@http-client-toolkit/dashboard 0.1.0 → 0.12.1

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/lib/index.d.ts CHANGED
@@ -1,188 +1,241 @@
1
1
  import { IncomingMessage, ServerResponse, Server } from 'http';
2
- import { CacheStore, DedupeStore, RateLimitStore } from '@http-client-toolkit/core';
2
+ import {
3
+ HttpClient,
4
+ CacheStore,
5
+ DedupeStore,
6
+ RateLimitStore,
7
+ } from '@http-client-toolkit/core';
3
8
  import { z } from 'zod';
4
9
 
5
- declare const ClientConfigSchema: z.ZodEffects<z.ZodObject<{
6
- name: z.ZodString;
7
- cacheStore: z.ZodOptional<z.ZodType<CacheStore<unknown>, z.ZodTypeDef, CacheStore<unknown>>>;
8
- dedupeStore: z.ZodOptional<z.ZodType<DedupeStore<unknown>, z.ZodTypeDef, DedupeStore<unknown>>>;
9
- rateLimitStore: z.ZodOptional<z.ZodType<RateLimitStore, z.ZodTypeDef, RateLimitStore>>;
10
- }, "strip", z.ZodTypeAny, {
11
- name: string;
12
- cacheStore?: CacheStore<unknown> | undefined;
13
- dedupeStore?: DedupeStore<unknown> | undefined;
14
- rateLimitStore?: RateLimitStore | undefined;
15
- }, {
16
- name: string;
17
- cacheStore?: CacheStore<unknown> | undefined;
18
- dedupeStore?: DedupeStore<unknown> | undefined;
19
- rateLimitStore?: RateLimitStore | undefined;
20
- }>, {
21
- name: string;
22
- cacheStore?: CacheStore<unknown> | undefined;
23
- dedupeStore?: DedupeStore<unknown> | undefined;
24
- rateLimitStore?: RateLimitStore | undefined;
25
- }, {
26
- name: string;
27
- cacheStore?: CacheStore<unknown> | undefined;
28
- dedupeStore?: DedupeStore<unknown> | undefined;
29
- rateLimitStore?: RateLimitStore | undefined;
30
- }>;
31
- declare const DashboardOptionsSchema: z.ZodEffects<z.ZodObject<{
32
- clients: z.ZodArray<z.ZodEffects<z.ZodObject<{
33
- name: z.ZodString;
34
- cacheStore: z.ZodOptional<z.ZodType<CacheStore<unknown>, z.ZodTypeDef, CacheStore<unknown>>>;
35
- dedupeStore: z.ZodOptional<z.ZodType<DedupeStore<unknown>, z.ZodTypeDef, DedupeStore<unknown>>>;
36
- rateLimitStore: z.ZodOptional<z.ZodType<RateLimitStore, z.ZodTypeDef, RateLimitStore>>;
37
- }, "strip", z.ZodTypeAny, {
38
- name: string;
39
- cacheStore?: CacheStore<unknown> | undefined;
40
- dedupeStore?: DedupeStore<unknown> | undefined;
41
- rateLimitStore?: RateLimitStore | undefined;
42
- }, {
43
- name: string;
44
- cacheStore?: CacheStore<unknown> | undefined;
45
- dedupeStore?: DedupeStore<unknown> | undefined;
46
- rateLimitStore?: RateLimitStore | undefined;
47
- }>, {
48
- name: string;
49
- cacheStore?: CacheStore<unknown> | undefined;
50
- dedupeStore?: DedupeStore<unknown> | undefined;
51
- rateLimitStore?: RateLimitStore | undefined;
52
- }, {
53
- name: string;
54
- cacheStore?: CacheStore<unknown> | undefined;
55
- dedupeStore?: DedupeStore<unknown> | undefined;
56
- rateLimitStore?: RateLimitStore | undefined;
57
- }>, "many">;
58
- basePath: z.ZodDefault<z.ZodString>;
59
- pollIntervalMs: z.ZodDefault<z.ZodNumber>;
60
- }, "strip", z.ZodTypeAny, {
10
+ declare const ClientConfigSchema: z.ZodEffects<
11
+ z.ZodObject<
12
+ {
13
+ client: z.ZodType<HttpClient, z.ZodTypeDef, HttpClient>;
14
+ name: z.ZodOptional<z.ZodString>;
15
+ },
16
+ 'strip',
17
+ z.ZodTypeAny,
18
+ {
19
+ client: HttpClient;
20
+ name?: string | undefined;
21
+ },
22
+ {
23
+ client: HttpClient;
24
+ name?: string | undefined;
25
+ }
26
+ >,
27
+ {
28
+ client: HttpClient;
29
+ name?: string | undefined;
30
+ },
31
+ {
32
+ client: HttpClient;
33
+ name?: string | undefined;
34
+ }
35
+ >;
36
+ declare const DashboardOptionsSchema: z.ZodEffects<
37
+ z.ZodObject<
38
+ {
39
+ clients: z.ZodArray<
40
+ z.ZodEffects<
41
+ z.ZodObject<
42
+ {
43
+ client: z.ZodType<HttpClient, z.ZodTypeDef, HttpClient>;
44
+ name: z.ZodOptional<z.ZodString>;
45
+ },
46
+ 'strip',
47
+ z.ZodTypeAny,
48
+ {
49
+ client: HttpClient;
50
+ name?: string | undefined;
51
+ },
52
+ {
53
+ client: HttpClient;
54
+ name?: string | undefined;
55
+ }
56
+ >,
57
+ {
58
+ client: HttpClient;
59
+ name?: string | undefined;
60
+ },
61
+ {
62
+ client: HttpClient;
63
+ name?: string | undefined;
64
+ }
65
+ >,
66
+ 'many'
67
+ >;
68
+ basePath: z.ZodDefault<z.ZodString>;
69
+ pollIntervalMs: z.ZodDefault<z.ZodNumber>;
70
+ },
71
+ 'strip',
72
+ z.ZodTypeAny,
73
+ {
74
+ clients: {
75
+ client: HttpClient;
76
+ name?: string | undefined;
77
+ }[];
78
+ basePath: string;
79
+ pollIntervalMs: number;
80
+ },
81
+ {
82
+ clients: {
83
+ client: HttpClient;
84
+ name?: string | undefined;
85
+ }[];
86
+ basePath?: string | undefined;
87
+ pollIntervalMs?: number | undefined;
88
+ }
89
+ >,
90
+ {
61
91
  clients: {
62
- name: string;
63
- cacheStore?: CacheStore<unknown> | undefined;
64
- dedupeStore?: DedupeStore<unknown> | undefined;
65
- rateLimitStore?: RateLimitStore | undefined;
92
+ client: HttpClient;
93
+ name?: string | undefined;
66
94
  }[];
67
95
  basePath: string;
68
96
  pollIntervalMs: number;
69
- }, {
97
+ },
98
+ {
70
99
  clients: {
71
- name: string;
72
- cacheStore?: CacheStore<unknown> | undefined;
73
- dedupeStore?: DedupeStore<unknown> | undefined;
74
- rateLimitStore?: RateLimitStore | undefined;
100
+ client: HttpClient;
101
+ name?: string | undefined;
75
102
  }[];
76
103
  basePath?: string | undefined;
77
104
  pollIntervalMs?: number | undefined;
78
- }>, {
79
- clients: {
80
- name: string;
81
- cacheStore?: CacheStore<unknown> | undefined;
82
- dedupeStore?: DedupeStore<unknown> | undefined;
83
- rateLimitStore?: RateLimitStore | undefined;
84
- }[];
85
- basePath: string;
86
- pollIntervalMs: number;
87
- }, {
88
- clients: {
89
- name: string;
90
- cacheStore?: CacheStore<unknown> | undefined;
91
- dedupeStore?: DedupeStore<unknown> | undefined;
92
- rateLimitStore?: RateLimitStore | undefined;
93
- }[];
94
- basePath?: string | undefined;
95
- pollIntervalMs?: number | undefined;
96
- }>;
97
- declare const StandaloneDashboardOptionsSchema: z.ZodIntersection<z.ZodEffects<z.ZodObject<{
98
- clients: z.ZodArray<z.ZodEffects<z.ZodObject<{
99
- name: z.ZodString;
100
- cacheStore: z.ZodOptional<z.ZodType<CacheStore<unknown>, z.ZodTypeDef, CacheStore<unknown>>>;
101
- dedupeStore: z.ZodOptional<z.ZodType<DedupeStore<unknown>, z.ZodTypeDef, DedupeStore<unknown>>>;
102
- rateLimitStore: z.ZodOptional<z.ZodType<RateLimitStore, z.ZodTypeDef, RateLimitStore>>;
103
- }, "strip", z.ZodTypeAny, {
104
- name: string;
105
- cacheStore?: CacheStore<unknown> | undefined;
106
- dedupeStore?: DedupeStore<unknown> | undefined;
107
- rateLimitStore?: RateLimitStore | undefined;
108
- }, {
109
- name: string;
110
- cacheStore?: CacheStore<unknown> | undefined;
111
- dedupeStore?: DedupeStore<unknown> | undefined;
112
- rateLimitStore?: RateLimitStore | undefined;
113
- }>, {
114
- name: string;
115
- cacheStore?: CacheStore<unknown> | undefined;
116
- dedupeStore?: DedupeStore<unknown> | undefined;
117
- rateLimitStore?: RateLimitStore | undefined;
118
- }, {
119
- name: string;
120
- cacheStore?: CacheStore<unknown> | undefined;
121
- dedupeStore?: DedupeStore<unknown> | undefined;
122
- rateLimitStore?: RateLimitStore | undefined;
123
- }>, "many">;
124
- basePath: z.ZodDefault<z.ZodString>;
125
- pollIntervalMs: z.ZodDefault<z.ZodNumber>;
126
- }, "strip", z.ZodTypeAny, {
127
- clients: {
128
- name: string;
129
- cacheStore?: CacheStore<unknown> | undefined;
130
- dedupeStore?: DedupeStore<unknown> | undefined;
131
- rateLimitStore?: RateLimitStore | undefined;
132
- }[];
133
- basePath: string;
134
- pollIntervalMs: number;
135
- }, {
136
- clients: {
137
- name: string;
138
- cacheStore?: CacheStore<unknown> | undefined;
139
- dedupeStore?: DedupeStore<unknown> | undefined;
140
- rateLimitStore?: RateLimitStore | undefined;
141
- }[];
142
- basePath?: string | undefined;
143
- pollIntervalMs?: number | undefined;
144
- }>, {
145
- clients: {
146
- name: string;
147
- cacheStore?: CacheStore<unknown> | undefined;
148
- dedupeStore?: DedupeStore<unknown> | undefined;
149
- rateLimitStore?: RateLimitStore | undefined;
150
- }[];
151
- basePath: string;
152
- pollIntervalMs: number;
153
- }, {
154
- clients: {
155
- name: string;
156
- cacheStore?: CacheStore<unknown> | undefined;
157
- dedupeStore?: DedupeStore<unknown> | undefined;
158
- rateLimitStore?: RateLimitStore | undefined;
159
- }[];
160
- basePath?: string | undefined;
161
- pollIntervalMs?: number | undefined;
162
- }>, z.ZodObject<{
163
- port: z.ZodDefault<z.ZodNumber>;
164
- host: z.ZodDefault<z.ZodString>;
165
- }, "strip", z.ZodTypeAny, {
166
- port: number;
167
- host: string;
168
- }, {
169
- port?: number | undefined;
170
- host?: string | undefined;
171
- }>>;
105
+ }
106
+ >;
107
+ declare const StandaloneDashboardOptionsSchema: z.ZodIntersection<
108
+ z.ZodEffects<
109
+ z.ZodObject<
110
+ {
111
+ clients: z.ZodArray<
112
+ z.ZodEffects<
113
+ z.ZodObject<
114
+ {
115
+ client: z.ZodType<HttpClient, z.ZodTypeDef, HttpClient>;
116
+ name: z.ZodOptional<z.ZodString>;
117
+ },
118
+ 'strip',
119
+ z.ZodTypeAny,
120
+ {
121
+ client: HttpClient;
122
+ name?: string | undefined;
123
+ },
124
+ {
125
+ client: HttpClient;
126
+ name?: string | undefined;
127
+ }
128
+ >,
129
+ {
130
+ client: HttpClient;
131
+ name?: string | undefined;
132
+ },
133
+ {
134
+ client: HttpClient;
135
+ name?: string | undefined;
136
+ }
137
+ >,
138
+ 'many'
139
+ >;
140
+ basePath: z.ZodDefault<z.ZodString>;
141
+ pollIntervalMs: z.ZodDefault<z.ZodNumber>;
142
+ },
143
+ 'strip',
144
+ z.ZodTypeAny,
145
+ {
146
+ clients: {
147
+ client: HttpClient;
148
+ name?: string | undefined;
149
+ }[];
150
+ basePath: string;
151
+ pollIntervalMs: number;
152
+ },
153
+ {
154
+ clients: {
155
+ client: HttpClient;
156
+ name?: string | undefined;
157
+ }[];
158
+ basePath?: string | undefined;
159
+ pollIntervalMs?: number | undefined;
160
+ }
161
+ >,
162
+ {
163
+ clients: {
164
+ client: HttpClient;
165
+ name?: string | undefined;
166
+ }[];
167
+ basePath: string;
168
+ pollIntervalMs: number;
169
+ },
170
+ {
171
+ clients: {
172
+ client: HttpClient;
173
+ name?: string | undefined;
174
+ }[];
175
+ basePath?: string | undefined;
176
+ pollIntervalMs?: number | undefined;
177
+ }
178
+ >,
179
+ z.ZodObject<
180
+ {
181
+ port: z.ZodDefault<z.ZodNumber>;
182
+ host: z.ZodDefault<z.ZodString>;
183
+ },
184
+ 'strip',
185
+ z.ZodTypeAny,
186
+ {
187
+ port: number;
188
+ host: string;
189
+ },
190
+ {
191
+ port?: number | undefined;
192
+ host?: string | undefined;
193
+ }
194
+ >
195
+ >;
196
+ interface NormalizedClientConfig {
197
+ name: string;
198
+ cacheStore?: CacheStore;
199
+ dedupeStore?: DedupeStore;
200
+ rateLimitStore?: RateLimitStore;
201
+ }
172
202
  type ClientConfig = z.input<typeof ClientConfigSchema>;
