@plyaz/config 1.6.0 → 1.6.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/errors/index.cjs +3 -0
- package/dist/errors/index.cjs.map +1 -0
- package/dist/errors/index.mjs +3 -0
- package/dist/errors/index.mjs.map +1 -0
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/dist/logger/index.cjs +3 -0
- package/dist/logger/index.cjs.map +1 -0
- package/dist/logger/index.mjs +3 -0
- package/dist/logger/index.mjs.map +1 -0
- package/dist/network/constants.d.ts +222 -0
- package/dist/network/index.cjs +1 -1
- package/dist/network/index.cjs.map +1 -1
- package/dist/network/index.mjs +1 -1
- package/dist/network/index.mjs.map +1 -1
- package/package.json +13 -1
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
'use strict';// @plyaz package - Built with tsup
|
|
2
|
+
var e={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},r=["email","password","wallet","token","secret","ssn"];exports.LOGGER_LEVELS=e;exports.SENSITIVE_DATA=r;//# sourceMappingURL=index.cjs.map
|
|
3
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/logger/constants.ts"],"names":["LOGGER_LEVELS","SENSITIVE_DATA"],"mappings":";AACO,IAAMA,CAAAA,CAAgB,CAC3B,KAAA,CAAO,EAAA,CACP,MAAO,EAAA,CACP,IAAA,CAAM,EAAA,CACN,IAAA,CAAM,EAAA,CACN,KAAA,CAAO,GACP,KAAA,CAAO,EACT,EAGaC,CAAAA,CAAiB,CAAC,QAAS,UAAA,CAAY,QAAA,CAAU,OAAA,CAAS,QAAA,CAAU,KAAK","file":"index.cjs","sourcesContent":["// levels of the loggers\nexport const LOGGER_LEVELS = {\n trace: 10,\n debug: 20,\n info: 30,\n warn: 40,\n error: 50,\n fatal: 60,\n};\n\n// Sensitive fields excluded from logs\nexport const SENSITIVE_DATA = ['email', 'password', 'wallet', 'token', 'secret', 'ssn'];\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/logger/constants.ts"],"names":["LOGGER_LEVELS","SENSITIVE_DATA"],"mappings":";AACO,IAAMA,CAAAA,CAAgB,CAC3B,KAAA,CAAO,EAAA,CACP,MAAO,EAAA,CACP,IAAA,CAAM,EAAA,CACN,IAAA,CAAM,EAAA,CACN,KAAA,CAAO,GACP,KAAA,CAAO,EACT,EAGaC,CAAAA,CAAiB,CAAC,QAAS,UAAA,CAAY,QAAA,CAAU,OAAA,CAAS,QAAA,CAAU,KAAK","file":"index.mjs","sourcesContent":["// levels of the loggers\nexport const LOGGER_LEVELS = {\n trace: 10,\n debug: 20,\n info: 30,\n warn: 40,\n error: 50,\n fatal: 60,\n};\n\n// Sensitive fields excluded from logs\nexport const SENSITIVE_DATA = ['email', 'password', 'wallet', 'token', 'secret', 'ssn'];\n"]}
|
|
@@ -93,6 +93,192 @@ export declare const NETWORK_SCORES: {
|
|
|
93
93
|
*/
|
|
94
94
|
readonly OFFLINE: 0;
|
|
95
95
|
};
|
|
96
|
+
/**
|
|
97
|
+
* Network timeout constants in milliseconds
|
|
98
|
+
* Used for request timeout configuration based on network quality
|
|
99
|
+
*/
|
|
100
|
+
export declare const NETWORK_TIMEOUTS: {
|
|
101
|
+
/**
|
|
102
|
+
* Fast network timeout - 15 seconds
|
|
103
|
+
*/
|
|
104
|
+
readonly FAST: 15000;
|
|
105
|
+
/**
|
|
106
|
+
* Medium network timeout - 30 seconds
|
|
107
|
+
*/
|
|
108
|
+
readonly MEDIUM: 30000;
|
|
109
|
+
/**
|
|
110
|
+
* Slow network timeout - 60 seconds
|
|
111
|
+
*/
|
|
112
|
+
readonly SLOW: 60000;
|
|
113
|
+
/**
|
|
114
|
+
* Very slow network timeout - 90 seconds
|
|
115
|
+
*/
|
|
116
|
+
readonly VERY_SLOW: 90000;
|
|
117
|
+
/**
|
|
118
|
+
* Offline timeout - 5 seconds (fail fast)
|
|
119
|
+
*/
|
|
120
|
+
readonly OFFLINE: 5000;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Cache TTL (Time-To-Live) constants in seconds
|
|
124
|
+
* Used for cache expiration strategies
|
|
125
|
+
*/
|
|
126
|
+
export declare const CACHE_TTL: {
|
|
127
|
+
/**
|
|
128
|
+
* Short cache TTL - 5 minutes
|
|
129
|
+
*/
|
|
130
|
+
readonly SHORT: 300;
|
|
131
|
+
/**
|
|
132
|
+
* Medium cache TTL - 10 minutes
|
|
133
|
+
*/
|
|
134
|
+
readonly MEDIUM: 600;
|
|
135
|
+
/**
|
|
136
|
+
* Long cache TTL - 30 minutes
|
|
137
|
+
*/
|
|
138
|
+
readonly LONG: 1800;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Cache stale time constants in seconds
|
|
142
|
+
* Used to determine when cached data is considered stale
|
|
143
|
+
*/
|
|
144
|
+
export declare const CACHE_STALE: {
|
|
145
|
+
/**
|
|
146
|
+
* Short stale time - 1 minute
|
|
147
|
+
*/
|
|
148
|
+
readonly SHORT: 60;
|
|
149
|
+
/**
|
|
150
|
+
* Medium stale time - 5 minutes
|
|
151
|
+
*/
|
|
152
|
+
readonly MEDIUM: 300;
|
|
153
|
+
/**
|
|
154
|
+
* Long stale time - 15 minutes
|
|
155
|
+
*/
|
|
156
|
+
readonly LONG: 900;
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* Request deduplication time constants in milliseconds
|
|
160
|
+
* Used to prevent duplicate requests within time windows
|
|
161
|
+
*/
|
|
162
|
+
export declare const DEDUPE_TIME: {
|
|
163
|
+
/**
|
|
164
|
+
* Aggressive deduplication - 1 second
|
|
165
|
+
*/
|
|
166
|
+
readonly AGGRESSIVE: 1000;
|
|
167
|
+
/**
|
|
168
|
+
* Balanced deduplication - 2 seconds
|
|
169
|
+
*/
|
|
170
|
+
readonly BALANCED: 2000;
|
|
171
|
+
/**
|
|
172
|
+
* Conservative deduplication - 5 seconds
|
|
173
|
+
*/
|
|
174
|
+
readonly CONSERVATIVE: 5000;
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* Retry attempt constants
|
|
178
|
+
* Number of retry attempts for failed requests
|
|
179
|
+
*/
|
|
180
|
+
export declare const RETRY_ATTEMPTS: {
|
|
181
|
+
/**
|
|
182
|
+
* Few retry attempts - 2
|
|
183
|
+
*/
|
|
184
|
+
readonly FEW: 2;
|
|
185
|
+
/**
|
|
186
|
+
* Standard retry attempts - 3
|
|
187
|
+
*/
|
|
188
|
+
readonly STANDARD: 3;
|
|
189
|
+
/**
|
|
190
|
+
* Many retry attempts - 5
|
|
191
|
+
*/
|
|
192
|
+
readonly MANY: 5;
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* Retry delay constants in milliseconds
|
|
196
|
+
* Initial delays between retry attempts
|
|
197
|
+
*/
|
|
198
|
+
export declare const RETRY_DELAYS: {
|
|
199
|
+
/**
|
|
200
|
+
* Short retry delay - 1 second
|
|
201
|
+
*/
|
|
202
|
+
readonly SHORT: 1000;
|
|
203
|
+
/**
|
|
204
|
+
* Long retry delay - 2 seconds
|
|
205
|
+
*/
|
|
206
|
+
readonly LONG: 2000;
|
|
207
|
+
/**
|
|
208
|
+
* Maximum retry delay - 30 seconds
|
|
209
|
+
*/
|
|
210
|
+
readonly MAX: 30000;
|
|
211
|
+
};
|
|
212
|
+
/**
|
|
213
|
+
* Retry backoff multiplier constants
|
|
214
|
+
* Exponential backoff multipliers for retry delays
|
|
215
|
+
*/
|
|
216
|
+
export declare const RETRY_BACKOFF: {
|
|
217
|
+
/**
|
|
218
|
+
* Small backoff multiplier - 1.5x
|
|
219
|
+
*/
|
|
220
|
+
readonly SMALL: 1.5;
|
|
221
|
+
/**
|
|
222
|
+
* Medium backoff multiplier - 2x
|
|
223
|
+
*/
|
|
224
|
+
readonly MEDIUM: 2;
|
|
225
|
+
/**
|
|
226
|
+
* Large backoff multiplier - 2.5x
|
|
227
|
+
*/
|
|
228
|
+
readonly LARGE: 2.5;
|
|
229
|
+
};
|
|
230
|
+
/**
|
|
231
|
+
* Batch size constants
|
|
232
|
+
* Number of items to process in a single batch
|
|
233
|
+
*/
|
|
234
|
+
export declare const BATCH_SIZES: {
|
|
235
|
+
/**
|
|
236
|
+
* Huge batch size - 50 items
|
|
237
|
+
*/
|
|
238
|
+
readonly HUGE: 50;
|
|
239
|
+
/**
|
|
240
|
+
* Large batch size - 25 items
|
|
241
|
+
*/
|
|
242
|
+
readonly LARGE: 25;
|
|
243
|
+
/**
|
|
244
|
+
* Medium batch size - 10 items
|
|
245
|
+
*/
|
|
246
|
+
readonly MEDIUM: 10;
|
|
247
|
+
/**
|
|
248
|
+
* Small batch size - 5 items
|
|
249
|
+
*/
|
|
250
|
+
readonly SMALL: 5;
|
|
251
|
+
/**
|
|
252
|
+
* No batching - 0 items
|
|
253
|
+
*/
|
|
254
|
+
readonly NONE: 0;
|
|
255
|
+
};
|
|
256
|
+
/**
|
|
257
|
+
* Page size constants
|
|
258
|
+
* Number of items per page for pagination
|
|
259
|
+
*/
|
|
260
|
+
export declare const PAGE_SIZES: {
|
|
261
|
+
/**
|
|
262
|
+
* Huge page size - 100 items
|
|
263
|
+
*/
|
|
264
|
+
readonly HUGE: 100;
|
|
265
|
+
/**
|
|
266
|
+
* Large page size - 50 items
|
|
267
|
+
*/
|
|
268
|
+
readonly LARGE: 50;
|
|
269
|
+
/**
|
|
270
|
+
* Medium page size - 25 items
|
|
271
|
+
*/
|
|
272
|
+
readonly MEDIUM: 25;
|
|
273
|
+
/**
|
|
274
|
+
* Small page size - 10 items
|
|
275
|
+
*/
|
|
276
|
+
readonly SMALL: 10;
|
|
277
|
+
/**
|
|
278
|
+
* No pagination - 0 items
|
|
279
|
+
*/
|
|
280
|
+
readonly NONE: 0;
|
|
281
|
+
};
|
|
96
282
|
/**
|
|
97
283
|
* Type for network constant values
|
|
98
284
|
*/
|
|
@@ -109,3 +295,39 @@ export type SpeedThreshold = (typeof SPEED_THRESHOLDS)[keyof typeof SPEED_THRESH
|
|
|
109
295
|
* Type for network score values
|
|
110
296
|
*/
|
|
111
297
|
export type NetworkScore = (typeof NETWORK_SCORES)[keyof typeof NETWORK_SCORES];
|
|
298
|
+
/**
|
|
299
|
+
* Type for network timeout values
|
|
300
|
+
*/
|
|
301
|
+
export type NetworkTimeout = (typeof NETWORK_TIMEOUTS)[keyof typeof NETWORK_TIMEOUTS];
|
|
302
|
+
/**
|
|
303
|
+
* Type for cache TTL values
|
|
304
|
+
*/
|
|
305
|
+
export type CacheTTL = (typeof CACHE_TTL)[keyof typeof CACHE_TTL];
|
|
306
|
+
/**
|
|
307
|
+
* Type for cache stale values
|
|
308
|
+
*/
|
|
309
|
+
export type CacheStale = (typeof CACHE_STALE)[keyof typeof CACHE_STALE];
|
|
310
|
+
/**
|
|
311
|
+
* Type for dedupe time values
|
|
312
|
+
*/
|
|
313
|
+
export type DedupeTime = (typeof DEDUPE_TIME)[keyof typeof DEDUPE_TIME];
|
|
314
|
+
/**
|
|
315
|
+
* Type for retry attempt values
|
|
316
|
+
*/
|
|
317
|
+
export type RetryAttempt = (typeof RETRY_ATTEMPTS)[keyof typeof RETRY_ATTEMPTS];
|
|
318
|
+
/**
|
|
319
|
+
* Type for retry delay values
|
|
320
|
+
*/
|
|
321
|
+
export type RetryDelay = (typeof RETRY_DELAYS)[keyof typeof RETRY_DELAYS];
|
|
322
|
+
/**
|
|
323
|
+
* Type for retry backoff values
|
|
324
|
+
*/
|
|
325
|
+
export type RetryBackoff = (typeof RETRY_BACKOFF)[keyof typeof RETRY_BACKOFF];
|
|
326
|
+
/**
|
|
327
|
+
* Type for batch size values
|
|
328
|
+
*/
|
|
329
|
+
export type BatchSize = (typeof BATCH_SIZES)[keyof typeof BATCH_SIZES];
|
|
330
|
+
/**
|
|
331
|
+
* Type for page size values
|
|
332
|
+
*/
|
|
333
|
+
export type PageSize = (typeof PAGE_SIZES)[keyof typeof PAGE_SIZES];
|
package/dist/network/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
'use strict';// @plyaz package - Built with tsup
|
|
2
|
-
var
|
|
2
|
+
var t={IPV4_OCTET_MIN:1,IPV4_OCTET_MAX:255,IPV4_OCTET_COUNT:4,RANDOM_BYTE_MAX:256,DEFAULT_PROCESS_ID_MAX:1e4},E={EXCELLENT:50,GOOD:150,FAIR:400},e={EXCELLENT:10,GOOD:2,FAIR:.5},o={EXCELLENT:100,GOOD:75,FAIR:50,POOR:25,OFFLINE:0},T={FAST:15e3,MEDIUM:3e4,SLOW:6e4,VERY_SLOW:9e4,OFFLINE:5e3},S={SHORT:300,MEDIUM:600,LONG:1800},p={SHORT:60,MEDIUM:300,LONG:900},R={AGGRESSIVE:1e3,BALANCED:2e3,CONSERVATIVE:5e3},y={FEW:2,STANDARD:3,MANY:5},O={SHORT:1e3,LONG:2e3,MAX:3e4},A={SMALL:1.5,MEDIUM:2,LARGE:2.5},_={HUGE:50,LARGE:25,MEDIUM:10,SMALL:5,NONE:0},f={HUGE:100,LARGE:50,MEDIUM:25,SMALL:10,NONE:0};exports.BATCH_SIZES=_;exports.CACHE_STALE=p;exports.CACHE_TTL=S;exports.DEDUPE_TIME=R;exports.NETWORK_CONSTANTS=t;exports.NETWORK_SCORES=o;exports.NETWORK_TIMEOUTS=T;exports.PAGE_SIZES=f;exports.RETRY_ATTEMPTS=y;exports.RETRY_BACKOFF=A;exports.RETRY_DELAYS=O;exports.RTT_THRESHOLDS=E;exports.SPEED_THRESHOLDS=e;//# sourceMappingURL=index.cjs.map
|
|
3
3
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/network/constants.ts"],"names":["NETWORK_CONSTANTS","RTT_THRESHOLDS","SPEED_THRESHOLDS","NETWORK_SCORES"],"mappings":";AAYO,IAAMA,
|
|
1
|
+
{"version":3,"s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AAA,CAKV,KAAM,CACR,CAAA,CAMaC,CAAAA,CAAe,CAI1B,KAAA,CAAO,GAAA,CAKP,IAAA,CAAM,GAAA,CAKN,IAAK,GACP,CAAA,CAMaC,CAAAA,CAAgB,CAI3B,KAAA,CAAO,GAAA,CAKP,MAAA,CAAQ,CAAA,CAKR,KAAA,CAAO,GACT,CAAA,CAMaC,CAAAA,CAAc,CAIzB,IAAA,CAAM,EAAA,CAKN,KAAA,CAAO,GAKP,MAAA,CAAQ,EAAA,CAKR,KAAA,CAAO,CAAA,CAKP,IAAA,CAAM,CACR,CAAA,CAMaC,CAAAA,CAAa,CAIxB,IAAA,CAAM,GAAA,CAKN,KAAA,CAAO,EAAA,CAKP,MAAA,CAAQ,EAAA,CAKR,KAAA,CAAO,EAAA,CAKP,KAAM,CACR","file":"index.cjs","sourcesContent":["/**\n * Network-related Constants\n *\n * Constants for network operations including IP addresses,\n * byte ranges, and process identifiers.\n *\n * @module network/constants\n */\n\n/**\n * Network and connection constants\n */\nexport const NETWORK_CONSTANTS = {\n /**\n * Minimum value for an IPv4 octet (excluding 0 for first octet)\n */\n IPV4_OCTET_MIN: 1,\n\n /**\n * Maximum value for an IPv4 octet\n */\n IPV4_OCTET_MAX: 255,\n\n /**\n * Number of octets in an IPv4 address\n */\n IPV4_OCTET_COUNT: 4,\n\n /**\n * Maximum value for a random byte (256 exclusive)\n */\n RANDOM_BYTE_MAX: 256,\n\n /**\n * Default maximum process ID for testing\n */\n DEFAULT_PROCESS_ID_MAX: 10000,\n} as const;\n\n/**\n * Round-trip time (RTT) thresholds in milliseconds\n * Used to classify network latency quality\n */\nexport const RTT_THRESHOLDS = {\n /**\n * Excellent network latency - under 50ms\n */\n EXCELLENT: 50,\n\n /**\n * Good network latency - under 150ms\n */\n GOOD: 150,\n\n /**\n * Fair network latency - under 400ms\n */\n FAIR: 400,\n} as const;\n\n/**\n * Network speed thresholds in Mbps\n * Used to classify connection speed quality\n */\nexport const SPEED_THRESHOLDS = {\n /**\n * Excellent connection speed - 10+ Mbps\n */\n EXCELLENT: 10,\n\n /**\n * Good connection speed - 2+ Mbps\n */\n GOOD: 2,\n\n /**\n * Fair connection speed - 0.5+ Mbps\n */\n FAIR: 0.5,\n} as const;\n\n/**\n * Network quality scores (0-100 scale)\n * Used to quantify overall network performance\n */\nexport const NETWORK_SCORES = {\n /**\n * Excellent network quality score\n */\n EXCELLENT: 100,\n\n /**\n * Good network quality score\n */\n GOOD: 75,\n\n /**\n * Fair network quality score\n */\n FAIR: 50,\n\n /**\n * Poor network quality score\n */\n POOR: 25,\n\n /**\n * Offline - no network connection\n */\n OFFLINE: 0,\n} as const;\n\n/**\n * Network timeout constants in milliseconds\n * Used for request timeout configuration based on network quality\n */\nexport const NETWORK_TIMEOUTS = {\n /**\n * Fast network timeout - 15 seconds\n */\n FAST: 15000,\n\n /**\n * Medium network timeout - 30 seconds\n */\n MEDIUM: 30000,\n\n /**\n * Slow network timeout - 60 seconds\n */\n SLOW: 60000,\n\n /**\n * Very slow network timeout - 90 seconds\n */\n VERY_SLOW: 90000,\n\n /**\n * Offline timeout - 5 seconds (fail fast)\n */\n OFFLINE: 5000,\n} as const;\n\n/**\n * Cache TTL (Time-To-Live) constants in seconds\n * Used for cache expiration strategies\n */\nexport const CACHE_TTL = {\n /**\n * Short cache TTL - 5 minutes\n */\n SHORT: 300,\n\n /**\n * Medium cache TTL - 10 minutes\n */\n MEDIUM: 600,\n\n /**\n * Long cache TTL - 30 minutes\n */\n LONG: 1800,\n} as const;\n\n/**\n * Cache stale time constants in seconds\n * Used to determine when cached data is considered stale\n */\nexport const CACHE_STALE = {\n /**\n * Short stale time - 1 minute\n */\n SHORT: 60,\n\n /**\n * Medium stale time - 5 minutes\n */\n MEDIUM: 300,\n\n /**\n * Long stale time - 15 minutes\n */\n LONG: 900,\n} as const;\n\n/**\n * Request deduplication time constants in milliseconds\n * Used to prevent duplicate requests within time windows\n */\nexport const DEDUPE_TIME = {\n /**\n * Aggressive deduplication - 1 second\n */\n AGGRESSIVE: 1000,\n\n /**\n * Balanced deduplication - 2 seconds\n */\n BALANCED: 2000,\n\n /**\n * Conservative deduplication - 5 seconds\n */\n CONSERVATIVE: 5000,\n} as const;\n\n/**\n * Retry attempt constants\n * Number of retry attempts for failed requests\n */\nexport const RETRY_ATTEMPTS = {\n /**\n * Few retry attempts - 2\n */\n FEW: 2,\n\n /**\n * Standard retry attempts - 3\n */\n STANDARD: 3,\n\n /**\n * Many retry attempts - 5\n */\n MANY: 5,\n} as const;\n\n/**\n * Retry delay constants in milliseconds\n * Initial delays between retry attempts\n */\nexport const RETRY_DELAYS = {\n /**\n * Short retry delay - 1 second\n */\n SHORT: 1000,\n\n /**\n * Long retry delay - 2 seconds\n */\n LONG: 2000,\n\n /**\n * Maximum retry delay - 30 seconds\n */\n MAX: 30000,\n} as const;\n\n/**\n * Retry backoff multiplier constants\n * Exponential backoff multipliers for retry delays\n */\nexport const RETRY_BACKOFF = {\n /**\n * Small backoff multiplier - 1.5x\n */\n SMALL: 1.5,\n\n /**\n * Medium backoff multiplier - 2x\n */\n MEDIUM: 2,\n\n /**\n * Large backoff multiplier - 2.5x\n */\n LARGE: 2.5,\n} as const;\n\n/**\n * Batch size constants\n * Number of items to process in a single batch\n */\nexport const BATCH_SIZES = {\n /**\n * Huge batch size - 50 items\n */\n HUGE: 50,\n\n /**\n * Large batch size - 25 items\n */\n LARGE: 25,\n\n /**\n * Medium batch size - 10 items\n */\n MEDIUM: 10,\n\n /**\n * Small batch size - 5 items\n */\n SMALL: 5,\n\n /**\n * No batching - 0 items\n */\n NONE: 0,\n} as const;\n\n/**\n * Page size constants\n * Number of items per page for pagination\n */\nexport const PAGE_SIZES = {\n /**\n * Huge page size - 100 items\n */\n HUGE: 100,\n\n /**\n * Large page size - 50 items\n */\n LARGE: 50,\n\n /**\n * Medium page size - 25 items\n */\n MEDIUM: 25,\n\n /**\n * Small page size - 10 items\n */\n SMALL: 10,\n\n /**\n * No pagination - 0 items\n */\n NONE: 0,\n} as const;\n\n/**\n * Type for network constant values\n */\nexport type NetworkConstant = (typeof NETWORK_CONSTANTS)[keyof typeof NETWORK_CONSTANTS];\n\n/**\n * Type for RTT threshold values\n */\nexport type RTTThreshold = (typeof RTT_THRESHOLDS)[keyof typeof RTT_THRESHOLDS];\n\n/**\n * Type for speed threshold values\n */\nexport type SpeedThreshold = (typeof SPEED_THRESHOLDS)[keyof typeof SPEED_THRESHOLDS];\n\n/**\n * Type for network score values\n */\nexport type NetworkScore = (typeof NETWORK_SCORES)[keyof typeof NETWORK_SCORES];\n\n/**\n * Type for network timeout values\n */\nexport type NetworkTimeout = (typeof NETWORK_TIMEOUTS)[keyof typeof NETWORK_TIMEOUTS];\n\n/**\n * Type for cache TTL values\n */\nexport type CacheTTL = (typeof CACHE_TTL)[keyof typeof CACHE_TTL];\n\n/**\n * Type for cache stale values\n */\nexport type CacheStale = (typeof CACHE_STALE)[keyof typeof CACHE_STALE];\n\n/**\n * Type for dedupe time values\n */\nexport type DedupeTime = (typeof DEDUPE_TIME)[keyof typeof DEDUPE_TIME];\n\n/**\n * Type for retry attempt values\n */\nexport type RetryAttempt = (typeof RETRY_ATTEMPTS)[keyof typeof RETRY_ATTEMPTS];\n\n/**\n * Type for retry delay values\n */\nexport type RetryDelay = (typeof RETRY_DELAYS)[keyof typeof RETRY_DELAYS];\n\n/**\n * Type for retry backoff values\n */\nexport type RetryBackoff = (typeof RETRY_BACKOFF)[keyof typeof RETRY_BACKOFF];\n\n/**\n * Type for batch size values\n */\nexport type BatchSize = (typeof BATCH_SIZES)[keyof typeof BATCH_SIZES];\n\n/**\n * Type for page size values\n */\nexport type PageSize = (typeof PAGE_SIZES)[keyof typeof PAGE_SIZES];\n"]}
|
package/dist/network/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @plyaz package - Built with tsup
|
|
2
|
-
var
|
|
2
|
+
var t={IPV4_OCTET_MIN:1,IPV4_OCTET_MAX:255,IPV4_OCTET_COUNT:4,RANDOM_BYTE_MAX:256,DEFAULT_PROCESS_ID_MAX:1e4},E={EXCELLENT:50,GOOD:150,FAIR:400},e={EXCELLENT:10,GOOD:2,FAIR:.5},o={EXCELLENT:100,GOOD:75,FAIR:50,POOR:25,OFFLINE:0},T={FAST:15e3,MEDIUM:3e4,SLOW:6e4,VERY_SLOW:9e4,OFFLINE:5e3},S={SHORT:300,MEDIUM:600,LONG:1800},p={SHORT:60,MEDIUM:300,LONG:900},R={AGGRESSIVE:1e3,BALANCED:2e3,CONSERVATIVE:5e3},y={FEW:2,STANDARD:3,MANY:5},O={SHORT:1e3,LONG:2e3,MAX:3e4},A={SMALL:1.5,MEDIUM:2,LARGE:2.5},_={HUGE:50,LARGE:25,MEDIUM:10,SMALL:5,NONE:0},f={HUGE:100,LARGE:50,MEDIUM:25,SMALL:10,NONE:0};export{_ as BATCH_SIZES,p as CACHE_STALE,S as CACHE_TTL,R as DEDUPE_TIME,t as NETWORK_CONSTANTS,o as NETWORK_SCORES,T as NETWORK_TIMEOUTS,f as PAGE_SIZES,y as RETRY_ATTEMPTS,A as RETRY_BACKOFF,O as RETRY_DELAYS,E as RTT_THRESHOLDS,e as SPEED_THRESHOLDS};//# sourceMappingURL=index.mjs.map
|
|
3
3
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/network/constants.ts"],"names":["NETWORK_CONSTANTS","RTT_THRESHOLDS","SPEED_THRESHOLDS","NETWORK_SCORES"],"mappings":";AAYO,IAAMA,
|
|
1
|
+
{"version":3,"sources":["../../src/network/constants.ts"],"names":["NETWORK_CONSTANTS","RTT_THRESHOLDS","SPEED_THRESHOLDS","NETWORK_SCORES","NETWORK_TIMEOUTS","CACHE_TTL","CACHE_STALE","DEDUPE_TIME","RETRY_ATTEMPTS","RETRY_DELAYS","RETRY_BACKOFF","BATCH_SIZES","PAGE_SIZES"],"mappings":";AAYO,IAAMA,CAAAA,CAAoB,CAI/B,cAAA,CAAgB,CAA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AKN,KAAA,CAAO,GAKP,MAAA,CAAQ,EAAA,CAKR,KAAA,CAAO,CAAA,CAKP,IAAA,CAAM,CACR,CAAA,CAMaC,CAAAA,CAAa,CAIxB,IAAA,CAAM,GAAA,CAKN,KAAA,CAAO,EAAA,CAKP,MAAA,CAAQ,EAAA,CAKR,KAAA,CAAO,EAAA,CAKP,KAAM,CACR","file":"index.mjs","sourcesContent":["/**\n * Network-related Constants\n *\n * Constants for network operations including IP addresses,\n * byte ranges, and process identifiers.\n *\n * @module network/constants\n */\n\n/**\n * Network and connection constants\n */\nexport const NETWORK_CONSTANTS = {\n /**\n * Minimum value for an IPv4 octet (excluding 0 for first octet)\n */\n IPV4_OCTET_MIN: 1,\n\n /**\n * Maximum value for an IPv4 octet\n */\n IPV4_OCTET_MAX: 255,\n\n /**\n * Number of octets in an IPv4 address\n */\n IPV4_OCTET_COUNT: 4,\n\n /**\n * Maximum value for a random byte (256 exclusive)\n */\n RANDOM_BYTE_MAX: 256,\n\n /**\n * Default maximum process ID for testing\n */\n DEFAULT_PROCESS_ID_MAX: 10000,\n} as const;\n\n/**\n * Round-trip time (RTT) thresholds in milliseconds\n * Used to classify network latency quality\n */\nexport const RTT_THRESHOLDS = {\n /**\n * Excellent network latency - under 50ms\n */\n EXCELLENT: 50,\n\n /**\n * Good network latency - under 150ms\n */\n GOOD: 150,\n\n /**\n * Fair network latency - under 400ms\n */\n FAIR: 400,\n} as const;\n\n/**\n * Network speed thresholds in Mbps\n * Used to classify connection speed quality\n */\nexport const SPEED_THRESHOLDS = {\n /**\n * Excellent connection speed - 10+ Mbps\n */\n EXCELLENT: 10,\n\n /**\n * Good connection speed - 2+ Mbps\n */\n GOOD: 2,\n\n /**\n * Fair connection speed - 0.5+ Mbps\n */\n FAIR: 0.5,\n} as const;\n\n/**\n * Network quality scores (0-100 scale)\n * Used to quantify overall network performance\n */\nexport const NETWORK_SCORES = {\n /**\n * Excellent network quality score\n */\n EXCELLENT: 100,\n\n /**\n * Good network quality score\n */\n GOOD: 75,\n\n /**\n * Fair network quality score\n */\n FAIR: 50,\n\n /**\n * Poor network quality score\n */\n POOR: 25,\n\n /**\n * Offline - no network connection\n */\n OFFLINE: 0,\n} as const;\n\n/**\n * Network timeout constants in milliseconds\n * Used for request timeout configuration based on network quality\n */\nexport const NETWORK_TIMEOUTS = {\n /**\n * Fast network timeout - 15 seconds\n */\n FAST: 15000,\n\n /**\n * Medium network timeout - 30 seconds\n */\n MEDIUM: 30000,\n\n /**\n * Slow network timeout - 60 seconds\n */\n SLOW: 60000,\n\n /**\n * Very slow network timeout - 90 seconds\n */\n VERY_SLOW: 90000,\n\n /**\n * Offline timeout - 5 seconds (fail fast)\n */\n OFFLINE: 5000,\n} as const;\n\n/**\n * Cache TTL (Time-To-Live) constants in seconds\n * Used for cache expiration strategies\n */\nexport const CACHE_TTL = {\n /**\n * Short cache TTL - 5 minutes\n */\n SHORT: 300,\n\n /**\n * Medium cache TTL - 10 minutes\n */\n MEDIUM: 600,\n\n /**\n * Long cache TTL - 30 minutes\n */\n LONG: 1800,\n} as const;\n\n/**\n * Cache stale time constants in seconds\n * Used to determine when cached data is considered stale\n */\nexport const CACHE_STALE = {\n /**\n * Short stale time - 1 minute\n */\n SHORT: 60,\n\n /**\n * Medium stale time - 5 minutes\n */\n MEDIUM: 300,\n\n /**\n * Long stale time - 15 minutes\n */\n LONG: 900,\n} as const;\n\n/**\n * Request deduplication time constants in milliseconds\n * Used to prevent duplicate requests within time windows\n */\nexport const DEDUPE_TIME = {\n /**\n * Aggressive deduplication - 1 second\n */\n AGGRESSIVE: 1000,\n\n /**\n * Balanced deduplication - 2 seconds\n */\n BALANCED: 2000,\n\n /**\n * Conservative deduplication - 5 seconds\n */\n CONSERVATIVE: 5000,\n} as const;\n\n/**\n * Retry attempt constants\n * Number of retry attempts for failed requests\n */\nexport const RETRY_ATTEMPTS = {\n /**\n * Few retry attempts - 2\n */\n FEW: 2,\n\n /**\n * Standard retry attempts - 3\n */\n STANDARD: 3,\n\n /**\n * Many retry attempts - 5\n */\n MANY: 5,\n} as const;\n\n/**\n * Retry delay constants in milliseconds\n * Initial delays between retry attempts\n */\nexport const RETRY_DELAYS = {\n /**\n * Short retry delay - 1 second\n */\n SHORT: 1000,\n\n /**\n * Long retry delay - 2 seconds\n */\n LONG: 2000,\n\n /**\n * Maximum retry delay - 30 seconds\n */\n MAX: 30000,\n} as const;\n\n/**\n * Retry backoff multiplier constants\n * Exponential backoff multipliers for retry delays\n */\nexport const RETRY_BACKOFF = {\n /**\n * Small backoff multiplier - 1.5x\n */\n SMALL: 1.5,\n\n /**\n * Medium backoff multiplier - 2x\n */\n MEDIUM: 2,\n\n /**\n * Large backoff multiplier - 2.5x\n */\n LARGE: 2.5,\n} as const;\n\n/**\n * Batch size constants\n * Number of items to process in a single batch\n */\nexport const BATCH_SIZES = {\n /**\n * Huge batch size - 50 items\n */\n HUGE: 50,\n\n /**\n * Large batch size - 25 items\n */\n LARGE: 25,\n\n /**\n * Medium batch size - 10 items\n */\n MEDIUM: 10,\n\n /**\n * Small batch size - 5 items\n */\n SMALL: 5,\n\n /**\n * No batching - 0 items\n */\n NONE: 0,\n} as const;\n\n/**\n * Page size constants\n * Number of items per page for pagination\n */\nexport const PAGE_SIZES = {\n /**\n * Huge page size - 100 items\n */\n HUGE: 100,\n\n /**\n * Large page size - 50 items\n */\n LARGE: 50,\n\n /**\n * Medium page size - 25 items\n */\n MEDIUM: 25,\n\n /**\n * Small page size - 10 items\n */\n SMALL: 10,\n\n /**\n * No pagination - 0 items\n */\n NONE: 0,\n} as const;\n\n/**\n * Type for network constant values\n */\nexport type NetworkConstant = (typeof NETWORK_CONSTANTS)[keyof typeof NETWORK_CONSTANTS];\n\n/**\n * Type for RTT threshold values\n */\nexport type RTTThreshold = (typeof RTT_THRESHOLDS)[keyof typeof RTT_THRESHOLDS];\n\n/**\n * Type for speed threshold values\n */\nexport type SpeedThreshold = (typeof SPEED_THRESHOLDS)[keyof typeof SPEED_THRESHOLDS];\n\n/**\n * Type for network score values\n */\nexport type NetworkScore = (typeof NETWORK_SCORES)[keyof typeof NETWORK_SCORES];\n\n/**\n * Type for network timeout values\n */\nexport type NetworkTimeout = (typeof NETWORK_TIMEOUTS)[keyof typeof NETWORK_TIMEOUTS];\n\n/**\n * Type for cache TTL values\n */\nexport type CacheTTL = (typeof CACHE_TTL)[keyof typeof CACHE_TTL];\n\n/**\n * Type for cache stale values\n */\nexport type CacheStale = (typeof CACHE_STALE)[keyof typeof CACHE_STALE];\n\n/**\n * Type for dedupe time values\n */\nexport type DedupeTime = (typeof DEDUPE_TIME)[keyof typeof DEDUPE_TIME];\n\n/**\n * Type for retry attempt values\n */\nexport type RetryAttempt = (typeof RETRY_ATTEMPTS)[keyof typeof RETRY_ATTEMPTS];\n\n/**\n * Type for retry delay values\n */\nexport type RetryDelay = (typeof RETRY_DELAYS)[keyof typeof RETRY_DELAYS];\n\n/**\n * Type for retry backoff values\n */\nexport type RetryBackoff = (typeof RETRY_BACKOFF)[keyof typeof RETRY_BACKOFF];\n\n/**\n * Type for batch size values\n */\nexport type BatchSize = (typeof BATCH_SIZES)[keyof typeof BATCH_SIZES];\n\n/**\n * Type for page size values\n */\nexport type PageSize = (typeof PAGE_SIZES)[keyof typeof PAGE_SIZES];\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plyaz/config",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.2",
|
|
4
4
|
"author": "Redeemer Pace",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"description": "Provides shared configs and constants for @playz ecosystem.",
|
|
@@ -87,6 +87,18 @@
|
|
|
87
87
|
"require": "./dist/api/index.cjs",
|
|
88
88
|
"default": "./dist/api/index.mjs"
|
|
89
89
|
},
|
|
90
|
+
"./errors": {
|
|
91
|
+
"types": "./dist/errors/index.d.ts",
|
|
92
|
+
"import": "./dist/errors/index.mjs",
|
|
93
|
+
"require": "./dist/errors/index.cjs",
|
|
94
|
+
"default": "./dist/errors/index.mjs"
|
|
95
|
+
},
|
|
96
|
+
"./logger": {
|
|
97
|
+
"types": "./dist/logger/index.d.ts",
|
|
98
|
+
"import": "./dist/logger/index.mjs",
|
|
99
|
+
"require": "./dist/logger/index.cjs",
|
|
100
|
+
"default": "./dist/logger/index.mjs"
|
|
101
|
+
},
|
|
90
102
|
"./translations": {
|
|
91
103
|
"types": "./dist/translations/index.d.ts"
|
|
92
104
|
},
|