@plyaz/types 1.7.22 → 1.7.23
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/api/client/types.d.ts +78 -2
- package/dist/api/errors/types.d.ts +13 -1
- package/dist/api/index.cjs +1029 -0
- package/dist/api/index.cjs.map +1 -1
- package/dist/api/index.d.ts +33 -21
- package/dist/api/index.js +971 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/network/index.d.ts +1 -1
- package/dist/api/network/types.d.ts +1 -1
- package/dist/api/utils/types.d.ts +89 -0
- package/dist/auth/index.cjs +4239 -0
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.d.ts +2 -2
- package/dist/auth/index.js +46 -0
- package/dist/auth/index.js.map +1 -1
- package/dist/events/index.cjs +33 -0
- package/dist/events/index.cjs.map +1 -1
- package/dist/events/index.d.ts +1 -1
- package/dist/events/index.js +30 -0
- package/dist/events/index.js.map +1 -1
- package/dist/index.cjs +5353 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +1092 -0
- package/dist/index.js.map +1 -1
- package/dist/web3/index.cjs +27 -0
- package/dist/web3/index.cjs.map +1 -1
- package/dist/web3/index.d.ts +1 -1
- package/dist/web3/index.js +26 -0
- package/dist/web3/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/api/hooks/index.d.ts +0 -1
- package/dist/api/queue/index.d.ts +0 -6
- package/dist/api/regional/index.d.ts +0 -6
- package/dist/api/request/index.d.ts +0 -1
- package/dist/api/utils/index.d.ts +0 -5
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
* API Client Types
|
|
3
3
|
* Defines the client interface and options
|
|
4
4
|
*/
|
|
5
|
-
import type { ApiHandlerMethods } from 'fetchff';
|
|
5
|
+
import type { ApiHandlerMethods, FetchResponse, RequestConfig, ResponseError } from 'fetchff';
|
|
6
6
|
import type { ApiConfig } from '../config';
|
|
7
|
-
import type { ConfigUpdateStrategy, HandlerStrategy } from '../events';
|
|
7
|
+
import type { ConfigUpdateStrategy, EventScopeWithTemporary, HandlerStrategy } from '../events';
|
|
8
8
|
import type { EndpointTypes } from '../endpoints';
|
|
9
9
|
import type { UnknownRecord } from 'type-fest';
|
|
10
|
+
import type { NETWORK_QUALITY, NetworkInfo } from '../network';
|
|
11
|
+
import type { ConfigConflict, DebugInfo } from '../debugger';
|
|
12
|
+
import type { ApiPackageErrorLike } from '../errors';
|
|
10
13
|
/**
|
|
11
14
|
* Options for creating an API client
|
|
12
15
|
* Endpoints are automatically included from src/api/endpoints
|
|
@@ -146,3 +149,76 @@ export interface TrackConfigUpdateParams {
|
|
|
146
149
|
/** Timestamp when the update started */
|
|
147
150
|
startTime: number;
|
|
148
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* ClientEventManager Interface
|
|
154
|
+
* Defines the contract for client event management
|
|
155
|
+
*
|
|
156
|
+
* @template TEventManager - The event manager type (should have a getEmitter() method)
|
|
157
|
+
*/
|
|
158
|
+
export interface ClientEventManagerLike<TEventManager> {
|
|
159
|
+
readonly emitter: TEventManager extends {
|
|
160
|
+
getEmitter(): infer E;
|
|
161
|
+
} ? E : never;
|
|
162
|
+
addHandler(event: string, handler: Function | Function[], options?: HandlerOptions): () => void;
|
|
163
|
+
updateConfig(updates: Partial<ApiConfig>, options?: UpdateConfigOptions): void;
|
|
164
|
+
clearTemporaryOverrides(): void;
|
|
165
|
+
checkConflicts(): ConfigConflict[];
|
|
166
|
+
getDebugInfo(): DebugInfo;
|
|
167
|
+
startMonitoring(): void;
|
|
168
|
+
stopMonitoring(): void;
|
|
169
|
+
isMonitoring(): boolean;
|
|
170
|
+
getEventStats(): {
|
|
171
|
+
totalEvents: number;
|
|
172
|
+
totalListeners: number;
|
|
173
|
+
listenerCount: number;
|
|
174
|
+
recentEvents: Array<{
|
|
175
|
+
type: string;
|
|
176
|
+
timestamp: number;
|
|
177
|
+
data?: unknown;
|
|
178
|
+
}>;
|
|
179
|
+
overrideCount: number;
|
|
180
|
+
eventCountsByType: Record<string, number>;
|
|
181
|
+
};
|
|
182
|
+
getActiveScopes(): EventScopeWithTemporary[];
|
|
183
|
+
emitError(error: ApiPackageErrorLike): void;
|
|
184
|
+
emitRequestStart(config: RequestConfig): void;
|
|
185
|
+
emitResponseReceived<TData = unknown>(response: FetchResponse<TData>): void;
|
|
186
|
+
emitRetryAttempt<TResponse = unknown>(error: ResponseError<TResponse>, attemptNumber: number, config?: RequestConfig): void;
|
|
187
|
+
dispose(): void;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Extended API client with event methods
|
|
191
|
+
*/
|
|
192
|
+
/**
|
|
193
|
+
* API configuration with additional metadata for debugging and inspection
|
|
194
|
+
*/
|
|
195
|
+
export interface ApiConfigWithMetadata extends ApiConfig {
|
|
196
|
+
clientId?: string;
|
|
197
|
+
createdAt?: string;
|
|
198
|
+
lastUpdatedAt?: string;
|
|
199
|
+
updateCount?: number;
|
|
200
|
+
networkInfo?: NetworkInfo;
|
|
201
|
+
networkQuality?: NETWORK_QUALITY;
|
|
202
|
+
activeOverrides?: string[];
|
|
203
|
+
conflictDetection?: boolean;
|
|
204
|
+
configHierarchy?: {
|
|
205
|
+
hasGlobalConfig: boolean;
|
|
206
|
+
hasClientConfig: boolean;
|
|
207
|
+
hasTemporaryOverrides: boolean;
|
|
208
|
+
configOverrideStrategy?: ConfigUpdateStrategy;
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
export type ApiClientWithEvents<TEventManager, EndpointsList = UnknownRecord> = ApiClientInstance<EndpointsList> & {
|
|
212
|
+
eventManager: ClientEventManagerLike<TEventManager>;
|
|
213
|
+
on(event: string, handler: Function): () => void;
|
|
214
|
+
off(event: string, handler: Function): void;
|
|
215
|
+
checkConflicts(): ConfigConflict[];
|
|
216
|
+
getDebugInfo(): DebugInfo;
|
|
217
|
+
startMonitoring(): void;
|
|
218
|
+
stopMonitoring(): void;
|
|
219
|
+
isMonitoring(): boolean;
|
|
220
|
+
dispose(): void;
|
|
221
|
+
updateConfig(updates: Partial<ApiClientOptions>, options?: UpdateConfigOptions): void;
|
|
222
|
+
clearTemporaryOverrides(): void;
|
|
223
|
+
getConfig(): ApiConfigWithMetadata;
|
|
224
|
+
};
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { ResponseError, RequestConfig } from 'fetchff';
|
|
9
9
|
import type { ERROR_CATEGORY, ErrorDetail, ErrorResponse } from '../../errors';
|
|
10
|
-
import type { API_ERROR_CODES, OPERATIONS, ERROR_FIELDS, STORAGE_TYPES } from '..';
|
|
10
|
+
import type { API_ERROR_CODES, OPERATIONS, ERROR_FIELDS, STORAGE_TYPES, ApiClientInstance } from '..';
|
|
11
11
|
/**
|
|
12
12
|
* Typed constants as types for convenience
|
|
13
13
|
*/
|
|
@@ -226,3 +226,15 @@ export interface ErrorHandlerOptions {
|
|
|
226
226
|
*/
|
|
227
227
|
strategy?: 'merge' | 'replace' | 'prepend' | 'append';
|
|
228
228
|
}
|
|
229
|
+
/**
|
|
230
|
+
* Options for creating an ApiPackageError
|
|
231
|
+
*/
|
|
232
|
+
export interface ApiPackageErrorOptions<EndpointsList> {
|
|
233
|
+
responseError?: ResponseError;
|
|
234
|
+
statusCode?: number;
|
|
235
|
+
errors?: ErrorDetail<unknown, unknown, unknown>[];
|
|
236
|
+
correlationId?: string;
|
|
237
|
+
cause?: Error;
|
|
238
|
+
context?: ErrorContext;
|
|
239
|
+
clientContext?: ApiClientInstance<EndpointsList>;
|
|
240
|
+
}
|