@allstak/angular 0.1.0 → 0.2.0
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 +25 -0
- package/esm2022/src/providers.mjs +36 -4
- package/esm2022/src/version.mjs +2 -2
- package/fesm2022/allstak-angular.mjs +37 -5
- package/fesm2022/allstak-angular.mjs.map +1 -1
- package/package.json +1 -1
- package/src/providers.d.ts +36 -1
- package/src/version.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,31 @@ All notable changes to `@allstak/angular` are documented here.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.2.0] — 2026-05-30
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- `provideAllStak(config)` now folds in router/navigation instrumentation by
|
|
13
|
+
default. A standalone app that wires only `provideAllStak(...)` automatically
|
|
14
|
+
gets a `navigation` span + breadcrumb per route change — previously these
|
|
15
|
+
fired only when `provideAllStakRouterInstrumentation()` (or
|
|
16
|
+
`AllStakModule.forRoot`) was also added. The fold-in force-instantiates the
|
|
17
|
+
`providedIn: 'root'` `TraceService` via `APP_INITIALIZER`, and is a no-op when
|
|
18
|
+
`@angular/router` is absent (the service's `Router` dependency is
|
|
19
|
+
`@Optional()`). Behavior is preserved for existing apps: adding
|
|
20
|
+
`provideAllStakRouterInstrumentation()` alongside `provideAllStak(...)` is
|
|
21
|
+
idempotent because `TraceService` is a singleton, so the subscription is wired
|
|
22
|
+
exactly once.
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
|
|
26
|
+
- `provideAllStak(config, { router: false })` — opt out of the automatic
|
|
27
|
+
navigation instrumentation fold-in. `provideAllStakRouterInstrumentation()`
|
|
28
|
+
remains exported for explicit wiring or for re-enabling navigation spans when
|
|
29
|
+
the fold-in is disabled.
|
|
30
|
+
|
|
31
|
+
[0.2.0]: https://github.com/AllStak/allstak-angular/releases/tag/v0.2.0
|
|
32
|
+
|
|
8
33
|
## [0.1.0] — 2026-05-29
|
|
9
34
|
|
|
10
35
|
Initial release of the official AllStak SDK for Angular.
|
|
@@ -17,9 +17,17 @@ import { TraceService } from './trace-service';
|
|
|
17
17
|
* to catch errors thrown *during bootstrap itself*, prefer calling `init(...)`
|
|
18
18
|
* directly in `main.ts` before `bootstrapApplication`; this provider is the
|
|
19
19
|
* convenient alternative for apps that initialise inside the DI graph.
|
|
20
|
+
*
|
|
21
|
+
* Router/navigation instrumentation is folded in by default — a
|
|
22
|
+
* `provideAllStak()`-only standalone app gets a `navigation` span + breadcrumb
|
|
23
|
+
* per route change with no extra wiring. It is a no-op when `@angular/router`
|
|
24
|
+
* is not present (the `Router` dependency is `@Optional()`). Opt out with
|
|
25
|
+
* `provideAllStak(config, { router: false })`. The standalone
|
|
26
|
+
* {@link provideAllStakRouterInstrumentation} remains exported for explicit use
|
|
27
|
+
* and is idempotent if also added alongside `provideAllStak`.
|
|
20
28
|
*/
|
|
21
|
-
export function provideAllStak(config) {
|
|
22
|
-
|
|
29
|
+
export function provideAllStak(config, options) {
|
|
30
|
+
const providers = [
|
|
23
31
|
{
|
|
24
32
|
provide: ENVIRONMENT_INITIALIZER,
|
|
25
33
|
multi: true,
|
|
@@ -27,7 +35,22 @@ export function provideAllStak(config) {
|
|
|
27
35
|
init(config);
|
|
28
36
|
},
|
|
29
37
|
},
|
|
30
|
-
]
|
|
38
|
+
];
|
|
39
|
+
if (options?.router !== false) {
|
|
40
|
+
// Fold in the router instrumentation so navigation spans are automatic.
|
|
41
|
+
// `TraceService` is `providedIn: 'root'`; force-instantiate it via an
|
|
42
|
+
// APP_INITIALIZER so its Router subscription is live before the first
|
|
43
|
+
// navigation completes. Harmless (no-op) when @angular/router is absent.
|
|
44
|
+
providers.push(TraceService, {
|
|
45
|
+
provide: APP_INITIALIZER,
|
|
46
|
+
multi: true,
|
|
47
|
+
useFactory: () => {
|
|
48
|
+
inject(TraceService);
|
|
49
|
+
return () => undefined;
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return makeEnvironmentProviders(providers);
|
|
31
54
|
}
|
|
32
55
|
/**
|
|
33
56
|
* Provide the AllStak `ErrorHandler` (overriding Angular's default) so every
|
|
@@ -50,6 +73,15 @@ export function provideAllStakErrorHandler(options) {
|
|
|
50
73
|
* service when something injects it. The `APP_INITIALIZER` below injects it
|
|
51
74
|
* during bootstrap, guaranteeing the subscription is live before the first
|
|
52
75
|
* navigation completes.
|
|
76
|
+
*
|
|
77
|
+
* As of the navigation-auto-wire change, {@link provideAllStak} already folds
|
|
78
|
+
* this in by default, so most standalone apps no longer need to add this
|
|
79
|
+
* provider explicitly. It remains exported for apps that disable the fold with
|
|
80
|
+
* `provideAllStak(config, { router: false })` but still want navigation spans,
|
|
81
|
+
* or that bootstrap `init` outside the DI graph. Adding it alongside
|
|
82
|
+
* `provideAllStak` is safe: `TraceService` is a `providedIn: 'root'` singleton,
|
|
83
|
+
* so the duplicate `inject(TraceService)` resolves to the same instance and the
|
|
84
|
+
* Router subscription is wired exactly once.
|
|
53
85
|
*/
|
|
54
86
|
export function provideAllStakRouterInstrumentation() {
|
|
55
87
|
return makeEnvironmentProviders([
|
|
@@ -65,4 +97,4 @@ export function provideAllStakRouterInstrumentation() {
|
|
|
65
97
|
},
|
|
66
98
|
]);
|
|
67
99
|
}
|
|
68
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
100
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvdmlkZXJzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3Byb3ZpZGVycy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQ0wsZUFBZSxFQUNmLHV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tb3AuXG4gICAgICAgIGluamVjdChUcmFjZVNlcnZpY2UpO1xuICAgICAgICByZXR1cm4gKCkgPT4gdW5kZWZpbmVkO1xuICAgICAgfSxcbiAgICB9LFxuICBdKTtcbn1cbiJdfQ==
|
package/esm2022/src/version.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// AUTO-GENERATED by scripts/gen-version.mjs — do not edit by hand.
|
|
2
2
|
export const SDK_NAME = 'allstak-angular';
|
|
3
|
-
export const SDK_VERSION = "0.
|
|
4
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
3
|
+
export const SDK_VERSION = "0.2.0";
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVyc2lvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy92ZXJzaW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLG1FQUFtRTtBQUNuRSxNQUFNLENBQUMsTUFBTSxRQUFRLEdBQUcsaUJBQWlCLENBQUM7QUFDMUMsTUFBTSxDQUFDLE1BQU0sV0FBVyxHQUFHLE9BQU8sQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8vIEFVVE8tR0VORVJBVEVEIGJ5IHNjcmlwdHMvZ2VuLXZlcnNpb24ubWpzIOKAlCBkbyBub3QgZWRpdCBieSBoYW5kLlxuZXhwb3J0IGNvbnN0IFNES19OQU1FID0gJ2FsbHN0YWstYW5ndWxhcic7XG5leHBvcnQgY29uc3QgU0RLX1ZFUlNJT04gPSBcIjAuMi4wXCI7XG4iXX0=
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AllStak } from '@allstak/js';
|
|
2
2
|
export { AllStak, Scope, Session, SessionTracker, Span, WebVitalsModule, consoleIntegration, databaseIntegration, dedupeIntegration, defineIntegration, eventFiltersIntegration, httpClientIntegration, inboundFiltersIntegration, isWebVitalsSupported } from '@allstak/js';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { Injectable, Optional, Input, Directive,
|
|
4
|
+
import { Injectable, Optional, Input, Directive, ENVIRONMENT_INITIALIZER, inject, APP_INITIALIZER, makeEnvironmentProviders, ErrorHandler, InjectionToken, NgModule } from '@angular/core';
|
|
5
5
|
import { HttpErrorResponse, HttpResponse } from '@angular/common/http';
|
|
6
6
|
import { Observable } from 'rxjs';
|
|
7
7
|
import * as i1 from '@angular/router';
|
|
@@ -9,7 +9,7 @@ import { NavigationStart, NavigationEnd, NavigationCancel, NavigationError } fro
|
|
|
9
9
|
|
|
10
10
|
// AUTO-GENERATED by scripts/gen-version.mjs — do not edit by hand.
|
|
11
11
|
const SDK_NAME = 'allstak-angular';
|
|
12
|
-
const SDK_VERSION = "0.
|
|
12
|
+
const SDK_VERSION = "0.2.0";
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Initialize the AllStak SDK for an Angular application.
|
|
@@ -571,9 +571,17 @@ function finishSpan(span) {
|
|
|
571
571
|
* to catch errors thrown *during bootstrap itself*, prefer calling `init(...)`
|
|
572
572
|
* directly in `main.ts` before `bootstrapApplication`; this provider is the
|
|
573
573
|
* convenient alternative for apps that initialise inside the DI graph.
|
|
574
|
+
*
|
|
575
|
+
* Router/navigation instrumentation is folded in by default — a
|
|
576
|
+
* `provideAllStak()`-only standalone app gets a `navigation` span + breadcrumb
|
|
577
|
+
* per route change with no extra wiring. It is a no-op when `@angular/router`
|
|
578
|
+
* is not present (the `Router` dependency is `@Optional()`). Opt out with
|
|
579
|
+
* `provideAllStak(config, { router: false })`. The standalone
|
|
580
|
+
* {@link provideAllStakRouterInstrumentation} remains exported for explicit use
|
|
581
|
+
* and is idempotent if also added alongside `provideAllStak`.
|
|
574
582
|
*/
|
|
575
|
-
function provideAllStak(config) {
|
|
576
|
-
|
|
583
|
+
function provideAllStak(config, options) {
|
|
584
|
+
const providers = [
|
|
577
585
|
{
|
|
578
586
|
provide: ENVIRONMENT_INITIALIZER,
|
|
579
587
|
multi: true,
|
|
@@ -581,7 +589,22 @@ function provideAllStak(config) {
|
|
|
581
589
|
init(config);
|
|
582
590
|
},
|
|
583
591
|
},
|
|
584
|
-
]
|
|
592
|
+
];
|
|
593
|
+
if (options?.router !== false) {
|
|
594
|
+
// Fold in the router instrumentation so navigation spans are automatic.
|
|
595
|
+
// `TraceService` is `providedIn: 'root'`; force-instantiate it via an
|
|
596
|
+
// APP_INITIALIZER so its Router subscription is live before the first
|
|
597
|
+
// navigation completes. Harmless (no-op) when @angular/router is absent.
|
|
598
|
+
providers.push(TraceService, {
|
|
599
|
+
provide: APP_INITIALIZER,
|
|
600
|
+
multi: true,
|
|
601
|
+
useFactory: () => {
|
|
602
|
+
inject(TraceService);
|
|
603
|
+
return () => undefined;
|
|
604
|
+
},
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
return makeEnvironmentProviders(providers);
|
|
585
608
|
}
|
|
586
609
|
/**
|
|
587
610
|
* Provide the AllStak `ErrorHandler` (overriding Angular's default) so every
|
|
@@ -604,6 +627,15 @@ function provideAllStakErrorHandler(options) {
|
|
|
604
627
|
* service when something injects it. The `APP_INITIALIZER` below injects it
|
|
605
628
|
* during bootstrap, guaranteeing the subscription is live before the first
|
|
606
629
|
* navigation completes.
|
|
630
|
+
*
|
|
631
|
+
* As of the navigation-auto-wire change, {@link provideAllStak} already folds
|
|
632
|
+
* this in by default, so most standalone apps no longer need to add this
|
|
633
|
+
* provider explicitly. It remains exported for apps that disable the fold with
|
|
634
|
+
* `provideAllStak(config, { router: false })` but still want navigation spans,
|
|
635
|
+
* or that bootstrap `init` outside the DI graph. Adding it alongside
|
|
636
|
+
* `provideAllStak` is safe: `TraceService` is a `providedIn: 'root'` singleton,
|
|
637
|
+
* so the duplicate `inject(TraceService)` resolves to the same instance and the
|
|
638
|
+
* Router subscription is wired exactly once.
|
|
607
639
|
*/
|
|
608
640
|
function provideAllStakRouterInstrumentation() {
|
|
609
641
|
return makeEnvironmentProviders([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"allstak-angular.mjs","sources":["../../src/version.ts","../../src/init.ts","../../src/error-handler.ts","../../src/http-interceptor.ts","../../src/trace-service.ts","../../src/trace-directive.ts","../../src/trace-decorators.ts","../../src/providers.ts","../../src/module.ts","../../public-api.ts","../../allstak-angular.ts"],"sourcesContent":["// AUTO-GENERATED by scripts/gen-version.mjs — do not edit by hand.\nexport const SDK_NAME = 'allstak-angular';\nexport const SDK_VERSION = \"0.1.0\";\n","import { AllStak } from '@allstak/js';\nimport type { AllStakConfig } from '@allstak/js';\nimport { SDK_NAME, SDK_VERSION } from './version';\n\n/**\n * The core client instance returned by `AllStak.init`. `@allstak/js` does\n * not export the `AllStakClient` class by name, so we derive the type from\n * the value. This keeps the emitted declaration referential (no inlining of\n * the core class's private members, which would trip TS4094).\n */\nexport type AllStakClientInstance = ReturnType<typeof AllStak.init>;\n\n/**\n * Initialize the AllStak SDK for an Angular application.\n *\n * This is a thin shim over `AllStak.init` from `@allstak/js` that stamps the\n * wrapper identity (`sdkName: 'allstak-angular'`, `sdkVersion`) so the backend\n * can tell Angular traffic apart from plain JS traffic. Everything else —\n * buffering, sampling, session health, offline queue, PII scrubbing — is\n * delegated to the underlying core client.\n *\n * Call this once at app boot in `main.ts`, BEFORE `bootstrapApplication(...)`\n * (standalone) or `platformBrowserDynamic().bootstrapModule(...)` (NgModule),\n * so the global `ErrorHandler` and router instrumentation see a live client:\n *\n * import { init } from '@allstak/angular';\n *\n * init({\n * apiKey: environment.allstakApiKey,\n * environment: environment.production ? 'production' : 'development',\n * });\n *\n * bootstrapApplication(AppComponent, appConfig);\n */\nexport function init(config: AllStakConfig): AllStakClientInstance {\n return AllStak.init({\n ...config,\n sdkName: config.sdkName ?? SDK_NAME,\n sdkVersion: config.sdkVersion ?? SDK_VERSION,\n });\n}\n","import { ErrorHandler, Injectable } from '@angular/core';\nimport { AllStak } from '@allstak/js';\n\n/**\n * Options accepted by {@link createErrorHandler} / {@link AllStakErrorHandler}.\n *\n * Mirrors the shape host apps expect from a framework error-handler factory:\n * a logging toggle and an `extractor` escape hatch so the host can customise\n * how a thrown value is unwrapped before we hand it to `captureException`.\n */\nexport interface ErrorHandlerOptions {\n /**\n * Also `console.error` the original error after capturing it. Default:\n * `true` — preserving Angular's default behaviour of surfacing errors to\n * the console so local development is not silenced.\n */\n logErrors?: boolean;\n\n /**\n * Customise how the thrown value is reduced to the `Error` we capture.\n * Receives the raw value Angular handed to `handleError` plus the SDK's\n * `defaultExtractor`, so a host can fall back to default behaviour for\n * cases it does not care about.\n *\n * createErrorHandler({\n * extractor: (error, defaultExtractor) =>\n * error?.customCause ?? defaultExtractor(error),\n * });\n */\n extractor?: (error: unknown, defaultExtractor: (error: unknown) => unknown) => unknown;\n}\n\nconst DEFAULT_OPTIONS: Required<Pick<ErrorHandlerOptions, 'logErrors'>> = {\n logErrors: true,\n};\n\n/**\n * Unwrap the common Angular/zone.js error envelopes so we capture the real\n * underlying error rather than the wrapper:\n *\n * - Angular wraps errors thrown during change detection as\n * `{ ngOriginalError }` / `{ originalError }`.\n * - `HttpErrorResponse` carries the server payload on `.error`.\n * - DOM `ErrorEvent` carries the real error on `.error`.\n * - Rejected promises may surface as `{ rejection }`.\n */\nfunction defaultExtractor(error: unknown): unknown {\n if (error && typeof error === 'object') {\n const candidate = error as Record<string, unknown>;\n // PromiseRejectionEvent-style wrapping from zone.js.\n if ('rejection' in candidate && candidate['rejection'] != null) {\n return defaultExtractor(candidate['rejection']);\n }\n // Angular wraps the thrown value during change detection.\n if ('ngOriginalError' in candidate && candidate['ngOriginalError'] != null) {\n return defaultExtractor(candidate['ngOriginalError']);\n }\n if ('originalError' in candidate && candidate['originalError'] != null) {\n return defaultExtractor(candidate['originalError']);\n }\n // DOM ErrorEvent / HttpErrorResponse expose the real error on `.error`.\n if ('error' in candidate && candidate['error'] instanceof Error) {\n return candidate['error'];\n }\n }\n return error;\n}\n\n/** Coerce any extracted value into an `Error` so `captureException` is happy. */\nfunction toError(value: unknown): Error {\n if (value instanceof Error) return value;\n if (typeof value === 'string') return new Error(value);\n try {\n return new Error(JSON.stringify(value));\n } catch {\n return new Error(String(value));\n }\n}\n\n/**\n * AllStak's implementation of Angular's `ErrorHandler`. Captures every error\n * routed through Angular's global error handling — uncaught render/lifecycle\n * errors, change-detection errors, and (when zone.js is present) unhandled\n * promise rejections.\n *\n * Wired manually as `{ provide: ErrorHandler, useValue: createErrorHandler() }`\n * or via {@link provideAllStakErrorHandler}.\n */\n@Injectable()\nexport class AllStakErrorHandler implements ErrorHandler {\n private readonly options: ErrorHandlerOptions;\n\n constructor(options: ErrorHandlerOptions = {}) {\n this.options = { ...DEFAULT_OPTIONS, ...options };\n }\n\n handleError(error: unknown): void {\n const extracted = this.options.extractor\n ? this.options.extractor(error, defaultExtractor)\n : defaultExtractor(error);\n\n const err = toError(extracted);\n\n try {\n AllStak.captureException(err, { framework: 'angular' });\n } catch {\n // Never let our handler break the host's error path.\n }\n\n if (this.options.logErrors !== false) {\n // Preserve Angular's default of surfacing the original (pre-unwrap)\n // value so stack traces and zone context stay intact in the console.\n // eslint-disable-next-line no-console\n console.error(error);\n }\n }\n}\n\n/**\n * Factory returning an Angular `ErrorHandler` that forwards to\n * `AllStak.captureException`.\n *\n * Standalone (`app.config.ts`):\n *\n * import { ErrorHandler } from '@angular/core';\n * import { createErrorHandler } from '@allstak/angular';\n *\n * export const appConfig = {\n * providers: [{ provide: ErrorHandler, useValue: createErrorHandler() }],\n * };\n *\n * NgModule (`AppModule`):\n *\n * @NgModule({\n * providers: [{ provide: ErrorHandler, useValue: createErrorHandler() }],\n * })\n * export class AppModule {}\n */\nexport function createErrorHandler(options?: ErrorHandlerOptions): ErrorHandler {\n return new AllStakErrorHandler(options);\n}\n","import { Injectable } from '@angular/core';\nimport type {\n HttpEvent,\n HttpHandler,\n HttpInterceptor,\n HttpHandlerFn,\n HttpRequest,\n} from '@angular/common/http';\nimport { HttpResponse, HttpErrorResponse } from '@angular/common/http';\nimport { Observable } from 'rxjs';\nimport { AllStak } from '@allstak/js';\nimport type { HttpRequestItem, Span } from '@allstak/js';\n\n/** HTTP verbs the core `HttpRequestItem` accepts. */\ntype HttpMethod = HttpRequestItem['method'];\n\nconst KNOWN_METHODS: ReadonlySet<string> = new Set([\n 'GET',\n 'POST',\n 'PUT',\n 'DELETE',\n 'PATCH',\n 'HEAD',\n 'OPTIONS',\n]);\n\n/** Normalise an Angular request method into the core method union. */\nfunction normalizeMethod(method: string): HttpMethod {\n const upper = method.toUpperCase();\n return (KNOWN_METHODS.has(upper) ? upper : 'GET') as HttpMethod;\n}\n\n/** Split an outbound URL into `host` + `path`, tolerating relative URLs. */\nfunction splitUrl(url: string): { host: string; path: string } {\n try {\n const base =\n typeof window !== 'undefined' && window.location\n ? window.location.origin\n : 'http://localhost';\n const parsed = new URL(url, base);\n return { host: parsed.host, path: parsed.pathname + parsed.search };\n } catch {\n return { host: '', path: url };\n }\n}\n\n/**\n * Open a span + record an outbound request for a single `HttpRequest`, and\n * return the lifecycle hooks the interceptor (class or functional) uses to\n * finish it. Shared so the class-based and functional interceptors stay\n * behaviourally identical.\n */\nfunction instrumentRequest(req: HttpRequest<unknown>): {\n onResponse: (status: number) => void;\n onError: (error: unknown) => void;\n} {\n const startedAt = Date.now();\n const method = normalizeMethod(req.method);\n const { host, path } = splitUrl(req.urlWithParams);\n let span: Span | null = null;\n\n try {\n span = AllStak.startSpan('http.client', {\n op: 'http.client',\n description: `${req.method} ${req.urlWithParams}`,\n attributes: {\n 'allstak.origin': 'auto.http.angular',\n 'http.method': req.method,\n 'http.url': req.urlWithParams,\n },\n });\n } catch {\n // Never block the request on observability errors.\n }\n\n const finish = (statusCode: number, status: 'ok' | 'error') => {\n const durationMs = Date.now() - startedAt;\n try {\n span?.setMeasurement('http.duration_ms', durationMs);\n span?.finish(status);\n } catch {\n // ignore — span may already be finished\n }\n try {\n const item: HttpRequestItem = {\n direction: 'outbound',\n method,\n host,\n path,\n statusCode,\n durationMs,\n };\n AllStak.captureRequest(item);\n } catch {\n // ignore — request recording is best-effort\n }\n };\n\n return {\n onResponse(statusCode: number) {\n finish(statusCode, statusCode >= 400 ? 'error' : 'ok');\n },\n onError(error: unknown) {\n const statusCode = error instanceof HttpErrorResponse ? error.status : 0;\n finish(statusCode, 'error');\n },\n };\n}\n\n/**\n * Class-based `HttpInterceptor` that records every outbound HTTP request and\n * opens a `http.client` span around it. Register in the DI-token style used by\n * NgModule apps and standalone apps that opt into `withInterceptorsFromDi()`:\n *\n * import { HTTP_INTERCEPTORS } from '@angular/common/http';\n * import { AllStakHttpInterceptor } from '@allstak/angular';\n *\n * providers: [\n * { provide: HTTP_INTERCEPTORS, useClass: AllStakHttpInterceptor, multi: true },\n * ]\n *\n * The interceptor never mutates the request and never swallows errors — it\n * only observes the stream.\n */\n@Injectable()\nexport class AllStakHttpInterceptor implements HttpInterceptor {\n intercept(\n req: HttpRequest<unknown>,\n next: HttpHandler,\n ): Observable<HttpEvent<unknown>> {\n const hooks = instrumentRequest(req);\n\n return new Observable<HttpEvent<unknown>>((subscriber) => {\n const sub = next.handle(req).subscribe({\n next: (event) => {\n if (event instanceof HttpResponse) {\n hooks.onResponse(event.status);\n }\n subscriber.next(event);\n },\n error: (error) => {\n hooks.onError(error);\n subscriber.error(error);\n },\n complete: () => subscriber.complete(),\n });\n return () => sub.unsubscribe();\n });\n }\n}\n\n/**\n * Functional `HttpInterceptor` for standalone apps using\n * `provideHttpClient(withInterceptors([allStakHttpInterceptor]))`.\n *\n * Behaviourally identical to {@link AllStakHttpInterceptor}.\n */\nexport function allStakHttpInterceptor(\n req: HttpRequest<unknown>,\n next: HttpHandlerFn,\n): Observable<HttpEvent<unknown>> {\n const hooks = instrumentRequest(req);\n\n return new Observable<HttpEvent<unknown>>((subscriber) => {\n const sub = next(req).subscribe({\n next: (event) => {\n if (event instanceof HttpResponse) {\n hooks.onResponse(event.status);\n }\n subscriber.next(event);\n },\n error: (error) => {\n hooks.onError(error);\n subscriber.error(error);\n },\n complete: () => subscriber.complete(),\n });\n return () => sub.unsubscribe();\n });\n}\n","import { Injectable, OnDestroy, Optional } from '@angular/core';\nimport {\n Router,\n NavigationStart,\n NavigationEnd,\n NavigationCancel,\n NavigationError,\n} from '@angular/router';\nimport type { Event as RouterEvent } from '@angular/router';\nimport type { Subscription } from 'rxjs';\nimport { AllStak } from '@allstak/js';\nimport type { Span } from '@allstak/js';\n\n/**\n * Router-aware navigation instrumentation.\n *\n * `TraceService` subscribes to Angular `Router` events and opens a\n * `navigation` span per route change — `NavigationStart` opens it,\n * `NavigationEnd` finishes it `ok`, and `NavigationCancel` / `NavigationError`\n * finish it `error`. A navigation breadcrumb is recorded alongside each span.\n *\n * Because Angular only constructs a service when something injects it, the\n * service must be *force-instantiated* for its Router subscription to run.\n * Use {@link provideAllStakRouterInstrumentation} (standalone) or inject it in\n * your `AppComponent` constructor (NgModule) — see those helpers for wiring.\n *\n * `Router` is `@Optional()` so apps without `@angular/router` (which is an\n * optional peer dependency) can still construct the service without error; it\n * simply becomes a no-op.\n */\n@Injectable({ providedIn: 'root' })\nexport class TraceService implements OnDestroy {\n private activeNavSpan: Span | null = null;\n private readonly subscription: Subscription | null = null;\n\n constructor(@Optional() private readonly router: Router | null) {\n if (!this.router) return;\n this.subscription = this.router.events.subscribe((event: RouterEvent) => {\n this.handleEvent(event);\n });\n }\n\n private handleEvent(event: RouterEvent): void {\n try {\n if (event instanceof NavigationStart) {\n this.onNavigationStart(event.url);\n } else if (event instanceof NavigationEnd) {\n this.finishActive('ok');\n } else if (\n event instanceof NavigationCancel ||\n event instanceof NavigationError\n ) {\n this.finishActive('error');\n if (event instanceof NavigationError) {\n AllStak.captureException(\n event.error instanceof Error\n ? event.error\n : new Error(String(event.error)),\n { framework: 'angular', source: '@angular/router' },\n );\n }\n }\n } catch {\n // ignore — never block navigation on observability errors\n }\n }\n\n private onNavigationStart(url: string): void {\n // A new navigation supersedes any span still open from a redirect chain.\n this.finishActive('ok');\n\n AllStak.addBreadcrumb({\n type: 'navigation',\n message: url,\n level: 'info',\n data: { url },\n });\n\n this.activeNavSpan = AllStak.startSpan('navigation', {\n op: 'navigation',\n description: url,\n attributes: {\n 'allstak.origin': 'auto.navigation.angular',\n 'route.url': url,\n },\n });\n }\n\n private finishActive(status: 'ok' | 'error'): void {\n if (!this.activeNavSpan) return;\n try {\n this.activeNavSpan.finish(status);\n } catch {\n // ignore — span may already be finished\n } finally {\n this.activeNavSpan = null;\n }\n }\n\n ngOnDestroy(): void {\n this.subscription?.unsubscribe();\n this.finishActive('ok');\n }\n}\n","import {\n Directive,\n Input,\n OnInit,\n AfterViewInit,\n} from '@angular/core';\nimport { AllStak } from '@allstak/js';\nimport type { Span } from '@allstak/js';\n\n/**\n * `[trace]` template directive for component render timing.\n *\n * <app-checkout trace=\"checkout\"></app-checkout>\n *\n * Opens a `ui.angular.init` span when the host component initialises\n * (`ngOnInit`) and finishes it once the component's view has been fully\n * initialised (`ngAfterViewInit`). The span is named after the directive's\n * `trace` value — required, because component class names are not reliable in\n * minified production builds.\n *\n * Standalone components import the directive directly; module-based apps get\n * it via {@link AllStakTraceModule}.\n */\n@Directive({\n selector: '[trace]',\n standalone: true,\n})\nexport class TraceDirective implements OnInit, AfterViewInit {\n /**\n * Human-readable name for the traced component. Used as the span\n * description. Required so spans stay meaningful after minification.\n */\n @Input('trace') componentName = '';\n\n private span: Span | null = null;\n\n ngOnInit(): void {\n const name = this.componentName || 'unnamed';\n try {\n this.span = AllStak.startSpan('ui.angular.init', {\n op: 'ui.angular.init',\n description: name,\n attributes: {\n 'allstak.origin': 'auto.ui.angular',\n 'angular.component': name,\n },\n });\n } catch {\n // Never let render tracing break a component.\n }\n }\n\n ngAfterViewInit(): void {\n try {\n this.span?.finish('ok');\n } catch {\n // ignore — span may already be finished\n } finally {\n this.span = null;\n }\n }\n}\n","import { AllStak } from '@allstak/js';\nimport type { Span } from '@allstak/js';\n\n/**\n * Options for {@link TraceClassDecorator} / {@link TraceMethodDecorator}.\n *\n * `name` is required because Angular component/class names are mangled in\n * minified production builds — the span would otherwise be unidentifiable.\n */\nexport interface TraceDecoratorOptions {\n name: string;\n}\n\n/**\n * Class decorator that instruments a component's init lifecycle. Wraps\n * `ngOnInit` so a `ui.angular.init` span is opened on init and finished on\n * `ngAfterViewInit` (or immediately after `ngOnInit` if the component has no\n * `ngAfterViewInit`).\n *\n * @TraceClassDecorator({ name: 'CheckoutComponent' })\n * @Component({ ... })\n * export class CheckoutComponent implements OnInit {}\n */\nexport function TraceClassDecorator(options: TraceDecoratorOptions) {\n return function <T extends { new (...args: any[]): object }>(target: T): T {\n const proto = target.prototype as Record<string, unknown> & {\n ngOnInit?: () => void;\n ngAfterViewInit?: () => void;\n };\n const SPAN_KEY = '__allstak_trace_class_span__';\n const originalOnInit = proto.ngOnInit;\n const originalAfterViewInit = proto.ngAfterViewInit;\n\n proto.ngOnInit = function (this: Record<string, unknown>) {\n try {\n this[SPAN_KEY] = AllStak.startSpan('ui.angular.init', {\n op: 'ui.angular.init',\n description: options.name,\n attributes: {\n 'allstak.origin': 'auto.ui.angular',\n 'angular.component': options.name,\n },\n });\n } catch {\n // ignore\n }\n originalOnInit?.call(this);\n // If there is no ngAfterViewInit, close the span right after init.\n if (!originalAfterViewInit && !proto.ngAfterViewInit) {\n finishSpan(this[SPAN_KEY]);\n this[SPAN_KEY] = undefined;\n }\n };\n\n proto.ngAfterViewInit = function (this: Record<string, unknown>) {\n originalAfterViewInit?.call(this);\n finishSpan(this[SPAN_KEY]);\n this[SPAN_KEY] = undefined;\n };\n\n return target;\n };\n}\n\n/** Alias for the alternate naming. */\nexport const TraceClass = TraceClassDecorator;\n\n/**\n * Method decorator emitting a point-in-time `ui.angular.[hook]` span around a\n * single lifecycle method (e.g. `ngOnInit`, `ngOnChanges`, `ngAfterViewInit`).\n *\n * class Foo {\n * @TraceMethodDecorator({ name: 'Foo.ngOnInit' })\n * ngOnInit() {}\n * }\n */\nexport function TraceMethodDecorator(options: TraceDecoratorOptions) {\n return function (\n _target: object,\n propertyKey: string,\n descriptor: PropertyDescriptor,\n ): PropertyDescriptor {\n const original = descriptor.value as ((...args: unknown[]) => unknown) | undefined;\n descriptor.value = function (this: unknown, ...args: unknown[]) {\n let span: Span | null = null;\n try {\n span = AllStak.startSpan(`ui.angular.${propertyKey}`, {\n op: `ui.angular.${propertyKey}`,\n description: options.name,\n attributes: {\n 'allstak.origin': 'auto.ui.angular',\n 'angular.hook': propertyKey,\n },\n });\n } catch {\n // ignore\n }\n try {\n return original?.apply(this, args);\n } finally {\n finishSpan(span ?? undefined);\n }\n };\n return descriptor;\n };\n}\n\n/** Alias for the alternate naming. */\nexport const TraceMethod = TraceMethodDecorator;\n\nfunction finishSpan(span: unknown): void {\n try {\n (span as Span | undefined)?.finish('ok');\n } catch {\n // ignore — span may already be finished\n }\n}\n","import {\n APP_INITIALIZER,\n ENVIRONMENT_INITIALIZER,\n ErrorHandler,\n inject,\n makeEnvironmentProviders,\n} from '@angular/core';\nimport type { EnvironmentProviders, Provider } from '@angular/core';\nimport type { AllStakConfig } from '@allstak/js';\nimport { init } from './init';\nimport { createErrorHandler } from './error-handler';\nimport type { ErrorHandlerOptions } from './error-handler';\nimport { TraceService } from './trace-service';\n\n/**\n * Bootstrap the AllStak SDK from a standalone app's `appConfig.providers`.\n *\n * import { provideAllStak } from '@allstak/angular';\n *\n * export const appConfig: ApplicationConfig = {\n * providers: [\n * provideAllStak({ apiKey: environment.allstakApiKey }),\n * ],\n * };\n *\n * This calls {@link init} during DI bootstrap. For the global `ErrorHandler`\n * to catch errors thrown *during bootstrap itself*, prefer calling `init(...)`\n * directly in `main.ts` before `bootstrapApplication`; this provider is the\n * convenient alternative for apps that initialise inside the DI graph.\n */\nexport function provideAllStak(config: AllStakConfig): EnvironmentProviders {\n return makeEnvironmentProviders([\n {\n provide: ENVIRONMENT_INITIALIZER,\n multi: true,\n useValue: () => {\n init(config);\n },\n },\n ]);\n}\n\n/**\n * Provide the AllStak `ErrorHandler` (overriding Angular's default) so every\n * error routed through Angular's global error handling is captured.\n *\n * providers: [provideAllStakErrorHandler()]\n *\n * Equivalent to `{ provide: ErrorHandler, useValue: createErrorHandler() }`.\n */\nexport function provideAllStakErrorHandler(\n options?: ErrorHandlerOptions,\n): Provider {\n return { provide: ErrorHandler, useValue: createErrorHandler(options) };\n}\n\n/**\n * Register and force-instantiate {@link TraceService} so its Router\n * subscription runs and a navigation span opens per route change.\n *\n * providers: [provideRouter(routes), provideAllStakRouterInstrumentation()]\n *\n * `TraceService` is `providedIn: 'root'`, but Angular only constructs a\n * service when something injects it. The `APP_INITIALIZER` below injects it\n * during bootstrap, guaranteeing the subscription is live before the first\n * navigation completes.\n */\nexport function provideAllStakRouterInstrumentation(): EnvironmentProviders {\n return makeEnvironmentProviders([\n TraceService,\n {\n provide: APP_INITIALIZER,\n multi: true,\n useFactory: () => {\n // Force-instantiate the service; the factory itself is a no-op.\n inject(TraceService);\n return () => undefined;\n },\n },\n ]);\n}\n","import {\n APP_INITIALIZER,\n ErrorHandler,\n InjectionToken,\n NgModule,\n Optional,\n} from '@angular/core';\nimport type { ModuleWithProviders } from '@angular/core';\nimport type { AllStakConfig } from '@allstak/js';\nimport { init } from './init';\nimport { createErrorHandler } from './error-handler';\nimport { TraceService } from './trace-service';\nimport { TraceDirective } from './trace-directive';\n\n/** DI token carrying the config passed to {@link AllStakModule.forRoot}. */\nexport const ALLSTAK_CONFIG = new InjectionToken<AllStakConfig>('ALLSTAK_CONFIG');\n\n/**\n * NgModule that exposes {@link TraceDirective} for module-based apps (or\n * standalone components that prefer NgModule-style `imports`):\n *\n * @NgModule({ imports: [AllStakTraceModule] })\n * export class AppModule {}\n *\n * <app-checkout trace=\"checkout\"></app-checkout>\n *\n * `TraceDirective` is a standalone directive, so it is imported (not declared)\n * and re-exported.\n */\n@NgModule({\n imports: [TraceDirective],\n exports: [TraceDirective],\n})\nexport class AllStakTraceModule {}\n\n/**\n * Root NgModule for module-based Angular apps.\n *\n * import { AllStakModule } from '@allstak/angular';\n *\n * @NgModule({\n * imports: [\n * BrowserModule,\n * AllStakModule.forRoot({ apiKey: environment.allstakApiKey }),\n * ],\n * })\n * export class AppModule {}\n *\n * `forRoot(config)`:\n * - calls {@link init} during bootstrap (via `APP_INITIALIZER`);\n * - overrides the global `ErrorHandler` with the AllStak handler;\n * - force-instantiates {@link TraceService} so router navigation spans open;\n * - exposes {@link TraceDirective} via {@link AllStakTraceModule}.\n *\n * Call `forRoot` exactly once, in your root module. Feature modules that only\n * need the `[trace]` directive can import {@link AllStakTraceModule} directly.\n */\n@NgModule({\n imports: [AllStakTraceModule],\n exports: [AllStakTraceModule],\n})\nexport class AllStakModule {\n // Inject TraceService here so importing the module force-instantiates it and\n // its Router subscription runs. `@Optional` keeps router-less apps working.\n constructor(@Optional() _trace: TraceService | null) {}\n\n static forRoot(config: AllStakConfig): ModuleWithProviders<AllStakModule> {\n return {\n ngModule: AllStakModule,\n providers: [\n { provide: ALLSTAK_CONFIG, useValue: config },\n { provide: ErrorHandler, useValue: createErrorHandler() },\n TraceService,\n {\n provide: APP_INITIALIZER,\n multi: true,\n useFactory: appInitializerFactory,\n deps: [ALLSTAK_CONFIG, TraceService],\n },\n ],\n };\n }\n}\n\n/**\n * `APP_INITIALIZER` factory: initialises the SDK from the injected config and\n * touches `TraceService` so it is constructed (its constructor wires the\n * Router subscription). Declared as a named function so ng-packagr's partial\n * compiler can statically reference it (no arrow-in-decorator-metadata error).\n */\nexport function appInitializerFactory(\n config: AllStakConfig,\n // TraceService is injected via `deps` purely to force its construction.\n _trace: TraceService,\n): () => void {\n return () => {\n init(config);\n };\n}\n","/**\n * AllStak for Angular.\n *\n * Public surface:\n * - `init` — bootstrap (delegates to @allstak/js with Angular tagging)\n * - `createErrorHandler` / `AllStakErrorHandler` — Angular `ErrorHandler` forwarding to captureException\n * - `AllStakHttpInterceptor` / `allStakHttpInterceptor` — records outbound requests + opens spans\n * - `TraceService` — Router-aware navigation span instrumentation\n * - `TraceDirective` / `AllStakTraceModule` — `[trace]` component render-timing directive\n * - `TraceClassDecorator` / `TraceMethodDecorator` — lifecycle-span decorators\n * - `provideAllStak` / `provideAllStakErrorHandler` / `provideAllStakRouterInstrumentation`\n * — standalone provider functions\n * - `AllStakModule.forRoot(config)` — NgModule registration for module-based apps\n * - re-exports — every top-level @allstak/js export\n */\n\n// Bootstrap.\nexport { init } from './src/init';\nexport type { AllStakClientInstance } from './src/init';\n\n// Error handling.\nexport {\n createErrorHandler,\n AllStakErrorHandler,\n} from './src/error-handler';\nexport type { ErrorHandlerOptions } from './src/error-handler';\n\n// HTTP instrumentation.\nexport {\n AllStakHttpInterceptor,\n allStakHttpInterceptor,\n} from './src/http-interceptor';\n\n// Router / navigation instrumentation.\nexport { TraceService } from './src/trace-service';\n\n// Component render-timing directive + module.\nexport { TraceDirective } from './src/trace-directive';\n\n// Lifecycle-span decorators.\nexport {\n TraceClass,\n TraceClassDecorator,\n TraceMethod,\n TraceMethodDecorator,\n} from './src/trace-decorators';\nexport type { TraceDecoratorOptions } from './src/trace-decorators';\n\n// Standalone provider functions.\nexport {\n provideAllStak,\n provideAllStakErrorHandler,\n provideAllStakRouterInstrumentation,\n} from './src/providers';\n\n// NgModule registration for module-based apps.\nexport {\n AllStakModule,\n AllStakTraceModule,\n ALLSTAK_CONFIG,\n appInitializerFactory,\n} from './src/module';\n\n// Wrapper identity.\nexport { SDK_NAME, SDK_VERSION } from './src/version';\n\n// ---------------------------------------------------------------------------\n// Mirror the @allstak/js public surface so consumers can pull the entire\n// observability API from a single namespaced import:\n// import * as AllStakAngular from '@allstak/angular';\n// ---------------------------------------------------------------------------\nexport {\n AllStak,\n Scope,\n Session,\n SessionTracker,\n Span,\n WebVitalsModule,\n isWebVitalsSupported,\n defineIntegration,\n dedupeIntegration,\n consoleIntegration,\n httpClientIntegration,\n databaseIntegration,\n eventFiltersIntegration,\n inboundFiltersIntegration,\n} from '@allstak/js';\n\nexport type {\n AllStakConfig,\n AllStakIntegration,\n Breadcrumb,\n ErrorEvent,\n ErrorEventProcessor,\n LogEvent,\n LogLevel,\n HttpRequestItem,\n HeartbeatOptions,\n SpanData,\n SpanOptions,\n SpanProcessor,\n TracesSampler,\n SamplingContext,\n WebVitalsContext,\n DbQueryItem,\n SessionStatus,\n} from '@allstak/js';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.TraceService"],"mappings":";;;;;;;;;AAAA;AACO,MAAM,QAAQ,GAAG;AACjB,MAAM,WAAW,GAAG;;ACU3B;;;;;;;;;;;;;;;;;;;;;AAqBG;AACG,SAAU,IAAI,CAAC,MAAqB,EAAA;IACxC,OAAO,OAAO,CAAC,IAAI,CAAC;AAClB,QAAA,GAAG,MAAM;AACT,QAAA,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,QAAQ;AACnC,QAAA,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,WAAW;AAC7C,KAAA,CAAC;AACJ;;ACRA,MAAM,eAAe,GAAqD;AACxE,IAAA,SAAS,EAAE,IAAI;CAChB;AAED;;;;;;;;;AASG;AACH,SAAS,gBAAgB,CAAC,KAAc,EAAA;AACtC,IAAA,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QACtC,MAAM,SAAS,GAAG,KAAgC;;QAElD,IAAI,WAAW,IAAI,SAAS,IAAI,SAAS,CAAC,WAAW,CAAC,IAAI,IAAI,EAAE;AAC9D,YAAA,OAAO,gBAAgB,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QACjD;;QAEA,IAAI,iBAAiB,IAAI,SAAS,IAAI,SAAS,CAAC,iBAAiB,CAAC,IAAI,IAAI,EAAE;AAC1E,YAAA,OAAO,gBAAgB,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;QACvD;QACA,IAAI,eAAe,IAAI,SAAS,IAAI,SAAS,CAAC,eAAe,CAAC,IAAI,IAAI,EAAE;AACtE,YAAA,OAAO,gBAAgB,CA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AAa,EAAA,UAAA,EAAA,CAAA;kBAJzB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,kBAAkB,CAAC;oBAC7B,OAAO,EAAE,CAAC,kBAAkB,CAAC;AAC9B,iBAAA;;0BAIc;;AAoBf;;;;;AAKG;AACG,SAAU,qBAAqB,CACnC,MAAqB;AACrB;AACA,MAAoB,EAAA;AAEpB,IAAA,OAAO,MAAK;QACV,IAAI,CAAC,MAAM,CAAC;AACd,IAAA,CAAC;AACH;;AClGA;;;;;;;;;;;;;;AAcG;AAEH;;AChBA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"allstak-angular.mjs","sources":["../../src/version.ts","../../src/init.ts","../../src/error-handler.ts","../../src/http-interceptor.ts","../../src/trace-service.ts","../../src/trace-directive.ts","../../src/trace-decorators.ts","../../src/providers.ts","../../src/module.ts","../../public-api.ts","../../allstak-angular.ts"],"sourcesContent":["// AUTO-GENERATED by scripts/gen-version.mjs — do not edit by hand.\nexport const SDK_NAME = 'allstak-angular';\nexport const SDK_VERSION = \"0.2.0\";\n","import { AllStak } from '@allstak/js';\nimport type { AllStakConfig } from '@allstak/js';\nimport { SDK_NAME, SDK_VERSION } from './version';\n\n/**\n * The core client instance returned by `AllStak.init`. `@allstak/js` does\n * not export the `AllStakClient` class by name, so we derive the type from\n * the value. This keeps the emitted declaration referential (no inlining of\n * the core class's private members, which would trip TS4094).\n */\nexport type AllStakClientInstance = ReturnType<typeof AllStak.init>;\n\n/**\n * Initialize the AllStak SDK for an Angular application.\n *\n * This is a thin shim over `AllStak.init` from `@allstak/js` that stamps the\n * wrapper identity (`sdkName: 'allstak-angular'`, `sdkVersion`) so the backend\n * can tell Angular traffic apart from plain JS traffic. Everything else —\n * buffering, sampling, session health, offline queue, PII scrubbing — is\n * delegated to the underlying core client.\n *\n * Call this once at app boot in `main.ts`, BEFORE `bootstrapApplication(...)`\n * (standalone) or `platformBrowserDynamic().bootstrapModule(...)` (NgModule),\n * so the global `ErrorHandler` and router instrumentation see a live client:\n *\n * import { init } from '@allstak/angular';\n *\n * init({\n * apiKey: environment.allstakApiKey,\n * environment: environment.production ? 'production' : 'development',\n * });\n *\n * bootstrapApplication(AppComponent, appConfig);\n */\nexport function init(config: AllStakConfig): AllStakClientInstance {\n return AllStak.init({\n ...config,\n sdkName: config.sdkName ?? SDK_NAME,\n sdkVersion: config.sdkVersion ?? SDK_VERSION,\n });\n}\n","import { ErrorHandler, Injectable } from '@angular/core';\nimport { AllStak } from '@allstak/js';\n\n/**\n * Options accepted by {@link createErrorHandler} / {@link AllStakErrorHandler}.\n *\n * Mirrors the shape host apps expect from a framework error-handler factory:\n * a logging toggle and an `extractor` escape hatch so the host can customise\n * how a thrown value is unwrapped before we hand it to `captureException`.\n */\nexport interface ErrorHandlerOptions {\n /**\n * Also `console.error` the original error after capturing it. Default:\n * `true` — preserving Angular's default behaviour of surfacing errors to\n * the console so local development is not silenced.\n */\n logErrors?: boolean;\n\n /**\n * Customise how the thrown value is reduced to the `Error` we capture.\n * Receives the raw value Angular handed to `handleError` plus the SDK's\n * `defaultExtractor`, so a host can fall back to default behaviour for\n * cases it does not care about.\n *\n * createErrorHandler({\n * extractor: (error, defaultExtractor) =>\n * error?.customCause ?? defaultExtractor(error),\n * });\n */\n extractor?: (error: unknown, defaultExtractor: (error: unknown) => unknown) => unknown;\n}\n\nconst DEFAULT_OPTIONS: Required<Pick<ErrorHandlerOptions, 'logErrors'>> = {\n logErrors: true,\n};\n\n/**\n * Unwrap the common Angular/zone.js error envelopes so we capture the real\n * underlying error rather than the wrapper:\n *\n * - Angular wraps errors thrown during change detection as\n * `{ ngOriginalError }` / `{ originalError }`.\n * - `HttpErrorResponse` carries the server payload on `.error`.\n * - DOM `ErrorEvent` carries the real error on `.error`.\n * - Rejected promises may surface as `{ rejection }`.\n */\nfunction defaultExtractor(error: unknown): unknown {\n if (error && typeof error === 'object') {\n const candidate = error as Record<string, unknown>;\n // PromiseRejectionEvent-style wrapping from zone.js.\n if ('rejection' in candidate && candidate['rejection'] != null) {\n return defaultExtractor(candidate['rejection']);\n }\n // Angular wraps the thrown value during change detection.\n if ('ngOriginalError' in candidate && candidate['ngOriginalError'] != null) {\n return defaultExtractor(candidate['ngOriginalError']);\n }\n if ('originalError' in candidate && candidate['originalError'] != null) {\n return defaultExtractor(candidate['originalError']);\n }\n // DOM ErrorEvent / HttpErrorResponse expose the real error on `.error`.\n if ('error' in candidate && candidate['error'] instanceof Error) {\n return candidate['error'];\n }\n }\n return error;\n}\n\n/** Coerce any extracted value into an `Error` so `captureException` is happy. */\nfunction toError(value: unknown): Error {\n if (value instanceof Error) return value;\n if (typeof value === 'string') return new Error(value);\n try {\n return new Error(JSON.stringify(value));\n } catch {\n return new Error(String(value));\n }\n}\n\n/**\n * AllStak's implementation of Angular's `ErrorHandler`. Captures every error\n * routed through Angular's global error handling — uncaught render/lifecycle\n * errors, change-detection errors, and (when zone.js is present) unhandled\n * promise rejections.\n *\n * Wired manually as `{ provide: ErrorHandler, useValue: createErrorHandler() }`\n * or via {@link provideAllStakErrorHandler}.\n */\n@Injectable()\nexport class AllStakErrorHandler implements ErrorHandler {\n private readonly options: ErrorHandlerOptions;\n\n constructor(options: ErrorHandlerOptions = {}) {\n this.options = { ...DEFAULT_OPTIONS, ...options };\n }\n\n handleError(error: unknown): void {\n const extracted = this.options.extractor\n ? this.options.extractor(error, defaultExtractor)\n : defaultExtractor(error);\n\n const err = toError(extracted);\n\n try {\n AllStak.captureException(err, { framework: 'angular' });\n } catch {\n // Never let our handler break the host's error path.\n }\n\n if (this.options.logErrors !== false) {\n // Preserve Angular's default of surfacing the original (pre-unwrap)\n // value so stack traces and zone context stay intact in the console.\n // eslint-disable-next-line no-console\n console.error(error);\n }\n }\n}\n\n/**\n * Factory returning an Angular `ErrorHandler` that forwards to\n * `AllStak.captureException`.\n *\n * Standalone (`app.config.ts`):\n *\n * import { ErrorHandler } from '@angular/core';\n * import { createErrorHandler } from '@allstak/angular';\n *\n * export const appConfig = {\n * providers: [{ provide: ErrorHandler, useValue: createErrorHandler() }],\n * };\n *\n * NgModule (`AppModule`):\n *\n * @NgModule({\n * providers: [{ provide: ErrorHandler, useValue: createErrorHandler() }],\n * })\n * export class AppModule {}\n */\nexport function createErrorHandler(options?: ErrorHandlerOptions): ErrorHandler {\n return new AllStakErrorHandler(options);\n}\n","import { Injectable } from '@angular/core';\nimport type {\n HttpEvent,\n HttpHandler,\n HttpInterceptor,\n HttpHandlerFn,\n HttpRequest,\n} from '@angular/common/http';\nimport { HttpResponse, HttpErrorResponse } from '@angular/common/http';\nimport { Observable } from 'rxjs';\nimport { AllStak } from '@allstak/js';\nimport type { HttpRequestItem, Span } from '@allstak/js';\n\n/** HTTP verbs the core `HttpRequestItem` accepts. */\ntype HttpMethod = HttpRequestItem['method'];\n\nconst KNOWN_METHODS: ReadonlySet<string> = new Set([\n 'GET',\n 'POST',\n 'PUT',\n 'DELETE',\n 'PATCH',\n 'HEAD',\n 'OPTIONS',\n]);\n\n/** Normalise an Angular request method into the core method union. */\nfunction normalizeMethod(method: string): HttpMethod {\n const upper = method.toUpperCase();\n return (KNOWN_METHODS.has(upper) ? upper : 'GET') as HttpMethod;\n}\n\n/** Split an outbound URL into `host` + `path`, tolerating relative URLs. */\nfunction splitUrl(url: string): { host: string; path: string } {\n try {\n const base =\n typeof window !== 'undefined' && window.location\n ? window.location.origin\n : 'http://localhost';\n const parsed = new URL(url, base);\n return { host: parsed.host, path: parsed.pathname + parsed.search };\n } catch {\n return { host: '', path: url };\n }\n}\n\n/**\n * Open a span + record an outbound request for a single `HttpRequest`, and\n * return the lifecycle hooks the interceptor (class or functional) uses to\n * finish it. Shared so the class-based and functional interceptors stay\n * behaviourally identical.\n */\nfunction instrumentRequest(req: HttpRequest<unknown>): {\n onResponse: (status: number) => void;\n onError: (error: unknown) => void;\n} {\n const startedAt = Date.now();\n const method = normalizeMethod(req.method);\n const { host, path } = splitUrl(req.urlWithParams);\n let span: Span | null = null;\n\n try {\n span = AllStak.startSpan('http.client', {\n op: 'http.client',\n description: `${req.method} ${req.urlWithParams}`,\n attributes: {\n 'allstak.origin': 'auto.http.angular',\n 'http.method': req.method,\n 'http.url': req.urlWithParams,\n },\n });\n } catch {\n // Never block the request on observability errors.\n }\n\n const finish = (statusCode: number, status: 'ok' | 'error') => {\n const durationMs = Date.now() - startedAt;\n try {\n span?.setMeasurement('http.duration_ms', durationMs);\n span?.finish(status);\n } catch {\n // ignore — span may already be finished\n }\n try {\n const item: HttpRequestItem = {\n direction: 'outbound',\n method,\n host,\n path,\n statusCode,\n durationMs,\n };\n AllStak.captureRequest(item);\n } catch {\n // ignore — request recording is best-effort\n }\n };\n\n return {\n onResponse(statusCode: number) {\n finish(statusCode, statusCode >= 400 ? 'error' : 'ok');\n },\n onError(error: unknown) {\n const statusCode = error instanceof HttpErrorResponse ? error.status : 0;\n finish(statusCode, 'error');\n },\n };\n}\n\n/**\n * Class-based `HttpInterceptor` that records every outbound HTTP request and\n * opens a `http.client` span around it. Register in the DI-token style used by\n * NgModule apps and standalone apps that opt into `withInterceptorsFromDi()`:\n *\n * import { HTTP_INTERCEPTORS } from '@angular/common/http';\n * import { AllStakHttpInterceptor } from '@allstak/angular';\n *\n * providers: [\n * { provide: HTTP_INTERCEPTORS, useClass: AllStakHttpInterceptor, multi: true },\n * ]\n *\n * The interceptor never mutates the request and never swallows errors — it\n * only observes the stream.\n */\n@Injectable()\nexport class AllStakHttpInterceptor implements HttpInterceptor {\n intercept(\n req: HttpRequest<unknown>,\n next: HttpHandler,\n ): Observable<HttpEvent<unknown>> {\n const hooks = instrumentRequest(req);\n\n return new Observable<HttpEvent<unknown>>((subscriber) => {\n const sub = next.handle(req).subscribe({\n next: (event) => {\n if (event instanceof HttpResponse) {\n hooks.onResponse(event.status);\n }\n subscriber.next(event);\n },\n error: (error) => {\n hooks.onError(error);\n subscriber.error(error);\n },\n complete: () => subscriber.complete(),\n });\n return () => sub.unsubscribe();\n });\n }\n}\n\n/**\n * Functional `HttpInterceptor` for standalone apps using\n * `provideHttpClient(withInterceptors([allStakHttpInterceptor]))`.\n *\n * Behaviourally identical to {@link AllStakHttpInterceptor}.\n */\nexport function allStakHttpInterceptor(\n req: HttpRequest<unknown>,\n next: HttpHandlerFn,\n): Observable<HttpEvent<unknown>> {\n const hooks = instrumentRequest(req);\n\n return new Observable<HttpEvent<unknown>>((subscriber) => {\n const sub = next(req).subscribe({\n next: (event) => {\n if (event instanceof HttpResponse) {\n hooks.onResponse(event.status);\n }\n subscriber.next(event);\n },\n error: (error) => {\n hooks.onError(error);\n subscriber.error(error);\n },\n complete: () => subscriber.complete(),\n });\n return () => sub.unsubscribe();\n });\n}\n","import { Injectable, OnDestroy, Optional } from '@angular/core';\nimport {\n Router,\n NavigationStart,\n NavigationEnd,\n NavigationCancel,\n NavigationError,\n} from '@angular/router';\nimport type { Event as RouterEvent } from '@angular/router';\nimport type { Subscription } from 'rxjs';\nimport { AllStak } from '@allstak/js';\nimport type { Span } from '@allstak/js';\n\n/**\n * Router-aware navigation instrumentation.\n *\n * `TraceService` subscribes to Angular `Router` events and opens a\n * `navigation` span per route change — `NavigationStart` opens it,\n * `NavigationEnd` finishes it `ok`, and `NavigationCancel` / `NavigationError`\n * finish it `error`. A navigation breadcrumb is recorded alongside each span.\n *\n * Because Angular only constructs a service when something injects it, the\n * service must be *force-instantiated* for its Router subscription to run.\n * Use {@link provideAllStakRouterInstrumentation} (standalone) or inject it in\n * your `AppComponent` constructor (NgModule) — see those helpers for wiring.\n *\n * `Router` is `@Optional()` so apps without `@angular/router` (which is an\n * optional peer dependency) can still construct the service without error; it\n * simply becomes a no-op.\n */\n@Injectable({ providedIn: 'root' })\nexport class TraceService implements OnDestroy {\n private activeNavSpan: Span | null = null;\n private readonly subscription: Subscription | null = null;\n\n constructor(@Optional() private readonly router: Router | null) {\n if (!this.router) return;\n this.subscription = this.router.events.subscribe((event: RouterEvent) => {\n this.handleEvent(event);\n });\n }\n\n private handleEvent(event: RouterEvent): void {\n try {\n if (event instanceof NavigationStart) {\n this.onNavigationStart(event.url);\n } else if (event instanceof NavigationEnd) {\n this.finishActive('ok');\n } else if (\n event instanceof NavigationCancel ||\n event instanceof NavigationError\n ) {\n this.finishActive('error');\n if (event instanceof NavigationError) {\n AllStak.captureException(\n event.error instanceof Error\n ? event.error\n : new Error(String(event.error)),\n { framework: 'angular', source: '@angular/router' },\n );\n }\n }\n } catch {\n // ignore — never block navigation on observability errors\n }\n }\n\n private onNavigationStart(url: string): void {\n // A new navigation supersedes any span still open from a redirect chain.\n this.finishActive('ok');\n\n AllStak.addBreadcrumb({\n type: 'navigation',\n message: url,\n level: 'info',\n data: { url },\n });\n\n this.activeNavSpan = AllStak.startSpan('navigation', {\n op: 'navigation',\n description: url,\n attributes: {\n 'allstak.origin': 'auto.navigation.angular',\n 'route.url': url,\n },\n });\n }\n\n private finishActive(status: 'ok' | 'error'): void {\n if (!this.activeNavSpan) return;\n try {\n this.activeNavSpan.finish(status);\n } catch {\n // ignore — span may already be finished\n } finally {\n this.activeNavSpan = null;\n }\n }\n\n ngOnDestroy(): void {\n this.subscription?.unsubscribe();\n this.finishActive('ok');\n }\n}\n","import {\n Directive,\n Input,\n OnInit,\n AfterViewInit,\n} from '@angular/core';\nimport { AllStak } from '@allstak/js';\nimport type { Span } from '@allstak/js';\n\n/**\n * `[trace]` template directive for component render timing.\n *\n * <app-checkout trace=\"checkout\"></app-checkout>\n *\n * Opens a `ui.angular.init` span when the host component initialises\n * (`ngOnInit`) and finishes it once the component's view has been fully\n * initialised (`ngAfterViewInit`). The span is named after the directive's\n * `trace` value — required, because component class names are not reliable in\n * minified production builds.\n *\n * Standalone components import the directive directly; module-based apps get\n * it via {@link AllStakTraceModule}.\n */\n@Directive({\n selector: '[trace]',\n standalone: true,\n})\nexport class TraceDirective implements OnInit, AfterViewInit {\n /**\n * Human-readable name for the traced component. Used as the span\n * description. Required so spans stay meaningful after minification.\n */\n @Input('trace') componentName = '';\n\n private span: Span | null = null;\n\n ngOnInit(): void {\n const name = this.componentName || 'unnamed';\n try {\n this.span = AllStak.startSpan('ui.angular.init', {\n op: 'ui.angular.init',\n description: name,\n attributes: {\n 'allstak.origin': 'auto.ui.angular',\n 'angular.component': name,\n },\n });\n } catch {\n // Never let render tracing break a component.\n }\n }\n\n ngAfterViewInit(): void {\n try {\n this.span?.finish('ok');\n } catch {\n // ignore — span may already be finished\n } finally {\n this.span = null;\n }\n }\n}\n","import { AllStak } from '@allstak/js';\nimport type { Span } from '@allstak/js';\n\n/**\n * Options for {@link TraceClassDecorator} / {@link TraceMethodDecorator}.\n *\n * `name` is required because Angular component/class names are mangled in\n * minified production builds — the span would otherwise be unidentifiable.\n */\nexport interface TraceDecoratorOptions {\n name: string;\n}\n\n/**\n * Class decorator that instruments a component's init lifecycle. Wraps\n * `ngOnInit` so a `ui.angular.init` span is opened on init and finished on\n * `ngAfterViewInit` (or immediately after `ngOnInit` if the component has no\n * `ngAfterViewInit`).\n *\n * @TraceClassDecorator({ name: 'CheckoutComponent' })\n * @Component({ ... })\n * export class CheckoutComponent implements OnInit {}\n */\nexport function TraceClassDecorator(options: TraceDecoratorOptions) {\n return function <T extends { new (...args: any[]): object }>(target: T): T {\n const proto = target.prototype as Record<string, unknown> & {\n ngOnInit?: () => void;\n ngAfterViewInit?: () => void;\n };\n const SPAN_KEY = '__allstak_trace_class_span__';\n const originalOnInit = proto.ngOnInit;\n const originalAfterViewInit = proto.ngAfterViewInit;\n\n proto.ngOnInit = function (this: Record<string, unknown>) {\n try {\n this[SPAN_KEY] = AllStak.startSpan('ui.angular.init', {\n op: 'ui.angular.init',\n description: options.name,\n attributes: {\n 'allstak.origin': 'auto.ui.angular',\n 'angular.component': options.name,\n },\n });\n } catch {\n // ignore\n }\n originalOnInit?.call(this);\n // If there is no ngAfterViewInit, close the span right after init.\n if (!originalAfterViewInit && !proto.ngAfterViewInit) {\n finishSpan(this[SPAN_KEY]);\n this[SPAN_KEY] = undefined;\n }\n };\n\n proto.ngAfterViewInit = function (this: Record<string, unknown>) {\n originalAfterViewInit?.call(this);\n finishSpan(this[SPAN_KEY]);\n this[SPAN_KEY] = undefined;\n };\n\n return target;\n };\n}\n\n/** Alias for the alternate naming. */\nexport const TraceClass = TraceClassDecorator;\n\n/**\n * Method decorator emitting a point-in-time `ui.angular.[hook]` span around a\n * single lifecycle method (e.g. `ngOnInit`, `ngOnChanges`, `ngAfterViewInit`).\n *\n * class Foo {\n * @TraceMethodDecorator({ name: 'Foo.ngOnInit' })\n * ngOnInit() {}\n * }\n */\nexport function TraceMethodDecorator(options: TraceDecoratorOptions) {\n return function (\n _target: object,\n propertyKey: string,\n descriptor: PropertyDescriptor,\n ): PropertyDescriptor {\n const original = descriptor.value as ((...args: unknown[]) => unknown) | undefined;\n descriptor.value = function (this: unknown, ...args: unknown[]) {\n let span: Span | null = null;\n try {\n span = AllStak.startSpan(`ui.angular.${propertyKey}`, {\n op: `ui.angular.${propertyKey}`,\n description: options.name,\n attributes: {\n 'allstak.origin': 'auto.ui.angular',\n 'angular.hook': propertyKey,\n },\n });\n } catch {\n // ignore\n }\n try {\n return original?.apply(this, args);\n } finally {\n finishSpan(span ?? undefined);\n }\n };\n return descriptor;\n };\n}\n\n/** Alias for the alternate naming. */\nexport const TraceMethod = TraceMethodDecorator;\n\nfunction finishSpan(span: unknown): void {\n try {\n (span as Span | undefined)?.finish('ok');\n } catch {\n // ignore — span may already be finished\n }\n}\n","import {\n APP_INITIALIZER,\n ENVIRONMENT_INITIALIZER,\n ErrorHandler,\n inject,\n makeEnvironmentProviders,\n} from '@angular/core';\nimport type { EnvironmentProviders, Provider } from '@angular/core';\nimport type { AllStakConfig } from '@allstak/js';\nimport { init } from './init';\nimport { createErrorHandler } from './error-handler';\nimport type { ErrorHandlerOptions } from './error-handler';\nimport { TraceService } from './trace-service';\n\n/** Options controlling what `provideAllStak` auto-wires. */\nexport interface ProvideAllStakOptions {\n /**\n * Auto-instrument the Angular `Router` so a `navigation` span + breadcrumb\n * opens per route change, with no extra provider.\n *\n * Default `true`. Folding the router instrumentation into `provideAllStak`\n * means a `provideAllStak()`-only app gets navigation spans automatically;\n * previously they only fired if {@link provideAllStakRouterInstrumentation}\n * was also added. Force-instantiating {@link TraceService} when\n * `@angular/router` is absent is harmless — the service becomes a no-op\n * because its `Router` dependency is `@Optional()`.\n *\n * Set to `false` only if you need to opt out of automatic navigation\n * instrumentation entirely.\n */\n router?: boolean;\n}\n\n/**\n * Bootstrap the AllStak SDK from a standalone app's `appConfig.providers`.\n *\n * import { provideAllStak } from '@allstak/angular';\n *\n * export const appConfig: ApplicationConfig = {\n * providers: [\n * provideAllStak({ apiKey: environment.allstakApiKey }),\n * ],\n * };\n *\n * This calls {@link init} during DI bootstrap. For the global `ErrorHandler`\n * to catch errors thrown *during bootstrap itself*, prefer calling `init(...)`\n * directly in `main.ts` before `bootstrapApplication`; this provider is the\n * convenient alternative for apps that initialise inside the DI graph.\n *\n * Router/navigation instrumentation is folded in by default — a\n * `provideAllStak()`-only standalone app gets a `navigation` span + breadcrumb\n * per route change with no extra wiring. It is a no-op when `@angular/router`\n * is not present (the `Router` dependency is `@Optional()`). Opt out with\n * `provideAllStak(config, { router: false })`. The standalone\n * {@link provideAllStakRouterInstrumentation} remains exported for explicit use\n * and is idempotent if also added alongside `provideAllStak`.\n */\nexport function provideAllStak(\n config: AllStakConfig,\n options?: ProvideAllStakOptions,\n): EnvironmentProviders {\n const providers: Array<Provider> = [\n {\n provide: ENVIRONMENT_INITIALIZER,\n multi: true,\n useValue: () => {\n init(config);\n },\n },\n ];\n\n if (options?.router !== false) {\n // Fold in the router instrumentation so navigation spans are automatic.\n // `TraceService` is `providedIn: 'root'`; force-instantiate it via an\n // APP_INITIALIZER so its Router subscription is live before the first\n // navigation completes. Harmless (no-op) when @angular/router is absent.\n providers.push(TraceService, {\n provide: APP_INITIALIZER,\n multi: true,\n useFactory: () => {\n inject(TraceService);\n return () => undefined;\n },\n });\n }\n\n return makeEnvironmentProviders(providers);\n}\n\n/**\n * Provide the AllStak `ErrorHandler` (overriding Angular's default) so every\n * error routed through Angular's global error handling is captured.\n *\n * providers: [provideAllStakErrorHandler()]\n *\n * Equivalent to `{ provide: ErrorHandler, useValue: createErrorHandler() }`.\n */\nexport function provideAllStakErrorHandler(\n options?: ErrorHandlerOptions,\n): Provider {\n return { provide: ErrorHandler, useValue: createErrorHandler(options) };\n}\n\n/**\n * Register and force-instantiate {@link TraceService} so its Router\n * subscription runs and a navigation span opens per route change.\n *\n * providers: [provideRouter(routes), provideAllStakRouterInstrumentation()]\n *\n * `TraceService` is `providedIn: 'root'`, but Angular only constructs a\n * service when something injects it. The `APP_INITIALIZER` below injects it\n * during bootstrap, guaranteeing the subscription is live before the first\n * navigation completes.\n *\n * As of the navigation-auto-wire change, {@link provideAllStak} already folds\n * this in by default, so most standalone apps no longer need to add this\n * provider explicitly. It remains exported for apps that disable the fold with\n * `provideAllStak(config, { router: false })` but still want navigation spans,\n * or that bootstrap `init` outside the DI graph. Adding it alongside\n * `provideAllStak` is safe: `TraceService` is a `providedIn: 'root'` singleton,\n * so the duplicate `inject(TraceService)` resolves to the same instance and the\n * Router subscription is wired exactly once.\n */\nexport function provideAllStakRouterInstrumentation(): EnvironmentProviders {\n return makeEnvironmentProviders([\n TraceService,\n {\n provide: APP_INITIALIZER,\n multi: true,\n useFactory: () => {\n // Force-instantiate the service; the factory itself is a no-op.\n inject(TraceService);\n return () => undefined;\n },\n },\n ]);\n}\n","import {\n APP_INITIALIZER,\n ErrorHandler,\n InjectionToken,\n NgModule,\n Optional,\n} from '@angular/core';\nimport type { ModuleWithProviders } from '@angular/core';\nimport type { AllStakConfig } from '@allstak/js';\nimport { init } from './init';\nimport { createErrorHandler } from './error-handler';\nimport { TraceService } from './trace-service';\nimport { TraceDirective } from './trace-directive';\n\n/** DI token carrying the config passed to {@link AllStakModule.forRoot}. */\nexport const ALLSTAK_CONFIG = new InjectionToken<AllStakConfig>('ALLSTAK_CONFIG');\n\n/**\n * NgModule that exposes {@link TraceDirective} for module-based apps (or\n * standalone components that prefer NgModule-style `imports`):\n *\n * @NgModule({ imports: [AllStakTraceModule] })\n * export class AppModule {}\n *\n * <app-checkout trace=\"checkout\"></app-checkout>\n *\n * `TraceDirective` is a standalone directive, so it is imported (not declared)\n * and re-exported.\n */\n@NgModule({\n imports: [TraceDirective],\n exports: [TraceDirective],\n})\nexport class AllStakTraceModule {}\n\n/**\n * Root NgModule for module-based Angular apps.\n *\n * import { AllStakModule } from '@allstak/angular';\n *\n * @NgModule({\n * imports: [\n * BrowserModule,\n * AllStakModule.forRoot({ apiKey: environment.allstakApiKey }),\n * ],\n * })\n * export class AppModule {}\n *\n * `forRoot(config)`:\n * - calls {@link init} during bootstrap (via `APP_INITIALIZER`);\n * - overrides the global `ErrorHandler` with the AllStak handler;\n * - force-instantiates {@link TraceService} so router navigation spans open;\n * - exposes {@link TraceDirective} via {@link AllStakTraceModule}.\n *\n * Call `forRoot` exactly once, in your root module. Feature modules that only\n * need the `[trace]` directive can import {@link AllStakTraceModule} directly.\n */\n@NgModule({\n imports: [AllStakTraceModule],\n exports: [AllStakTraceModule],\n})\nexport class AllStakModule {\n // Inject TraceService here so importing the module force-instantiates it and\n // its Router subscription runs. `@Optional` keeps router-less apps working.\n constructor(@Optional() _trace: TraceService | null) {}\n\n static forRoot(config: AllStakConfig): ModuleWithProviders<AllStakModule> {\n return {\n ngModule: AllStakModule,\n providers: [\n { provide: ALLSTAK_CONFIG, useValue: config },\n { provide: ErrorHandler, useValue: createErrorHandler() },\n TraceService,\n {\n provide: APP_INITIALIZER,\n multi: true,\n useFactory: appInitializerFactory,\n deps: [ALLSTAK_CONFIG, TraceService],\n },\n ],\n };\n }\n}\n\n/**\n * `APP_INITIALIZER` factory: initialises the SDK from the injected config and\n * touches `TraceService` so it is constructed (its constructor wires the\n * Router subscription). Declared as a named function so ng-packagr's partial\n * compiler can statically reference it (no arrow-in-decorator-metadata error).\n */\nexport function appInitializerFactory(\n config: AllStakConfig,\n // TraceService is injected via `deps` purely to force its construction.\n _trace: TraceService,\n): () => void {\n return () => {\n init(config);\n };\n}\n","/**\n * AllStak for Angular.\n *\n * Public surface:\n * - `init` — bootstrap (delegates to @allstak/js with Angular tagging)\n * - `createErrorHandler` / `AllStakErrorHandler` — Angular `ErrorHandler` forwarding to captureException\n * - `AllStakHttpInterceptor` / `allStakHttpInterceptor` — records outbound requests + opens spans\n * - `TraceService` — Router-aware navigation span instrumentation\n * - `TraceDirective` / `AllStakTraceModule` — `[trace]` component render-timing directive\n * - `TraceClassDecorator` / `TraceMethodDecorator` — lifecycle-span decorators\n * - `provideAllStak` / `provideAllStakErrorHandler` / `provideAllStakRouterInstrumentation`\n * — standalone provider functions\n * - `AllStakModule.forRoot(config)` — NgModule registration for module-based apps\n * - re-exports — every top-level @allstak/js export\n */\n\n// Bootstrap.\nexport { init } from './src/init';\nexport type { AllStakClientInstance } from './src/init';\n\n// Error handling.\nexport {\n createErrorHandler,\n AllStakErrorHandler,\n} from './src/error-handler';\nexport type { ErrorHandlerOptions } from './src/error-handler';\n\n// HTTP instrumentation.\nexport {\n AllStakHttpInterceptor,\n allStakHttpInterceptor,\n} from './src/http-interceptor';\n\n// Router / navigation instrumentation.\nexport { TraceService } from './src/trace-service';\n\n// Component render-timing directive + module.\nexport { TraceDirective } from './src/trace-directive';\n\n// Lifecycle-span decorators.\nexport {\n TraceClass,\n TraceClassDecorator,\n TraceMethod,\n TraceMethodDecorator,\n} from './src/trace-decorators';\nexport type { TraceDecoratorOptions } from './src/trace-decorators';\n\n// Standalone provider functions.\nexport {\n provideAllStak,\n provideAllStakErrorHandler,\n provideAllStakRouterInstrumentation,\n} from './src/providers';\n\n// NgModule registration for module-based apps.\nexport {\n AllStakModule,\n AllStakTraceModule,\n ALLSTAK_CONFIG,\n appInitializerFactory,\n} from './src/module';\n\n// Wrapper identity.\nexport { SDK_NAME, SDK_VERSION } from './src/version';\n\n// ---------------------------------------------------------------------------\n// Mirror the @allstak/js public surface so consumers can pull the entire\n// observability API from a single namespaced import:\n// import * as AllStakAngular from '@allstak/angular';\n// ---------------------------------------------------------------------------\nexport {\n AllStak,\n Scope,\n Session,\n SessionTracker,\n Span,\n WebVitalsModule,\n isWebVitalsSupported,\n defineIntegration,\n dedupeIntegration,\n consoleIntegration,\n httpClientIntegration,\n databaseIntegration,\n eventFiltersIntegration,\n inboundFiltersIntegration,\n} from '@allstak/js';\n\nexport type {\n AllStakConfig,\n AllStakIntegration,\n Breadcrumb,\n ErrorEvent,\n ErrorEventProcessor,\n LogEvent,\n LogLevel,\n HttpRequestItem,\n HeartbeatOptions,\n SpanData,\n SpanOptions,\n SpanProcessor,\n TracesSampler,\n SamplingContext,\n WebVitalsContext,\n DbQueryItem,\n SessionStatus,\n} from '@allstak/js';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.TraceService"],"mappings":";;;;;;;;;AAAA;AACO,MAAM,QAAQ,GAAG;AACjB,MAAM,WAAW,GAAG;;ACU3B;;;;;;;;;;;;;;;;;;;;;AAqBG;AACG,SAAU,IAAI,CAAC,MAAqB,EAAA;IACxC,OAAO,OAAO,CAAC,IAAI,CAAC;AAClB,QAAA,GAAG,MAAM;AACT,QAAA,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,QAAQ;AACnC,QAAA,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,WAAW;AAC7C,KAAA,CAAC;AACJ;;ACRA,MAAM,eAAe,GAAqD;AACxE,IAAA,SAAS,EAAE,IAAI;CAChB;AAED;;;;;;;;;AASG;AACH,SAAS,gBAAgB,CAAC,KAAc,EAAA;AACtC,IAAA,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QACtC,MAAM,SAAS,GAAG,KAAgC;;QAElD,IAAI,WAAW,IAAI,SAAS,IAAI,SAAS,CAAC,WAAW,CAAC,IAAI,IAAI,EAAE;AAC9D,YAAA,OAAO,gBAAgB,CAAC,SAAS,CAAC,WAAW,CAAC,C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AAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,kBAAkB,EAAE,EAAE;gBACzD,YAAY;AACZ,gBAAA;AACE,oBAAA,OAAO,EAAE,eAAe;AACxB,oBAAA,KAAK,EAAE,IAAI;AACX,oBAAA,UAAU,EAAE,qBAAqB;AACjC,oBAAA,IAAI,EAAE,CAAC,cAAc,EAAE,YAAY,CAAC;AACrC,iBAAA;AACF,aAAA;SACF;IACH;wGApBW,aAAa,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAAA,YAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;yGAAb,aAAa,EAAA,OAAA,EAAA,CA5Bb,kBAAkB,CAAA,EAAA,OAAA,EAAA,CAAlB,kBAAkB,CAAA,EAAA,CAAA;yGA4BlB,aAAa,EAAA,OAAA,EAAA,CAHd,kBAAkB,EAzBjB,kBAAkB,CAAA,EAAA,CAAA;;4FA4BlB,aAAa,EAAA,UAAA,EAAA,CAAA;kBAJzB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,kBAAkB,CAAC;oBAC7B,OAAO,EAAE,CAAC,kBAAkB,CAAC;AAC9B,iBAAA;;0BAIc;;AAoBf;;;;;AAKG;AACG,SAAU,qBAAqB,CACnC,MAAqB;AACrB;AACA,MAAoB,EAAA;AAEpB,IAAA,OAAO,MAAK;QACV,IAAI,CAAC,MAAM,CAAC;AACd,IAAA,CAAC;AACH;;AClGA;;;;;;;;;;;;;;AAcG;AAEH;;AChBA;;AAEG;;;;"}
|
package/package.json
CHANGED
package/src/providers.d.ts
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
import type { EnvironmentProviders, Provider } from '@angular/core';
|
|
2
2
|
import type { AllStakConfig } from '@allstak/js';
|
|
3
3
|
import type { ErrorHandlerOptions } from './error-handler';
|
|
4
|
+
/** Options controlling what `provideAllStak` auto-wires. */
|
|
5
|
+
export interface ProvideAllStakOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Auto-instrument the Angular `Router` so a `navigation` span + breadcrumb
|
|
8
|
+
* opens per route change, with no extra provider.
|
|
9
|
+
*
|
|
10
|
+
* Default `true`. Folding the router instrumentation into `provideAllStak`
|
|
11
|
+
* means a `provideAllStak()`-only app gets navigation spans automatically;
|
|
12
|
+
* previously they only fired if {@link provideAllStakRouterInstrumentation}
|
|
13
|
+
* was also added. Force-instantiating {@link TraceService} when
|
|
14
|
+
* `@angular/router` is absent is harmless — the service becomes a no-op
|
|
15
|
+
* because its `Router` dependency is `@Optional()`.
|
|
16
|
+
*
|
|
17
|
+
* Set to `false` only if you need to opt out of automatic navigation
|
|
18
|
+
* instrumentation entirely.
|
|
19
|
+
*/
|
|
20
|
+
router?: boolean;
|
|
21
|
+
}
|
|
4
22
|
/**
|
|
5
23
|
* Bootstrap the AllStak SDK from a standalone app's `appConfig.providers`.
|
|
6
24
|
*
|
|
@@ -16,8 +34,16 @@ import type { ErrorHandlerOptions } from './error-handler';
|
|
|
16
34
|
* to catch errors thrown *during bootstrap itself*, prefer calling `init(...)`
|
|
17
35
|
* directly in `main.ts` before `bootstrapApplication`; this provider is the
|
|
18
36
|
* convenient alternative for apps that initialise inside the DI graph.
|
|
37
|
+
*
|
|
38
|
+
* Router/navigation instrumentation is folded in by default — a
|
|
39
|
+
* `provideAllStak()`-only standalone app gets a `navigation` span + breadcrumb
|
|
40
|
+
* per route change with no extra wiring. It is a no-op when `@angular/router`
|
|
41
|
+
* is not present (the `Router` dependency is `@Optional()`). Opt out with
|
|
42
|
+
* `provideAllStak(config, { router: false })`. The standalone
|
|
43
|
+
* {@link provideAllStakRouterInstrumentation} remains exported for explicit use
|
|
44
|
+
* and is idempotent if also added alongside `provideAllStak`.
|
|
19
45
|
*/
|
|
20
|
-
export declare function provideAllStak(config: AllStakConfig): EnvironmentProviders;
|
|
46
|
+
export declare function provideAllStak(config: AllStakConfig, options?: ProvideAllStakOptions): EnvironmentProviders;
|
|
21
47
|
/**
|
|
22
48
|
* Provide the AllStak `ErrorHandler` (overriding Angular's default) so every
|
|
23
49
|
* error routed through Angular's global error handling is captured.
|
|
@@ -37,5 +63,14 @@ export declare function provideAllStakErrorHandler(options?: ErrorHandlerOptions
|
|
|
37
63
|
* service when something injects it. The `APP_INITIALIZER` below injects it
|
|
38
64
|
* during bootstrap, guaranteeing the subscription is live before the first
|
|
39
65
|
* navigation completes.
|
|
66
|
+
*
|
|
67
|
+
* As of the navigation-auto-wire change, {@link provideAllStak} already folds
|
|
68
|
+
* this in by default, so most standalone apps no longer need to add this
|
|
69
|
+
* provider explicitly. It remains exported for apps that disable the fold with
|
|
70
|
+
* `provideAllStak(config, { router: false })` but still want navigation spans,
|
|
71
|
+
* or that bootstrap `init` outside the DI graph. Adding it alongside
|
|
72
|
+
* `provideAllStak` is safe: `TraceService` is a `providedIn: 'root'` singleton,
|
|
73
|
+
* so the duplicate `inject(TraceService)` resolves to the same instance and the
|
|
74
|
+
* Router subscription is wired exactly once.
|
|
40
75
|
*/
|
|
41
76
|
export declare function provideAllStakRouterInstrumentation(): EnvironmentProviders;
|
package/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const SDK_NAME = "allstak-angular";
|
|
2
|
-
export declare const SDK_VERSION = "0.
|
|
2
|
+
export declare const SDK_VERSION = "0.2.0";
|