pinia-plugin-subscription 1.0.0-beta.13 → 1.0.0-beta.15
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 +29 -12
- package/CONTRIBUTING.md +10 -1
- package/README.md +11 -9
- package/SECURITY.md +2 -2
- package/dist/chunks/{PluginSubscription-Bkqj4uSK.js → PluginSubscription-GJDsym1O.js} +253 -247
- package/dist/core/PluginSubscriber.d.ts +1 -1
- package/dist/core/PluginSubscription.d.ts +13 -12
- package/dist/core/Store.d.ts +1 -1
- package/dist/helpers/index.d.ts +0 -4
- package/dist/helpers.js +56 -651
- package/dist/pinia-plugin-subscription.js +4 -5
- package/dist/system/TraceEmitter.d.ts +1 -2
- package/dist/types/index.d.ts +1 -2
- package/dist/types/plugin.d.ts +2 -3
- package/dist/types/trace.d.ts +30 -109
- package/dist/utils/traceGroups.d.ts +9 -7
- package/docs/authoring-plugins.md +13 -7
- package/docs/using-plugins.md +28 -19
- package/package.json +9 -4
- package/dist/chunks/PluginSubscription-Bkqj4uSK.js.map +0 -1
- package/dist/factories/console-trace-listener.d.ts +0 -7
- package/dist/factories/trace-listener.d.ts +0 -10
- package/dist/factories/trace-registry.d.ts +0 -2
- package/dist/helpers.js.map +0 -1
- package/dist/pinia-plugin-subscription.js.map +0 -1
- package/dist/system/Tracer.d.ts +0 -23
- package/dist/system/log/console-group.d.ts +0 -8
- package/dist/system/log/console.d.ts +0 -18
- package/dist/system/log/index.d.ts +0 -2
- package/dist/system/log/log-trace.d.ts +0 -8
- package/dist/system/log/print-array.d.ts +0 -7
- package/dist/system/log/print-error.d.ts +0 -6
- package/dist/system/log/print-object.d.ts +0 -1
- package/dist/system/log/print-trace-payload.d.ts +0 -1
- package/dist/system/log/print-trace.d.ts +0 -9
- package/dist/system/log/trace-console.d.ts +0 -9
- package/dist/tests/defineAStore.test-d.d.ts +0 -1
- package/dist/tests/storeOptionsExtensions.test-d.d.ts +0 -12
- package/dist/types/comparison.d.ts +0 -3
- package/dist/types/list.d.ts +0 -13
- package/dist/types/log.d.ts +0 -8
- package/dist/types/resourceId.d.ts +0 -4
- package/dist/utils/Performance.d.ts +0 -9
- package/dist/utils/environment.d.ts +0 -7
- package/dist/utils/object.d.ts +0 -4
- package/dist/utils/redact.d.ts +0 -15
- package/docs/tracing.md +0 -185
package/CHANGELOG.md
CHANGED
|
@@ -8,38 +8,41 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
10
|
### Added
|
|
11
|
+
- `pinia-plugin-subscription-devtools` package with `createTraceDevtools(options?)`, `createTracerRegistry()`, `mountTraceDevtools()` and the tracing documentation (`packages/devtools/docs/tracing.md`).
|
|
12
|
+
- `addScopesListener(scopes, context?, handler?)` groups events from selected store scopes and accepts a custom trace handler; custom `handler` / `filter` listeners are the supported way to consume trace events, documented in `packages/devtools/docs/tracing.md`
|
|
13
|
+
- `journal.serialize()` / `journal.import()` and `stringifyTraceSnapshot()` to carry server traces to the browser; payloads are bounded and made JSON-safe by `toSerializable`, imports are validated. The SSR demo embeds the server journal in the page and loads it through `createTraceDevtools()`
|
|
14
|
+
- `pinia-plugin-subscription-devtools`: `createTracerRegistry({ journal, side })` enables a per-store journal (`registry.journal`) recording every trace event with `seq`, `side` and the `actionId` correlating the events of one store action; ring buffer per store and side (default 1000, context and error events kept separately), `getEvents()`, `getScopes()`, `getDropped()`, `subscribe()`, `clear()`; documented in `packages/devtools/docs/tracing.md`
|
|
11
15
|
- SSR demo subscribers are now class-based (`PluginSubscriber` + a `Store` subclass) and emit traces through the tracer `PluginSubscription` provides (`this.trace()` / `this.traceError()`): hydration start/done, errors, and the `onMutation` trace group, all scoped to the store; the per-request tracer registry also listens on the server, so server traces print in the Node terminal and browser traces in the devtools console
|
|
12
16
|
- SSR demo shows a concrete case of environment-aware hydration: one store filled by a server-only subscriber (request data) and a client-only deferred subscriber (browser data), with a server/browser panel layout and a hydration timeline; the `Accept-Language` header is validated before being serialized
|
|
13
17
|
- Added a Vite SSR demo server (`npm run dev:ssr`) with per-request app/plugin instances, async server-side subscriber hydration, and Pinia state serialization for client hydration
|
|
14
18
|
- Demo: `defineAStoreCtx` enhanced-store example; the demo app now resolves the package to `src/` through Vite aliases (no build needed)
|
|
15
19
|
- Added `pinia-plugin-subscription` to the package `keywords`
|
|
16
|
-
- Added `addScopesListener(scopes, context?)` to `createTracerRegistry()` for grouping events from selected store scopes; documented in `docs/tracing.md`
|
|
17
20
|
- `traceGroups` glossary, exported from `pinia-plugin-subscription/helpers`, building the `groupId` emitted by `PluginSubscription` (`onActionAfter`, `onActionError`, `onMutation`, `reset`); documented in `docs/tracing.md`
|
|
18
21
|
- `createPluginSubscriber(name, invoke, optionalProps?)` factory, exported from `pinia-plugin-subscription/helpers`, to build plain-object subscribers; documented in `docs/authoring-plugins.md` and used by the demo plugin
|
|
19
22
|
- Added a dedicated tracing guide, `docs/tracing.md`; the README now only presents tracing and links to it
|
|
20
23
|
- Moved the API reference, import subpaths, development, `Store` summary and testing sections from `README.md` to `docs/authoring-plugins.md`
|
|
21
|
-
- `createTracerRegistry({ redact })
|
|
22
|
-
- `createTracerRegistry({ enabled })`: tracing is now disabled by default in production builds (`process.env.NODE_ENV === 'production'`); `addListener()` becomes a no-op unless `enabled: true` is passed. `enabled: false` forces it off in any environment. Error reporting through `console.error` is unchanged
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
- Added metadata-based trace filter criteria with `equals`, `contains`, `startsWith` and `endsWith` comparators, combined with `every` or `some`
|
|
27
|
-
- Added `createConsoleTraceListener()` as an opt-in console sink for trace events
|
|
24
|
+
- `pinia-plugin-subscription-devtools`: `createTracerRegistry({ redact })` opts into redaction of event payloads before they reach listeners. `true` masks a default list of sensitive keys (`password`, `token`, `secret`, `authorization`, API/private keys, `credential`, `cookie`, `cipher`...); an object adds custom `keys`, a `replacement`, or drops the defaults with `includeDefaults: false`. It works on a copy, covers arrays/`Map`/`Set`, handles circular references, and replaces the payload by `__traceRedactionError` if redaction fails. `defaultRedactedKeys` and `TraceRedactOptions` are exported
|
|
25
|
+
- `createTracerRegistry({ enabled })` in `pinia-plugin-subscription-devtools`: tracing is now disabled by default in production builds (`process.env.NODE_ENV === 'production'`); `addListener()` becomes a no-op unless `enabled: true` is passed. `enabled: false` forces it off in any environment. Error reporting through `console.error` is unchanged
|
|
26
|
+
- `pinia-plugin-subscription-devtools`: added `createTracerRegistry()` to create isolated trace listeners and tracers for each application or Pinia instance
|
|
27
|
+
- `pinia-plugin-subscription-devtools`: added the `Tracer` class and registry methods `addTraceListener()`, `clearTraceListeners()` and `hasTraceListeners()`
|
|
28
|
+
- `pinia-plugin-subscription-devtools`: added metadata-based trace filter criteria with `equals`, `contains`, `startsWith` and `endsWith` comparators, combined with `every` or `some`
|
|
28
29
|
- Added `trace()` and `traceError()` to `Store` and `PluginSubscription`
|
|
29
|
-
- Added trace types: `TraceEvent`, `TraceEventMetadata`, `
|
|
30
|
+
- Added trace types: `TraceEvent`, `TraceEventMetadata`, `TraceHandler`, `TraceLevel`, `TraceListener`, `TraceListenerRemover` and `TracePayload`
|
|
30
31
|
- Added `check:leaks` script and `scripts/check-dist-leaks.mjs`, guarding published artifacts against non-peer dependency imports in `dist/` (`.js` and `.d.ts`)
|
|
31
32
|
- Added the leak guard to `npm run build` and to the CI workflow
|
|
32
33
|
- Added unit tests covering the tracing system and the leak detection logic
|
|
33
34
|
|
|
34
35
|
### Changed
|
|
35
|
-
-
|
|
36
|
+
- Devtools: refs and computed attached to a trace are now displayed through their value instead of as raw objects (`toSerializable` unwraps them)
|
|
37
|
+
- **Breaking:** removed the built-in console output of traces (`createConsoleGroupTraceListener`, `ConsoleTraceGroupListener`, `TraceGroupListener`, `TraceListenerGroupBy`, the `groupBy` option of `addListener()`, and the internal console printers). Listeners now only forward events to their own `handler` (a no-op when omitted); `startGroup` / `closeGroup` only maintain the open-group stack that sets `groupId`. Fixed `tracerHandler.journal` not being exposed by the registry
|
|
38
|
+
- Trace groups follow the lifecycles of a store: `groupId` is now a `/` separated path (`<storeId>/plugin`, `<storeId>/onAction:<name>#<n>`, with `/after` and `/onError` sub-groups, `<storeId>/onMutation#<n>`, `<storeId>/reset#<n>`, `<storeId>/plugin/deferred:<subscriber>#<n>`). Every trace emitted for a store while a group is open, including those of subscribers and `Store` subclasses, joins the innermost one. `traceGroups` builders take the call counter; `TraceGroupId` is removed, and `groupId` is lifted from the payload to the event like `actionId`
|
|
39
|
+
- Devtools: the timeline nests events by lifecycle instead of by raw `actionId` (no more `#<n>` ids), events without `error` / `payload` are no longer expandable, `P` (payload) and `E` (error) chips flag the events carrying them, the floating button reads `Devtools` with a debug icon, and the Context tab lists subscribers by name (with their execution options) and shows options without `actions`
|
|
36
40
|
- `storeMutationSubscription` now supports several subscribers per store, like `storeOnActionSubscription`: a single `$subscribe` is registered per store and dispatches to every callback. A failing callback is reported through `traceError` without blocking the others, subscriber names are tracked, and the hook is unsubscribed when the store is disposed
|
|
37
41
|
- `storeOnActionSubscription` now receives the Pinia plugin context; action trace labels include the invoked action name
|
|
38
42
|
- Subscribers deferred with `hydration: 'defer'` now run inside their own trace group (label `subscriber:deferred`, keyed by store scope), which stays open until their asynchronous `hydrate()` / `afterHydration()` settle, so their traces are no longer emitted outside any group once `plugin()` has closed its `context` group. A hydration that never settles can no longer buffer the store's traces forever: the group is force-closed after `deferredTraceGroupTimeout` ms (new option, default 2500) and a `subscriber:deferred:timeout` error is traced
|
|
39
43
|
- Moved the demo application from `src/demo/` to the repository-level `demo/` directory, separating example code from the library source and tracking the demo files in version control.
|
|
40
44
|
- Clarified that SSR tracing registries and plugin instances must be created per request, and added coverage for listener isolation between registries
|
|
41
45
|
- Replaced the `Debug` abstract class with composition: `Store` and `PluginSubscription` no longer extend it and now own a `Tracer`
|
|
42
|
-
- `createPlugin()` accepts `PluginSubscriptionOptions`, including a `createTracer` factory to connect a tracer registry to plugin and store trace events
|
|
43
46
|
- Trace errors with no matching listener, and failures in listener filters or handlers, are now reported with `console.error` instead of rethrowing the original error
|
|
44
47
|
- Deprecated `createHydrationPlugin()` in favor of `createPlugin()` with hydration options
|
|
45
48
|
- Trace payloads are now lazily resolved, so unobserved tracing no longer builds log arguments
|
|
@@ -52,11 +55,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
52
55
|
- `Tracer` listener matching no longer allocates intermediate arrays beyond the matched set, and duplicated unhandled-error reporting was factored out
|
|
53
56
|
- The `pluginsubscription` namespace prefix is now a shared constant (`pluginSubscriptionNamespace`) instead of a hard-coded string
|
|
54
57
|
|
|
58
|
+
### Changed (breaking)
|
|
59
|
+
- The tracing solution moved to the new `pinia-plugin-subscription-devtools` package (`packages/devtools/`, same repository). `pinia-plugin-subscription` now only emits trace events through the `Tracer` / `TracerHandler` contract exported from `pinia-plugin-subscription/types`; without a `tracerHandler` it emits nothing. The compressed package drops from about 117 kB to about 50 kB, and the new package weighs about 19 kB.
|
|
60
|
+
- `createTracerRegistry`, `Tracer` (class), `defaultRedactedKeys`, `stringifyTraceSnapshot`, `getTraceGroupName` and `mountTraceDevtools` are now exported by `pinia-plugin-subscription-devtools` instead of `pinia-plugin-subscription/helpers` and `pinia-plugin-subscription/devtools`. `traceGroups` stays in `pinia-plugin-subscription/helpers`.
|
|
61
|
+
- The `Tracer` export of `pinia-plugin-subscription/helpers` is now the `Tracer` interface of `pinia-plugin-subscription/types`.
|
|
62
|
+
- `TracerHandler.createTracer(source)` no longer takes options, and `TracerHandler` no longer exposes `journal`; the registry's handler of the devtools package does.
|
|
63
|
+
- Source maps are no longer published.
|
|
64
|
+
|
|
55
65
|
### Documentation
|
|
56
66
|
- Added `demo/README.md` mapping each use case to its demo files and docs; documented the `pinia-plugin-subscription` topic in the Ecosystem section
|
|
57
67
|
- Reference implementation section lists the demo files and what each one illustrates; README links the demo and the `pinia-plugin-subscription` topic
|
|
58
68
|
|
|
59
69
|
### Fixed
|
|
70
|
+
- Devtools: the aside body now scrolls inside the aside (its scrollbar was out of reach under the page one)
|
|
71
|
+
- Devtools: traces emitted with the `store:reset:<id>` / `store:onMutation:<id>` group ids of pinia-plugin-extending-store are merged into the plugin `reset` / `onMutation` groups
|
|
72
|
+
- Devtools: the aside no longer sits under the page scrollbar (it keeps a gutter next to it) and the mouse wheel over the aside always scrolls the aside, not the page
|
|
73
|
+
- Devtools: the aside is mounted in the browser top layer (Popover API) so it stays viewport-sized and scrollable even when a page ancestor has a `transform` / `filter`; trace rows show the label first, then time, side and P / E chips on a second line
|
|
74
|
+
- Devtools: calls of a same hook (`onAction · name`, `onMutation`…) are merged into one group per store and side; groups start collapsed; events show their payload content directly (no `payload` key); wheel/touch scroll is no longer swallowed by host-page scroll locks and the scrollbar is always visible
|
|
60
75
|
- `defineAStoreSetup` now creates a separate setup context for each Pinia store instance, preventing enhanced-store extensions from being shared across SSR requests
|
|
61
76
|
- Demo plugin-added state now uses `Store.addToState()` so `pluginIsActive` is exposed and reactive on the Pinia store
|
|
62
77
|
- `defineAStoreCtx()` now types the inferred setup context's enhanced-store extensions as `unknown` instead of `AnyObject`; explicit types remain available through generics or `getEnhancedStore<T>()`
|
|
@@ -66,7 +81,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
66
81
|
- Subscriber, subscription, action and rollback tracking keys now encode store IDs and names without delimiter collisions; disposing a store removes only its own tracking entries
|
|
67
82
|
- Trace groups opened by `onAction`, `$subscribe` and `$reset` are now always closed (also when the action fails or a callback throws), so grouped events no longer stay buffered forever
|
|
68
83
|
- Listener definitions passed to `addListener()` are no longer mutated when their `filter` is an array of criteria
|
|
69
|
-
- `TracerHandler` and `TraceRegistry` types now match the implementation (`createTracer(source, options?)`, `void` group callbacks, `addListener()` with options, `tracerHandler`); `createTracerRegistry()` is explicitly typed as `TraceRegistry`
|
|
70
84
|
- `CustomConsole.rebuildArgs()` no longer returns `undefined` for unsupported argument types
|
|
71
85
|
- `clearTraceListeners()` now empties the shared listener list in place, so tracers created before the call stop delivering to cleared listeners and see listeners registered afterwards
|
|
72
86
|
|
|
@@ -78,6 +92,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
78
92
|
- **Breaking:** removed the legacy `debug` and `console` accessors from `Store` and `PluginSubscription`
|
|
79
93
|
- Removed the internal `src/system/Debug.ts` abstract class (was never publicly exported)
|
|
80
94
|
- **Breaking:** replaced module-global trace-listener functions with methods on a `createTracerRegistry()` instance
|
|
95
|
+
- Removed Performance monitoring utilities
|
|
96
|
+
- The `devtools` option of `createPlugin()` and the `pinia-plugin-subscription/devtools` entry point; install `pinia-plugin-subscription-devtools` and use `createTraceDevtools()` with `tracerHandler: registry.tracerHandler`
|
|
97
|
+
- Types `TraceFilter`, `TraceJournal`, `TraceRegistry`, `TracerOptions`, `TracerRegistryOptions` and the other registry types from `pinia-plugin-subscription/types`; they are exported by `pinia-plugin-subscription-devtools`
|
|
81
98
|
|
|
82
99
|
## [0.2.1]
|
|
83
100
|
|
package/CONTRIBUTING.md
CHANGED
|
@@ -23,6 +23,15 @@ Please be respectful and constructive in all interactions with other contributor
|
|
|
23
23
|
git checkout -b feature/your-feature-name
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
+
## Repository Layout
|
|
27
|
+
|
|
28
|
+
This repository is an npm workspace with two published packages:
|
|
29
|
+
|
|
30
|
+
- `pinia-plugin-subscription` (repository root, `src/`): the plugin. It only *emits* trace events through the `TracerHandler` contract (`src/types/trace.ts`) and must never import the devtools package.
|
|
31
|
+
- `pinia-plugin-subscription-devtools` (`packages/devtools/`): consumes trace events (registry, journal, redaction, in-page panel). It depends on the plugin through types only.
|
|
32
|
+
|
|
33
|
+
Core tests use the in-memory tracer in `src/tests/support/testTracer.ts`; end-to-end tracing tests live in `packages/devtools/src/tests/`.
|
|
34
|
+
|
|
26
35
|
## Development Workflow
|
|
27
36
|
|
|
28
37
|
### Running Tests
|
|
@@ -36,7 +45,7 @@ npm run coverage # Generate coverage report
|
|
|
36
45
|
### Building
|
|
37
46
|
|
|
38
47
|
```bash
|
|
39
|
-
npm run build # Run tests, build
|
|
48
|
+
npm run build # Run tests, then build and check both packages
|
|
40
49
|
```
|
|
41
50
|
|
|
42
51
|
### Preview Changes
|
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ The package serves two audiences:
|
|
|
35
35
|
| --- | --- |
|
|
36
36
|
| Use a compatible plugin (e.g. `pinia-plugin-extending-store`, `pinia-plugin-persist-state`) or this package's built-in store features (`defineAStore`, `$reset`, state rollback) in your app | [Using compatible plugins](docs/using-plugins.md) |
|
|
37
37
|
| Build your own pinia plugin on top of `pinia-plugin-subscription` (API reference, `Store` class, import subpaths, development and testing) | [Plugin authoring guide](docs/authoring-plugins.md) |
|
|
38
|
-
| Debug stores and plugins with structured trace events | [Tracing](docs/tracing.md) |
|
|
38
|
+
| Debug stores and plugins with structured trace events | [Tracing](packages/devtools/docs/tracing.md) |
|
|
39
39
|
|
|
40
40
|
A runnable example lives in [`demo/`](demo/) (`npm run dev` for SPA mode or `npm run dev:ssr` for Vite SSR). The SSR example hydrates **one store from two environments**: a server-only subscriber loads request data (awaited before rendering and serializing Pinia state) and a client-only, deferred subscriber fills browser data after hydration, with a visual timeline; see the [reference implementation](docs/authoring-plugins.md#reference-implementation). Plugins built on this package are discoverable through the [`pinia-plugin-subscription` GitHub topic](https://github.com/topics/pinia-plugin-subscription).
|
|
41
41
|
|
|
@@ -65,27 +65,29 @@ app.mount('#app')
|
|
|
65
65
|
|
|
66
66
|
## Advanced Features
|
|
67
67
|
|
|
68
|
-
- **Structured tracing:**
|
|
69
|
-
- **Scope-based trace listeners:** Use `addScopesListener()` to group events from selected stores — see [Tracing](docs/tracing.md#filtering-events).
|
|
68
|
+
- **Structured tracing:** the plugin and `Store` emit typed trace events through an optional `tracerHandler`. Tracing itself (listeners, journal, redaction, in-page panel) lives in the separate [`pinia-plugin-subscription-devtools`](packages/devtools/) package, so apps that do not debug stay lean — see [Tracing](#tracing).
|
|
70
69
|
- **Reset callbacks:** Define `resetStoreCallback` to run custom logic when a store is reset.
|
|
71
70
|
- **SSR and hydration control:** Configure whether each subscribed plugin runs on the server, the client, or only after client hydration.
|
|
72
71
|
- **Lifecycle safety:** Internal hydration ordering is now guarded so `hydrate()` completes before `afterHydration()` and disposed stores do not retain stale subscriber metadata.
|
|
73
72
|
|
|
74
73
|
## Tracing
|
|
75
74
|
|
|
76
|
-
|
|
75
|
+
The plugin only *emits* structured trace events; without a `tracerHandler` it emits nothing and costs nothing. Install [`pinia-plugin-subscription-devtools`](packages/devtools/) (usually as a development dependency) to consume them with filtered listeners, a per-store journal, payload redaction and an in-page panel:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
npm install -D pinia-plugin-subscription-devtools
|
|
79
|
+
```
|
|
77
80
|
|
|
78
81
|
```ts
|
|
79
82
|
import { createPlugin } from 'pinia-plugin-subscription'
|
|
80
|
-
import {
|
|
83
|
+
import { createTraceDevtools } from 'pinia-plugin-subscription-devtools'
|
|
81
84
|
|
|
82
|
-
const registry =
|
|
83
|
-
registry.addListener([{ target: 'scope', value: 'cart' }])
|
|
85
|
+
const { registry } = createTraceDevtools() // mounts the in-page panel in development browsers
|
|
84
86
|
|
|
85
87
|
pinia.use(createPlugin(subscribers, { tracerHandler: registry.tracerHandler }))
|
|
86
88
|
```
|
|
87
89
|
|
|
88
|
-
See the [Tracing documentation](docs/tracing.md) for filtering, redaction, production safety, event shape and error reporting.
|
|
90
|
+
See the [Tracing documentation](packages/devtools/docs/tracing.md) for filtering, redaction, production safety, event shape and error reporting. Plugin authors only need the `Tracer` and `TracerHandler` types from `pinia-plugin-subscription/types`, and `createTracer` / `this.trace()` to emit events.
|
|
89
91
|
|
|
90
92
|
## License
|
|
91
93
|
|
|
@@ -93,4 +95,4 @@ MIT
|
|
|
93
95
|
|
|
94
96
|
## Publishing
|
|
95
97
|
|
|
96
|
-
|
|
98
|
+
Both packages (`pinia-plugin-subscription` and `pinia-plugin-subscription-devtools`) are published to npm via GitHub Actions on the same release. GitHub releases marked as pre-releases are published with the `beta` dist-tag using `npm publish --tag beta`; stable releases use the default `latest` tag. The workflow uses npm provenance for better supply-chain security and requires a `NPM_TOKEN` secret in the repository settings.
|
package/SECURITY.md
CHANGED
|
@@ -38,7 +38,7 @@ When using pinia-plugin-subscription:
|
|
|
38
38
|
|
|
39
39
|
### Tracing and Production Logging
|
|
40
40
|
|
|
41
|
-
Normal trace events are opt-in: the plugin requires an explicitly configured `tracerHandler` and matching listeners to deliver them. `createTracerRegistry()` ignores `addListener()` in production builds (`process.env.NODE_ENV === 'production'`) unless `createTracerRegistry({ enabled: true })` is passed. This guard relies on the consuming bundler replacing `process.env.NODE_ENV`; without it, tracing is considered enabled. Production tracing can be useful for incident diagnosis, but should only be enabled deliberately and with controlled access to its output.
|
|
41
|
+
Tracing is provided by the separate `pinia-plugin-subscription-devtools` package. Normal trace events are opt-in: the plugin requires an explicitly configured `tracerHandler` and matching listeners to deliver them. `createTracerRegistry()` ignores `addListener()` in production builds (`process.env.NODE_ENV === 'production'`) unless `createTracerRegistry({ enabled: true })` is passed. This guard relies on the consuming bundler replacing `process.env.NODE_ENV`; without it, tracing is considered enabled. Production tracing can be useful for incident diagnosis, but should only be enabled deliberately and with controlled access to its output.
|
|
42
42
|
|
|
43
43
|
Trace events are not redacted by default. Depending on the event, they may contain action arguments, store state, mutations, plugin options, subscriptions, or error details. These values can include application secrets or personal data. `createTracerRegistry({ redact: true })` masks values stored under sensitive keys (passwords, tokens, secrets, authorization, API keys, cookies...) before any listener receives them, but it inspects keys only: it does not detect secrets under innocuous keys, and it does not redact `event.error`. A listener can expose them through the browser console, server logs, or an external logging service. The absence of a production block is not, by itself, a vulnerability; the disclosure risk depends on the data emitted, the logging destination, and who can access it.
|
|
44
44
|
|
|
@@ -53,7 +53,7 @@ When configuring tracing:
|
|
|
53
53
|
|
|
54
54
|
For production, handle error events with a matching listener that reports only sanitized details, and ensure listener filters and handlers do not throw sensitive errors. Review the application's console and error logging policy as well; do not silently discard operational errors to prevent disclosure.
|
|
55
55
|
|
|
56
|
-
See [Tracing](./docs/tracing.md) for configuration and event details.
|
|
56
|
+
See [Tracing](./packages/devtools/docs/tracing.md) for configuration and event details.
|
|
57
57
|
|
|
58
58
|
## Dependencies Security
|
|
59
59
|
|