-
Notifications
You must be signed in to change notification settings - Fork 192
/
Copy pathindex.d.ts
146 lines (134 loc) · 3.69 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
import type Collection from 'mongodb-collection-model';
import type { DataService } from 'mongodb-data-service';
import type { Collection as DatabaseCollection } from 'mongodb-database-model';
import Database from 'mongodb-database-model';
import { CollectionCollection } from 'mongodb-collection-model';
declare const ServerType: {
humanize(serverType: string): string;
isWritable(serverType: string): boolean;
STANDALONE: string;
MONGOS: string;
POSSIBLE_PRIMARY: string;
RS_PRIMARY: string;
RS_SECONDARY: string;
RS_ARBITER: string;
RS_OTHER: string;
RS_GHOST: string;
UNKNOWN: string;
SERVER_TYPES: string;
WRITABLE_SERVER_TYPES: string;
};
declare const TopologyType: {
humanize(topologyType: string): string;
isWritable(topologyType: string): boolean;
isReadable(topologyType: string, readPreference: string): boolean;
SINGLE: string;
REPLICA_SET_NO_PRIMARY: string;
REPLICA_SET_WITH_PRIMARY: string;
SHARDED: string;
LOAD_BALANCED: string;
UNKNOWN: string;
TOPOLOGY_TYPES: string;
WRITABLE_TOPOLOGY_TYPES: string;
};
interface AuthInfo {
user: unknown | null;
roles: unknown[] | null;
privileges: unknown[] | null;
}
interface HostInfo {
arch: string;
cpu_cores: number;
cpu_frequency: number;
memory_bits: number;
os: string;
os_family: string;
kernel_version: string;
kernel_version_string: string;
}
interface BuildInfo {
isEnterprise: boolean;
version: string;
}
interface GenuineMongoDB {
isGenuine: boolean;
dbType: string;
}
interface DataLake {
isDataLake: boolean;
version: string;
}
interface Server {
type: string;
address: string;
}
interface TopologyDescription {
type: string;
servers: Server[];
setName: string | null;
}
declare class MongoDBInstanceProps {
_id: string;
hostname: string;
port: number;
status: string;
statusError: string | null;
databasesStatus: string;
databasesStatusError: string | null;
refreshingStatus: 'initial' | 'fetching' | 'refreshing' | 'ready' | 'error';
refreshingStatusError: string | null;
isAtlas: boolean;
isLocalAtlas: boolean;
atlasVersion: string;
isRefreshing: boolean;
isTopologyWritable: boolean;
singleServerType: string | null;
isServerWritable: boolean;
isWritable: boolean;
description: string;
env: string;
host: HostInfo;
build: BuildInfo;
genuineMongoDB: GenuineMongoDB;
dataLake: DataLake;
auth: AuthInfo;
databases: DatabaseCollection;
csfleMode: 'enabled' | 'disabled' | 'unavailable';
topologyDescription: TopologyDescription;
}
declare class MongoDBInstance extends MongoDBInstanceProps {
constructor(props: MongoDBInstanceProps);
fetch(opts: { dataService: DataService; force?: boolean }): Promise<void>;
fetchDatabases(opts: {
dataService: DataService;
force?: boolean;
}): Promise<void>;
refresh(opts: {
dataService: DataService;
fetchDatabases?: boolean;
fetchDbStats?: boolean;
fetchCollections?: boolean;
fetchCollInfo?: boolean;
fetchCollStats?: boolean;
}): Promise<void>;
getNamespace(opts: {
dataService: Pick<DataService, 'instance' | 'getCurrentTopologyType'>;
database: string;
collection: string;
}): Promise<Collection | null>;
removeAllListeners(): void;
on(evt: string, fn: (...args: any) => void);
removeListener(evt: string, fn: (...args: any) => void);
toJSON(opts?: { derived?: boolean }): MongoDBInstanceProps;
previousAttributes(): MongoDBInstanceProps;
set(val: Partial<MongoDBInstanceProps>): this;
static removeAllListeners(
model:
| MongoDBInstance
| DatabaseCollection
| Database
| CollectionCollection
| Collection
): void;
}
export { MongoDBInstance, MongoDBInstanceProps, ServerType, TopologyType };