This repository has been archived by the owner on Sep 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.d.ts
335 lines (295 loc) · 9.82 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
/// <reference types="jquery"/>
/**
* The top level object returned from a 'list' operation.
*/
export type IJmxDomains = {
[domainName: string]: IJmxDomain;
};
/**
* Individual JMX domain, MBean property lists are stored as keys.
*/
export type IJmxDomain = {
[propertyList: string]: IJmxMBean;
};
/**
* JMX MBean object that contains the operations/attributes.
*/
export interface IJmxMBean {
desc: string;
attr?: IJmxAttributes;
op?: IJmxOperations;
canInvoke?: boolean;
}
/**
* JMX MBean attributes, attribute name is the key.
*/
export type IJmxAttributes = {
[attributeName: string]: IJmxAttribute;
};
/**
* JMX attribute object that contains the type, description and if it's read/write
* or not.
*/
export interface IJmxAttribute {
desc: string;
type: string;
rw: boolean;
canInvoke?: boolean;
}
/**
* JMX operation object that's a map of the operation name to the operation schema.
*/
export type IJmxOperations = {
[methodName: string]: IJmxOperation | IJmxOperation[];
};
/**
* Schema for a JMX operation object.
*/
export interface IJmxOperation {
desc: string;
args: IJmxOperationArgument[];
ret: string;
canInvoke?: boolean;
}
/**
* Operation arguments are stored in a map of argument name -> type.
*/
export interface IJmxOperationArgument {
desc: string;
name: string;
type: string;
}
/**
* Request operation.
* https://jolokia.org/reference/html/protocol.html#jolokia-operations
*/
export type IRequest =
| { type: 'read'; mbean: string; attribute?: string | string[]; path?: string; }
| { type: 'write'; mbean: string; attribute: string; value: unknown; path?: string; }
| { type: 'exec'; mbean: string; operation: string; arguments?: unknown[]; }
| { type: 'search'; mbean: string; }
| { type: 'list'; path?: string; }
| { type: 'version'; };
export interface IResponse {
status: number;
timestamp: number;
request: IRequest;
value: unknown;
history?: IResponse[];
}
export interface IErrorResponse extends IResponse {
error_type: string;
error: string;
stacktrace: string;
}
export type IErrorResponseFn = (response: IErrorResponse) => void;
export type IAjaxErrorFn = (xhr: JQueryXHR, text: string, error: string) => void;
/**
* Processing parameters.
* https://jolokia.org/reference/html/protocol.html#processing-parameters
*/
export interface IParams {
maxDepth?: number;
maxCollectionSize?: number;
maxObjects?: number;
ignoreErrors?: boolean;
mimeType?: string;
canonicalNaming?: boolean;
includeStackTrace?: boolean;
serializeException?: boolean;
ifModifiedSince?: Date;
}
/**
* Common request options shared by the low-level request and simple APIs.
* https://jolokia.org/reference/html/clients.html#js-request-options-table
*/
export interface IOptionsBase extends IParams {
url?: string;
method?: string;
jsonp?: boolean;
// success differs between the request and simple APIs
error?: IErrorResponseFn;
ajaxError?: IAjaxErrorFn;
username?: string;
password?: string;
timeout?: number;
canonicalProperties?: boolean;
// TODO: needed?
/*
type?: string;
dataType?: string;
contentType?: string;
*/
// Other implicit options
[name: string]: unknown;
}
export type IResponseFn = (response: IResponse) => void;
/**
* Request options of a single request used for the low-level request API.
*/
export interface IOptions extends IOptionsBase {
success?: IResponseFn;
}
/**
* Request options of bulk requests used for the low-level request API.
*/
export interface IBulkOptions extends IOptionsBase {
success?: IResponseFn[];
}
export type ISimpleResponseFn = (value: unknown) => void;
/**
* Request options used for the READ/WRITE/EXEC simple API.
*/
export interface ISimpleOptions extends IOptionsBase {
success?: ISimpleResponseFn;
}
export type ISearchResponseFn = (value: string[]) => void;
/**
* Request options used for the SEARCH simple API.
*/
export interface ISearchOptions extends IOptionsBase {
success?: ISearchResponseFn;
}
export type IListResponseFn = (value: IJmxDomains | IJmxDomain | IJmxMBean) => void;
/**
* Request options used for the LIST simple API.
*/
export interface IListOptions extends IOptionsBase {
success?: IListResponseFn;
}
export type IVersionResponseFn = (value: IVersion) => void;
/**
* Request options used for the VERSION simple API.
*/
export interface IVersionOptions extends IOptionsBase {
success?: IVersionResponseFn;
}
export interface IRegisterParams {
success?: IResponseFn;
error?: IErrorResponseFn;
config?: IOptions;
}
export interface IRegisterRequest extends IRequest {
config?: IOptions;
}
export interface IAgentConfig {
agentDescription: string;
agentId: string;
agentType: string;
serializeException: string;
[name: string]: unknown;
}
export interface IExtraInfo {
[name: string]: unknown;
}
export interface IAgentInfo {
product: string;
vendor: string;
version: string;
extraInfo: IExtraInfo;
}
export interface IVersion {
protocol: string;
agent: string;
config: IAgentConfig;
info: IAgentInfo;
}
// we'll assume jolokia-simple.js is also being included
export interface IJolokia {
// ===========================================================================
// Low-level request API:
// https://jolokia.org/reference/html/clients.html#js-request
// ===========================================================================
request(operation: IRequest, opts: IOptions): unknown | null;
request(operations: IRequest[], opts: IBulkOptions): unknown[] | null;
// ===========================================================================
// Simple API:
// https://jolokia.org/reference/html/clients.html#js-simple
// ===========================================================================
/**
* This method returns the value of an JMX attribute of an MBean.
* A path can be optionally given, and the optional request options are given
* as last argument(s). The return value for synchronous operations are the attribute's
* value, for asynchronous operations (i.e. `opts.success != null`) it is `null`.
*
* @param {string} mbean objectname of MBean to query. Can be a pattern.
* @param {string} attribute attribute name. If an array, multiple attributes are fetched.
* If <code>null</code>, all attributes are fetched.
* @param {string} path optional path within the return value. For multi-attribute fetch,
* the path is ignored.
* @param {IOptions} opts options passed to Jolokia.request()
* @return {unknown|null} the value of the attribute, possibly a complex object
*/
getAttribute(mbean: string, attribute: string, path: string, opts?: ISimpleOptions): unknown | null;
getAttribute(mbean: string, attribute: string, opts?: ISimpleOptions): unknown | null;
/**
* For setting an JMX attribute, this method takes the MBean's name, the attribute
* and the value to set. The optional path is the inner path of the attribute
* on which to set the value. The old value of the attribute is returned or given
* to a `success` callback.
*
* @param {string} mbean objectname of MBean to set
* @param {string} attribute the attribute to set
* @param {unknown} value the value to set
* @param {string} path an optional <em>inner path</em> which, when given, is
* used to determine an inner object to set the value on
* @param {IOptions} opts additional options passed to Jolokia.request()
* @return {unknown|null} the previous value
*/
setAttribute(mbean: string, attribute: string, value: unknown, path: string, opts?: ISimpleOptions): unknown | null;
setAttribute(mbean: string, attribute: string, value: unknown, opts?: ISimpleOptions): unknown | null;
/**
* With this method, a JMX operation can be executed on the MBean. Beside the
* operation's name, one or more arguments can be given depending on the signature
* of the JMX operation. The return value is the return value of the operation.
*
* @param mbean the MBean name
* @param operation the operation name to execute
* @param arguments the arguments to pass to the operation
*/
execute(mbean: string, operation: string, ...arguments: unknown[]): unknown | null;
/**
* Searches for one or more MBeans whose object names fit the pattern.
* The return value is a list of strings with the matching MBean names or `null`
* if none is found.
*
* @param mBeanPattern the MBean pattern
* @param opts optional request options
*/
search(mBeanPattern: string, opts?: ISearchOptions): string[] | null;
/**
* For getting meta information about registered MBeans, the list command can
* be used. The optional path points into this meta information for retrieving
* partial information.
*
* @param path the path to list the information
* @param opts optional request options
*/
list(path: string | null, opts?: IListOptions): IJmxDomains | null;
/**
* The version method returns the agent's version, the protocol version, and
* possibly some additional server-specific information.
*
* @param opts optional request options
*/
version(opts?: IVersionOptions): IVersion | null;
// ===========================================================================
// Request scheduler:
// https://jolokia.org/reference/html/clients.html#js-poller
// ===========================================================================
register(callback: (...response: IResponse[]) => void, ...request: IRequest[]): number;
register(params: IRegisterParams, ...request: IRegisterRequest[]): number;
unregister(handle: number): void;
jobs(): number[];
start(period: number): void;
stop(): void;
isRunning(): boolean;
}
export const Jolokia: {
new(opts?: IOptions): IJolokia;
new(url?: string): IJolokia;
(): IJolokia;
};
export const cubism: unknown;
export const d3: unknown;
export default Jolokia;