monsqlize 2.0.0 → 2.0.2
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 +461 -458
- package/README.md +7 -2
- package/changelogs/README.md +141 -138
- package/changelogs/v2.0.0.md +164 -164
- package/changelogs/v2.0.1.md +39 -0
- package/changelogs/v2.0.2.md +22 -0
- package/dist/cjs/index.cjs +329 -141
- package/dist/esm/index.mjs +329 -141
- package/dist/types/base.d.ts +81 -81
- package/dist/types/collection.d.ts +973 -973
- package/dist/types/expression.d.ts +115 -115
- package/dist/types/index.d.ts +23 -23
- package/dist/types/model.d.ts +489 -485
- package/dist/types/mongodb.d.ts +49 -49
- package/dist/types/monsqlize.d.ts +429 -429
- package/dist/types/pool.d.ts +84 -84
- package/dist/types/runtime.d.ts +315 -315
- package/dist/types/saga.d.ts +121 -121
- package/dist/types/slow-query-log.d.ts +126 -126
- package/dist/types/sync.d.ts +103 -103
- package/package.json +101 -99
package/dist/types/pool.d.ts
CHANGED
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
import type { MongoClientOptions } from 'mongodb';
|
|
2
|
-
|
|
3
|
-
import type { LoggerLike } from './base';
|
|
4
|
-
|
|
5
|
-
export type PoolRole = 'primary' | 'secondary' | 'analytics' | 'custom';
|
|
6
|
-
export type PoolStrategy = 'auto' | 'roundRobin' | 'weighted' | 'leastConnections' | 'manual';
|
|
7
|
-
export type FallbackStrategy = 'error' | 'readonly' | 'primary' | 'secondary';
|
|
8
|
-
|
|
9
|
-
export interface PoolConfig {
|
|
10
|
-
name: string;
|
|
11
|
-
uri: string;
|
|
12
|
-
role?: PoolRole;
|
|
13
|
-
weight?: number;
|
|
14
|
-
tags?: string[];
|
|
15
|
-
options?: MongoClientOptions;
|
|
16
|
-
healthCheck?: {
|
|
17
|
-
enabled?: boolean;
|
|
18
|
-
interval?: number;
|
|
19
|
-
timeout?: number;
|
|
20
|
-
retries?: number;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface ConnectionPoolManagerOptions {
|
|
25
|
-
pools?: PoolConfig[];
|
|
26
|
-
maxPoolsCount?: number;
|
|
27
|
-
poolStrategy?: PoolStrategy;
|
|
28
|
-
poolFallback?: boolean | {
|
|
29
|
-
enabled?: boolean;
|
|
30
|
-
fallbackStrategy?: FallbackStrategy;
|
|
31
|
-
retryDelay?: number;
|
|
32
|
-
maxRetries?: number;
|
|
33
|
-
};
|
|
34
|
-
logger?: LoggerLike | null;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface PoolHealthStatus {
|
|
38
|
-
status: 'up' | 'down' | 'degraded';
|
|
39
|
-
consecutiveFailures: number;
|
|
40
|
-
lastCheckTime: Date | null;
|
|
41
|
-
lastError: Error | null;
|
|
42
|
-
uptime: number;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export interface PoolStats {
|
|
46
|
-
name: string;
|
|
47
|
-
/** Current active connections (reported by MongoDB driver). v2 extension — v1 fixtures may omit. */
|
|
48
|
-
connections?: number;
|
|
49
|
-
/** Available (idle) connections in the pool. v2 extension — v1 fixtures may omit. */
|
|
50
|
-
available?: number;
|
|
51
|
-
/** Requests currently waiting for a connection. v2 extension — v1 fixtures may omit. */
|
|
52
|
-
waiting?: number;
|
|
53
|
-
/** Health status from the last health check. v2 extension — v1 fixtures may omit. */
|
|
54
|
-
status?: 'up' | 'down' | 'degraded' | 'unknown';
|
|
55
|
-
totalRequests: number;
|
|
56
|
-
successCount: number;
|
|
57
|
-
errorCount: number;
|
|
58
|
-
avgResponseTime: number;
|
|
59
|
-
minResponseTime: number;
|
|
60
|
-
maxResponseTime: number;
|
|
61
|
-
errorRate: number;
|
|
62
|
-
lastRequestTime: Date | null;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export declare class ConnectionPoolManager {
|
|
66
|
-
constructor(options?: ConnectionPoolManagerOptions);
|
|
67
|
-
addPool(config: PoolConfig): Promise<void>;
|
|
68
|
-
removePool(name: string): Promise<void>;
|
|
69
|
-
getPool(name: string): unknown | null;
|
|
70
|
-
getPoolNames(): string[];
|
|
71
|
-
selectPool(operation: string, options?: { pool?: string; tags?: string[]; databaseName?: string; }): {
|
|
72
|
-
name: string;
|
|
73
|
-
client: unknown;
|
|
74
|
-
db: (name?: string) => unknown;
|
|
75
|
-
collection: (databaseName: string | undefined, collectionName: string) => unknown;
|
|
76
|
-
};
|
|
77
|
-
startHealthCheck(name?: string): void;
|
|
78
|
-
stopHealthCheck(name?: string): void;
|
|
79
|
-
getPoolHealth(): Map<string, PoolHealthStatus>;
|
|
80
|
-
getHealthStatus(): Record<string, PoolHealthStatus>;
|
|
81
|
-
getPoolStats(): Record<string, PoolStats>;
|
|
82
|
-
close(): Promise<void>;
|
|
83
|
-
}
|
|
84
|
-
|
|
1
|
+
import type { MongoClientOptions } from 'mongodb';
|
|
2
|
+
|
|
3
|
+
import type { LoggerLike } from './base';
|
|
4
|
+
|
|
5
|
+
export type PoolRole = 'primary' | 'secondary' | 'analytics' | 'custom';
|
|
6
|
+
export type PoolStrategy = 'auto' | 'roundRobin' | 'weighted' | 'leastConnections' | 'manual';
|
|
7
|
+
export type FallbackStrategy = 'error' | 'readonly' | 'primary' | 'secondary';
|
|
8
|
+
|
|
9
|
+
export interface PoolConfig {
|
|
10
|
+
name: string;
|
|
11
|
+
uri: string;
|
|
12
|
+
role?: PoolRole;
|
|
13
|
+
weight?: number;
|
|
14
|
+
tags?: string[];
|
|
15
|
+
options?: MongoClientOptions;
|
|
16
|
+
healthCheck?: {
|
|
17
|
+
enabled?: boolean;
|
|
18
|
+
interval?: number;
|
|
19
|
+
timeout?: number;
|
|
20
|
+
retries?: number;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface ConnectionPoolManagerOptions {
|
|
25
|
+
pools?: PoolConfig[];
|
|
26
|
+
maxPoolsCount?: number;
|
|
27
|
+
poolStrategy?: PoolStrategy;
|
|
28
|
+
poolFallback?: boolean | {
|
|
29
|
+
enabled?: boolean;
|
|
30
|
+
fallbackStrategy?: FallbackStrategy;
|
|
31
|
+
retryDelay?: number;
|
|
32
|
+
maxRetries?: number;
|
|
33
|
+
};
|
|
34
|
+
logger?: LoggerLike | null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface PoolHealthStatus {
|
|
38
|
+
status: 'up' | 'down' | 'degraded';
|
|
39
|
+
consecutiveFailures: number;
|
|
40
|
+
lastCheckTime: Date | null;
|
|
41
|
+
lastError: Error | null;
|
|
42
|
+
uptime: number;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface PoolStats {
|
|
46
|
+
name: string;
|
|
47
|
+
/** Current active connections (reported by MongoDB driver). v2 extension — v1 fixtures may omit. */
|
|
48
|
+
connections?: number;
|
|
49
|
+
/** Available (idle) connections in the pool. v2 extension — v1 fixtures may omit. */
|
|
50
|
+
available?: number;
|
|
51
|
+
/** Requests currently waiting for a connection. v2 extension — v1 fixtures may omit. */
|
|
52
|
+
waiting?: number;
|
|
53
|
+
/** Health status from the last health check. v2 extension — v1 fixtures may omit. */
|
|
54
|
+
status?: 'up' | 'down' | 'degraded' | 'unknown';
|
|
55
|
+
totalRequests: number;
|
|
56
|
+
successCount: number;
|
|
57
|
+
errorCount: number;
|
|
58
|
+
avgResponseTime: number;
|
|
59
|
+
minResponseTime: number;
|
|
60
|
+
maxResponseTime: number;
|
|
61
|
+
errorRate: number;
|
|
62
|
+
lastRequestTime: Date | null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export declare class ConnectionPoolManager {
|
|
66
|
+
constructor(options?: ConnectionPoolManagerOptions);
|
|
67
|
+
addPool(config: PoolConfig): Promise<void>;
|
|
68
|
+
removePool(name: string): Promise<void>;
|
|
69
|
+
getPool(name: string): unknown | null;
|
|
70
|
+
getPoolNames(): string[];
|
|
71
|
+
selectPool(operation: string, options?: { pool?: string; tags?: string[]; databaseName?: string; }): {
|
|
72
|
+
name: string;
|
|
73
|
+
client: unknown;
|
|
74
|
+
db: (name?: string) => unknown;
|
|
75
|
+
collection: (databaseName: string | undefined, collectionName: string) => unknown;
|
|
76
|
+
};
|
|
77
|
+
startHealthCheck(name?: string): void;
|
|
78
|
+
stopHealthCheck(name?: string): void;
|
|
79
|
+
getPoolHealth(): Map<string, PoolHealthStatus>;
|
|
80
|
+
getHealthStatus(): Record<string, PoolHealthStatus>;
|
|
81
|
+
getPoolStats(): Record<string, PoolStats>;
|
|
82
|
+
close(): Promise<void>;
|
|
83
|
+
}
|
|
84
|
+
|