@adonis-agora/telescope 0.8.2 → 0.8.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # @adonis-agora/telescope
2
2
 
3
+ ## 0.8.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#28](https://github.com/DavideCarvalho/adonis-agora-telescope/pull/28) [`4b6e205`](https://github.com/DavideCarvalho/adonis-agora-telescope/commit/4b6e205c87367b48c9817ca1c8e8e2b5258d51c8) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Make the commented-out examples in the published config stubs actually compile.
8
+
9
+ Every `config/telescope_*.ts` stub documents its options as a commented block you uncomment. Three
10
+ of those blocks did not type-check the moment you did:
11
+
12
+ - `config/telescope_ui.ts`, `config/telescope_mcp.ts` and `config/telescope_alerts.ts` used
13
+ `env.get(...)` in their examples without importing `env` — uncommenting one gave
14
+ `Cannot find name 'env'`. Each now carries a commented `import env from '#start/env'` next to the
15
+ examples that need it.
16
+ - The `authorize` example read `ctx.auth?.user?.isAdmin`, but the hook's declared parameter is the
17
+ framework-light `{ request, response }` slice, so `auth` is not on the type (the provider does
18
+ pass your real `HttpContext` through at runtime). The example now narrows `ctx` explicitly, which
19
+ is both correct and honest about why the cast is there.
20
+ - The `geoLookup` example did `const body = await res.json()`, which is `unknown` — every
21
+ `body.city` read was an error. It is now typed at the boundary.
22
+
23
+ The same four fixes are applied to the docs, which carried the identical examples.
24
+
25
+ A new test compiles every published stub inside a scratch consumer app — with the package resolved
26
+ by name, so against the shipped `dist/**/*.d.ts` — and compiles a second copy of each config stub
27
+ with every commented example switched on. Across the seven config stubs there are 28 lines of live
28
+ code and 101 commented ones, so without that second pass the gate would have been watching under a
29
+ quarter of what these files document.
30
+
31
+ `copy:stubs` also now copies the stubs directory wholesale instead of naming each of the eight files
32
+ in a chained `cp`, so an added stub can no longer be published as a missing file.
33
+
3
34
  ## 0.8.2
4
35
 
5
36
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  /** Keep in sync with this package's `version` in package.json. */
2
- export declare const VERSION = "0.8.2";
2
+ export declare const VERSION = "0.8.3";
3
3
  export { TelescopeAiDiagnoser } from './telescope_ai_diagnoser.js';
4
4
  export type { AnthropicMessagesClient, DiagnoseOptions, TelescopeAiDiagnoserOptions, } from './telescope_ai_diagnoser.js';
5
5
  export { normalizeConfidence, parseDiagnosis } from './diagnoser.js';
@@ -1,5 +1,5 @@
1
1
  /** Keep in sync with this package's `version` in package.json. */
2
- export const VERSION = '0.8.2';
2
+ export const VERSION = '0.8.3';
3
3
  // — diagnoser —
4
4
  export { TelescopeAiDiagnoser } from './telescope_ai_diagnoser.js';
5
5
  // — diagnosis model + parsing —
@@ -1,5 +1,5 @@
1
1
  /** Keep in sync with this package's `version` in package.json. */
2
- export declare const VERSION = "0.8.2";
2
+ export declare const VERSION = "0.8.3";
3
3
  export { consoleChannel, customChannel, slackChannel, webhookChannel, } from './alert_channel.js';
4
4
  export type { AlertChannel, ChannelFetch, ConsoleSink } from './alert_channel.js';
5
5
  export { formatSlackMessage } from './slack_format.js';
@@ -1,5 +1,5 @@
1
1
  /** Keep in sync with this package's `version` in package.json. */
2
- export const VERSION = '0.8.2';
2
+ export const VERSION = '0.8.3';
3
3
  // — channels —
4
4
  export { consoleChannel, customChannel, slackChannel, webhookChannel, } from './alert_channel.js';
5
5
  // — slack formatting —
@@ -1,5 +1,5 @@
1
1
  /** Keep in sync with this package's `version` in package.json. */
2
- export declare const VERSION = "0.8.2";
2
+ export declare const VERSION = "0.8.3";
3
3
  export { EntryType, isBatchOrigin } from './entry.js';
4
4
  export type { BatchOrigin, BuiltinEntryType, Entry, RecordInput } from './entry.js';
5
5
  export type { EntryQuery, TelescopeStore } from './store.js';
package/dist/src/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /** Keep in sync with this package's `version` in package.json. */
2
- export const VERSION = '0.8.2';
2
+ export const VERSION = '0.8.3';
3
3
  // — entry model —
4
4
  export { EntryType, isBatchOrigin } from './entry.js';
5
5
  export { InMemoryTelescopeStore } from './stores/memory.js';
@@ -1,5 +1,5 @@
1
1
  /** Keep in sync with this package's `version` in package.json. */
