@adonis-agora/telescope 0.8.2 → 0.8.4

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,52 @@
1
1
  # @adonis-agora/telescope
2
2
 
3
+ ## 0.8.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix the published package missing `dist/stubs/main.js`.
8
+
9
+ `configure.ts` imports `{ stubsRoot } from './stubs/main.js'`, but the build ran
10
+ `copy:stubs` _after_ `tsc` and the script did `rm -rf dist/stubs && cp -R stubs/. dist/stubs/`
11
+ — wiping the freshly compiled `dist/stubs/main.js` and leaving only the raw
12
+ `stubs/main.ts` behind. Every published version so far has therefore failed at
13
+ `node ace configure` with `ERR_MODULE_NOT_FOUND` for `./stubs/main.js`.
14
+
15
+ `copy:stubs` now only copies the stub templates (`config/`, `database/`) into
16
+ `dist/stubs/` instead of deleting and replacing the whole directory, so the
17
+ compiled `main.js` survives and ships in the tarball.
18
+
19
+ ## 0.8.3
20
+
21
+ ### Patch Changes
22
+
23
+ - [#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.
24
+
25
+ Every `config/telescope_*.ts` stub documents its options as a commented block you uncomment. Three
26
+ of those blocks did not type-check the moment you did:
27
+
28
+ - `config/telescope_ui.ts`, `config/telescope_mcp.ts` and `config/telescope_alerts.ts` used
29
+ `env.get(...)` in their examples without importing `env` — uncommenting one gave
30
+ `Cannot find name 'env'`. Each now carries a commented `import env from '#start/env'` next to the
31
+ examples that need it.
32
+ - The `authorize` example read `ctx.auth?.user?.isAdmin`, but the hook's declared parameter is the
33
+ framework-light `{ request, response }` slice, so `auth` is not on the type (the provider does
34
+ pass your real `HttpContext` through at runtime). The example now narrows `ctx` explicitly, which
35
+ is both correct and honest about why the cast is there.
36
+ - The `geoLookup` example did `const body = await res.json()`, which is `unknown` — every
37
+ `body.city` read was an error. It is now typed at the boundary.
38
+
39
+ The same four fixes are applied to the docs, which carried the identical examples.
40
+
41
+ A new test compiles every published stub inside a scratch consumer app — with the package resolved
42
+ by name, so against the shipped `dist/**/*.d.ts` — and compiles a second copy of each config stub
43
+ with every commented example switched on. Across the seven config stubs there are 28 lines of live
44
+ code and 101 commented ones, so without that second pass the gate would have been watching under a
45
+ quarter of what these files document.
46
+
47
+ `copy:stubs` also now copies the stubs directory wholesale instead of naming each of the eight files
48
+ in a chained `cp`, so an added stub can no longer be published as a missing file.
49
+
3
50
  ## 0.8.2
4
51
 
5
52
  ### 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.4";
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.4';
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.4";
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.4';
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.4";
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.4';
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.4";
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.4';
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.4";
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.4';
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.4";
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.4';
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.4";
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.4';
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).
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.4",
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": "mkdir -p dist/stubs && cp -R stubs/config dist/stubs/ && cp -R stubs/database 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",