pinia-plugin-subscription 1.0.0-beta.13 → 1.0.0-beta.14
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 +14 -2
- package/README.md +15 -4
- package/dist/chunks/trace-registry-Cm_2un0x.js +1009 -0
- package/dist/chunks/trace-registry-Cm_2un0x.js.map +1 -0
- package/dist/chunks/traceGroups-DfxYkUpm.js +105 -0
- package/dist/chunks/traceGroups-DfxYkUpm.js.map +1 -0
- package/dist/core/PluginSubscription.d.ts +13 -12
- package/dist/devtools/components.d.ts +40 -0
- package/dist/devtools/index.d.ts +9 -0
- package/dist/devtools/model.d.ts +17 -0
- package/dist/devtools/styles.d.ts +1 -0
- package/dist/devtools.js +377 -0
- package/dist/devtools.js.map +1 -0
- package/dist/factories/trace-listener.d.ts +6 -7
- package/dist/factories/trace-registry.d.ts +1 -1
- package/dist/helpers/index.d.ts +2 -2
- package/dist/helpers.js +50 -638
- package/dist/helpers.js.map +1 -1
- package/dist/pinia-plugin-subscription.js +44 -18
- package/dist/pinia-plugin-subscription.js.map +1 -1
- package/dist/system/TraceJournal.d.ts +6 -0
- package/dist/system/Tracer.d.ts +6 -2
- package/dist/types/devtools.d.ts +60 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/plugin.d.ts +6 -0
- package/dist/types/trace.d.ts +79 -21
- package/dist/utils/constants.d.ts +2 -1
- package/dist/utils/toSerializable.d.ts +10 -0
- package/dist/utils/traceContext.d.ts +7 -0
- package/dist/utils/traceGroups.d.ts +11 -7
- package/docs/authoring-plugins.md +2 -2
- package/docs/tracing.md +119 -28
- package/docs/using-plugins.md +17 -12
- package/package.json +9 -1
- package/dist/chunks/PluginSubscription-Bkqj4uSK.js +0 -662
- package/dist/chunks/PluginSubscription-Bkqj4uSK.js.map +0 -1
- package/dist/factories/console-trace-listener.d.ts +0 -7
- 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/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/object.d.ts +0 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace-registry-Cm_2un0x.js","sources":["../../src/utils/deep-clone.ts","../../src/factories/state-snapshot.ts","../../src/utils/store.ts","../../src/core/RollbackStateSnapshotsHandler.ts","../../src/system/TraceEmitter.ts","../../src/core/PluginSubscription.ts","../../src/utils/validation/index.ts","../../src/utils/constants.ts","../../src/system/Tracer.ts","../../src/system/TraceJournal.ts","../../src/factories/trace-listener.ts","../../src/utils/environment.ts","../../src/utils/redact.ts"],"sourcesContent":["/**\n * Deeply clones the provided value, handling objects, arrays, maps, and sets. Uses `structuredClone` if available, otherwise falls back to a manual deep clone.\n * @template T The type of the value to deep clone.\n * @param value The value to deep clone.\n * @returns A deep clone of the provided value.\n */\nexport function deepClone<T>(value: T): T {\n if (typeof structuredClone === 'function') {\n try {\n return structuredClone(value)\n } catch {\n // fall through to the safe manual clone below\n }\n }\n\n if (value === null || typeof value !== 'object') {\n return value\n }\n\n if (value instanceof Map) {\n return new Map(\n Array.from(value.entries(), ([key, entryValue]) => [deepClone(key), deepClone(entryValue)])\n ) as T\n }\n\n if (value instanceof Set) {\n return new Set(Array.from(value.values(), entryValue => deepClone(entryValue))) as T\n }\n\n if (Array.isArray(value)) {\n return value.map(item => deepClone(item)) as T\n }\n\n if (Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null) {\n return Object.fromEntries(\n Object.entries(value as Record<string, unknown>).map(([key, item]) => [key, deepClone(item)])\n ) as T\n }\n\n const clonedObject = Object.create(Object.getPrototypeOf(value)) as Record<string, unknown>\n for (const [key, item] of Object.entries(value as Record<string, unknown>)) {\n clonedObject[key] = deepClone(item)\n }\n\n return clonedObject as T\n}","import { toRaw } from 'vue'\nimport { deepClone } from '../utils/deep-clone'\n\nimport type { StateTree } from 'pinia'\nimport type { CreateStateSnapshotKeys } from '../types/plugin'\n\n\nexport function createStateSnapshot(state: StateTree, keys: CreateStateSnapshotKeys = 'all') {\n if (Array.isArray(keys)) {\n const clonedState: Partial<StateTree> = {}\n for (const key of keys) {\n if (key in state) {\n clonedState[key] = deepClone(toRaw(state[key]))\n }\n }\n return clonedState\n }\n\n if (keys !== 'all') {\n throw new Error(`Invalid keys parameter: ${keys}`)\n }\n\n return deepClone(toRaw(state))\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 StoreOptions\n} from \"../types/store\"\nimport type { PluginStoreOptions } from \"../types/plugin\"\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<unknown, 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 let setupContext: DefineAStoreSetupContext<SS> | undefined\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 () => {\n setupContext = {\n id,\n extensions: {}\n }\n\n if (shouldStoreSetupContext) {\n defineAStoreSetupContextsById.set(id, setupContext as DefineAStoreSetupContext<AnyObject>)\n }\n\n return storeDefinition(setupContext)\n },\n options as unknown as DefineAStoreSetupOptions<Id, SS>\n )\n\n return Object.assign(((...args: Parameters<typeof useStore>) => {\n const store = useStore(...args)\n\n if (shouldStoreSetupContext && setupContext) {\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\nexport function getEnhancedStore<TEnhancedStore>(\n ctx: DefineAStoreSetupContext<unknown>\n): TEnhancedStore\nexport function getEnhancedStore<TEnhancedStore>(\n ctx: DefineAStoreSetupContext<unknown>\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 as TEnhancedStore\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\nexport function setEnhancedStore<TEnhancedStore>(\n ctx: DefineAStoreSetupContext<unknown>,\n store: TEnhancedStore\n): void\nexport function setEnhancedStore(\n ctx: DefineAStoreSetupContext<unknown>,\n store: unknown\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\nexport function getExtendingStore<TEnhancedStore>(\n ctx: DefineAStoreSetupContext<unknown>\n): TEnhancedStore\nexport function getExtendingStore<TEnhancedStore>(\n ctx: DefineAStoreSetupContext<unknown>\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 getStoreScopedKey(actionName, store)\n}\n\nexport function getStoreKeyPrefix(store: Pick<Store, '$id'>): string {\n const storeId = String(store.$id)\n return `${storeId.length}:${storeId}:`\n}\n\nexport function getStoreScopedKey(value: string, store: Pick<Store, '$id'>): string {\n return `${getStoreKeyPrefix(store)}${value.length}:${value}`\n}","import { createStateSnapshot } from \"../factories/state-snapshot\"\nimport { getActionStoreKey, getStoreKeyPrefix, hasDeniedFirstChar } from '../utils/store'\n\nimport type { PiniaPluginContext, StateTree, Store } from 'pinia'\nimport type { AnyObject } from '../types'\nimport type { CreateStateSnapshotKeys } from '../types/plugin'\nimport type { RollbackActionParams } from '../types/store'\n\n\n/**\n * Handles rollback state snapshots for Pinia stores.\n * This class provides methods to add rollback actions to stores,\n * create rollback snapshots, and manage the state snapshots internally.\n */\nexport default class RollbackStateSnapshotsHandler {\n private _stateSnapshots: Map<symbol, StateTree> = new Map()\n private _storeHasRollbackSnapshots: Set<string> = new Set()\n private _storeRollbackSnapshotsParams: Map<string, CreateStateSnapshotKeys> = new Map()\n\n\n /**\n * Adds a rollback action to the given store.\n * This method extends the store with a $rollbackAfterFailure function that handles rollback logic for actions.\n * The action arguments are forwarded through apply(), so they must be provided as a single array.\n * @param {Store} store The store to which the rollback action will be added.\n * @returns void\n */\n addRollbackAction(store: Store): void {\n if (typeof store.$rollbackAfterFailure === 'function') {\n return\n }\n\n store.$rollbackAfterFailure = async ({ action, stateKeys }: RollbackActionParams, args: any[] = []) => {\n const actionFn = (store as AnyObject)[action]\n if (typeof actionFn !== 'function' || hasDeniedFirstChar(action)) {\n return\n }\n\n const keys: CreateStateSnapshotKeys = !stateKeys || stateKeys.length === 0 ? 'all' : stateKeys\n\n const snapshotKey = this.saveStateSnapshot(store, action, keys)\n try {\n await actionFn.apply(store, args)\n } catch (error) {\n this.patchStore(snapshotKey, store)\n throw error\n } finally {\n this.removeStateSnapshot(snapshotKey)\n }\n }\n }\n\n /**\n * Creates a rollback snapshot for the specified action and store.\n * This snapshot can be used to restore the store's state in case of an error during the action execution.\n * @param {string} actionName The name of the action for which the rollback snapshot is created.\n * @param {Store} store The Pinia store instance.\n * @returns An object containing `after` and `onError` callbacks for handling the rollback, or `undefined` if no snapshot is created.\n */\n createOnActionCallbacks(\n actionName: string,\n store: Store\n ): {\n after: () => void,\n onError: () => void\n } | undefined {\n const stateKeys = this._storeRollbackSnapshotsParams.get(\n getActionStoreKey(actionName, store)\n )\n\n if (!stateKeys) {\n return\n }\n\n const keys: CreateStateSnapshotKeys = (stateKeys.length === 0 || stateKeys[0] === 'all') ? 'all' : stateKeys\n const snapshotKey = this.saveStateSnapshot(store, actionName, keys)\n\n return {\n after: () => { this.removeStateSnapshot(snapshotKey) },\n onError: () => {\n this.patchStore(snapshotKey, store)\n this.removeStateSnapshot(snapshotKey)\n }\n }\n }\n\n /**\n * Initializes the rollback state snapshots handler from the given Pinia plugin context.\n * This method extracts the rollback snapshot parameters from the store options and stores them internally.\n * @param {PiniaPluginContext} param0 The Pinia plugin context containing the store and its options.\n * @returns void\n */\n initFromPluginContext({ options, store }: PiniaPluginContext) {\n const rollbackSnapshotParams = options?.storeOptions?.rollbackAfterFailure as Record<string, CreateStateSnapshotKeys>\n if (rollbackSnapshotParams && !this._storeHasRollbackSnapshots.has(store.$id)) {\n Object.keys(rollbackSnapshotParams).forEach(key => {\n const stateKeys = rollbackSnapshotParams[key]\n if (stateKeys) {\n this._storeRollbackSnapshotsParams.set(\n getActionStoreKey(key, store),\n stateKeys\n )\n }\n })\n this._storeHasRollbackSnapshots.add(store.$id)\n }\n this.addRollbackAction(store)\n }\n\n /**\n * Clears all rollback tracking data for the given store.\n * Must be called when the store is disposed to avoid memory leaks with dynamically created stores.\n * @param {Store} store The disposed Pinia store instance.\n * @returns void\n */\n clearStoreTracking(store: Store): void {\n const keyPrefix = getStoreKeyPrefix(store)\n\n for (const key of Array.from(this._storeRollbackSnapshotsParams.keys())) {\n if (key.startsWith(keyPrefix)) {\n this._storeRollbackSnapshotsParams.delete(key)\n }\n }\n\n this._storeHasRollbackSnapshots.delete(store.$id)\n\n for (const snapshotKey of Array.from(this._stateSnapshots.keys())) {\n if (snapshotKey.description?.startsWith(keyPrefix)) {\n this._stateSnapshots.delete(snapshotKey)\n }\n }\n }\n\n private patchStore(snapshotKey: symbol, store: Store): void {\n const stateSnapshot = this._stateSnapshots.get(snapshotKey)\n if (!stateSnapshot) {\n return\n }\n\n try {\n store.$patch(stateSnapshot)\n } catch (error) {\n console.error(`Failed to patch store with snapshot ${String(snapshotKey)}`, error)\n }\n }\n\n /**\n * Removes a state snapshot identified by the given snapshot key from the internal state snapshot tracking.\n * @param snapshotKey The key of the state snapshot to be removed.\n * @returns void\n */\n private removeStateSnapshot(snapshotKey?: symbol): void {\n if (!snapshotKey) {\n return\n }\n\n this._stateSnapshots.delete(snapshotKey)\n }\n\n /**\n * Saves the current state snapshot for a given store and action.\n * @param store The Pinia store instance.\n * @param actionName The name of the action being executed.\n * @param stateKeys The state keys to include in the snapshot, or 'all' for the full state.\n * @returns A unique symbol key representing the saved snapshot.\n */\n private saveStateSnapshot(store: Store, actionName: string, stateKeys: CreateStateSnapshotKeys): symbol {\n const stateSnapshot = createStateSnapshot(\n store.$state,\n stateKeys\n )\n\n const snapshotKey = Symbol(getActionStoreKey(actionName, store))\n this._stateSnapshots.set(snapshotKey, stateSnapshot)\n return snapshotKey\n }\n\n /**\n * Checks if the given store has rollback snapshots.\n * @param store The Pinia store instance.\n * @returns True if the store has rollback snapshots, false otherwise.\n */\n storeHasRollbackSnapshots(store: Store): boolean {\n return this._storeHasRollbackSnapshots.has(store.$id)\n }\n}","import type Tracer from './Tracer'\nimport type { TracePayload } from '../types/trace'\n\n/**\n * Base class for objects emitting structured trace events.\n * Subclasses provide `_className` and may override `tracer` to build it lazily.\n */\nexport default abstract class TraceEmitter {\n protected abstract _className: string\n protected _tracer?: Tracer\n private _traceOptions: Record<string, boolean> = {\n /** Indicates whether to add the class name to the namespace for tracing purposes. */\n addClassNameToLabel: true,\n }\n\n get classNameAddedToTraceNamespace(): boolean {\n return this._traceOptions.addClassNameToLabel === true\n }\n\n set classNameAddedToTraceNamespace(value: boolean) {\n this._traceOptions.addClassNameToLabel = value\n }\n\n /** Returns the structured trace emitter, if tracing is enabled. */\n protected get tracer(): Tracer | undefined {\n return this._tracer\n }\n\n /**\n * Emits a structured trace event.\n * Prefer the factory form for `payload`: it is only resolved when consumed.\n */\n trace(label: string, scope?: string, payload?: TracePayload, namespace?: string): void {\n const tracer = this.tracer\n if (tracer) {\n label = this.traceLabelFormatter(label)\n tracer.debug(label, namespace ?? label.toLowerCase(), payload, scope)\n }\n }\n\n /**\n * Emits a structured error event, or reports it with `console.error` when tracing is disabled.\n */\n traceError(label: string, error: unknown, scope?: string, payload?: TracePayload, namespace?: string): void {\n const tracer = this.tracer\n if (tracer) {\n label = this.traceLabelFormatter(label)\n tracer.error(label, namespace ?? label.toLowerCase(), error, payload, scope)\n } else {\n console.error(error)\n }\n }\n\n private traceLabelFormatter(label: string): string {\n return this.classNameAddedToTraceNamespace ? `${this._className}:${label}` : label\n }\n}\n","import RollbackStateSnapshotsHandler from \"./RollbackStateSnapshotsHandler\"\nimport { deepClone } from '../utils/deep-clone'\nimport { getActionStoreKey, getStoreKeyPrefix, getStoreScopedKey } from '../utils/store'\nimport TraceEmitter from \"../system/TraceEmitter\"\nimport { isEmpty } from \"../utils/validation\"\nimport { pluginName, pluginSubscriptionClassName } from \"../utils/constants\"\n\nimport type { PiniaPluginContext, StateTree, Store, SubscriptionCallbackMutation } from \"pinia\"\nimport type { AnyObject } from \"../types\"\nimport type { TraceEvent, TracePayload } from \"../types/trace\"\nimport { traceGroups } from \"../utils/traceGroups\"\nimport type {\n PluginExecutionOptions,\n PluginHydrationScheduler,\n PluginRuntimeEnvironment,\n PluginSubscriber,\n PluginSubscription as PluginSubscriptionDefinition,\n PluginSubscriptionOptions,\n PluginSubscriptions,\n StoreMutationSubscription,\n StoreMutationSubscriptionCallback,\n StoreOnActionAfterCallbackParameter,\n StoreOnActionSubscriptionCallback\n} from \"../types/plugin\"\n\n\nconst className = pluginSubscriptionClassName\nconst defaultPluginExecution: Required<PluginExecutionOptions> = {\n environment: 'both',\n hydration: 'immediate'\n}\n\nconst defaultDeferredTraceGroupTimeout = 2500\n\nfunction defaultHydrationScheduler(callback: () => void): void {\n if (typeof window !== 'undefined' && typeof window.requestAnimationFrame === 'function') {\n window.requestAnimationFrame(() => globalThis.setTimeout(callback, 0))\n return\n }\n\n globalThis.setTimeout(callback, 0)\n}\n\nexport default class PluginSubscription extends TraceEmitter {\n protected _className: string = className\n private _hydrationScheduler: PluginHydrationScheduler\n private _onActionSubscriptions: Map<Store, Set<StoreOnActionSubscriptionCallback>> = new Map()\n private _onActionSubscriptionsTraces: Map<string, string[]> = new Map()\n private _actionSeq = 0\n private _onActionStores: Set<Store> = new Set()\n private _onActionAfterSubscriptions: Record<string, StoreOnActionAfterCallbackParameter[]> = {}\n private _onActionOnErrorSubscriptions: Record<string, Array<(error: unknown) => void>> = {}\n private _onMutationSubscriptions: Map<Store, Set<StoreMutationSubscriptionCallback>> = new Map()\n private _onMutationSubscriptionsTraces: Map<string, string[]> = new Map()\n private _onMutationUnsubscribes: Map<Store, () => void> = new Map()\n private _options?: PluginSubscriptionOptions\n private _resetStoreCallback: Map<Store, Set<NonNullable<PluginSubscriber['resetStoreCallback']>>> = new Map()\n private _disposedStores: WeakSet<Store> = new WeakSet()\n private _storeRollbackSnapshotsHandler: RollbackStateSnapshotsHandler = new RollbackStateSnapshotsHandler()\n private _subscribers: PluginSubscriber[] = []\n private _subscribersDelivered: Set<string> = new Set()\n private _subscribersScheduled: Set<string> = new Set()\n private _subscriptions: PluginSubscriptions[] = []\n private _subscriptionsDelivered: Set<string> = new Set()\n private _subscriptionsScheduled: Set<string> = new Set()\n set subscribers(subscribers: PluginSubscriber[]) {\n this._subscribers = subscribers\n }\n\n get subscriptions(): PluginSubscriptions[] | undefined {\n if (!isEmpty(this._subscriptions)) {\n return this._subscriptions\n }\n }\n\n constructor(\n subscribers: PluginSubscriber[],\n options?: PluginSubscriptionOptions\n ) {\n super()\n this._hydrationScheduler = options?.hydrationScheduler ?? defaultHydrationScheduler\n this._options = options\n this._subscribers = subscribers\n this.initializeTracer()\n }\n\n private addOnActionAfterCallback(actionName: string, store: Store, callback: StoreOnActionAfterCallbackParameter): void {\n const key = getActionStoreKey(actionName, store)\n if (!this._onActionAfterSubscriptions[key]) {\n this._onActionAfterSubscriptions[key] = []\n }\n this._onActionAfterSubscriptions[key]?.push(callback)\n }\n\n private addOnActionOnErrorCallback(actionName: string, store: Store, callback: (error: unknown) => void): void {\n const key = getActionStoreKey(actionName, store)\n if (!this._onActionOnErrorSubscriptions[key]) {\n this._onActionOnErrorSubscriptions[key] = []\n }\n this._onActionOnErrorSubscriptions[key]?.push(callback)\n }\n\n private addResetStoreCallback(store: Store, callback: NonNullable<PluginSubscriber['resetStoreCallback']>): void {\n if (!this._resetStoreCallback.has(store)) {\n this._resetStoreCallback.set(store, new Set())\n }\n this._resetStoreCallback.get(store)!.add(callback)\n }\n\n private clearOnActionCallbacksSubscriptions(storageKey: string): void {\n delete this._onActionAfterSubscriptions[storageKey]\n delete this._onActionOnErrorSubscriptions[storageKey]\n }\n\n private clearStoreTracking(store: Store): void {\n this._onActionSubscriptions.delete(store)\n this._onActionStores.delete(store)\n this._onMutationUnsubscribes.get(store)?.()\n this._onMutationUnsubscribes.delete(store)\n this._onMutationSubscriptions.delete(store)\n this._resetStoreCallback.delete(store)\n this._onActionSubscriptionsTraces.delete(store.$id)\n this._onMutationSubscriptionsTraces.delete(store.$id)\n const keyPrefix = getStoreKeyPrefix(store)\n\n for (const key of Array.from(this._subscribersDelivered)) {\n if (key.startsWith(keyPrefix)) {\n this._subscribersDelivered.delete(key)\n }\n }\n\n for (const key of Array.from(this._subscribersScheduled)) {\n if (key.startsWith(keyPrefix)) {\n this._subscribersScheduled.delete(key)\n }\n }\n\n for (const key of Array.from(this._subscriptionsDelivered)) {\n if (key.startsWith(keyPrefix)) {\n this._subscriptionsDelivered.delete(key)\n }\n }\n\n for (const key of Array.from(this._subscriptionsScheduled)) {\n if (key.startsWith(keyPrefix)) {\n this._subscriptionsScheduled.delete(key)\n }\n }\n\n for (const key of Object.keys(this._onActionAfterSubscriptions)) {\n if (key.startsWith(keyPrefix)) {\n delete this._onActionAfterSubscriptions[key]\n }\n }\n\n for (const key of Object.keys(this._onActionOnErrorSubscriptions)) {\n if (key.startsWith(keyPrefix)) {\n delete this._onActionOnErrorSubscriptions[key]\n }\n }\n }\n\n /**\n * Closes a trace group once `pending` settles, or after the configured timeout so a promise\n * that never settles cannot keep buffering the traces of the store scope.\n */\n private closeGroupWhenSettled(\n pending: Promise<unknown>,\n closeGroup: () => void,\n storeId: string,\n subscriberName: string\n ): void {\n let closed = false\n const closeOnce = () => {\n if (closed) {\n return\n }\n closed = true\n globalThis.clearTimeout(timer)\n closeGroup()\n }\n const timeout = this._options?.deferredTraceGroupTimeout ?? defaultDeferredTraceGroupTimeout\n const timer = globalThis.setTimeout(() => {\n if (closed) {\n return\n }\n this.traceError(\n 'subscriber:deferred:timeout',\n new Error(`Subscriber \"${subscriberName}\" hydration still pending after ${timeout}ms`),\n storeId\n )\n closeOnce()\n }, timeout)\n\n pending.then(closeOnce, closeOnce)\n }\n\n /**\n * Creates a callback collector for the specified action and store.\n * @param actionName The name of the action to collect callbacks for.\n * @param store The store instance associated with the action.\n * @returns A function that collects callbacks for the specified action and store.\n */\n private createOnActionAfterCallbackCollector(actionName: string, store: Store) {\n return (callback: StoreOnActionAfterCallbackParameter) => {\n this.addOnActionAfterCallback(actionName, store, callback)\n }\n }\n\n /**\n * Creates a callback collector for the specified action and store that handles errors.\n * @param actionName The name of the action to collect error callbacks for.\n * @param store The store instance associated with the action.\n * @returns A function that collects error callbacks for the specified action and store.\n */\n private createOnActionOnErrorCallbackCollector(actionName: string, store: Store) {\n return (callback: (error: unknown) => void) => {\n this.addOnActionOnErrorCallback(actionName, store, callback)\n }\n }\n\n /**\n * Rolls back the state snapshot for a given action if an error occurs, and removes the snapshot after the action completes or fails.\n * @param actionName The name of the action being executed.\n * @param store The Pinia store instance.\n * @returns void\n */\n private createRollbackSnapshot(\n actionName: string,\n store: Store\n ) {\n const {\n after,\n onError\n } = this._storeRollbackSnapshotsHandler.createOnActionCallbacks(\n actionName,\n store\n ) ?? {}\n\n if (!after || !onError) {\n return\n }\n\n this.addOnActionAfterCallback(actionName, store, after)\n this.addOnActionOnErrorCallback(actionName, store, onError)\n this.trace('store:onAction:rollbackSnapshot:created', store.$id)\n }\n\n private defineCurrentEnvironment(): PluginRuntimeEnvironment {\n return this._options?.runtimeEnvironment\n ?? (typeof window === 'undefined' ? 'server' : 'client')\n }\n\n private definePluginExecution(subscriber: PluginSubscriber): Required<PluginExecutionOptions> {\n return {\n ...defaultPluginExecution,\n ...(this._options?.execution ?? {}),\n ...(subscriber.execution ?? {}),\n ...(this._options?.subscriberExecution?.[subscriber.name] ?? {}),\n }\n }\n\n private defineHydrationScheduler(subscriber: PluginSubscriber | PluginSubscriptionDefinition['subscription']): PluginHydrationScheduler {\n return subscriber.hydrationScheduler ?? this._hydrationScheduler\n }\n\n private defineSubscriberKey(subscriber: PluginSubscriber, store: Store): string {\n return getStoreScopedKey(subscriber.name, store)\n }\n\n private defineSubscriptionKey(pluginName: string, store: Store): string {\n return getStoreScopedKey(pluginName, store)\n }\n\n /** Closes a trace group once all async callbacks are settled (immediately if none is pending). */\n private endGroupAfter(pending: (Promise<void> | undefined)[], end: () => void): void {\n const promises = pending.filter((p): p is Promise<void> => !!p)\n if (promises.length) {\n Promise.all(promises).then(end)\n } else {\n end()\n }\n }\n\n private executeResetStoreCallbacks(store: Store): void {\n this._resetStoreCallback.get(store)?.forEach(callback => callback(store))\n }\n\n /**\n * Executes the store's onAction subscription for the given plugin subscriber.\n * @param store The Pinia store instance.\n * @param subscriber The plugin subscriber.\n * @returns void\n */\n private executeStoreOnActionSubscription(store: Store): void {\n if (this._onActionStores.has(store) || typeof store.$onAction !== 'function') {\n return\n }\n const onActionSubscriptions = this._onActionSubscriptions.get(store)\n const hasRollbackSnapshots = this._storeRollbackSnapshotsHandler.storeHasRollbackSnapshots(store)\n\n if (!onActionSubscriptions?.size && !hasRollbackSnapshots) {\n return\n }\n\n this._onActionStores.add(store)\n store.$onAction(({ after, args, name, onError }) => {\n const callbacks = this._onActionSubscriptions.get(store)\n if (!callbacks?.size) {\n return\n }\n\n const callId = ++this._actionSeq\n const actionId = `${store.$id}#${callId}`\n const groupId = traceGroups.onAction(store.$id, name, callId)\n this.traceGroupStart(() => ({ actionId, args, groupId }), store.$id, `store:onAction:${name}`)\n // The group must be closed exactly once, whichever way the action ends.\n let groupClosed = false\n const closeGroup = () => {\n if (!groupClosed) {\n groupClosed = true\n this.traceGroupEnd({ groupId }, store.$id)\n }\n }\n\n try {\n const storageKey = getActionStoreKey(name, store)\n\n if (this._storeRollbackSnapshotsHandler.storeHasRollbackSnapshots(store)) {\n this.createRollbackSnapshot(name, store)\n }\n\n // Callbacks are invoked synchronously so that their after/onError collectors are filled before Pinia runs the action.\n const pending: Promise<void>[] = []\n callbacks.forEach(callback => {\n const result = this.runCallbackSafely(\n () => callback({\n after: this.createOnActionAfterCallbackCollector(name, store),\n args,\n name,\n onError: this.createOnActionOnErrorCallbackCollector(name, store)\n }),\n 'store:onAction:callback:error',\n store.$id,\n () => ({ actionId, groupId })\n )\n if (result) {\n pending.push(result)\n }\n })\n\n this.endGroupAfter(pending, closeGroup)\n this.executeStoreOnActionAfterCallbacks(after, storageKey, store, name, actionId, callId)\n this.executeStoreOnActionOnErrorCallbacks(onError, storageKey, store, name, actionId, callId)\n this.clearOnActionCallbacksSubscriptions(storageKey)\n } catch (error) {\n closeGroup()\n throw error\n }\n })\n }\n\n private executeStoreOnActionAfterCallbacks(\n after: (callback: (result: any) => void) => void,\n storageKey: string,\n store: Store,\n name: string,\n actionId: string,\n callId: number\n ) {\n const afterCallbacks = this._onActionAfterSubscriptions[storageKey]\n if (afterCallbacks?.length) {\n after((result) => {\n this.traceGroupStart(\n () => ({\n actionId,\n groupId: traceGroups.onActionAfter(store.$id, name, callId),\n result\n }),\n store.$id,\n `store:onAction:after:${name}`\n )\n\n const pending = afterCallbacks.map(callback => this.runCallbackSafely(\n () => callback(result),\n 'storeOnActionAfterCallbacks',\n store.$id,\n () => ({ actionId, 'action name': name, groupId: traceGroups.onActionAfter(store.$id, name, callId) })\n ))\n\n this.endGroupAfter(pending, () =>\n this.traceGroupEnd(() => ({ groupId: traceGroups.onActionAfter(store.$id, name, callId) }), store.$id))\n })\n }\n }\n\n private executeStoreOnActionOnErrorCallbacks(\n onError: (callback: (error: any) => void) => void,\n storageKey: string,\n store: Store,\n name: string,\n actionId: string,\n callId: number\n ) {\n const onErrorCallbacks = this._onActionOnErrorSubscriptions[storageKey]\n\n if (onErrorCallbacks?.length) {\n onError((error) => {\n this.traceGroupStart(() => ({\n actionId,\n 'action name': name,\n error,\n groupId: traceGroups.onActionError(store.$id, name, callId)\n }), store.$id,\n `store:onAction:onError:${name}`\n )\n\n const pending = onErrorCallbacks.map(callback => this.runCallbackSafely(\n () => callback(error),\n 'store:onAction:onError:error',\n store.$id,\n () => ({ actionId, groupId: traceGroups.onActionError(store.$id, name, callId) })\n ))\n\n this.endGroupAfter(pending, () =>\n this.traceGroupEnd(() => ({ groupId: traceGroups.onActionError(store.$id, name, callId) }), store.$id))\n })\n }\n }\n\n /**\n * @returns A promise settling once asynchronous hydration hooks are done, undefined when everything ran synchronously.\n */\n private executeSubscriber(context: PiniaPluginContext, subscriber: PluginSubscriber): Promise<unknown> | undefined {\n const subscriberKey = this.defineSubscriberKey(subscriber, context.store)\n\n if (this._subscribersDelivered.has(subscriberKey)) {\n return\n }\n\n if (\n !subscriber.invoke(context, this._options?.tracerHandler?.createTracer)) {\n return\n }\n\n this._subscribersDelivered.add(subscriberKey)\n\n let hydrateResult: void | Promise<void>\n\n try {\n hydrateResult = subscriber.hydrate?.(context)\n } catch (error) {\n this.traceError('subscriber:hydrate', error, context.store.$id)\n return\n }\n\n const runAfterHydration = (): Promise<unknown> | undefined => {\n try {\n const afterHydration = subscriber.afterHydration?.(context)\n if (afterHydration && typeof (afterHydration as Promise<void>).then === 'function') {\n return (afterHydration as Promise<void>).catch(\n error => this.traceError('subscriber:afterHydration', error, context.store.$id)\n )\n }\n } catch (error) {\n this.traceError('subscriber:afterHydration', error, context.store.$id)\n }\n }\n\n let pending: Promise<unknown> | undefined\n\n if (hydrateResult && typeof (hydrateResult as Promise<void>).then === 'function') {\n pending = (hydrateResult as Promise<void>)\n .then(() => runAfterHydration())\n .catch(error => this.traceError('subscriber:hydrate', error, context.store.$id))\n } else {\n pending = runAfterHydration()\n }\n\n if (subscriber.subscriptions) {\n this.subscriptionDelivery(context, subscriber.subscriptions)\n }\n\n if (subscriber.storeMutationSubscription) {\n this.storeMutationSubscription(subscriber, subscriber.storeMutationSubscription)\n }\n\n this.storeOnActionSubscription(subscriber, context)\n\n if (subscriber.resetStoreCallback) {\n this.addResetStoreCallback(context.store, subscriber.resetStoreCallback)\n }\n\n return pending\n }\n\n private executeSubscriberSafely(context: PiniaPluginContext, subscriber: PluginSubscriber): Promise<unknown> | undefined {\n try {\n return this.executeSubscriber(context, subscriber)\n } catch (e) {\n this.traceError('subscriber:execute', e, context.store.$id)\n }\n }\n\n private initializeTracer() {\n if (this._options?.tracerHandler) {\n this._tracer = this._options.tracerHandler.createTracer(pluginName)\n }\n }\n\n /**\n * Invokes the plugin with the given Pinia plugin context, executing all relevant subscribers safely.\n * @param param0 The Pinia plugin context containing the store and options.\n * @param param0.store The Pinia store instance.\n * @param param0.options The options passed to the Pinia store.\n * @returns void\n */\n plugin({ store, options }: PiniaPluginContext) {\n if (!this._subscribers.length) {\n return\n }\n\n const subscribtions = {\n $onAction: [],\n $subscribe: [],\n }\n const pluginGroupId = traceGroups.plugin(store.$id)\n this.traceGroupStart(() => ({\n groupId: pluginGroupId,\n subscribers: this._subscribers,\n 'hooks subscriptions': subscribtions,\n store,\n options\n }), store.$id)\n\n this._onActionSubscriptionsTraces.set(store.$id, subscribtions.$onAction)\n this._onMutationSubscriptionsTraces.set(store.$id, subscribtions.$subscribe)\n\n try {\n this._subscribers.forEach(\n subscriber => {\n const subscriberKey = this.defineSubscriberKey(subscriber, store)\n const execution = this.definePluginExecution(subscriber)\n\n if (\n this._subscribersDelivered.has(subscriberKey)\n || this._subscribersScheduled.has(subscriberKey)\n ) {\n return\n }\n\n if (!this.shouldInvokePlugin(execution)) {\n return\n }\n\n if (this.shouldScheduleAfterHydration(execution)) {\n this.queueSubscriberExecution({ store, options } as PiniaPluginContext, subscriber, subscriberKey)\n return\n }\n\n this.executeSubscriber({ store, options } as PiniaPluginContext, subscriber)\n }\n )\n\n this.rewriteResetStore({ store } as PiniaPluginContext, store.$state)\n this._storeRollbackSnapshotsHandler.initFromPluginContext({ store, options } as PiniaPluginContext)\n this.executeStoreOnActionSubscription(store)\n this.registerStoreCleanup(store)\n } catch (e) {\n this.traceError('plugin:invoke', e, store.$id)\n }\n this.traceGroupEnd(() => ({ groupId: pluginGroupId }), store.$id)\n }\n\n private queueSubscriberExecution(\n context: PiniaPluginContext,\n subscriber: PluginSubscriber,\n subscriberKey: string\n ): void {\n const scheduler = this.defineHydrationScheduler(subscriber)\n\n this._subscribersScheduled.add(subscriberKey)\n scheduler(() => {\n if (this._disposedStores.has(context.store)) {\n return\n }\n this._subscribersScheduled.delete(subscriberKey)\n\n // Deferred runs happen after plugin() closed its group: open one so their traces stay grouped by store\n const storeId = context.store.$id\n const groupId = traceGroups.pluginDeferred(storeId, subscriber.name, ++this._actionSeq)\n this.traceGroupStart(() => ({ groupId, subscriber: subscriber.name }), storeId, 'subscriber:deferred')\n const closeGroup = () => this.traceGroupEnd(() => ({ groupId }), storeId)\n let pending: Promise<unknown> | undefined\n try {\n pending = this.executeSubscriberSafely(context, subscriber)\n } finally {\n // Keep the group open until async hydration hooks settle, so their traces stay inside it\n if (pending) {\n this.closeGroupWhenSettled(pending, closeGroup, storeId, subscriber.name)\n } else {\n closeGroup()\n }\n }\n })\n }\n\n private registerStoreCleanup(store: Store): void {\n if (typeof store.$dispose !== 'function') {\n return\n }\n\n const dispose = store.$dispose.bind(store)\n const scopedStore = store as AnyObject\n\n if (scopedStore.__piniaPluginSubscriptionDisposed) {\n return\n }\n\n scopedStore.__piniaPluginSubscriptionDisposed = true\n store.$dispose = () => {\n this._disposedStores.add(store)\n this.clearStoreTracking(store)\n this._storeRollbackSnapshotsHandler.clearStoreTracking(store)\n return dispose()\n }\n }\n\n private rewriteResetStore({ store }: PiniaPluginContext, initState: StateTree): void {\n const safeState = deepClone(initState)\n\n store.$reset = () => {\n const groupId = traceGroups.reset(store.$id, ++this._actionSeq)\n this.traceGroupStart(() => ({ initialState: safeState, groupId }), store.$id, 'store:reset')\n try {\n this.executeResetStoreCallbacks(store)\n store.$patch(deepClone(safeState))\n } finally {\n this.traceGroupEnd(() => ({ groupId }), store.$id)\n }\n }\n }\n\n /**\n * Runs a callback, tracing sync errors and async rejections.\n * @returns a never-rejecting promise when the callback is asynchronous, undefined otherwise.\n */\n private runCallbackSafely(\n callback: () => unknown,\n errorLabel: string,\n storeId: string,\n extra?: () => Record<string, unknown>\n ): Promise<void> | undefined {\n try {\n const result = callback()\n if (result && typeof (result as Promise<unknown>).then === 'function') {\n return Promise.resolve(result).then(\n () => undefined,\n error => this.traceError(errorLabel, error, storeId, extra)\n )\n }\n } catch (error) {\n this.traceError(errorLabel, error, storeId, extra)\n }\n }\n\n private shouldInvokePlugin(execution: Required<PluginExecutionOptions>): boolean {\n const currentEnvironment = this.defineCurrentEnvironment()\n\n return execution.environment === 'both' || execution.environment === currentEnvironment\n }\n\n private shouldScheduleAfterHydration(execution: Required<PluginExecutionOptions>): boolean {\n return this.defineCurrentEnvironment() === 'client' && execution.hydration === 'defer'\n }\n\n private storeOnActionSubscription(subscriber: PluginSubscriber, context: PiniaPluginContext): void {\n const { store, callback } = subscriber?.storeOnActionSubscription?.(context) ?? {}\n\n if (!store || !callback) {\n return\n }\n\n if (!this._onActionSubscriptions.has(store)) {\n this._onActionSubscriptions.set(store, new Set())\n }\n this._onActionSubscriptions.get(store)!.add(callback)\n this._onActionSubscriptionsTraces.get(store.$id)?.push(subscriber.name)\n }\n\n private storeMutationSubscription(subscriber: PluginSubscriber, subscription: StoreMutationSubscription): void {\n const { store, callback } = subscription()\n\n if (!store || !callback) {\n return\n }\n\n if (!this._onMutationSubscriptions.has(store)) {\n this._onMutationSubscriptions.set(store, new Set())\n }\n this._onMutationSubscriptions.get(store)!.add(callback)\n this._onMutationSubscriptionsTraces.get(store.$id)?.push(subscriber.name)\n\n if (this._onMutationUnsubscribes.has(store)) {\n return\n }\n\n const unsubscribe = store.$subscribe(async (mutation: SubscriptionCallbackMutation<StateTree>) => {\n const callbacks = this._onMutationSubscriptions.get(store)\n if (!callbacks?.size) {\n return\n }\n\n const groupId = traceGroups.onMutation(store.$id, ++this._actionSeq)\n this.traceGroupStart(() => ({ mutation, groupId }), store.$id, 'store:onMutation')\n try {\n await Promise.all([...callbacks].map(async (mutationCallback) => {\n try {\n await mutationCallback(mutation)\n } catch (error) {\n this.traceError('store:onMutation', error, store.$id, () => ({ groupId }))\n }\n }))\n } finally {\n this.traceGroupEnd(() => ({ groupId }), store.$id)\n }\n })\n\n this._onMutationUnsubscribes.set(store, unsubscribe)\n }\n\n private subscriptionDelivery(\n context: PiniaPluginContext,\n pluginSubscriptions: PluginSubscriptions\n ): void {\n Object.entries(pluginSubscriptions).forEach(([pluginName, pluginSubscription]) => {\n const subscriptionKey = this.defineSubscriptionKey(pluginName, context.store)\n const execution = this.definePluginExecution(pluginSubscription.subscription)\n\n if (\n this._subscriptionsDelivered.has(subscriptionKey)\n || this._subscriptionsScheduled.has(subscriptionKey)\n ) {\n return\n }\n\n if (!this.shouldInvokePlugin(execution)) {\n return\n }\n\n if (this.shouldScheduleAfterHydration(execution)) {\n const scheduler = this.defineHydrationScheduler(pluginSubscription.subscription)\n\n this._subscriptionsScheduled.add(subscriptionKey)\n scheduler(() => {\n if (this._disposedStores.has(context.store)) {\n return\n }\n this._subscriptionsScheduled.delete(subscriptionKey)\n this.subscriptionDeliverySafely(context, pluginName, pluginSubscription)\n })\n return\n }\n\n this.subscriptionDeliverySafely(context, pluginName, pluginSubscription)\n })\n }\n\n private subscriptionDeliverySafely(\n { store, options }: PiniaPluginContext,\n pluginName: string,\n pluginSubscription: PluginSubscriptionDefinition\n ): void {\n try {\n if (this._subscriptionsDelivered.has(this.defineSubscriptionKey(pluginName, store))) {\n return\n }\n\n const { subscription, subscriptionOptions, stores } = pluginSubscription\n\n this.trace('Subscription:delivery', store.$id, () => ({\n groupId: traceGroups.plugin(store.$id),\n pluginName,\n subscription,\n subscriptionOptions\n }))\n\n const pluginOptions = {\n storeOptions: { ...(options?.storeOptions ?? {}), ...subscriptionOptions }\n }\n\n subscription.invoke(\n { store, options: { ...options, ...pluginOptions } } as PiniaPluginContext\n )\n this._subscriptionsDelivered.add(this.defineSubscriptionKey(pluginName, store))\n\n if (!isEmpty(stores)) {\n stores?.forEach(\n store => subscription.invoke({\n store,\n options: {\n ...options,\n ...pluginOptions,\n ...((store as AnyObject)?.storeOptions ?? {})\n }\n } as PiniaPluginContext)\n )\n }\n } catch (e) {\n this.traceError('subscription:delivery', e, store.$id, () => ({ groupId: traceGroups.plugin(store.$id) }))\n }\n }\n\n private traceGroupEnd(payload: TracePayload, scope: string): void {\n const tracerHandler = this._options?.tracerHandler\n if (tracerHandler && (tracerHandler.hasTraceListeners?.() ?? true)) {\n tracerHandler.closeGroup({\n ...(typeof payload === 'function' ? payload() : (payload ?? {})),\n scope\n })\n }\n }\n\n private traceGroupStart(payload: TracePayload, scope: string, label?: string): void {\n const tracerHandler = this._options?.tracerHandler\n if (tracerHandler && (tracerHandler.hasTraceListeners?.() ?? true)) {\n payload = (typeof payload === 'function' ? payload() : (payload ?? {}));\n tracerHandler.startGroup({\n ...payload,\n scope\n } as TraceEvent)\n this.trace(label ?? 'context', scope, payload)\n }\n }\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}","export const pluginName: string = 'pinia-plugin-subscription'\nexport const pluginSubscriptionClassName = 'PluginSubscription'\n/** Prefix of every namespace emitted by `PluginSubscription` (labels are lowercased into namespaces). */\nexport const pluginSubscriptionNamespace: string = pluginSubscriptionClassName.toLowerCase()/** Journal scope of the events emitted without a store. */\nexport const journalGlobalScope: string = '__global__'\n","import type { AnyObject } from '../types'\nimport type {\n TraceEvent,\n TraceEventMetadata,\n TraceJournal,\n TraceLevel,\n TraceListener,\n TracePayload,\n TraceSide,\n TracerOptions,\n} from '../types/trace'\n\nfunction resolvePayload(payload: TracePayload): AnyObject | undefined {\n if (typeof payload !== 'function') {\n return payload\n }\n\n try {\n return payload()\n } catch (error) {\n return { __tracePayloadError: error }\n }\n}\n\n/**\n * Emits structured trace events.\n *\n * Nothing is allocated when no listener matches:\n * the payload is a factory resolved only once a consumer is known.\n */\nexport default class Tracer {\n private readonly _currentGroupId?: TracerOptions['currentGroupId']\n private readonly _journal?: TraceJournal\n private readonly _listeners: TraceListener[] = []\n private readonly _redactor?: (payload: AnyObject) => AnyObject\n private _scope?: string\n private readonly _side: TraceSide\n private readonly _source: string\n\n constructor(source: string, listeners: TraceListener[], options: TracerOptions = {}) {\n this._currentGroupId = options.currentGroupId\n this._journal = options.journal\n this._redactor = options.redactor\n this._side = options.side ?? 'client'\n this._scope = options.scope\n this._source = source\n this._listeners = listeners\n }\n\n get scope(): string | undefined {\n return this._scope\n }\n\n set scope(scope: string | undefined) {\n this._scope = scope\n }\n\n get source(): string {\n return this._source\n }\n\n debug(label: string, namespace: string, payload?: TracePayload, scope?: string): void {\n this.emit('debug', label, namespace, payload, scope)\n }\n\n /** Relays the error to matching listeners, or reports it when none match. */\n error(label: string, namespace: string, error: unknown, payload?: TracePayload, scope?: string): void {\n this.emit('error', label, namespace, payload, scope, error)\n }\n\n private resolveAndRedact(payload: TracePayload): AnyObject | undefined {\n const resolved = resolvePayload(payload)\n\n if (!this._redactor || resolved === undefined) {\n return resolved\n }\n\n try {\n return this._redactor(resolved)\n } catch (error) {\n // never leak the raw payload when redaction fails\n return { __traceRedactionError: error instanceof Error ? error.message : String(error) }\n }\n }\n\n private buildMetadata(level: TraceLevel, label: string, namespace: string, scope?: string): TraceEventMetadata {\n return {\n label,\n level,\n namespace,\n scope: scope ?? this._scope,\n source: this._source\n }\n }\n\n private matchListeners(metadata: TraceEventMetadata) {\n const matched: TraceListener[] = []\n\n for (const listener of this._listeners) {\n try {\n if (listener.filter(metadata)) {\n matched.push(listener)\n }\n } catch (error) {\n console.error('Error in trace listener filter:', error)\n }\n }\n\n return matched\n }\n\n private emit(\n level: TraceLevel,\n label: string,\n namespace: string,\n payload?: TracePayload,\n scope?: string,\n error?: unknown\n ): void {\n if (this._listeners.length === 0 && !this._journal) {\n if (level === 'error') {\n console.error('Unhandled error trace event:', error)\n }\n return\n }\n\n const metadata = this.buildMetadata(level, label, namespace, scope)\n const matched = this._listeners.length ? this.matchListeners(metadata) : []\n\n if (matched.length === 0 && !this._journal) {\n if (level === 'error') {\n console.error('Unhandled error trace event:', error)\n }\n return\n }\n\n const resolved = payload !== undefined ? this.resolveAndRedact(payload) : undefined\n // `actionId` travels in the payload so that emitters need no extra argument, and is lifted to the event.\n // `groupId` is lifted the same way; without one, the innermost open group of the scope applies.\n const { actionId, groupId: payloadGroupId, ...rest } = resolved ?? {}\n const groupId = typeof payloadGroupId === 'string'\n ? payloadGroupId\n : this._currentGroupId?.(metadata.scope)\n const lifted = typeof actionId === 'string' || typeof payloadGroupId === 'string'\n const event: TraceEvent = {\n ...metadata,\n ...(typeof actionId === 'string' && { actionId }),\n ...(groupId !== undefined && { groupId }),\n ...(error !== undefined && { error }),\n ...(resolved !== undefined && { payload: lifted ? rest : resolved }),\n ...(this._journal && { seq: this._journal.nextSeq(), side: this._side }),\n timestamp: Date.now()\n }\n\n this._journal?.append(event)\n\n if (matched.length === 0 && level === 'error') {\n console.error('Unhandled error trace event:', error)\n }\n\n for (const listener of matched) {\n try {\n listener.handler(event)\n } catch (error) {\n // a faulty listener must never break the traced code\n console.error('Error in trace listener:', error)\n }\n }\n }\n}\n","import { journalGlobalScope } from '../utils/constants'\nimport { isContextEvent } from '../utils/traceContext'\nimport { toSerializable } from '../utils/toSerializable'\n\nimport type {\n AnyObject\n} from '../types'\nimport type {\n TraceEvent,\n TraceJournal,\n TraceJournalListener,\n TraceJournalOptions,\n TraceJournalSnapshot,\n TraceSide\n} from '../types/trace'\n\nconst defaultMaxEventsPerStore = 1000\n\ninterface ScopeEntry {\n dropped: number\n /** Context and error events: evicted separately so that they outlive the regular flow. */\n kept: TraceEvent[]\n /** One ring per side, so that imported server events are not evicted by client events. */\n rings: Record<TraceSide, TraceEvent[]>\n}\n\n/** Context and error events are the ones needed to understand a store whatever its age. */\nfunction isKept(event: TraceEvent): boolean {\n return event.level === 'error' || isContextEvent(event)\n}\n\nfunction pushCapped(events: TraceEvent[], event: TraceEvent, max: number): number {\n events.push(event)\n const overflow = events.length - max\n if (overflow > 0) {\n events.splice(0, overflow)\n return overflow\n }\n return 0\n}\n\n/** Rebuilds an event from untrusted data, copying known fields only. */\nfunction toImportedEvent(raw: unknown): TraceEvent | undefined {\n if (!raw || typeof raw !== 'object') { return }\n\n const { error, label, level, namespace, payload, seq, source, timestamp } = raw as Record<string, unknown>\n if (\n typeof label !== 'string' || typeof namespace !== 'string' || typeof source !== 'string'\n || (level !== 'debug' && level !== 'error')\n || typeof seq !== 'number' || !Number.isFinite(seq)\n || typeof timestamp !== 'number'\n ) { return }\n\n const { actionId, groupId, scope } = raw as Record<string, unknown>\n return {\n ...(typeof actionId === 'string' && { actionId }),\n ...(error !== undefined && { error }),\n ...(typeof groupId === 'string' && { groupId }),\n label,\n level,\n namespace,\n ...(typeof payload === 'object' && payload !== null && { payload: payload as AnyObject }),\n ...(typeof scope === 'string' && { scope }),\n seq,\n side: 'server',\n source,\n timestamp\n }\n}\n\n/**\n * Creates the journal of a registry.\n * @param options Size cap of the journal.\n */\nexport function createTraceJournal({ maxEventsPerStore }: TraceJournalOptions = {}): TraceJournal {\n const max = Math.max(1, Math.floor(maxEventsPerStore ?? defaultMaxEventsPerStore))\n const entries = new Map<string, ScopeEntry>()\n const listeners = new Set<TraceJournalListener>()\n let seq = 0\n\n function getEntry(scope: string): ScopeEntry {\n let entry = entries.get(scope)\n if (!entry) {\n entry = { dropped: 0, kept: [], rings: { client: [], server: [] } }\n entries.set(scope, entry)\n }\n return entry\n }\n\n function removeServerEvents() {\n entries.forEach(entry => {\n entry.rings.server = []\n entry.kept = entry.kept.filter(event => event.side !== 'server')\n })\n }\n\n function getAllEvents(): TraceEvent[] {\n return [...entries.keys()]\n .flatMap(scope => getEvents(scope))\n .sort((a, b) => (a.seq ?? 0) - (b.seq ?? 0))\n }\n\n function getEvents(scope: string): TraceEvent[] {\n const entry = entries.get(scope)\n if (!entry) { return [] }\n\n return [...entry.kept, ...entry.rings.client, ...entry.rings.server]\n .sort((a, b) => (a.seq ?? 0) - (b.seq ?? 0))\n }\n\n return {\n append(event) {\n const entry = getEntry(event.scope ?? journalGlobalScope)\n const target = isKept(event) ? entry.kept : entry.rings[event.side ?? 'client']\n entry.dropped += pushCapped(target, event, max)\n\n listeners.forEach(listener => {\n try {\n listener(event)\n } catch (error) {\n // a faulty subscriber must never break the traced code\n console.error('Error in trace journal listener:', error)\n }\n })\n },\n clear(scope) {\n if (scope === undefined) {\n entries.clear()\n } else {\n entries.delete(scope)\n }\n },\n getDropped: scope => entries.get(scope)?.dropped ?? 0,\n getEvents,\n getScopes: () => [...entries.keys()],\n import(snapshot) {\n const raw = (snapshot as Partial<TraceJournalSnapshot> | null)?.events\n if (!Array.isArray(raw)) { return 0 }\n\n const events = raw.map(toImportedEvent).filter((event): event is TraceEvent => !!event)\n const lastSeq = events.reduce((highest, event) => Math.max(highest, event.seq ?? 0), 0)\n\n removeServerEvents()\n // Negative sequence numbers keep imported events before every local one, whatever the server counter was.\n events.forEach(event => this.append({ ...event, seq: (event.seq ?? 0) - lastSeq - 1 }))\n\n return events.length\n },\n nextSeq: () => ++seq,\n serialize: () => ({\n events: getAllEvents().map(({ error, payload, ...event }) => ({\n ...event,\n ...(error !== undefined && { error: toSerializable(error) }),\n ...(payload !== undefined && { payload: toSerializable(payload) as AnyObject })\n })),\n version: 1\n }),\n subscribe(listener) {\n listeners.add(listener)\n return () => { listeners.delete(listener) }\n }\n }\n}\n","import { pluginName, pluginSubscriptionNamespace } from \"../utils/constants\"\n\nimport type {\n TraceEventMetadata,\n TraceFilter,\n TraceFilterFactoryCriterion,\n TraceFilterFactoryParam,\n TraceListener\n} from \"../types/trace\"\n\nconst noop = () => { }\n\n\nfunction createFilter(criteria: TraceFilterFactoryCriterion[], context: boolean = true, mode: 'every' | 'some') {\n return (event: TraceEventMetadata) => {\n return criteria[mode](({ comparator = 'equals', target, value }) => {\n if (target === 'namespace' && context && isPluginSubscription(event)) {\n return true\n }\n\n const eventValue = event[target]\n if (typeof eventValue !== 'string') return false\n\n let result = false\n switch (comparator) {\n case 'equals':\n result = eventValue === value\n break\n case 'contains':\n result = eventValue.includes(value)\n break\n case 'startsWith':\n result = eventValue.startsWith(value)\n break\n case 'endsWith':\n result = eventValue.endsWith(value)\n break\n default:\n result = false\n break\n }\n return result\n })\n }\n}\n\n/**\n * Creates a trace listener from a definition or filter criteria.\n * @param listenerDef The listener definition or filter criteria.\n * @param context Also match the plugin's own context events. Defaults to true.\n * @param filterMode The mode to apply when evaluating multiple filter criteria: 'every' or 'some'.\n * @returns A listener whose handler is the supplied one, or a no-op when none is given.\n */\nexport function createTraceListener(\n listenerDef: TraceFilterFactoryParam | TraceFilterFactoryCriterion[],\n context: boolean = true,\n filterMode: 'every' | 'some' = 'every'\n): TraceListener {\n const { handler = noop, filter } = createTraceFilter(listenerDef, context, filterMode)\n\n return { filter, handler }\n}\n\nfunction createTraceFilter(\n listenerDef: TraceFilterFactoryParam | TraceFilterFactoryCriterion[],\n context: boolean = true,\n filterMode: 'every' | 'some' = 'every'\n): TraceFilterFactoryParam & { filter: TraceFilter } {\n if (Array.isArray(listenerDef)) {\n return { filter: createFilter(listenerDef, context, filterMode) }\n }\n\n // Copy: the caller's definition must never be mutated.\n return {\n ...listenerDef,\n filter: Array.isArray(listenerDef.filter)\n ? createFilter(listenerDef.filter, context, filterMode)\n : listenerDef.filter\n }\n}\n\nfunction isPluginSubscription(event: TraceEventMetadata): boolean {\n return event?.source === pluginName && (!event?.namespace || event.namespace.startsWith(pluginSubscriptionNamespace))\n}","declare const process: { env: { NODE_ENV?: string } } | undefined\n\n/**\n * Tells whether the host application is built for production.\n * The literal `process.env.NODE_ENV` expression is kept on purpose: consumer bundlers\n * (Vite, webpack, Nuxt...) replace it statically. Without a bundler `process` may be\n * undefined, in which case the environment is not considered production.\n */\nexport function isProductionEnvironment(): boolean {\n try {\n return process!.env.NODE_ENV === 'production'\n } catch {\n return false\n }\n}\n","import type { AnyObject } from '../types'\nimport type { TraceRedactOptions } from '../types/trace'\n\nexport const DEFAULT_REDACTED_VALUE = '[REDACTED]'\n\n/**\n * Keys masked by default when redaction is enabled.\n * Matching is a case-insensitive \"contains\", so `accessToken` or `user_password` are masked too.\n */\nexport const defaultRedactedKeys: readonly RegExp[] = [\n /pass(word|wd|phrase|code)|^pwd/i,\n /secret/i,\n /token/i,\n /authorization/i,\n /api[-_]?key/i,\n /(private|encryption|signing|secret)[-_]?key/i,\n /credential/i,\n /cookie/i,\n /cipher/i,\n]\n\nconst MAX_DEPTH = 12\n\ntype KeyMatcher = (key: string) => boolean\n\nfunction createKeyMatcher(keys: ReadonlyArray<string | RegExp>): KeyMatcher {\n const exact = new Set<string>()\n const patterns: RegExp[] = []\n\n for (const key of keys) {\n if (typeof key === 'string') {\n exact.add(key.toLowerCase())\n } else {\n // a global/sticky regexp is stateful: rebuild it without those flags\n patterns.push(new RegExp(key.source, key.flags.replace(/[gy]/g, '')))\n }\n }\n\n return (key: string) => exact.has(key.toLowerCase()) || patterns.some(pattern => pattern.test(key))\n}\n\nfunction isTraversable(value: unknown): value is object {\n if (value === null || typeof value !== 'object') {\n return false\n }\n\n return !(\n value instanceof Date\n || value instanceof RegExp\n || value instanceof Error\n || value instanceof Promise\n || value instanceof WeakMap\n || value instanceof WeakSet\n )\n}\n\n/**\n * Creates a function returning a redacted copy of a trace payload.\n * The original value (usually the live store state) is never mutated.\n * @param options Redaction options, or `true` to use the default keys.\n * @returns The redaction function.\n */\nexport function createRedactor(options: TraceRedactOptions | true = true): (payload: AnyObject) => AnyObject {\n const { includeDefaults = true, keys = [], replacement = DEFAULT_REDACTED_VALUE } =\n options === true ? {} : options\n const isSensitive = createKeyMatcher([...(includeDefaults ? defaultRedactedKeys : []), ...keys])\n\n function redact(value: unknown, seen: WeakMap<object, unknown>, depth: number): unknown {\n if (!isTraversable(value)) {\n return value\n }\n\n const cached = seen.get(value)\n if (cached !== undefined) {\n return cached\n }\n\n if (depth >= MAX_DEPTH) {\n return '[MaxDepth]'\n }\n\n if (value instanceof Map) {\n const copy = new Map()\n seen.set(value, copy)\n value.forEach((entry, key) => {\n copy.set(key, typeof key === 'string' && isSensitive(key) ? replacement : redact(entry, seen, depth + 1))\n })\n return copy\n }\n\n if (value instanceof Set) {\n const copy = new Set()\n seen.set(value, copy)\n value.forEach(entry => copy.add(redact(entry, seen, depth + 1)))\n return copy\n }\n\n if (Array.isArray(value)) {\n const copy: unknown[] = []\n seen.set(value, copy)\n value.forEach(entry => copy.push(redact(entry, seen, depth + 1)))\n return copy\n }\n\n const copy: Record<string, unknown> = {}\n seen.set(value, copy)\n for (const key of Object.keys(value)) {\n const redactedValue = isSensitive(key)\n ? replacement\n : redact((value as Record<string, unknown>)[key], seen, depth + 1)\n Object.defineProperty(copy, key, {\n configurable: true,\n enumerable: true,\n value: redactedValue,\n writable: true\n })\n }\n return copy\n }\n\n return payload => redact(payload, new WeakMap(), 0) as AnyObject\n}\n"],"names":["deepClone","value","key","entryValue","item","clonedObject","createStateSnapshot","state","keys","clonedState","toRaw","defineAStoreSetupContexts","defineAStoreSetupContextsById","setupContextDisposeWrappedStores","registerSetupContextCleanupOnDispose","store","id","originalDispose","args","defineAStore","storeDefinition","options","storeOptions","defineAStoreSetup","defineAStoreOptionApi","defineAStoreCtx","setupContext","shouldStoreSetupContext","useStore","defineStore","deniedFirstChar","hasDeniedFirstChar","property","getDefineAStoreSetupContext","storeRecord","getEnhancedStore","ctx","enhancedStore","setEnhancedStore","getActionStoreKey","actionName","getStoreScopedKey","getStoreKeyPrefix","storeId","RollbackStateSnapshotsHandler","__publicField","action","stateKeys","actionFn","snapshotKey","error","rollbackSnapshotParams","keyPrefix","stateSnapshot","TraceEmitter","payload","namespace","tracer","label","scope","isEmpty","pluginName","pluginSubscriptionClassName","pluginSubscriptionNamespace","journalGlobalScope","className","defaultPluginExecution","defaultDeferredTraceGroupTimeout","defaultHydrationScheduler","callback","PluginSubscription","subscribers","storageKey","pending","closeGroup","subscriberName","closed","closeOnce","timer","timeout","after","onError","subscriber","pluginName2","end","promises","p","onActionSubscriptions","hasRollbackSnapshots","name","callbacks","actionId","callId","groupId","traceGroups","groupClosed","result","afterCallbacks","onErrorCallbacks","context","subscriberKey","hydrateResult","runAfterHydration","afterHydration","e","subscribtions","pluginGroupId","execution","scheduler","dispose","scopedStore","initState","safeState","errorLabel","extra","currentEnvironment","subscription","unsubscribe","mutation","mutationCallback","pluginSubscriptions","pluginSubscription","subscriptionKey","subscriptionOptions","stores","pluginOptions","store2","tracerHandler","resolvePayload","Tracer","source","listeners","resolved","level","metadata","matched","listener","payloadGroupId","rest","event","error2","defaultMaxEventsPerStore","isContextEvent","pushCapped","events","max","overflow","toImportedEvent","raw","seq","timestamp","createTraceJournal","maxEventsPerStore","entries","getEntry","entry","removeServerEvents","getAllEvents","getEvents","b","a","isKept","target","snapshot","lastSeq","highest","toSerializable","noop$1","createFilter","criteria","mode","comparator","isPluginSubscription","eventValue","createTraceListener","listenerDef","handler","filter","createTraceFilter","filterMode","DEFAULT_REDACTED_VALUE","defaultRedactedKeys","MAX_DEPTH","createKeyMatcher","exact","patterns","noop","pattern","isTraversable","createRedactor","includeDefaults","replacement","isSensitive","seen","depth","cached","copy2","redact","copy","redactedValue","createTracerRegistry","enabled","isProductionEnvironment","journalOption","side","journal","tracerSide","redactor","openGroups","currentGroupId","stack","addListener","index","addScopesListener","scopes","clearTraceListeners","trackGroup","hasTraceListeners"],"mappings":";;;;;;AAMO,SAASA,EAAaC,GAAa;AACtC,MAAI,OAAO,mBAAoB;AAC3B,QAAI;AACA,aAAO,gBAAgBA,CAAK;AAAA,IAChC,QAAQ;AAAA,IAER;AAGJ,MAAIA,MAAU,QAAQ,OAAOA,KAAU;AACnC,WAAOA;AAGX,MAAIA,aAAiB;AACjB,WAAO,IAAI;AAAA,MACP,MAAM,KAAKA,EAAM,QAAA,GAAW,CAAC,CAACC,GAAKC,C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,qBAAAE;AAAA,IAEA,SAAAV;AAAA,IACA;MACA,YAAW,CAAAtJ,MAAciK,EAAa,SAAAjK,CAAA;AAAA,MAClC,kBAAsBlC,IAAA,CAAY,MAAG,IAC/B4G,GAAAC,GACAC,KAA6C,gBAAA8E,GAAiB,SAAAJ,GAAC,UAAAE,GAAA,MAAAD,GAAA,GAAAzL,EAAA,CAAA;AAAA,MACrE,mBAAAoM;AAAA,MAAiC,SAAAZ;AAAA,MACf,YACd,OAAYW,EAAA,QAAAjK,CAAA;AAAA,IAAA;AAAA,IACL,mBAAAkK;AAAA,EACG;AACb;"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
function h(t, { maxDepth: e = 5, maxEntries: n = 100, maxNodes: u = 2e3 } = {}) {
|
|
2
|
+
const r = /* @__PURE__ */ new Set();
|
|
3
|
+
let f = 0;
|
|
4
|
+
function c(s, a) {
|
|
5
|
+
switch (typeof s) {
|
|
6
|
+
case "string":
|
|
7
|
+
return s.length > 2e3 ? `${s.slice(0, 2e3)}…` : s;
|
|
8
|
+
case "number":
|
|
9
|
+
return Number.isFinite(s) ? s : String(s);
|
|
10
|
+
case "boolean":
|
|
11
|
+
return s;
|
|
12
|
+
case "undefined":
|
|
13
|
+
return "[undefined]";
|
|
14
|
+
case "bigint":
|
|
15
|
+
return `${s}n`;
|
|
16
|
+
case "symbol":
|
|
17
|
+
return s.toString();
|
|
18
|
+
case "function":
|
|
19
|
+
return `[Function ${s.name || "anonymous"}]`;
|
|
20
|
+
}
|
|
21
|
+
if (s === null)
|
|
22
|
+
return null;
|
|
23
|
+
const o = s;
|
|
24
|
+
if (r.has(o))
|
|
25
|
+
return "[Circular]";
|
|
26
|
+
if (++f > u)
|
|
27
|
+
return "[Truncated]";
|
|
28
|
+
if (o instanceof Date)
|
|
29
|
+
return Number.isNaN(o.getTime()) ? "Invalid Date" : o.toISOString();
|
|
30
|
+
if (o instanceof Error)
|
|
31
|
+
return { message: o.message, name: o.name };
|
|
32
|
+
const $ = Array.isArray(o) || o instanceof Set || o instanceof Map;
|
|
33
|
+
if (a >= e)
|
|
34
|
+
return $ ? `[${o.constructor.name}]` : "[Object]";
|
|
35
|
+
r.add(o);
|
|
36
|
+
try {
|
|
37
|
+
if (Array.isArray(o) || o instanceof Set) {
|
|
38
|
+
const i = [...o], p = i.slice(0, n).map((d) => c(d, a + 1));
|
|
39
|
+
return i.length > n && p.push(`… ${i.length - n} more`), o instanceof Set ? { __type: "Set", values: p } : p;
|
|
40
|
+
}
|
|
41
|
+
if (o instanceof Map)
|
|
42
|
+
return { __type: "Map", entries: c([...o.entries()], a) };
|
|
43
|
+
const l = {}, g = Object.keys(o).filter((i) => !i.startsWith("_"));
|
|
44
|
+
for (const i of g.slice(0, n))
|
|
45
|
+
try {
|
|
46
|
+
l[i] = c(o[i], a + 1);
|
|
47
|
+
} catch {
|
|
48
|
+
l[i] = "[Unreadable]";
|
|
49
|
+
}
|
|
50
|
+
return g.length > n && (l["…"] = `${g.length - n} more`), l;
|
|
51
|
+
} finally {
|
|
52
|
+
r.delete(o);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return c(t, 0);
|
|
56
|
+
}
|
|
57
|
+
function A(t) {
|
|
58
|
+
return JSON.stringify(t).replace(/</g, "\\u003c").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
59
|
+
}
|
|
60
|
+
function O(t) {
|
|
61
|
+
return t.namespace.endsWith(":context");
|
|
62
|
+
}
|
|
63
|
+
function m(t) {
|
|
64
|
+
const e = {};
|
|
65
|
+
return t.forEach((n) => {
|
|
66
|
+
const { execution: u, name: r, pluginOptions: f } = n ?? {}, c = typeof r == "string" && r ? r : "anonymous";
|
|
67
|
+
let s = c;
|
|
68
|
+
for (let a = 2; s in e; a++)
|
|
69
|
+
s = `${c} (${a})`;
|
|
70
|
+
e[s] = {
|
|
71
|
+
...u !== void 0 && { execution: u },
|
|
72
|
+
...f !== void 0 && { pluginOptions: f }
|
|
73
|
+
};
|
|
74
|
+
}), e;
|
|
75
|
+
}
|
|
76
|
+
function v(t) {
|
|
77
|
+
const e = { ...t };
|
|
78
|
+
if (Array.isArray(e.subscribers) && (e.subscribers = m(e.subscribers)), e.options && typeof e.options == "object") {
|
|
79
|
+
const n = e.options, u = n.storeOptions && typeof n.storeOptions == "object" ? n.storeOptions : n, { actions: r, ...f } = u;
|
|
80
|
+
e.options = f;
|
|
81
|
+
}
|
|
82
|
+
return e;
|
|
83
|
+
}
|
|
84
|
+
const b = (t, e, n) => `${t}/onAction:${e}#${n}`, y = (t) => `${t}/plugin`, N = {
|
|
85
|
+
onAction: b,
|
|
86
|
+
onActionAfter: (t, e, n) => `${b(t, e, n)}/after`,
|
|
87
|
+
onActionError: (t, e, n) => `${b(t, e, n)}/onError`,
|
|
88
|
+
onMutation: (t, e) => `${t}/onMutation#${e}`,
|
|
89
|
+
plugin: y,
|
|
90
|
+
pluginDeferred: (t, e, n) => `${y(t)}/deferred:${e}#${n}`,
|
|
91
|
+
reset: (t, e) => `${t}/reset#${e}`
|
|
92
|
+
}, S = /#\d+$/;
|
|
93
|
+
function w(t) {
|
|
94
|
+
const e = t.slice(t.lastIndexOf("/") + 1);
|
|
95
|
+
return e === "plugin" ? "Plugin setup" : e.replace(S, "").replace(":", " · ");
|
|
96
|
+
}
|
|
97
|
+
export {
|
|
98
|
+
N as a,
|
|
99
|
+
v as b,
|
|
100
|
+
w as g,
|
|
101
|
+
O as i,
|
|
102
|
+
A as s,
|
|
103
|
+
h as t
|
|
104
|
+
};
|
|
105
|
+
//# sourceMappingURL=traceGroups-DfxYkUpm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traceGroups-DfxYkUpm.js","sources":["../../src/utils/toSerializable.ts","../../src/utils/traceContext.ts","../../src/utils/traceGroups.ts"],"sourcesContent":["import type { ToSerializableOptions } from '../types/trace'\n\nconst maxStringLength = 2000\n\n/**\n * Converts any value (live stores, class instances, circular graphs...) into a bounded, JSON-safe\n * structure that is also readable in a UI. Keys starting with `_` (Vue/Pinia internals) are skipped.\n */\nexport function toSerializable(\n value: unknown,\n { maxDepth = 5, maxEntries = 100, maxNodes = 2000 }: ToSerializableOptions = {}\n): unknown {\n const ancestors = new Set<object>()\n let nodes = 0\n\n function convert(current: unknown, depth: number): unknown {\n switch (typeof current) {\n case 'string':\n return current.length > maxStringLength ? `${current.slice(0, maxStringLength)}…` : current\n case 'number':\n return Number.isFinite(current) ? current : String(current)\n case 'boolean':\n return current\n case 'undefined':\n return '[undefined]'\n case 'bigint':\n return `${current}n`\n case 'symbol':\n return current.toString()\n case 'function':\n return `[Function ${current.name || 'anonymous'}]`\n }\n\n if (current === null) { return null }\n\n const object = current as object\n if (ancestors.has(object)) { return '[Circular]' }\n if (++nodes > maxNodes) { return '[Truncated]' }\n if (object instanceof Date) { return Number.isNaN(object.getTime()) ? 'Invalid Date' : object.toISOString() }\n if (object instanceof Error) { return { message: object.message, name: object.name } }\n\n const isCollection = Array.isArray(object) || object instanceof Set || object instanceof Map\n if (depth >= maxDepth) {\n return isCollection ? `[${object.constructor.name}]` : '[Object]'\n }\n\n ancestors.add(object)\n try {\n if (Array.isArray(object) || object instanceof Set) {\n const items = [...object]\n const result = items.slice(0, maxEntries).map(item => convert(item, depth + 1))\n if (items.length > maxEntries) { result.push(`… ${items.length - maxEntries} more`) }\n return object instanceof Set ? { __type: 'Set', values: result } : result\n }\n\n if (object instanceof Map) {\n return { __type: 'Map', entries: convert([...object.entries()], depth) }\n }\n\n const result: Record<string, unknown> = {}\n const keys = Object.keys(object).filter(key => !key.startsWith('_'))\n for (const key of keys.slice(0, maxEntries)) {\n try {\n result[key] = convert((object as Record<string, unknown>)[key], depth + 1)\n } catch {\n result[key] = '[Unreadable]'\n }\n }\n if (keys.length > maxEntries) { result['…'] = `${keys.length - maxEntries} more` }\n return result\n } finally {\n ancestors.delete(object)\n }\n }\n\n return convert(value, 0)\n}\n\n/**\n * JSON for embedding in an HTML `<script type=\"application/json\">` element: neutralizes `<` and line separators.\n */\nexport function stringifyForHtml(value: unknown): string {\n return JSON.stringify(value)\n .replace(/</g, '\\\\u003c')\n .replace(/\\u2028/g, '\\\\u2028')\n .replace(/\\u2029/g, '\\\\u2029')\n}\n","import type { TraceEvent } from '../types/trace'\n\n/** Context events describe a store (state, subscribers, options) and are emitted when a store is set up. */\nexport function isContextEvent(event: Pick<TraceEvent, 'namespace'>): boolean {\n return event.namespace.endsWith(':context')\n}\n\ninterface NamedSubscriber {\n execution?: unknown\n name?: unknown\n pluginOptions?: unknown\n}\n\n/** Subscribers by name, like the console does, keeping their execution options and plugin options. */\nexport function describeSubscribers(subscribers: unknown[]): Record<string, unknown> {\n const described: Record<string, unknown> = {}\n\n subscribers.forEach(item => {\n const { execution, name, pluginOptions } = (item ?? {}) as NamedSubscriber\n const baseName = typeof name === 'string' && name ? name : 'anonymous'\n let key = baseName\n for (let duplicate = 2; key in described; duplicate++) { key = `${baseName} (${duplicate})` }\n\n described[key] = {\n ...(execution !== undefined && { execution }),\n ...(pluginOptions !== undefined && { pluginOptions })\n }\n })\n\n return described\n}\n\n/** Context payload as displayed by the devtools: named subscribers, and options without their actions. */\nexport function buildContextView(payload: Record<string, unknown>): Record<string, unknown> {\n const view = { ...payload }\n\n if (Array.isArray(view.subscribers)) {\n view.subscribers = describeSubscribers(view.subscribers)\n }\n\n if (view.options && typeof view.options === 'object') {\n const options = view.options as { storeOptions?: unknown }\n const shown = options.storeOptions && typeof options.storeOptions === 'object' ? options.storeOptions : options\n const { actions: _actions, ...withoutActions } = shown as Record<string, unknown>\n view.options = withoutActions\n }\n\n return view\n}\n","/**\n * Glossary of the `groupId` values emitted by `PluginSubscription`.\n * A group id is a `/` separated path: its prefixes are the parent groups (lifecycles), so\n * `after` and `onError` are sub-groups of their `onAction` call.\n * Listeners can subscribe to these ids and custom traces can join the same group.\n */\nconst onAction = (storeId: string, actionName: string, callId: number) => `${storeId}/onAction:${actionName}#${callId}`\nconst plugin = (storeId: string) => `${storeId}/plugin`\n\nexport const traceGroups = {\n onAction,\n onActionAfter: (storeId: string, actionName: string, callId: number) => `${onAction(storeId, actionName, callId)}/after`,\n onActionError: (storeId: string, actionName: string, callId: number) => `${onAction(storeId, actionName, callId)}/onError`,\n onMutation: (storeId: string, callId: number) => `${storeId}/onMutation#${callId}`,\n plugin,\n pluginDeferred: (storeId: string, subscriberName: string, callId: number) => `${plugin(storeId)}/deferred:${subscriberName}#${callId}`,\n reset: (storeId: string, callId: number) => `${storeId}/reset#${callId}`\n}\n\nconst callIdSuffix = /#\\d+$/\n\n/** Human readable name of a group: its last segment, without the call counter. */\nexport function getTraceGroupName(groupId: string): string {\n const segment = groupId.slice(groupId.lastIndexOf('/') + 1)\n if (segment === 'plugin') { return 'Plugin setup' }\n return segment.replace(callIdSuffix, '').replace(':', ' · ')\n}\n"],"names":["toSerializable","value","maxDepth","maxEntries","maxNodes","ancestors","nodes","convert","current","depth","object","isCollection","items","result","item","keys","key","stringifyForHtml","isContextEvent","event","describeSubscribers","subscribers","described","execution","name","pluginOptions","baseName","duplicate","buildContextView","payload","view","options","shown","_actions","withoutActions","onAction","storeId","actionName","callId","plugin","traceGroups","subscriberName","callIdSuffix","getTraceGroupName","groupId","segment"],"mappings":"AAQO,SAASA,EACZC,GACA,EAAE,UAAAC,IAAW,GAAG,YAAAC,IAAa,KAAK,UAAAC,IAAW,IAAA,IAAgC,IACtE;AACP,QAAMC,wBAAgB,IAAA;AACtB,MAAIC,IAAQ;AAEZ,WAASC,EAAQC,GAAkBC,GAAwB;AACvD,YAAQ,OAAOD,GAAA;AAAA,MACX,KAAK;AACD,eAAOA,EAAQ,SAAS,MAAkB,GAAGA,EAAQ,MAAM,GAAG,GAAe,CAAC,MAAMA;AAAA,MACxF,KAAK;AACD,eAAO,OAAO,SAASA,CAAO,IAAIA,IAAU,OAAOA,CAAO;AAAA,MAC9D,KAAK;AACD,eAAOA;AAAA,MACX,KAAK;AACD,eAAO;AAAA,MACX,KAAK;AACD,eAAO,GA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AOA,EAAK,WAAY,UAAU;AAClD,UAAMC,IAAUD,EAAK,SACfE,IAAQD,EAAQ,gBAAgB,OAAOA,EAAQ,gBAAiB,WAAWA,EAAQ,eAAeA,GAClG,EAAE,SAASE,GAAU,GAAGC,MAAmBF;AACjD,IAAAF,EAAK,UAAUI;AAAA,EACnB;AAEA,SAAOJ;AACX;AC1CA,MAAMK,IAAW,CAACC,GAAiBC,GAAoBC,MAAmB,GAAGF,CAAO,aAAaC,CAAU,IAAIC,CAAM,IAC/GC,IAAS,CAACH,MAAoB,GAAGA,CAAO,WAEjCI,IAAc;AAAA,EACvB,UAAAL;AAAA,EACA,eAAe,CAACC,GAAiBC,GAAoBC,MAAmB,GAAGH,EAASC,GAASC,GAAYC,CAAM,CAAC;AAAA,EAChH,eAAe,CAACF,GAAiBC,GAAoBC,MAAmB,GAAGH,EAASC,GAASC,GAAYC,CAAM,CAAC;AAAA,EAChH,YAAY,CAACF,GAAiBE,MAAmB,GAAGF,CAAO,eAAeE,CAAM;AAAA,EAChF,QAAAC;AAAA,EACA,gBAAgB,CAACH,GAAiBK,GAAwBH,MAAmB,GAAGC,EAAOH,CAAO,CAAC,aAAaK,CAAc,IAAIH,CAAM;AAAA,EACpI,OAAO,CAACF,GAAiBE,MAAmB,GAAGF,CAAO,UAAUE,CAAM;AAC1E,GAEMI,IAAe;AAGd,SAASC,EAAkBC,GAAyB;AACvD,QAAMC,IAAUD,EAAQ,MAAMA,EAAQ,YAAY,GAAG,IAAI,CAAC;AAC1D,SAAIC,MAAY,WAAmB,iBAC5BA,EAAQ,QAAQH,GAAc,EAAE,EAAE,QAAQ,KAAK,KAAK;AAC/D;"}
|
|
@@ -6,6 +6,7 @@ export default class PluginSubscription extends TraceEmitter {
|
|
|
6
6
|
private _hydrationScheduler;
|
|
7
7
|
private _onActionSubscriptions;
|
|
8
8
|
private _onActionSubscriptionsTraces;
|
|
9
|
+
private _actionSeq;
|
|
9
10
|
private _onActionStores;
|
|
10
11
|
private _onActionAfterSubscriptions;
|
|
11
12
|
private _onActionOnErrorSubscriptions;
|
|
@@ -30,6 +31,11 @@ export default class PluginSubscription extends TraceEmitter {
|
|
|
30
31
|
private addResetStoreCallback;
|
|
31
32
|
private clearOnActionCallbacksSubscriptions;
|
|
32
33
|
private clearStoreTracking;
|
|
34
|
+
/**
|
|
35
|
+
* Closes a trace group once `pending` settles, or after the configured timeout so a promise
|
|
36
|
+
* that never settles cannot keep buffering the traces of the store scope.
|
|
37
|
+
*/
|
|
38
|
+
private closeGroupWhenSettled;
|
|
33
39
|
/**
|
|
34
40
|
* Creates a callback collector for the specified action and store.
|
|
35
41
|
* @param actionName The name of the action to collect callbacks for.
|
|
@@ -56,6 +62,8 @@ export default class PluginSubscription extends TraceEmitter {
|
|
|
56
62
|
private defineHydrationScheduler;
|
|
57
63
|
private defineSubscriberKey;
|
|
58
64
|
private defineSubscriptionKey;
|
|
65
|
+
/** Closes a trace group once all async callbacks are settled (immediately if none is pending). */
|
|
66
|
+
private endGroupAfter;
|
|
59
67
|
private executeResetStoreCallbacks;
|
|
60
68
|
/**
|
|
61
69
|
* Executes the store's onAction subscription for the given plugin subscriber.
|
|
@@ -64,13 +72,6 @@ export default class PluginSubscription extends TraceEmitter {
|
|
|
64
72
|
* @returns void
|
|
65
73
|
*/
|
|
66
74
|
private executeStoreOnActionSubscription;
|
|
67
|
-
/**
|
|
68
|
-
* Runs a callback, tracing sync errors and async rejections.
|
|
69
|
-
* @returns a never-rejecting promise when the callback is asynchronous, undefined otherwise.
|
|
70
|
-
*/
|
|
71
|
-
private runCallbackSafely;
|
|
72
|
-
/** Closes a trace group once all async callbacks are settled (immediately if none is pending). */
|
|
73
|
-
private endGroupAfter;
|
|
74
75
|
private executeStoreOnActionAfterCallbacks;
|
|
75
76
|
private executeStoreOnActionOnErrorCallbacks;
|
|
76
77
|
/**
|
|
@@ -88,13 +89,13 @@ export default class PluginSubscription extends TraceEmitter {
|
|
|
88
89
|
*/
|
|
89
90
|
plugin({ store, options }: PiniaPluginContext): void;
|
|
90
91
|
private queueSubscriberExecution;
|
|
91
|
-
/**
|
|
92
|
-
* Closes a trace group once `pending` settles, or after the configured timeout so a promise
|
|
93
|
-
* that never settles cannot keep buffering the traces of the store scope.
|
|
94
|
-
*/
|
|
95
|
-
private closeGroupWhenSettled;
|
|
96
92
|
private registerStoreCleanup;
|
|
97
93
|
private rewriteResetStore;
|
|
94
|
+
/**
|
|
95
|
+
* Runs a callback, tracing sync errors and async rejections.
|
|
96
|
+
* @returns a never-rejecting promise when the callback is asynchronous, undefined otherwise.
|
|
97
|
+
*/
|
|
98
|
+
private runCallbackSafely;
|
|
98
99
|
private shouldInvokePlugin;
|
|
99
100
|
private shouldScheduleAfterHydration;
|
|
100
101
|
private storeOnActionSubscription;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type PropType, type VNode } from 'vue';
|
|
2
|
+
import type { TraceJournal } from '../types/trace';
|
|
3
|
+
import type { TraceDevtoolsOptions, TraceTimelineFilters } from '../types/devtools';
|
|
4
|
+
export interface DevtoolsState {
|
|
5
|
+
expanded: Record<string, boolean>;
|
|
6
|
+
filters: TraceTimelineFilters;
|
|
7
|
+
open: boolean;
|
|
8
|
+
scope?: string;
|
|
9
|
+
tab: 'context' | 'timeline';
|
|
10
|
+
}
|
|
11
|
+
export declare const TraceDevtoolsPanel: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
12
|
+
journal: {
|
|
13
|
+
required: true;
|
|
14
|
+
type: PropType<TraceJournal>;
|
|
15
|
+
};
|
|
16
|
+
options: {
|
|
17
|
+
required: true;
|
|
18
|
+
type: PropType<Required<Pick<TraceDevtoolsOptions, "position" | "width">>>;
|
|
19
|
+
};
|
|
20
|
+
state: {
|
|
21
|
+
required: true;
|
|
22
|
+
type: PropType<DevtoolsState>;
|
|
23
|
+
};
|
|
24
|
+
}>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
27
|
+
journal: {
|
|
28
|
+
required: true;
|
|
29
|
+
type: PropType<TraceJournal>;
|
|
30
|
+
};
|
|
31
|
+
options: {
|
|
32
|
+
required: true;
|
|
33
|
+
type: PropType<Required<Pick<TraceDevtoolsOptions, "position" | "width">>>;
|
|
34
|
+
};
|
|
35
|
+
state: {
|
|
36
|
+
required: true;
|
|
37
|
+
type: PropType<DevtoolsState>;
|
|
38
|
+
};
|
|
39
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
40
|
+
export declare function createDevtoolsState(open: boolean): DevtoolsState;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TraceDevtoolsHandle, TraceDevtoolsOptions } from '../types/devtools';
|
|
2
|
+
import type { TraceRegistry } from '../types/trace';
|
|
3
|
+
/**
|
|
4
|
+
* Mounts the trace panel in the page: an aside, isolated in a Shadow DOM, reading the registry journal.
|
|
5
|
+
* Meant for development: load it with a dynamic import and keep it out of production builds.
|
|
6
|
+
* It does nothing outside a browser, or when the registry has no journal (`createTracerRegistry({ journal: true })`).
|
|
7
|
+
*/
|
|
8
|
+
export declare function mountTraceDevtools(registry: Pick<TraceRegistry, 'journal'>, { container, open, position, shortcut, width }?: TraceDevtoolsOptions): TraceDevtoolsHandle;
|
|
9
|
+
export type { TraceDevtoolsHandle, TraceDevtoolsOptions } from '../types/devtools';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TraceEvent, TraceJournal } from '../types/trace';
|
|
2
|
+
import type { TraceEventDetail, TraceStoreSummary, TraceTimelineEntry, TraceTimelineFilters } from '../types/devtools';
|
|
3
|
+
export declare const defaultTimelineFilters: TraceTimelineFilters;
|
|
4
|
+
/**
|
|
5
|
+
* Only the parts an event actually carries: no `error` / `payload` key when they are undefined or empty.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getEventDetail(event: TraceEvent): TraceEventDetail;
|
|
8
|
+
/**
|
|
9
|
+
* Nests the events by lifecycle: the `groupId` path gives the groups, so `after` and `onError` are
|
|
10
|
+
* sub-groups of their `onAction`. Events without group stay at the root. Context events belong to the Context tab.
|
|
11
|
+
*/
|
|
12
|
+
export declare function buildTimeline(events: TraceEvent[]): TraceTimelineEntry[];
|
|
13
|
+
/** Keeps the events matching the filters, and drops groups left empty. */
|
|
14
|
+
export declare function filterTimeline(entries: TraceTimelineEntry[], filters: TraceTimelineFilters): TraceTimelineEntry[];
|
|
15
|
+
/** Most recent context event of a store: store, subscribers, hooks subscriptions and options. */
|
|
16
|
+
export declare function findContextEvent(events: TraceEvent[]): TraceEvent | undefined;
|
|
17
|
+
export declare function summarizeStores(journal: TraceJournal): TraceStoreSummary[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const devtoolsStyles = "\n:host { all: initial; }\n.pps { position: fixed; top: 0; bottom: 0; z-index: 2147483000; display: flex; flex-direction: column;\n background: #1b1d23; color: #e6e8ee; font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;\n box-shadow: 0 0 24px rgba(0,0,0,.45); max-height: 100vh; max-height: 100dvh; overflow: hidden; }\n.pps.right { right: var(--pps-gutter, 0px); border-left: 1px solid #343846; }\n.pps.left { left: 0; border-right: 1px solid #343846; }\n.pps * { box-sizing: border-box; }\n.pps-fab { position: fixed; bottom: 16px; z-index: 2147483000; border: 0; border-radius: 999px; padding: 8px 14px; display: flex; align-items: center; gap: 6px;\n background: #1b1d23; color: #42d392; font: 600 12px ui-monospace, monospace; cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,.4); }\n.pps-icon { width: 16px; height: 16px; fill: currentColor; }\n.pps-fab.right { right: calc(16px + var(--pps-gutter, 0px)); } .pps-fab.left { left: 16px; }\n.pps-fab.right:hover { filter: drop-shadow(1px 1px 29px #90ee90d4); }\n.pps-fab.has-errors { color: #ff6b6b; }\n.pps-header { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-bottom: 1px solid #343846; }\n.pps-title { font-weight: 700; color: #42d392; flex: 1; }\n.pps-bar { display: flex; gap: 6px; padding: 6px 10px; border-bottom: 1px solid #343846; flex-wrap: wrap; }\n.pps select, .pps input, .pps button { min-width: 0; max-width: 100%; background: #272a33; color: inherit; border: 1px solid #3d4252; border-radius: 4px;\n padding: 3px 6px; font: inherit; }\n.pps button { cursor: pointer; } .pps button:hover { background: #313644; }\n.pps button.active { background: #42d392; color: #10131a; border-color: #42d392; }\n.pps input { flex: 1; min-width: 90px; }\n.pps-body { flex: 1 1 0; min-height: 0; overflow-x: hidden; overflow-y: scroll; overscroll-behavior: contain; padding: 6px 10px 16px;\n scrollbar-width: auto; scrollbar-color: #5a6075 #272a33; }\n.pps-body::-webkit-scrollbar { width: 12px; }\n.pps-body::-webkit-scrollbar-track { background: #272a33; }\n.pps-body::-webkit-scrollbar-thumb { background: #5a6075; border-radius: 6px; border: 2px solid #272a33; }\n.pps-entry { border-bottom: 1px solid #2b2f3b; padding: 3px 0; }\n.pps button.pps-row { display: flex; gap: 6px; align-items: baseline; width: 100%; text-align: left; border: 0; background: none; padding: 2px 0; }\n.pps button.pps-row:hover { background: #272a33; }\n.pps button.pps-static { cursor: default; }\n.pps button.pps-event { flex-direction: column; gap: 2px; align-items: stretch; }\n.pps-meta { display: flex; gap: 6px; align-items: center; }\n.pps-label { flex: 1; min-width: 0; overflow-wrap: anywhere; }\n.pps-caret { color: #7c8294; width: 10px; }\n.pps-chip { border-radius: 3px; padding: 0 5px; font-size: 10px; font-weight: 700; color: #10131a; cursor: help; }\n.pps-chip.p { background: #42d392; } .pps-chip.e { background: #ff6b6b; }\n.pps-badge { border-radius: 3px; padding: 0 4px; font-size: 10px; background: #3d4252; }\n.pps-badge.server { background: #8e6bff; color: #fff; } .pps-badge.client { background: #2f7de1; color: #fff; }\n.pps-error { color: #ff6b6b; }\n.pps-children { margin-left: 14px; border-left: 1px solid #343846; padding-left: 8px; }\n.pps-muted { color: #7c8294; }\n.pps-tree { margin-left: 12px; } .pps-tree > summary { cursor: pointer; }\n.pps-key { color: #9ecbff; } .pps-str { color: #a5d6a7; } .pps-num { color: #ffcc80; }\n.pps-notice { color: #ffcc80; padding: 4px 0; }\n";
|