@plyaz/types 1.7.16 → 1.7.18

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.
Files changed (65) hide show
  1. package/dist/api/cache/index.d.ts +5 -0
  2. package/dist/api/cache/types.d.ts +22 -0
  3. package/dist/api/client/index.d.ts +5 -0
  4. package/dist/api/client/types.d.ts +31 -0
  5. package/dist/api/config/index.d.ts +5 -0
  6. package/dist/api/config/types.d.ts +634 -0
  7. package/dist/api/errors/index.d.ts +5 -0
  8. package/dist/api/errors/types.d.ts +129 -0
  9. package/dist/api/events/index.d.ts +5 -0
  10. package/dist/api/events/types.d.ts +795 -0
  11. package/dist/api/headers/index.d.ts +5 -0
  12. package/dist/api/headers/types.d.ts +59 -0
  13. package/dist/api/index.d.ts +19 -1
  14. package/dist/api/network/enums.d.ts +14 -0
  15. package/dist/api/network/index.d.ts +6 -0
  16. package/dist/api/network/types.d.ts +121 -0
  17. package/dist/api/performance/index.d.ts +5 -0
  18. package/dist/api/performance/types.d.ts +137 -0
  19. package/dist/api/polling/index.d.ts +5 -0
  20. package/dist/api/polling/types.d.ts +74 -0
  21. package/dist/api/queue/enums.d.ts +31 -0
  22. package/dist/api/queue/index.d.ts +6 -0
  23. package/dist/api/queue/types.d.ts +65 -0
  24. package/dist/api/regional/index.d.ts +5 -0
  25. package/dist/api/regional/types.d.ts +50 -0
  26. package/dist/api/retry/index.d.ts +5 -0
  27. package/dist/api/retry/types.d.ts +26 -0
  28. package/dist/api/revalidation/index.d.ts +5 -0
  29. package/dist/api/revalidation/types.d.ts +33 -0
  30. package/dist/api/strategies/index.d.ts +5 -0
  31. package/dist/api/strategies/types.d.ts +27 -0
  32. package/dist/api/utils/enums.d.ts +23 -0
  33. package/dist/api/utils/index.d.ts +5 -0
  34. package/dist/auth/index.cjs +0 -41
  35. package/dist/auth/index.cjs.map +1 -1
  36. package/dist/auth/index.d.ts +1 -1
  37. package/dist/auth/index.js +0 -38
  38. package/dist/auth/index.js.map +1 -1
  39. package/dist/common/types.d.ts +1 -4
  40. package/dist/errors/enums.d.ts +27 -0
  41. package/dist/errors/index.cjs +0 -43
  42. package/dist/errors/index.cjs.map +1 -1
  43. package/dist/errors/index.d.ts +1 -1
  44. package/dist/errors/index.js +0 -40
  45. package/dist/errors/index.js.map +1 -1
  46. package/dist/events/index.cjs +0 -33
  47. package/dist/events/index.cjs.map +1 -1
  48. package/dist/events/index.d.ts +1 -1
  49. package/dist/events/index.js +0 -30
  50. package/dist/events/index.js.map +1 -1
  51. package/dist/events/types.d.ts +2 -2
  52. package/dist/index.cjs +0 -138
  53. package/dist/index.cjs.map +1 -1
  54. package/dist/index.d.ts +5 -5
  55. package/dist/index.js +0 -128
  56. package/dist/index.js.map +1 -1
  57. package/dist/testing/common/utils/types.d.ts +2 -1
  58. package/dist/testing/features/api/types.d.ts +173 -21
  59. package/dist/web3/index.cjs +0 -27
  60. package/dist/web3/index.cjs.map +1 -1
  61. package/dist/web3/index.d.ts +1 -1
  62. package/dist/web3/index.js +0 -26
  63. package/dist/web3/index.js.map +1 -1
  64. package/package.json +3 -2
  65. package/dist/api/types.d.ts +0 -51
