pinia-plugin-subscription 1.0.0-beta.0 → 1.0.0-beta.2
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 +4 -1
- package/README.md +58 -17
- package/dist/chunks/{constantes-BsD73jkk.js → constantes-CaTNAbzX.js} +94 -78
- package/dist/chunks/constantes-CaTNAbzX.js.map +1 -0
- package/dist/core/PluginSubscriber.d.ts +4 -5
- package/dist/core/Store.d.ts +27 -9
- package/dist/factories/console-trace-listener.d.ts +7 -0
- package/dist/factories/trace-listener.d.ts +16 -0
- package/dist/factories/trace-registry.d.ts +12 -1
- package/dist/helpers/index.d.ts +1 -1
- package/dist/helpers.js +245 -81
- package/dist/helpers.js.map +1 -1
- package/dist/lib/main.d.ts +1 -1
- package/dist/pinia-plugin-subscription.js +45 -45
- package/dist/pinia-plugin-subscription.js.map +1 -1
- package/dist/system/Tracer.d.ts +2 -2
- package/dist/system/log.d.ts +12 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/plugin.d.ts +77 -1
- package/dist/types/store.d.ts +0 -3
- package/dist/types/trace.d.ts +44 -3
- package/dist/utils/store.d.ts +2 -1
- package/docs/authoring-plugins.md +33 -3
- package/docs/using-plugins.md +24 -4
- package/package.json +1 -1
- package/dist/chunks/constantes-BsD73jkk.js.map +0 -1
- package/dist/system/createConsoleTraceListener.d.ts +0 -6
package/dist/types/store.d.ts
CHANGED
|
@@ -44,9 +44,6 @@ export interface DefineAStoreSetupContext<TEnhancedStore, TExtraExtensions exten
|
|
|
44
44
|
export type DefineAugmentedStore<TStore, TState> = (args?: any) => CustomStore<TStore, TState>;
|
|
45
45
|
export type ObjectBaseProperty = Record<string, OptionBaseProperty | OptionBaseProperty[]>;
|
|
46
46
|
export type OptionBaseProperty = string | number | boolean | null | undefined | object | Function;
|
|
47
|
-
export interface PluginStoreOptions {
|
|
48
|
-
storeOptions: StoreOptions;
|
|
49
|
-
}
|
|
50
47
|
export interface RollbackActionParams {
|
|
51
48
|
action: string;
|
|
52
49
|
stateKeys?: CreateStateSnapshotKeys;
|
package/dist/types/trace.d.ts
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import type { AnyObject } from './index';
|
|
2
2
|
import type Tracer from '../system/Tracer';
|
|
3
|
+
export interface AddTraceListenerOptions {
|
|
4
|
+
filterMode?: TraceListenerFilterMode;
|
|
5
|
+
groupBy?: TraceListenerGroupBy;
|
|
6
|
+
}
|
|
7
|
+
export interface ConsoleTraceEventArgs extends Omit<TraceEvent, 'level' | 'timestamp'> {
|
|
8
|
+
}
|
|
9
|
+
export type ConsoleTraceEvent = Array<string | ConsoleTraceEventArgs>;
|
|
10
|
+
/**
|
|
11
|
+
* A trace listener that supports grouping of trace events.
|
|
12
|
+
*/
|
|
13
|
+
export interface ConsoleTraceGroupListener extends Omit<TraceListener, 'filter'> {
|
|
14
|
+
createGroup: (key: string) => void;
|
|
15
|
+
logGroup: (key: string) => void;
|
|
16
|
+
}
|
|
3
17
|
/**
|
|
4
18
|
* Severity of a trace event.
|
|
5
19
|
* `error` events are delivered to matching listeners, or reported with `console.error` when none match.
|
|
@@ -10,6 +24,9 @@ export type TraceLevel = 'debug' | 'error';
|
|
|
10
24
|
* Filters receive this object so that discarded events never allocate a payload.
|
|
11
25
|
*/
|
|
12
26
|
export interface TraceEventMetadata {
|
|
27
|
+
/** Label describing the event, e.g. `Subscription:Delivery`. */
|
|
28
|
+
label: string;
|
|
29
|
+
/** Severity of the trace event. */
|
|
13
30
|
level: TraceLevel;
|
|
14
31
|
/** Structured, colon separated identifier, e.g. `subscription:delivery`. */
|
|
15
32
|
namespace: string;
|
|
@@ -26,6 +43,19 @@ export interface TraceEvent extends TraceEventMetadata {
|
|
|
26
43
|
payload?: AnyObject;
|
|
27
44
|
timestamp: number;
|
|
28
45
|
}
|
|
46
|
+
type TraceFilterCriterionComparator = 'equals' | 'contains' | 'startsWith' | 'endsWith';
|
|
47
|
+
export interface TraceFilterCriterion {
|
|
48
|
+
comparator: TraceFilterCriterionComparator;
|
|
49
|
+
target: keyof TraceEventMetadata;
|
|
50
|
+
value: string;
|
|
51
|
+
}
|
|
52
|
+
export interface TraceFilterFactoryCriterion extends Omit<TraceFilterCriterion, 'comparator'> {
|
|
53
|
+
comparator?: TraceFilterCriterionComparator;
|
|
54
|
+
}
|
|
55
|
+
export type TraceFilterFactoryParam = {
|
|
56
|
+
handler?: TraceHandler;
|
|
57
|
+
filter: TraceFilter | TraceFilterFactoryCriterion[];
|
|
58
|
+
};
|
|
29
59
|
/**
|
|
30
60
|
* Event data. Prefer the function form: it is only invoked when a listener
|
|
31
61
|
* actually consumes the event, keeping unobserved tracing allocation free.
|
|
@@ -37,17 +67,22 @@ export type TracePayload = AnyObject | (() => AnyObject);
|
|
|
37
67
|
* @returns `true` if the event should be delivered to the listener, otherwise `false`.
|
|
38
68
|
*/
|
|
39
69
|
export type TraceFilter = (event: TraceEventMetadata) => boolean;
|
|
70
|
+
export interface TraceGroupListener extends ConsoleTraceGroupListener, TraceListener {
|
|
71
|
+
groupBy: TraceListenerGroupBy;
|
|
72
|
+
}
|
|
40
73
|
/**
|
|
41
74
|
* Handles a trace event.
|
|
42
75
|
* @param event The resolved trace event to handle.
|
|
43
76
|
*/
|
|
44
77
|
export type TraceHandler = (event: TraceEvent) => void;
|
|
45
78
|
export interface TraceListener {
|
|
46
|
-
/** Evaluated on every event; return `true` to receive it.
|
|
47
|
-
filter
|
|
79
|
+
/** Evaluated on every event; return `true` to receive it. */
|
|
80
|
+
filter: TraceFilter;
|
|
48
81
|
/** Handles the trace event when it passes the filter. */
|
|
49
82
|
handler: TraceHandler;
|
|
50
83
|
}
|
|
84
|
+
export type TraceListenerFilterMode = 'every' | 'some';
|
|
85
|
+
export type TraceListenerGroupBy = keyof TraceEventMetadata;
|
|
51
86
|
/** Removes a previously registered listener. */
|
|
52
87
|
export type TraceListenerRemover = () => void;
|
|
53
88
|
export type TraceRegistry = {
|
|
@@ -57,7 +92,7 @@ export type TraceRegistry = {
|
|
|
57
92
|
* @param listener The trace listener to register.
|
|
58
93
|
* @returns A function that removes the registered listener when called.
|
|
59
94
|
*/
|
|
60
|
-
addTraceListener: (listener: TraceListener) => TraceListenerRemover;
|
|
95
|
+
addTraceListener: (listener: TraceListener | TraceFilterFactoryParam, filterMode?: 'every' | 'some') => TraceListenerRemover;
|
|
61
96
|
/**
|
|
62
97
|
* Clears all registered trace listeners.
|
|
63
98
|
*/
|
|
@@ -75,6 +110,12 @@ export type TraceRegistry = {
|
|
|
75
110
|
*/
|
|
76
111
|
hasTraceListeners: () => boolean;
|
|
77
112
|
};
|
|
113
|
+
export interface TracerHandler {
|
|
114
|
+
closeGroup: (payload: TraceEvent) => undefined;
|
|
115
|
+
createTracer: (source: string) => Tracer;
|
|
116
|
+
startGroup: (payload: TraceEvent) => undefined;
|
|
117
|
+
}
|
|
78
118
|
export interface TracerOptions {
|
|
79
119
|
scope?: string;
|
|
80
120
|
}
|
|
121
|
+
export {};
|
package/dist/utils/store.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DefineStoreOptions, SetupStoreDefinition, StateTree, Store, StoreDefinition, _GettersTree } from "pinia";
|
|
2
2
|
import type { AnyObject } from "../types";
|
|
3
|
-
import type { DefineAStoreDefinition, DefineAStoreSetupContext, EmptyExtensions,
|
|
3
|
+
import type { DefineAStoreDefinition, DefineAStoreSetupContext, EmptyExtensions, StoreOptions } from "../types/store";
|
|
4
|
+
import type { PluginStoreOptions } from "../types/plugin";
|
|
4
5
|
export declare const itemState: {
|
|
5
6
|
'@id': undefined;
|
|
6
7
|
id: undefined;
|
|
@@ -207,8 +207,9 @@ export const myStoreSubscriber = new MyPluginSubscriber()
|
|
|
207
207
|
| `storeSubscribe` (getter/setter) | Factory for pinia's `$subscribe` (`{ store, callback }`). |
|
|
208
208
|
| `onAction` (getter/setter) | Factory for pinia's `$onAction` (`{ store, callback }`). |
|
|
209
209
|
| `static customizeStore(store, options)` | Recommended factory; guarded by `_requiredKeys` (see above). |
|
|
210
|
-
| `trace(
|
|
211
|
-
| `traceError(
|
|
210
|
+
| `trace(label, payload?, scope?, namespace?)` | Emits a structured trace event. The default scope is the wrapped store ID. |
|
|
211
|
+
| `traceError(label, error, payload?, scope?, namespace?)` | Emits an error event; if no listener matches, reports it with `console.error` without rethrowing it. |
|
|
212
|
+
| `classNameAddedToTraceNamespace` (getter/setter) | Controls whether the store class name is prefixed to trace labels; enabled by default. |
|
|
212
213
|
| `stateHas(property)` / `storeHas(property)` | Safe `hasOwnProperty` checks on state / store. |
|
|
213
214
|
| `getValue(value)` | Unwraps a ref or returns the value as-is. |
|
|
214
215
|
| `isOptionApi()` | Whether the store uses the options API. |
|
|
@@ -359,6 +360,35 @@ const mySubscriber = {
|
|
|
359
360
|
This keeps the server render deterministic and prevents browser-only
|
|
360
361
|
initialization from crashing Nuxt or SSR builds.
|
|
361
362
|
|
|
363
|
+
### Emitting trace events
|
|
364
|
+
|
|
365
|
+
Use `trace()` and `traceError()` from a `Store` subclass to emit structured
|
|
366
|
+
events. The first argument is a human-readable label; by default the store
|
|
367
|
+
class name is prefixed to it and the normalized label becomes the namespace.
|
|
368
|
+
Pass an explicit fourth `namespace` argument to control the namespace, or set
|
|
369
|
+
`classNameAddedToTraceNamespace = false` to omit the class prefix. Prefer a
|
|
370
|
+
payload factory so data is not built unless a listener consumes the event:
|
|
371
|
+
|
|
372
|
+
```ts
|
|
373
|
+
class CartStore extends Store {
|
|
374
|
+
reportItems(): void {
|
|
375
|
+
this.trace(
|
|
376
|
+
'cart:items',
|
|
377
|
+
() => ({ items: this.state.items }),
|
|
378
|
+
this.store.$id,
|
|
379
|
+
'cart:items'
|
|
380
|
+
)
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
`createTracerRegistry()` and `createConsoleTraceListener()` are available
|
|
386
|
+
from `pinia-plugin-subscription/helpers`. Register listeners on a registry
|
|
387
|
+
and pass its `createTracer` factory through `createPlugin()` options to
|
|
388
|
+
connect them to plugin and store events. Listener filters can be callbacks
|
|
389
|
+
over event metadata or criteria using `equals`, `contains`, `startsWith` and
|
|
390
|
+
`endsWith` comparisons.
|
|
391
|
+
|
|
362
392
|
## Typing per-store options: `StoreOptionsExtensions` (TypeScript)
|
|
363
393
|
|
|
364
394
|
This package is the only one allowed to augment pinia's
|
|
@@ -402,6 +432,6 @@ Guidelines:
|
|
|
402
432
|
## Reference implementation
|
|
403
433
|
|
|
404
434
|
The demo app ships a complete plugin implementation in
|
|
405
|
-
[`
|
|
435
|
+
[`demo/`](../demo/): a
|
|
406
436
|
`PluginSubscriber` subclass, a `Store` subclass, option typing and SSR
|
|
407
437
|
guards. Run `npm run dev` to explore it live.
|
package/docs/using-plugins.md
CHANGED
|
@@ -319,21 +319,40 @@ Register listeners independently from plugin construction:
|
|
|
319
319
|
|
|
320
320
|
```js
|
|
321
321
|
import {
|
|
322
|
-
addTraceListener,
|
|
323
322
|
createConsoleTraceListener,
|
|
323
|
+
createTracerRegistry
|
|
324
|
+
} from 'pinia-plugin-subscription/helpers'
|
|
325
|
+
import {
|
|
324
326
|
createPlugin
|
|
325
327
|
} from 'pinia-plugin-subscription'
|
|
326
328
|
|
|
327
|
-
|
|
329
|
+
const traceRegistry = createTracerRegistry()
|
|
330
|
+
|
|
331
|
+
traceRegistry.addTraceListener({
|
|
328
332
|
...createConsoleTraceListener(),
|
|
329
333
|
filter: event => event.scope === 'cart'
|
|
330
334
|
})
|
|
331
335
|
|
|
332
|
-
pinia.use(createPlugin([myStoreSubscriber]
|
|
336
|
+
pinia.use(createPlugin([myStoreSubscriber], {
|
|
337
|
+
createTracer: traceRegistry.createTracer
|
|
338
|
+
}))
|
|
333
339
|
```
|
|
334
340
|
|
|
335
341
|
Filters run in real time and can target a source, namespace, store scope, or
|
|
336
342
|
trace level without passing diagnostic options through subscribers.
|
|
343
|
+
You can also use comparison criteria (`equals`, `contains`, `startsWith` or
|
|
344
|
+
`endsWith`) instead of a filter callback; criteria are combined with `every`
|
|
345
|
+
by default or `some` when requested. If criteria are provided without a
|
|
346
|
+
handler, the registry uses its styled console listener.
|
|
347
|
+
|
|
348
|
+
```js
|
|
349
|
+
traceRegistry.addTraceListener({
|
|
350
|
+
filter: [
|
|
351
|
+
{ target: 'scope', value: 'cart' },
|
|
352
|
+
{ target: 'namespace', comparator: 'startsWith', value: 'pluginsubscription:subscription:' }
|
|
353
|
+
]
|
|
354
|
+
}, 'every')
|
|
355
|
+
```
|
|
337
356
|
|
|
338
357
|
## SSR / Nuxt
|
|
339
358
|
|
|
@@ -351,7 +370,8 @@ finishes.
|
|
|
351
370
|
```js
|
|
352
371
|
import { createSSRApp } from 'vue'
|
|
353
372
|
import { createPinia } from 'pinia'
|
|
354
|
-
import { createPlugin
|
|
373
|
+
import { createPlugin } from 'pinia-plugin-subscription'
|
|
374
|
+
import { createTracerRegistry } from 'pinia-plugin-subscription/helpers'
|
|
355
375
|
import App from './App.vue'
|
|
356
376
|
import { subscribers } from './subscribers'
|
|
357
377
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pinia-plugin-subscription",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.2",
|
|
4
4
|
"description": "Pinia plugin for Vue.js that helps building Pinia plugins by centralizing subscriber registration and providing a Store base class for store helpers.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constantes-BsD73jkk.js","sources":["../../src/core/PluginSubscriber.ts","../../src/utils/store.ts","../../src/utils/validation/index.ts","../../src/core/Store.ts"],"sourcesContent":["import Store from \"./Store\";\nimport type { PiniaPluginContext, Store as PiniaStore } from \"pinia\";\nimport type { AnyObject } from \"../types\";\nimport type {\n PluginExecutionOptions,\n PluginHydrationScheduler,\n PluginSubscriber as PluginSubscriberInterface,\n PluginSubscriptions,\n StoreMutationSubscription,\n StoreOnActionSubscription\n} from \"../types/plugin\";\nimport type Tracer from \"../system/Tracer\";\n\n\n\ntype CreateInstance<Instance = Store> = (store: PiniaStore, options: AnyObject) => Instance | undefined\n\n\n/**\n * Type definition for the function used to create an instance of a store.\n * @template Instance The type of the store instance, defaulting to the base Store class.\n * @param store The Pinia store for which the instance is being created.\n * @param options Additional options for creating the store instance.\n * @returns The created store instance or undefined if creation fails.\n */\nexport default abstract class PluginSubscriber<Instance extends Store> implements PluginSubscriberInterface {\n private _createInstance: CreateInstance\n private _name: string\n private _pluginOptions?: AnyObject\n private _storeInstance?: Instance\n /** Callback function to reset the store instance, if needed. */\n protected _resetStoreCallback?: (store?: PiniaStore) => void\n private _storeOnActionSubscription?: StoreOnActionSubscription\n private _storeMutationSubscription?: StoreMutationSubscription\n private _subscriptions?: PluginSubscriptions\n /**\n * Called when the plugin subscriber has been created for a specific store.\n * This callback can be used to perform any initialization or setup required for the plugin subscriber.\n */\n protected pluginCreated?: (store: PiniaStore) => void\n /** Options for the plugin subscriber's execution. */\n public execution?: PluginExecutionOptions\n /** Scheduler for handling the hydration process of the plugin subscriber. */\n public hydrationScheduler?: PluginHydrationScheduler\n\n\n get name(): string {\n return this._name;\n }\n\n get storeInstance(): Instance | undefined {\n return this._storeInstance\n }\n\n get pluginOptions(): AnyObject {\n return this._pluginOptions ?? {};\n }\n\n set pluginOptions(options: AnyObject | undefined) {\n this._pluginOptions = options;\n }\n\n get resetStoreCallback(): ((store?: PiniaStore) => void) | undefined {\n return this._resetStoreCallback as ((store?: PiniaStore) => void) | undefined;\n }\n\n get storeOnActionSubscription(): StoreOnActionSubscription | undefined {\n return this._storeOnActionSubscription;\n }\n\n get storeMutationSubscription(): StoreMutationSubscription | undefined {\n return this._storeMutationSubscription;\n }\n\n get subscriptions(): PluginSubscriptions | undefined {\n return this._subscriptions\n }\n\n set subscriptions(subscriptions: PluginSubscriptions) {\n this._subscriptions = subscriptions\n }\n\n\n constructor(pluginName: string, createInstanceFunction: CreateInstance) {\n this._name = pluginName\n this._createInstance = createInstanceFunction\n }\n\n /**\n * Called after the store has been hydrated.\n * @param context The Pinia plugin context containing the store and options.\n * @returns A promise that resolves when the post-hydration process is complete, or void if synchronous.\n */\n public afterHydration(context: PiniaPluginContext): void | Promise<void> {\n return\n }\n\n /**\n * Called when the plugin subscriber needs to hydrate its state.\n * @param context The Pinia plugin context containing the store and options.\n * @returns A promise that resolves when the hydration process is complete, or void if synchronous.\n */\n public hydrate(context: PiniaPluginContext): void | Promise<void> {\n return\n }\n\n /**\n * Invokes the plugin subscriber with the given context and optional tracer creation function.\n * @param context The Pinia plugin context containing the store and options.\n * @param createTracer Optional function to create a tracer for the plugin.\n * @returns True if the plugin was successfully invoked, otherwise false.\n */\n public invoke({ store, options }: PiniaPluginContext, createTracer?: (name: string) => Tracer): boolean {\n this._storeInstance = this._createInstance(store, { ...options, ...this.pluginOptions, createTracer }) as Instance\n\n if (!this._storeInstance) {\n return false\n }\n\n this._subscriptions = this._storeInstance.getSubscriptions()\n this._storeMutationSubscription = this._storeInstance.storeSubscribe\n this._storeOnActionSubscription = this._storeInstance.onAction\n\n if (this.pluginCreated) {\n this.pluginCreated(store)\n }\n\n return true\n }\n}","import { defineStore } from \"pinia\"\nimport type {\n DefineSetupStoreOptions,\n DefineStoreOptions,\n SetupStoreDefinition,\n StateTree,\n Store,\n StoreDefinition,\n _ExtractActionsFromSetupStore,\n _ExtractGettersFromSetupStore,\n _ExtractStateFromSetupStore,\n _GettersTree\n} from \"pinia\"\nimport type { AnyObject } from \"../types\"\nimport type {\n DefineAStoreDefinition,\n DefineAStoreSetupContext,\n EmptyExtensions,\n PluginStoreOptions,\n StoreOptions\n} from \"../types/store\"\n\n\nexport const itemState = {\n '@id': undefined,\n id: undefined\n}\n\ntype DefineAStoreSetup<SS, TExtraExtensions extends Record<string, unknown> = EmptyExtensions> =\n (ctx: DefineAStoreSetupContext<SS, TExtraExtensions>) => SS\n\n/**\n * Options parameter of pinia's `defineStore()` for setup stores, derived from\n * the setup function return type.\n */\ntype DefineAStoreSetupOptions<Id extends string, SS> = DefineSetupStoreOptions<\n Id,\n _ExtractStateFromSetupStore<SS>,\n _ExtractGettersFromSetupStore<SS>,\n _ExtractActionsFromSetupStore<SS>\n>\n\nconst defineAStoreSetupContexts = new WeakMap<object, DefineAStoreSetupContext<AnyObject>>()\nconst defineAStoreSetupContextsById = new Map<string, DefineAStoreSetupContext<AnyObject>>()\nconst setupContextDisposeWrappedStores = new WeakSet<object>()\n\nfunction registerSetupContextCleanupOnDispose(\n store: AnyObject,\n id: string\n): void {\n if (setupContextDisposeWrappedStores.has(store) || typeof store.$dispose !== 'function') {\n return\n }\n\n const originalDispose = store.$dispose as (...args: unknown[]) => unknown\n store.$dispose = (...args: unknown[]) => {\n defineAStoreSetupContexts.delete(store)\n defineAStoreSetupContextsById.delete(id)\n return originalDispose.apply(store, args)\n }\n setupContextDisposeWrappedStores.add(store)\n}\n\n/**\n * Define a store with the setup API. State, getters and actions are inferred\n * from the setup function return, exactly like pinia's `defineStore`, so\n * store members are listed by IDEs and action prototypes are preserved.\n * @template Id The type of the store identifier.\n * @template SS The type of the setup function return.\n * @param id The unique identifier for the store.\n * @param storeDefinition The setup function defining the store.\n * @param options Optional store options.\n * @returns The defined store.\n */\nexport function defineAStore<Id extends string, SS>(\n id: Id,\n storeDefinition: (ctx?: DefineAStoreSetupContext<AnyObject>) => SS,\n options?: StoreOptions\n): SetupStoreDefinition<Id, SS>\n/**\n * Define a store with the options API, mirroring pinia's `defineStore` inference.\n * @template Id The type of the store identifier.\n * @template S The type of the store's state.\n * @template G The type of the store's getters.\n * @template A The type of the store's actions.\n * @param id The unique identifier for the store.\n * @param storeDefinition The store options definition.\n * @param options Optional store options.\n * @returns The defined store.\n */\nexport function defineAStore<Id extends string, S extends StateTree = {}, G extends _GettersTree<S> = {}, A = {}>(\n id: Id,\n storeDefinition: Omit<DefineStoreOptions<Id, S, G, A>, 'id'>,\n options?: StoreOptions\n): StoreDefinition<Id, S, G, A>\n/**\n * Define a store with explicit store/state types, e.g. when plugins augment\n * the store with members not returned by the setup function.\n * @template Sto The type of the store.\n * @template Sta The type of the store's state.\n * @param id The unique identifier for the store.\n * @param storeDefinition The store definition, either as an options object or a setup function.\n * @param options Optional store options.\n * @returns The defined store.\n */\nexport function defineAStore<Sto, Sta>(\n id: string,\n storeDefinition:\n | Omit<DefineStoreOptions<string, StateTree & Sta, AnyObject, Partial<Sto>>, 'id'>\n | ((ctx?: DefineAStoreSetupContext<Sto & Sta>) => AnyObject),\n options?: StoreOptions\n): DefineAStoreDefinition<Sto, Sta>\nexport function defineAStore(\n id: string,\n storeDefinition:\n | Omit<DefineStoreOptions<string, StateTree, AnyObject, AnyObject>, 'id'>\n | DefineAStoreSetup<AnyObject>,\n options?: StoreOptions\n): StoreDefinition {\n const storeOptions: PluginStoreOptions = options ? { storeOptions: options } : {} as PluginStoreOptions\n\n return (typeof storeDefinition === 'function'\n ? defineAStoreSetup(\n id,\n storeDefinition as DefineAStoreSetup<AnyObject>,\n storeOptions\n )\n : defineAStoreOptionApi(\n id,\n storeDefinition,\n storeOptions\n )) as StoreDefinition\n}\n\n/**\n * Define a store with a required, fully typed setup context. State, getters\n * and actions are inferred from the setup function return.\n * @template Id The type of the store identifier.\n * @template SS The type of the setup function return.\n * @template TExtraExtensions The type of the store's extra extensions.\n * @param id The unique identifier for the store.\n * @param storeDefinition The setup function defining the store.\n * @param options Optional store options.\n * @returns The defined store with setup context.\n */\nexport function defineAStoreCtx<Id extends string, SS, TExtraExtensions extends Record<string, unknown> = EmptyExtensions>(\n id: Id,\n storeDefinition: (ctx: DefineAStoreSetupContext<AnyObject, TExtraExtensions>) => SS,\n options?: StoreOptions\n): SetupStoreDefinition<Id, SS>\n/**\n * Define a store with a setup context and explicit store/state types, e.g.\n * when plugins augment the store with members not returned by the setup function.\n * @template Sto The type of the store.\n * @template Sta The type of the store's state.\n * @template TExtraExtensions The type of the store's extra extensions.\n * @param id The unique identifier for the store.\n * @param storeDefinition The setup function defining the store.\n * @param options Optional store options.\n * @returns The defined store with setup context.\n */\nexport function defineAStoreCtx<Sto, Sta, TExtraExtensions extends Record<string, unknown> = EmptyExtensions>(\n id: string,\n storeDefinition: (ctx: DefineAStoreSetupContext<Sto & Sta, TExtraExtensions>) => AnyObject,\n options?: StoreOptions\n): DefineAStoreDefinition<Sto, Sta>\nexport function defineAStoreCtx(\n id: string,\n storeDefinition: DefineAStoreSetup<AnyObject, any>,\n options?: StoreOptions\n): StoreDefinition {\n const storeOptions: PluginStoreOptions = options\n ? { storeOptions: { ...options, enhancedStore: true } }\n : { storeOptions: { enhancedStore: true } } as PluginStoreOptions\n\n return defineAStoreSetup(\n id,\n storeDefinition,\n storeOptions\n ) as StoreDefinition\n}\n\nexport function defineAStoreSetup<Id extends string, SS>(\n id: Id,\n storeDefinition: DefineAStoreSetup<SS>,\n options: PluginStoreOptions\n): SetupStoreDefinition<Id, SS> {\n const setupContext: DefineAStoreSetupContext<SS> = {\n id,\n extensions: {}\n }\n\n const shouldStoreSetupContext = options?.storeOptions?.enhancedStore === true\n\n // `storeOptions` augments pinia's DefineStoreOptionsBase (see createPlugin.ts);\n // the assertion stays valid in compilation units where the augmentation is not loaded.\n const useStore = defineStore(\n id,\n () => storeDefinition(setupContext),\n options as unknown as DefineAStoreSetupOptions<Id, SS>\n )\n\n return Object.assign(((...args: Parameters<typeof useStore>) => {\n if (shouldStoreSetupContext) {\n defineAStoreSetupContextsById.set(id, setupContext as DefineAStoreSetupContext<AnyObject>)\n }\n\n const store = useStore(...args)\n\n if (shouldStoreSetupContext) {\n defineAStoreSetupContexts.set(store, setupContext as DefineAStoreSetupContext<AnyObject>)\n defineAStoreSetupContextsById.delete(id)\n registerSetupContextCleanupOnDispose(store as AnyObject, id)\n }\n\n return store\n }) as typeof useStore, useStore)\n}\n\nexport function defineAStoreOptionApi<Id extends string, S extends StateTree = {}, G extends _GettersTree<S> = {}, A = {}>(\n id: Id,\n storeDefinition: Omit<DefineStoreOptions<Id, S, G, A>, 'id'>,\n options?: PluginStoreOptions\n): StoreDefinition<Id, S, G, A> {\n if (options) {\n storeDefinition = { ...storeDefinition, ...(options ?? {}) }\n }\n\n return defineStore(id, storeDefinition)\n}\n\nconst deniedFirstChar = new Set<string>(['_', '$'])\n\n/**\n * Check if a property has a denied first character : ['_', '$'].\n * @param property The property name to check.\n * @returns True if the property has a denied first character, false otherwise.\n */\nexport function hasDeniedFirstChar(property: string): boolean {\n return deniedFirstChar.has(property[0] as string)\n}\n\n/**\n * Get the setup context associated with a store instance (or pending store id).\n * @param store The store instance, or an object exposing the store `$id`.\n * @returns The setup context when the store was defined with `enhancedStore` enabled, undefined otherwise.\n */\nexport function getDefineAStoreSetupContext(store: object): DefineAStoreSetupContext<AnyObject> | undefined {\n const storeRecord = store as AnyObject\n\n return defineAStoreSetupContexts.get(store)\n ?? (typeof storeRecord?.$id === 'string'\n ? defineAStoreSetupContextsById.get(storeRecord.$id)\n : undefined)\n}\n\n/**\n * Get the enhanced store from the context.\n * @template TEnhancedStore The type of the enhanced store.\n * @param ctx The context containing the extensions.\n * @returns The enhanced store casted to the specified types.\n */\nexport function getEnhancedStore<TEnhancedStore>(\n ctx: DefineAStoreSetupContext<TEnhancedStore>\n): TEnhancedStore {\n const enhancedStore = ctx.extensions.enhancedStore ?? ctx.extensions.extending\n\n if (!enhancedStore) {\n throw new Error(`${ctx.id}Store - getEnhancedStore - Error: enhanced store is required`)\n }\n\n return enhancedStore\n}\n\n/**\n * Set the enhanced store in context with deprecated alias support.\n * @template TEnhancedStore The type of the enhanced store.\n * @param ctx The context containing the extensions.\n * @param store The store to expose as enhancement.\n */\nexport function setEnhancedStore<TEnhancedStore>(\n ctx: DefineAStoreSetupContext<TEnhancedStore>,\n store: TEnhancedStore\n): void {\n ctx.extensions.enhancedStore = store\n ctx.extensions.extending = store\n}\n\n/**\n * @deprecated Use getEnhancedStore instead.\n */\nexport function getExtendingStore<TEnhancedStore>(\n ctx: DefineAStoreSetupContext<TEnhancedStore>\n): TEnhancedStore {\n console.warn(`${ctx.id}Store - getExtendingStore is deprecated. Use getEnhancedStore instead.`)\n return getEnhancedStore<TEnhancedStore>(ctx)\n}\n\n/**\n * Get the storage key for a given action and store combination.\n * @param actionName The name of the action.\n * @param store The Pinia store instance.\n * @returns The storage key for the action and store combination.\n */\nexport function getActionStoreKey(actionName: string, store: Store): string {\n return `${actionName}-${store.$id}`\n}","export function isEmpty(value: any): boolean {\n if (!value) {\n return (typeof value === 'boolean' || typeof value === 'number') ? false : true\n }\n\n if (Array.isArray(value)) {\n return value.length === 0\n }\n\n if (typeof value === 'object') {\n return Object.keys(value).length === 0\n }\n\n if (typeof value === 'string') {\n return value.trim() === ''\n }\n\n return false\n}","import { isRef, ref, toRef, type Ref } from \"vue\"\nimport Tracer from \"../system/Tracer\"\nimport { getDefineAStoreSetupContext, hasDeniedFirstChar, setEnhancedStore } from \"../utils/store\"\nimport { isEmpty } from \"../utils/validation\"\n\nimport type {\n PluginSubscriptionOptions,\n PluginSubscriptions,\n StoreMutationSubscription,\n StoreMutationSubscriptionCallback,\n StoreMutationSubscriptionReturn,\n StoreOnActionSubscription,\n StoreOnActionSubscriptionCallback,\n StoreOnActionSubscriptionReturn\n} from \"../types/plugin\"\nimport type { Store as PiniaStore, StateTree } from \"pinia\"\nimport type { TracePayload } from \"../types/trace\"\nimport type { AnyObject, PluginSubscriberInterface } from \"../types\"\nimport type { StoreOptions, StatePropertyValue, PluginStoreOptions } from \"../types/store\"\n\n/**\n * Base class for a Pinia store with enhanced capabilities.\n * Provides structured tracing, plugin subscriptions, and state management utilities.\n */\nexport default class Store {\n protected _className = 'Store'\n private _onAction?: StoreOnActionSubscriptionCallback\n private _options: StoreOptions\n private _store: PiniaStore\n private _subscriptions: PluginSubscriptions = {}\n private _storeSubscribe?: StoreMutationSubscriptionCallback\n private _tracer?: Tracer\n private _createTracer?: PluginSubscriptionOptions['createTracer']\n\n protected static _requiredKeys?: string[]\n\n get onAction(): StoreOnActionSubscription | undefined {\n if (!this._onAction) {\n return\n }\n\n return () => ({\n store: this.store as PiniaStore,\n callback: this._onAction\n }) as StoreOnActionSubscriptionReturn\n }\n\n set onAction(onAction: StoreOnActionSubscriptionCallback) {\n this._onAction = onAction\n }\n\n get options(): StoreOptions { return this._options }\n\n get state(): StateTree { return this._store.$state }\n\n set state(state: StateTree) { this._store.$state = state }\n\n get store(): AnyObject { return this._store }\n\n get storeSubscribe(): StoreMutationSubscription | undefined {\n if (!this._storeSubscribe) {\n return\n }\n\n return () => ({\n store: this.store as PiniaStore,\n callback: this._storeSubscribe\n }) as StoreMutationSubscriptionReturn\n }\n\n set storeSubscribe(storeSubscribe: StoreMutationSubscriptionCallback) {\n this._storeSubscribe = storeSubscribe\n }\n\n /**\n * Returns the structured trace emitter of this store.\n * Built lazily so that subclasses overriding `_className` are reflected.\n */\n protected get tracer(): Tracer | undefined {\n if (!this._tracer && this._createTracer) {\n this._tracer = this._createTracer(this._className)\n this._tracer.scope = this.store.$id\n }\n\n return this._tracer\n }\n\n constructor(store: PiniaStore, options: PluginStoreOptions & PluginSubscriptionOptions) {\n this._options = options.storeOptions\n this._store = store\n this.initializeTracer(options)\n\n if (this._options?.enhancedStore) {\n const ctx = getDefineAStoreSetupContext(this.store)\n\n if (ctx) {\n setEnhancedStore(ctx, this.store)\n }\n }\n }\n\n /**\n * Adds a property to the state of this store.\n * @param name The name of the property to add.\n * @param value The value of the property to add.\n */\n addToState(name: string, value?: StatePropertyValue): void {\n if (!this.isOptionApi()) {\n if (!isRef(value)) {\n value = ref<StatePropertyValue>(value)\n }\n }\n\n this.state[name] = value\n this.store[name] = toRef(this.state, name)\n }\n\n /**\n * Adds a subscription for a specific plugin to this store.\n * @param pluginName The name of the plugin for which the subscription is being added.\n * @param subscription The subscription callback or object to add.\n * @param options Additional options for the subscription, including subscription options and target stores.\n */\n addSubscription(\n pluginName: string,\n subscription: PluginSubscriberInterface,\n options?: { subscriptionOptions?: StoreOptions, stores?: PiniaStore[] }\n ): void {\n this._subscriptions[pluginName] = { subscription, ...(options ?? {}) }\n }\n\n /**\n * Called after the store has been hydrated.\n * @returns A promise that resolves when the post-hydration process is complete, or void if synchronous.\n */\n afterHydration(): void | Promise<void> {\n return\n }\n\n /**\n * Create and return a class instance\n * @param store \n * @param options \n * @returns \n */\n static customizeStore<Instance extends Store>(\n store: PiniaStore,\n options: PluginStoreOptions & PluginSubscriptionOptions\n ): Instance | undefined {\n if (options.storeOptions && this.hasRequiredKeys(options.storeOptions)) {\n return new this(store, options) as Instance\n }\n }\n\n /**\n * Retrieves the value of a specific store option.\n * @param optionName The name of the store option to retrieve.\n * @returns The value of the specified store option, or undefined if not found.\n */\n getOption(optionName: keyof StoreOptions) {\n return this.options && (this.options as StoreOptions)[optionName]\n }\n\n /**\n * Retrieves the value of a specific state property.\n * @param propertyName The name of the state property to retrieve.\n * @returns The value of the specified state property, or undefined if not found.\n */\n getStatePropertyValue(propertyName: string) {\n return this.getValue(this.state[propertyName])\n }\n\n /**\n * Retrieves all plugin subscriptions for this store.\n * @returns An object containing all plugin subscriptions, or undefined if there are none.\n */\n getSubscriptions(): PluginSubscriptions | undefined {\n if (isEmpty(this._subscriptions)) {\n return\n }\n\n return this._subscriptions\n }\n\n /**\n * Retrieves the actual value from a potentially reactive reference.\n * @param value The value to unwrap.\n * @returns The unwrapped value if it is a reactive reference, otherwise the original value.\n */\n getValue(value: any) {\n return value?.__v_isRef ? value.value : value\n }\n\n /**\n * Checks if the given property name has a denied first character.\n * @param property The property name to check.\n * @returns True if the property name has a denied first character, otherwise false.\n */\n protected hasDeniedFirstChar(property: string): boolean {\n return hasDeniedFirstChar(property)\n }\n\n /**\n * Checks if the given options object has all the required keys.\n * @param options The options object to check.\n * @returns True if all required keys are present, otherwise false.\n */\n protected static hasRequiredKeys(options: AnyObject): boolean {\n return this._requiredKeys !== undefined && this._requiredKeys?.every(requiredKey => !!options[requiredKey])\n }\n\n /**\n * Hydrates the store, potentially performing asynchronous operations.\n * @returns void or a Promise that resolves when hydration is complete.\n */\n hydrate(): void | Promise<void> {\n return\n }\n\n /**\n * Initializes the tracer for plugin subscriptions if the createTracer option is provided.\n * @param options The plugin subscription options containing the createTracer function.\n */\n private initializeTracer(options: PluginSubscriptionOptions) {\n this._createTracer = options?.createTracer\n }\n\n /**\n * Checks if the store is using the Options API.\n * @returns True if the store is using the Options API, otherwise false.\n */\n isOptionApi(): boolean { return this.store._isOptionsAPI }\n\n /**\n * Checks if the state object has the specified property.\n * @param property The property name to check.\n * @returns True if the state object has the property, otherwise false.\n */\n stateHas(property: string): boolean { return Object.prototype.hasOwnProperty.call(this.state, property) }\n\n /**\n * Checks if the store object has the specified property.\n * @param property The property name to check.\n * @returns True if the store object has the property, otherwise false.\n */\n storeHas(property: string): boolean { return Object.prototype.hasOwnProperty.call(this.store, property) }\n\n /**\n * Emits a structured trace event scoped to this store.\n * Prefer the factory form for `payload`: it is only resolved when consumed.\n */\n trace(namespace: string, payload?: TracePayload): void {\n if (this.tracer) {\n this.tracer.debug(namespace, payload)\n }\n }\n\n /**\n * Emits a structured error event, or rethrows it when no listener matches.\n */\n traceError(namespace: string, error: unknown, payload?: TracePayload): void {\n if (this.tracer) {\n this.tracer.error(namespace, error, payload)\n } else {\n console.error(error)\n }\n }\n}"],"names":["PluginSubscriber","pluginName","createInstanceFunction","__publicField","options","subscriptions","context","store","createTracer","defineAStoreSetupContexts","defineAStoreSetupContextsById","setupContextDisposeWrappedStores","registerSetupContextCleanupOnDispose","id","originalDispose","args","storeOptions","storeDefinition","defineAStoreSetup","defineAStoreOptionApi","defineAStoreCtx","setupContext","shouldStoreSetupContext","useStore","defineStore","deniedFirstChar","property","getDefineAStoreSetupContext","storeRecord","getEnhancedStore","ctx","enhancedStore","setEnhancedStore","getExtendingStore","getActionStoreKey","actionName","isEmpty","value","Store","onAction","state","storeSubscribe","name","isRef","ref","subscription","optionName","propertyName","hasDeniedFirstChar","requiredKey","namespace","payload","error"],"mapp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AAcC,CAAM;AAAA,EACpC;AAAA,EAAA,WAAAD,GAAAE,GAAAD,GAAA;AAAA,IAAA,KAAA,qBAMA,MAAoDD,GAAAE,GAAAD,CAAA,IAE5C,QAAA,MAAAC,CAAA;AAAA,EAGJ;AAAY;AD1KhBjD,EAXGmC,GAWH;AC2KA,MAAArC,IAAA;"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Console } from '../types/log';
|
|
2
|
-
import type { TraceListener } from '../types/trace';
|
|
3
|
-
/**
|
|
4
|
-
* Creates an opt-in trace listener that reproduces the former console output.
|
|
5
|
-
*/
|
|
6
|
-
export declare function createConsoleTraceListener(target?: Console): TraceListener;
|