2
- export declare const VERSION = "0.8.2";
2
+ export declare const VERSION = "0.8.3";
3
3
  export { defineConfig, resolveConfig, MCP_TOOL_NAMES } from './define_config.js';
4
4
  export type { McpToolName, ResolvedTelescopeMcpConfig, TelescopeMcpConfig, } from './define_config.js';
5
5
  export { MCP_INTERNAL_ERROR, MCP_METHOD_NOT_FOUND, MCP_TOOLS, MCP_UNAUTHORIZED, TelescopeMcpServer, } from './server.js';
@@ -1,5 +1,5 @@
1
1
  /** Keep in sync with this package's `version` in package.json. */
2
- export const VERSION = '0.8.2';
2
+ export const VERSION = '0.8.3';
3
3
  // — config —
4
4
  export { defineConfig, resolveConfig, MCP_TOOL_NAMES } from './define_config.js';
5
5
  // — server (plain, testable JSON-RPC surface) —
@@ -1,5 +1,5 @@
1
1
  /** Keep in sync with this package's `version` in package.json. */
2
- export declare const VERSION = "0.8.2";
2
+ export declare const VERSION = "0.8.3";
3
3
  export { defineConfig, resolveConfig } from './define_config.js';
4
4
  export type { ResolvedTelescopeCpuProfilingConfig, TelescopeCpuProfilingConfig, } from './define_config.js';
5
5
  export { CPU_PROFILE_ENTRY_TYPE, ProfilerService, } from './profiler_service.js';
@@ -1,5 +1,5 @@
1
1
  /** Keep in sync with this package's `version` in package.json. */
2
- export const VERSION = '0.8.2';
2
+ export const VERSION = '0.8.3';
3
3
  export { defineConfig, resolveConfig } from './define_config.js';
4
4
  export { CPU_PROFILE_ENTRY_TYPE, ProfilerService, } from './profiler_service.js';
5
5
  export { CpuProfiler, defaultSessionFactory } from './cpu-profiler.js';
@@ -1,5 +1,5 @@
1
1
  /** Keep in sync with this package's `version` in package.json. */
2
- export declare const VERSION = "0.8.2";
2
+ export declare const VERSION = "0.8.3";
3
3
  export { defineConfig, resolveConfig, normalizePath, defaultAuthorize } from './define_config.js';
4
4
  export type { AuthorizeHook, ReplayConfig, ResolvedTelescopeUiConfig, TelescopeUiConfig, UiCredentials, } from './define_config.js';
5
5
  export { resolveDashboardAuth, performLogin, readSession, sanitizeReturnTo, decideDashboardAuth, SESSION_COOKIE_NAME, } from './auth.js';
@@ -1,5 +1,5 @@
1
1
  /** Keep in sync with this package's `version` in package.json. */
2
- export const VERSION = '0.8.2';
2
+ export const VERSION = '0.8.3';
3
3
  // — config —
4
4
  export { defineConfig, resolveConfig, normalizePath, defaultAuthorize } from './define_config.js';
5
5
  // — built-in `dashboardAuth` login screen (optional; opt-in via `config/telescope_ui.ts`) —
@@ -1,5 +1,5 @@
1
1
  /** Keep in sync with this package's `version` in package.json. */
2
- export declare const VERSION = "0.8.2";
2
+ export declare const VERSION = "0.8.3";
3
3
  export type { EmitterLike, Watcher } from './emitter.js';
4
4
  export { resolveStore, safeRecord } from './record.js';
5
5
  export { buildQueryEntry, DB_QUERY_EVENT, LucidQueryWatcher } from './lucid_query_watcher.js';
@@ -1,5 +1,5 @@
1
1
  /** Keep in sync with this package's `version` in package.json. */
2
- export const VERSION = '0.8.2';
2
+ export const VERSION = '0.8.3';
3
3
  // — runtime recording (advanced) —
4
4
  export { resolveStore, safeRecord } from './record.js';
5
5
  // — Lucid query watcher (the headline watcher) —
@@ -1,6 +1,8 @@
1
1
  {{{
2
2
  exports({ to: app.configPath('telescope_alerts.ts') })
3
3
  }}}
4
+ /** Uncomment alongside any example below that reads env.get(...). */
5
+ // import env from '#start/env'
4
6
  import { defineConfig } from '@adonis-agora/telescope/alerts'
5
7
 
6
8
  /**
@@ -72,7 +74,7 @@ export default defineConfig({
72
74
  */
73
75
  // geoLookup: async (ip) => {
74
76
  // const res = await fetch('https://ipapi.example/' + ip)
75
- // const body = await res.json()
77
+ // const body = (await res.json()) as { city?: string; region?: string; country?: string; country_code?: string }
76
78
  // return { city: body.city, country: body.country, countryCode: body.country_code }
77
79
  // },
78
80
  })
@@ -1,6 +1,8 @@
1
1
  {{{
2
2
  exports({ to: app.configPath('telescope_mcp.ts') })
3
3
  }}}
