@gokiteam/goki-dev-client 0.2.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/dist/client.d.ts +380 -0
- package/dist/client.js +557 -0
- package/dist/helpers.d.ts +62 -0
- package/dist/helpers.js +122 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.js +78 -0
- package/dist/package.json +1 -0
- package/dist/types.d.ts +339 -0
- package/dist/types.js +7 -0
- package/package.json +39 -0
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @gokiteam/goki-dev-client - Main Client
|
|
3
|
+
*
|
|
4
|
+
* HTTP client for Goki Developer Tools
|
|
5
|
+
*/
|
|
6
|
+
import { AxiosInstance } from 'axios';
|
|
7
|
+
import type * as Types from './types';
|
|
8
|
+
export interface DevToolsClientConfig {
|
|
9
|
+
baseUrl?: string;
|
|
10
|
+
timeout?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare class PubSubClient {
|
|
13
|
+
private client;
|
|
14
|
+
constructor(client: AxiosInstance);
|
|
15
|
+
private call;
|
|
16
|
+
/**
|
|
17
|
+
* Extract short topic name from a full path like 'projects/X/topics/Y' -> 'Y'
|
|
18
|
+
*/
|
|
19
|
+
private extractTopicName;
|
|
20
|
+
publish(params: {
|
|
21
|
+
topic: string;
|
|
22
|
+
message: any;
|
|
23
|
+
attributes?: Record<string, string>;
|
|
24
|
+
traceId?: string;
|
|
25
|
+
}): Promise<{
|
|
26
|
+
messageIds: string[];
|
|
27
|
+
} & {
|
|
28
|
+
traceId: string;
|
|
29
|
+
}>;
|
|
30
|
+
waitForMessage(params: Types.WaitForMessageRequest): Promise<Types.WaitForMessageResponse>;
|
|
31
|
+
assertMessagePublished(params: Types.AssertMessagePublishedRequest): Promise<Types.AssertMessagePublishedResponse>;
|
|
32
|
+
getMessages(params?: {
|
|
33
|
+
filter?: Types.PubSubHistoryFilter;
|
|
34
|
+
page?: Types.PageOptions;
|
|
35
|
+
traceId?: string;
|
|
36
|
+
}): Promise<{
|
|
37
|
+
messages: Types.PubSubMessage[];
|
|
38
|
+
total: number;
|
|
39
|
+
} & {
|
|
40
|
+
traceId: string;
|
|
41
|
+
}>;
|
|
42
|
+
searchMessages(params: {
|
|
43
|
+
query: string;
|
|
44
|
+
filter?: Partial<Types.PubSubHistoryFilter>;
|
|
45
|
+
traceId?: string;
|
|
46
|
+
}): Promise<{
|
|
47
|
+
messages: Types.PubSubMessage[];
|
|
48
|
+
total: number;
|
|
49
|
+
} & {
|
|
50
|
+
traceId: string;
|
|
51
|
+
}>;
|
|
52
|
+
listTopics(params?: {
|
|
53
|
+
traceId?: string;
|
|
54
|
+
}): Promise<{
|
|
55
|
+
topics: Types.PubSubTopic[];
|
|
56
|
+
total: number;
|
|
57
|
+
} & {
|
|
58
|
+
traceId: string;
|
|
59
|
+
}>;
|
|
60
|
+
createTopic(params: {
|
|
61
|
+
topic: string;
|
|
62
|
+
traceId?: string;
|
|
63
|
+
}): Promise<{
|
|
64
|
+
topic: Types.PubSubTopic;
|
|
65
|
+
} & {
|
|
66
|
+
traceId: string;
|
|
67
|
+
}>;
|
|
68
|
+
deleteTopic(params: {
|
|
69
|
+
topic: string;
|
|
70
|
+
traceId?: string;
|
|
71
|
+
}): Promise<void>;
|
|
72
|
+
}
|
|
73
|
+
export declare class LoggingClient {
|
|
74
|
+
private client;
|
|
75
|
+
constructor(client: AxiosInstance);
|
|
76
|
+
private call;
|
|
77
|
+
getByTrace(params: {
|
|
78
|
+
traceId: string;
|
|
79
|
+
queryTraceId?: string;
|
|
80
|
+
}): Promise<{
|
|
81
|
+
traceId: string;
|
|
82
|
+
entries: Types.LogEntry[];
|
|
83
|
+
count: number;
|
|
84
|
+
}>;
|
|
85
|
+
list(params?: {
|
|
86
|
+
filter?: Types.LogFilter;
|
|
87
|
+
page?: Types.PageOptions;
|
|
88
|
+
traceId?: string;
|
|
89
|
+
}): Promise<{
|
|
90
|
+
entries: Types.LogEntry[];
|
|
91
|
+
total: number;
|
|
92
|
+
} & {
|
|
93
|
+
traceId: string;
|
|
94
|
+
}>;
|
|
95
|
+
clear(params?: {
|
|
96
|
+
service?: string;
|
|
97
|
+
traceId?: string;
|
|
98
|
+
}): Promise<{
|
|
99
|
+
deletedCount: number;
|
|
100
|
+
} & {
|
|
101
|
+
traceId: string;
|
|
102
|
+
}>;
|
|
103
|
+
waitForLog(params: Types.WaitForLogRequest): Promise<Types.WaitForLogResponse>;
|
|
104
|
+
assertNoErrors(params: Types.AssertNoErrorsRequest): Promise<Types.AssertNoErrorsResponse>;
|
|
105
|
+
}
|
|
106
|
+
export declare class PostgresClient {
|
|
107
|
+
private client;
|
|
108
|
+
constructor(client: AxiosInstance);
|
|
109
|
+
private call;
|
|
110
|
+
query(params: Types.PostgresQueryRequest): Promise<Types.PostgresQueryResponse>;
|
|
111
|
+
listTables(params: {
|
|
112
|
+
database: string;
|
|
113
|
+
schema?: string;
|
|
114
|
+
traceId?: string;
|
|
115
|
+
}): Promise<{
|
|
116
|
+
tables: {
|
|
117
|
+
name: string;
|
|
118
|
+
rowCount: number;
|
|
119
|
+
}[];
|
|
120
|
+
} & {
|
|
121
|
+
traceId: string;
|
|
122
|
+
}>;
|
|
123
|
+
listRows(params: {
|
|
124
|
+
database: string;
|
|
125
|
+
schema: string;
|
|
126
|
+
table: string;
|
|
127
|
+
page?: Types.PageOptions;
|
|
128
|
+
traceId?: string;
|
|
129
|
+
}): Promise<{
|
|
130
|
+
rows: any[];
|
|
131
|
+
total: number;
|
|
132
|
+
} & {
|
|
133
|
+
traceId: string;
|
|
134
|
+
}>;
|
|
135
|
+
waitForCondition(params: Types.WaitForConditionRequest & {
|
|
136
|
+
type: 'postgres';
|
|
137
|
+
}): Promise<Types.WaitForConditionResponse>;
|
|
138
|
+
}
|
|
139
|
+
export declare class RedisClient {
|
|
140
|
+
private client;
|
|
141
|
+
constructor(client: AxiosInstance);
|
|
142
|
+
private call;
|
|
143
|
+
get(params: {
|
|
144
|
+
key: string;
|
|
145
|
+
traceId?: string;
|
|
146
|
+
}): Promise<Types.RedisValue>;
|
|
147
|
+
scan(params: {
|
|
148
|
+
pattern: string;
|
|
149
|
+
count?: number;
|
|
150
|
+
traceId?: string;
|
|
151
|
+
}): Promise<{
|
|
152
|
+
keys: Types.RedisKey[];
|
|
153
|
+
total: number;
|
|
154
|
+
} & {
|
|
155
|
+
traceId: string;
|
|
156
|
+
}>;
|
|
157
|
+
delete(params: {
|
|
158
|
+
key: string;
|
|
159
|
+
traceId?: string;
|
|
160
|
+
}): Promise<{
|
|
161
|
+
deleted: boolean;
|
|
162
|
+
} & {
|
|
163
|
+
traceId: string;
|
|
164
|
+
}>;
|
|
165
|
+
deletePattern(params: {
|
|
166
|
+
pattern: string;
|
|
167
|
+
traceId?: string;
|
|
168
|
+
}): Promise<{
|
|
169
|
+
deletedCount: number;
|
|
170
|
+
} & {
|
|
171
|
+
traceId: string;
|
|
172
|
+
}>;
|
|
173
|
+
waitForCondition(params: Types.WaitForConditionRequest & {
|
|
174
|
+
type: 'redis';
|
|
175
|
+
}): Promise<Types.WaitForConditionResponse>;
|
|
176
|
+
}
|
|
177
|
+
export declare class FirestoreClient {
|
|
178
|
+
private client;
|
|
179
|
+
constructor(client: AxiosInstance);
|
|
180
|
+
private call;
|
|
181
|
+
/**
|
|
182
|
+
* Parses a Firestore REST API typed value into a plain JS value.
|
|
183
|
+
*/
|
|
184
|
+
private parseFirestoreValue;
|
|
185
|
+
/**
|
|
186
|
+
* Parses Firestore REST API fields object into a plain JS object.
|
|
187
|
+
*/
|
|
188
|
+
private parseFirestoreFields;
|
|
189
|
+
/**
|
|
190
|
+
* Converts a raw Firestore REST API document to a clean FirestoreDocument.
|
|
191
|
+
* Raw format: { name: "projects/.../documents/collection/id", fields: { key: { stringValue: "..." } }, ... }
|
|
192
|
+
* Clean format: { id: "docId", data: { key: "..." } }
|
|
193
|
+
*/
|
|
194
|
+
private parseRawDocument;
|
|
195
|
+
getDocument(params: {
|
|
196
|
+
collection: string;
|
|
197
|
+
documentId: string;
|
|
198
|
+
traceId?: string;
|
|
199
|
+
}): Promise<{
|
|
200
|
+
document: Types.FirestoreDocument;
|
|
201
|
+
}>;
|
|
202
|
+
query(params: {
|
|
203
|
+
collection: string;
|
|
204
|
+
where: Types.FirestoreQuery;
|
|
205
|
+
traceId?: string;
|
|
206
|
+
}): Promise<{
|
|
207
|
+
documents: Types.FirestoreDocument[];
|
|
208
|
+
}>;
|
|
209
|
+
listDocuments(params: {
|
|
210
|
+
collection: string;
|
|
211
|
+
page?: Types.PageOptions;
|
|
212
|
+
traceId?: string;
|
|
213
|
+
}): Promise<{
|
|
214
|
+
documents: Types.FirestoreDocument[];
|
|
215
|
+
total: number;
|
|
216
|
+
}>;
|
|
217
|
+
deleteByQuery(params: Types.DeleteByQueryRequest): Promise<Types.DeleteByQueryResponse>;
|
|
218
|
+
deleteByPrefix(params: Types.DeleteByPrefixRequest): Promise<Types.DeleteByPrefixResponse>;
|
|
219
|
+
deleteBatch(params: Types.DeleteBatchRequest): Promise<Types.DeleteBatchResponse>;
|
|
220
|
+
waitForCondition(params: Types.WaitForConditionRequest & {
|
|
221
|
+
type: 'firestore';
|
|
222
|
+
}): Promise<Types.WaitForConditionResponse>;
|
|
223
|
+
}
|
|
224
|
+
export declare class MqttClient {
|
|
225
|
+
private client;
|
|
226
|
+
constructor(client: AxiosInstance);
|
|
227
|
+
private call;
|
|
228
|
+
listClients(params?: {
|
|
229
|
+
traceId?: string;
|
|
230
|
+
}): Promise<{
|
|
231
|
+
clients: Types.MqttClientInfo[];
|
|
232
|
+
} & {
|
|
233
|
+
traceId: string;
|
|
234
|
+
}>;
|
|
235
|
+
getMessages(params?: {
|
|
236
|
+
filter?: {
|
|
237
|
+
clientId?: string;
|
|
238
|
+
topic?: string;
|
|
239
|
+
};
|
|
240
|
+
page?: Types.PageOptions;
|
|
241
|
+
traceId?: string;
|
|
242
|
+
}): Promise<{
|
|
243
|
+
messages: Types.MqttMessage[];
|
|
244
|
+
total: number;
|
|
245
|
+
} & {
|
|
246
|
+
traceId: string;
|
|
247
|
+
}>;
|
|
248
|
+
}
|
|
249
|
+
export declare class DockerClient {
|
|
250
|
+
private client;
|
|
251
|
+
constructor(client: AxiosInstance);
|
|
252
|
+
private call;
|
|
253
|
+
list(params?: {
|
|
254
|
+
traceId?: string;
|
|
255
|
+
}): Promise<{
|
|
256
|
+
data: Types.DockerContainer[];
|
|
257
|
+
} & {
|
|
258
|
+
traceId: string;
|
|
259
|
+
}>;
|
|
260
|
+
start(params: {
|
|
261
|
+
containerName: string;
|
|
262
|
+
traceId?: string;
|
|
263
|
+
}): Promise<void>;
|
|
264
|
+
stop(params: {
|
|
265
|
+
containerName: string;
|
|
266
|
+
traceId?: string;
|
|
267
|
+
}): Promise<void>;
|
|
268
|
+
restart(params: {
|
|
269
|
+
containerName: string;
|
|
270
|
+
traceId?: string;
|
|
271
|
+
}): Promise<void>;
|
|
272
|
+
logs(params: {
|
|
273
|
+
containerName: string;
|
|
274
|
+
lines?: number;
|
|
275
|
+
traceId?: string;
|
|
276
|
+
}): Promise<{
|
|
277
|
+
data: string;
|
|
278
|
+
} & {
|
|
279
|
+
traceId: string;
|
|
280
|
+
}>;
|
|
281
|
+
}
|
|
282
|
+
export declare class PlatformClient {
|
|
283
|
+
private client;
|
|
284
|
+
constructor(client: AxiosInstance);
|
|
285
|
+
private call;
|
|
286
|
+
getStats(params?: {
|
|
287
|
+
traceId?: string;
|
|
288
|
+
}): Promise<{
|
|
289
|
+
stats: Types.PlatformStats;
|
|
290
|
+
} & {
|
|
291
|
+
traceId: string;
|
|
292
|
+
}>;
|
|
293
|
+
clearAll(params?: {
|
|
294
|
+
traceId?: string;
|
|
295
|
+
}): Promise<{
|
|
296
|
+
cleared: Record<string, number>;
|
|
297
|
+
} & {
|
|
298
|
+
traceId: string;
|
|
299
|
+
}>;
|
|
300
|
+
clearServices(params: Types.ClearServiceDataRequest): Promise<Types.ClearServiceDataResponse>;
|
|
301
|
+
export(params?: {
|
|
302
|
+
traceId?: string;
|
|
303
|
+
}): Promise<{
|
|
304
|
+
export: Types.ExportData;
|
|
305
|
+
} & {
|
|
306
|
+
traceId: string;
|
|
307
|
+
}>;
|
|
308
|
+
}
|
|
309
|
+
export declare class SchedulerClient {
|
|
310
|
+
private client;
|
|
311
|
+
constructor(client: AxiosInstance);
|
|
312
|
+
private call;
|
|
313
|
+
triggerTick(params?: {
|
|
314
|
+
traceId?: string;
|
|
315
|
+
}): Promise<Types.SchedulerTickResponse>;
|
|
316
|
+
}
|
|
317
|
+
export declare class HttpTrafficClient {
|
|
318
|
+
private client;
|
|
319
|
+
constructor(client: AxiosInstance);
|
|
320
|
+
private call;
|
|
321
|
+
list(params?: {
|
|
322
|
+
filter?: Types.HttpTrafficFilter;
|
|
323
|
+
limit?: number;
|
|
324
|
+
offset?: number;
|
|
325
|
+
traceId?: string;
|
|
326
|
+
}): Promise<{
|
|
327
|
+
entries: Types.HttpTrafficEntry[];
|
|
328
|
+
total: number;
|
|
329
|
+
limit: number;
|
|
330
|
+
offset: number;
|
|
331
|
+
} & {
|
|
332
|
+
traceId: string;
|
|
333
|
+
}>;
|
|
334
|
+
getDetails(params: {
|
|
335
|
+
id: string;
|
|
336
|
+
traceId?: string;
|
|
337
|
+
}): Promise<{
|
|
338
|
+
entry: Types.HttpTrafficEntry;
|
|
339
|
+
} & {
|
|
340
|
+
traceId: string;
|
|
341
|
+
}>;
|
|
342
|
+
clear(params?: {
|
|
343
|
+
traceId?: string;
|
|
344
|
+
}): Promise<{
|
|
345
|
+
message: string;
|
|
346
|
+
} & {
|
|
347
|
+
traceId: string;
|
|
348
|
+
}>;
|
|
349
|
+
waitFor(params: {
|
|
350
|
+
filter: Types.HttpTrafficWaitFilter;
|
|
351
|
+
timeout?: number;
|
|
352
|
+
traceId?: string;
|
|
353
|
+
}): Promise<{
|
|
354
|
+
entry: Types.HttpTrafficEntry;
|
|
355
|
+
foundAt: number;
|
|
356
|
+
traceId: string;
|
|
357
|
+
}>;
|
|
358
|
+
stats(params?: {
|
|
359
|
+
traceId?: string;
|
|
360
|
+
}): Promise<Types.HttpTrafficStats & {
|
|
361
|
+
traceId: string;
|
|
362
|
+
}>;
|
|
363
|
+
}
|
|
364
|
+
export declare class DevToolsClient {
|
|
365
|
+
private client;
|
|
366
|
+
private baseUrl;
|
|
367
|
+
pubsub: PubSubClient;
|
|
368
|
+
logging: LoggingClient;
|
|
369
|
+
postgres: PostgresClient;
|
|
370
|
+
redis: RedisClient;
|
|
371
|
+
firestore: FirestoreClient;
|
|
372
|
+
mqtt: MqttClient;
|
|
373
|
+
docker: DockerClient;
|
|
374
|
+
platform: PlatformClient;
|
|
375
|
+
scheduler: SchedulerClient;
|
|
376
|
+
httpTraffic: HttpTrafficClient;
|
|
377
|
+
constructor(config?: DevToolsClientConfig);
|
|
378
|
+
generateTraceId(prefix?: string): string;
|
|
379
|
+
}
|
|
380
|
+
export * from './types';
|