173
203
  type DashboardOptions = z.input<typeof DashboardOptionsSchema>;
174
- type StandaloneDashboardOptions = z.input<typeof StandaloneDashboardOptionsSchema>;
204
+ type StandaloneDashboardOptions = z.input<
205
+ typeof StandaloneDashboardOptionsSchema
206
+ >;
175
207
 
176
- type DashboardMiddleware = (req: IncomingMessage, res: ServerResponse, next?: () => void) => void;
177
- declare function createDashboard(options: DashboardOptions): DashboardMiddleware;
208
+ type DashboardMiddleware = (
209
+ req: IncomingMessage,
210
+ res: ServerResponse,
211
+ next?: () => void,
212
+ ) => void;
213
+ declare function createDashboard(
214
+ options: DashboardOptions,
215
+ ): DashboardMiddleware;
178
216
 
179
217
  type DashboardFetchHandler = (request: Request) => Promise<Response>;
180
- declare function createDashboardHandler(options: DashboardOptions): DashboardFetchHandler;
218
+ declare function createDashboardHandler(
219
+ options: DashboardOptions,
220
+ ): DashboardFetchHandler;
181
221
 
182
222
  interface StandaloneDashboardServer {
183
- server: Server;
184
- close(): Promise<void>;
223
+ server: Server;
224
+ close(): Promise<void>;
185
225
  }
186
- declare function startDashboard(options: StandaloneDashboardOptions): Promise<StandaloneDashboardServer>;
226
+ declare function startDashboard(
227
+ options: StandaloneDashboardOptions,
228
+ ): Promise<StandaloneDashboardServer>;
187
229
 
188
- export { type ClientConfig, type DashboardFetchHandler, type DashboardMiddleware, type DashboardOptions, type StandaloneDashboardOptions, type StandaloneDashboardServer, createDashboard, createDashboardHandler, startDashboard };
230
+ export {
231
+ type ClientConfig,
232
+ type DashboardFetchHandler,
233
+ type DashboardMiddleware,
234
+ type DashboardOptions,
235
+ type NormalizedClientConfig,
236
+ type StandaloneDashboardOptions,
237
+ type StandaloneDashboardServer,
238
+ createDashboard,
239
+ createDashboardHandler,
240
+ startDashboard,
241
+ };