binja 0.5.3 → 0.6.1

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.
@@ -0,0 +1,104 @@
1
+ /**
2
+ * ORM Integrations for Query Telemetry
3
+ *
4
+ * Provides helpers for Prisma, Drizzle, and Bun SQL
5
+ */
6
+ import type { QueryInfo } from './collector';
7
+ type QueryInput = Omit<QueryInfo, 'timestamp' | 'isN1'>;
8
+ /**
9
+ * Record a query manually (works with any database)
10
+ */
11
+ export declare function recordQuery(query: QueryInput): void;
12
+ /**
13
+ * Create Prisma middleware for query telemetry
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * import { PrismaClient } from '@prisma/client'
18
+ * import { createPrismaMiddleware } from 'binja/debug'
19
+ *
20
+ * const prisma = new PrismaClient()
21
+ * prisma.$use(createPrismaMiddleware())
22
+ * ```
23
+ */
24
+ export declare function createPrismaMiddleware(): (params: any, next: (params: any) => Promise<any>) => Promise<any>;
25
+ /**
26
+ * Setup Prisma query event logging
27
+ *
28
+ * @example
29
+ * ```typescript
30
+ * import { PrismaClient } from '@prisma/client'
31
+ * import { setupPrismaLogging } from 'binja/debug'
32
+ *
33
+ * const prisma = new PrismaClient({ log: [{ emit: 'event', level: 'query' }] })
34
+ * setupPrismaLogging(prisma)
35
+ * ```
36
+ */
37
+ export declare function setupPrismaLogging(prisma: any): void;
38
+ /**
39
+ * Create Drizzle logger for query telemetry
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * import { drizzle } from 'drizzle-orm/...'
44
+ * import { createDrizzleLogger } from 'binja/debug'
45
+ *
46
+ * const db = drizzle(client, { logger: createDrizzleLogger() })
47
+ * ```
48
+ */
49
+ export declare function createDrizzleLogger(): {
50
+ logQuery(query: string, params: unknown[]): void;
51
+ };
52
+ /**
53
+ * Wrap a Drizzle query for accurate timing
54
+ *
55
+ * @example
56
+ * ```typescript
57
+ * import { wrapDrizzleQuery } from 'binja/debug'
58
+ *
59
+ * const users = await wrapDrizzleQuery(
60
+ * db.select().from(usersTable).where(eq(usersTable.id, 1))
61
+ * )
62
+ * ```
63
+ */
64
+ export declare function wrapDrizzleQuery<T>(query: Promise<T>, sql?: string): Promise<T>;
65
+ /**
66
+ * Wrap Bun SQL database for query telemetry
67
+ *
68
+ * @example
69
+ * ```typescript
70
+ * import { Database } from 'bun:sqlite'
71
+ * import { wrapBunSQL } from 'binja/debug'
72
+ *
73
+ * const db = wrapBunSQL(new Database('mydb.sqlite'))
74
+ * ```
75
+ */
76
+ export declare function wrapBunSQL<T extends object>(db: T): T;
77
+ /**
78
+ * Wrap any async query function for timing
79
+ *
80
+ * @example
81
+ * ```typescript
82
+ * import { wrapQuery } from 'binja/debug'
83
+ *
84
+ * const result = await wrapQuery(
85
+ * 'SELECT * FROM users WHERE id = ?',
86
+ * () => db.query('SELECT * FROM users WHERE id = ?', [1])
87
+ * )
88
+ * ```
89
+ */
90
+ export declare function wrapQuery<T>(sql: string, queryFn: () => Promise<T>, source?: string): Promise<T>;
91
+ /**
92
+ * Create a query wrapper for any database client
93
+ *
94
+ * @example
95
+ * ```typescript
96
+ * import { createQueryWrapper } from 'binja/debug'
97
+ *
98
+ * const query = createQueryWrapper('mysql')
99
+ * const users = await query('SELECT * FROM users', () => mysql.query('SELECT * FROM users'))
100
+ * ```
101
+ */
102
+ export declare function createQueryWrapper(source: string): <T>(sql: string, queryFn: () => Promise<T>) => Promise<T>;
103
+ export {};
104
+ //# sourceMappingURL=integrations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integrations.d.ts","sourceRoot":"","sources":["../../src/debug/integrations.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,KAAK,UAAU,GAAG,IAAI,CAAC,SAAS,EAAE,WAAW,GAAG,MAAM,CAAC,CAAA;AAEvD;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAKnD;AAID;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,KACtB,QAAQ,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,kBAqB/D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,GAAG,GAAG,IAAI,CAYpD;AAID;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB;oBAEf,MAAM,UAAU,OAAO,EAAE,GAAG,IAAI;EAcnD;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,EACtC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,EACjB,GAAG,CAAC,EAAE,MAAM,GACX,OAAO,CAAC,CAAC,CAAC,CAkBZ;AAID;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,CA0CrD;AA0CD;;;;;;;;;;;;GAYG;AACH,wBAAsB,SAAS,CAAC,CAAC,EAC/B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACzB,MAAM,SAAQ,GACb,OAAO,CAAC,CAAC,CAAC,CAkBZ;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,IACvC,CAAC,EAAE,KAAK,MAAM,EAAE,SAAS,MAAM,OAAO,CAAC,CAAC,CAAC,KAAG,OAAO,CAAC,CAAC,CAAC,CAG/D"}
@@ -1,16 +1,18 @@
1
1
  /**
2
- * Debug Panel - Professional template debugging interface
2
+ * Debug Panel - Chrome DevTools-style debugging interface
3
3
  */
4
4
  import type { DebugData } from './collector';
5
5
  export interface PanelOptions {
6
- /** Panel position */
7
- position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
8
- /** Start collapsed */
9
- collapsed?: boolean;
10
- /** Dark mode */
11
- dark?: boolean;
12
- /** Panel width in pixels */
6
+ /** Panel position: 'bottom' (default), 'right', or 'popup' */
7
+ position?: 'bottom' | 'right' | 'popup';
8
+ /** Initial height in pixels (for bottom dock) */
9
+ height?: number;
10
+ /** Initial width in pixels (for right dock) */
13
11
  width?: number;
12
+ /** Start with panel open */
13
+ open?: boolean;
14
+ /** Dark mode (default: true) */
15
+ dark?: boolean;
14
16
  }
15
17
  export declare function generateDebugPanel(data: DebugData, options?: PanelOptions): string;
16
18
  //# sourceMappingURL=panel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"panel.d.ts","sourceRoot":"","sources":["../../src/debug/panel.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAA8B,MAAM,aAAa,CAAA;AAExE,MAAM,WAAW,YAAY;IAC3B,qBAAqB;IACrB,QAAQ,CAAC,EAAE,cAAc,GAAG,aAAa,GAAG,WAAW,GAAG,UAAU,CAAA;IACpE,sBAAsB;IACtB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,gBAAgB;IAChB,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,4BAA4B;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AASD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,GAAE,YAAiB,GAAG,MAAM,CAetF"}
1
+ {"version":3,"file":"panel.d.ts","sourceRoot":"","sources":["../../src/debug/panel.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAgB,MAAM,aAAa,CAAA;AAE1D,MAAM,WAAW,YAAY;IAC3B,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAA;IACvC,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,4BAA4B;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,gCAAgC;IAChC,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAUD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,GAAE,YAAiB,GAAG,MAAM,CActF"}