4
+ /** Uncomment alongside any example below that reads env.get(...). */
5
+ // import env from '#start/env'
4
6
  import { defineConfig } from '@adonis-agora/telescope/mcp'
5
7
 
6
8
  /**
@@ -28,7 +30,12 @@ export default defineConfig({
28
30
  * Access-decision hook (identical to the UI/metrics guard). Return true to allow
29
31
  * the request. Delegate to your own app auth here, e.g.:
30
32
  */
31
- // authorize: (ctx) => ctx.auth?.user?.isAdmin === true,
33
+ // authorize: async (ctx) => {
34
+ // // The provider passes your real HttpContext through at runtime; the declared
35
+ // // parameter is a framework-light slice, so narrow it to reach your own auth.
36
+ // const { auth } = ctx as unknown as { auth: { user?: { isAdmin?: boolean } } }
37
+ // return auth.user?.isAdmin === true
38
+ // },
32
39
 
33
40
  /**
34
41
  * Built-in credentials for the default policy (ignored when authorize is set):
@@ -1,6 +1,8 @@
1
1
  {{{
2
2
  exports({ to: app.configPath('telescope_ui.ts') })
3
3
  }}}
4
+ /** Uncomment alongside any example below that reads env.get(...). */
5
+ // import env from '#start/env'
4
6
  import { defineConfig } from '@adonis-agora/telescope/ui'
5
7
 
6
8
  /**
@@ -25,7 +27,12 @@ export default defineConfig({
25
27
  * (the guard answers 401 when no credential was presented, 403 when one was and
26
28
  * was rejected). Delegate to your own app auth here, e.g.:
27
29
  */
28
- // authorize: (ctx) => ctx.auth?.user?.isAdmin === true,
30
+ // authorize: async (ctx) => {
31
+ // // The provider passes your real HttpContext through at runtime; the declared
32
+ // // parameter is a framework-light slice, so narrow it to reach your own auth.
33
+ // const { auth } = ctx as unknown as { auth: { user?: { isAdmin?: boolean } } }
34
+ // return auth.user?.isAdmin === true
35
+ // },
29
36
 
30
37
  /**
31
38
  * Built-in credentials for the default policy (ignored when authorize is set).
@@ -1,7 +1,7 @@
1
1
  import { fileURLToPath } from 'node:url';
2
+
2
3
  /**
3
4
  * Absolute path to the published stubs directory, resolved from this compiled
4
5
  * module's location (`dist/stubs/main.js`). Passed to `codemods.makeUsingStub`.
5
6
  */
6
7
  export const stubsRoot = fileURLToPath(new URL('./', import.meta.url));
7
- //# sourceMappingURL=main.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adonis-agora/telescope",
3
- "version": "0.8.2",
3
+ "version": "0.8.3",
4
4
  "description": "Laravel Telescope-style headless observability for AdonisJS — records HTTP requests and every Agora diagnostics event as queryable entries, plus opt-in subpaths for per-technology watchers, a web dashboard, AI exception diagnosis, and alerting.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -156,7 +156,7 @@
156
156
  ],
157
157
  "scripts": {
158
158
  "build": "tsc -p tsconfig.json && pnpm run copy:stubs && pnpm run copy:assets",
159
- "copy:stubs": "mkdir -p dist/stubs/config dist/stubs/database/migrations && cp stubs/config/telescope.stub dist/stubs/config/telescope.stub && cp stubs/config/telescope_watchers.stub dist/stubs/config/telescope_watchers.stub && cp stubs/config/telescope_ui.stub dist/stubs/config/telescope_ui.stub && cp stubs/config/telescope_ai.stub dist/stubs/config/telescope_ai.stub && cp stubs/config/telescope_alerts.stub dist/stubs/config/telescope_alerts.stub && cp stubs/config/telescope_mcp.stub dist/stubs/config/telescope_mcp.stub && cp stubs/config/telescope_cpu_profiling.stub dist/stubs/config/telescope_cpu_profiling.stub && cp stubs/database/migrations/create_telescope_entries_table.stub dist/stubs/database/migrations/create_telescope_entries_table.stub",
159
+ "copy:stubs": "rm -rf dist/stubs && mkdir -p dist/stubs && cp -R stubs/. dist/stubs/",
160
160
  "copy:assets": "mkdir -p dist/src/ui && cp src/ui/dashboard.html dist/src/ui/dashboard.html",
161
161
  "test": "vitest run --passWithNoTests",
162
162
  "test:watch": "vitest",
@@ -1,6 +0,0 @@
1
- /**
2
- * Absolute path to the published stubs directory, resolved from this compiled
3
- * module's location (`dist/stubs/main.js`). Passed to `codemods.makeUsingStub`.
4
- */
5
- export declare const stubsRoot: string;
6
- //# sourceMappingURL=main.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../stubs/main.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,SAAS,QAAgD,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../../stubs/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC"}