@@ -0,0 +1,129 @@
1
+ /**
2
+ * Error handling types for @plyaz/api package
3
+ * Following the Confluence architecture specifications
4
+ */
5
+ import type { OPERATIONS, ERROR_FIELDS, STORAGE_TYPES } from '@plyaz/config';
6
+ import type { ERROR_CATEGORY, BaseErrorResponse, ErrorDetail } from '../../errors';
7
+ /**
8
+ * Typed constants as types for convenience
9
+ */
10
+ export type ErrorOperation = (typeof OPERATIONS)[keyof typeof OPERATIONS];
11
+ export type ErrorField = (typeof ERROR_FIELDS)[keyof typeof ERROR_FIELDS];
12
+ export type StorageType = (typeof STORAGE_TYPES)[keyof typeof STORAGE_TYPES];
13
+ /**
14
+ * Translation interpolation variables
15
+ */
16
+ export interface I18nContext {
17
+ [key: string]: string | number | boolean | null | undefined;
18
+ }
19
+ /**
20
+ * Cache error context
21
+ */
22
+ export interface CacheErrorContext extends BaseErrorResponse {
23
+ operation: ErrorOperation;
24
+ cacheKey?: string;
25
+ keyPrefix?: string;
26
+ exactKey?: string;
27
+ storageType?: StorageType | string;
28
+ fallbackAvailable?: boolean;
29
+ }
30
+ /**
31
+ * Headers error context
32
+ */
33
+ export interface HeadersErrorContext extends BaseErrorResponse {
34
+ operation: ErrorOperation;
35
+ warningCount?: number;
36
+ warnings?: string;
37
+ }
38
+ /**
39
+ * Regional error context
40
+ */
41
+ export interface RegionalErrorContext extends BaseErrorResponse {
42
+ operation: ErrorOperation;
43
+ requestedPreset?: string;
44
+ availablePresets?: string;
45
+ fallbackUsed?: string;
46
+ }
47
+ /**
48
+ * Network error context
49
+ */
50
+ export interface NetworkErrorContext extends BaseErrorResponse {
51
+ operation: ErrorOperation;
52
+ requestedPreset?: string;
53
+ availablePresets?: string;
54
+ }
55
+ /**
56
+ * Error definition structure
57
+ */
58
+ export interface ErrorDefinition {
59
+ code: string;
60
+ status: number;
61
+ category: typeof ERROR_CATEGORY;
62
+ fieldsLeft?: string[];
63
+ }
64
+ /**
65
+ * Map of error codes to their definitions
66
+ */
67
+ export type ErrorDefinitions = {
68
+ [key: string]: ErrorDefinition;
69
+ };
70
+ /**
71
+ * Union type for all error contexts
72
+ */
73
+ export type ErrorContext = BaseErrorResponse | CacheErrorContext | HeadersErrorContext | RegionalErrorContext | NetworkErrorContext;
74
+ /**
75
+ * Options for creating an ApiPackageError
76
+ * Note: ApiPackageError class itself is not migrated as it contains implementation
77
+ */
78
+ export interface ApiPackageErrorOptionsErrorDetail<ValueGiven, AllowedValues, Constraints> {
79
+ responseError?: unknown;
80
+ statusCode?: number;
81
+ errors?: ErrorDetail<ValueGiven, AllowedValues, Constraints>[];
82
+ correlationId?: string;
83
+ cause?: Error;
84
+ context?: ErrorContext;
85
+ clientContext?: unknown;
86
+ }
87
+ /**
88
+ * Event handler types for API package errors
89
+ * Note: ApiPackageError is not imported here to avoid implementation dependencies
90
+ */
91
+ export interface ErrorEventHandlers<ApiPackageError> {
92
+ onValidationError?: ((error: ApiPackageError) => void) | Array<(error: ApiPackageError) => void>;
93
+ onNetworkError?: ((error: ApiPackageError) => void) | Array<(error: ApiPackageError) => void>;
94
+ onAuthenticationError?: ((error: ApiPackageError) => void) | Array<(error: ApiPackageError) => void>;
95
+ onAuthorizationError?: ((error: ApiPackageError) => void) | Array<(error: ApiPackageError) => void>;
96
+ onRateLimitError?: ((error: ApiPackageError) => void) | Array<(error: ApiPackageError) => void>;
97
+ onTimeoutError?: ((error: ApiPackageError) => void) | Array<(error: ApiPackageError) => void>;
98
+ onConflictError?: ((error: ApiPackageError) => void) | Array<(error: ApiPackageError) => void>;
99
+ onNotFoundError?: ((error: ApiPackageError) => void) | Array<(error: ApiPackageError) => void>;
100
+ onServerError?: ((error: ApiPackageError) => void) | Array<(error: ApiPackageError) => void>;
101
+ onClientError?: ((error: ApiPackageError) => void) | Array<(error: ApiPackageError) => void>;
102
+ onExternalServiceError?: ((error: ApiPackageError) => void) | Array<(error: ApiPackageError) => void>;
103
+ onCacheError?: ((error: ApiPackageError) => void) | Array<(error: ApiPackageError) => void>;
104
+ onHeadersError?: ((error: ApiPackageError) => void) | Array<(error: ApiPackageError) => void>;
105
+ onRetryError?: ((error: ApiPackageError) => void) | Array<(error: ApiPackageError) => void>;
106
+ onStrategyError?: ((error: ApiPackageError) => void) | Array<(error: ApiPackageError) => void>;
107
+ onRegionalError?: ((error: ApiPackageError) => void) | Array<(error: ApiPackageError) => void>;
108
+ onUnknownError?: ((error: ApiPackageError) => void) | Array<(error: ApiPackageError) => void>;
109
+ onAnyError?: ((error: ApiPackageError) => void) | Array<(error: ApiPackageError) => void>;
110
+ }
111
+ /**
112
+ * Options for error handler registration
113
+ */
114
+ export interface ErrorHandlerOptions {
115
+ /**
116
+ * The scope level for the handler
117
+ * @default 'GLOBAL'
118
+ */
119
+ scope?: 'GLOBAL' | 'CONFIG' | 'CLIENT' | 'REQUEST' | 'TEMPORARY';
120
+ /**
121
+ * Strategy for handling multiple handlers
122
+ * - 'merge': Add to existing handlers (default)
123
+ * - 'replace': Replace existing handlers for this event type
124
+ * - 'prepend': Add new handlers before existing ones
125
+ * - 'append': Add new handlers after existing ones
126
+ * @default 'merge'
127
+ */
128
+ strategy?: 'merge' | 'replace' | 'prepend' | 'append';
129
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * API Events Types
3
+ * Re-exports all event-related types for the API package
4
+ */
5
+ export type * from './types';