monsqlize 2.0.6 → 3.0.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 -5
- package/MIGRATION.md +105 -0
- package/README.md +183 -195
- package/SECURITY.md +21 -0
- package/changelogs/README.md +16 -4
- package/changelogs/v2.0.7.md +63 -0
- package/changelogs/v3.0.0.md +97 -0
- package/dist/cjs/cli/data-task.cjs +17768 -0
- package/dist/cjs/index.cjs +12166 -5505
- package/dist/cjs/transaction/Transaction.cjs +151 -19
- package/dist/cjs/transaction/TransactionManager.cjs +152 -20
- package/dist/esm/index.mjs +12171 -5509
- package/dist/types/collection.d.mts +92 -13
- package/dist/types/collection.d.ts +92 -13
- package/dist/types/data-tasks.d.mts +221 -0
- package/dist/types/data-tasks.d.ts +221 -0
- package/dist/types/index.d.mts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/lock.d.mts +7 -4
- package/dist/types/lock.d.ts +7 -4
- package/dist/types/model.d.mts +46 -14
- package/dist/types/model.d.ts +46 -14
- package/dist/types/monsqlize.d.mts +130 -16
- package/dist/types/monsqlize.d.ts +130 -16
- package/dist/types/runtime.d.mts +14 -1
- package/dist/types/runtime.d.ts +14 -1
- package/dist/types/saga.d.mts +11 -6
- package/dist/types/saga.d.ts +11 -6
- package/dist/types/sync.d.mts +47 -1
- package/dist/types/sync.d.ts +47 -1
- package/dist/types/transaction.d.mts +8 -0
- package/dist/types/transaction.d.ts +8 -0
- package/package.json +26 -13
package/dist/types/runtime.d.ts
CHANGED
|
@@ -91,6 +91,10 @@ export interface MultiLevelCacheOptions {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
export type MultiLevelInvalidationMessage = {
|
|
94
|
+
type: 'del' | 'delete' | 'invalidateKey';
|
|
95
|
+
key: string;
|
|
96
|
+
ts: number;
|
|
97
|
+
} | {
|
|
94
98
|
type: 'delPattern';
|
|
95
99
|
pattern: string;
|
|
96
100
|
ts: number;
|
|
@@ -189,6 +193,7 @@ export type DistributedCacheInvalidatorStats = HubInvalidatorStats;
|
|
|
189
193
|
export declare class DistributedCacheInvalidator {
|
|
190
194
|
constructor(options: DistributedCacheInvalidatorOptions);
|
|
191
195
|
invalidate(pattern: string): Promise<void>;
|
|
196
|
+
invalidateKey(key: string): Promise<void>;
|
|
192
197
|
getStats(): HubInvalidatorStats;
|
|
193
198
|
close(): Promise<void>;
|
|
194
199
|
}
|
|
@@ -253,11 +258,19 @@ export interface FunctionCacheOptions extends HubFunctionCacheOptions {
|
|
|
253
258
|
defaultTTL?: number;
|
|
254
259
|
}
|
|
255
260
|
|
|
261
|
+
/**
|
|
262
|
+
* @deprecated Retained for v1 compatibility. Non-database function caching is no longer a recommended monSQLize feature path;
|
|
263
|
+
* use `cache-hub` directly or an application-owned cache layer for new generic function-cache usage.
|
|
264
|
+
*/
|
|
256
265
|
export declare function withCache<TArgs extends unknown[], TResult>(
|
|
257
266
|
fn: (...args: TArgs) => Promise<TResult>,
|
|
258
267
|
options?: WithCacheOptions<(...args: TArgs) => Promise<TResult>>,
|
|
259
268
|
): CachedFunction<TArgs, TResult>;
|
|
260
269
|
|
|
270
|
+
/**
|
|
271
|
+
* @deprecated Retained for v1 compatibility. Non-database function caching is no longer a recommended monSQLize feature path;
|
|
272
|
+
* use `cache-hub` directly or an application-owned cache layer for new generic function-cache usage.
|
|
273
|
+
*/
|
|
261
274
|
export declare class FunctionCache {
|
|
262
275
|
constructor(cacheOrDb?: CacheLike | { getCache(): CacheLike; }, options?: FunctionCacheOptions);
|
|
263
276
|
register(name: string, fn: (...args: unknown[]) => Promise<unknown>, options?: {
|
|
@@ -291,7 +304,7 @@ export declare class ModelInstance<TDocument = any> implements ModelInstanceCont
|
|
|
291
304
|
readonly dbName: string;
|
|
292
305
|
readonly poolName?: string;
|
|
293
306
|
readonly definition: ModelDefinition<TDocument>;
|
|
294
|
-
getNamespace(): { iid: string; type: 'mongodb'; db: string; collection: string; };
|
|
307
|
+
getNamespace(): { iid: string; type: 'mongodb'; db: string; collection: string; pool?: string; };
|
|
295
308
|
getRelations(): Record<string, RelationConfig>;
|
|
296
309
|
getEnums(): Record<string, string>;
|
|
297
310
|
raw(): unknown;
|
package/dist/types/saga.d.mts
CHANGED
|
@@ -14,6 +14,8 @@ export interface SagaContext {
|
|
|
14
14
|
readonly sagaId?: string;
|
|
15
15
|
/** Initial data passed to `executeSaga`. */
|
|
16
16
|
readonly data: any;
|
|
17
|
+
/** Abort signal for the current step. Timeout cancellation is cooperative; the step must observe this signal. */
|
|
18
|
+
readonly signal?: AbortSignal;
|
|
17
19
|
/** Store a value in the shared step context. */
|
|
18
20
|
set(key: string, value: any): void;
|
|
19
21
|
/** Retrieve a previously stored value. v1 compat — default generic is `any` to match v1 callers that did not annotate. */
|
|
@@ -52,7 +54,7 @@ export interface SagaStep {
|
|
|
52
54
|
compensate: (context: SagaContext, result?: any) => Promise<void>;
|
|
53
55
|
/** Per-step timeout in milliseconds (overrides Saga-level timeout). */
|
|
54
56
|
timeout?: number;
|
|
55
|
-
/** Number of retry attempts on step failure. */
|
|
57
|
+
/** Number of retry attempts on ordinary step failure. Timed-out attempts are never retried. */
|
|
56
58
|
retries?: number;
|
|
57
59
|
}
|
|
58
60
|
|
|
@@ -60,7 +62,7 @@ export interface SagaStep {
|
|
|
60
62
|
export interface SagaDefinition {
|
|
61
63
|
name: string;
|
|
62
64
|
steps: SagaStep[];
|
|
63
|
-
/**
|
|
65
|
+
/** Default timeout for each step in milliseconds; a step-level timeout overrides it. */
|
|
64
66
|
timeout?: number;
|
|
65
67
|
/** Whether to emit detailed execution logs. */
|
|
66
68
|
logging?: boolean;
|
|
@@ -125,14 +127,17 @@ export interface SagaStats {
|
|
|
125
127
|
compensationCount: number;
|
|
126
128
|
}
|
|
127
129
|
|
|
128
|
-
/**
|
|
130
|
+
/**
|
|
131
|
+
* Legacy-compatible in-process Saga orchestrator with compensation support.
|
|
132
|
+
* @deprecated Saga APIs are retained for compatibility. Prefer application/framework-level workflow orchestration.
|
|
133
|
+
*/
|
|
129
134
|
export declare class SagaOrchestrator {
|
|
130
135
|
constructor(options?: SagaOrchestratorOptions);
|
|
131
|
-
/**
|
|
136
|
+
/** @deprecated Saga APIs are retained for compatibility. Prefer application/framework-level workflow orchestration. */
|
|
132
137
|
define(definition: SagaDefinition): void;
|
|
133
|
-
/**
|
|
138
|
+
/** @deprecated Saga APIs are retained for compatibility. Prefer application/framework-level workflow orchestration. */
|
|
134
139
|
defineSaga(definition: SagaDefinition): Promise<SagaDefinition>;
|
|
135
|
-
/**
|
|
140
|
+
/** @deprecated Saga APIs are retained for compatibility. Prefer application/framework-level workflow orchestration. */
|
|
136
141
|
execute(name: string, data: any): Promise<SagaResult>;
|
|
137
142
|
/** Return the definition for a registered Saga by name. */
|
|
138
143
|
getSaga(name: string): SagaDefinition | undefined;
|
package/dist/types/saga.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ export interface SagaContext {
|
|
|
14
14
|
readonly sagaId?: string;
|
|
15
15
|
/** Initial data passed to `executeSaga`. */
|
|
16
16
|
readonly data: any;
|
|
17
|
+
/** Abort signal for the current step. Timeout cancellation is cooperative; the step must observe this signal. */
|
|
18
|
+
readonly signal?: AbortSignal;
|
|
17
19
|
/** Store a value in the shared step context. */
|
|
18
20
|
set(key: string, value: any): void;
|
|
19
21
|
/** Retrieve a previously stored value. v1 compat — default generic is `any` to match v1 callers that did not annotate. */
|
|
@@ -52,7 +54,7 @@ export interface SagaStep {
|
|
|
52
54
|
compensate: (context: SagaContext, result?: any) => Promise<void>;
|
|
53
55
|
/** Per-step timeout in milliseconds (overrides Saga-level timeout). */
|
|
54
56
|
timeout?: number;
|
|
55
|
-
/** Number of retry attempts on step failure. */
|
|
57
|
+
/** Number of retry attempts on ordinary step failure. Timed-out attempts are never retried. */
|
|
56
58
|
retries?: number;
|
|
57
59
|
}
|
|
58
60
|
|
|
@@ -60,7 +62,7 @@ export interface SagaStep {
|
|
|
60
62
|
export interface SagaDefinition {
|
|
61
63
|
name: string;
|
|
62
64
|
steps: SagaStep[];
|
|
63
|
-
/**
|
|
65
|
+
/** Default timeout for each step in milliseconds; a step-level timeout overrides it. */
|
|
64
66
|
timeout?: number;
|
|
65
67
|
/** Whether to emit detailed execution logs. */
|
|
66
68
|
logging?: boolean;
|
|
@@ -125,14 +127,17 @@ export interface SagaStats {
|
|
|
125
127
|
compensationCount: number;
|
|
126
128
|
}
|
|
127
129
|
|
|
128
|
-
/**
|
|
130
|
+
/**
|
|
131
|
+
* Legacy-compatible in-process Saga orchestrator with compensation support.
|
|
132
|
+
* @deprecated Saga APIs are retained for compatibility. Prefer application/framework-level workflow orchestration.
|
|
133
|
+
*/
|
|
129
134
|
export declare class SagaOrchestrator {
|
|
130
135
|
constructor(options?: SagaOrchestratorOptions);
|
|
131
|
-
/**
|
|
136
|
+
/** @deprecated Saga APIs are retained for compatibility. Prefer application/framework-level workflow orchestration. */
|
|
132
137
|
define(definition: SagaDefinition): void;
|
|
133
|
-
/**
|
|
138
|
+
/** @deprecated Saga APIs are retained for compatibility. Prefer application/framework-level workflow orchestration. */
|
|
134
139
|
defineSaga(definition: SagaDefinition): Promise<SagaDefinition>;
|
|
135
|
-
/**
|
|
140
|
+
/** @deprecated Saga APIs are retained for compatibility. Prefer application/framework-level workflow orchestration. */
|
|
136
141
|
execute(name: string, data: any): Promise<SagaResult>;
|
|
137
142
|
/** Return the definition for a registered Saga by name. */
|
|
138
143
|
getSaga(name: string): SagaDefinition | undefined;
|
package/dist/types/sync.d.mts
CHANGED
|
@@ -29,13 +29,42 @@ export interface SyncTargetConfig {
|
|
|
29
29
|
uri?: string;
|
|
30
30
|
pool?: string;
|
|
31
31
|
databaseName?: string;
|
|
32
|
+
/** Collections handled by this target; omit or pass ['*'] to handle all collections. */
|
|
32
33
|
collections?: string[];
|
|
33
34
|
options?: MongoClientOptions;
|
|
34
|
-
apply?: (event: SyncChangeEvent, document: Record<string, unknown> | undefined) => Promise<void>;
|
|
35
|
+
apply?: (event: SyncChangeEvent, document: Record<string, unknown> | undefined, context?: SyncTargetApplyContext) => Promise<void>;
|
|
35
36
|
/** Target node health check configuration. @since v1.0.8 */
|
|
36
37
|
healthCheck?: SyncTargetHealthCheckConfig;
|
|
37
38
|
}
|
|
38
39
|
|
|
40
|
+
export interface SyncTargetApplyContext {
|
|
41
|
+
targetName: string;
|
|
42
|
+
idempotencyKey?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface SyncIdempotencyStoreLike {
|
|
46
|
+
get(key: string): Promise<unknown> | unknown;
|
|
47
|
+
set(key: string, value: unknown, ttl?: number): Promise<unknown> | unknown;
|
|
48
|
+
del?(key: string): Promise<unknown> | unknown;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export type SyncIdempotencyMarkMode = 'success' | 'start';
|
|
52
|
+
|
|
53
|
+
export interface SyncIdempotencyConfig {
|
|
54
|
+
/** Enable runtime per-target idempotency checks. Defaults to false. */
|
|
55
|
+
enabled?: boolean;
|
|
56
|
+
/** Optional durable store; when omitted, an in-memory store is used. */
|
|
57
|
+
store?: SyncIdempotencyStoreLike;
|
|
58
|
+
/** Cache/store key prefix. Defaults to monsqlize:sync:idempotency. */
|
|
59
|
+
keyPrefix?: string;
|
|
60
|
+
/** Marker TTL in milliseconds. Store implementations may ignore it. */
|
|
61
|
+
ttl?: number;
|
|
62
|
+
/** Mark after target success by default; start mode requires target-owned recovery for post-mark failures. */
|
|
63
|
+
markMode?: SyncIdempotencyMarkMode;
|
|
64
|
+
/** Custom event key builder. Return null/undefined to disable idempotency for that event. */
|
|
65
|
+
keyBuilder?: (event: SyncChangeEvent, targetName: string) => string | null | undefined;
|
|
66
|
+
}
|
|
67
|
+
|
|
39
68
|
export interface ResumeTokenRedisLike {
|
|
40
69
|
get(key: string): Promise<string | null> | string | null;
|
|
41
70
|
set(key: string, value: string): Promise<unknown> | unknown;
|
|
@@ -47,14 +76,25 @@ export interface ResumeTokenConfig {
|
|
|
47
76
|
path?: string;
|
|
48
77
|
redis?: ResumeTokenRedisLike;
|
|
49
78
|
key?: string;
|
|
79
|
+
/** Throw when a stored resume token cannot be loaded or parsed. Defaults to strictSave. */
|
|
80
|
+
strictLoad?: boolean;
|
|
81
|
+
/** Throw when resume-token persistence fails. Defaults to true for reliable CDC. */
|
|
82
|
+
strictSave?: boolean;
|
|
83
|
+
/** Number of retry attempts after a failed token save. Defaults to 0. */
|
|
84
|
+
saveRetries?: number;
|
|
85
|
+
/** Delay between token-save retries in milliseconds. Defaults to 100. */
|
|
86
|
+
saveRetryDelayMs?: number;
|
|
50
87
|
}
|
|
51
88
|
|
|
52
89
|
export interface SyncConfig {
|
|
53
90
|
enabled: boolean;
|
|
54
91
|
targets: SyncTargetConfig[];
|
|
92
|
+
/** Source collections watched by the manager; omit or pass ['*'] to watch all collections. */
|
|
55
93
|
collections?: string[];
|
|
56
94
|
resumeToken?: ResumeTokenConfig;
|
|
57
95
|
filter?: (event: SyncChangeEvent) => boolean;
|
|
96
|
+
/** Optional per-target idempotency gate for replay protection. */
|
|
97
|
+
idempotency?: SyncIdempotencyConfig;
|
|
58
98
|
/**
|
|
59
99
|
* Transform a change-stream document before forwarding to sync targets.
|
|
60
100
|
* v1 form took a single argument (`doc => ...`); v2 added a second `event` argument.
|
|
@@ -70,10 +110,16 @@ export interface SyncStats {
|
|
|
70
110
|
errorCount: number;
|
|
71
111
|
startTime: Date | null;
|
|
72
112
|
lastEventTime: Date | null;
|
|
113
|
+
lastError: Error | null;
|
|
114
|
+
tokenSaveErrorCount: number;
|
|
115
|
+
lastTokenSaveError: Error | null;
|
|
116
|
+
duplicateEventCount: number;
|
|
117
|
+
duplicateTargetCount: number;
|
|
73
118
|
targets: Array<{
|
|
74
119
|
name: string;
|
|
75
120
|
syncCount: number;
|
|
76
121
|
errorCount: number;
|
|
122
|
+
duplicateCount: number;
|
|
77
123
|
lastSyncTime: Date | null;
|
|
78
124
|
lastError: Error | null;
|
|
79
125
|
successRate: string;
|
package/dist/types/sync.d.ts
CHANGED
|
@@ -29,13 +29,42 @@ export interface SyncTargetConfig {
|
|
|
29
29
|
uri?: string;
|
|
30
30
|
pool?: string;
|
|
31
31
|
databaseName?: string;
|
|
32
|
+
/** Collections handled by this target; omit or pass ['*'] to handle all collections. */
|
|
32
33
|
collections?: string[];
|
|
33
34
|
options?: MongoClientOptions;
|
|
34
|
-
apply?: (event: SyncChangeEvent, document: Record<string, unknown> | undefined) => Promise<void>;
|
|
35
|
+
apply?: (event: SyncChangeEvent, document: Record<string, unknown> | undefined, context?: SyncTargetApplyContext) => Promise<void>;
|
|
35
36
|
/** Target node health check configuration. @since v1.0.8 */
|
|
36
37
|
healthCheck?: SyncTargetHealthCheckConfig;
|
|
37
38
|
}
|
|
38
39
|
|
|
40
|
+
export interface SyncTargetApplyContext {
|
|
41
|
+
targetName: string;
|
|
42
|
+
idempotencyKey?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface SyncIdempotencyStoreLike {
|
|
46
|
+
get(key: string): Promise<unknown> | unknown;
|
|
47
|
+
set(key: string, value: unknown, ttl?: number): Promise<unknown> | unknown;
|
|
48
|
+
del?(key: string): Promise<unknown> | unknown;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export type SyncIdempotencyMarkMode = 'success' | 'start';
|
|
52
|
+
|
|
53
|
+
export interface SyncIdempotencyConfig {
|
|
54
|
+
/** Enable runtime per-target idempotency checks. Defaults to false. */
|
|
55
|
+
enabled?: boolean;
|
|
56
|
+
/** Optional durable store; when omitted, an in-memory store is used. */
|
|
57
|
+
store?: SyncIdempotencyStoreLike;
|
|
58
|
+
/** Cache/store key prefix. Defaults to monsqlize:sync:idempotency. */
|
|
59
|
+
keyPrefix?: string;
|
|
60
|
+
/** Marker TTL in milliseconds. Store implementations may ignore it. */
|
|
61
|
+
ttl?: number;
|
|
62
|
+
/** Mark after target success by default; start mode requires target-owned recovery for post-mark failures. */
|
|
63
|
+
markMode?: SyncIdempotencyMarkMode;
|
|
64
|
+
/** Custom event key builder. Return null/undefined to disable idempotency for that event. */
|
|
65
|
+
keyBuilder?: (event: SyncChangeEvent, targetName: string) => string | null | undefined;
|
|
66
|
+
}
|
|
67
|
+
|
|
39
68
|
export interface ResumeTokenRedisLike {
|
|
40
69
|
get(key: string): Promise<string | null> | string | null;
|
|
41
70
|
set(key: string, value: string): Promise<unknown> | unknown;
|
|
@@ -47,14 +76,25 @@ export interface ResumeTokenConfig {
|
|
|
47
76
|
path?: string;
|
|
48
77
|
redis?: ResumeTokenRedisLike;
|
|
49
78
|
key?: string;
|
|
79
|
+
/** Throw when a stored resume token cannot be loaded or parsed. Defaults to strictSave. */
|
|
80
|
+
strictLoad?: boolean;
|
|
81
|
+
/** Throw when resume-token persistence fails. Defaults to true for reliable CDC. */
|
|
82
|
+
strictSave?: boolean;
|
|
83
|
+
/** Number of retry attempts after a failed token save. Defaults to 0. */
|
|
84
|
+
saveRetries?: number;
|
|
85
|
+
/** Delay between token-save retries in milliseconds. Defaults to 100. */
|
|
86
|
+
saveRetryDelayMs?: number;
|
|
50
87
|
}
|
|
51
88
|
|
|
52
89
|
export interface SyncConfig {
|
|
53
90
|
enabled: boolean;
|
|
54
91
|
targets: SyncTargetConfig[];
|
|
92
|
+
/** Source collections watched by the manager; omit or pass ['*'] to watch all collections. */
|
|
55
93
|
collections?: string[];
|
|
56
94
|
resumeToken?: ResumeTokenConfig;
|
|
57
95
|
filter?: (event: SyncChangeEvent) => boolean;
|
|
96
|
+
/** Optional per-target idempotency gate for replay protection. */
|
|
97
|
+
idempotency?: SyncIdempotencyConfig;
|
|
58
98
|
/**
|
|
59
99
|
* Transform a change-stream document before forwarding to sync targets.
|
|
60
100
|
* v1 form took a single argument (`doc => ...`); v2 added a second `event` argument.
|
|
@@ -70,10 +110,16 @@ export interface SyncStats {
|
|
|
70
110
|
errorCount: number;
|
|
71
111
|
startTime: Date | null;
|
|
72
112
|
lastEventTime: Date | null;
|
|
113
|
+
lastError: Error | null;
|
|
114
|
+
tokenSaveErrorCount: number;
|
|
115
|
+
lastTokenSaveError: Error | null;
|
|
116
|
+
duplicateEventCount: number;
|
|
117
|
+
duplicateTargetCount: number;
|
|
73
118
|
targets: Array<{
|
|
74
119
|
name: string;
|
|
75
120
|
syncCount: number;
|
|
76
121
|
errorCount: number;
|
|
122
|
+
duplicateCount: number;
|
|
77
123
|
lastSyncTime: Date | null;
|
|
78
124
|
lastError: Error | null;
|
|
79
125
|
successRate: string;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { CacheLike } from './runtime.mjs';
|
|
2
2
|
import type { LoggerLike } from './base.mjs';
|
|
3
3
|
|
|
4
|
+
export type CacheInvalidationIntent =
|
|
5
|
+
| { type: 'pattern'; value: string }
|
|
6
|
+
| { type: 'key'; value: string };
|
|
7
|
+
|
|
4
8
|
/** Minimal MongoDB session contract used by the transaction layer. */
|
|
5
9
|
export interface MongoSession {
|
|
6
10
|
id: unknown;
|
|
@@ -99,6 +103,10 @@ export declare class Transaction {
|
|
|
99
103
|
end(): Promise<void>;
|
|
100
104
|
/** Record a cache-invalidation pattern to be replayed on commit. */
|
|
101
105
|
recordInvalidation(pattern: string): Promise<void>;
|
|
106
|
+
/** Record an exact cache key or pattern invalidation intent to be replayed on commit. */
|
|
107
|
+
recordCacheInvalidation(intent: CacheInvalidationIntent): Promise<void>;
|
|
108
|
+
/** @internal Record that a MongoDB write helper ran in this transaction. */
|
|
109
|
+
recordWriteOperation(): void;
|
|
102
110
|
/** Return the elapsed duration in milliseconds since the transaction started. */
|
|
103
111
|
getDuration(): number;
|
|
104
112
|
/** Return a snapshot of the transaction's current state and metadata. */
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { CacheLike } from './runtime';
|
|
2
2
|
import type { LoggerLike } from './base';
|
|
3
3
|
|
|
4
|
+
export type CacheInvalidationIntent =
|
|
5
|
+
| { type: 'pattern'; value: string }
|
|
6
|
+
| { type: 'key'; value: string };
|
|
7
|
+
|
|
4
8
|
/** Minimal MongoDB session contract used by the transaction layer. */
|
|
5
9
|
export interface MongoSession {
|
|
6
10
|
id: unknown;
|
|
@@ -99,6 +103,10 @@ export declare class Transaction {
|
|
|
99
103
|
end(): Promise<void>;
|
|
100
104
|
/** Record a cache-invalidation pattern to be replayed on commit. */
|
|
101
105
|
recordInvalidation(pattern: string): Promise<void>;
|
|
106
|
+
/** Record an exact cache key or pattern invalidation intent to be replayed on commit. */
|
|
107
|
+
recordCacheInvalidation(intent: CacheInvalidationIntent): Promise<void>;
|
|
108
|
+
/** @internal Record that a MongoDB write helper ran in this transaction. */
|
|
109
|
+
recordWriteOperation(): void;
|
|
102
110
|
/** Return the elapsed duration in milliseconds since the transaction started. */
|
|
103
111
|
getDuration(): number;
|
|
104
112
|
/** Return a snapshot of the transaction's current state and metadata. */
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "monsqlize",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "TypeScript
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"description": "TypeScript production data runtime layer for MongoDB today, with cache, transactions, pools, models, sync, and observability",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./dist/cjs/index.cjs",
|
|
7
7
|
"module": "./dist/esm/index.mjs",
|
|
8
8
|
"types": "./dist/types/index.d.ts",
|
|
9
|
+
"bin": {
|
|
10
|
+
"monsqlize": "dist/cjs/cli/data-task.cjs"
|
|
11
|
+
},
|
|
9
12
|
"exports": {
|
|
10
13
|
".": {
|
|
11
14
|
"types": {
|
|
@@ -22,6 +25,8 @@
|
|
|
22
25
|
"dist/**/*.mjs",
|
|
23
26
|
"dist/**/*.d.ts",
|
|
24
27
|
"dist/**/*.d.mts",
|
|
28
|
+
"changelogs/v3.0.0.md",
|
|
29
|
+
"changelogs/v2.0.7.md",
|
|
25
30
|
"changelogs/v2.0.6.md",
|
|
26
31
|
"changelogs/v2.0.5.md",
|
|
27
32
|
"changelogs/v2.0.4.md",
|
|
@@ -30,20 +35,25 @@
|
|
|
30
35
|
"changelogs/v2.0.1.md",
|
|
31
36
|
"changelogs/v2.0.0.md",
|
|
32
37
|
"README.md",
|
|
38
|
+
"MIGRATION.md",
|
|
39
|
+
"SECURITY.md",
|
|
33
40
|
"LICENSE",
|
|
34
41
|
"CHANGELOG.md"
|
|
35
42
|
],
|
|
36
43
|
"keywords": [
|
|
37
44
|
"mongodb",
|
|
38
45
|
"database",
|
|
39
|
-
"
|
|
46
|
+
"data-runtime",
|
|
47
|
+
"database-runtime",
|
|
40
48
|
"cache",
|
|
41
49
|
"transaction",
|
|
42
50
|
"distributed",
|
|
51
|
+
"cache-invalidation",
|
|
43
52
|
"pagination",
|
|
44
53
|
"performance",
|
|
45
54
|
"mongodb-driver",
|
|
46
55
|
"nosql",
|
|
56
|
+
"typescript",
|
|
47
57
|
"query-builder",
|
|
48
58
|
"api"
|
|
49
59
|
],
|
|
@@ -65,7 +75,7 @@
|
|
|
65
75
|
"mongodbMemoryServer": {
|
|
66
76
|
"downloadDir": ".cache/mongodb-memory-server/binaries",
|
|
67
77
|
"preferGlobalPath": "false",
|
|
68
|
-
"version": "7.0.
|
|
78
|
+
"version": "7.0.37"
|
|
69
79
|
}
|
|
70
80
|
},
|
|
71
81
|
"engines": {
|
|
@@ -85,24 +95,27 @@
|
|
|
85
95
|
"test:real-env:private": "node scripts/validation/run-private-real-env-checks.cjs",
|
|
86
96
|
"test:examples": "npm run build && tsc -p tsconfig.examples.json && node scripts/run-examples.cjs",
|
|
87
97
|
"test:performance": "npm run build && npm run build:tests && node .generated/test-dist/test/performance/baselines/function-cache.benchmark.js",
|
|
88
|
-
"test:unit": "npm run build && npm run build:tests && node
|
|
98
|
+
"test:unit": "npm run build && npm run build:tests && node test/run-tests.cjs unit",
|
|
89
99
|
"test:integration": "npm run build && npm run build:tests && node --test --test-concurrency=1 .generated/test-dist/test/integration/cache/cache.test.js .generated/test-dist/test/integration/cache/cache-behavior.test.js .generated/test-dist/test/integration/mongodb/connect.test.js .generated/test-dist/test/integration/mongodb/queries.test.js .generated/test-dist/test/integration/mongodb/management.test.js .generated/test-dist/test/integration/mongodb/writes-batch.test.js .generated/test-dist/test/integration/mongodb/find.test.js .generated/test-dist/test/integration/mongodb/find-one.test.js .generated/test-dist/test/integration/mongodb/find-page.test.js .generated/test-dist/test/integration/mongodb/aggregate.test.js .generated/test-dist/test/integration/mongodb/chaining.test.js .generated/test-dist/test/integration/mongodb/insert.test.js .generated/test-dist/test/integration/mongodb/update.test.js .generated/test-dist/test/integration/mongodb/delete.test.js .generated/test-dist/test/integration/mongodb/update-pipeline.test.js .generated/test-dist/test/integration/model/model-features.test.js .generated/test-dist/test/integration/transaction/transaction.test.js .generated/test-dist/test/integration/pool/pool.test.js .generated/test-dist/test/integration/pool/pool-behavior.test.js .generated/test-dist/test/integration/watch/watch-native.test.js .generated/test-dist/test/integration/runtime/runtime-core-regression.test.js .generated/test-dist/test/integration/sync/sync.test.js .generated/test-dist/test/integration/slow-query-log/slow-query-log.test.js .generated/test-dist/test/integration/model/model-crud-extended.test.js .generated/test-dist/test/integration/mongodb/management-complete.test.js .generated/test-dist/test/integration/runtime/runtime-methods-extended.test.js .generated/test-dist/test/integration/mongodb/find-page-advanced.test.js",
|
|
100
|
+
"test:data-tasks:integration": "npm run build && npm run build:tests && node test/run-tests.cjs data-tasks-integration",
|
|
101
|
+
"test:data-task-cli": "npm run build && npm run build:tests && node test/run-tests.cjs data-task-cli",
|
|
102
|
+
"test:pack-install": "npm run build && node scripts/pack-install-smoke.cjs",
|
|
90
103
|
"test:refactor-guard": "npm run build && npm run build:tests && node --test --test-concurrency=1 .generated/test-dist/test/compatibility/exports/exports.test.js .generated/test-dist/test/integration/model/model-features.test.js .generated/test-dist/test/integration/runtime/runtime-core-regression.test.js .generated/test-dist/test/integration/sync/sync.test.js",
|
|
91
104
|
"test:refactor-guard:cache": "npm run build && npm run build:tests && node --test .generated/test-dist/test/unit/cache/cache-refactor-guard.test.js",
|
|
92
|
-
"test:coverage": "
|
|
105
|
+
"test:coverage": "node scripts/run-coverage.cjs",
|
|
93
106
|
"test:audit": "npm audit --omit=dev --registry=https://registry.npmjs.org/",
|
|
94
107
|
"test": "npm run build && npm run build:tests && node test/run-tests.cjs",
|
|
95
|
-
"type-check": "npm run build && tsc -p tsconfig.json --noEmit && tsd --files test/types/root-import.test-d.ts --files test/types/cache-usage.test-d.ts --files test/types/model-usage.test-d.ts --files test/types/pool-usage.test-d.ts --files test/types/sync-usage.test-d.ts --files test/types/slow-query-log-usage.test-d.ts --files test/types/saga-usage.test-d.ts",
|
|
108
|
+
"type-check": "npm run build && tsc -p tsconfig.json --noEmit && tsd --files test/types/root-import.test-d.ts --files test/types/cache-usage.test-d.ts --files test/types/model-usage.test-d.ts --files test/types/pool-usage.test-d.ts --files test/types/sync-usage.test-d.ts --files test/types/slow-query-log-usage.test-d.ts --files test/types/saga-usage.test-d.ts --files test/types/data-tasks-usage.test-d.ts",
|
|
96
109
|
"check:test-language": "node scripts/check-test-language.cjs",
|
|
97
110
|
"check:docs-examples": "node scripts/validation/check-doc-example-matrix.cjs",
|
|
111
|
+
"check:release-candidate": "node scripts/check-release-candidate.cjs",
|
|
98
112
|
"verify:fast": "npm run lint && npm run check:docs-examples && npm run type-check && npm run check:sizes:strict && npm run test:runtime && npm run test:compatibility && npm run test:refactor-guard && npm run test:refactor-guard:cache",
|
|
99
113
|
"verify:full": "npm run lint && npm run check:docs-examples && npm run type-check && npm run check:sizes:strict && npm run test:examples && npm run test:server-matrix",
|
|
100
114
|
"verify:release": "npm run verify:full && npm run test:real-env:private",
|
|
101
115
|
"verify": "npm run verify:full",
|
|
102
116
|
"release:preflight": "node scripts/release-preflight.cjs",
|
|
103
117
|
"prepublishOnly": "npm run release:preflight",
|
|
104
|
-
"release:publish": "npm run release:preflight && npm publish --ignore-scripts"
|
|
105
|
-
"postpublish": "echo 'Publish succeeded. Create GitHub Release: https://github.com/vextjs/monSQLize/releases/new?tag=v'$npm_package_version"
|
|
118
|
+
"release:publish": "npm run release:preflight && npm publish --ignore-scripts"
|
|
106
119
|
},
|
|
107
120
|
"devDependencies": {
|
|
108
121
|
"@eslint/js": "9.39.4",
|
|
@@ -110,9 +123,9 @@
|
|
|
110
123
|
"@types/semver": "7.7.1",
|
|
111
124
|
"c8": "11.0.0",
|
|
112
125
|
"chai": "6.2.2",
|
|
113
|
-
"esbuild": "0.
|
|
126
|
+
"esbuild": "0.28.1",
|
|
114
127
|
"eslint": "9.39.4",
|
|
115
|
-
"mongodb-memory-server": "
|
|
128
|
+
"mongodb-memory-server": "10.4.3",
|
|
116
129
|
"sinon": "22.0.0",
|
|
117
130
|
"tsd": "0.33.0",
|
|
118
131
|
"typescript": "5.9.3"
|
|
@@ -120,9 +133,9 @@
|
|
|
120
133
|
"dependencies": {
|
|
121
134
|
"async-lock": "1.4.1",
|
|
122
135
|
"cache-hub": "2.2.4",
|
|
123
|
-
"ioredis": "5.
|
|
136
|
+
"ioredis": "5.11.1",
|
|
124
137
|
"mongodb": "6.21.0",
|
|
125
|
-
"schema-dsl": "2.
|
|
138
|
+
"schema-dsl": "2.1.6",
|
|
126
139
|
"ssh2": "1.17.0"
|
|
127
140
|
}
|
|
128
141
|
}
|