@geekmidas/telescope 0.0.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.
Files changed (103) hide show
  1. package/README.md +521 -0
  2. package/dist/Telescope-B3Wd82yk.cjs +602 -0
  3. package/dist/Telescope-B3Wd82yk.cjs.map +1 -0
  4. package/dist/Telescope-C5dyDYYB.d.cts +133 -0
  5. package/dist/Telescope-D-uoZB6b.mjs +596 -0
  6. package/dist/Telescope-D-uoZB6b.mjs.map +1 -0
  7. package/dist/Telescope-DyIWgh9-.d.mts +133 -0
  8. package/dist/Telescope.cjs +3 -0
  9. package/dist/Telescope.d.cts +3 -0
  10. package/dist/Telescope.d.mts +3 -0
  11. package/dist/Telescope.mjs +3 -0
  12. package/dist/chunk-CUT6urMc.cjs +30 -0
  13. package/dist/index.cjs +5 -0
  14. package/dist/index.d.cts +4 -0
  15. package/dist/index.d.mts +4 -0
  16. package/dist/index.mjs +4 -0
  17. package/dist/logger/console.cjs +161 -0
  18. package/dist/logger/console.cjs.map +1 -0
  19. package/dist/logger/console.d.cts +109 -0
  20. package/dist/logger/console.d.mts +109 -0
  21. package/dist/logger/console.mjs +159 -0
  22. package/dist/logger/console.mjs.map +1 -0
  23. package/dist/logger/pino.cjs +118 -0
  24. package/dist/logger/pino.cjs.map +1 -0
  25. package/dist/logger/pino.d.cts +89 -0
  26. package/dist/logger/pino.d.mts +89 -0
  27. package/dist/logger/pino.mjs +116 -0
  28. package/dist/logger/pino.mjs.map +1 -0
  29. package/dist/memory-9-B9WACq.cjs +110 -0
  30. package/dist/memory-9-B9WACq.cjs.map +1 -0
  31. package/dist/memory-Cm0eevCS.d.mts +38 -0
  32. package/dist/memory-DiP1a-pp.d.cts +38 -0
  33. package/dist/memory-SdN5vtG9.mjs +104 -0
  34. package/dist/memory-SdN5vtG9.mjs.map +1 -0
  35. package/dist/server/hono.cjs +180 -0
  36. package/dist/server/hono.cjs.map +1 -0
  37. package/dist/server/hono.d.cts +26 -0
  38. package/dist/server/hono.d.mts +26 -0
  39. package/dist/server/hono.mjs +176 -0
  40. package/dist/server/hono.mjs.map +1 -0
  41. package/dist/storage/kysely.cjs +336 -0
  42. package/dist/storage/kysely.cjs.map +1 -0
  43. package/dist/storage/kysely.d.cts +161 -0
  44. package/dist/storage/kysely.d.mts +161 -0
  45. package/dist/storage/kysely.mjs +334 -0
  46. package/dist/storage/kysely.mjs.map +1 -0
  47. package/dist/storage/memory.cjs +3 -0
  48. package/dist/storage/memory.d.cts +3 -0
  49. package/dist/storage/memory.d.mts +3 -0
  50. package/dist/storage/memory.mjs +3 -0
  51. package/dist/types-BGDhFv4R.d.cts +170 -0
  52. package/dist/types-CZbzz8kx.d.mts +170 -0
  53. package/dist/types.cjs +0 -0
  54. package/dist/types.d.cts +2 -0
  55. package/dist/types.d.mts +2 -0
  56. package/dist/types.mjs +0 -0
  57. package/dist/ui-assets-D6-8TAr_.mjs +30 -0
  58. package/dist/ui-assets-D6-8TAr_.mjs.map +1 -0
  59. package/dist/ui-assets-ulevVble.cjs +48 -0
  60. package/dist/ui-assets-ulevVble.cjs.map +1 -0
  61. package/dist/ui-assets.cjs +5 -0
  62. package/dist/ui-assets.d.cts +12 -0
  63. package/dist/ui-assets.d.mts +12 -0
  64. package/dist/ui-assets.mjs +3 -0
  65. package/package.json +83 -0
  66. package/scripts/embed-ui.ts +90 -0
  67. package/src/Telescope.ts +714 -0
  68. package/src/__tests__/Telescope.spec.ts +356 -0
  69. package/src/index.ts +23 -0
  70. package/src/logger/__tests__/console.spec.ts +266 -0
  71. package/src/logger/__tests__/pino.spec.ts +217 -0
  72. package/src/logger/console.ts +230 -0
  73. package/src/logger/pino.ts +191 -0
  74. package/src/server/__tests__/hono.spec.ts +340 -0
  75. package/src/server/hono.ts +247 -0
  76. package/src/storage/__tests__/kysely.spec.ts +715 -0
  77. package/src/storage/__tests__/memory.spec.ts +411 -0
  78. package/src/storage/kysely.ts +572 -0
  79. package/src/storage/memory.ts +168 -0
  80. package/src/types.ts +188 -0
  81. package/src/ui-assets.ts +40 -0
  82. package/ui/index.html +12 -0
  83. package/ui/node_modules/.bin/browserslist +21 -0
  84. package/ui/node_modules/.bin/jiti +21 -0
  85. package/ui/node_modules/.bin/terser +21 -0
  86. package/ui/node_modules/.bin/tsc +21 -0
  87. package/ui/node_modules/.bin/tsserver +21 -0
  88. package/ui/node_modules/.bin/tsx +21 -0
  89. package/ui/node_modules/.bin/vite +21 -0
  90. package/ui/package.json +24 -0
  91. package/ui/src/App.tsx +342 -0
  92. package/ui/src/api.ts +75 -0
  93. package/ui/src/components/ExceptionDetail.tsx +100 -0
  94. package/ui/src/components/LogDetail.tsx +91 -0
  95. package/ui/src/components/RequestDetail.tsx +143 -0
  96. package/ui/src/main.tsx +10 -0
  97. package/ui/src/styles.css +10 -0
  98. package/ui/src/types.ts +63 -0
  99. package/ui/src/vite-env.d.ts +1 -0
  100. package/ui/src/vite-plugin-gkm-config.ts +54 -0
  101. package/ui/tsconfig.json +20 -0
  102. package/ui/tsconfig.tsbuildinfo +14 -0
  103. package/ui/vite.config.ts +13 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kysely.mjs","names":["config: KyselyStorageConfig<DB>","entry: RequestEntry","entries: RequestEntry[]","options?: QueryOptions","row: TelescopeRequestTable","id: string","entry: ExceptionEntry","entries: ExceptionEntry[]","row: TelescopeExceptionTable","entry: LogEntry","entries: LogEntry[]","row: TelescopeLogTable","olderThan: Date","eb: any","query: any","value: unknown"],"sources":["../../src/storage/kysely.ts"],"sourcesContent":["import type { Kysely } from 'kysely';\nimport type {\n ExceptionEntry,\n LogEntry,\n QueryOptions,\n RequestEntry,\n TelescopeStats,\n TelescopeStorage,\n} from '../types';\n\n/**\n * Database table interface for telescope requests.\n * Use this to define your telescope_requests table in your Kysely database schema.\n */\nexport interface TelescopeRequestTable {\n id: string;\n method: string;\n path: string;\n url: string;\n headers: unknown;\n body: unknown | null;\n query: unknown | null;\n status: number;\n response_headers: unknown;\n response_body: unknown | null;\n duration: number;\n timestamp: Date;\n ip: string | null;\n user_id: string | null;\n tags: unknown | null;\n}\n\n/**\n * Database table interface for telescope exceptions.\n */\nexport interface TelescopeExceptionTable {\n id: string;\n name: string;\n message: string;\n stack: unknown;\n source: unknown | null;\n request_id: string | null;\n timestamp: Date;\n handled: boolean;\n tags: unknown | null;\n}\n\n/**\n * Database table interface for telescope logs.\n */\nexport interface TelescopeLogTable {\n id: string;\n level: string;\n message: string;\n context: unknown | null;\n request_id: string | null;\n timestamp: Date;\n}\n\n/**\n * Combined database interface for all telescope tables.\n * Use this to extend your database schema.\n *\n * @example\n * ```typescript\n * import type { TelescopeTables } from '@geekmidas/telescope/storage/kysely';\n *\n * interface Database extends TelescopeTables {\n * users: UserTable;\n * // ... other tables\n * }\n * ```\n */\nexport interface TelescopeTables {\n telescope_requests: TelescopeRequestTable;\n telescope_exceptions: TelescopeExceptionTable;\n telescope_logs: TelescopeLogTable;\n}\n\n/**\n * Configuration for KyselyStorage.\n */\nexport interface KyselyStorageConfig<DB> {\n /** Kysely database instance */\n db: Kysely<DB>;\n /**\n * Table name prefix (default: 'telescope').\n * Tables will be named: {prefix}_requests, {prefix}_exceptions, {prefix}_logs\n */\n tablePrefix?: string;\n}\n\n/**\n * Kysely-based storage implementation for Telescope.\n * Stores telescope data in PostgreSQL, MySQL, or SQLite using Kysely.\n *\n * @template DB - Your Kysely database schema (must include TelescopeTables)\n *\n * @example\n * ```typescript\n * import { Kysely, PostgresDialect } from 'kysely';\n * import { KyselyStorage, type TelescopeTables } from '@geekmidas/telescope/storage/kysely';\n *\n * interface Database extends TelescopeTables {\n * users: UserTable;\n * }\n *\n * const db = new Kysely<Database>({ dialect: new PostgresDialect({ pool }) });\n * const storage = new KyselyStorage({ db });\n *\n * const telescope = new Telescope({ storage });\n * ```\n */\nexport class KyselyStorage<DB> implements TelescopeStorage {\n private readonly db: Kysely<DB>;\n private readonly requestsTable: string;\n private readonly exceptionsTable: string;\n private readonly logsTable: string;\n\n constructor(config: KyselyStorageConfig<DB>) {\n this.db = config.db;\n const prefix = config.tablePrefix ?? 'telescope';\n this.requestsTable = `${prefix}_requests`;\n this.exceptionsTable = `${prefix}_exceptions`;\n this.logsTable = `${prefix}_logs`;\n }\n\n // ============================================\n // Requests\n // ============================================\n\n async saveRequest(entry: RequestEntry): Promise<void> {\n const row = this.requestToRow(entry);\n await (this.db as any)\n .insertInto(this.requestsTable)\n .values(row)\n .execute();\n }\n\n async saveRequests(entries: RequestEntry[]): Promise<void> {\n if (entries.length === 0) return;\n\n const rows = entries.map((e) => this.requestToRow(e));\n await (this.db as any)\n .insertInto(this.requestsTable)\n .values(rows)\n .execute();\n }\n\n async getRequests(options?: QueryOptions): Promise<RequestEntry[]> {\n let query = (this.db as any)\n .selectFrom(this.requestsTable)\n .selectAll()\n .orderBy('timestamp', 'desc');\n\n query = this.applyQueryOptions(query, options);\n\n const rows = await query.execute();\n return rows.map((row: TelescopeRequestTable) => this.rowToRequest(row));\n }\n\n async getRequest(id: string): Promise<RequestEntry | null> {\n const row = await (this.db as any)\n .selectFrom(this.requestsTable)\n .selectAll()\n .where('id', '=', id)\n .executeTakeFirst();\n\n return row ? this.rowToRequest(row) : null;\n }\n\n // ============================================\n // Exceptions\n // ============================================\n\n async saveException(entry: ExceptionEntry): Promise<void> {\n const row = this.exceptionToRow(entry);\n await (this.db as any)\n .insertInto(this.exceptionsTable)\n .values(row)\n .execute();\n }\n\n async saveExceptions(entries: ExceptionEntry[]): Promise<void> {\n if (entries.length === 0) return;\n\n const rows = entries.map((e) => this.exceptionToRow(e));\n await (this.db as any)\n .insertInto(this.exceptionsTable)\n .values(rows)\n .execute();\n }\n\n async getExceptions(options?: QueryOptions): Promise<ExceptionEntry[]> {\n let query = (this.db as any)\n .selectFrom(this.exceptionsTable)\n .selectAll()\n .orderBy('timestamp', 'desc');\n\n query = this.applyQueryOptions(query, options);\n\n const rows = await query.execute();\n return rows.map((row: TelescopeExceptionTable) => this.rowToException(row));\n }\n\n async getException(id: string): Promise<ExceptionEntry | null> {\n const row = await (this.db as any)\n .selectFrom(this.exceptionsTable)\n .selectAll()\n .where('id', '=', id)\n .executeTakeFirst();\n\n return row ? this.rowToException(row) : null;\n }\n\n // ============================================\n // Logs\n // ============================================\n\n async saveLog(entry: LogEntry): Promise<void> {\n const row = this.logToRow(entry);\n await (this.db as any).insertInto(this.logsTable).values(row).execute();\n }\n\n async saveLogs(entries: LogEntry[]): Promise<void> {\n if (entries.length === 0) return;\n\n const rows = entries.map((e) => this.logToRow(e));\n await (this.db as any).insertInto(this.logsTable).values(rows).execute();\n }\n\n async getLogs(options?: QueryOptions): Promise<LogEntry[]> {\n let query = (this.db as any)\n .selectFrom(this.logsTable)\n .selectAll()\n .orderBy('timestamp', 'desc');\n\n query = this.applyQueryOptions(query, options);\n\n const rows = await query.execute();\n return rows.map((row: TelescopeLogTable) => this.rowToLog(row));\n }\n\n // ============================================\n // Cleanup\n // ============================================\n\n async prune(olderThan: Date): Promise<number> {\n const results = await Promise.all([\n (this.db as any)\n .deleteFrom(this.requestsTable)\n .where('timestamp', '<', olderThan)\n .executeTakeFirst(),\n (this.db as any)\n .deleteFrom(this.exceptionsTable)\n .where('timestamp', '<', olderThan)\n .executeTakeFirst(),\n (this.db as any)\n .deleteFrom(this.logsTable)\n .where('timestamp', '<', olderThan)\n .executeTakeFirst(),\n ]);\n\n return results.reduce(\n (sum, result) => sum + Number(result.numDeletedRows ?? 0),\n 0,\n );\n }\n\n // ============================================\n // Stats\n // ============================================\n\n async getStats(): Promise<TelescopeStats> {\n const [requestsResult, exceptionsResult, logsResult] = await Promise.all([\n (this.db as any)\n .selectFrom(this.requestsTable)\n .select((eb: any) => [\n eb.fn.count('id').as('count'),\n eb.fn.min('timestamp').as('oldest'),\n eb.fn.max('timestamp').as('newest'),\n ])\n .executeTakeFirst(),\n (this.db as any)\n .selectFrom(this.exceptionsTable)\n .select((eb: any) => [\n eb.fn.count('id').as('count'),\n eb.fn.min('timestamp').as('oldest'),\n eb.fn.max('timestamp').as('newest'),\n ])\n .executeTakeFirst(),\n (this.db as any)\n .selectFrom(this.logsTable)\n .select((eb: any) => [\n eb.fn.count('id').as('count'),\n eb.fn.min('timestamp').as('oldest'),\n eb.fn.max('timestamp').as('newest'),\n ])\n .executeTakeFirst(),\n ]);\n\n const allDates = [\n requestsResult?.oldest,\n requestsResult?.newest,\n exceptionsResult?.oldest,\n exceptionsResult?.newest,\n logsResult?.oldest,\n logsResult?.newest,\n ]\n .filter((d): d is Date => d != null)\n .sort((a, b) => new Date(a).getTime() - new Date(b).getTime());\n\n return {\n requests: Number(requestsResult?.count ?? 0),\n exceptions: Number(exceptionsResult?.count ?? 0),\n logs: Number(logsResult?.count ?? 0),\n oldestEntry: allDates[0] ? new Date(allDates[0]) : undefined,\n newestEntry: allDates.length > 0\n ? new Date(allDates[allDates.length - 1])\n : undefined,\n };\n }\n\n // ============================================\n // Private Helpers\n // ============================================\n\n private applyQueryOptions(query: any, options?: QueryOptions): any {\n if (!options) {\n return query.limit(50);\n }\n\n if (options.after) {\n query = query.where('timestamp', '>=', options.after);\n }\n\n if (options.before) {\n query = query.where('timestamp', '<=', options.before);\n }\n\n if (options.search) {\n // Search in relevant text fields - using ILIKE for case-insensitive\n // This is a simple implementation; for production you'd want full-text search\n query = query.where((eb: any) =>\n eb.or([\n eb('message', 'ilike', `%${options.search}%`),\n eb('path', 'ilike', `%${options.search}%`),\n eb('url', 'ilike', `%${options.search}%`),\n ]),\n );\n }\n\n // Tags filter would require array contains operation\n // which is database-specific (PostgreSQL: @>, etc.)\n\n const limit = options.limit ?? 50;\n const offset = options.offset ?? 0;\n\n return query.limit(limit).offset(offset);\n }\n\n private requestToRow(entry: RequestEntry): TelescopeRequestTable {\n return {\n id: entry.id,\n method: entry.method,\n path: entry.path,\n url: entry.url,\n headers: entry.headers,\n body: entry.body ?? null,\n query: entry.query ?? null,\n status: entry.status,\n response_headers: entry.responseHeaders,\n response_body: entry.responseBody ?? null,\n duration: entry.duration,\n timestamp: entry.timestamp,\n ip: entry.ip ?? null,\n user_id: entry.userId ?? null,\n tags: entry.tags ?? null,\n };\n }\n\n private rowToRequest(row: TelescopeRequestTable): RequestEntry {\n return {\n id: row.id,\n method: row.method,\n path: row.path,\n url: row.url,\n headers: this.parseJson(row.headers) as Record<string, string>,\n body: row.body ? this.parseJson(row.body) : undefined,\n query: row.query\n ? (this.parseJson(row.query) as Record<string, string>)\n : undefined,\n status: row.status,\n responseHeaders: this.parseJson(row.response_headers) as Record<\n string,\n string\n >,\n responseBody: row.response_body\n ? this.parseJson(row.response_body)\n : undefined,\n duration: row.duration,\n timestamp: new Date(row.timestamp),\n ip: row.ip ?? undefined,\n userId: row.user_id ?? undefined,\n tags: row.tags ? (this.parseJson(row.tags) as string[]) : undefined,\n };\n }\n\n private exceptionToRow(entry: ExceptionEntry): TelescopeExceptionTable {\n return {\n id: entry.id,\n name: entry.name,\n message: entry.message,\n stack: entry.stack,\n source: entry.source ?? null,\n request_id: entry.requestId ?? null,\n timestamp: entry.timestamp,\n handled: entry.handled,\n tags: entry.tags ?? null,\n };\n }\n\n private rowToException(row: TelescopeExceptionTable): ExceptionEntry {\n return {\n id: row.id,\n name: row.name,\n message: row.message,\n stack: this.parseJson(row.stack) as ExceptionEntry['stack'],\n source: row.source\n ? (this.parseJson(row.source) as ExceptionEntry['source'])\n : undefined,\n requestId: row.request_id ?? undefined,\n timestamp: new Date(row.timestamp),\n handled: row.handled,\n tags: row.tags ? (this.parseJson(row.tags) as string[]) : undefined,\n };\n }\n\n private logToRow(entry: LogEntry): TelescopeLogTable {\n return {\n id: entry.id,\n level: entry.level,\n message: entry.message,\n context: entry.context ?? null,\n request_id: entry.requestId ?? null,\n timestamp: entry.timestamp,\n };\n }\n\n private rowToLog(row: TelescopeLogTable): LogEntry {\n return {\n id: row.id,\n level: row.level as LogEntry['level'],\n message: row.message,\n context: row.context\n ? (this.parseJson(row.context) as Record<string, unknown>)\n : undefined,\n requestId: row.request_id ?? undefined,\n timestamp: new Date(row.timestamp),\n };\n }\n\n /**\n * Parse a JSON value that may already be parsed (e.g., from jsonb columns).\n */\n private parseJson(value: unknown): unknown {\n if (typeof value === 'object' && value !== null) {\n return value;\n }\n if (typeof value === 'string') {\n try {\n return JSON.parse(value);\n } catch {\n return value;\n }\n }\n return value;\n }\n}\n\n/**\n * SQL migration to create telescope tables.\n * Use this to set up the required tables in your database.\n *\n * @example\n * ```typescript\n * import { getTelescopeMigration } from '@geekmidas/telescope/storage/kysely';\n *\n * // In your migration file\n * export async function up(db: Kysely<any>): Promise<void> {\n * const migration = getTelescopeMigration();\n * await db.schema.executeRaw(migration.up).execute();\n * }\n *\n * export async function down(db: Kysely<any>): Promise<void> {\n * const migration = getTelescopeMigration();\n * await db.schema.executeRaw(migration.down).execute();\n * }\n * ```\n */\nexport function getTelescopeMigration(tablePrefix = 'telescope'): {\n up: string;\n down: string;\n} {\n return {\n up: `\n-- Telescope requests table\nCREATE TABLE IF NOT EXISTS ${tablePrefix}_requests (\n id VARCHAR(21) PRIMARY KEY,\n method VARCHAR(10) NOT NULL,\n path TEXT NOT NULL,\n url TEXT NOT NULL,\n headers JSONB NOT NULL,\n body JSONB,\n query JSONB,\n status INTEGER NOT NULL,\n response_headers JSONB NOT NULL,\n response_body JSONB,\n duration DOUBLE PRECISION NOT NULL,\n timestamp TIMESTAMPTZ NOT NULL,\n ip VARCHAR(45),\n user_id VARCHAR(255),\n tags JSONB\n);\n\nCREATE INDEX IF NOT EXISTS idx_${tablePrefix}_requests_timestamp\n ON ${tablePrefix}_requests (timestamp DESC);\nCREATE INDEX IF NOT EXISTS idx_${tablePrefix}_requests_path\n ON ${tablePrefix}_requests (path);\nCREATE INDEX IF NOT EXISTS idx_${tablePrefix}_requests_status\n ON ${tablePrefix}_requests (status);\n\n-- Telescope exceptions table\nCREATE TABLE IF NOT EXISTS ${tablePrefix}_exceptions (\n id VARCHAR(21) PRIMARY KEY,\n name VARCHAR(255) NOT NULL,\n message TEXT NOT NULL,\n stack JSONB NOT NULL,\n source JSONB,\n request_id VARCHAR(21),\n timestamp TIMESTAMPTZ NOT NULL,\n handled BOOLEAN NOT NULL DEFAULT FALSE,\n tags JSONB\n);\n\nCREATE INDEX IF NOT EXISTS idx_${tablePrefix}_exceptions_timestamp\n ON ${tablePrefix}_exceptions (timestamp DESC);\nCREATE INDEX IF NOT EXISTS idx_${tablePrefix}_exceptions_request_id\n ON ${tablePrefix}_exceptions (request_id);\n\n-- Telescope logs table\nCREATE TABLE IF NOT EXISTS ${tablePrefix}_logs (\n id VARCHAR(21) PRIMARY KEY,\n level VARCHAR(10) NOT NULL,\n message TEXT NOT NULL,\n context JSONB,\n request_id VARCHAR(21),\n timestamp TIMESTAMPTZ NOT NULL\n);\n\nCREATE INDEX IF NOT EXISTS idx_${tablePrefix}_logs_timestamp\n ON ${tablePrefix}_logs (timestamp DESC);\nCREATE INDEX IF NOT EXISTS idx_${tablePrefix}_logs_level\n ON ${tablePrefix}_logs (level);\nCREATE INDEX IF NOT EXISTS idx_${tablePrefix}_logs_request_id\n ON ${tablePrefix}_logs (request_id);\n`,\n down: `\nDROP TABLE IF EXISTS ${tablePrefix}_logs;\nDROP TABLE IF EXISTS ${tablePrefix}_exceptions;\nDROP TABLE IF EXISTS ${tablePrefix}_requests;\n`,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAiHA,IAAa,gBAAb,MAA2D;CACzD,AAAiB;CACjB,AAAiB;CACjB,AAAiB;CACjB,AAAiB;CAEjB,YAAYA,QAAiC;AAC3C,OAAK,KAAK,OAAO;EACjB,MAAM,SAAS,OAAO,eAAe;AACrC,OAAK,iBAAiB,EAAE,OAAO;AAC/B,OAAK,mBAAmB,EAAE,OAAO;AACjC,OAAK,aAAa,EAAE,OAAO;CAC5B;CAMD,MAAM,YAAYC,OAAoC;EACpD,MAAM,MAAM,KAAK,aAAa,MAAM;AACpC,QAAM,AAAC,KAAK,GACT,WAAW,KAAK,cAAc,CAC9B,OAAO,IAAI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AAQ,UAAUI,OAAyB;AACzC,aAAW,UAAU,YAAY,UAAU,KACzC,QAAO;AAET,aAAW,UAAU,SACnB,KAAI;AACF,UAAO,KAAK,MAAM,MAAM;EACzB,QAAO;AACN,UAAO;EACR;AAEH,SAAO;CACR;AACF;;;;;;;;;;;;;;;;;;;;;AAsBD,SAAgB,sBAAsB,cAAc,aAGlD;AACA,QAAO;EACL,KAAK;;6BAEoB,YAAY;;;;;;;;;;;;;;;;;;iCAkBR,YAAY;OACtC,YAAY;iCACc,YAAY;OACtC,YAAY;iCACc,YAAY;OACtC,YAAY;;;6BAGU,YAAY;;;;;;;;;;;;iCAYR,YAAY;OACtC,YAAY;iCACc,YAAY;OACtC,YAAY;;;6BAGU,YAAY;;;;;;;;;iCASR,YAAY;OACtC,YAAY;iCACc,YAAY;OACtC,YAAY;iCACc,YAAY;OACtC,YAAY;;EAEf,OAAO;uBACY,YAAY;uBACZ,YAAY;uBACZ,YAAY;;CAEhC;AACF"}
@@ -0,0 +1,3 @@
1
+ const require_memory = require('../memory-9-B9WACq.cjs');
2
+
3
+ exports.InMemoryStorage = require_memory.InMemoryStorage;
@@ -0,0 +1,3 @@
1
+ import "../types-BGDhFv4R.cjs";
2
+ import { InMemoryStorage, InMemoryStorageOptions } from "../memory-DiP1a-pp.cjs";
3
+ export { InMemoryStorage, InMemoryStorageOptions };
@@ -0,0 +1,3 @@
1
+ import "../types-CZbzz8kx.mjs";
2
+ import { InMemoryStorage, InMemoryStorageOptions } from "../memory-Cm0eevCS.mjs";
3
+ export { InMemoryStorage, InMemoryStorageOptions };
@@ -0,0 +1,3 @@
1
+ import { InMemoryStorage } from "../memory-SdN5vtG9.mjs";
2
+
3
+ export { InMemoryStorage };
@@ -0,0 +1,170 @@
1
+ //#region src/types.d.ts
2
+ /**
3
+ * Stack frame from a parsed error stack trace
4
+ */
5
+ interface StackFrame {
6
+ file: string;
7
+ line: number;
8
+ column: number;
9
+ function: string;
10
+ /** Whether this frame is from application code (vs node_modules) */
11
+ isApp: boolean;
12
+ }
13
+ /**
14
+ * Source code context around an error
15
+ */
16
+ interface SourceContext {
17
+ file: string;
18
+ line: number;
19
+ column: number;
20
+ lines: Array<{
21
+ num: number;
22
+ code: string;
23
+ highlight: boolean;
24
+ }>;
25
+ }
26
+ /**
27
+ * Recorded HTTP request entry
28
+ */
29
+ interface RequestEntry {
30
+ id: string;
31
+ method: string;
32
+ path: string;
33
+ url: string;
34
+ headers: Record<string, string>;
35
+ body?: unknown;
36
+ query?: Record<string, string>;
37
+ status: number;
38
+ responseHeaders: Record<string, string>;
39
+ responseBody?: unknown;
40
+ duration: number;
41
+ timestamp: Date;
42
+ ip?: string;
43
+ userId?: string;
44
+ tags?: string[];
45
+ }
46
+ /**
47
+ * Recorded exception entry
48
+ */
49
+ interface ExceptionEntry {
50
+ id: string;
51
+ name: string;
52
+ message: string;
53
+ stack: StackFrame[];
54
+ source?: SourceContext;
55
+ requestId?: string;
56
+ timestamp: Date;
57
+ handled: boolean;
58
+ tags?: string[];
59
+ }
60
+ /**
61
+ * Recorded log entry
62
+ */
63
+ interface LogEntry {
64
+ id: string;
65
+ level: 'debug' | 'info' | 'warn' | 'error';
66
+ message: string;
67
+ context?: Record<string, unknown>;
68
+ requestId?: string;
69
+ timestamp: Date;
70
+ }
71
+ /**
72
+ * Query options for retrieving entries
73
+ */
74
+ interface QueryOptions {
75
+ limit?: number;
76
+ offset?: number;
77
+ before?: Date;
78
+ after?: Date;
79
+ search?: string;
80
+ tags?: string[];
81
+ }
82
+ /**
83
+ * Storage interface for Telescope data
84
+ * Implementations can use memory, database, or any other backend
85
+ */
86
+ interface TelescopeStorage {
87
+ saveRequest(entry: RequestEntry): Promise<void>;
88
+ saveRequests?(entries: RequestEntry[]): Promise<void>;
89
+ getRequests(options?: QueryOptions): Promise<RequestEntry[]>;
90
+ getRequest(id: string): Promise<RequestEntry | null>;
91
+ saveException(entry: ExceptionEntry): Promise<void>;
92
+ saveExceptions?(entries: ExceptionEntry[]): Promise<void>;
93
+ getExceptions(options?: QueryOptions): Promise<ExceptionEntry[]>;
94
+ getException(id: string): Promise<ExceptionEntry | null>;
95
+ saveLog(entry: LogEntry): Promise<void>;
96
+ saveLogs?(entries: LogEntry[]): Promise<void>;
97
+ getLogs(options?: QueryOptions): Promise<LogEntry[]>;
98
+ prune(olderThan: Date): Promise<number>;
99
+ getStats(): Promise<TelescopeStats>;
100
+ }
101
+ /**
102
+ * Statistics about stored entries
103
+ */
104
+ interface TelescopeStats {
105
+ requests: number;
106
+ exceptions: number;
107
+ logs: number;
108
+ oldestEntry?: Date;
109
+ newestEntry?: Date;
110
+ }
111
+ /**
112
+ * Configuration options for Telescope
113
+ */
114
+ interface TelescopeOptions {
115
+ /** Storage backend for persisting data */
116
+ storage: TelescopeStorage;
117
+ /** Whether telescope is enabled (default: true) */
118
+ enabled?: boolean;
119
+ /** Dashboard path (default: '/__telescope') */
120
+ path?: string;
121
+ /** Whether to record request/response bodies (default: true) */
122
+ recordBody?: boolean;
123
+ /** Maximum body size to record in bytes (default: 64KB) */
124
+ maxBodySize?: number;
125
+ /** URL patterns to ignore (default: []) */
126
+ ignorePatterns?: string[];
127
+ /** Auto-prune entries older than this many hours (default: undefined - no auto-prune) */
128
+ pruneAfterHours?: number;
129
+ }
130
+ /**
131
+ * Normalized telescope options with defaults applied
132
+ */
133
+ interface NormalizedTelescopeOptions {
134
+ storage: TelescopeStorage;
135
+ enabled: boolean;
136
+ path: string;
137
+ recordBody: boolean;
138
+ maxBodySize: number;
139
+ ignorePatterns: string[];
140
+ pruneAfterHours?: number;
141
+ }
142
+ /**
143
+ * WebSocket event types
144
+ */
145
+ type TelescopeEventType = 'request' | 'exception' | 'log' | 'stats' | 'connected';
146
+ /**
147
+ * WebSocket event payload
148
+ */
149
+ interface TelescopeEvent<T = unknown> {
150
+ type: TelescopeEventType;
151
+ payload: T;
152
+ timestamp: number;
153
+ }
154
+ /**
155
+ * Context stored during request processing
156
+ */
157
+ interface RequestContext {
158
+ id: string;
159
+ startTime: number;
160
+ method: string;
161
+ path: string;
162
+ url: string;
163
+ headers: Record<string, string>;
164
+ query: Record<string, string>;
165
+ body?: unknown;
166
+ ip?: string;
167
+ }
168
+ //#endregion
169
+ export { ExceptionEntry, LogEntry, NormalizedTelescopeOptions, QueryOptions, RequestContext, RequestEntry, SourceContext, StackFrame, TelescopeEvent, TelescopeEventType, TelescopeOptions, TelescopeStats, TelescopeStorage };
170
+ //# sourceMappingURL=types-BGDhFv4R.d.cts.map
@@ -0,0 +1,170 @@
1
+ //#region src/types.d.ts
2
+ /**
3
+ * Stack frame from a parsed error stack trace
4
+ */
5
+ interface StackFrame {
6
+ file: string;
7
+ line: number;
8
+ column: number;
9
+ function: string;
10
+ /** Whether this frame is from application code (vs node_modules) */
11
+ isApp: boolean;
12
+ }
13
+ /**
14
+ * Source code context around an error
15
+ */
16
+ interface SourceContext {
17
+ file: string;
18
+ line: number;
19
+ column: number;
20
+ lines: Array<{
21
+ num: number;
22
+ code: string;
23
+ highlight: boolean;
24
+ }>;
25
+ }
26
+ /**
27
+ * Recorded HTTP request entry
28
+ */
29
+ interface RequestEntry {
30
+ id: string;
31
+ method: string;
32
+ path: string;
33
+ url: string;
34
+ headers: Record<string, string>;
35
+ body?: unknown;
36
+ query?: Record<string, string>;
37
+ status: number;
38
+ responseHeaders: Record<string, string>;
39
+ responseBody?: unknown;
40
+ duration: number;
41
+ timestamp: Date;
42
+ ip?: string;
43
+ userId?: string;
44
+ tags?: string[];
45
+ }
46
+ /**
47
+ * Recorded exception entry
48
+ */
49
+ interface ExceptionEntry {
50
+ id: string;
51
+ name: string;
52
+ message: string;
53
+ stack: StackFrame[];
54
+ source?: SourceContext;
55
+ requestId?: string;
56
+ timestamp: Date;
57
+ handled: boolean;
58
+ tags?: string[];
59
+ }
60
+ /**
61
+ * Recorded log entry
62
+ */
63
+ interface LogEntry {
64
+ id: string;
65
+ level: 'debug' | 'info' | 'warn' | 'error';
66
+ message: string;
67
+ context?: Record<string, unknown>;
68
+ requestId?: string;
69
+ timestamp: Date;
70
+ }
71
+ /**
72
+ * Query options for retrieving entries
73
+ */
74
+ interface QueryOptions {
75
+ limit?: number;
76
+ offset?: number;
77
+ before?: Date;
78
+ after?: Date;
79
+ search?: string;
80
+ tags?: string[];
81
+ }
82
+ /**
83
+ * Storage interface for Telescope data
84
+ * Implementations can use memory, database, or any other backend
85
+ */
86
+ interface TelescopeStorage {
87
+ saveRequest(entry: RequestEntry): Promise<void>;
88
+ saveRequests?(entries: RequestEntry[]): Promise<void>;
89
+ getRequests(options?: QueryOptions): Promise<RequestEntry[]>;
90
+ getRequest(id: string): Promise<RequestEntry | null>;
91
+ saveException(entry: ExceptionEntry): Promise<void>;
92
+ saveExceptions?(entries: ExceptionEntry[]): Promise<void>;
93
+ getExceptions(options?: QueryOptions): Promise<ExceptionEntry[]>;
94
+ getException(id: string): Promise<ExceptionEntry | null>;
95
+ saveLog(entry: LogEntry): Promise<void>;
96
+ saveLogs?(entries: LogEntry[]): Promise<void>;
97
+ getLogs(options?: QueryOptions): Promise<LogEntry[]>;
98
+ prune(olderThan: Date): Promise<number>;
99
+ getStats(): Promise<TelescopeStats>;
100
+ }
101
+ /**
102
+ * Statistics about stored entries
103
+ */
104
+ interface TelescopeStats {
105
+ requests: number;
106
+ exceptions: number;
107
+ logs: number;
108
+ oldestEntry?: Date;
109
+ newestEntry?: Date;
110
+ }
111
+ /**
112
+ * Configuration options for Telescope
113
+ */
114
+ interface TelescopeOptions {
115
+ /** Storage backend for persisting data */
116
+ storage: TelescopeStorage;
117
+ /** Whether telescope is enabled (default: true) */
118
+ enabled?: boolean;
119
+ /** Dashboard path (default: '/__telescope') */
120
+ path?: string;
121
+ /** Whether to record request/response bodies (default: true) */
122
+ recordBody?: boolean;
123
+ /** Maximum body size to record in bytes (default: 64KB) */
124
+ maxBodySize?: number;
125
+ /** URL patterns to ignore (default: []) */
126
+ ignorePatterns?: string[];
127
+ /** Auto-prune entries older than this many hours (default: undefined - no auto-prune) */
128
+ pruneAfterHours?: number;
129
+ }
130
+ /**
131
+ * Normalized telescope options with defaults applied
132
+ */
133
+ interface NormalizedTelescopeOptions {
134
+ storage: TelescopeStorage;
135
+ enabled: boolean;
136
+ path: string;
137
+ recordBody: boolean;
138
+ maxBodySize: number;
139
+ ignorePatterns: string[];
140
+ pruneAfterHours?: number;
141
+ }
142
+ /**
143
+ * WebSocket event types
144
+ */
145
+ type TelescopeEventType = 'request' | 'exception' | 'log' | 'stats' | 'connected';
146
+ /**
147
+ * WebSocket event payload
148
+ */
149
+ interface TelescopeEvent<T = unknown> {
150
+ type: TelescopeEventType;
151
+ payload: T;
152
+ timestamp: number;
153
+ }
154
+ /**
155
+ * Context stored during request processing
156
+ */
157
+ interface RequestContext {
158
+ id: string;
159
+ startTime: number;
160
+ method: string;
161
+ path: string;
162
+ url: string;
163
+ headers: Record<string, string>;
164
+ query: Record<string, string>;
165
+ body?: unknown;
166
+ ip?: string;
167
+ }
168
+ //#endregion
169
+ export { ExceptionEntry, LogEntry, NormalizedTelescopeOptions, QueryOptions, RequestContext, RequestEntry, SourceContext, StackFrame, TelescopeEvent, TelescopeEventType, TelescopeOptions, TelescopeStats, TelescopeStorage };
170
+ //# sourceMappingURL=types-CZbzz8kx.d.mts.map
package/dist/types.cjs ADDED
File without changes
@@ -0,0 +1,2 @@
1
+ import { ExceptionEntry, LogEntry, NormalizedTelescopeOptions, QueryOptions, RequestContext, RequestEntry, SourceContext, StackFrame, TelescopeEvent, TelescopeEventType, TelescopeOptions, TelescopeStats, TelescopeStorage } from "./types-BGDhFv4R.cjs";
2
+ export { ExceptionEntry, LogEntry, NormalizedTelescopeOptions, QueryOptions, RequestContext, RequestEntry, SourceContext, StackFrame, TelescopeEvent, TelescopeEventType, TelescopeOptions, TelescopeStats, TelescopeStorage };
@@ -0,0 +1,2 @@
1
+ import { ExceptionEntry, LogEntry, NormalizedTelescopeOptions, QueryOptions, RequestContext, RequestEntry, SourceContext, StackFrame, TelescopeEvent, TelescopeEventType, TelescopeOptions, TelescopeStats, TelescopeStorage } from "./types-CZbzz8kx.mjs";
2
+ export { ExceptionEntry, LogEntry, NormalizedTelescopeOptions, QueryOptions, RequestContext, RequestEntry, SourceContext, StackFrame, TelescopeEvent, TelescopeEventType, TelescopeOptions, TelescopeStats, TelescopeStorage };
package/dist/types.mjs ADDED
File without changes