@dasasian/firebase-structured-logger 1.2.0 → 1.3.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +173 -33
- package/dist/client/breadcrumbs.d.ts +39 -6
- package/dist/client/breadcrumbs.d.ts.map +1 -1
- package/dist/client/breadcrumbs.js +98 -10
- package/dist/client/breadcrumbs.js.map +1 -1
- package/dist/client/logger.d.ts.map +1 -1
- package/dist/client/logger.js +4 -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/client/views.d.ts +3 -0
- package/dist/client/views.d.ts.map +1 -0
- package/dist/client/views.js +30 -0
- package/dist/client/views.js.map +1 -0
- package/dist/shared/types.d.ts +16 -9
- package/dist/shared/types.d.ts.map +1 -1
- package/package.json +30 -3
- package/skills/logs/SKILL.md +21 -13
- package/skills/query-logs/SKILL.md +1 -1
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.1",
|
|
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,10 +38,22 @@
|
|
|
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"
|
|
44
52
|
},
|
|
53
|
+
"./client/views": {
|
|
54
|
+
"types": "./dist/client/views.d.ts",
|
|
55
|
+
"default": "./dist/client/views.js"
|
|
56
|
+
},
|
|
45
57
|
"./functions": {
|
|
46
58
|
"types": "./dist/functions/index.d.ts",
|
|
47
59
|
"default": "./dist/functions/index.js"
|
|
@@ -59,9 +71,18 @@
|
|
|
59
71
|
"client/navigation": [
|
|
60
72
|
"dist/client/navigation.d.ts"
|
|
61
73
|
],
|
|
74
|
+
"client/navigation/vue-router": [
|
|
75
|
+
"dist/client/navigation/vue-router.d.ts"
|
|
76
|
+
],
|
|
77
|
+
"client/navigation/react-router": [
|
|
78
|
+
"dist/client/navigation/react-router.d.ts"
|
|
79
|
+
],
|
|
62
80
|
"client/timing": [
|
|
63
81
|
"dist/client/timing.d.ts"
|
|
64
82
|
],
|
|
83
|
+
"client/views": [
|
|
84
|
+
"dist/client/views.d.ts"
|
|
85
|
+
],
|
|
65
86
|
"functions": [
|
|
66
87
|
"dist/functions/index.d.ts"
|
|
67
88
|
],
|
|
@@ -82,7 +103,7 @@
|
|
|
82
103
|
"build:watch": "tsc --watch",
|
|
83
104
|
"clean": "rm -rf dist",
|
|
84
105
|
"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",
|
|
106
|
+
"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/views.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
107
|
"prepublishOnly": "npm run clean && npm run build",
|
|
87
108
|
"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
109
|
"smoke:deploy:run": "bash smoke/cloudrun/deploy.sh",
|
|
@@ -119,8 +140,14 @@
|
|
|
119
140
|
"firebase-admin": "^14.5.0",
|
|
120
141
|
"firebase-functions": "^7.4.0",
|
|
121
142
|
"jsdom": "^30.1.1",
|
|
143
|
+
"react": "^19.3.0",
|
|
144
|
+
"react-dom": "^19.3.0",
|
|
145
|
+
"react-router-6": "npm:react-router@^6.30",
|
|
146
|
+
"react-router-7": "npm:react-router@^7.18",
|
|
122
147
|
"tsx": "^4.23.15",
|
|
123
|
-
"typescript": "~6.0.3"
|
|
148
|
+
"typescript": "~6.0.3",
|
|
149
|
+
"vue": "^3.5.43",
|
|
150
|
+
"vue-router": "^4.6.4"
|
|
124
151
|
},
|
|
125
152
|
"engines": {
|
|
126
153
|
"node": ">=22"
|
package/skills/logs/SKILL.md
CHANGED
|
@@ -58,23 +58,23 @@ 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
|
-
-
|
|
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
|
|
63
|
+
- Dialogs, tabs and steps that matter → `data-fsl-view="Name"` on their root element, with `enableViews()` once at startup. Flag a name built from a value (`order-${id}`) and a mark on list items
|
|
64
64
|
- Explicit user decisions → `bc.action('merge_chosen')`, `bc.action('discard_changes')`
|
|
65
65
|
- Scan/camera events → `bc.action('barcode_scanned', { barcode })`
|
|
66
66
|
|
|
67
67
|
Service-layer breadcrumbs (secondary — useful but not sufficient on their own):
|
|
68
68
|
- Before a Firestore/API call → `bc.action('save_item', { itemId })`
|
|
69
|
-
-
|
|
69
|
+
- 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
70
|
|
|
71
71
|
**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
72
|
|
|
73
73
|
API:
|
|
74
74
|
- `bc.action(name: string, data?)` — user-initiated operations and decisions
|
|
75
75
|
- `bc.state(name: string, data?)` — significant state changes
|
|
76
|
-
- `bc.
|
|
77
|
-
- `bc
|
|
76
|
+
- `bc.handledError(type: string, data?)` — an error handled and not logged (`bc.error` is its deprecated old name)
|
|
77
|
+
- Page changes are not a `bc.*` call — see navigation below
|
|
78
78
|
|
|
79
79
|
**Label completeness**
|
|
80
80
|
- For each function, check which `AppLabels` fields are in scope as variables
|
|
@@ -166,18 +166,26 @@ Import `bc` from `firebase-structured-logger/client`:
|
|
|
166
166
|
```ts
|
|
167
167
|
bc.action(name: string, data?: Record<string, unknown>): void // before operations
|
|
168
168
|
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
|
|
169
|
+
bc.handledError(type: string, data?: Record<string, unknown>): void // an error handled, not logged
|
|
171
170
|
```
|
|
171
|
+
`bc.nav` and `bc.error` are deprecated in 1.3 and removed in 2.0 — flag them.
|
|
172
172
|
|
|
173
173
|
Import `enableNavigation` from `firebase-structured-logger/client/navigation`:
|
|
174
174
|
```ts
|
|
175
|
-
enableNavigation(options?: {
|
|
175
|
+
enableNavigation(options?: { labelsFor?: (path: string) => { route?: string; screen?: string; path?: string } }): void
|
|
176
|
+
navigatedTo(screen: string, labels?: { route?: string; path?: string }): void
|
|
177
|
+
defaultLabelsFor(path: string): { route: string; screen: string; path: string }
|
|
176
178
|
```
|
|
177
|
-
- Call once at startup. Every
|
|
178
|
-
gets `route` (the pattern, `/orders/:id`), `path` (the real path) and `
|
|
179
|
-
-
|
|
180
|
-
|
|
179
|
+
- Call `enableNavigation` once at startup. Every page change becomes one `nav` breadcrumb, and
|
|
180
|
+
every entry gets `route` (the pattern, `/orders/:id`), `path` (the real path) and `screen`.
|
|
181
|
+
- `labelsFor` names routes the app's own way; it must be synchronous. Flag the deprecated
|
|
182
|
+
`routeFor`, `cleanPath` and `path: false` options — `labelsFor` replaces all three.
|
|
183
|
+
- Suggest `navigatedTo` only for apps whose screens change without the URL changing.
|
|
184
|
+
- An app on Vue Router 4 or a React Router data router (6.4+, 7) should use the adapter
|
|
185
|
+
instead: `enableVueRouterNavigation(router)` from `/client/navigation/vue-router`, or
|
|
186
|
+
`enableReactRouterNavigation(router)` from `/client/navigation/react-router`. It takes
|
|
187
|
+
names from the router (Vue route `name`, React `handle.screen`). Flag a `labelsFor` that
|
|
188
|
+
re-lists the app's routes by hand in such an app.
|
|
181
189
|
- A separate import on purpose: apps that do not use it ship none of it.
|
|
182
190
|
|
|
183
191
|
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) |
|