@rawnodes/logger 2.7.2 → 2.8.0
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/index.d.mts +176 -1
- package/dist/index.d.ts +176 -1
- package/dist/index.js +148 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +146 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -104,6 +104,35 @@ interface TelegramConfig extends HttpTransportBaseConfig {
|
|
|
104
104
|
threadId?: number;
|
|
105
105
|
replyToMessageId?: number;
|
|
106
106
|
}
|
|
107
|
+
interface ZohoCliqBotConfig {
|
|
108
|
+
/** Bot display name (shown in the channel). */
|
|
109
|
+
name: string;
|
|
110
|
+
/** Optional bot avatar URL. */
|
|
111
|
+
image?: string;
|
|
112
|
+
}
|
|
113
|
+
interface ZohoCliqConfig extends HttpTransportBaseConfig {
|
|
114
|
+
/**
|
|
115
|
+
* Incoming webhook URL. If provided, `companyId`/`channel`/`region` are
|
|
116
|
+
* ignored and this URL is used as-is (with `zapikey` appended as query).
|
|
117
|
+
*/
|
|
118
|
+
webhookUrl?: string;
|
|
119
|
+
/** Zoho Cliq company/org ID. Required unless `webhookUrl` is set. */
|
|
120
|
+
companyId?: string;
|
|
121
|
+
/** Target channel name (the `channelsbyname` API segment). Required unless `webhookUrl` is set. */
|
|
122
|
+
channel?: string;
|
|
123
|
+
/** Zoho region/TLD: 'eu' | 'com' | 'in' | etc. Default: 'eu'. */
|
|
124
|
+
region?: string;
|
|
125
|
+
/** Zoho API key (zapikey). Required. */
|
|
126
|
+
apiKey: string;
|
|
127
|
+
/** If true (default), message is posted as a broadcast so all members are notified. */
|
|
128
|
+
broadcast?: boolean;
|
|
129
|
+
/** Post as a custom bot instead of the default user. */
|
|
130
|
+
bot?: ZohoCliqBotConfig;
|
|
131
|
+
/** Include ISO timestamp in each formatted message. Default: true. */
|
|
132
|
+
includeTimestamp?: boolean;
|
|
133
|
+
/** Include meta as a fenced code block. Default: true. */
|
|
134
|
+
includeMeta?: boolean;
|
|
135
|
+
}
|
|
107
136
|
type LogStreamPattern = 'hostname' | 'hostname-date' | 'hostname-uuid' | 'date' | 'uuid';
|
|
108
137
|
interface LogStreamPatternConfig {
|
|
109
138
|
pattern: LogStreamPattern;
|
|
@@ -167,6 +196,7 @@ interface LoggerConfig {
|
|
|
167
196
|
discord?: DiscordConfig | DiscordConfig[];
|
|
168
197
|
telegram?: TelegramConfig | TelegramConfig[];
|
|
169
198
|
cloudwatch?: CloudWatchConfig | CloudWatchConfig[];
|
|
199
|
+
zohoCliq?: ZohoCliqConfig | ZohoCliqConfig[];
|
|
170
200
|
/** Relay transport config — streams logs to a remote server via WebSocket (runs in worker thread) */
|
|
171
201
|
relay?: RelayConfig;
|
|
172
202
|
/** Enable caller info (file:line) in logs. Pass true for defaults or CallerConfig for options */
|
|
@@ -409,6 +439,18 @@ declare class CloudWatchTransport extends BaseHttpTransport {
|
|
|
409
439
|
private isInvalidSequenceTokenError;
|
|
410
440
|
}
|
|
411
441
|
|
|
442
|
+
declare class ZohoCliqTransport extends BaseHttpTransport {
|
|
443
|
+
private config;
|
|
444
|
+
private endpoint;
|
|
445
|
+
private requestTimeout;
|
|
446
|
+
constructor(config: ZohoCliqConfig);
|
|
447
|
+
private buildEndpoint;
|
|
448
|
+
protected sendBatch(messages: BufferedMessage[]): Promise<void>;
|
|
449
|
+
private formatMessage;
|
|
450
|
+
private splitContent;
|
|
451
|
+
private post;
|
|
452
|
+
}
|
|
453
|
+
|
|
412
454
|
interface TimingResult {
|
|
413
455
|
label: string;
|
|
414
456
|
durationMs: number;
|
|
@@ -535,6 +577,35 @@ declare const LogStreamPatternConfigSchema: z.ZodType<LogStreamPatternConfig>;
|
|
|
535
577
|
declare const LogStreamTemplateConfigSchema: z.ZodType<LogStreamTemplateConfig>;
|
|
536
578
|
declare const LogStreamNameSchema: z.ZodType<LogStreamName>;
|
|
537
579
|
declare const CloudWatchConfigSchema: z.ZodType<CloudWatchConfig>;
|
|
580
|
+
declare const ZohoCliqConfigSchema: z.ZodObject<{
|
|
581
|
+
level: z.ZodOptional<z.ZodType<"off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly", unknown, z.core.$ZodTypeInternals<"off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly", unknown>>>;
|
|
582
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodType<LevelRule, unknown, z.core.$ZodTypeInternals<LevelRule, unknown>>>>;
|
|
583
|
+
batchSize: z.ZodOptional<z.ZodNumber>;
|
|
584
|
+
flushInterval: z.ZodOptional<z.ZodNumber>;
|
|
585
|
+
maxRetries: z.ZodOptional<z.ZodNumber>;
|
|
586
|
+
retryDelay: z.ZodOptional<z.ZodNumber>;
|
|
587
|
+
onError: z.ZodType<HttpTransportBaseConfig["onError"]>;
|
|
588
|
+
onDrop: z.ZodType<HttpTransportBaseConfig["onDrop"]>;
|
|
589
|
+
maxQueueSize: z.ZodOptional<z.ZodNumber>;
|
|
590
|
+
dropPolicy: z.ZodOptional<z.ZodEnum<{
|
|
591
|
+
"drop-oldest": "drop-oldest";
|
|
592
|
+
"drop-newest": "drop-newest";
|
|
593
|
+
}>>;
|
|
594
|
+
requestTimeout: z.ZodOptional<z.ZodNumber>;
|
|
595
|
+
webhookUrl: z.ZodOptional<z.ZodString>;
|
|
596
|
+
companyId: z.ZodOptional<z.ZodString>;
|
|
597
|
+
channel: z.ZodOptional<z.ZodString>;
|
|
598
|
+
region: z.ZodOptional<z.ZodString>;
|
|
599
|
+
apiKey: z.ZodString;
|
|
600
|
+
broadcast: z.ZodOptional<z.ZodBoolean>;
|
|
601
|
+
bot: z.ZodOptional<z.ZodObject<{
|
|
602
|
+
name: z.ZodString;
|
|
603
|
+
image: z.ZodOptional<z.ZodString>;
|
|
604
|
+
}, z.core.$strip>>;
|
|
605
|
+
includeTimestamp: z.ZodOptional<z.ZodBoolean>;
|
|
606
|
+
includeMeta: z.ZodOptional<z.ZodBoolean>;
|
|
607
|
+
}, z.core.$strip>;
|
|
608
|
+
declare const RelayConfigSchema: z.ZodType<RelayConfig>;
|
|
538
609
|
declare const LevelConfigObjectSchema: z.ZodType<LevelConfigObject>;
|
|
539
610
|
declare const LevelConfigSchema: z.ZodType<LevelConfig>;
|
|
540
611
|
declare const CallerConfigSchema: z.ZodType<CallerConfig>;
|
|
@@ -546,6 +617,61 @@ declare const LoggerConfigSchema: z.ZodObject<{
|
|
|
546
617
|
discord: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<DiscordConfig, unknown, z.core.$ZodTypeInternals<DiscordConfig, unknown>>, z.ZodArray<z.ZodType<DiscordConfig, unknown, z.core.$ZodTypeInternals<DiscordConfig, unknown>>>]>>;
|
|
547
618
|
telegram: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<TelegramConfig, unknown, z.core.$ZodTypeInternals<TelegramConfig, unknown>>, z.ZodArray<z.ZodType<TelegramConfig, unknown, z.core.$ZodTypeInternals<TelegramConfig, unknown>>>]>>;
|
|
548
619
|
cloudwatch: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<CloudWatchConfig, unknown, z.core.$ZodTypeInternals<CloudWatchConfig, unknown>>, z.ZodArray<z.ZodType<CloudWatchConfig, unknown, z.core.$ZodTypeInternals<CloudWatchConfig, unknown>>>]>>;
|
|
620
|
+
zohoCliq: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
621
|
+
level: z.ZodOptional<z.ZodType<"off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly", unknown, z.core.$ZodTypeInternals<"off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly", unknown>>>;
|
|
622
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodType<LevelRule, unknown, z.core.$ZodTypeInternals<LevelRule, unknown>>>>;
|
|
623
|
+
batchSize: z.ZodOptional<z.ZodNumber>;
|
|
624
|
+
flushInterval: z.ZodOptional<z.ZodNumber>;
|
|
625
|
+
maxRetries: z.ZodOptional<z.ZodNumber>;
|
|
626
|
+
retryDelay: z.ZodOptional<z.ZodNumber>;
|
|
627
|
+
onError: z.ZodType<HttpTransportBaseConfig["onError"]>;
|
|
628
|
+
onDrop: z.ZodType<HttpTransportBaseConfig["onDrop"]>;
|
|
629
|
+
maxQueueSize: z.ZodOptional<z.ZodNumber>;
|
|
630
|
+
dropPolicy: z.ZodOptional<z.ZodEnum<{
|
|
631
|
+
"drop-oldest": "drop-oldest";
|
|
632
|
+
"drop-newest": "drop-newest";
|
|
633
|
+
}>>;
|
|
634
|
+
requestTimeout: z.ZodOptional<z.ZodNumber>;
|
|
635
|
+
webhookUrl: z.ZodOptional<z.ZodString>;
|
|
636
|
+
companyId: z.ZodOptional<z.ZodString>;
|
|
637
|
+
channel: z.ZodOptional<z.ZodString>;
|
|
638
|
+
region: z.ZodOptional<z.ZodString>;
|
|
639
|
+
apiKey: z.ZodString;
|
|
640
|
+
broadcast: z.ZodOptional<z.ZodBoolean>;
|
|
641
|
+
bot: z.ZodOptional<z.ZodObject<{
|
|
642
|
+
name: z.ZodString;
|
|
643
|
+
image: z.ZodOptional<z.ZodString>;
|
|
644
|
+
}, z.core.$strip>>;
|
|
645
|
+
includeTimestamp: z.ZodOptional<z.ZodBoolean>;
|
|
646
|
+
includeMeta: z.ZodOptional<z.ZodBoolean>;
|
|
647
|
+
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
648
|
+
level: z.ZodOptional<z.ZodType<"off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly", unknown, z.core.$ZodTypeInternals<"off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly", unknown>>>;
|
|
649
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodType<LevelRule, unknown, z.core.$ZodTypeInternals<LevelRule, unknown>>>>;
|
|
650
|
+
batchSize: z.ZodOptional<z.ZodNumber>;
|
|
651
|
+
flushInterval: z.ZodOptional<z.ZodNumber>;
|
|
652
|
+
maxRetries: z.ZodOptional<z.ZodNumber>;
|
|
653
|
+
retryDelay: z.ZodOptional<z.ZodNumber>;
|
|
654
|
+
onError: z.ZodType<HttpTransportBaseConfig["onError"]>;
|
|
655
|
+
onDrop: z.ZodType<HttpTransportBaseConfig["onDrop"]>;
|
|
656
|
+
maxQueueSize: z.ZodOptional<z.ZodNumber>;
|
|
657
|
+
dropPolicy: z.ZodOptional<z.ZodEnum<{
|
|
658
|
+
"drop-oldest": "drop-oldest";
|
|
659
|
+
"drop-newest": "drop-newest";
|
|
660
|
+
}>>;
|
|
661
|
+
requestTimeout: z.ZodOptional<z.ZodNumber>;
|
|
662
|
+
webhookUrl: z.ZodOptional<z.ZodString>;
|
|
663
|
+
companyId: z.ZodOptional<z.ZodString>;
|
|
664
|
+
channel: z.ZodOptional<z.ZodString>;
|
|
665
|
+
region: z.ZodOptional<z.ZodString>;
|
|
666
|
+
apiKey: z.ZodString;
|
|
667
|
+
broadcast: z.ZodOptional<z.ZodBoolean>;
|
|
668
|
+
bot: z.ZodOptional<z.ZodObject<{
|
|
669
|
+
name: z.ZodString;
|
|
670
|
+
image: z.ZodOptional<z.ZodString>;
|
|
671
|
+
}, z.core.$strip>>;
|
|
672
|
+
includeTimestamp: z.ZodOptional<z.ZodBoolean>;
|
|
673
|
+
includeMeta: z.ZodOptional<z.ZodBoolean>;
|
|
674
|
+
}, z.core.$strip>>]>>;
|
|
549
675
|
relay: z.ZodOptional<z.ZodType<RelayConfig, unknown, z.core.$ZodTypeInternals<RelayConfig, unknown>>>;
|
|
550
676
|
caller: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodType<CallerConfig, unknown, z.core.$ZodTypeInternals<CallerConfig, unknown>>]>>;
|
|
551
677
|
hostname: z.ZodOptional<z.ZodString>;
|
|
@@ -559,10 +685,59 @@ declare function safeValidateConfig(config: unknown): z.ZodSafeParseResult<{
|
|
|
559
685
|
discord?: DiscordConfig | DiscordConfig[] | undefined;
|
|
560
686
|
telegram?: TelegramConfig | TelegramConfig[] | undefined;
|
|
561
687
|
cloudwatch?: CloudWatchConfig | CloudWatchConfig[] | undefined;
|
|
688
|
+
zohoCliq?: {
|
|
689
|
+
onError: ((error: Error, droppedMessages: unknown[]) => void) | undefined;
|
|
690
|
+
onDrop: ((droppedMessages: unknown[]) => void) | undefined;
|
|
691
|
+
apiKey: string;
|
|
692
|
+
level?: "off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly" | undefined;
|
|
693
|
+
rules?: LevelRule[] | undefined;
|
|
694
|
+
batchSize?: number | undefined;
|
|
695
|
+
flushInterval?: number | undefined;
|
|
696
|
+
maxRetries?: number | undefined;
|
|
697
|
+
retryDelay?: number | undefined;
|
|
698
|
+
maxQueueSize?: number | undefined;
|
|
699
|
+
dropPolicy?: "drop-oldest" | "drop-newest" | undefined;
|
|
700
|
+
requestTimeout?: number | undefined;
|
|
701
|
+
webhookUrl?: string | undefined;
|
|
702
|
+
companyId?: string | undefined;
|
|
703
|
+
channel?: string | undefined;
|
|
704
|
+
region?: string | undefined;
|
|
705
|
+
broadcast?: boolean | undefined;
|
|
706
|
+
bot?: {
|
|
707
|
+
name: string;
|
|
708
|
+
image?: string | undefined;
|
|
709
|
+
} | undefined;
|
|
710
|
+
includeTimestamp?: boolean | undefined;
|
|
711
|
+
includeMeta?: boolean | undefined;
|
|
712
|
+
} | {
|
|
713
|
+
onError: ((error: Error, droppedMessages: unknown[]) => void) | undefined;
|
|
714
|
+
onDrop: ((droppedMessages: unknown[]) => void) | undefined;
|
|
715
|
+
apiKey: string;
|
|
716
|
+
level?: "off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly" | undefined;
|
|
717
|
+
rules?: LevelRule[] | undefined;
|
|
718
|
+
batchSize?: number | undefined;
|
|
719
|
+
flushInterval?: number | undefined;
|
|
720
|
+
maxRetries?: number | undefined;
|
|
721
|
+
retryDelay?: number | undefined;
|
|
722
|
+
maxQueueSize?: number | undefined;
|
|
723
|
+
dropPolicy?: "drop-oldest" | "drop-newest" | undefined;
|
|
724
|
+
requestTimeout?: number | undefined;
|
|
725
|
+
webhookUrl?: string | undefined;
|
|
726
|
+
companyId?: string | undefined;
|
|
727
|
+
channel?: string | undefined;
|
|
728
|
+
region?: string | undefined;
|
|
729
|
+
broadcast?: boolean | undefined;
|
|
730
|
+
bot?: {
|
|
731
|
+
name: string;
|
|
732
|
+
image?: string | undefined;
|
|
733
|
+
} | undefined;
|
|
734
|
+
includeTimestamp?: boolean | undefined;
|
|
735
|
+
includeMeta?: boolean | undefined;
|
|
736
|
+
}[] | undefined;
|
|
562
737
|
relay?: RelayConfig | undefined;
|
|
563
738
|
caller?: boolean | CallerConfig | undefined;
|
|
564
739
|
hostname?: string | undefined;
|
|
565
740
|
autoShutdown?: boolean | AutoShutdownConfig | undefined;
|
|
566
741
|
}>;
|
|
567
742
|
|
|
568
|
-
export { type AutoShutdownConfig, AutoShutdownConfigSchema, BaseHttpTransport, type BaseHttpTransportOptions, type BufferOptions, type BufferedMessage, type CallerConfig, CallerConfigSchema, type CallerInfo, type CloudWatchConfig, CloudWatchConfigSchema, CloudWatchTransport, type ConsoleConfig, ConsoleConfigSchema, type DiscordConfig, DiscordConfigSchema, DiscordTransport, type FileConfig, FileConfigSchema, type GracefulShutdownOptions, type HttpErrorData, type HttpTransportBaseConfig, HttpTransportBaseConfigSchema, LOG_LEVELS, type LevelConfig, type LevelConfigObject, LevelConfigObjectSchema, LevelConfigSchema, type LevelOverride, type LevelOverrideMatch, type LevelRule, LevelRuleSchema, type LogFormat, LogFormatSchema, type LogLevel, LogLevelSchema, type LogStreamName, LogStreamNameSchema, type LogStreamPattern, type LogStreamPatternConfig, LogStreamPatternConfigSchema, LogStreamPatternSchema, type LogStreamTemplateConfig, LogStreamTemplateConfigSchema, Logger, type LoggerConfig, LoggerConfigSchema, type LoggerContext, LoggerStore, type MaskSecretsOptions, MessageBuffer, type Meta, type RequestIdOptions, type SerializedError, type SingletonLogger, type TelegramConfig, TelegramConfigSchema, TelegramTransport, type TimingResult, assertLogLevel, createMasker, createSingletonLogger, extractRequestId, flattenObject, formatCallerInfo, formatLogfmt, formatLogfmtValue, generateRequestId, getCallerInfo, getOrGenerateRequestId, isValidLogLevel, maskSecrets, matchesContext, measureAsync, measureSync, registerShutdown, safeValidateConfig, serializeError, validateConfig };
|
|
743
|
+
export { type AutoShutdownConfig, AutoShutdownConfigSchema, BaseHttpTransport, type BaseHttpTransportOptions, type BufferOptions, type BufferedMessage, type CallerConfig, CallerConfigSchema, type CallerInfo, type CloudWatchConfig, CloudWatchConfigSchema, CloudWatchTransport, type ConsoleConfig, ConsoleConfigSchema, type DiscordConfig, DiscordConfigSchema, DiscordTransport, type FileConfig, FileConfigSchema, type GracefulShutdownOptions, type HttpErrorData, type HttpTransportBaseConfig, HttpTransportBaseConfigSchema, LOG_LEVELS, type LevelConfig, type LevelConfigObject, LevelConfigObjectSchema, LevelConfigSchema, type LevelOverride, type LevelOverrideMatch, type LevelRule, LevelRuleSchema, type LogFormat, LogFormatSchema, type LogLevel, LogLevelSchema, type LogStreamName, LogStreamNameSchema, type LogStreamPattern, type LogStreamPatternConfig, LogStreamPatternConfigSchema, LogStreamPatternSchema, type LogStreamTemplateConfig, LogStreamTemplateConfigSchema, Logger, type LoggerConfig, LoggerConfigSchema, type LoggerContext, LoggerStore, type MaskSecretsOptions, MessageBuffer, type Meta, type RelayConfig, RelayConfigSchema, type RequestIdOptions, type SerializedError, type SingletonLogger, type TelegramConfig, TelegramConfigSchema, TelegramTransport, type TimingResult, type ZohoCliqBotConfig, type ZohoCliqConfig, ZohoCliqConfigSchema, ZohoCliqTransport, assertLogLevel, createMasker, createSingletonLogger, extractRequestId, flattenObject, formatCallerInfo, formatLogfmt, formatLogfmtValue, generateRequestId, getCallerInfo, getOrGenerateRequestId, isValidLogLevel, maskSecrets, matchesContext, measureAsync, measureSync, registerShutdown, safeValidateConfig, serializeError, validateConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -104,6 +104,35 @@ interface TelegramConfig extends HttpTransportBaseConfig {
|
|
|
104
104
|
threadId?: number;
|
|
105
105
|
replyToMessageId?: number;
|
|
106
106
|
}
|
|
107
|
+
interface ZohoCliqBotConfig {
|
|
108
|
+
/** Bot display name (shown in the channel). */
|
|
109
|
+
name: string;
|
|
110
|
+
/** Optional bot avatar URL. */
|
|
111
|
+
image?: string;
|
|
112
|
+
}
|
|
113
|
+
interface ZohoCliqConfig extends HttpTransportBaseConfig {
|
|
114
|
+
/**
|
|
115
|
+
* Incoming webhook URL. If provided, `companyId`/`channel`/`region` are
|
|
116
|
+
* ignored and this URL is used as-is (with `zapikey` appended as query).
|
|
117
|
+
*/
|
|
118
|
+
webhookUrl?: string;
|
|
119
|
+
/** Zoho Cliq company/org ID. Required unless `webhookUrl` is set. */
|
|
120
|
+
companyId?: string;
|
|
121
|
+
/** Target channel name (the `channelsbyname` API segment). Required unless `webhookUrl` is set. */
|
|
122
|
+
channel?: string;
|
|
123
|
+
/** Zoho region/TLD: 'eu' | 'com' | 'in' | etc. Default: 'eu'. */
|
|
124
|
+
region?: string;
|
|
125
|
+
/** Zoho API key (zapikey). Required. */
|
|
126
|
+
apiKey: string;
|
|
127
|
+
/** If true (default), message is posted as a broadcast so all members are notified. */
|
|
128
|
+
broadcast?: boolean;
|
|
129
|
+
/** Post as a custom bot instead of the default user. */
|
|
130
|
+
bot?: ZohoCliqBotConfig;
|
|
131
|
+
/** Include ISO timestamp in each formatted message. Default: true. */
|
|
132
|
+
includeTimestamp?: boolean;
|
|
133
|
+
/** Include meta as a fenced code block. Default: true. */
|
|
134
|
+
includeMeta?: boolean;
|
|
135
|
+
}
|
|
107
136
|
type LogStreamPattern = 'hostname' | 'hostname-date' | 'hostname-uuid' | 'date' | 'uuid';
|
|
108
137
|
interface LogStreamPatternConfig {
|
|
109
138
|
pattern: LogStreamPattern;
|
|
@@ -167,6 +196,7 @@ interface LoggerConfig {
|
|
|
167
196
|
discord?: DiscordConfig | DiscordConfig[];
|
|
168
197
|
telegram?: TelegramConfig | TelegramConfig[];
|
|
169
198
|
cloudwatch?: CloudWatchConfig | CloudWatchConfig[];
|
|
199
|
+
zohoCliq?: ZohoCliqConfig | ZohoCliqConfig[];
|
|
170
200
|
/** Relay transport config — streams logs to a remote server via WebSocket (runs in worker thread) */
|
|
171
201
|
relay?: RelayConfig;
|
|
172
202
|
/** Enable caller info (file:line) in logs. Pass true for defaults or CallerConfig for options */
|
|
@@ -409,6 +439,18 @@ declare class CloudWatchTransport extends BaseHttpTransport {
|
|
|
409
439
|
private isInvalidSequenceTokenError;
|
|
410
440
|
}
|
|
411
441
|
|
|
442
|
+
declare class ZohoCliqTransport extends BaseHttpTransport {
|
|
443
|
+
private config;
|
|
444
|
+
private endpoint;
|
|
445
|
+
private requestTimeout;
|
|
446
|
+
constructor(config: ZohoCliqConfig);
|
|
447
|
+
private buildEndpoint;
|
|
448
|
+
protected sendBatch(messages: BufferedMessage[]): Promise<void>;
|
|
449
|
+
private formatMessage;
|
|
450
|
+
private splitContent;
|
|
451
|
+
private post;
|
|
452
|
+
}
|
|
453
|
+
|
|
412
454
|
interface TimingResult {
|
|
413
455
|
label: string;
|
|
414
456
|
durationMs: number;
|
|
@@ -535,6 +577,35 @@ declare const LogStreamPatternConfigSchema: z.ZodType<LogStreamPatternConfig>;
|
|
|
535
577
|
declare const LogStreamTemplateConfigSchema: z.ZodType<LogStreamTemplateConfig>;
|
|
536
578
|
declare const LogStreamNameSchema: z.ZodType<LogStreamName>;
|
|
537
579
|
declare const CloudWatchConfigSchema: z.ZodType<CloudWatchConfig>;
|
|
580
|
+
declare const ZohoCliqConfigSchema: z.ZodObject<{
|
|
581
|
+
level: z.ZodOptional<z.ZodType<"off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly", unknown, z.core.$ZodTypeInternals<"off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly", unknown>>>;
|
|
582
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodType<LevelRule, unknown, z.core.$ZodTypeInternals<LevelRule, unknown>>>>;
|
|
583
|
+
batchSize: z.ZodOptional<z.ZodNumber>;
|
|
584
|
+
flushInterval: z.ZodOptional<z.ZodNumber>;
|
|
585
|
+
maxRetries: z.ZodOptional<z.ZodNumber>;
|
|
586
|
+
retryDelay: z.ZodOptional<z.ZodNumber>;
|
|
587
|
+
onError: z.ZodType<HttpTransportBaseConfig["onError"]>;
|
|
588
|
+
onDrop: z.ZodType<HttpTransportBaseConfig["onDrop"]>;
|
|
589
|
+
maxQueueSize: z.ZodOptional<z.ZodNumber>;
|
|
590
|
+
dropPolicy: z.ZodOptional<z.ZodEnum<{
|
|
591
|
+
"drop-oldest": "drop-oldest";
|
|
592
|
+
"drop-newest": "drop-newest";
|
|
593
|
+
}>>;
|
|
594
|
+
requestTimeout: z.ZodOptional<z.ZodNumber>;
|
|
595
|
+
webhookUrl: z.ZodOptional<z.ZodString>;
|
|
596
|
+
companyId: z.ZodOptional<z.ZodString>;
|
|
597
|
+
channel: z.ZodOptional<z.ZodString>;
|
|
598
|
+
region: z.ZodOptional<z.ZodString>;
|
|
599
|
+
apiKey: z.ZodString;
|
|
600
|
+
broadcast: z.ZodOptional<z.ZodBoolean>;
|
|
601
|
+
bot: z.ZodOptional<z.ZodObject<{
|
|
602
|
+
name: z.ZodString;
|
|
603
|
+
image: z.ZodOptional<z.ZodString>;
|
|
604
|
+
}, z.core.$strip>>;
|
|
605
|
+
includeTimestamp: z.ZodOptional<z.ZodBoolean>;
|
|
606
|
+
includeMeta: z.ZodOptional<z.ZodBoolean>;
|
|
607
|
+
}, z.core.$strip>;
|
|
608
|
+
declare const RelayConfigSchema: z.ZodType<RelayConfig>;
|
|
538
609
|
declare const LevelConfigObjectSchema: z.ZodType<LevelConfigObject>;
|
|
539
610
|
declare const LevelConfigSchema: z.ZodType<LevelConfig>;
|
|
540
611
|
declare const CallerConfigSchema: z.ZodType<CallerConfig>;
|
|
@@ -546,6 +617,61 @@ declare const LoggerConfigSchema: z.ZodObject<{
|
|
|
546
617
|
discord: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<DiscordConfig, unknown, z.core.$ZodTypeInternals<DiscordConfig, unknown>>, z.ZodArray<z.ZodType<DiscordConfig, unknown, z.core.$ZodTypeInternals<DiscordConfig, unknown>>>]>>;
|
|
547
618
|
telegram: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<TelegramConfig, unknown, z.core.$ZodTypeInternals<TelegramConfig, unknown>>, z.ZodArray<z.ZodType<TelegramConfig, unknown, z.core.$ZodTypeInternals<TelegramConfig, unknown>>>]>>;
|
|
548
619
|
cloudwatch: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<CloudWatchConfig, unknown, z.core.$ZodTypeInternals<CloudWatchConfig, unknown>>, z.ZodArray<z.ZodType<CloudWatchConfig, unknown, z.core.$ZodTypeInternals<CloudWatchConfig, unknown>>>]>>;
|
|
620
|
+
zohoCliq: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
621
|
+
level: z.ZodOptional<z.ZodType<"off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly", unknown, z.core.$ZodTypeInternals<"off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly", unknown>>>;
|
|
622
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodType<LevelRule, unknown, z.core.$ZodTypeInternals<LevelRule, unknown>>>>;
|
|
623
|
+
batchSize: z.ZodOptional<z.ZodNumber>;
|
|
624
|
+
flushInterval: z.ZodOptional<z.ZodNumber>;
|
|
625
|
+
maxRetries: z.ZodOptional<z.ZodNumber>;
|
|
626
|
+
retryDelay: z.ZodOptional<z.ZodNumber>;
|
|
627
|
+
onError: z.ZodType<HttpTransportBaseConfig["onError"]>;
|
|
628
|
+
onDrop: z.ZodType<HttpTransportBaseConfig["onDrop"]>;
|
|
629
|
+
maxQueueSize: z.ZodOptional<z.ZodNumber>;
|
|
630
|
+
dropPolicy: z.ZodOptional<z.ZodEnum<{
|
|
631
|
+
"drop-oldest": "drop-oldest";
|
|
632
|
+
"drop-newest": "drop-newest";
|
|
633
|
+
}>>;
|
|
634
|
+
requestTimeout: z.ZodOptional<z.ZodNumber>;
|
|
635
|
+
webhookUrl: z.ZodOptional<z.ZodString>;
|
|
636
|
+
companyId: z.ZodOptional<z.ZodString>;
|
|
637
|
+
channel: z.ZodOptional<z.ZodString>;
|
|
638
|
+
region: z.ZodOptional<z.ZodString>;
|
|
639
|
+
apiKey: z.ZodString;
|
|
640
|
+
broadcast: z.ZodOptional<z.ZodBoolean>;
|
|
641
|
+
bot: z.ZodOptional<z.ZodObject<{
|
|
642
|
+
name: z.ZodString;
|
|
643
|
+
image: z.ZodOptional<z.ZodString>;
|
|
644
|
+
}, z.core.$strip>>;
|
|
645
|
+
includeTimestamp: z.ZodOptional<z.ZodBoolean>;
|
|
646
|
+
includeMeta: z.ZodOptional<z.ZodBoolean>;
|
|
647
|
+
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
648
|
+
level: z.ZodOptional<z.ZodType<"off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly", unknown, z.core.$ZodTypeInternals<"off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly", unknown>>>;
|
|
649
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodType<LevelRule, unknown, z.core.$ZodTypeInternals<LevelRule, unknown>>>>;
|
|
650
|
+
batchSize: z.ZodOptional<z.ZodNumber>;
|
|
651
|
+
flushInterval: z.ZodOptional<z.ZodNumber>;
|
|
652
|
+
maxRetries: z.ZodOptional<z.ZodNumber>;
|
|
653
|
+
retryDelay: z.ZodOptional<z.ZodNumber>;
|
|
654
|
+
onError: z.ZodType<HttpTransportBaseConfig["onError"]>;
|
|
655
|
+
onDrop: z.ZodType<HttpTransportBaseConfig["onDrop"]>;
|
|
656
|
+
maxQueueSize: z.ZodOptional<z.ZodNumber>;
|
|
657
|
+
dropPolicy: z.ZodOptional<z.ZodEnum<{
|
|
658
|
+
"drop-oldest": "drop-oldest";
|
|
659
|
+
"drop-newest": "drop-newest";
|
|
660
|
+
}>>;
|
|
661
|
+
requestTimeout: z.ZodOptional<z.ZodNumber>;
|
|
662
|
+
webhookUrl: z.ZodOptional<z.ZodString>;
|
|
663
|
+
companyId: z.ZodOptional<z.ZodString>;
|
|
664
|
+
channel: z.ZodOptional<z.ZodString>;
|
|
665
|
+
region: z.ZodOptional<z.ZodString>;
|
|
666
|
+
apiKey: z.ZodString;
|
|
667
|
+
broadcast: z.ZodOptional<z.ZodBoolean>;
|
|
668
|
+
bot: z.ZodOptional<z.ZodObject<{
|
|
669
|
+
name: z.ZodString;
|
|
670
|
+
image: z.ZodOptional<z.ZodString>;
|
|
671
|
+
}, z.core.$strip>>;
|
|
672
|
+
includeTimestamp: z.ZodOptional<z.ZodBoolean>;
|
|
673
|
+
includeMeta: z.ZodOptional<z.ZodBoolean>;
|
|
674
|
+
}, z.core.$strip>>]>>;
|
|
549
675
|
relay: z.ZodOptional<z.ZodType<RelayConfig, unknown, z.core.$ZodTypeInternals<RelayConfig, unknown>>>;
|
|
550
676
|
caller: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodType<CallerConfig, unknown, z.core.$ZodTypeInternals<CallerConfig, unknown>>]>>;
|
|
551
677
|
hostname: z.ZodOptional<z.ZodString>;
|
|
@@ -559,10 +685,59 @@ declare function safeValidateConfig(config: unknown): z.ZodSafeParseResult<{
|
|
|
559
685
|
discord?: DiscordConfig | DiscordConfig[] | undefined;
|
|
560
686
|
telegram?: TelegramConfig | TelegramConfig[] | undefined;
|
|
561
687
|
cloudwatch?: CloudWatchConfig | CloudWatchConfig[] | undefined;
|
|
688
|
+
zohoCliq?: {
|
|
689
|
+
onError: ((error: Error, droppedMessages: unknown[]) => void) | undefined;
|
|
690
|
+
onDrop: ((droppedMessages: unknown[]) => void) | undefined;
|
|
691
|
+
apiKey: string;
|
|
692
|
+
level?: "off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly" | undefined;
|
|
693
|
+
rules?: LevelRule[] | undefined;
|
|
694
|
+
batchSize?: number | undefined;
|
|
695
|
+
flushInterval?: number | undefined;
|
|
696
|
+
maxRetries?: number | undefined;
|
|
697
|
+
retryDelay?: number | undefined;
|
|
698
|
+
maxQueueSize?: number | undefined;
|
|
699
|
+
dropPolicy?: "drop-oldest" | "drop-newest" | undefined;
|
|
700
|
+
requestTimeout?: number | undefined;
|
|
701
|
+
webhookUrl?: string | undefined;
|
|
702
|
+
companyId?: string | undefined;
|
|
703
|
+
channel?: string | undefined;
|
|
704
|
+
region?: string | undefined;
|
|
705
|
+
broadcast?: boolean | undefined;
|
|
706
|
+
bot?: {
|
|
707
|
+
name: string;
|
|
708
|
+
image?: string | undefined;
|
|
709
|
+
} | undefined;
|
|
710
|
+
includeTimestamp?: boolean | undefined;
|
|
711
|
+
includeMeta?: boolean | undefined;
|
|
712
|
+
} | {
|
|
713
|
+
onError: ((error: Error, droppedMessages: unknown[]) => void) | undefined;
|
|
714
|
+
onDrop: ((droppedMessages: unknown[]) => void) | undefined;
|
|
715
|
+
apiKey: string;
|
|
716
|
+
level?: "off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly" | undefined;
|
|
717
|
+
rules?: LevelRule[] | undefined;
|
|
718
|
+
batchSize?: number | undefined;
|
|
719
|
+
flushInterval?: number | undefined;
|
|
720
|
+
maxRetries?: number | undefined;
|
|
721
|
+
retryDelay?: number | undefined;
|
|
722
|
+
maxQueueSize?: number | undefined;
|
|
723
|
+
dropPolicy?: "drop-oldest" | "drop-newest" | undefined;
|
|
724
|
+
requestTimeout?: number | undefined;
|
|
725
|
+
webhookUrl?: string | undefined;
|
|
726
|
+
companyId?: string | undefined;
|
|
727
|
+
channel?: string | undefined;
|
|
728
|
+
region?: string | undefined;
|
|
729
|
+
broadcast?: boolean | undefined;
|
|
730
|
+
bot?: {
|
|
731
|
+
name: string;
|
|
732
|
+
image?: string | undefined;
|
|
733
|
+
} | undefined;
|
|
734
|
+
includeTimestamp?: boolean | undefined;
|
|
735
|
+
includeMeta?: boolean | undefined;
|
|
736
|
+
}[] | undefined;
|
|
562
737
|
relay?: RelayConfig | undefined;
|
|
563
738
|
caller?: boolean | CallerConfig | undefined;
|
|
564
739
|
hostname?: string | undefined;
|
|
565
740
|
autoShutdown?: boolean | AutoShutdownConfig | undefined;
|
|
566
741
|
}>;
|
|
567
742
|
|
|
568
|
-
export { type AutoShutdownConfig, AutoShutdownConfigSchema, BaseHttpTransport, type BaseHttpTransportOptions, type BufferOptions, type BufferedMessage, type CallerConfig, CallerConfigSchema, type CallerInfo, type CloudWatchConfig, CloudWatchConfigSchema, CloudWatchTransport, type ConsoleConfig, ConsoleConfigSchema, type DiscordConfig, DiscordConfigSchema, DiscordTransport, type FileConfig, FileConfigSchema, type GracefulShutdownOptions, type HttpErrorData, type HttpTransportBaseConfig, HttpTransportBaseConfigSchema, LOG_LEVELS, type LevelConfig, type LevelConfigObject, LevelConfigObjectSchema, LevelConfigSchema, type LevelOverride, type LevelOverrideMatch, type LevelRule, LevelRuleSchema, type LogFormat, LogFormatSchema, type LogLevel, LogLevelSchema, type LogStreamName, LogStreamNameSchema, type LogStreamPattern, type LogStreamPatternConfig, LogStreamPatternConfigSchema, LogStreamPatternSchema, type LogStreamTemplateConfig, LogStreamTemplateConfigSchema, Logger, type LoggerConfig, LoggerConfigSchema, type LoggerContext, LoggerStore, type MaskSecretsOptions, MessageBuffer, type Meta, type RequestIdOptions, type SerializedError, type SingletonLogger, type TelegramConfig, TelegramConfigSchema, TelegramTransport, type TimingResult, assertLogLevel, createMasker, createSingletonLogger, extractRequestId, flattenObject, formatCallerInfo, formatLogfmt, formatLogfmtValue, generateRequestId, getCallerInfo, getOrGenerateRequestId, isValidLogLevel, maskSecrets, matchesContext, measureAsync, measureSync, registerShutdown, safeValidateConfig, serializeError, validateConfig };
|
|
743
|
+
export { type AutoShutdownConfig, AutoShutdownConfigSchema, BaseHttpTransport, type BaseHttpTransportOptions, type BufferOptions, type BufferedMessage, type CallerConfig, CallerConfigSchema, type CallerInfo, type CloudWatchConfig, CloudWatchConfigSchema, CloudWatchTransport, type ConsoleConfig, ConsoleConfigSchema, type DiscordConfig, DiscordConfigSchema, DiscordTransport, type FileConfig, FileConfigSchema, type GracefulShutdownOptions, type HttpErrorData, type HttpTransportBaseConfig, HttpTransportBaseConfigSchema, LOG_LEVELS, type LevelConfig, type LevelConfigObject, LevelConfigObjectSchema, LevelConfigSchema, type LevelOverride, type LevelOverrideMatch, type LevelRule, LevelRuleSchema, type LogFormat, LogFormatSchema, type LogLevel, LogLevelSchema, type LogStreamName, LogStreamNameSchema, type LogStreamPattern, type LogStreamPatternConfig, LogStreamPatternConfigSchema, LogStreamPatternSchema, type LogStreamTemplateConfig, LogStreamTemplateConfigSchema, Logger, type LoggerConfig, LoggerConfigSchema, type LoggerContext, LoggerStore, type MaskSecretsOptions, MessageBuffer, type Meta, type RelayConfig, RelayConfigSchema, type RequestIdOptions, type SerializedError, type SingletonLogger, type TelegramConfig, TelegramConfigSchema, TelegramTransport, type TimingResult, type ZohoCliqBotConfig, type ZohoCliqConfig, ZohoCliqConfigSchema, ZohoCliqTransport, assertLogLevel, createMasker, createSingletonLogger, extractRequestId, flattenObject, formatCallerInfo, formatLogfmt, formatLogfmtValue, generateRequestId, getCallerInfo, getOrGenerateRequestId, isValidLogLevel, maskSecrets, matchesContext, measureAsync, measureSync, registerShutdown, safeValidateConfig, serializeError, validateConfig };
|
package/dist/index.js
CHANGED
|
@@ -500,6 +500,112 @@ var TelegramTransport = class extends BaseHttpTransport {
|
|
|
500
500
|
return text.replace(/[&<>"']/g, (c) => entities[c] || c);
|
|
501
501
|
}
|
|
502
502
|
};
|
|
503
|
+
|
|
504
|
+
// src/transports/zoho-cliq.ts
|
|
505
|
+
var LEVEL_EMOJI3 = {
|
|
506
|
+
off: "",
|
|
507
|
+
error: "\u{1F534}",
|
|
508
|
+
warn: "\u{1F7E1}",
|
|
509
|
+
info: "\u{1F7E2}",
|
|
510
|
+
http: "\u{1F535}",
|
|
511
|
+
verbose: "\u{1F7E3}",
|
|
512
|
+
debug: "\u26AA",
|
|
513
|
+
silly: "\u26AB"
|
|
514
|
+
};
|
|
515
|
+
var DEFAULT_REQUEST_TIMEOUT_MS3 = 1e4;
|
|
516
|
+
var MAX_MESSAGE_LENGTH = 9500;
|
|
517
|
+
var ZohoCliqTransport = class extends BaseHttpTransport {
|
|
518
|
+
config;
|
|
519
|
+
endpoint;
|
|
520
|
+
requestTimeout;
|
|
521
|
+
constructor(config) {
|
|
522
|
+
super({
|
|
523
|
+
batchSize: config.batchSize ?? 20,
|
|
524
|
+
flushInterval: config.flushInterval ?? 2e3,
|
|
525
|
+
maxRetries: config.maxRetries,
|
|
526
|
+
retryDelay: config.retryDelay,
|
|
527
|
+
maxQueueSize: config.maxQueueSize,
|
|
528
|
+
dropPolicy: config.dropPolicy,
|
|
529
|
+
onDrop: config.onDrop,
|
|
530
|
+
onError: config.onError
|
|
531
|
+
});
|
|
532
|
+
this.config = config;
|
|
533
|
+
this.requestTimeout = config.requestTimeout ?? DEFAULT_REQUEST_TIMEOUT_MS3;
|
|
534
|
+
this.endpoint = this.buildEndpoint();
|
|
535
|
+
}
|
|
536
|
+
buildEndpoint() {
|
|
537
|
+
if (this.config.webhookUrl) {
|
|
538
|
+
return this.config.webhookUrl;
|
|
539
|
+
}
|
|
540
|
+
const region = this.config.region ?? "eu";
|
|
541
|
+
const companyId = this.config.companyId;
|
|
542
|
+
const channel = encodeURIComponent(this.config.channel);
|
|
543
|
+
return `https://cliq.zoho.${region}/company/${companyId}/api/v2/channelsbyname/${channel}/message`;
|
|
544
|
+
}
|
|
545
|
+
async sendBatch(messages) {
|
|
546
|
+
const text = messages.map((msg) => this.formatMessage(msg)).join("\n\n---\n\n");
|
|
547
|
+
for (const chunk of this.splitContent(text, MAX_MESSAGE_LENGTH)) {
|
|
548
|
+
await this.post(chunk);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
formatMessage(msg) {
|
|
552
|
+
const emoji = LEVEL_EMOJI3[msg.level];
|
|
553
|
+
const level = msg.level.toUpperCase();
|
|
554
|
+
const context = msg.context || "APP";
|
|
555
|
+
const timestamp = this.config.includeTimestamp !== false ? ` ${msg.timestamp.toISOString()}` : "";
|
|
556
|
+
let text = `${emoji} *${level}* [${context}]${timestamp}
|
|
557
|
+
${msg.message}`;
|
|
558
|
+
if (this.config.includeMeta !== false && msg.meta && Object.keys(msg.meta).length > 0) {
|
|
559
|
+
text += "\n```\n" + JSON.stringify(msg.meta, null, 2) + "\n```";
|
|
560
|
+
}
|
|
561
|
+
return text;
|
|
562
|
+
}
|
|
563
|
+
splitContent(content, maxLength) {
|
|
564
|
+
if (content.length <= maxLength) return [content];
|
|
565
|
+
const chunks = [];
|
|
566
|
+
let current = content;
|
|
567
|
+
while (current.length > 0) {
|
|
568
|
+
if (current.length <= maxLength) {
|
|
569
|
+
chunks.push(current);
|
|
570
|
+
break;
|
|
571
|
+
}
|
|
572
|
+
let splitAt = current.lastIndexOf("\n", maxLength);
|
|
573
|
+
if (splitAt === -1 || splitAt < maxLength / 2) {
|
|
574
|
+
splitAt = current.lastIndexOf(" ", maxLength);
|
|
575
|
+
}
|
|
576
|
+
if (splitAt === -1 || splitAt < maxLength / 2) {
|
|
577
|
+
splitAt = maxLength;
|
|
578
|
+
}
|
|
579
|
+
chunks.push(current.slice(0, splitAt));
|
|
580
|
+
current = current.slice(splitAt).trimStart();
|
|
581
|
+
}
|
|
582
|
+
return chunks;
|
|
583
|
+
}
|
|
584
|
+
async post(text) {
|
|
585
|
+
const url = new URL(this.endpoint);
|
|
586
|
+
url.searchParams.set("zapikey", this.config.apiKey);
|
|
587
|
+
if (this.config.bot?.name) {
|
|
588
|
+
url.searchParams.set("bot_unique_name", this.config.bot.name);
|
|
589
|
+
}
|
|
590
|
+
const body = {
|
|
591
|
+
text,
|
|
592
|
+
broadcast: this.config.broadcast ?? true
|
|
593
|
+
};
|
|
594
|
+
if (this.config.bot) {
|
|
595
|
+
body.bot = this.config.bot;
|
|
596
|
+
}
|
|
597
|
+
const response = await fetch(url.toString(), {
|
|
598
|
+
method: "POST",
|
|
599
|
+
headers: { "Content-Type": "application/json" },
|
|
600
|
+
body: JSON.stringify(body),
|
|
601
|
+
signal: AbortSignal.timeout(this.requestTimeout)
|
|
602
|
+
});
|
|
603
|
+
if (!response.ok && response.status !== 204) {
|
|
604
|
+
const respText = await response.text().catch(() => "");
|
|
605
|
+
throw new Error(`Zoho Cliq API failed: ${response.status} ${respText}`);
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
};
|
|
503
609
|
var instanceUuid = crypto.randomUUID().slice(0, 8);
|
|
504
610
|
function formatDate() {
|
|
505
611
|
return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
@@ -857,6 +963,15 @@ function createStreams(config, state) {
|
|
|
857
963
|
stream: telegramStream
|
|
858
964
|
});
|
|
859
965
|
}
|
|
966
|
+
for (const zohoCliqConfig of toArray(config.zohoCliq)) {
|
|
967
|
+
const transport = new ZohoCliqTransport(zohoCliqConfig);
|
|
968
|
+
transports.push(transport);
|
|
969
|
+
const zohoStream = createHttpTransportStream(transport, zohoCliqConfig.level, zohoCliqConfig.rules, state);
|
|
970
|
+
streams.push({
|
|
971
|
+
level: "trace",
|
|
972
|
+
stream: zohoStream
|
|
973
|
+
});
|
|
974
|
+
}
|
|
860
975
|
for (const cloudwatchConfig of toArray(config.cloudwatch)) {
|
|
861
976
|
const transport = new CloudWatchTransport(cloudwatchConfig, config.hostname);
|
|
862
977
|
transports.push(transport);
|
|
@@ -1162,6 +1277,35 @@ var CloudWatchConfigSchema = zod.z.object({
|
|
|
1162
1277
|
createLogGroup: zod.z.boolean().optional(),
|
|
1163
1278
|
createLogStream: zod.z.boolean().optional()
|
|
1164
1279
|
});
|
|
1280
|
+
var ZohoCliqConfigBaseSchema = zod.z.object({
|
|
1281
|
+
level: LogLevelSchema.optional(),
|
|
1282
|
+
rules: zod.z.array(LevelRuleSchema).optional(),
|
|
1283
|
+
batchSize: zod.z.number().int().positive().optional(),
|
|
1284
|
+
flushInterval: zod.z.number().int().positive().optional(),
|
|
1285
|
+
maxRetries: zod.z.number().int().nonnegative().optional(),
|
|
1286
|
+
retryDelay: zod.z.number().int().positive().optional(),
|
|
1287
|
+
onError: zod.z.function().optional(),
|
|
1288
|
+
onDrop: zod.z.function().optional(),
|
|
1289
|
+
maxQueueSize: zod.z.number().int().positive().optional(),
|
|
1290
|
+
dropPolicy: zod.z.enum(["drop-oldest", "drop-newest"]).optional(),
|
|
1291
|
+
requestTimeout: zod.z.number().int().positive().optional(),
|
|
1292
|
+
webhookUrl: zod.z.string().url().optional(),
|
|
1293
|
+
companyId: zod.z.string().min(1).optional(),
|
|
1294
|
+
channel: zod.z.string().min(1).optional(),
|
|
1295
|
+
region: zod.z.string().min(1).optional(),
|
|
1296
|
+
apiKey: zod.z.string().min(1, "apiKey is required"),
|
|
1297
|
+
broadcast: zod.z.boolean().optional(),
|
|
1298
|
+
bot: zod.z.object({
|
|
1299
|
+
name: zod.z.string().min(1),
|
|
1300
|
+
image: zod.z.string().url().optional()
|
|
1301
|
+
}).optional(),
|
|
1302
|
+
includeTimestamp: zod.z.boolean().optional(),
|
|
1303
|
+
includeMeta: zod.z.boolean().optional()
|
|
1304
|
+
});
|
|
1305
|
+
var ZohoCliqConfigSchema = ZohoCliqConfigBaseSchema.refine(
|
|
1306
|
+
(cfg) => Boolean(cfg.webhookUrl) || Boolean(cfg.companyId) && Boolean(cfg.channel),
|
|
1307
|
+
{ message: "Either webhookUrl or both companyId and channel must be provided" }
|
|
1308
|
+
);
|
|
1165
1309
|
var RelayConfigSchema = zod.z.object({
|
|
1166
1310
|
apiUrl: zod.z.string().url("apiUrl must be a valid URL"),
|
|
1167
1311
|
token: zod.z.string().min(1, "token is required"),
|
|
@@ -1193,6 +1337,7 @@ var LoggerConfigSchema = zod.z.object({
|
|
|
1193
1337
|
discord: zod.z.union([DiscordConfigSchema, zod.z.array(DiscordConfigSchema)]).optional(),
|
|
1194
1338
|
telegram: zod.z.union([TelegramConfigSchema, zod.z.array(TelegramConfigSchema)]).optional(),
|
|
1195
1339
|
cloudwatch: zod.z.union([CloudWatchConfigSchema, zod.z.array(CloudWatchConfigSchema)]).optional(),
|
|
1340
|
+
zohoCliq: zod.z.union([ZohoCliqConfigSchema, zod.z.array(ZohoCliqConfigSchema)]).optional(),
|
|
1196
1341
|
relay: RelayConfigSchema.optional(),
|
|
1197
1342
|
caller: zod.z.union([zod.z.boolean(), CallerConfigSchema]).optional(),
|
|
1198
1343
|
hostname: zod.z.string().optional(),
|
|
@@ -1878,8 +2023,11 @@ exports.Logger = Logger;
|
|
|
1878
2023
|
exports.LoggerConfigSchema = LoggerConfigSchema;
|
|
1879
2024
|
exports.LoggerStore = LoggerStore;
|
|
1880
2025
|
exports.MessageBuffer = MessageBuffer;
|
|
2026
|
+
exports.RelayConfigSchema = RelayConfigSchema;
|
|
1881
2027
|
exports.TelegramConfigSchema = TelegramConfigSchema;
|
|
1882
2028
|
exports.TelegramTransport = TelegramTransport;
|
|
2029
|
+
exports.ZohoCliqConfigSchema = ZohoCliqConfigSchema;
|
|
2030
|
+
exports.ZohoCliqTransport = ZohoCliqTransport;
|
|
1883
2031
|
exports.assertLogLevel = assertLogLevel;
|
|
1884
2032
|
exports.createMasker = createMasker;
|
|
1885
2033
|
exports.createSingletonLogger = createSingletonLogger;
|