@blyp/core 0.1.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/README.md +533 -0
- package/dist/client.js +1132 -0
- package/dist/client.js.map +1 -0
- package/dist/client.mjs +1125 -0
- package/dist/client.mjs.map +1 -0
- package/dist/connectors/betterstack/index.d.ts +7 -0
- package/dist/connectors/betterstack/sender.d.ts +5 -0
- package/dist/connectors/betterstack.js +1508 -0
- package/dist/connectors/betterstack.js.map +1 -0
- package/dist/connectors/betterstack.mjs +1483 -0
- package/dist/connectors/betterstack.mjs.map +1 -0
- package/dist/connectors/otlp/index.d.ts +5 -0
- package/dist/connectors/otlp/sender.d.ts +7 -0
- package/dist/connectors/otlp.js +1347 -0
- package/dist/connectors/otlp.js.map +1 -0
- package/dist/connectors/otlp.mjs +1344 -0
- package/dist/connectors/otlp.mjs.map +1 -0
- package/dist/connectors/posthog/index.d.ts +7 -0
- package/dist/connectors/posthog/sender.d.ts +11 -0
- package/dist/connectors/posthog.js +1503 -0
- package/dist/connectors/posthog.js.map +1 -0
- package/dist/connectors/posthog.mjs +1498 -0
- package/dist/connectors/posthog.mjs.map +1 -0
- package/dist/connectors/sentry/index.d.ts +5 -0
- package/dist/connectors/sentry/sender.d.ts +5 -0
- package/dist/connectors/sentry.js +1356 -0
- package/dist/connectors/sentry.js.map +1 -0
- package/dist/connectors/sentry.mjs +1333 -0
- package/dist/connectors/sentry.mjs.map +1 -0
- package/dist/connectors/shared.d.ts +8 -0
- package/dist/core/colors.d.ts +30 -0
- package/dist/core/config.d.ts +18 -0
- package/dist/core/errors.d.ts +8 -0
- package/dist/core/file-logger.d.ts +19 -0
- package/dist/core/helpers.d.ts +5 -0
- package/dist/core/index.d.ts +8 -0
- package/dist/core/log-reader.d.ts +5 -0
- package/dist/core/log-record.d.ts +14 -0
- package/dist/core/logger.d.ts +20 -0
- package/dist/core/primary-sink.d.ts +10 -0
- package/dist/core/runtime.d.ts +4 -0
- package/dist/core/sinks/database-primary-sink.d.ts +25 -0
- package/dist/core/sinks/file-primary-sink.d.ts +14 -0
- package/dist/core/structured-log.d.ts +3 -0
- package/dist/database/adapters/drizzle.d.ts +7 -0
- package/dist/database/adapters/prisma.d.ts +9 -0
- package/dist/database/helpers.d.ts +5 -0
- package/dist/database/index.d.ts +3 -0
- package/dist/database.js +24 -0
- package/dist/database.js.map +1 -0
- package/dist/database.mjs +21 -0
- package/dist/database.mjs.map +1 -0
- package/dist/elysia.js +4180 -0
- package/dist/elysia.js.map +1 -0
- package/dist/elysia.mjs +4152 -0
- package/dist/elysia.mjs.map +1 -0
- package/dist/expo.js +719 -0
- package/dist/expo.js.map +1 -0
- package/dist/expo.mjs +717 -0
- package/dist/expo.mjs.map +1 -0
- package/dist/express.js +4170 -0
- package/dist/express.js.map +1 -0
- package/dist/express.mjs +4141 -0
- package/dist/express.mjs.map +1 -0
- package/dist/fastify.js +4187 -0
- package/dist/fastify.js.map +1 -0
- package/dist/fastify.mjs +4158 -0
- package/dist/fastify.mjs.map +1 -0
- package/dist/frameworks/client/index.d.ts +3 -0
- package/dist/frameworks/client/logger.d.ts +4 -0
- package/dist/frameworks/elysia/index.d.ts +2 -0
- package/dist/frameworks/elysia/logger.d.ts +35 -0
- package/dist/frameworks/expo/index.d.ts +2 -0
- package/dist/frameworks/expo/logger.d.ts +3 -0
- package/dist/frameworks/expo/network.d.ts +7 -0
- package/dist/frameworks/express/index.d.ts +2 -0
- package/dist/frameworks/express/logger.d.ts +5 -0
- package/dist/frameworks/fastify/index.d.ts +2 -0
- package/dist/frameworks/fastify/logger.d.ts +4 -0
- package/dist/frameworks/hono/index.d.ts +2 -0
- package/dist/frameworks/hono/logger.d.ts +4 -0
- package/dist/frameworks/nestjs/constants.d.ts +2 -0
- package/dist/frameworks/nestjs/filter.d.ts +8 -0
- package/dist/frameworks/nestjs/helpers.d.ts +25 -0
- package/dist/frameworks/nestjs/index.d.ts +3 -0
- package/dist/frameworks/nestjs/interceptor.d.ts +8 -0
- package/dist/frameworks/nestjs/logger.d.ts +6 -0
- package/dist/frameworks/nestjs/middleware.d.ts +8 -0
- package/dist/frameworks/nestjs/module.d.ts +5 -0
- package/dist/frameworks/nextjs/index.d.ts +2 -0
- package/dist/frameworks/nextjs/logger.d.ts +3 -0
- package/dist/frameworks/shared/http.d.ts +10 -0
- package/dist/frameworks/shared/index.d.ts +5 -0
- package/dist/frameworks/shared/logger.d.ts +35 -0
- package/dist/frameworks/shared/request-context.d.ts +12 -0
- package/dist/frameworks/shared/request-logger.d.ts +4 -0
- package/dist/frameworks/standalone/index.d.ts +3 -0
- package/dist/frameworks/standalone/logger.d.ts +5 -0
- package/dist/frameworks/sveltekit/index.d.ts +2 -0
- package/dist/frameworks/sveltekit/logger.d.ts +3 -0
- package/dist/frameworks/tanstack-start/index.d.ts +2 -0
- package/dist/frameworks/tanstack-start/logger.d.ts +3 -0
- package/dist/frameworks/workers/index.d.ts +2 -0
- package/dist/frameworks/workers/logger.d.ts +3 -0
- package/dist/hono.js +4156 -0
- package/dist/hono.js.map +1 -0
- package/dist/hono.mjs +4128 -0
- package/dist/hono.mjs.map +1 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.js +6581 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +6494 -0
- package/dist/index.mjs.map +1 -0
- package/dist/nestjs.js +4649 -0
- package/dist/nestjs.js.map +1 -0
- package/dist/nestjs.mjs +4621 -0
- package/dist/nestjs.mjs.map +1 -0
- package/dist/nextjs.js +4183 -0
- package/dist/nextjs.js.map +1 -0
- package/dist/nextjs.mjs +4155 -0
- package/dist/nextjs.mjs.map +1 -0
- package/dist/shared/client-log.d.ts +14 -0
- package/dist/shared/errors.d.ts +296 -0
- package/dist/shared/log-value.d.ts +3 -0
- package/dist/shared/once.d.ts +4 -0
- package/dist/shared/remote-delivery.d.ts +6 -0
- package/dist/shared/validation.d.ts +7 -0
- package/dist/standalone.js +3353 -0
- package/dist/standalone.js.map +1 -0
- package/dist/standalone.mjs +3324 -0
- package/dist/standalone.mjs.map +1 -0
- package/dist/sveltekit.js +4182 -0
- package/dist/sveltekit.js.map +1 -0
- package/dist/sveltekit.mjs +4154 -0
- package/dist/sveltekit.mjs.map +1 -0
- package/dist/tanstack-start.js +4182 -0
- package/dist/tanstack-start.js.map +1 -0
- package/dist/tanstack-start.mjs +4154 -0
- package/dist/tanstack-start.mjs.map +1 -0
- package/dist/types/connectors/betterstack.d.ts +54 -0
- package/dist/types/connectors/mode.d.ts +2 -0
- package/dist/types/connectors/otlp.d.ts +50 -0
- package/dist/types/connectors/posthog.d.ts +75 -0
- package/dist/types/connectors/sentry.d.ts +48 -0
- package/dist/types/core/config.d.ts +152 -0
- package/dist/types/core/errors.d.ts +16 -0
- package/dist/types/core/file-logger.d.ts +29 -0
- package/dist/types/core/helpers.d.ts +8 -0
- package/dist/types/core/index.d.ts +8 -0
- package/dist/types/core/log-reader.d.ts +4 -0
- package/dist/types/core/log-record.d.ts +1 -0
- package/dist/types/core/logger.d.ts +40 -0
- package/dist/types/core/structured-log.d.ts +57 -0
- package/dist/types/database.d.ts +73 -0
- package/dist/types/frameworks/client.d.ts +32 -0
- package/dist/types/frameworks/elysia.d.ts +33 -0
- package/dist/types/frameworks/expo.d.ts +44 -0
- package/dist/types/frameworks/express.d.ts +24 -0
- package/dist/types/frameworks/fastify.d.ts +22 -0
- package/dist/types/frameworks/hono.d.ts +13 -0
- package/dist/types/frameworks/http.d.ts +47 -0
- package/dist/types/frameworks/nestjs.d.ts +37 -0
- package/dist/types/frameworks/nextjs.d.ts +27 -0
- package/dist/types/frameworks/request-context.d.ts +8 -0
- package/dist/types/frameworks/request-logger.d.ts +8 -0
- package/dist/types/frameworks/shared.d.ts +154 -0
- package/dist/types/frameworks/standalone.d.ts +64 -0
- package/dist/types/frameworks/sveltekit.d.ts +37 -0
- package/dist/types/frameworks/tanstack-start.d.ts +28 -0
- package/dist/types/frameworks/workers.d.ts +33 -0
- package/dist/types/shared/client-log.d.ts +91 -0
- package/dist/types/shared/errors.d.ts +75 -0
- package/dist/types/shared/index.d.ts +4 -0
- package/dist/types/shared/once.d.ts +2 -0
- package/dist/types/shared/remote-delivery.d.ts +32 -0
- package/dist/workers.js +626 -0
- package/dist/workers.js.map +1 -0
- package/dist/workers.mjs +623 -0
- package/dist/workers.mjs.map +1 -0
- package/exports/client.js +3 -0
- package/exports/client.mjs +3 -0
- package/exports/connectors/betterstack.js +1 -0
- package/exports/connectors/betterstack.mjs +1 -0
- package/exports/connectors/otlp.js +1 -0
- package/exports/connectors/otlp.mjs +1 -0
- package/exports/connectors/posthog.js +1 -0
- package/exports/connectors/posthog.mjs +1 -0
- package/exports/connectors/sentry.js +1 -0
- package/exports/connectors/sentry.mjs +1 -0
- package/exports/database.js +1 -0
- package/exports/database.mjs +1 -0
- package/exports/expo.js +1 -0
- package/exports/expo.mjs +1 -0
- package/exports/frameworks/elysia.js +1 -0
- package/exports/frameworks/elysia.mjs +1 -0
- package/exports/frameworks/express.js +1 -0
- package/exports/frameworks/express.mjs +1 -0
- package/exports/frameworks/fastify.js +1 -0
- package/exports/frameworks/fastify.mjs +1 -0
- package/exports/frameworks/hono.js +1 -0
- package/exports/frameworks/hono.mjs +1 -0
- package/exports/frameworks/nestjs.js +1 -0
- package/exports/frameworks/nestjs.mjs +1 -0
- package/exports/frameworks/nextjs.js +1 -0
- package/exports/frameworks/nextjs.mjs +1 -0
- package/exports/frameworks/standalone.js +1 -0
- package/exports/frameworks/standalone.mjs +1 -0
- package/exports/frameworks/sveltekit.js +1 -0
- package/exports/frameworks/sveltekit.mjs +1 -0
- package/exports/frameworks/tanstack-start.js +1 -0
- package/exports/frameworks/tanstack-start.mjs +1 -0
- package/exports/workers.js +1 -0
- package/exports/workers.mjs +1 -0
- package/package.json +291 -0
- package/types/client.d.ts +34 -0
- package/types/connectors/betterstack.d.ts +1 -0
- package/types/connectors/otlp.d.ts +1 -0
- package/types/connectors/posthog.d.ts +1 -0
- package/types/connectors/sentry.d.ts +1 -0
- package/types/database.d.ts +1 -0
- package/types/expo.d.ts +17 -0
- package/types/frameworks/client.d.ts +160 -0
- package/types/frameworks/elysia.d.ts +1 -0
- package/types/frameworks/expo.d.ts +50 -0
- package/types/frameworks/express.d.ts +1 -0
- package/types/frameworks/fastify.d.ts +1 -0
- package/types/frameworks/hono.d.ts +1 -0
- package/types/frameworks/nestjs.d.ts +1 -0
- package/types/frameworks/nextjs.d.ts +1 -0
- package/types/frameworks/standalone.d.ts +1 -0
- package/types/frameworks/sveltekit.d.ts +1 -0
- package/types/frameworks/tanstack-start.d.ts +1 -0
- package/types/frameworks/workers.d.ts +115 -0
- package/types/index.d.ts +1 -0
- package/types/workers.d.ts +13 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/// <reference lib="dom" />
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
BlypErrorCode,
|
|
5
|
+
BlypErrorCodeDefinition,
|
|
6
|
+
BlypErrorLike,
|
|
7
|
+
ErrorLogLevel,
|
|
8
|
+
ErrorLoggerLike,
|
|
9
|
+
ParseErrorOptions,
|
|
10
|
+
ParseableErrorPayload,
|
|
11
|
+
} from '../../dist/index';
|
|
12
|
+
|
|
13
|
+
export interface ClientLogPageContext {
|
|
14
|
+
hash?: string;
|
|
15
|
+
pathname?: string;
|
|
16
|
+
search?: string;
|
|
17
|
+
url?: string;
|
|
18
|
+
title?: string;
|
|
19
|
+
referrer?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface ClientLogBrowserContext {
|
|
23
|
+
userAgent?: string;
|
|
24
|
+
language?: string;
|
|
25
|
+
platform?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface ClientLogDeviceContext {
|
|
29
|
+
runtime?: 'expo' | 'browser';
|
|
30
|
+
network?: {
|
|
31
|
+
type?: string;
|
|
32
|
+
isConnected?: boolean;
|
|
33
|
+
isInternetReachable?: boolean;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type ClientLogLevel =
|
|
38
|
+
| 'debug'
|
|
39
|
+
| 'info'
|
|
40
|
+
| 'warning'
|
|
41
|
+
| 'error'
|
|
42
|
+
| 'critical'
|
|
43
|
+
| 'success'
|
|
44
|
+
| 'table';
|
|
45
|
+
|
|
46
|
+
export interface ClientLogEvent {
|
|
47
|
+
type: 'client_log';
|
|
48
|
+
source: 'client';
|
|
49
|
+
id: string;
|
|
50
|
+
level: ClientLogLevel;
|
|
51
|
+
message: string;
|
|
52
|
+
data?: unknown;
|
|
53
|
+
bindings?: Record<string, unknown>;
|
|
54
|
+
clientTimestamp: string;
|
|
55
|
+
page?: ClientLogPageContext;
|
|
56
|
+
browser?: ClientLogBrowserContext;
|
|
57
|
+
device?: ClientLogDeviceContext;
|
|
58
|
+
session?: {
|
|
59
|
+
pageId?: string;
|
|
60
|
+
sessionId?: string;
|
|
61
|
+
};
|
|
62
|
+
metadata?: Record<string, unknown>;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export type RemoteDeliveryRuntime = 'browser' | 'expo';
|
|
66
|
+
|
|
67
|
+
export type RemoteDeliveryTransport = 'fetch' | 'beacon';
|
|
68
|
+
|
|
69
|
+
export type RemoteDeliveryFailureReason =
|
|
70
|
+
| 'offline'
|
|
71
|
+
| 'network_error'
|
|
72
|
+
| 'response_status'
|
|
73
|
+
| 'invalid_endpoint'
|
|
74
|
+
| 'missing_transport'
|
|
75
|
+
| 'queue_overflow';
|
|
76
|
+
|
|
77
|
+
export interface RemoteDeliverySuccessContext {
|
|
78
|
+
runtime: RemoteDeliveryRuntime;
|
|
79
|
+
event: ClientLogEvent;
|
|
80
|
+
attempt: number;
|
|
81
|
+
status?: number;
|
|
82
|
+
transport: RemoteDeliveryTransport;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface RemoteDeliveryRetryContext {
|
|
86
|
+
runtime: RemoteDeliveryRuntime;
|
|
87
|
+
event: ClientLogEvent;
|
|
88
|
+
attempt: number;
|
|
89
|
+
retriesRemaining: number;
|
|
90
|
+
nextRetryAt: string;
|
|
91
|
+
reason: 'offline' | 'network_error' | 'response_status';
|
|
92
|
+
status?: number;
|
|
93
|
+
error?: string;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface RemoteDeliveryFailureContext {
|
|
97
|
+
runtime: RemoteDeliveryRuntime;
|
|
98
|
+
event: ClientLogEvent;
|
|
99
|
+
attempt: number;
|
|
100
|
+
reason: RemoteDeliveryFailureReason;
|
|
101
|
+
status?: number;
|
|
102
|
+
error?: string;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface RemoteDeliveryDropContext {
|
|
106
|
+
runtime: RemoteDeliveryRuntime;
|
|
107
|
+
droppedEvent: ClientLogEvent;
|
|
108
|
+
replacementEvent: ClientLogEvent;
|
|
109
|
+
maxQueueSize: number;
|
|
110
|
+
reason: 'queue_overflow';
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface RemoteDeliveryConfig {
|
|
114
|
+
maxRetries?: number;
|
|
115
|
+
retryDelayMs?: number;
|
|
116
|
+
maxQueueSize?: number;
|
|
117
|
+
warnOnFailure?: boolean;
|
|
118
|
+
onSuccess?: (ctx: RemoteDeliverySuccessContext) => void;
|
|
119
|
+
onRetry?: (ctx: RemoteDeliveryRetryContext) => void;
|
|
120
|
+
onFailure?: (ctx: RemoteDeliveryFailureContext) => void;
|
|
121
|
+
onDrop?: (ctx: RemoteDeliveryDropContext) => void;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface ClientLoggerConfig {
|
|
125
|
+
endpoint?: string;
|
|
126
|
+
headers?: Record<string, string>;
|
|
127
|
+
credentials?: RequestCredentials;
|
|
128
|
+
localConsole?: boolean;
|
|
129
|
+
remoteSync?: boolean;
|
|
130
|
+
metadata?: Record<string, unknown> | (() => Record<string, unknown>);
|
|
131
|
+
delivery?: RemoteDeliveryConfig;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface ClientLogger {
|
|
135
|
+
success: (message: unknown, ...args: unknown[]) => void;
|
|
136
|
+
critical: (message: unknown, ...args: unknown[]) => void;
|
|
137
|
+
warning: (message: unknown, ...args: unknown[]) => void;
|
|
138
|
+
info: (message: unknown, ...args: unknown[]) => void;
|
|
139
|
+
debug: (message: unknown, ...args: unknown[]) => void;
|
|
140
|
+
error: (message: unknown, ...args: unknown[]) => void;
|
|
141
|
+
warn: (message: unknown, ...args: unknown[]) => void;
|
|
142
|
+
table: (message: string, data?: unknown) => void;
|
|
143
|
+
child: (bindings: Record<string, unknown>) => ClientLogger;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export declare function createClientLogger(config?: ClientLoggerConfig): ClientLogger;
|
|
147
|
+
export declare const logger: ClientLogger;
|
|
148
|
+
export type {
|
|
149
|
+
ClientLogDeviceContext,
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export type {
|
|
153
|
+
BlypErrorCode,
|
|
154
|
+
BlypErrorCodeDefinition,
|
|
155
|
+
BlypErrorLike,
|
|
156
|
+
ErrorLogLevel,
|
|
157
|
+
ErrorLoggerLike,
|
|
158
|
+
ParseErrorOptions,
|
|
159
|
+
ParseableErrorPayload,
|
|
160
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../dist/frameworks/elysia';
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ClientLogBrowserContext,
|
|
3
|
+
ClientLogDeviceContext,
|
|
4
|
+
ClientLogEvent,
|
|
5
|
+
ClientLogLevel,
|
|
6
|
+
ClientLogPageContext,
|
|
7
|
+
RemoteDeliveryConfig,
|
|
8
|
+
RemoteDeliveryDropContext,
|
|
9
|
+
RemoteDeliveryFailureContext,
|
|
10
|
+
RemoteDeliveryFailureReason,
|
|
11
|
+
RemoteDeliveryRetryContext,
|
|
12
|
+
RemoteDeliverySuccessContext,
|
|
13
|
+
} from './client';
|
|
14
|
+
|
|
15
|
+
export interface ExpoLoggerConfig {
|
|
16
|
+
endpoint: string;
|
|
17
|
+
headers?: Record<string, string>;
|
|
18
|
+
localConsole?: boolean;
|
|
19
|
+
remoteSync?: boolean;
|
|
20
|
+
metadata?: Record<string, unknown> | (() => Record<string, unknown>);
|
|
21
|
+
delivery?: RemoteDeliveryConfig;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface ExpoLogger {
|
|
25
|
+
success: (message: unknown, ...args: unknown[]) => void;
|
|
26
|
+
critical: (message: unknown, ...args: unknown[]) => void;
|
|
27
|
+
warning: (message: unknown, ...args: unknown[]) => void;
|
|
28
|
+
info: (message: unknown, ...args: unknown[]) => void;
|
|
29
|
+
debug: (message: unknown, ...args: unknown[]) => void;
|
|
30
|
+
error: (message: unknown, ...args: unknown[]) => void;
|
|
31
|
+
warn: (message: unknown, ...args: unknown[]) => void;
|
|
32
|
+
table: (message: string, data?: unknown) => void;
|
|
33
|
+
child: (bindings: Record<string, unknown>) => ExpoLogger;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export declare function createExpoLogger(config: ExpoLoggerConfig): ExpoLogger;
|
|
37
|
+
|
|
38
|
+
export type {
|
|
39
|
+
ClientLogBrowserContext,
|
|
40
|
+
ClientLogDeviceContext,
|
|
41
|
+
ClientLogEvent,
|
|
42
|
+
ClientLogLevel,
|
|
43
|
+
ClientLogPageContext,
|
|
44
|
+
RemoteDeliveryConfig,
|
|
45
|
+
RemoteDeliveryDropContext,
|
|
46
|
+
RemoteDeliveryFailureContext,
|
|
47
|
+
RemoteDeliveryFailureReason,
|
|
48
|
+
RemoteDeliveryRetryContext,
|
|
49
|
+
RemoteDeliverySuccessContext,
|
|
50
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../dist/frameworks/express';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../dist/frameworks/fastify';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../dist/frameworks/hono';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../dist/frameworks/nestjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../dist/frameworks/nextjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../dist/frameworks/standalone';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../dist/frameworks/sveltekit';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../dist/frameworks/tanstack-start';
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
export interface HttpRequestLog {
|
|
2
|
+
type: 'http_request' | 'http_error';
|
|
3
|
+
method: string;
|
|
4
|
+
url: string;
|
|
5
|
+
path: string;
|
|
6
|
+
statusCode: number;
|
|
7
|
+
responseTime: number;
|
|
8
|
+
timestamp: string;
|
|
9
|
+
ip?: string;
|
|
10
|
+
userAgent?: string;
|
|
11
|
+
referrer?: string;
|
|
12
|
+
requestId?: string;
|
|
13
|
+
error?: string;
|
|
14
|
+
stack?: string;
|
|
15
|
+
code?: string;
|
|
16
|
+
why?: string;
|
|
17
|
+
fix?: string;
|
|
18
|
+
link?: string;
|
|
19
|
+
details?: unknown;
|
|
20
|
+
[key: string]: unknown;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface WorkersLoggerConfig {
|
|
24
|
+
env?: Record<string, unknown>;
|
|
25
|
+
customProps?: (request: Request) => Record<string, unknown>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface WorkersEmitOptions {
|
|
29
|
+
response?: Response | { status: number };
|
|
30
|
+
status?: number;
|
|
31
|
+
error?: unknown;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type StructuredLogLevel =
|
|
35
|
+
| 'debug'
|
|
36
|
+
| 'info'
|
|
37
|
+
| 'warn'
|
|
38
|
+
| 'warning'
|
|
39
|
+
| 'error'
|
|
40
|
+
| 'success'
|
|
41
|
+
| 'critical'
|
|
42
|
+
| 'table';
|
|
43
|
+
|
|
44
|
+
export interface StructuredLogError {
|
|
45
|
+
message: string;
|
|
46
|
+
code?: string | number;
|
|
47
|
+
type?: string;
|
|
48
|
+
stack?: string;
|
|
49
|
+
why?: string;
|
|
50
|
+
fix?: string;
|
|
51
|
+
link?: string;
|
|
52
|
+
details?: Record<string, unknown>;
|
|
53
|
+
cause?: unknown;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface StructuredLogEvent {
|
|
57
|
+
level: StructuredLogLevel;
|
|
58
|
+
message: string;
|
|
59
|
+
timestamp: string;
|
|
60
|
+
data?: unknown;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface StructuredLogPayload {
|
|
64
|
+
groupId: string;
|
|
65
|
+
timestamp: string;
|
|
66
|
+
level: StructuredLogLevel;
|
|
67
|
+
method?: string;
|
|
68
|
+
path?: string;
|
|
69
|
+
status?: number;
|
|
70
|
+
duration?: number;
|
|
71
|
+
events?: StructuredLogEvent[];
|
|
72
|
+
error?: StructuredLogError;
|
|
73
|
+
[key: string]: unknown;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface StructuredLogEmitOptions {
|
|
77
|
+
response?: Response | { status: number };
|
|
78
|
+
status?: number;
|
|
79
|
+
error?: unknown;
|
|
80
|
+
level?: StructuredLogLevel;
|
|
81
|
+
message?: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface StructuredLog {
|
|
85
|
+
set(fields: Record<string, unknown>): StructuredLog;
|
|
86
|
+
debug(message: unknown, ...args: unknown[]): StructuredLog;
|
|
87
|
+
info(message: unknown, ...args: unknown[]): StructuredLog;
|
|
88
|
+
warn(message: unknown, ...args: unknown[]): StructuredLog;
|
|
89
|
+
warning(message: unknown, ...args: unknown[]): StructuredLog;
|
|
90
|
+
error(message: unknown, ...args: unknown[]): StructuredLog;
|
|
91
|
+
success(message: unknown, ...args: unknown[]): StructuredLog;
|
|
92
|
+
critical(message: unknown, ...args: unknown[]): StructuredLog;
|
|
93
|
+
table(message: string, data?: unknown): StructuredLog;
|
|
94
|
+
emit(options?: StructuredLogEmitOptions): StructuredLogPayload;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface WorkersRequestLogger {
|
|
98
|
+
set(fields: Record<string, unknown>): WorkersRequestLogger;
|
|
99
|
+
emit(options?: WorkersEmitOptions): HttpRequestLog;
|
|
100
|
+
debug(message: unknown, ...args: unknown[]): void;
|
|
101
|
+
info(message: unknown, ...args: unknown[]): void;
|
|
102
|
+
warn(message: unknown, ...args: unknown[]): void;
|
|
103
|
+
warning(message: unknown, ...args: unknown[]): void;
|
|
104
|
+
error(message: unknown, ...args: unknown[]): void;
|
|
105
|
+
success(message: unknown, ...args: unknown[]): void;
|
|
106
|
+
critical(message: unknown, ...args: unknown[]): void;
|
|
107
|
+
table(message: string, data?: unknown): void;
|
|
108
|
+
createStructuredLog(
|
|
109
|
+
groupId: string,
|
|
110
|
+
initial?: Record<string, unknown>
|
|
111
|
+
): StructuredLog;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export declare function initWorkersLogger(config?: WorkersLoggerConfig): void;
|
|
115
|
+
export declare function createWorkersLogger(request: Request): WorkersRequestLogger;
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/index';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { createWorkersLogger, initWorkersLogger } from './frameworks/workers';
|
|
2
|
+
export type {
|
|
3
|
+
HttpRequestLog,
|
|
4
|
+
StructuredLog,
|
|
5
|
+
StructuredLogEmitOptions,
|
|
6
|
+
StructuredLogError,
|
|
7
|
+
StructuredLogEvent,
|
|
8
|
+
StructuredLogLevel,
|
|
9
|
+
StructuredLogPayload,
|
|
10
|
+
WorkersEmitOptions,
|
|
11
|
+
WorkersLoggerConfig,
|
|
12
|
+
WorkersRequestLogger,
|
|
13
|
+
} from './frameworks/workers';
|