reroute-js 0.25.3 → 0.26.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/README.md +150 -52
- package/cli/bin.d.ts +1 -1
- package/cli/bin.js +446 -150
- package/cli/bin.js.map +13 -9
- package/cli/index.d.ts +1 -1
- package/cli/index.js +4 -4
- package/cli/index.js.map +1 -1
- package/cli/src/cli.d.ts +1 -1
- package/cli/src/commands/analyze.d.ts +1 -1
- package/cli/src/commands/build.d.ts +1 -1
- package/cli/src/commands/dev.d.ts +1 -1
- package/cli/src/commands/gen.d.ts +1 -1
- package/cli/src/commands/gen.d.ts.map +1 -1
- package/cli/src/commands/index.d.ts +1 -1
- package/cli/src/commands/init.d.ts +1 -1
- package/cli/src/commands/lib/assets.d.ts +1 -1
- package/cli/src/commands/lib/bundler.d.ts +1 -1
- package/cli/src/commands/lib/command.d.ts +1 -1
- package/cli/src/commands/lib/env.d.ts +1 -1
- package/cli/src/commands/lib/index.d.ts +1 -1
- package/cli/src/commands/lib/log.d.ts +1 -1
- package/cli/src/commands/lib/markdown/availability.d.ts +1 -1
- package/cli/src/commands/lib/markdown/index.d.ts +1 -1
- package/cli/src/commands/lib/markdown/processor.d.ts +1 -1
- package/cli/src/commands/lib/production.d.ts +1 -1
- package/cli/src/commands/lib/server.d.ts +1 -1
- package/cli/src/commands/lib/streaming/analyzer.d.ts +1 -1
- package/cli/src/commands/lib/streaming/suspense.d.ts +1 -1
- package/cli/src/commands/lib/tailwind.d.ts +1 -1
- package/cli/src/commands/lib/terminal-ui.d.ts +1 -1
- package/cli/src/commands/lib/version.d.ts +1 -1
- package/cli/src/commands/og.d.ts +1 -1
- package/cli/src/commands/start.d.ts +1 -1
- package/cli/src/index.d.ts +1 -1
- package/core/index.d.ts +1 -1
- package/core/index.js +912 -589
- package/core/index.js.map +22 -14
- package/core/src/bundler/hash.d.ts +1 -1
- package/core/src/bundler/index.d.ts +1 -1
- package/core/src/config.d.ts +243 -2
- package/core/src/config.d.ts.map +1 -1
- package/core/src/content/discovery.d.ts +1 -1
- package/core/src/content/index.d.ts +1 -1
- package/core/src/content/metadata.d.ts +1 -1
- package/core/src/index.d.ts +1 -1
- package/core/src/llms/extractor.d.ts +1 -1
- package/core/src/llms/formatter.d.ts +1 -1
- package/core/src/llms/full-generator.d.ts +1 -1
- package/core/src/llms/index-generator.d.ts +1 -1
- package/core/src/llms/index.d.ts +1 -1
- package/core/src/og/discovery.d.ts +1 -1
- package/core/src/og/index.d.ts +1 -1
- package/core/src/og/meta.d.ts +1 -1
- package/core/src/og/render.d.ts +1 -1
- package/core/src/og/types.d.ts +1 -1
- package/core/src/robots/discovery.d.ts +1 -1
- package/core/src/robots/generator.d.ts +1 -1
- package/core/src/robots/index.d.ts +1 -1
- package/core/src/robots/policies.d.ts +1 -1
- package/core/src/rss/discovery.d.ts +1 -1
- package/core/src/rss/generator.d.ts +1 -1
- package/core/src/rss/index.d.ts +1 -1
- package/core/src/sitemap/discovery.d.ts +1 -1
- package/core/src/sitemap/generator.d.ts +1 -1
- package/core/src/sitemap/index.d.ts +1 -1
- package/core/src/ssr/index.d.ts +1 -1
- package/core/src/ssr/lib/cache.d.ts +1 -1
- package/core/src/ssr/lib/collections.d.ts +1 -1
- package/core/src/ssr/lib/compression.d.ts +1 -1
- package/core/src/ssr/lib/compute/content.d.ts +1 -1
- package/core/src/ssr/lib/compute/index.d.ts +1 -1
- package/core/src/ssr/lib/compute/layouts.d.ts +1 -1
- package/core/src/ssr/lib/compute/routes.d.ts +1 -1
- package/core/src/ssr/lib/data.d.ts +1 -1
- package/core/src/ssr/lib/html.d.ts +1 -1
- package/core/src/ssr/lib/imports.d.ts +1 -1
- package/core/src/ssr/lib/index.d.ts +1 -1
- package/core/src/ssr/lib/layouts.d.ts +1 -1
- package/core/src/ssr/lib/metadata.d.ts +1 -1
- package/core/src/ssr/lib/mime.d.ts +1 -1
- package/core/src/ssr/lib/modules.d.ts +1 -1
- package/core/src/ssr/lib/path.d.ts +1 -1
- package/core/src/ssr/lib/preload.d.ts +1 -1
- package/core/src/ssr/lib/scripts/collections.d.ts +1 -1
- package/core/src/ssr/lib/scripts/data.d.ts +2 -2
- package/core/src/ssr/lib/scripts/data.d.ts.map +1 -1
- package/core/src/ssr/lib/scripts/escape.d.ts +1 -1
- package/core/src/ssr/lib/scripts/feeds.d.ts +1 -1
- package/core/src/ssr/lib/scripts/index.d.ts +1 -1
- package/core/src/ssr/lib/seed.d.ts +1 -1
- package/core/src/ssr/lib/setup.d.ts +4 -2
- package/core/src/ssr/lib/setup.d.ts.map +1 -1
- package/core/src/ssr/lib/styles.d.ts +1 -1
- package/core/src/ssr/lib/template.d.ts +1 -1
- package/core/src/ssr/lib/types.d.ts +1 -1
- package/core/src/ssr/render.d.ts +4 -2
- package/core/src/ssr/render.d.ts.map +1 -1
- package/core/src/ssr/stream.d.ts +4 -2
- package/core/src/ssr/stream.d.ts.map +1 -1
- package/elysia/index.d.ts +1 -1
- package/elysia/index.js +715 -468
- package/elysia/index.js.map +15 -11
- package/elysia/src/index.d.ts +1 -1
- package/elysia/src/libs/assets.d.ts +1 -1
- package/elysia/src/libs/cache.d.ts +1 -1
- package/elysia/src/libs/caching.d.ts +1 -1
- package/elysia/src/libs/http.d.ts +1 -1
- package/elysia/src/libs/image.d.ts +1 -1
- package/elysia/src/libs/index.d.ts +1 -1
- package/elysia/src/libs/llms.d.ts +1 -1
- package/elysia/src/libs/response.d.ts +1 -1
- package/elysia/src/libs/serving.d.ts +1 -1
- package/elysia/src/plugin.d.ts +1 -1
- package/elysia/src/routes/artifacts.d.ts +1 -1
- package/elysia/src/routes/content.d.ts +1 -1
- package/elysia/src/routes/content.d.ts.map +1 -1
- package/elysia/src/routes/image.d.ts +1 -1
- package/elysia/src/routes/index.d.ts +1 -1
- package/elysia/src/routes/internal.d.ts +1 -1
- package/elysia/src/routes/llms.d.ts +1 -1
- package/elysia/src/routes/og.d.ts +1 -1
- package/elysia/src/routes/redirects.d.ts +1 -1
- package/elysia/src/routes/robots.d.ts +1 -1
- package/elysia/src/routes/rss.d.ts +1 -1
- package/elysia/src/routes/search.d.ts +1 -1
- package/elysia/src/routes/sitemap.d.ts +1 -1
- package/elysia/src/routes/ssr.d.ts +1 -1
- package/elysia/src/routes/ssr.d.ts.map +1 -1
- package/elysia/src/routes/static.d.ts +1 -1
- package/elysia/src/routes/static.d.ts.map +1 -1
- package/elysia/src/types.d.ts +1 -1
- package/package.json +2 -9
- package/react/index.d.ts +1 -1
- package/react/index.js +2 -2
- package/react/index.js.map +1 -1
- package/react/src/components/ClientOnly.d.ts +1 -1
- package/react/src/components/ContentRoute.d.ts +1 -1
- package/react/src/components/Image.d.ts +1 -1
- package/react/src/components/LazyRoute.d.ts +1 -1
- package/react/src/components/Link.d.ts +1 -1
- package/react/src/components/Markdown.d.ts +1 -1
- package/react/src/components/Outlet.d.ts +1 -1
- package/react/src/components/index.d.ts +1 -1
- package/react/src/hooks/index.d.ts +1 -1
- package/react/src/hooks/useContent.d.ts +1 -1
- package/react/src/hooks/useData.d.ts +1 -1
- package/react/src/hooks/useFeed.d.ts +1 -1
- package/react/src/hooks/useLayoutData.d.ts +1 -1
- package/react/src/hooks/useLlms.d.ts +1 -1
- package/react/src/hooks/useNavigate.d.ts +1 -1
- package/react/src/hooks/useParams.d.ts +1 -1
- package/react/src/hooks/useRouter.d.ts +1 -1
- package/react/src/hooks/useSearch.d.ts +1 -1
- package/react/src/hooks/useSearchParams.d.ts +1 -1
- package/react/src/hooks/useToc.d.ts +1 -1
- package/react/src/index.d.ts +1 -1
- package/react/src/lib/collection.d.ts +1 -1
- package/react/src/lib/content.d.ts +1 -1
- package/react/src/lib/head.d.ts +1 -1
- package/react/src/lib/index.d.ts +1 -1
- package/react/src/lib/lazy-route.d.ts +1 -1
- package/react/src/lib/route-loader.d.ts +1 -1
- package/react/src/providers/ContentProvider.d.ts +1 -1
- package/react/src/providers/RerouteProvider.d.ts +1 -1
- package/react/src/providers/RouterProvider.d.ts +1 -1
- package/react/src/providers/index.d.ts +1 -1
- package/react/src/types/any.d.ts +1 -1
- package/react/src/types/index.d.ts +1 -1
- package/react/src/types/router.d.ts +1 -1
- package/telemetry/react.d.ts +2 -2
- package/telemetry/react.d.ts.map +1 -1
- package/telemetry/react.js +164 -183
- package/telemetry/react.js.map +7 -6
- package/telemetry/{index.d.ts → server.d.ts} +2 -2
- package/telemetry/server.d.ts.map +1 -0
- package/telemetry/server.js +1134 -0
- package/telemetry/server.js.map +44 -0
- package/telemetry/src/{browser/react.d.ts → react/api.d.ts} +4 -12
- package/telemetry/src/react/api.d.ts.map +1 -0
- package/telemetry/{browser.d.ts → src/react/index.d.ts} +4 -3
- package/telemetry/src/react/index.d.ts.map +1 -0
- package/telemetry/src/{browser/index.d.ts → react/telemetry.d.ts} +13 -13
- package/telemetry/src/react/telemetry.d.ts.map +1 -0
- package/telemetry/src/server/index.d.ts +3 -101
- package/telemetry/src/server/index.d.ts.map +1 -1
- package/telemetry/src/server/instrumentation.d.ts +62 -0
- package/telemetry/src/server/instrumentation.d.ts.map +1 -0
- package/telemetry/src/server/plugin.d.ts +72 -0
- package/telemetry/src/server/plugin.d.ts.map +1 -0
- package/telemetry/browser.d.ts.map +0 -1
- package/telemetry/browser.js +0 -383
- package/telemetry/browser.js.map +0 -10
- package/telemetry/index.d.ts.map +0 -1
- package/telemetry/index.js +0 -525
- package/telemetry/index.js.map +0 -10
- package/telemetry/src/browser/index.d.ts.map +0 -1
- package/telemetry/src/browser/react.d.ts.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* reroute-js v0.
|
|
2
|
+
* reroute-js v0.26.0
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2025 stewones <hi@stewan.io>
|
|
@@ -7,5 +7,6 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Built with Bun <3
|
|
9
9
|
*/
|
|
10
|
-
export * from './
|
|
11
|
-
|
|
10
|
+
export * from './api';
|
|
11
|
+
export * from './telemetry';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/telemetry/src/react/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* reroute-js v0.
|
|
2
|
+
* reroute-js v0.26.0
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2025 stewones <hi@stewan.io>
|
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
*/
|
|
10
10
|
/** biome-ignore-all lint/suspicious/noExplicitAny: That's fine */
|
|
11
11
|
export interface BrowserTelemetryOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Enable browser telemetry
|
|
14
|
+
* @default true
|
|
15
|
+
*/
|
|
16
|
+
enabled?: boolean;
|
|
12
17
|
/**
|
|
13
18
|
* Service name for browser telemetry
|
|
14
19
|
* @default 'reroute-app-browser'
|
|
@@ -29,19 +34,14 @@ export interface BrowserTelemetryOptions {
|
|
|
29
34
|
*/
|
|
30
35
|
apiKey?: string;
|
|
31
36
|
/**
|
|
32
|
-
*
|
|
33
|
-
* @default
|
|
37
|
+
* Deployment environment (e.g., 'production', 'staging', 'development')
|
|
38
|
+
* @default 'development'
|
|
34
39
|
*/
|
|
35
|
-
|
|
40
|
+
environment?: string;
|
|
36
41
|
/**
|
|
37
|
-
* Enable
|
|
42
|
+
* Enable console.error capture
|
|
38
43
|
* @default true
|
|
39
44
|
*/
|
|
40
|
-
enableWebVitals?: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Enable console.error capture (recommended for production only)
|
|
43
|
-
* @default isProduction
|
|
44
|
-
*/
|
|
45
45
|
enableConsoleCapture?: boolean;
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
@@ -50,12 +50,12 @@ export interface BrowserTelemetryOptions {
|
|
|
50
50
|
*
|
|
51
51
|
* @example
|
|
52
52
|
* ```typescript
|
|
53
|
-
* import { initBrowserTelemetry } from 'reroute-js/telemetry/
|
|
53
|
+
* import { initBrowserTelemetry } from 'reroute-js/telemetry/react';
|
|
54
54
|
*
|
|
55
55
|
* initBrowserTelemetry({
|
|
56
56
|
* serviceName: 'My App Browser',
|
|
57
57
|
* otlpEndpoint: '/api/telemetry', // Same-origin proxy
|
|
58
|
-
*
|
|
58
|
+
* environment: 'production',
|
|
59
59
|
* });
|
|
60
60
|
* ```
|
|
61
61
|
*/
|
|
@@ -97,4 +97,4 @@ export declare function trackError(error: Error, context?: Record<string, string
|
|
|
97
97
|
* Gracefully shutdown telemetry
|
|
98
98
|
*/
|
|
99
99
|
export declare function shutdownTelemetry(): Promise<void>;
|
|
100
|
-
//# sourceMappingURL=
|
|
100
|
+
//# sourceMappingURL=telemetry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../../../../../../packages/telemetry/src/react/telemetry.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,MAAM,WAAW,uBAAuB;IACvC;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAOD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,oBAAoB,CACzC,OAAO,GAAE,uBAA4B,iBAgIrC;AA6ND;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CACzB,IAAI,EAAE,MAAM,EACZ,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAM,OAqC1D;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACzB,SAAS,EAAE,MAAM,EACjB,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAM,QAY1D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CACzB,KAAK,EAAE,KAAK,EACZ,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAM,QA0CvD;AAED;;GAEG;AACH,wBAAsB,iBAAiB,kBAMtC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* reroute-js v0.
|
|
2
|
+
* reroute-js v0.26.0
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2025 stewones <hi@stewan.io>
|
|
@@ -7,104 +7,6 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Built with Bun <3
|
|
9
9
|
*/
|
|
10
|
-
|
|
11
|
-
export
|
|
12
|
-
/**
|
|
13
|
-
* Service name for telemetry
|
|
14
|
-
* @default 'reroute-app'
|
|
15
|
-
*/
|
|
16
|
-
serviceName?: string;
|
|
17
|
-
/**
|
|
18
|
-
* Service version
|
|
19
|
-
* @default process.env.npm_package_version || '1.0.0'
|
|
20
|
-
*/
|
|
21
|
-
serviceVersion?: string;
|
|
22
|
-
/**
|
|
23
|
-
* OTLP endpoint URL
|
|
24
|
-
* @default process.env.OTEL_EXPORTER_OTLP_ENDPOINT || 'http://localhost:4318'
|
|
25
|
-
*/
|
|
26
|
-
otlpEndpoint?: string;
|
|
27
|
-
/**
|
|
28
|
-
* API key for authentication (optional, only needed for SigNoz Cloud)
|
|
29
|
-
*/
|
|
30
|
-
apiKey?: string;
|
|
31
|
-
/**
|
|
32
|
-
* Whether running in production
|
|
33
|
-
* @default process.env.NODE_ENV === 'production'
|
|
34
|
-
*/
|
|
35
|
-
isProduction?: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Enable system metrics (CPU, memory, connections)
|
|
38
|
-
* @default true
|
|
39
|
-
*/
|
|
40
|
-
enableSystemMetrics?: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Metric export interval in milliseconds
|
|
43
|
-
* @default 5000
|
|
44
|
-
*/
|
|
45
|
-
metricsInterval?: number;
|
|
46
|
-
/**
|
|
47
|
-
* Enable browser telemetry proxy
|
|
48
|
-
* Creates /api/telemetry/* endpoints to forward browser traces
|
|
49
|
-
* This avoids CORS issues and ad blockers
|
|
50
|
-
* @default false
|
|
51
|
-
*/
|
|
52
|
-
proxy?: boolean;
|
|
53
|
-
/**
|
|
54
|
-
* Enable verbose logging for proxy
|
|
55
|
-
* @default false
|
|
56
|
-
*/
|
|
57
|
-
proxyVerbose?: boolean;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Server-side telemetry plugin for Elysia
|
|
61
|
-
*
|
|
62
|
-
* Automatically captures:
|
|
63
|
-
* - HTTP requests and responses
|
|
64
|
-
* - Errors with full stack traces
|
|
65
|
-
* - System metrics (CPU, memory)
|
|
66
|
-
* - Request/response sizes
|
|
67
|
-
* - Active connections
|
|
68
|
-
*
|
|
69
|
-
* @example
|
|
70
|
-
* ```typescript
|
|
71
|
-
* import { Elysia } from 'elysia';
|
|
72
|
-
* import { telemetry } from 'reroute-js/telemetry/server';
|
|
73
|
-
*
|
|
74
|
-
* new Elysia()
|
|
75
|
-
* .use(telemetry({
|
|
76
|
-
* serviceName: 'My App',
|
|
77
|
-
* isProduction: true,
|
|
78
|
-
* }))
|
|
79
|
-
* .listen(3000);
|
|
80
|
-
* ```
|
|
81
|
-
*/
|
|
82
|
-
export declare function telemetry(options?: ServerTelemetryOptions): (app: Elysia) => Elysia<"", {
|
|
83
|
-
decorator: {};
|
|
84
|
-
store: {};
|
|
85
|
-
derive: {};
|
|
86
|
-
resolve: {};
|
|
87
|
-
}, {
|
|
88
|
-
typebox: {};
|
|
89
|
-
error: {};
|
|
90
|
-
}, {
|
|
91
|
-
schema: {};
|
|
92
|
-
standaloneSchema: {};
|
|
93
|
-
macro: {};
|
|
94
|
-
macroFn: {};
|
|
95
|
-
parser: {};
|
|
96
|
-
response: {};
|
|
97
|
-
}, {}, {
|
|
98
|
-
derive: {};
|
|
99
|
-
resolve: {};
|
|
100
|
-
schema: {};
|
|
101
|
-
standaloneSchema: {};
|
|
102
|
-
response: {};
|
|
103
|
-
}, {
|
|
104
|
-
derive: {};
|
|
105
|
-
resolve: {};
|
|
106
|
-
schema: {};
|
|
107
|
-
standaloneSchema: {};
|
|
108
|
-
response: {};
|
|
109
|
-
}>;
|
|
10
|
+
export * from './instrumentation';
|
|
11
|
+
export * from './plugin';
|
|
110
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/telemetry/src/server/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/telemetry/src/server/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* reroute-js v0.26.0
|
|
3
|
+
*
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright 2025 stewones <hi@stewan.io>
|
|
6
|
+
* @see https://github.com/stewones/reroute
|
|
7
|
+
*
|
|
8
|
+
* Built with Bun <3
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Telemetry utilities for instrumenting operations
|
|
12
|
+
*
|
|
13
|
+
* This module provides helpers to create spans for custom instrumentation:
|
|
14
|
+
* - API endpoints
|
|
15
|
+
* - Database queries
|
|
16
|
+
* - External service calls
|
|
17
|
+
* - Business logic operations
|
|
18
|
+
*/
|
|
19
|
+
import { type Span } from '@opentelemetry/api';
|
|
20
|
+
/**
|
|
21
|
+
* Execute a function within a named span for distributed tracing
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* const result = await withSpan('database.query', async (span) => {
|
|
26
|
+
* span.setAttribute('query', 'SELECT * FROM users');
|
|
27
|
+
* return await db.query('SELECT * FROM users');
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function withSpan<T>(name: string, fn: (span: Span) => Promise<T>, attributes?: Record<string, string | number | boolean>): Promise<T>;
|
|
32
|
+
/**
|
|
33
|
+
* Execute a synchronous function within a named span
|
|
34
|
+
*/
|
|
35
|
+
export declare function withSpanSync<T>(name: string, fn: (span: Span) => T, attributes?: Record<string, string | number | boolean>): T;
|
|
36
|
+
/**
|
|
37
|
+
* Add attributes to the current active span (if available)
|
|
38
|
+
*/
|
|
39
|
+
export declare function setSpanAttributes(attributes: Record<string, string | number | boolean>): void;
|
|
40
|
+
/**
|
|
41
|
+
* Record an event in the current active span
|
|
42
|
+
*/
|
|
43
|
+
export declare function addSpanEvent(name: string, attributes?: Record<string, string | number | boolean>): void;
|
|
44
|
+
/**
|
|
45
|
+
* Execute a function within the context of a parent span
|
|
46
|
+
* This ensures child spans created inside the function are properly nested
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* const parentSpan = store.telemetrySpan;
|
|
51
|
+
* await withParentSpan(parentSpan, async () => {
|
|
52
|
+
* // Any spans created here will be children of parentSpan
|
|
53
|
+
* await withSpan('child.operation', async () => {...});
|
|
54
|
+
* });
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare function withParentSpan<T>(parentSpan: Span | undefined | null, fn: () => Promise<T>): Promise<T>;
|
|
58
|
+
/**
|
|
59
|
+
* Execute a synchronous function within the context of a parent span
|
|
60
|
+
*/
|
|
61
|
+
export declare function withParentSpanSync<T>(parentSpan: Span | undefined | null, fn: () => T): T;
|
|
62
|
+
//# sourceMappingURL=instrumentation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrumentation.d.ts","sourceRoot":"","sources":["../../../../../../packages/telemetry/src/server/instrumentation.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAW,KAAK,IAAI,EAAyB,MAAM,oBAAoB,CAAC;AA8D/E;;;;;;;;;;GAUG;AACH,wBAAsB,QAAQ,CAAC,CAAC,EAC/B,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,EAC9B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GACpD,OAAO,CAAC,CAAC,CAAC,CAqBZ;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAC7B,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,CAAC,EACrB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GACpD,CAAC,CAqBH;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAChC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,QAQrD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC3B,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,QAQtD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,cAAc,CAAC,CAAC,EACrC,UAAU,EAAE,IAAI,GAAG,SAAS,GAAG,IAAI,EACnC,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAClB,OAAO,CAAC,CAAC,CAAC,CAQZ;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EACnC,UAAU,EAAE,IAAI,GAAG,SAAS,GAAG,IAAI,EACnC,EAAE,EAAE,MAAM,CAAC,GACT,CAAC,CAOH"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* reroute-js v0.26.0
|
|
3
|
+
*
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright 2025 stewones <hi@stewan.io>
|
|
6
|
+
* @see https://github.com/stewones/reroute
|
|
7
|
+
*
|
|
8
|
+
* Built with Bun <3
|
|
9
|
+
*/
|
|
10
|
+
import type { Elysia } from 'elysia';
|
|
11
|
+
import { type TelemetryOptions } from 'reroute-js/core';
|
|
12
|
+
/**
|
|
13
|
+
* Server telemetry options
|
|
14
|
+
* Extends TelemetryOptions from config - all options can be set in reroute.config.ts
|
|
15
|
+
* or passed directly here (direct options override config values)
|
|
16
|
+
*/
|
|
17
|
+
export interface ServerTelemetryOptions extends TelemetryOptions {
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Server-side telemetry plugin for Elysia
|
|
21
|
+
*
|
|
22
|
+
* Automatically captures:
|
|
23
|
+
* - HTTP requests and responses
|
|
24
|
+
* - Errors with full stack traces
|
|
25
|
+
* - System metrics (CPU, memory)
|
|
26
|
+
* - Request/response sizes
|
|
27
|
+
* - Active connections
|
|
28
|
+
*
|
|
29
|
+
* Configuration is loaded from reroute.config.ts automatically.
|
|
30
|
+
* Direct options override config values.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* import { Elysia } from 'elysia';
|
|
35
|
+
* import { telemetry } from 'reroute-js/telemetry/server';
|
|
36
|
+
*
|
|
37
|
+
* new Elysia()
|
|
38
|
+
* .use(telemetry({
|
|
39
|
+
* serviceName: 'My App',
|
|
40
|
+
* }))
|
|
41
|
+
* .listen(3000);
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function telemetry(options?: ServerTelemetryOptions): (app: Elysia) => Promise<Elysia<"", {
|
|
45
|
+
decorator: {};
|
|
46
|
+
store: {};
|
|
47
|
+
derive: {};
|
|
48
|
+
resolve: {};
|
|
49
|
+
}, {
|
|
50
|
+
typebox: {};
|
|
51
|
+
error: {};
|
|
52
|
+
}, {
|
|
53
|
+
schema: {};
|
|
54
|
+
standaloneSchema: {};
|
|
55
|
+
macro: {};
|
|
56
|
+
macroFn: {};
|
|
57
|
+
parser: {};
|
|
58
|
+
response: {};
|
|
59
|
+
}, {}, {
|
|
60
|
+
derive: {};
|
|
61
|
+
resolve: {};
|
|
62
|
+
schema: {};
|
|
63
|
+
standaloneSchema: {};
|
|
64
|
+
response: {};
|
|
65
|
+
}, {
|
|
66
|
+
derive: {};
|
|
67
|
+
resolve: {};
|
|
68
|
+
schema: {};
|
|
69
|
+
standaloneSchema: {};
|
|
70
|
+
response: {};
|
|
71
|
+
}>>;
|
|
72
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../../packages/telemetry/src/server/plugin.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAc,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEpE;;;;GAIG;AACH,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB;CAAG;AAoEnE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,SAAS,CAAC,OAAO,GAAE,sBAA2B,IAE/C,KAAK,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;IAowBzB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../../packages/telemetry/browser.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|