@plyaz/types 1.14.2 → 1.14.4
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/index.cjs +0 -13
- package/dist/api/index.cjs.map +1 -1
- package/dist/api/index.d.ts +0 -1
- package/dist/api/index.js +1 -13
- package/dist/api/index.js.map +1 -1
- package/dist/api/utils/types.d.ts +0 -19
- package/dist/common/enums.d.ts +25 -0
- package/dist/common/index.cjs +27 -0
- package/dist/common/index.cjs.map +1 -1
- package/dist/common/index.d.ts +1 -0
- package/dist/common/index.js +26 -0
- package/dist/common/index.js.map +1 -1
- package/dist/db/index.cjs.map +1 -1
- package/dist/db/index.js.map +1 -1
- package/dist/errors/enums.d.ts +28 -0
- package/dist/errors/index.cjs +26 -0
- package/dist/errors/index.cjs.map +1 -1
- package/dist/errors/index.js +26 -1
- package/dist/errors/index.js.map +1 -1
- package/dist/index.cjs +122 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.js +118 -13
- package/dist/index.js.map +1 -1
- package/dist/logger/enums.d.ts +36 -0
- package/dist/logger/types.d.ts +43 -6
- package/dist/notifications/types.d.ts +8 -7
- package/dist/utils/enums.d.ts +69 -0
- package/dist/utils/types.d.ts +24 -0
- package/package.json +11 -1
- package/dist/api/utils/enums.d.ts +0 -23
- package/dist/logger/index.d.ts +0 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard service names for logger instances across packages
|
|
3
|
+
*
|
|
4
|
+
* These constants ensure consistency in service naming and prevent typos
|
|
5
|
+
* when creating logger instances.
|
|
6
|
+
*/
|
|
7
|
+
export declare const LOGGER_SERVICES: {
|
|
8
|
+
readonly API_CLIENT: "ApiClient";
|
|
9
|
+
readonly CLIENT_EVENT_MANAGER: "ClientEventManager";
|
|
10
|
+
readonly INTERCEPTORS: "Interceptors";
|
|
11
|
+
readonly PUB_SUB: "PubSub";
|
|
12
|
+
readonly EVENT_MANAGER: "EventManager";
|
|
13
|
+
readonly EVENT_QUEUE: "EventQueue";
|
|
14
|
+
readonly CONFIG_QUEUE: "ConfigQueue";
|
|
15
|
+
readonly OPERATION_TRACKER: "OperationTracker";
|
|
16
|
+
readonly EXPRESS_FRAMEWORK: "ExpressFramework";
|
|
17
|
+
readonly NESTJS_GUARD: "NestJSGuard";
|
|
18
|
+
readonly NESTJS_INTERCEPTOR: "NestJSInterceptor";
|
|
19
|
+
readonly NETWORK_CONFIGURATION: "NetworkConfiguration";
|
|
20
|
+
readonly BASE_OPERATION_TRACKER: "BaseOperationTracker";
|
|
21
|
+
readonly EVENT_QUEUE_MANAGER: "EventQueueManager";
|
|
22
|
+
readonly QUEUE_ORCHESTRATOR: "QueueOrchestrator";
|
|
23
|
+
readonly PERFORMANCE_MONITOR: "PerformanceMonitor";
|
|
24
|
+
readonly DEBUG_REPORT: "DebugReport";
|
|
25
|
+
readonly UNIFIED_DEBUGGER: "UnifiedDebugger";
|
|
26
|
+
readonly DEBUGGER_QUEUE_MANAGER: "DebuggerQueueManager";
|
|
27
|
+
readonly EMAIL_SERVICE: "EmailService";
|
|
28
|
+
readonly SMS_SERVICE: "SMSService";
|
|
29
|
+
readonly PUSH_SERVICE: "PushService";
|
|
30
|
+
readonly WEBHOOK_SERVICE: "WebhookService";
|
|
31
|
+
readonly TEMPLATE_ENGINE: "TemplateEngine";
|
|
32
|
+
readonly ATTACHMENT_RESOLVER: "AttachmentResolver";
|
|
33
|
+
readonly CONFIG_MANAGER: "ConfigManager";
|
|
34
|
+
readonly CONFIG_VALIDATOR: "ConfigValidator";
|
|
35
|
+
};
|
|
36
|
+
export type LoggerService = (typeof LOGGER_SERVICES)[keyof typeof LOGGER_SERVICES];
|
package/dist/logger/types.d.ts
CHANGED
|
@@ -1,13 +1,50 @@
|
|
|
1
1
|
import type pino from 'pino';
|
|
2
|
+
/**
|
|
3
|
+
* Base logger interface with support for both patterns:
|
|
4
|
+
* - Single meta object: logger.info('msg', { key: val })
|
|
5
|
+
* - Variadic args: logger.info('msg', obj1, obj2, ...)
|
|
6
|
+
*/
|
|
2
7
|
export interface LoggerInterface {
|
|
3
|
-
debug(message: string,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
debug(message: string, meta?: Record<string, unknown>): void;
|
|
9
|
+
debug(message: string, ...supportingDetails: unknown[]): void;
|
|
10
|
+
info(message: string, meta?: Record<string, unknown>): void;
|
|
11
|
+
info(message: string, ...supportingDetails: unknown[]): void;
|
|
12
|
+
warn(message: string, meta?: Record<string, unknown>): void;
|
|
13
|
+
warn(message: string, ...supportingDetails: unknown[]): void;
|
|
14
|
+
error(message: string, meta?: Record<string, unknown>): void;
|
|
15
|
+
error(message: string, ...supportingDetails: unknown[]): void;
|
|
16
|
+
fatal(message: string, meta?: Record<string, unknown>): void;
|
|
17
|
+
fatal(message: string, ...supportingDetails: unknown[]): void;
|
|
18
|
+
group?(label?: string): void;
|
|
19
|
+
groupCollapsed?(label?: string): void;
|
|
20
|
+
groupEnd?(): void;
|
|
8
21
|
}
|
|
9
22
|
export type LoggerMethodTypes = 'debug' | 'info' | 'warn' | 'error' | 'fatal';
|
|
10
|
-
export type LoggerEnvironment = 'development' | 'production';
|
|
23
|
+
export type LoggerEnvironment = 'development' | 'production' | 'staging';
|
|
24
|
+
/**
|
|
25
|
+
* Configuration for PackageLogger instances
|
|
26
|
+
*/
|
|
27
|
+
export interface PackageLoggerConfig {
|
|
28
|
+
/** Package name (e.g., 'notifications', 'api', 'config') */
|
|
29
|
+
packageName: string;
|
|
30
|
+
/** Service/module name within package (optional) */
|
|
31
|
+
service?: string;
|
|
32
|
+
/** Environment (development or production) */
|
|
33
|
+
environment?: LoggerEnvironment;
|
|
34
|
+
/** Correlation ID for request tracing */
|
|
35
|
+
correlationId?: string;
|
|
36
|
+
/** Minimum log level to output */
|
|
37
|
+
minLevel?: LoggerMethodTypes;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Extended logger interface with package context support
|
|
41
|
+
*/
|
|
42
|
+
export interface PackageLoggerInterface extends LoggerInterface {
|
|
43
|
+
/** Create child logger with additional context */
|
|
44
|
+
child(context: Record<string, unknown>): PackageLoggerInterface;
|
|
45
|
+
/** Get current package context */
|
|
46
|
+
getContext(): Record<string, unknown>;
|
|
47
|
+
}
|
|
11
48
|
/**
|
|
12
49
|
* Infers the parameter types for a specific logger method from the `pino.Logger` interface.
|
|
13
50
|
*
|
|
@@ -160,7 +160,7 @@ export interface BaseAdapterConfig {
|
|
|
160
160
|
/** Optional fallback adapter */
|
|
161
161
|
fallbackAdapter?: unknown;
|
|
162
162
|
/** Optional logger */
|
|
163
|
-
logger?:
|
|
163
|
+
logger?: Logger;
|
|
164
164
|
/** Attachment resolver options */
|
|
165
165
|
attachmentResolverOptions?: AttachmentResolverOptions;
|
|
166
166
|
/** API client configuration (for providers using @plyaz/api) */
|
|
@@ -1206,7 +1206,7 @@ export interface AttachmentResolverOptions {
|
|
|
1206
1206
|
/** Allow local file paths (default: true) */
|
|
1207
1207
|
allowLocalPaths?: boolean;
|
|
1208
1208
|
/** Logger */
|
|
1209
|
-
logger?:
|
|
1209
|
+
logger?: Logger;
|
|
1210
1210
|
}
|
|
1211
1211
|
/**
|
|
1212
1212
|
* Base event payload with generic metadata support
|
|
@@ -1351,11 +1351,12 @@ export interface Logger {
|
|
|
1351
1351
|
info(message: string, meta?: UnknownRecord): void;
|
|
1352
1352
|
warn(message: string, meta?: UnknownRecord): void;
|
|
1353
1353
|
error(message: string, meta?: UnknownRecord): void;
|
|
1354
|
+
fatal?(message: string, meta?: UnknownRecord): void;
|
|
1354
1355
|
}
|
|
1355
1356
|
/**
|
|
1356
1357
|
* Log level type
|
|
1357
1358
|
*/
|
|
1358
|
-
export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
1359
|
+
export type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'fatal';
|
|
1359
1360
|
/**
|
|
1360
1361
|
* NotificationAdapter - Base interface all providers must implement
|
|
1361
1362
|
*
|
|
@@ -1861,7 +1862,7 @@ export interface BaseWebhookAdapterConfig extends WebhookAdapterConfig {
|
|
|
1861
1862
|
/** Header name containing the signature */
|
|
1862
1863
|
signatureHeader?: string;
|
|
1863
1864
|
/** Logger instance */
|
|
1864
|
-
logger?:
|
|
1865
|
+
logger?: Logger;
|
|
1865
1866
|
}
|
|
1866
1867
|
/**
|
|
1867
1868
|
* Idempotency record (internal use)
|
|
@@ -1911,7 +1912,7 @@ export interface InfobipDeliveryWebhookConfig {
|
|
|
1911
1912
|
*/
|
|
1912
1913
|
priority?: number;
|
|
1913
1914
|
/** Logger instance */
|
|
1914
|
-
logger?:
|
|
1915
|
+
logger?: Logger;
|
|
1915
1916
|
}
|
|
1916
1917
|
/**
|
|
1917
1918
|
* Infobip Email Tracking Webhook configuration
|
|
@@ -1937,7 +1938,7 @@ export interface InfobipTrackingWebhookConfig {
|
|
|
1937
1938
|
*/
|
|
1938
1939
|
priority?: number;
|
|
1939
1940
|
/** Logger instance */
|
|
1940
|
-
logger?:
|
|
1941
|
+
logger?: Logger;
|
|
1941
1942
|
}
|
|
1942
1943
|
/**
|
|
1943
1944
|
* SendGrid Webhook configuration
|
|
@@ -1975,5 +1976,5 @@ export interface SendGridWebhookConfig {
|
|
|
1975
1976
|
*/
|
|
1976
1977
|
priority?: number;
|
|
1977
1978
|
/** Logger instance */
|
|
1978
|
-
logger?:
|
|
1979
|
+
logger?: Logger;
|
|
1979
1980
|
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Media file extensions
|
|
3
|
+
*/
|
|
4
|
+
export declare const MEDIA_EXTENSIONS: {
|
|
5
|
+
readonly IMAGE: readonly ["jpg", "jpeg", "png", "gif", "webp", "svg", "ico", "bmp", "tiff"];
|
|
6
|
+
readonly VIDEO: readonly ["mp4", "webm", "avi", "mov", "wmv", "flv", "mkv", "3gp"];
|
|
7
|
+
readonly AUDIO: readonly ["mp3", "wav", "ogg", "aac", "flac", "m4a", "wma"];
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Media MIME type prefixes
|
|
11
|
+
*/
|
|
12
|
+
export declare const MEDIA_MIME_PREFIXES: readonly ["image/", "video/", "audio/"];
|
|
13
|
+
/**
|
|
14
|
+
* ANSI color codes
|
|
15
|
+
*/
|
|
16
|
+
export declare const COLORS: {
|
|
17
|
+
readonly reset: "\u001B[0m";
|
|
18
|
+
readonly black: "\u001B[30m";
|
|
19
|
+
readonly red: "\u001B[31m";
|
|
20
|
+
readonly green: "\u001B[32m";
|
|
21
|
+
readonly yellow: "\u001B[33m";
|
|
22
|
+
readonly blue: "\u001B[34m";
|
|
23
|
+
readonly magenta: "\u001B[35m";
|
|
24
|
+
readonly cyan: "\u001B[36m";
|
|
25
|
+
readonly white: "\u001B[37m";
|
|
26
|
+
readonly gray: "\u001B[90m";
|
|
27
|
+
readonly brightRed: "\u001B[91m";
|
|
28
|
+
readonly brightGreen: "\u001B[92m";
|
|
29
|
+
readonly brightYellow: "\u001B[93m";
|
|
30
|
+
readonly brightBlue: "\u001B[94m";
|
|
31
|
+
readonly brightMagenta: "\u001B[95m";
|
|
32
|
+
readonly brightCyan: "\u001B[96m";
|
|
33
|
+
readonly brightWhite: "\u001B[97m";
|
|
34
|
+
readonly bgRed: "\u001B[41m";
|
|
35
|
+
readonly bgGreen: "\u001B[42m";
|
|
36
|
+
readonly bgYellow: "\u001B[43m";
|
|
37
|
+
readonly bgBlue: "\u001B[44m";
|
|
38
|
+
readonly bgMagenta: "\u001B[45m";
|
|
39
|
+
readonly bgCyan: "\u001B[46m";
|
|
40
|
+
readonly bgWhite: "\u001B[47m";
|
|
41
|
+
readonly bold: "\u001B[1m";
|
|
42
|
+
readonly dim: "\u001B[2m";
|
|
43
|
+
readonly italic: "\u001B[3m";
|
|
44
|
+
readonly underline: "\u001B[4m";
|
|
45
|
+
readonly blink: "\u001B[5m";
|
|
46
|
+
readonly reverse: "\u001B[7m";
|
|
47
|
+
readonly hidden: "\u001B[8m";
|
|
48
|
+
readonly strikethrough: "\u001B[9m";
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Correlation ID types for different contexts
|
|
52
|
+
* Used across packages for distributed tracing and event correlation
|
|
53
|
+
*/
|
|
54
|
+
export declare enum CORRELATION_TYPE {
|
|
55
|
+
/** Network event correlation */
|
|
56
|
+
NETWORK = "net",
|
|
57
|
+
/** API request correlation */
|
|
58
|
+
API = "api",
|
|
59
|
+
/** User session correlation */
|
|
60
|
+
SESSION = "session",
|
|
61
|
+
/** Transaction correlation */
|
|
62
|
+
TRANSACTION = "txn",
|
|
63
|
+
/** Event correlation */
|
|
64
|
+
EVENT = "evt",
|
|
65
|
+
/** Trace correlation */
|
|
66
|
+
TRACE = "trace",
|
|
67
|
+
/** Generic correlation */
|
|
68
|
+
GENERIC = "corr"
|
|
69
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility Types
|
|
3
|
+
* Common types used across packages
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* ID generation options
|
|
7
|
+
* Used for generating unique identifiers across packages
|
|
8
|
+
*/
|
|
9
|
+
export interface IdGenerationOptions {
|
|
10
|
+
/** Prefix for the ID */
|
|
11
|
+
prefix?: string;
|
|
12
|
+
/** Suffix for the ID */
|
|
13
|
+
suffix?: string;
|
|
14
|
+
/** Use timestamp-based ID instead of UUID */
|
|
15
|
+
useTimestamp?: boolean;
|
|
16
|
+
/** Separator for components */
|
|
17
|
+
separator?: string;
|
|
18
|
+
/** Include random component for timestamp IDs */
|
|
19
|
+
includeRandom?: boolean;
|
|
20
|
+
/** Radix for number conversion (2-36) */
|
|
21
|
+
radix?: number;
|
|
22
|
+
/** Length of random component */
|
|
23
|
+
randomLength?: number;
|
|
24
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plyaz/types",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.4",
|
|
4
4
|
"author": "Redeemer Pace",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"description": "Provides shared TypeScript types and schema utilities for validation and parsing in the @playz ecosystem.",
|
|
@@ -170,6 +170,16 @@
|
|
|
170
170
|
"import": "./dist/notifications/index.js",
|
|
171
171
|
"require": "./dist/notifications/index.cjs"
|
|
172
172
|
},
|
|
173
|
+
"./logger": {
|
|
174
|
+
"types": "./dist/logger/index.d.ts",
|
|
175
|
+
"import": "./dist/logger/index.js",
|
|
176
|
+
"require": "./dist/logger/index.cjs"
|
|
177
|
+
},
|
|
178
|
+
"./utils": {
|
|
179
|
+
"types": "./dist/utils/index.d.ts",
|
|
180
|
+
"import": "./dist/utils/index.js",
|
|
181
|
+
"require": "./dist/utils/index.cjs"
|
|
182
|
+
},
|
|
173
183
|
"./payments": {
|
|
174
184
|
"types": "./dist/payments/index.d.ts",
|
|
175
185
|
"import": "./dist/payments/index.js",
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utility Enums for API Package
|
|
3
|
-
* Enums used across API utilities
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Correlation ID types for different contexts
|
|
7
|
-
*/
|
|
8
|
-
export declare enum CORRELATION_TYPE {
|
|
9
|
-
/** Network event correlation */
|
|
10
|
-
NETWORK = "net",
|
|
11
|
-
/** API request correlation */
|
|
12
|
-
API = "api",
|
|
13
|
-
/** User session correlation */
|
|
14
|
-
SESSION = "session",
|
|
15
|
-
/** Transaction correlation */
|
|
16
|
-
TRANSACTION = "txn",
|
|
17
|
-
/** Event correlation */
|
|
18
|
-
EVENT = "evt",
|
|
19
|
-
/** Trace correlation */
|
|
20
|
-
TRACE = "trace",
|
|
21
|
-
/** Generic correlation */
|
|
22
|
-
GENERIC = "corr"
|
|
23
|
-
}
|
package/dist/logger/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type * from './types';
|