@stacksjs/debugbar 0.0.1-stage → 0.75.730
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/LICENSE.md +21 -0
- package/README.md +43 -0
- package/dist/api.d.ts +30 -0
- package/dist/assets.d.ts +9 -0
- package/dist/client/debugbar.js +234 -0
- package/dist/collectors/auth.d.ts +2 -0
- package/dist/collectors/cache.d.ts +2 -0
- package/dist/collectors/environment.d.ts +4 -0
- package/dist/collectors/events.d.ts +2 -0
- package/dist/collectors/exceptions.d.ts +5 -0
- package/dist/collectors/index.d.ts +5 -0
- package/dist/collectors/jobs.d.ts +2 -0
- package/dist/collectors/logs.d.ts +2 -0
- package/dist/collectors/mail.d.ts +4 -0
- package/dist/collectors/messages.d.ts +2 -0
- package/dist/collectors/queries.d.ts +18 -0
- package/dist/collectors/request.d.ts +2 -0
- package/dist/collectors/route.d.ts +2 -0
- package/dist/collectors/timeline.d.ts +4 -0
- package/dist/collectors/views.d.ts +11 -0
- package/dist/collectors.d.ts +47 -0
- package/dist/context.d.ts +44 -0
- package/dist/endpoints.d.ts +24 -0
- package/dist/frames.d.ts +13 -0
- package/dist/guard.d.ts +37 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.js +10 -0
- package/dist/inject.d.ts +40 -0
- package/dist/middleware.d.ts +14 -0
- package/dist/peer.d.ts +23 -0
- package/dist/redact.d.ts +36 -0
- package/dist/runtime.d.ts +47 -0
- package/dist/sql.d.ts +15 -0
- package/dist/state.d.ts +28 -0
- package/dist/storage.d.ts +18 -0
- package/dist/tsconfig.json +5 -0
- package/dist/types.d.ts +145 -0
- package/dist/user.d.ts +7 -0
- package/dist/views.d.ts +18 -0
- package/package.json +63 -1
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import type { DebugbarConfig, DebugbarUser } from '@stacksjs/types';
|
|
2
|
+
export type { DebugbarCollectorName, DebugbarConfig, DebugbarQueriesConfig, DebugbarSignInAsConfig, DebugbarUser } from '@stacksjs/types';
|
|
3
|
+
export declare interface MessageEntry {
|
|
4
|
+
level: MessageLevel
|
|
5
|
+
label?: string
|
|
6
|
+
message: string
|
|
7
|
+
context?: unknown
|
|
8
|
+
at: number
|
|
9
|
+
}
|
|
10
|
+
export declare interface MeasureEntry {
|
|
11
|
+
label: string
|
|
12
|
+
start: number
|
|
13
|
+
duration: number
|
|
14
|
+
group: string
|
|
15
|
+
}
|
|
16
|
+
export declare interface QueryEntry {
|
|
17
|
+
sql: string
|
|
18
|
+
params: unknown[]
|
|
19
|
+
start: number
|
|
20
|
+
duration: number
|
|
21
|
+
rows?: number
|
|
22
|
+
kind?: string
|
|
23
|
+
source?: string
|
|
24
|
+
error?: string
|
|
25
|
+
duplicates?: number
|
|
26
|
+
similar?: number
|
|
27
|
+
slow?: boolean
|
|
28
|
+
}
|
|
29
|
+
export declare interface QueriesSection {
|
|
30
|
+
count: number
|
|
31
|
+
duration: number
|
|
32
|
+
dropped: number
|
|
33
|
+
duplicates: number
|
|
34
|
+
slow: number
|
|
35
|
+
failed: number
|
|
36
|
+
slowThresholdMs: number
|
|
37
|
+
nPlusOne: Array<{ shape: string, count: number, sample: string, source?: string }>
|
|
38
|
+
statements: QueryEntry[]
|
|
39
|
+
}
|
|
40
|
+
export declare interface LogEntry {
|
|
41
|
+
level: string
|
|
42
|
+
message: string
|
|
43
|
+
at: number
|
|
44
|
+
context?: unknown
|
|
45
|
+
}
|
|
46
|
+
export declare interface StackFrame {
|
|
47
|
+
function?: string
|
|
48
|
+
file: string
|
|
49
|
+
line?: number
|
|
50
|
+
column?: number
|
|
51
|
+
app: boolean
|
|
52
|
+
}
|
|
53
|
+
export declare interface ExceptionEntry {
|
|
54
|
+
name: string
|
|
55
|
+
message: string
|
|
56
|
+
at: number
|
|
57
|
+
frames: StackFrame[]
|
|
58
|
+
excerpt?: { file: string, line: number, start: number, lines: string[] }
|
|
59
|
+
context?: unknown
|
|
60
|
+
}
|
|
61
|
+
export declare interface EventEntry {
|
|
62
|
+
name: string
|
|
63
|
+
at: number
|
|
64
|
+
payload?: unknown
|
|
65
|
+
}
|
|
66
|
+
export declare interface CacheEntry {
|
|
67
|
+
type: 'hit' | 'miss' | 'write' | 'forget'
|
|
68
|
+
key: string
|
|
69
|
+
ttl?: number
|
|
70
|
+
duration?: number
|
|
71
|
+
at: number
|
|
72
|
+
}
|
|
73
|
+
export declare interface MailEntry {
|
|
74
|
+
to: string[]
|
|
75
|
+
subject: string
|
|
76
|
+
from?: string
|
|
77
|
+
driver: string
|
|
78
|
+
success: boolean
|
|
79
|
+
message?: string
|
|
80
|
+
duration: number
|
|
81
|
+
at: number
|
|
82
|
+
}
|
|
83
|
+
export declare interface JobEntry {
|
|
84
|
+
event: string
|
|
85
|
+
name: string
|
|
86
|
+
queue: string
|
|
87
|
+
at: number
|
|
88
|
+
payload?: unknown
|
|
89
|
+
error?: string
|
|
90
|
+
}
|
|
91
|
+
export declare interface RouteSection {
|
|
92
|
+
method: string
|
|
93
|
+
path: string
|
|
94
|
+
handler: string
|
|
95
|
+
middleware: string[]
|
|
96
|
+
}
|
|
97
|
+
export declare interface ViewSection {
|
|
98
|
+
template?: string
|
|
99
|
+
layout?: string
|
|
100
|
+
fragment: boolean
|
|
101
|
+
renderMs: number
|
|
102
|
+
}
|
|
103
|
+
export declare interface DebugbarSummary {
|
|
104
|
+
method: string
|
|
105
|
+
url: string
|
|
106
|
+
path: string
|
|
107
|
+
status: number
|
|
108
|
+
kind: DebugbarRequestKind
|
|
109
|
+
process: DebugbarProcess
|
|
110
|
+
duration: number
|
|
111
|
+
memory: number
|
|
112
|
+
queries: number
|
|
113
|
+
queryDuration: number
|
|
114
|
+
logs: number
|
|
115
|
+
exceptions: number
|
|
116
|
+
route?: string
|
|
117
|
+
user?: { id: number | string, name?: string, email?: string }
|
|
118
|
+
}
|
|
119
|
+
/** One finished request, as written to disk and served to the bar. */
|
|
120
|
+
export declare interface DebugbarRecord {
|
|
121
|
+
id: string
|
|
122
|
+
version: 1
|
|
123
|
+
startedAt: string
|
|
124
|
+
summary: DebugbarSummary
|
|
125
|
+
collectors: Record<string, unknown>
|
|
126
|
+
labels?: Record<string, string>
|
|
127
|
+
}
|
|
128
|
+
/** What `/__debugbar/users` answers with. */
|
|
129
|
+
export declare interface SignInAsListing {
|
|
130
|
+
enabled: boolean
|
|
131
|
+
users: DebugbarUser[]
|
|
132
|
+
current: DebugbarUser | null
|
|
133
|
+
tokenStorageKey?: string
|
|
134
|
+
}
|
|
135
|
+
/** The resolved settings every part of the package reads. */
|
|
136
|
+
export declare interface ResolvedDebugbarConfig extends DebugbarConfig {
|
|
137
|
+
storage: { path: string, maxRequests: number }
|
|
138
|
+
except: string[]
|
|
139
|
+
queries: { slowThresholdMs: number, nPlusOneThreshold: number, backtrace: boolean, maxQueries: number }
|
|
140
|
+
}
|
|
141
|
+
/** Which server produced a record: the one that renders pages or the API. */
|
|
142
|
+
export type DebugbarProcess = 'views' | 'api';
|
|
143
|
+
/** `page` is a full document, `fragment` an stx router navigation, `api` everything else. */
|
|
144
|
+
export type DebugbarRequestKind = 'page' | 'fragment' | 'api';
|
|
145
|
+
export type MessageLevel = 'debug' | 'info' | 'warning' | 'error';
|
package/dist/user.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DebugbarUser } from '@stacksjs/types';
|
|
2
|
+
export declare function describeUser(row: unknown): DebugbarUser | null;
|
|
3
|
+
export declare function requestToken(request: Request, cookieToken?: (request: Request) => string | undefined): { token: string, via: 'bearer' | 'cookie' } | undefined;
|
|
4
|
+
/** The user a request's token belongs to, or null for a guest or a dead token. */
|
|
5
|
+
export declare function resolveRequestUser(request: Request): Promise<{ user: DebugbarUser | null, via: 'bearer' | 'cookie' | 'none' }>;
|
|
6
|
+
/** Forget cached lookups, after a sign-in or a sign-out changes the answer. */
|
|
7
|
+
export declare function forgetResolvedUsers(): void;
|
package/dist/views.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { BootOptions, DebugbarRuntime } from './runtime';
|
|
2
|
+
/**
|
|
3
|
+
* The debugbar for a server that renders pages, or undefined when it is not
|
|
4
|
+
* enabled in this process. A caller that gets undefined mounts nothing.
|
|
5
|
+
*
|
|
6
|
+
* Create it before the page server's module is imported (see peer.ts): on
|
|
7
|
+
* an app with i18n the client's address cannot be told otherwise, and every
|
|
8
|
+
* request under `/__debugbar/` is then refused.
|
|
9
|
+
*/
|
|
10
|
+
export declare function createViewsDebugbar(options?: ViewsDebugbarOptions): ViewsDebugbar | undefined;
|
|
11
|
+
export declare interface ViewsDebugbarOptions extends BootOptions {
|
|
12
|
+
clientAddress?: (request: Request, server: unknown) => string | null | undefined
|
|
13
|
+
}
|
|
14
|
+
export declare interface ViewsDebugbar {
|
|
15
|
+
readonly runtime: DebugbarRuntime
|
|
16
|
+
onRequest: (request: Request, server?: unknown) => Promise<Response> | undefined
|
|
17
|
+
onResponse: (request: Request, response: Response) => Response | undefined
|
|
18
|
+
}
|
package/package.json
CHANGED
|
@@ -1,14 +1,76 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/debugbar",
|
|
3
|
-
"version": "0.0.1-stage",
|
|
4
3
|
"type": "module",
|
|
4
|
+
"sideEffects": false,
|
|
5
|
+
"version": "0.75.730",
|
|
5
6
|
"description": "The Stacks debugbar: a request inspector for development.",
|
|
6
7
|
"author": "Chris Breuer",
|
|
8
|
+
"contributors": [
|
|
9
|
+
"Chris Breuer <chris@stacksjs.com>"
|
|
10
|
+
],
|
|
7
11
|
"license": "MIT",
|
|
12
|
+
"funding": "https://github.com/sponsors/chrisbbreuer",
|
|
8
13
|
"homepage": "https://github.com/stacksjs/stacks/tree/main/storage/framework/core/debugbar#readme",
|
|
9
14
|
"repository": {
|
|
10
15
|
"type": "git",
|
|
11
16
|
"url": "git+https://github.com/stacksjs/stacks.git",
|
|
12
17
|
"directory": "./storage/framework/core/debugbar"
|
|
18
|
+
},
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/stacksjs/stacks/issues"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"debugbar",
|
|
24
|
+
"debug",
|
|
25
|
+
"profiler",
|
|
26
|
+
"queries",
|
|
27
|
+
"stacks"
|
|
28
|
+
],
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"bun": "./dist/index.js",
|
|
33
|
+
"import": "./dist/index.js",
|
|
34
|
+
"default": "./dist/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./*": {
|
|
37
|
+
"types": "./dist/*.d.ts",
|
|
38
|
+
"bun": "./dist/*.js",
|
|
39
|
+
"import": "./dist/*.js",
|
|
40
|
+
"default": "./dist/*.js"
|
|
41
|
+
},
|
|
42
|
+
"./*.js": {
|
|
43
|
+
"types": "./dist/*.d.ts",
|
|
44
|
+
"bun": "./dist/*.js",
|
|
45
|
+
"import": "./dist/*.js",
|
|
46
|
+
"default": "./dist/*.js"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"module": "dist/index.js",
|
|
50
|
+
"types": "dist/index.d.ts",
|
|
51
|
+
"files": [
|
|
52
|
+
"README.md",
|
|
53
|
+
"dist"
|
|
54
|
+
],
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "bun build.ts",
|
|
57
|
+
"typecheck": "bun tsc --noEmit",
|
|
58
|
+
"prepublishOnly": "bun run build"
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"better-dx": "^0.2.39"
|
|
62
|
+
},
|
|
63
|
+
"dependencies": {
|
|
64
|
+
"@stacksjs/auth": "0.75.730",
|
|
65
|
+
"@stacksjs/config": "0.75.730",
|
|
66
|
+
"@stacksjs/database": "0.75.730",
|
|
67
|
+
"@stacksjs/error-handling": "0.75.730",
|
|
68
|
+
"@stacksjs/events": "0.75.730",
|
|
69
|
+
"@stacksjs/logging": "0.75.730",
|
|
70
|
+
"@stacksjs/path": "0.75.730",
|
|
71
|
+
"@stacksjs/query-builder": "0.75.730",
|
|
72
|
+
"@stacksjs/queue": "0.75.730",
|
|
73
|
+
"@stacksjs/router": "0.75.730",
|
|
74
|
+
"@stacksjs/types": "0.75.730"
|
|
13
75
|
}
|
|
14
76
|
}
|