@dasasian/firebase-structured-logger 1.2.0 → 1.3.0-rc.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/README.md +125 -33
- package/dist/client/breadcrumbs.d.ts +35 -6
- package/dist/client/breadcrumbs.d.ts.map +1 -1
- package/dist/client/breadcrumbs.js +87 -10
- package/dist/client/breadcrumbs.js.map +1 -1
- package/dist/client/logger.d.ts.map +1 -1
- package/dist/client/logger.js +2 -7
- package/dist/client/logger.js.map +1 -1
- package/dist/client/navigation/adapterShared.d.ts +18 -0
- package/dist/client/navigation/adapterShared.d.ts.map +1 -0
- package/dist/client/navigation/adapterShared.js +49 -0
- package/dist/client/navigation/adapterShared.js.map +1 -0
- package/dist/client/navigation/react-router.d.ts +30 -0
- package/dist/client/navigation/react-router.d.ts.map +1 -0
- package/dist/client/navigation/react-router.js +57 -0
- package/dist/client/navigation/react-router.js.map +1 -0
- package/dist/client/navigation/vue-router.d.ts +28 -0
- package/dist/client/navigation/vue-router.d.ts.map +1 -0
- package/dist/client/navigation/vue-router.js +47 -0
- package/dist/client/navigation/vue-router.js.map +1 -0
- package/dist/client/navigation.d.ts +29 -4
- package/dist/client/navigation.d.ts.map +1 -1
- package/dist/client/navigation.js +60 -4
- package/dist/client/navigation.js.map +1 -1
- package/dist/shared/types.d.ts +14 -9
- package/dist/shared/types.d.ts.map +1 -1
- package/package.json +23 -3
- package/skills/logs/SKILL.md +20 -13
- package/skills/query-logs/SKILL.md +1 -1
package/README.md
CHANGED
|
@@ -513,7 +513,7 @@ logger.error(err, { orderId })
|
|
|
513
513
|
|---|---|---|
|
|
514
514
|
| `appId`, `releaseId` | client | your `initLogger` config |
|
|
515
515
|
| `screen` | client | tracked as the user moves |
|
|
516
|
-
| `route`, `path
|
|
516
|
+
| `route`, `path` | client | with navigation on — the route pattern and the real path (`routeSource` too, deprecated) |
|
|
517
517
|
| `userId` | client | `setUser`, held for the session |
|
|
518
518
|
| `platform` | client | user agent — `ios` / `android` / `macos` / `web` |
|
|
519
519
|
| `browser` | client | user agent |
|
|
@@ -578,9 +578,10 @@ export const logger = initLogger<MyAppLabels>({ /* … */ })
|
|
|
578
578
|
|
|
579
579
|
logger.setUser(uid, { organizationId }) // on sign in — rides every log until cleared
|
|
580
580
|
logger.clearUser() // on sign out
|
|
581
|
-
logger.setScreen('checkout') // on navigation
|
|
582
581
|
```
|
|
583
582
|
|
|
583
|
+
The screen comes from navigation — see "Navigation, automatically".
|
|
584
|
+
|
|
584
585
|
**Backend** — scoped to the request:
|
|
585
586
|
|
|
586
587
|
```ts
|
|
@@ -604,10 +605,9 @@ from [setup](#logging-from-your-cloud-functions) is the same thing without that.
|
|
|
604
605
|
```ts
|
|
605
606
|
import { bc } from '@dasasian/firebase-structured-logger/client'
|
|
606
607
|
|
|
607
|
-
bc.nav('Checkout') // also sets labels.screen
|
|
608
608
|
bc.action('apply_discount', { code: 'SAVE10' })
|
|
609
609
|
bc.state('total_recalculated', { total: 42.00 })
|
|
610
|
-
bc.
|
|
610
|
+
bc.handledError('draft_save_failed', { attempt: 1 }) // an error you handled and did not log
|
|
611
611
|
```
|
|
612
612
|
|
|
613
613
|
A stack trace tells you where the code broke. It cannot tell you what the person did to
|
|
@@ -615,66 +615,143 @@ get there, which is usually the part you need to reproduce it. Breadcrumbs are t
|
|
|
615
615
|
a rolling record of the last steps, attached automatically to every error and every piece
|
|
616
616
|
of feedback, with no correlation work on your side.
|
|
617
617
|
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
tap_place_order`.
|
|
618
|
+
Turn on navigation, drop a `bc.action` before anything that can fail, and `total is wrong`
|
|
619
|
+
arrives as `Checkout · apply_discount · total_recalculated · tap_place_order`.
|
|
621
620
|
|
|
622
621
|
The trail is capped at **50 entries** and **5 minutes** — old enough to cover the steps that
|
|
623
622
|
led here, short enough that it stays the current attempt rather than the whole session, and
|
|
624
623
|
bounded so a long-lived tab cannot grow it without limit. It lives in memory only, so it
|
|
625
624
|
never touches storage and never leaves the device except attached to a log you send.
|
|
626
625
|
|
|
627
|
-
Breadcrumbs are session-global by design: one user, one path.
|
|
628
|
-
|
|
626
|
+
Breadcrumbs are session-global by design: one user, one path.
|
|
627
|
+
|
|
628
|
+
**Errors and breadcrumbs.** An error you log is already in the logs, in time order with
|
|
629
|
+
everything else the user did — it needs no breadcrumb too. `bc.handledError` is for the
|
|
630
|
+
other kind: an error your code handled and chose not to log, like a save that failed and
|
|
631
|
+
then worked on retry. It costs nothing unless something else goes wrong, and then the
|
|
632
|
+
trail shows it as a clue. (`bc.error`, its old name, warns once and is removed in 2.0.)
|
|
629
633
|
|
|
630
634
|
> Record the step, not the data. Breadcrumb `data` is written to your logs verbatim — keep
|
|
631
635
|
> PII, tokens and card numbers out of it, the same as you would for any label.
|
|
632
636
|
|
|
633
637
|
### Navigation, automatically
|
|
634
638
|
|
|
639
|
+
Where the user is has one way in for each kind of place:
|
|
640
|
+
|
|
641
|
+
| What changed | Record it with | Gives |
|
|
642
|
+
|---|---|---|
|
|
643
|
+
| a page, and the URL changed | `enableNavigation()`, or a router adapter — automatic | one `nav` breadcrumb; `screen`, `route` and `path` labels |
|
|
644
|
+
| a page, but the URL did not | `navigatedTo('Checkout')` | the same breadcrumb and labels |
|
|
645
|
+
| something inside or on top of a page | markup (`data-fsl-view`, planned in #58) | a `view` label |
|
|
646
|
+
|
|
635
647
|
```ts
|
|
636
|
-
import { enableNavigation } from '@dasasian/firebase-structured-logger/client/navigation'
|
|
648
|
+
import { enableNavigation, navigatedTo, defaultLabelsFor } from '@dasasian/firebase-structured-logger/client/navigation'
|
|
637
649
|
|
|
638
650
|
enableNavigation()
|
|
639
|
-
|
|
640
|
-
// or name routes the way your router does
|
|
641
|
-
enableNavigation({
|
|
642
|
-
routeFor: (path) => router.match(path)?.name, // undefined falls back to the id rule
|
|
643
|
-
})
|
|
644
651
|
```
|
|
645
652
|
|
|
646
653
|
Its own entry point, so an app that never imports it ships none of it, whatever its
|
|
647
654
|
bundler — and the import says plainly that it wraps `history.pushState` and
|
|
648
655
|
`replaceState`, the only way to notice a single-page app changing route. Call it once,
|
|
649
|
-
before or after `initLogger`. It records the current page at once and every
|
|
650
|
-
after it, back and forward included,
|
|
651
|
-
labels:
|
|
656
|
+
before or after `initLogger`. It records the current page at once and every page change
|
|
657
|
+
after it, back and forward included, and every entry carries:
|
|
652
658
|
|
|
653
659
|
| Label | Example | Means |
|
|
654
660
|
|---|---|---|
|
|
655
661
|
| `route` | `/orders/:id/items` | the pattern — for grouping and counting |
|
|
656
662
|
| `path` | `/orders/1042/items` | the real path — for "what went wrong for order 1042?" |
|
|
657
|
-
| `
|
|
663
|
+
| `screen` | `OrderItems`, or the route when there is no name | the page's name |
|
|
664
|
+
| `routeSource` | `pattern` | **deprecated, removed in 2.0** — set only by the default labels |
|
|
665
|
+
|
|
666
|
+
**The default — the id rule.** A path segment that is all digits, a UUID, a long hex
|
|
667
|
+
string or a ULID becomes `:id`; anything else is kept as written, so a slug like
|
|
668
|
+
`/blog/my-post` stays as it is. `screen` is the route.
|
|
669
|
+
|
|
670
|
+
**Your own labels — `labelsFor`.** One function: it gets the real path and returns the
|
|
671
|
+
labels for it. Whatever it returns is used exactly as returned, and a field it leaves out
|
|
672
|
+
is not logged.
|
|
673
|
+
|
|
674
|
+
```ts
|
|
675
|
+
enableNavigation({
|
|
676
|
+
labelsFor: (path) => ({ ...defaultLabelsFor(path), screen: path.startsWith('/admin') ? 'Admin' : undefined }),
|
|
677
|
+
})
|
|
678
|
+
```
|
|
679
|
+
|
|
680
|
+
It must be synchronous — it runs inside your router's own `pushState` — and if it throws,
|
|
681
|
+
that page gets `defaultLabelsFor(path)` and the console says so once.
|
|
682
|
+
|
|
683
|
+
**With React Router or Vue Router — an adapter.** Your router already knows each page's
|
|
684
|
+
pattern and name, so the adapter asks it instead of guessing from the path. It listens to
|
|
685
|
+
the router's own events and does not wrap `history`; `labelsFor` does not apply to it.
|
|
686
|
+
|
|
687
|
+
```ts
|
|
688
|
+
// Vue Router 4
|
|
689
|
+
import { enableVueRouterNavigation } from '@dasasian/firebase-structured-logger/client/navigation/vue-router'
|
|
690
|
+
enableVueRouterNavigation(router)
|
|
691
|
+
|
|
692
|
+
// React Router 6.4+ or 7, data router (createBrowserRouter and friends)
|
|
693
|
+
import { enableReactRouterNavigation } from '@dasasian/firebase-structured-logger/client/navigation/react-router'
|
|
694
|
+
enableReactRouterNavigation(router)
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
| Label | Vue Router | React Router |
|
|
698
|
+
|---|---|---|
|
|
699
|
+
| `route` | the full pattern of the deepest match, `/orders/:id/items` | the same, joined from each match's `path`, without the `basename` |
|
|
700
|
+
| `screen` | the `name` of the deepest matched route that has one | `handle.screen` of the deepest match that has one |
|
|
701
|
+
| `path` | `to.path` — never the query or hash | `location.pathname` |
|
|
702
|
+
|
|
703
|
+
No name anywhere in the match → `screen` is the route. Vue names that are symbols are
|
|
704
|
+
skipped. One page change is one breadcrumb: a React Router redirect records only the page
|
|
705
|
+
it ends on, and a Vue navigation that was blocked or cancelled records nothing.
|
|
706
|
+
|
|
707
|
+
One option, `adjust`, takes the router's labels and returns the ones to log — for
|
|
708
|
+
cleaning personal data out of a path:
|
|
658
709
|
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
710
|
+
```ts
|
|
711
|
+
enableVueRouterNavigation(router, {
|
|
712
|
+
adjust: (labels) => ({ ...labels, path: labels.path?.replace(/[^/]+@[^/]+/g, ':email') }),
|
|
713
|
+
})
|
|
714
|
+
```
|
|
715
|
+
|
|
716
|
+
Each adapter returns a function that stops it. Calling an adapter again stops the first
|
|
717
|
+
one. If you call both an adapter and `enableNavigation()`, the adapter wins and the
|
|
718
|
+
console says so once. Neither router is a dependency of this package: the adapter only
|
|
719
|
+
reads the router you pass in.
|
|
720
|
+
|
|
721
|
+
**Without URL routing** — screens that switch without the address changing — call
|
|
722
|
+
`navigatedTo(screen, { route?, path? })` on each change. It records the same breadcrumb and
|
|
723
|
+
labels as automatic navigation.
|
|
724
|
+
|
|
725
|
+
**One breadcrumb per page change**, structured so it reads without parsing:
|
|
726
|
+
|
|
727
|
+
```
|
|
728
|
+
{ type: "nav", name: "OrderItems", data: { route: "/orders/:id/items", path: "/orders/1042/items" } }
|
|
729
|
+
```
|
|
662
730
|
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
written, so a slug like `/blog/my-post` stays as it is — no rule tells a slug from a page
|
|
666
|
-
name reliably, which is what `routeFor` is for.
|
|
731
|
+
`name` is the screen, else the route, else the path; `data.path` is absent when your
|
|
732
|
+
`labelsFor` leaves `path` out.
|
|
667
733
|
|
|
668
734
|
**What never leaves the browser:** the query string, always — it is where tokens and
|
|
669
735
|
emails usually ride. The fragment too, unless it is a route: `#/orders/1042` is read as the
|
|
670
|
-
path, `#section-3` or `#access_token=…` is dropped.
|
|
671
|
-
personal data
|
|
736
|
+
path, `#section-3` or `#access_token=…` is dropped. `labelsFor` receives the path already
|
|
737
|
+
stripped. If your paths themselves can hold personal data, clean them there:
|
|
672
738
|
|
|
673
739
|
```ts
|
|
674
|
-
enableNavigation({
|
|
675
|
-
|
|
740
|
+
enableNavigation({
|
|
741
|
+
labelsFor: (path) => {
|
|
742
|
+
const labels = defaultLabelsFor(path)
|
|
743
|
+
return { ...labels, path: labels.path?.replace(/[^/]+@[^/]+/g, ':email') }
|
|
744
|
+
},
|
|
745
|
+
})
|
|
676
746
|
```
|
|
677
747
|
|
|
748
|
+
**With navigation on, `bc.nav` and `setScreen` are ignored** — they would record the same
|
|
749
|
+
page change twice — and the console says so once.
|
|
750
|
+
|
|
751
|
+
**Deprecated in 1.3, removed in 2.0:** `routeFor`, `cleanPath` and `path: false` (each
|
|
752
|
+
warns once; use `labelsFor`), the `routeSource` label, and `bc.nav` / `setScreen` (use
|
|
753
|
+
`enableNavigation`, or `navigatedTo` without URL routing).
|
|
754
|
+
|
|
678
755
|
## Timing: when something is too slow
|
|
679
756
|
|
|
680
757
|
Some failures never throw. A loading screen waits on eight pieces, one of them takes 30
|
|
@@ -1021,7 +1098,7 @@ logger.debug(message, labels?, context?, attachments?) // suppressed in producti
|
|
|
1021
1098
|
|
|
1022
1099
|
logger.setUser(uid, extraLabels?)
|
|
1023
1100
|
logger.clearUser()
|
|
1024
|
-
logger.setScreen(screen)
|
|
1101
|
+
logger.setScreen(screen) // deprecated in 1.3 — use navigation
|
|
1025
1102
|
logger.addBreadcrumb(type, name, data?)
|
|
1026
1103
|
|
|
1027
1104
|
```
|
|
@@ -1029,8 +1106,13 @@ logger.addBreadcrumb(type, name, data?)
|
|
|
1029
1106
|
Optional helpers are separate entry points, so an app ships only what it imports:
|
|
1030
1107
|
|
|
1031
1108
|
```ts
|
|
1032
|
-
import { enableNavigation } from '@dasasian/firebase-structured-logger/client/navigation'
|
|
1033
|
-
enableNavigation({
|
|
1109
|
+
import { enableNavigation, navigatedTo, defaultLabelsFor } from '@dasasian/firebase-structured-logger/client/navigation'
|
|
1110
|
+
enableNavigation({ labelsFor?: (path) => ({ route?, screen?, path? }) }) // see "Navigation, automatically"
|
|
1111
|
+
navigatedTo(screen, { route?, path? }) // a page change with no URL change
|
|
1112
|
+
|
|
1113
|
+
import { enableVueRouterNavigation } from '@dasasian/firebase-structured-logger/client/navigation/vue-router'
|
|
1114
|
+
import { enableReactRouterNavigation } from '@dasasian/firebase-structured-logger/client/navigation/react-router'
|
|
1115
|
+
const stop = enableVueRouterNavigation(router, { adjust?: (labels) => labels }) // the same for React Router
|
|
1034
1116
|
|
|
1035
1117
|
import { trace, startTrace, configureTraces } from '@dasasian/firebase-structured-logger/client/timing'
|
|
1036
1118
|
configureTraces({ name: { warnAfterMs?, steps?: { step: ms } } }) // see "Timing"
|
|
@@ -1053,6 +1135,16 @@ and are removed in 2.0:
|
|
|
1053
1135
|
| `triggerTestLog()` | `sendTestLog()` |
|
|
1054
1136
|
| `fsl upload-sourcemaps --functions=<dir>` | `--backend=<dir>` (it is not only for Cloud Functions) |
|
|
1055
1137
|
|
|
1138
|
+
**Deprecated in 1.3.** Still working in 1.x, each with a one-time console warning where
|
|
1139
|
+
code can warn; removed in 2.0:
|
|
1140
|
+
|
|
1141
|
+
| Old | New |
|
|
1142
|
+
|---|---|
|
|
1143
|
+
| `enableNavigation({ routeFor })`, `({ cleanPath })`, `({ path: false })` | `enableNavigation({ labelsFor })` |
|
|
1144
|
+
| label `routeSource` | none — `labelsFor`'s answer is final |
|
|
1145
|
+
| `bc.nav(screen)`, `logger.setScreen(screen)` | `enableNavigation()`, or `navigatedTo(screen)` without URL routing |
|
|
1146
|
+
| `bc.error(type, data?)` | `bc.handledError(type, data?)` — only for errors you handled and did not log |
|
|
1147
|
+
|
|
1056
1148
|
`Logger` is exported as a **type only** — the client logger is a session singleton, so
|
|
1057
1149
|
annotate with `Logger<MyAppLabels>` and construct with `initLogger()`. A second instance
|
|
1058
1150
|
would silently share breadcrumbs, screen and the rate-limit budget while looking independent.
|
|
@@ -13,25 +13,54 @@ import type { BreadcrumbEntry, NavigationLabels } from '../shared/types';
|
|
|
13
13
|
* would have reproduced the bug.
|
|
14
14
|
*/
|
|
15
15
|
export declare const MAX_BREADCRUMBS = 50;
|
|
16
|
+
/**
|
|
17
|
+
* Set by `enableNavigation()` and `navigatedTo()` (`client/navigation.ts`), never by
|
|
18
|
+
* the core itself — the setter a helper hands data through, mirroring `setCurrentRoute`.
|
|
19
|
+
* Once true, the legacy `bc.nav`/`setScreen` path is ignored: one page change must give
|
|
20
|
+
* exactly one `nav` breadcrumb, never two for the same event.
|
|
21
|
+
*/
|
|
22
|
+
export declare function setNavigationEnabled(enabled: boolean): void;
|
|
23
|
+
/** Called by a router adapter's own registration/`stop()` — never by the core itself. */
|
|
24
|
+
export declare function setAdapterActive(active: boolean): void;
|
|
25
|
+
export declare function isAdapterActive(): boolean;
|
|
26
|
+
/** Called once, by `enableNavigation()`, the first time it wraps `history`. */
|
|
27
|
+
export declare function noteHistoryWrapperWired(): void;
|
|
28
|
+
/** @deprecated Use `enableNavigation()`, or `navigatedTo()` without URL routing. */
|
|
16
29
|
export declare function setCurrentScreen(screen: string): void;
|
|
17
30
|
export declare function getCurrentScreen(): string | undefined;
|
|
18
31
|
/**
|
|
19
|
-
* Called by `enableNavigation()` (`client/navigation.ts`) on
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
32
|
+
* Called by `enableNavigation()` and `navigatedTo()` (`client/navigation.ts`) on every
|
|
33
|
+
* page change — never by the core itself. Mirrors `setNavigationEnabled`: the one-way
|
|
34
|
+
* setter a helper hands data through, rather than the core reaching out to the helper.
|
|
35
|
+
* Adds one `nav` breadcrumb named after `labels.screen`, else `labels.route`, else
|
|
36
|
+
* `labels.path`; `labels` itself is stored exactly as given, so a field left out of it
|
|
37
|
+
* stays absent from the entry labels built from `getCurrentRoute()`.
|
|
24
38
|
*/
|
|
25
39
|
export declare function setCurrentRoute(labels: NavigationLabels): void;
|
|
26
|
-
/** The current page's navigation labels, or `undefined` when
|
|
40
|
+
/** The current page's navigation labels, or `undefined` when navigation was never turned on. */
|
|
27
41
|
export declare function getCurrentRoute(): NavigationLabels | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* The screen to label an entry with right now — navigation's, when it has one,
|
|
44
|
+
* else the legacy `setScreen`/`bc.nav` value. Written once so the label and the
|
|
45
|
+
* repeat signature can never read two different answers to the same question.
|
|
46
|
+
*/
|
|
47
|
+
export declare function getActiveScreen(): string | undefined;
|
|
28
48
|
export declare function addBreadcrumb(type: BreadcrumbEntry['type'], name: string, data?: Record<string, unknown>): void;
|
|
29
49
|
export declare function getLastBreadcrumbs(count: number): BreadcrumbEntry[];
|
|
30
50
|
export declare function clearBreadcrumbs(): void;
|
|
51
|
+
/**
|
|
52
|
+
* One way in for each kind of breadcrumb (CLAUDE.md, "Where the user is"). `nav` and
|
|
53
|
+
* `error` are deprecated — `enableNavigation()`/`navigatedTo()` and `handledError`
|
|
54
|
+
* replace them — and each still works, warning once.
|
|
55
|
+
*/
|
|
31
56
|
export declare const bc: {
|
|
32
57
|
action: (name: string, data?: Record<string, unknown>) => void;
|
|
33
58
|
state: (name: string, data?: Record<string, unknown>) => void;
|
|
59
|
+
/** @deprecated Use `enableNavigation()`, or `navigatedTo()` without URL routing. */
|
|
34
60
|
nav: (screen: string) => void;
|
|
61
|
+
/** @deprecated Use `bc.handledError` — only for an error your code handled and did not log. */
|
|
35
62
|
error: (type: string, data?: Record<string, unknown>) => void;
|
|
63
|
+
/** An error your code handled and chose not to log — a clue if something else goes wrong. */
|
|
64
|
+
handledError: (type: string, data?: Record<string, unknown>) => void;
|
|
36
65
|
};
|
|
37
66
|
//# sourceMappingURL=breadcrumbs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumbs.d.ts","sourceRoot":"","sources":["../../src/client/breadcrumbs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"breadcrumbs.d.ts","sourceRoot":"","sources":["../../src/client/breadcrumbs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAGxE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,eAAe,KAAK,CAAA;AAMjC;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAE3D;AAgBD,yFAAyF;AACzF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAGtD;AAED,wBAAgB,eAAe,IAAI,OAAO,CAEzC;AAED,+EAA+E;AAC/E,wBAAgB,uBAAuB,IAAI,IAAI,CAG9C;AAQD,oFAAoF;AACpF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAGrD;AAOD,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,SAAS,CAErD;AAID;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAM9D;AAED,gGAAgG;AAChG,wBAAgB,eAAe,IAAI,gBAAgB,GAAG,SAAS,CAE9D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,MAAM,GAAG,SAAS,CAEpD;AAoBD,wBAAgB,aAAa,CAC3B,IAAI,EAAE,eAAe,CAAC,MAAM,CAAC,EAC7B,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,IAAI,CAQN;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,eAAe,EAAE,CAKnE;AAED,wBAAgB,gBAAgB,IAAI,IAAI,CAGvC;AAED;;;;GAIG;AACH,eAAO,MAAM,EAAE;mBACE,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;kBACvC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACpD,oFAAoF;kBACtE,MAAM;IACpB,+FAA+F;kBACjF,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAIpD,6FAA6F;yBACxE,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAC5D,CAAA"}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.bc = exports.MAX_BREADCRUMBS = void 0;
|
|
4
|
+
exports.setNavigationEnabled = setNavigationEnabled;
|
|
5
|
+
exports.setAdapterActive = setAdapterActive;
|
|
6
|
+
exports.isAdapterActive = isAdapterActive;
|
|
7
|
+
exports.noteHistoryWrapperWired = noteHistoryWrapperWired;
|
|
4
8
|
exports.setCurrentScreen = setCurrentScreen;
|
|
5
9
|
exports.getCurrentScreen = getCurrentScreen;
|
|
6
10
|
exports.setCurrentRoute = setCurrentRoute;
|
|
7
11
|
exports.getCurrentRoute = getCurrentRoute;
|
|
12
|
+
exports.getActiveScreen = getActiveScreen;
|
|
8
13
|
exports.addBreadcrumb = addBreadcrumb;
|
|
9
14
|
exports.getLastBreadcrumbs = getLastBreadcrumbs;
|
|
10
15
|
exports.clearBreadcrumbs = clearBreadcrumbs;
|
|
16
|
+
const deprecate_1 = require("../shared/deprecate");
|
|
11
17
|
/**
|
|
12
18
|
* How many breadcrumbs are retained — and therefore how many are sent.
|
|
13
19
|
*
|
|
@@ -25,29 +31,88 @@ exports.MAX_BREADCRUMBS = 50;
|
|
|
25
31
|
const MAX_AGE_MS = 5 * 60 * 1000; // 5 minutes
|
|
26
32
|
let currentScreen;
|
|
27
33
|
let breadcrumbs = [];
|
|
28
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Set by `enableNavigation()` and `navigatedTo()` (`client/navigation.ts`), never by
|
|
36
|
+
* the core itself — the setter a helper hands data through, mirroring `setCurrentRoute`.
|
|
37
|
+
* Once true, the legacy `bc.nav`/`setScreen` path is ignored: one page change must give
|
|
38
|
+
* exactly one `nav` breadcrumb, never two for the same event.
|
|
39
|
+
*/
|
|
40
|
+
function setNavigationEnabled(enabled) {
|
|
41
|
+
navigationEnabled = enabled;
|
|
42
|
+
}
|
|
43
|
+
let navigationEnabled = false;
|
|
44
|
+
let adapterActive = false;
|
|
45
|
+
let historyWrapperWired = false;
|
|
46
|
+
let adapterWinsWarned = false;
|
|
47
|
+
function warnAdapterWins() {
|
|
48
|
+
if (adapterWinsWarned)
|
|
49
|
+
return;
|
|
50
|
+
adapterWinsWarned = true;
|
|
51
|
+
console.warn('[fsl] a router adapter and enableNavigation() are both active — the adapter wins, and the history wrapper stops recording.');
|
|
52
|
+
}
|
|
53
|
+
/** Called by a router adapter's own registration/`stop()` — never by the core itself. */
|
|
54
|
+
function setAdapterActive(active) {
|
|
55
|
+
if (active && historyWrapperWired)
|
|
56
|
+
warnAdapterWins();
|
|
57
|
+
adapterActive = active;
|
|
58
|
+
}
|
|
59
|
+
function isAdapterActive() {
|
|
60
|
+
return adapterActive;
|
|
61
|
+
}
|
|
62
|
+
/** Called once, by `enableNavigation()`, the first time it wraps `history`. */
|
|
63
|
+
function noteHistoryWrapperWired() {
|
|
64
|
+
if (adapterActive)
|
|
65
|
+
warnAdapterWins();
|
|
66
|
+
historyWrapperWired = true;
|
|
67
|
+
}
|
|
68
|
+
function recordScreenChange(screen) {
|
|
69
|
+
if (navigationEnabled)
|
|
70
|
+
return;
|
|
29
71
|
currentScreen = screen;
|
|
30
72
|
addBreadcrumb('nav', `navigate_${screen}`);
|
|
31
73
|
}
|
|
74
|
+
/** @deprecated Use `enableNavigation()`, or `navigatedTo()` without URL routing. */
|
|
75
|
+
function setCurrentScreen(screen) {
|
|
76
|
+
(0, deprecate_1.warnDeprecated)('setScreen', 'enableNavigation(), or navigatedTo() without URL routing');
|
|
77
|
+
recordScreenChange(screen);
|
|
78
|
+
}
|
|
79
|
+
function legacyNav(screen) {
|
|
80
|
+
(0, deprecate_1.warnDeprecated)('bc.nav', 'enableNavigation(), or navigatedTo() without URL routing');
|
|
81
|
+
recordScreenChange(screen);
|
|
82
|
+
}
|
|
32
83
|
function getCurrentScreen() {
|
|
33
84
|
return currentScreen;
|
|
34
85
|
}
|
|
35
86
|
let currentRoute;
|
|
36
87
|
/**
|
|
37
|
-
* Called by `enableNavigation()` (`client/navigation.ts`) on
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
88
|
+
* Called by `enableNavigation()` and `navigatedTo()` (`client/navigation.ts`) on every
|
|
89
|
+
* page change — never by the core itself. Mirrors `setNavigationEnabled`: the one-way
|
|
90
|
+
* setter a helper hands data through, rather than the core reaching out to the helper.
|
|
91
|
+
* Adds one `nav` breadcrumb named after `labels.screen`, else `labels.route`, else
|
|
92
|
+
* `labels.path`; `labels` itself is stored exactly as given, so a field left out of it
|
|
93
|
+
* stays absent from the entry labels built from `getCurrentRoute()`.
|
|
42
94
|
*/
|
|
43
95
|
function setCurrentRoute(labels) {
|
|
44
96
|
currentRoute = labels;
|
|
45
|
-
|
|
97
|
+
const data = {};
|
|
98
|
+
if (labels.route !== undefined)
|
|
99
|
+
data.route = labels.route;
|
|
100
|
+
if (labels.path !== undefined)
|
|
101
|
+
data.path = labels.path;
|
|
102
|
+
addBreadcrumb('nav', labels.screen ?? labels.route ?? labels.path ?? '', Object.keys(data).length > 0 ? data : undefined);
|
|
46
103
|
}
|
|
47
|
-
/** The current page's navigation labels, or `undefined` when
|
|
104
|
+
/** The current page's navigation labels, or `undefined` when navigation was never turned on. */
|
|
48
105
|
function getCurrentRoute() {
|
|
49
106
|
return currentRoute;
|
|
50
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* The screen to label an entry with right now — navigation's, when it has one,
|
|
110
|
+
* else the legacy `setScreen`/`bc.nav` value. Written once so the label and the
|
|
111
|
+
* repeat signature can never read two different answers to the same question.
|
|
112
|
+
*/
|
|
113
|
+
function getActiveScreen() {
|
|
114
|
+
return currentRoute?.screen ?? currentScreen;
|
|
115
|
+
}
|
|
51
116
|
/**
|
|
52
117
|
* Drop anything past the age cutoff.
|
|
53
118
|
*
|
|
@@ -84,10 +149,22 @@ function clearBreadcrumbs() {
|
|
|
84
149
|
breadcrumbs = [];
|
|
85
150
|
currentScreen = undefined;
|
|
86
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* One way in for each kind of breadcrumb (CLAUDE.md, "Where the user is"). `nav` and
|
|
154
|
+
* `error` are deprecated — `enableNavigation()`/`navigatedTo()` and `handledError`
|
|
155
|
+
* replace them — and each still works, warning once.
|
|
156
|
+
*/
|
|
87
157
|
exports.bc = {
|
|
88
158
|
action: (name, data) => addBreadcrumb('action', name, data),
|
|
89
159
|
state: (name, data) => addBreadcrumb('state', name, data),
|
|
90
|
-
|
|
91
|
-
|
|
160
|
+
/** @deprecated Use `enableNavigation()`, or `navigatedTo()` without URL routing. */
|
|
161
|
+
nav: (screen) => legacyNav(screen),
|
|
162
|
+
/** @deprecated Use `bc.handledError` — only for an error your code handled and did not log. */
|
|
163
|
+
error: (type, data) => {
|
|
164
|
+
(0, deprecate_1.warnDeprecated)('bc.error', 'bc.handledError');
|
|
165
|
+
addBreadcrumb('error', type, data);
|
|
166
|
+
},
|
|
167
|
+
/** An error your code handled and chose not to log — a clue if something else goes wrong. */
|
|
168
|
+
handledError: (type, data) => addBreadcrumb('error', type, data),
|
|
92
169
|
};
|
|
93
170
|
//# sourceMappingURL=breadcrumbs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumbs.js","sourceRoot":"","sources":["../../src/client/breadcrumbs.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"breadcrumbs.js","sourceRoot":"","sources":["../../src/client/breadcrumbs.ts"],"names":[],"mappings":";;;AA4BA,oDAEC;AAiBD,4CAGC;AAED,0CAEC;AAGD,0DAGC;AASD,4CAGC;AAOD,4CAEC;AAYD,0CAMC;AAGD,0CAEC;AAOD,0CAEC;AAoBD,sCAYC;AAED,gDAKC;AAED,4CAGC;AA5JD,mDAAoD;AAEpD;;;;;;;;;;;;GAYG;AACU,QAAA,eAAe,GAAG,EAAE,CAAA;AACjC,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAA,CAAC,YAAY;AAE7C,IAAI,aAAiC,CAAA;AACrC,IAAI,WAAW,GAAsB,EAAE,CAAA;AAEvC;;;;;GAKG;AACH,SAAgB,oBAAoB,CAAC,OAAgB;IACnD,iBAAiB,GAAG,OAAO,CAAA;AAC7B,CAAC;AAED,IAAI,iBAAiB,GAAG,KAAK,CAAA;AAE7B,IAAI,aAAa,GAAG,KAAK,CAAA;AACzB,IAAI,mBAAmB,GAAG,KAAK,CAAA;AAC/B,IAAI,iBAAiB,GAAG,KAAK,CAAA;AAE7B,SAAS,eAAe;IACtB,IAAI,iBAAiB;QAAE,OAAM;IAC7B,iBAAiB,GAAG,IAAI,CAAA;IAC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AAS,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EACzF,MAAM,EAAE,gBAAgB,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC,CAYxD;AAED,wBAAgB,eAAe,CAC7B,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,KACtF,MAAM,CAAC,SAAS,CAAC,CAGrB"}
|
package/dist/client/logger.js
CHANGED
|
@@ -105,7 +105,7 @@ class Logger {
|
|
|
105
105
|
errorType: error.name || 'UnknownError',
|
|
106
106
|
...labels,
|
|
107
107
|
};
|
|
108
|
-
void this.send(error.message, 'ERROR', errorLabels, context, attachments, (0, error_1.toErrorPayload)(error), (0, rateLimiter_1.signatureFor)(error, (0, breadcrumbs_1.
|
|
108
|
+
void this.send(error.message, 'ERROR', errorLabels, context, attachments, (0, error_1.toErrorPayload)(error), (0, rateLimiter_1.signatureFor)(error, (0, breadcrumbs_1.getActiveScreen)()));
|
|
109
109
|
}
|
|
110
110
|
info(message, labels, context, attachments) {
|
|
111
111
|
void this.send(message, 'INFO', labels, context, attachments);
|
|
@@ -146,16 +146,11 @@ class Logger {
|
|
|
146
146
|
skipBudget = false, timestamp) {
|
|
147
147
|
if (!bypassVolumeControls && severity_1.SEVERITY_ORDER[severity] > this.minLevel)
|
|
148
148
|
return false;
|
|
149
|
-
// Set only by enableNavigation() (@dasasian/firebase-structured-logger/client/navigation),
|
|
150
|
-
// through the setter it calls in breadcrumbs.ts — undefined for an app that never
|
|
151
|
-
// imports that entry point.
|
|
152
149
|
const nav = (0, breadcrumbs_1.getCurrentRoute)();
|
|
153
150
|
const allLabels = {
|
|
154
151
|
appId: this.config.appId,
|
|
155
152
|
releaseId: this.config.releaseId,
|
|
156
|
-
|
|
157
|
-
// still gets a useful screen label once navigation is enabled.
|
|
158
|
-
screen: (0, breadcrumbs_1.getCurrentScreen)() ?? nav?.route,
|
|
153
|
+
screen: (0, breadcrumbs_1.getActiveScreen)(),
|
|
159
154
|
route: nav?.route,
|
|
160
155
|
path: nav?.path,
|
|
161
156
|
routeSource: nav?.routeSource,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/client/logger.ts"],"names":[],"mappings":";;;AA0aA,oCAIC;AAWD,kCAWC;AAGD,wCAGC;AAKD,gCAcC;AAED,0CAKC;AAneD,iDAAmE;AACnE,2CAAyD;AACzD,mDAAoD;AACpD,+CAQsB;AACtB,+CAUsB;AA2BtB;;;;;;;;GAQG;AACH,SAAS,eAAe;IACtB,IAAI,CAAC;QACH,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;YAAE,OAAO,SAAS,CAAA;IAC7D,CAAC;IAAC,MAAM,CAAC;QACP,wCAAwC;IAC1C,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,oCAAoC;AACpC,MAAM,SAAS,GAAuB;IACpC,CAAC,kBAAkB,EAAE,KAAK,CAAC;IAC3B,CAAC,SAAS,EAAE,SAAS,CAAC;IACtB,CAAC,KAAK,EAAE,OAAO,CAAC;IAChB,CAAC,KAAK,EAAE,SAAS,CAAC;IAClB,CAAC,OAAO,EAAE,OAAO,CAAC;CACnB,CAAA;AAED,MAAM,QAAQ,GAAuB;IACnC,CAAC,SAAS,EAAE,SAAS,CAAC;IACtB,CAAC,KAAK,EAAE,MAAM,CAAC;IACf,CAAC,QAAQ,EAAE,QAAQ,CAAC;IACpB,CAAC,QAAQ,EAAE,QAAQ,CAAC;CACrB,CAAA;AAED,SAAS,cAAc,CAAC,KAAyB,EAAE,QAAgB;IACjE,IAAI,OAAO,SAAS,KAAK,WAAW;QAAE,OAAO,SAAS,CAAA;IACtD,MAAM,EAAE,GAAG,SAAS,CAAC,SAAS,CAAA;IAC9B,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,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ClC,CAAC,EAAE,MAAM,CAAC,CACT;IAAC,QAA8C,CAAC,KAAK,EAAE,EAAE,CAAA;AAC5D,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { NavigationLabels } from '../../shared/types';
|
|
2
|
+
type Stop = () => void;
|
|
3
|
+
/**
|
|
4
|
+
* Registers a new adapter as the one in force. The previous adapter's own `stop` runs
|
|
5
|
+
* after `activeStop` already points at the new one, so its call back into
|
|
6
|
+
* `clearAdapterStop` — guarded by identity — is a no-op rather than undoing this call.
|
|
7
|
+
*/
|
|
8
|
+
export declare function registerAdapterStop(stop: Stop): void;
|
|
9
|
+
/** Called by an adapter's own `stop()`. Only clears state it still owns. */
|
|
10
|
+
export declare function clearAdapterStop(stop: Stop): void;
|
|
11
|
+
/**
|
|
12
|
+
* Wraps a router adapter's `adjust` option: its answer is used as returned, and a
|
|
13
|
+
* throwing `adjust` falls back to the router's own labels with one console warning
|
|
14
|
+
* — however many times it throws for this adapter instance.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createAdjuster(adjust: ((labels: NavigationLabels) => NavigationLabels) | undefined): (labels: NavigationLabels) => NavigationLabels;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=adapterShared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapterShared.d.ts","sourceRoot":"","sources":["../../../src/client/navigation/adapterShared.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE1D,KAAK,IAAI,GAAG,MAAM,IAAI,CAAA;AAItB;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAMpD;AAED,4EAA4E;AAC5E,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAIjD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,gBAAgB,KAAK,gBAAgB,CAAC,GAAG,SAAS,GACnE,CAAC,MAAM,EAAE,gBAAgB,KAAK,gBAAgB,CAchD"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerAdapterStop = registerAdapterStop;
|
|
4
|
+
exports.clearAdapterStop = clearAdapterStop;
|
|
5
|
+
exports.createAdjuster = createAdjuster;
|
|
6
|
+
const breadcrumbs_1 = require("../breadcrumbs");
|
|
7
|
+
let activeStop;
|
|
8
|
+
/**
|
|
9
|
+
* Registers a new adapter as the one in force. The previous adapter's own `stop` runs
|
|
10
|
+
* after `activeStop` already points at the new one, so its call back into
|
|
11
|
+
* `clearAdapterStop` — guarded by identity — is a no-op rather than undoing this call.
|
|
12
|
+
*/
|
|
13
|
+
function registerAdapterStop(stop) {
|
|
14
|
+
const previous = activeStop;
|
|
15
|
+
activeStop = stop;
|
|
16
|
+
(0, breadcrumbs_1.setNavigationEnabled)(true);
|
|
17
|
+
(0, breadcrumbs_1.setAdapterActive)(true);
|
|
18
|
+
previous?.();
|
|
19
|
+
}
|
|
20
|
+
/** Called by an adapter's own `stop()`. Only clears state it still owns. */
|
|
21
|
+
function clearAdapterStop(stop) {
|
|
22
|
+
if (activeStop !== stop)
|
|
23
|
+
return;
|
|
24
|
+
activeStop = undefined;
|
|
25
|
+
(0, breadcrumbs_1.setAdapterActive)(false);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Wraps a router adapter's `adjust` option: its answer is used as returned, and a
|
|
29
|
+
* throwing `adjust` falls back to the router's own labels with one console warning
|
|
30
|
+
* — however many times it throws for this adapter instance.
|
|
31
|
+
*/
|
|
32
|
+
function createAdjuster(adjust) {
|
|
33
|
+
let warned = false;
|
|
34
|
+
return (labels) => {
|
|
35
|
+
if (!adjust)
|
|
36
|
+
return labels;
|
|
37
|
+
try {
|
|
38
|
+
return adjust(labels);
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
if (!warned) {
|
|
42
|
+
warned = true;
|
|
43
|
+
console.warn('[fsl] adjust threw — using the router\'s own labels for this page:', err instanceof Error ? err.message : err);
|
|
44
|
+
}
|
|
45
|
+
return labels;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=adapterShared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapterShared.js","sourceRoot":"","sources":["../../../src/client/navigation/adapterShared.ts"],"names":[],"mappings":";;AAYA,kDAMC;AAGD,4CAIC;AAOD,wCAgBC;AAhDD,gDAAuE;AAKvE,IAAI,UAA4B,CAAA;AAEhC;;;;GAIG;AACH,SAAgB,mBAAmB,CAAC,IAAU;IAC5C,MAAM,QAAQ,GAAG,UAAU,CAAA;IAC3B,UAAU,GAAG,IAAI,CAAA;IACjB,IAAA,kCAAoB,EAAC,IAAI,CAAC,CAAA;IAC1B,IAAA,8BAAgB,EAAC,IAAI,CAAC,CAAA;IACtB,QAAQ,EAAE,EAAE,CAAA;AACd,CAAC;AAED,4EAA4E;AAC5E,SAAgB,gBAAgB,CAAC,IAAU;IACzC,IAAI,UAAU,KAAK,IAAI;QAAE,OAAM;IAC/B,UAAU,GAAG,SAAS,CAAA;IACtB,IAAA,8BAAgB,EAAC,KAAK,CAAC,CAAA;AACzB,CAAC;AAED;;;;GAIG;AACH,SAAgB,cAAc,CAC5B,MAAoE;IAEpE,IAAI,MAAM,GAAG,KAAK,CAAA;IAClB,OAAO,CAAC,MAAwB,EAAoB,EAAE;QACpD,IAAI,CAAC,MAAM;YAAE,OAAO,MAAM,CAAA;QAC1B,IAAI,CAAC;YACH,OAAO,MAAM,CAAC,MAAM,CAAC,CAAA;QACvB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,GAAG,IAAI,CAAA;gBACb,OAAO,CAAC,IAAI,CAAC,oEAAoE,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;YAC9H,CAAC;YACD,OAAO,MAAM,CAAA;QACf,CAAC;IACH,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { NavigationLabels } from '../../shared/types';
|
|
2
|
+
export interface ReactRouteLike {
|
|
3
|
+
path?: string;
|
|
4
|
+
handle?: unknown;
|
|
5
|
+
}
|
|
6
|
+
export interface ReactRouteMatchLike {
|
|
7
|
+
route: ReactRouteLike;
|
|
8
|
+
}
|
|
9
|
+
export interface ReactRouterStateLike {
|
|
10
|
+
location: {
|
|
11
|
+
pathname: string;
|
|
12
|
+
key: string;
|
|
13
|
+
};
|
|
14
|
+
matches: ReactRouteMatchLike[];
|
|
15
|
+
}
|
|
16
|
+
export interface ReactRouterLike {
|
|
17
|
+
subscribe(listener: (state: ReactRouterStateLike) => void): () => void;
|
|
18
|
+
state: ReactRouterStateLike;
|
|
19
|
+
}
|
|
20
|
+
export interface ReactRouterNavigationOptions {
|
|
21
|
+
/** A throwing `adjust` falls back to the router's own labels, warning once. */
|
|
22
|
+
adjust?: (labels: NavigationLabels) => NavigationLabels;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Needs a data router (`createBrowserRouter`, `createHashRouter`, `createMemoryRouter`).
|
|
26
|
+
* One crumb per `location.key`, so a redirect records only the page it ends on. `path`
|
|
27
|
+
* keeps the `basename`; `route` never has it. A second call stops the first.
|
|
28
|
+
*/
|
|
29
|
+
export declare function enableReactRouterNavigation(router: ReactRouterLike, options?: ReactRouterNavigationOptions): () => void;
|
|
30
|
+
//# sourceMappingURL=react-router.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-router.d.ts","sourceRoot":"","sources":["../../../src/client/navigation/react-router.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE1D,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,cAAc,CAAA;CACtB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAA;IAC3C,OAAO,EAAE,mBAAmB,EAAE,CAAA;CAC/B;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,GAAG,MAAM,IAAI,CAAA;IACtE,KAAK,EAAE,oBAAoB,CAAA;CAC5B;AAED,MAAM,WAAW,4BAA4B;IAC3C,+EAA+E;IAC/E,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,gBAAgB,CAAA;CACxD;AA2BD;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,eAAe,EACvB,OAAO,GAAE,4BAAiC,GACzC,MAAM,IAAI,CAyBZ"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.enableReactRouterNavigation = enableReactRouterNavigation;
|
|
4
|
+
const breadcrumbs_1 = require("../breadcrumbs");
|
|
5
|
+
const adapterShared_1 = require("./adapterShared");
|
|
6
|
+
function joinRoutePath(matches) {
|
|
7
|
+
let joined = '';
|
|
8
|
+
for (const match of matches) {
|
|
9
|
+
const path = match.route.path;
|
|
10
|
+
if (path === undefined)
|
|
11
|
+
continue;
|
|
12
|
+
joined = path.startsWith('/') ? path : `${joined}/${path}`;
|
|
13
|
+
}
|
|
14
|
+
return joined.replace(/\/{2,}/g, '/');
|
|
15
|
+
}
|
|
16
|
+
function deepestHandleScreen(matches) {
|
|
17
|
+
for (let i = matches.length - 1; i >= 0; i--) {
|
|
18
|
+
const handle = matches[i].route.handle;
|
|
19
|
+
if (handle && typeof handle === 'object' && typeof handle.screen === 'string') {
|
|
20
|
+
return handle.screen;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
function labelsFromState(state) {
|
|
26
|
+
const route = joinRoutePath(state.matches);
|
|
27
|
+
return { route, screen: deepestHandleScreen(state.matches) ?? route, path: state.location.pathname };
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Needs a data router (`createBrowserRouter`, `createHashRouter`, `createMemoryRouter`).
|
|
31
|
+
* One crumb per `location.key`, so a redirect records only the page it ends on. `path`
|
|
32
|
+
* keeps the `basename`; `route` never has it. A second call stops the first.
|
|
33
|
+
*/
|
|
34
|
+
function enableReactRouterNavigation(router, options = {}) {
|
|
35
|
+
const adjustLabels = (0, adapterShared_1.createAdjuster)(options.adjust);
|
|
36
|
+
let stopped = false;
|
|
37
|
+
let lastKey = router.state.location.key;
|
|
38
|
+
const unsubscribe = router.subscribe((state) => {
|
|
39
|
+
if (state.location.key === lastKey)
|
|
40
|
+
return;
|
|
41
|
+
lastKey = state.location.key;
|
|
42
|
+
(0, breadcrumbs_1.setCurrentRoute)(adjustLabels(labelsFromState(state)));
|
|
43
|
+
});
|
|
44
|
+
function stop() {
|
|
45
|
+
if (stopped)
|
|
46
|
+
return;
|
|
47
|
+
stopped = true;
|
|
48
|
+
unsubscribe();
|
|
49
|
+
(0, adapterShared_1.clearAdapterStop)(stop);
|
|
50
|
+
}
|
|
51
|
+
(0, adapterShared_1.registerAdapterStop)(stop);
|
|
52
|
+
if (router.state.matches.length > 0) {
|
|
53
|
+
(0, breadcrumbs_1.setCurrentRoute)(adjustLabels(labelsFromState(router.state)));
|
|
54
|
+
}
|
|
55
|
+
return stop;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=react-router.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-router.js","sourceRoot":"","sources":["../../../src/client/navigation/react-router.ts"],"names":[],"mappings":";;AA0DA,kEA4BC;AAtFD,gDAAgD;AAChD,mDAAuF;AA2BvF,SAAS,aAAa,CAAC,OAA8B;IACnD,IAAI,MAAM,GAAG,EAAE,CAAA;IACf,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAA;QAC7B,IAAI,IAAI,KAAK,SAAS;YAAE,SAAQ;QAChC,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,IAAI,EAAE,CAAA;IAC5D,CAAC;IACD,OAAO,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAA;AACvC,CAAC;AAED,SAAS,mBAAmB,CAAC,OAA8B;IACzD,KAAK,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC7C,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAA;QACtC,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,OAAQ,MAA+B,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;YACxG,OAAQ,MAA6B,CAAC,MAAM,CAAA;QAC9C,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,SAAS,eAAe,CAAC,KAA2B;IAClD,MAAM,KAAK,GAAG,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,mBAAmB,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAA;AACtG,CAAC;AAED;;;;GAIG;AACH,SAAgB,2BAA2B,CACzC,MAAuB,EACvB,UAAwC,EAAE;IAE1C,MAAM,YAAY,GAAG,IAAA,8BAAc,EAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IACnD,IAAI,OAAO,GAAG,KAAK,CAAA;IACnB,IAAI,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAA;IAEvC,MAAM,WAAW,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE;QAC7C,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,KAAK,OAAO;YAAE,OAAM;QAC1C,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAA;QAC5B,IAAA,6BAAe,EAAC,YAAY,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IACvD,CAAC,CAAC,CAAA;IAEF,SAAS,IAAI;QACX,IAAI,OAAO;YAAE,OAAM;QACnB,OAAO,GAAG,IAAI,CAAA;QACd,WAAW,EAAE,CAAA;QACb,IAAA,gCAAgB,EAAC,IAAI,CAAC,CAAA;IACxB,CAAC;IAED,IAAA,mCAAmB,EAAC,IAAI,CAAC,CAAA;IAEzB,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpC,IAAA,6BAAe,EAAC,YAAY,CAAC,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IAC9D,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { NavigationLabels } from '../../shared/types';
|
|
2
|
+
/** `path` is already the deepest match's full resolved pattern, e.g. `/orders/:id/items`. */
|
|
3
|
+
export interface VueRouteRecordLike {
|
|
4
|
+
path: string;
|
|
5
|
+
name?: string | symbol;
|
|
6
|
+
}
|
|
7
|
+
export interface VueRouteLocationLike {
|
|
8
|
+
path: string;
|
|
9
|
+
matched: VueRouteRecordLike[];
|
|
10
|
+
}
|
|
11
|
+
export interface VueRouterLike {
|
|
12
|
+
afterEach(guard: (to: VueRouteLocationLike, from: VueRouteLocationLike, failure: unknown) => void): () => void;
|
|
13
|
+
currentRoute: {
|
|
14
|
+
value: VueRouteLocationLike;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export interface VueRouterNavigationOptions {
|
|
18
|
+
/** A throwing `adjust` falls back to the router's own labels, warning once. */
|
|
19
|
+
adjust?: (labels: NavigationLabels) => NavigationLabels;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Listens with `router.afterEach`; never wraps `history`. Skips a navigation that
|
|
23
|
+
* failed (`failure` truthy) — a blocked or cancelled one records no crumb. `path` is
|
|
24
|
+
* always `to.path`, never `fullPath`, so a query string or hash never reaches a label.
|
|
25
|
+
* A second call stops the first.
|
|
26
|
+
*/
|
|
27
|
+
export declare function enableVueRouterNavigation(router: VueRouterLike, options?: VueRouterNavigationOptions): () => void;
|
|
28
|
+
//# sourceMappingURL=vue-router.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue-router.d.ts","sourceRoot":"","sources":["../../../src/client/navigation/vue-router.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE1D,6FAA6F;AAC7F,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,kBAAkB,EAAE,CAAA;CAC9B;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,CACP,KAAK,EAAE,CAAC,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,oBAAoB,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,GACtF,MAAM,IAAI,CAAA;IACb,YAAY,EAAE;QAAE,KAAK,EAAE,oBAAoB,CAAA;KAAE,CAAA;CAC9C;AAED,MAAM,WAAW,0BAA0B;IACzC,+EAA+E;IAC/E,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,gBAAgB,CAAA;CACxD;AAgBD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,aAAa,EACrB,OAAO,GAAE,0BAA+B,GACvC,MAAM,IAAI,CAwBZ"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.enableVueRouterNavigation = enableVueRouterNavigation;
|
|
4
|
+
const breadcrumbs_1 = require("../breadcrumbs");
|
|
5
|
+
const adapterShared_1 = require("./adapterShared");
|
|
6
|
+
function deepestNamedScreen(matched) {
|
|
7
|
+
for (let i = matched.length - 1; i >= 0; i--) {
|
|
8
|
+
const name = matched[i].name;
|
|
9
|
+
if (typeof name === 'string')
|
|
10
|
+
return name;
|
|
11
|
+
}
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
function labelsFromRoute(to) {
|
|
15
|
+
const deepest = to.matched[to.matched.length - 1];
|
|
16
|
+
const route = deepest ? deepest.path : to.path;
|
|
17
|
+
return { route, screen: deepestNamedScreen(to.matched) ?? route, path: to.path };
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Listens with `router.afterEach`; never wraps `history`. Skips a navigation that
|
|
21
|
+
* failed (`failure` truthy) — a blocked or cancelled one records no crumb. `path` is
|
|
22
|
+
* always `to.path`, never `fullPath`, so a query string or hash never reaches a label.
|
|
23
|
+
* A second call stops the first.
|
|
24
|
+
*/
|
|
25
|
+
function enableVueRouterNavigation(router, options = {}) {
|
|
26
|
+
const adjustLabels = (0, adapterShared_1.createAdjuster)(options.adjust);
|
|
27
|
+
let stopped = false;
|
|
28
|
+
const unregister = router.afterEach((to, _from, failure) => {
|
|
29
|
+
if (failure)
|
|
30
|
+
return;
|
|
31
|
+
(0, breadcrumbs_1.setCurrentRoute)(adjustLabels(labelsFromRoute(to)));
|
|
32
|
+
});
|
|
33
|
+
function stop() {
|
|
34
|
+
if (stopped)
|
|
35
|
+
return;
|
|
36
|
+
stopped = true;
|
|
37
|
+
unregister();
|
|
38
|
+
(0, adapterShared_1.clearAdapterStop)(stop);
|
|
39
|
+
}
|
|
40
|
+
(0, adapterShared_1.registerAdapterStop)(stop);
|
|
41
|
+
const startingRoute = router.currentRoute.value;
|
|
42
|
+
if (startingRoute.matched.length > 0) {
|
|
43
|
+
(0, breadcrumbs_1.setCurrentRoute)(adjustLabels(labelsFromRoute(startingRoute)));
|
|
44
|
+
}
|
|
45
|
+
return stop;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=vue-router.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue-router.js","sourceRoot":"","sources":["../../../src/client/navigation/vue-router.ts"],"names":[],"mappings":";;AA+CA,8DA2BC;AA1ED,gDAAgD;AAChD,mDAAuF;AA0BvF,SAAS,kBAAkB,CAAC,OAA6B;IACvD,KAAK,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC7C,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;QAC5B,IAAI,OAAO,IAAI,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAA;IAC3C,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,SAAS,eAAe,CAAC,EAAwB;IAC/C,MAAM,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IACj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-logger/client/navigation` — its own entry point
|
|
3
4
|
* (see CLAUDE.md, "Optional client helpers are separate entry points") so an app
|
|
@@ -5,14 +6,23 @@
|
|
|
5
6
|
* once, before or after `initLogger`. See README, "Navigation, automatically".
|
|
6
7
|
*/
|
|
7
8
|
export interface NavigationOptions {
|
|
8
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* The single customisation point. Receives the real path, already stripped of its
|
|
11
|
+
* query string and any non-route fragment, and returns the labels for that page —
|
|
12
|
+
* used exactly as returned; a field left out is not logged. Must be synchronous: it
|
|
13
|
+
* runs inside your router's own `pushState`. If it throws, that page gets
|
|
14
|
+
* `defaultLabelsFor(path)` and the console warns once, however often it throws.
|
|
15
|
+
*/
|
|
16
|
+
labelsFor?: (path: string) => NavigationLabels;
|
|
17
|
+
/** @deprecated Use `labelsFor`. Names the route the way your router does. Returning `undefined` falls back to the id rule. */
|
|
9
18
|
routeFor?: (path: string) => string | undefined;
|
|
10
19
|
/**
|
|
11
|
-
* Runs on the real path before it is stored and before
|
|
12
|
-
* for paths that can themselves hold personal data,
|
|
20
|
+
* @deprecated Use `labelsFor`. Runs on the real path before it is stored and before
|
|
21
|
+
* `routeFor`/the id rule sees it — for paths that can themselves hold personal data,
|
|
22
|
+
* e.g. `/users/jane@example.com`.
|
|
13
23
|
*/
|
|
14
24
|
cleanPath?: (path: string) => string;
|
|
15
|
-
/** `false` omits the `path` label, and keeps the real path out of breadcrumbs too. */
|
|
25
|
+
/** @deprecated Use `labelsFor`. `false` omits the `path` label, and keeps the real path out of breadcrumbs too. */
|
|
16
26
|
path?: false;
|
|
17
27
|
}
|
|
18
28
|
/**
|
|
@@ -23,6 +33,21 @@ export interface NavigationOptions {
|
|
|
23
33
|
* no rule tells those from a page name reliably, which is what `routeFor` is for.
|
|
24
34
|
*/
|
|
25
35
|
export declare function routePattern(path: string): string;
|
|
36
|
+
/**
|
|
37
|
+
* The labels `enableNavigation()` gives when no `labelsFor` is passed: the id-rule
|
|
38
|
+
* `route`, `screen` equal to `route`, the stripped `path`, and the deprecated
|
|
39
|
+
* `routeSource: 'pattern'`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function defaultLabelsFor(path: string): NavigationLabels;
|
|
42
|
+
/**
|
|
43
|
+
* The same breadcrumb and labels as automatic navigation (`enableNavigation()`), for a
|
|
44
|
+
* screen that changes without the URL changing. Counts as navigation being on, the same
|
|
45
|
+
* as `enableNavigation()` — the legacy `bc.nav`/`setScreen` path is ignored from then on.
|
|
46
|
+
*/
|
|
47
|
+
export declare function navigatedTo(screen: string, extra?: {
|
|
48
|
+
route?: string;
|
|
49
|
+
path?: string;
|
|
50
|
+
}): void;
|
|
26
51
|
/**
|
|
27
52
|
* Turns on automatic navigation tracking for the session. The first call wraps
|
|
28
53
|
* `history.pushState`/`replaceState` and listens for `popstate`, then records the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/client/navigation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/client/navigation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAEvD;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,gBAAgB,CAAA;IAC9C,8HAA8H;IAC9H,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAA;IAC/C;;;;OAIG;IACH,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;IACpC,mHAAmH;IACnH,IAAI,CAAC,EAAE,KAAK,CAAA;CACb;AAWD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKjD;AAiBD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAG/D;AAqCD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,IAAI,CAM/F;AA8BD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,GAAE,iBAAsB,GAAG,IAAI,CAezE"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.routePattern = routePattern;
|
|
4
|
+
exports.defaultLabelsFor = defaultLabelsFor;
|
|
5
|
+
exports.navigatedTo = navigatedTo;
|
|
4
6
|
exports.enableNavigation = enableNavigation;
|
|
5
7
|
const breadcrumbs_1 = require("./breadcrumbs");
|
|
8
|
+
const deprecate_1 = require("../shared/deprecate");
|
|
6
9
|
const ALL_DIGITS = /^\d+$/;
|
|
7
10
|
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
8
11
|
const LONG_HEX = /^[0-9a-f]{16,}$/i;
|
|
@@ -32,17 +35,61 @@ function realPath(location) {
|
|
|
32
35
|
const raw = location.hash.startsWith('#/') ? location.hash.slice(1) : location.pathname;
|
|
33
36
|
return raw.split('?')[0] ?? raw;
|
|
34
37
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
/**
|
|
39
|
+
* The labels `enableNavigation()` gives when no `labelsFor` is passed: the id-rule
|
|
40
|
+
* `route`, `screen` equal to `route`, the stripped `path`, and the deprecated
|
|
41
|
+
* `routeSource: 'pattern'`.
|
|
42
|
+
*/
|
|
43
|
+
function defaultLabelsFor(path) {
|
|
44
|
+
const route = routePattern(path);
|
|
45
|
+
return { route, screen: route, path, routeSource: 'pattern' };
|
|
46
|
+
}
|
|
47
|
+
function legacyLabelsFor(path) {
|
|
38
48
|
const cleaned = options.cleanPath ? options.cleanPath(path) : path;
|
|
39
49
|
const fromRouter = options.routeFor?.(cleaned);
|
|
40
50
|
const route = fromRouter ?? routePattern(cleaned);
|
|
41
51
|
const routeSource = fromRouter !== undefined ? 'router' : 'pattern';
|
|
42
52
|
return options.path === false ? { route, routeSource } : { route, path: cleaned, routeSource };
|
|
43
53
|
}
|
|
54
|
+
let options = {};
|
|
55
|
+
let wired = false;
|
|
56
|
+
let labelsForThrew = false;
|
|
57
|
+
function resolveLabelsFor(path) {
|
|
58
|
+
if (options.labelsFor) {
|
|
59
|
+
try {
|
|
60
|
+
return options.labelsFor(path);
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
if (!labelsForThrew) {
|
|
64
|
+
labelsForThrew = true;
|
|
65
|
+
console.warn('[fsl] labelsFor threw — using the default labels for this page:', err instanceof Error ? err.message : err);
|
|
66
|
+
}
|
|
67
|
+
return defaultLabelsFor(path);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (options.routeFor !== undefined || options.cleanPath !== undefined || options.path === false) {
|
|
71
|
+
return legacyLabelsFor(path);
|
|
72
|
+
}
|
|
73
|
+
return defaultLabelsFor(path);
|
|
74
|
+
}
|
|
44
75
|
function recordNavigation() {
|
|
45
|
-
(0, breadcrumbs_1.
|
|
76
|
+
if ((0, breadcrumbs_1.isAdapterActive)())
|
|
77
|
+
return;
|
|
78
|
+
(0, breadcrumbs_1.setCurrentRoute)(resolveLabelsFor(realPath(location)));
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The same breadcrumb and labels as automatic navigation (`enableNavigation()`), for a
|
|
82
|
+
* screen that changes without the URL changing. Counts as navigation being on, the same
|
|
83
|
+
* as `enableNavigation()` — the legacy `bc.nav`/`setScreen` path is ignored from then on.
|
|
84
|
+
*/
|
|
85
|
+
function navigatedTo(screen, extra = {}) {
|
|
86
|
+
(0, breadcrumbs_1.setNavigationEnabled)(true);
|
|
87
|
+
const labels = { screen };
|
|
88
|
+
if (extra.route !== undefined)
|
|
89
|
+
labels.route = extra.route;
|
|
90
|
+
if (extra.path !== undefined)
|
|
91
|
+
labels.path = extra.path;
|
|
92
|
+
(0, breadcrumbs_1.setCurrentRoute)(labels);
|
|
46
93
|
}
|
|
47
94
|
// A Symbol.for registration, not a module-local Symbol — a second copy of this module
|
|
48
95
|
// (two bundles on one page) must still recognize the first copy's wrapper as "ours".
|
|
@@ -76,11 +123,20 @@ function wrapHistoryMethod(name) {
|
|
|
76
123
|
*/
|
|
77
124
|
function enableNavigation(newOptions = {}) {
|
|
78
125
|
options = newOptions;
|
|
126
|
+
labelsForThrew = false;
|
|
127
|
+
(0, breadcrumbs_1.setNavigationEnabled)(true);
|
|
128
|
+
if (newOptions.routeFor !== undefined)
|
|
129
|
+
(0, deprecate_1.warnDeprecated)('routeFor', 'labelsFor');
|
|
130
|
+
if (newOptions.cleanPath !== undefined)
|
|
131
|
+
(0, deprecate_1.warnDeprecated)('cleanPath', 'labelsFor');
|
|
132
|
+
if (newOptions.path === false)
|
|
133
|
+
(0, deprecate_1.warnDeprecated)('path: false', 'labelsFor');
|
|
79
134
|
if (typeof window === 'undefined')
|
|
80
135
|
return;
|
|
81
136
|
if (wired)
|
|
82
137
|
return;
|
|
83
138
|
wired = true;
|
|
139
|
+
(0, breadcrumbs_1.noteHistoryWrapperWired)();
|
|
84
140
|
wrapHistoryMethod('pushState');
|
|
85
141
|
wrapHistoryMethod('replaceState');
|
|
86
142
|
window.addEventListener('popstate', recordNavigation);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../src/client/navigation.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../src/client/navigation.ts"],"names":[],"mappings":";;AA+CA,oCAKC;AAsBD,4CAGC;AA0CD,kCAMC;AAqCD,4CAeC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;IACf,CAAC,CAAA;IACD,OAAO,CAAC,WAAW,CAAC,GAAG,IAAI,CAAA;IAC3B,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,CAAA;AACxB,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,gBAAgB,CAAC,aAAgC,EAAE;IACjE,OAAO,GAAG,UAAU,CAAA;IACpB,cAAc,GAAG,KAAK,CAAA;IACtB,IAAA,kCAAoB,EAAC,IAAI,CAAC,CAAA;IAC1B,IAAI,UAAU,CAAC,QAAQ,KAAK,SAAS;QAAE,IAAA,0BAAc,EAAC,UAAU,EAAE,WAAW,CAAC,CAAA;IAC9E,IAAI,UAAU,CAAC,SAAS,KAAK,SAAS;QAAE,IAAA,0BAAc,EAAC,WAAW,EAAE,WAAW,CAAC,CAAA;IAChF,IAAI,UAAU,CAAC,IAAI,KAAK,KAAK;QAAE,IAAA,0BAAc,EAAC,aAAa,EAAE,WAAW,CAAC,CAAA;IACzE,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAM;IACzC,IAAI,KAAK;QAAE,OAAM;IACjB,KAAK,GAAG,IAAI,CAAA;IACZ,IAAA,qCAAuB,GAAE,CAAA;IACzB,iBAAiB,CAAC,WAAW,CAAC,CAAA;IAC9B,iBAAiB,CAAC,cAAc,CAAC,CAAA;IACjC,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAA;IACrD,gBAAgB,EAAE,CAAA;AACpB,CAAC"}
|
package/dist/shared/types.d.ts
CHANGED
|
@@ -8,23 +8,28 @@ export interface BaseLabels {
|
|
|
8
8
|
releaseId?: string;
|
|
9
9
|
errorType?: string;
|
|
10
10
|
errorCategory?: string;
|
|
11
|
-
/** The route pattern, e.g. `/orders/:id/items`. Set by `enableNavigation()`. */
|
|
11
|
+
/** The route pattern, e.g. `/orders/:id/items`. Set by `enableNavigation()` or `navigatedTo()`. */
|
|
12
12
|
route?: string;
|
|
13
|
-
/** The real path, e.g. `/orders/1042/items`.
|
|
13
|
+
/** The real path, e.g. `/orders/1042/items`. Set by `enableNavigation()` or `navigatedTo()`. */
|
|
14
14
|
path?: string;
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Whether `route` came from the deprecated `routeFor` or the id rule.
|
|
17
|
+
* @deprecated Removed in 2.0 — a `labelsFor` answer is final and carries no source.
|
|
18
|
+
*/
|
|
16
19
|
routeSource?: 'router' | 'pattern';
|
|
17
20
|
}
|
|
18
21
|
/**
|
|
19
|
-
* What `enableNavigation()` (
|
|
20
|
-
*
|
|
21
|
-
* `client/breadcrumbs.ts`.
|
|
22
|
-
* given
|
|
22
|
+
* What `enableNavigation()` and `navigatedTo()` (both
|
|
23
|
+
* `@dasasian/firebase-structured-logger/client/navigation`) hand to the core logger for
|
|
24
|
+
* the current page, through `setCurrentRoute` in `client/breadcrumbs.ts`. Used exactly
|
|
25
|
+
* as given — a field left out is not logged — so every field is optional.
|
|
23
26
|
*/
|
|
24
27
|
export interface NavigationLabels {
|
|
25
|
-
route
|
|
28
|
+
route?: string;
|
|
29
|
+
screen?: string;
|
|
26
30
|
path?: string;
|
|
27
|
-
|
|
31
|
+
/** @deprecated Removed in 2.0. Set only by `defaultLabelsFor()` and the deprecated `routeFor`/`cleanPath`/`path: false`. */
|
|
32
|
+
routeSource?: 'router' | 'pattern';
|
|
28
33
|
}
|
|
29
34
|
export interface ErrorPayload {
|
|
30
35
|
message: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/shared/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAA;AAE3E,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB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,EAAE,WAAW,CAAA;IACrB,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;IACvD,WAAW,CAAC,EAAE;QACZ,WAAW,CAAC,EAAE,eAAe,EAAE,CAAA;QAC/B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QACjC,KAAK,CAAC,EAAE,YAAY,CAAA;KACrB,CAAA;IACD,2GAA2G;IAC3G,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACpC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,QAAQ,GAAG,OAAO,GAAG,KAAK,GAAG,OAAO,CAAA;IAC1C,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC/B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dasasian/firebase-structured-logger",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0-rc.0",
|
|
4
4
|
"description": "Structured logging for Firebase and Google Cloud web apps — browser, backend, and tools",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Dasasian",
|
|
@@ -38,6 +38,14 @@
|
|
|
38
38
|
"types": "./dist/client/navigation.d.ts",
|
|
39
39
|
"default": "./dist/client/navigation.js"
|
|
40
40
|
},
|
|
41
|
+
"./client/navigation/vue-router": {
|
|
42
|
+
"types": "./dist/client/navigation/vue-router.d.ts",
|
|
43
|
+
"default": "./dist/client/navigation/vue-router.js"
|
|
44
|
+
},
|
|
45
|
+
"./client/navigation/react-router": {
|
|
46
|
+
"types": "./dist/client/navigation/react-router.d.ts",
|
|
47
|
+
"default": "./dist/client/navigation/react-router.js"
|
|
48
|
+
},
|
|
41
49
|
"./client/timing": {
|
|
42
50
|
"types": "./dist/client/timing.d.ts",
|
|
43
51
|
"default": "./dist/client/timing.js"
|
|
@@ -59,6 +67,12 @@
|
|
|
59
67
|
"client/navigation": [
|
|
60
68
|
"dist/client/navigation.d.ts"
|
|
61
69
|
],
|
|
70
|
+
"client/navigation/vue-router": [
|
|
71
|
+
"dist/client/navigation/vue-router.d.ts"
|
|
72
|
+
],
|
|
73
|
+
"client/navigation/react-router": [
|
|
74
|
+
"dist/client/navigation/react-router.d.ts"
|
|
75
|
+
],
|
|
62
76
|
"client/timing": [
|
|
63
77
|
"dist/client/timing.d.ts"
|
|
64
78
|
],
|
|
@@ -82,7 +96,7 @@
|
|
|
82
96
|
"build:watch": "tsc --watch",
|
|
83
97
|
"clean": "rm -rf dist",
|
|
84
98
|
"typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.check.json",
|
|
85
|
-
"test": "tsx tests/logger.ts && tsx tests/browserBundle.ts && tsx tests/breadcrumbs.ts && tsx tests/navigation.ts && tsx tests/timing.ts && tsx tests/rateLimiter.ts && tsx tests/errorHandler.ts && tsx tests/attachments.ts && tsx tests/feedback.ts && tsx tests/paths.ts && tsx tests/loadsWithoutOptionalPeers.ts && tsx tests/sourceMapStripping.ts && FUNCTIONS_EMULATOR=true tsx tests/errorPayload.ts && FUNCTIONS_EMULATOR=true tsx tests/requestLogger.ts && FUNCTIONS_EMULATOR=true tsx tests/serverTrace.ts && FUNCTIONS_EMULATOR=true tsx tests/handler.ts && FUNCTIONS_EMULATOR=true tsx tests/httpHandler.ts && FUNCTIONS_EMULATOR=true tsx tests/symbolication.ts && FUNCTIONS_EMULATOR=true tsx tests/publicApi.ts && FUNCTIONS_EMULATOR=true tsx tests/configureTwice.ts && FUNCTIONS_EMULATOR=true tsx tests/deprecatedNames.ts && tsx tests/productionOutput.ts && tsx tests/storageChain.ts && tsx tests/entrySize.ts && tsx tests/handlerSymbolication.ts && tsx tests/releaseResolution.ts && tsx tests/sourceMapCacheBounds.ts && tsx tests/doctor.ts && tsx tests/doctorProcess.ts && tsx tests/uploadSourcemapsBackend.ts",
|
|
99
|
+
"test": "tsx tests/logger.ts && tsx tests/browserBundle.ts && tsx tests/breadcrumbs.ts && tsx tests/navigation.ts && tsx tests/vueRouterNavigation.ts && tsx tests/reactRouterNavigation.ts && tsx tests/timing.ts && tsx tests/rateLimiter.ts && tsx tests/errorHandler.ts && tsx tests/attachments.ts && tsx tests/feedback.ts && tsx tests/paths.ts && tsx tests/loadsWithoutOptionalPeers.ts && tsx tests/sourceMapStripping.ts && FUNCTIONS_EMULATOR=true tsx tests/errorPayload.ts && FUNCTIONS_EMULATOR=true tsx tests/requestLogger.ts && FUNCTIONS_EMULATOR=true tsx tests/serverTrace.ts && FUNCTIONS_EMULATOR=true tsx tests/handler.ts && FUNCTIONS_EMULATOR=true tsx tests/httpHandler.ts && FUNCTIONS_EMULATOR=true tsx tests/symbolication.ts && FUNCTIONS_EMULATOR=true tsx tests/publicApi.ts && FUNCTIONS_EMULATOR=true tsx tests/configureTwice.ts && FUNCTIONS_EMULATOR=true tsx tests/deprecatedNames.ts && tsx tests/productionOutput.ts && tsx tests/storageChain.ts && tsx tests/entrySize.ts && tsx tests/handlerSymbolication.ts && tsx tests/releaseResolution.ts && tsx tests/sourceMapCacheBounds.ts && tsx tests/doctor.ts && tsx tests/doctorProcess.ts && tsx tests/uploadSourcemapsBackend.ts",
|
|
86
100
|
"prepublishOnly": "npm run clean && npm run build",
|
|
87
101
|
"smoke:deploy": "cd smoke/functions && npm install && npm run build && cd .. && firebase deploy --only functions --project $(grep '^FSL_SMOKE_PROJECT=' .env.local | cut -d= -f2)",
|
|
88
102
|
"smoke:deploy:run": "bash smoke/cloudrun/deploy.sh",
|
|
@@ -119,8 +133,14 @@
|
|
|
119
133
|
"firebase-admin": "^14.5.0",
|
|
120
134
|
"firebase-functions": "^7.4.0",
|
|
121
135
|
"jsdom": "^30.1.1",
|
|
136
|
+
"react": "^19.3.0",
|
|
137
|
+
"react-dom": "^19.3.0",
|
|
138
|
+
"react-router-6": "npm:react-router@^6.30",
|
|
139
|
+
"react-router-7": "npm:react-router@^7.18",
|
|
122
140
|
"tsx": "^4.23.15",
|
|
123
|
-
"typescript": "~6.0.3"
|
|
141
|
+
"typescript": "~6.0.3",
|
|
142
|
+
"vue": "^3.5.43",
|
|
143
|
+
"vue-router": "^4.6.4"
|
|
124
144
|
},
|
|
125
145
|
"engines": {
|
|
126
146
|
"node": ">=22"
|
package/skills/logs/SKILL.md
CHANGED
|
@@ -58,23 +58,22 @@ Using the Explore agent's output, check the target file against the rules below.
|
|
|
58
58
|
Breadcrumbs reconstruct what the user was doing before an error — a session timeline, not just a wrapper around service calls. They belong primarily in components and screens, not service files.
|
|
59
59
|
|
|
60
60
|
UX-layer breadcrumbs to check for (flag if missing):
|
|
61
|
-
-
|
|
62
|
-
-
|
|
63
|
-
- Tab switches → `bc.action('switch_tab', { tab })`
|
|
61
|
+
- Page changes → `enableNavigation()` once at startup (or `navigatedTo('ScreenName')` when the URL does not change). Flag hand-written `bc.nav` / `setScreen` — deprecated, and ignored once navigation is on
|
|
62
|
+
- Opening a modal or switching a tab → `bc.action('open_item_modal', { itemId })`, `bc.action('switch_tab', { tab })` — the step the user took
|
|
64
63
|
- Explicit user decisions → `bc.action('merge_chosen')`, `bc.action('discard_changes')`
|
|
65
64
|
- Scan/camera events → `bc.action('barcode_scanned', { barcode })`
|
|
66
65
|
|
|
67
66
|
Service-layer breadcrumbs (secondary — useful but not sufficient on their own):
|
|
68
67
|
- Before a Firestore/API call → `bc.action('save_item', { itemId })`
|
|
69
|
-
-
|
|
68
|
+
- An error the code handled and did not log (a retry that worked) → `bc.handledError('save_failed', { itemId })`. An error that is logged needs no breadcrumb — flag `bc.handledError` next to a `logger.error` for the same failure as redundant
|
|
70
69
|
|
|
71
70
|
**A component file with no UX-layer breadcrumbs is almost certainly missing them. A service file with only service-layer breadcrumbs may be fine.**
|
|
72
71
|
|
|
73
72
|
API:
|
|
74
73
|
- `bc.action(name: string, data?)` — user-initiated operations and decisions
|
|
75
74
|
- `bc.state(name: string, data?)` — significant state changes
|
|
76
|
-
- `bc.
|
|
77
|
-
- `bc
|
|
75
|
+
- `bc.handledError(type: string, data?)` — an error handled and not logged (`bc.error` is its deprecated old name)
|
|
76
|
+
- Page changes are not a `bc.*` call — see navigation below
|
|
78
77
|
|
|
79
78
|
**Label completeness**
|
|
80
79
|
- For each function, check which `AppLabels` fields are in scope as variables
|
|
@@ -166,18 +165,26 @@ Import `bc` from `firebase-structured-logger/client`:
|
|
|
166
165
|
```ts
|
|
167
166
|
bc.action(name: string, data?: Record<string, unknown>): void // before operations
|
|
168
167
|
bc.state(name: string, data?: Record<string, unknown>): void // on state changes
|
|
169
|
-
bc.
|
|
170
|
-
bc.error(type: string, data?: Record<string, unknown>): void // on errors
|
|
168
|
+
bc.handledError(type: string, data?: Record<string, unknown>): void // an error handled, not logged
|
|
171
169
|
```
|
|
170
|
+
`bc.nav` and `bc.error` are deprecated in 1.3 and removed in 2.0 — flag them.
|
|
172
171
|
|
|
173
172
|
Import `enableNavigation` from `firebase-structured-logger/client/navigation`:
|
|
174
173
|
```ts
|
|
175
|
-
enableNavigation(options?: {
|
|
174
|
+
enableNavigation(options?: { labelsFor?: (path: string) => { route?: string; screen?: string; path?: string } }): void
|
|
175
|
+
navigatedTo(screen: string, labels?: { route?: string; path?: string }): void
|
|
176
|
+
defaultLabelsFor(path: string): { route: string; screen: string; path: string }
|
|
176
177
|
```
|
|
177
|
-
- Call once at startup. Every
|
|
178
|
-
gets `route` (the pattern, `/orders/:id`), `path` (the real path) and `
|
|
179
|
-
-
|
|
180
|
-
|
|
178
|
+
- Call `enableNavigation` once at startup. Every page change becomes one `nav` breadcrumb, and
|
|
179
|
+
every entry gets `route` (the pattern, `/orders/:id`), `path` (the real path) and `screen`.
|
|
180
|
+
- `labelsFor` names routes the app's own way; it must be synchronous. Flag the deprecated
|
|
181
|
+
`routeFor`, `cleanPath` and `path: false` options — `labelsFor` replaces all three.
|
|
182
|
+
- Suggest `navigatedTo` only for apps whose screens change without the URL changing.
|
|
183
|
+
- An app on Vue Router 4 or a React Router data router (6.4+, 7) should use the adapter
|
|
184
|
+
instead: `enableVueRouterNavigation(router)` from `/client/navigation/vue-router`, or
|
|
185
|
+
`enableReactRouterNavigation(router)` from `/client/navigation/react-router`. It takes
|
|
186
|
+
names from the router (Vue route `name`, React `handle.screen`). Flag a `labelsFor` that
|
|
187
|
+
re-lists the app's routes by hand in such an app.
|
|
181
188
|
- A separate import on purpose: apps that do not use it ship none of it.
|
|
182
189
|
|
|
183
190
|
Import `sendFeedback` from `firebase-structured-logger/client`:
|
|
@@ -33,7 +33,7 @@ All entries written by firebase-structured-logger include these labels:
|
|
|
33
33
|
| `screen` | Current screen name (falls back to `route` when the app never set one) |
|
|
34
34
|
| `route` | Route pattern, e.g. `/orders/:id/items` — group by this (apps using `enableNavigation`) |
|
|
35
35
|
| `path` | Real path, e.g. `/orders/1042/items` — one specific page or record; query string never stored |
|
|
36
|
-
| `routeSource` |
|
|
36
|
+
| `routeSource` | **Deprecated, removed in 2.0.** `pattern` when the default id rule made the route |
|
|
37
37
|
| `trace` | On a slow-trace WARNING: the trace's name, e.g. `app_boot` |
|
|
38
38
|
| `run` | On a slow-trace WARNING: tells overlapping runs of one trace apart |
|
|
39
39
|
| `slow` | `trace` (the whole run passed its limit) or `step` (one step passed its own) |
|