pinia-plugin-subscription 1.0.0-beta.13 → 1.0.0-beta.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/CHANGELOG.md +29 -12
  2. package/CONTRIBUTING.md +10 -1
  3. package/README.md +11 -9
  4. package/SECURITY.md +2 -2
  5. package/dist/chunks/{PluginSubscription-Bkqj4uSK.js → PluginSubscription-GJDsym1O.js} +253 -247
  6. package/dist/core/PluginSubscriber.d.ts +1 -1
  7. package/dist/core/PluginSubscription.d.ts +13 -12
  8. package/dist/core/Store.d.ts +1 -1
  9. package/dist/helpers/index.d.ts +0 -4
  10. package/dist/helpers.js +56 -651
  11. package/dist/pinia-plugin-subscription.js +4 -5
  12. package/dist/system/TraceEmitter.d.ts +1 -2
  13. package/dist/types/index.d.ts +1 -2
  14. package/dist/types/plugin.d.ts +2 -3
  15. package/dist/types/trace.d.ts +30 -109
  16. package/dist/utils/traceGroups.d.ts +9 -7
  17. package/docs/authoring-plugins.md +13 -7
  18. package/docs/using-plugins.md +28 -19
  19. package/package.json +9 -4
  20. package/dist/chunks/PluginSubscription-Bkqj4uSK.js.map +0 -1
  21. package/dist/factories/console-trace-listener.d.ts +0 -7
  22. package/dist/factories/trace-listener.d.ts +0 -10
  23. package/dist/factories/trace-registry.d.ts +0 -2
  24. package/dist/helpers.js.map +0 -1
  25. package/dist/pinia-plugin-subscription.js.map +0 -1
  26. package/dist/system/Tracer.d.ts +0 -23
  27. package/dist/system/log/console-group.d.ts +0 -8
  28. package/dist/system/log/console.d.ts +0 -18
  29. package/dist/system/log/index.d.ts +0 -2
  30. package/dist/system/log/log-trace.d.ts +0 -8
  31. package/dist/system/log/print-array.d.ts +0 -7
  32. package/dist/system/log/print-error.d.ts +0 -6
  33. package/dist/system/log/print-object.d.ts +0 -1
  34. package/dist/system/log/print-trace-payload.d.ts +0 -1
  35. package/dist/system/log/print-trace.d.ts +0 -9
  36. package/dist/system/log/trace-console.d.ts +0 -9
  37. package/dist/tests/defineAStore.test-d.d.ts +0 -1
  38. package/dist/tests/storeOptionsExtensions.test-d.d.ts +0 -12
  39. package/dist/types/comparison.d.ts +0 -3
  40. package/dist/types/list.d.ts +0 -13
  41. package/dist/types/log.d.ts +0 -8
  42. package/dist/types/resourceId.d.ts +0 -4
  43. package/dist/utils/Performance.d.ts +0 -9
  44. package/dist/utils/environment.d.ts +0 -7
  45. package/dist/utils/object.d.ts +0 -4
  46. package/dist/utils/redact.d.ts +0 -15
  47. package/docs/tracing.md +0 -185
@@ -1 +0,0 @@
1
- {"version":3,"file":"PluginSubscription-Bkqj4uSK.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/utils/traceGroups.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 _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 * 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 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 this.traceGroupStart(() => ({ args }), 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({}, 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 )\n if (result) {\n pending.push(result)\n }\n })\n\n this.endGroupAfter(pending, closeGroup)\n this.executeStoreOnActionAfterCallbacks(after, storageKey, store, name)\n this.executeStoreOnActionOnErrorCallbacks(onError, storageKey, store, name)\n this.clearOnActionCallbacksSubscriptions(storageKey)\n } catch (error) {\n closeGroup()\n throw error\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 /** 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 executeStoreOnActionAfterCallbacks(\n after: (callback: (result: any) => void) => void,\n storageKey: string,\n store: Store,\n name: string\n ) {\n const afterCallbacks = this._onActionAfterSubscriptions[storageKey]\n if (afterCallbacks?.length) {\n after((result) => {\n this.traceGroupStart(\n () => ({\n groupId: traceGroups.onActionAfter(store.$id),\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 () => ({ 'action name': name })\n ))\n\n this.endGroupAfter(pending, () =>\n this.traceGroupEnd(() => ({ groupId: traceGroups.onActionAfter(store.$id) }), 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 ) {\n const onErrorCallbacks = this._onActionOnErrorSubscriptions[storageKey]\n\n if (onErrorCallbacks?.length) {\n onError((error) => {\n this.traceGroupStart(() => ({\n 'action name': name,\n error,\n groupId: traceGroups.onActionError(store.$id)\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 () => ({ groupId: traceGroups.onActionError(store.$id) })\n ))\n\n this.endGroupAfter(pending, () =>\n this.traceGroupEnd(() => ({ groupId: traceGroups.onActionError(store.$id) }), 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 this.traceGroupStart(() => ({\n environment: {\n current: this.defineCurrentEnvironment(),\n ...this._options?.execution ?? {}\n\n },\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(() => ({}), 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 this.traceGroupStart(() => ({ subscriber: subscriber.name }), storeId, 'subscriber:deferred')\n const closeGroup = () => this.traceGroupEnd(() => ({}), 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 /**\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 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 this.traceGroupStart(() => ({ initialState: safeState, groupId: traceGroups.reset(store.$id) }), store.$id, 'store:reset')\n try {\n this.executeResetStoreCallbacks(store)\n store.$patch(deepClone(safeState))\n } finally {\n this.traceGroupEnd(() => ({ initialState: safeState, groupId: traceGroups.reset(store.$id) }), store.$id)\n }\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 this.traceGroupStart(() => ({ mutation, groupId: traceGroups.onMutation(store.$id) }), 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)\n }\n }))\n } finally {\n this.traceGroupEnd(() => ({ mutation, groupId: traceGroups.onMutation(store.$id) }), 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 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)\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()","import type { TraceGroupId } from '../types/trace'\n\n/**\n * Glossary of the `groupId` values emitted by `PluginSubscription`.\n * Each builder returns the group identifier of a store, so listeners can subscribe to it\n * and custom traces can join the same group.\n */\nexport const traceGroups: Record<TraceGroupId, (storeId: string) => string> = {\n onActionAfter: (storeId) => `store:onAction:after:${storeId}`,\n onActionError: (storeId) => `store:onAction:onError:${storeId}`,\n onMutation: (storeId) => `store:onMutation:${storeId}`,\n reset: (storeId) => `store:reset:${storeId}`\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","traceGroups","className","defaultPluginExecution","defaultDeferredTraceGroupTimeout","defaultHydrationScheduler","callback","subscribers","storageKey","after","onError","subscriber","pluginName2","onActionSubscriptions","hasRollbackSnapshots","name","callbacks","groupClosed","closeGroup","pending","result","errorLabel","extra","end","promises","p","afterCallbacks","onErrorCallbacks","subscriberKey","context","hydrateResult","runAfterHydration","afterHydration","e","subscribtions","execution","scheduler","subscriberName","closed","closeOnce","timer","timeout","dispose","scopedStore","initState","safeState","currentEnvironment","subscription","unsubscribe","mutation","mutationCallback","pluginSubscriptions","pluginSubscription","subscriptionKey","subscriptionOptions","stores","pluginOptions","store2","tracerHandler"],"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,CAAU,MAAM,CAACH,EAAUE,CAAG,GAAGF,EAAUG,CAAU,CAAC,CAAC;AAAA,IAAA;AAIlG,MAAIF,aAAiB;AACjB,WAAO,IAAI,IAAI,MAAM,KAAKA,EAAM,OAAA,GAAU,CAAAE,MAAcH,EAAUG,CAAU,CAAC,CAAC;AAGlF,MAAI,MAAM,QAAQF,CAAK;AACnB,WAAOA,EAAM,IAAI,CAAAG,MAAQJ,EAAUI,CAAI,CAAC;AAG5C,MAAI,OAAO,eAAeH,CAAK,MAAM,OAAO,aAAa,OAAO,eAAeA,CAAK,MAAM;AACtF,WAAO,OAAO;AAAA,MACV,OAAO,QAAQA,CAAgC,EAAE,IAAI,CAAC,CAACC,GAAKE,CAAI,MAAM,CAACF,GAAKF,EAAUI,CAAI,CAAC,CAAC;AAAA,IAAA;AAIpG,QAAMC,IAAe,OAAO,OAAO,OAA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YACD,GAAAnG;AAAA,YACT,GAAAkG;AAAA,YACK,GAAAC,GAAA,gBAA6B,CAAA;AAAA,UAC7B;AAAA;MAGD;AAAA,IAGJ;AACI,WAAA,WAAM,8BAA0C,GAAI;AAAA,IACpD;AAAA,EACI;AAAA,EAAA,cACJjE,GAAAI,GAAA;AAEA,UAAA8D,IAAK,KAAgB,UAAS;AAC9B,IAAAA,MAAIA,EAAA,oBAAA,KAAA,OACAA,EAAM,WAAgB;AAAA,MAClB,GAAA,OAAIlE,KAAA,aAAAA,EAAA,IAAAA,KAAA,CAAA;AAAA,MACA,OAAAI;AAAA,IAA+B,CAAA;AAAA,EAEqB;AAAA,EACxD,gBACFJ,GAAAI,GAAAD,GAAA;AAAA,UACN+D,IAAE,KAAA,UAAA;AACE,IAAAA,MAAKA,EAAuB,oBAAmB,KAAA,QACnDlE,IAAA,OAAAA,KAAA,aAAAA,EAAA,IAAAA,KAAA,CAAA,GACHkE,EAAA,WAAA;AAAA,MAED,GAAKlE;AAAA,MACT,OAAAI;AAAA,IAEQ,CAAA,GAIJ,KAAO,MAAAD,mBAA6BH,CAAUM;AAAAA,EAE1C;AAEA;"}
@@ -1,7 +0,0 @@
1
- import type { TraceListenerGroupBy, ConsoleTraceGroupListener } from '../types/trace';
2
- /**
3
- * Creates a console trace group listener that groups trace events by the specified key.
4
- * @param groupBy The key of the trace event metadata to group by.
5
- * @returns A console trace group listener configured to group trace events by the specified key.
6
- */
7
- export declare function createConsoleGroupTraceListener(groupBy?: TraceListenerGroupBy): ConsoleTraceGroupListener;
@@ -1,10 +0,0 @@
1
- import type { TraceEventMetadata, TraceFilterFactoryCriterion, TraceFilterFactoryParam, TraceGroupListener } from "../types/trace";
2
- /**
3
- * Creates a trace group listener with optional filtering.
4
- * @param listenerDef The listener definition or filter criteria for the trace group listener.
5
- * @param context Print the plugin context (subscribers, store, options, and traces) to the console.. Defaults to true.
6
- * @param filterMode The mode to apply when evaluating multiple filter criteria: 'every' or 'some'.
7
- * @param groupBy The key of the trace event metadata to group by.
8
- * @returns A trace listener configured with group handling and filtering.
9
- */
10
- export declare function createTraceGroupListener(listenerDef: TraceFilterFactoryParam | TraceFilterFactoryCriterion[], context?: boolean, filterMode?: 'every' | 'some', groupBy?: keyof TraceEventMetadata): TraceGroupListener;
@@ -1,2 +0,0 @@
1
- import type { TraceRegistry, TracerRegistryOptions } from '../types/trace';
2
- export declare function createTracerRegistry({ enabled, redact }?: TracerRegistryOptions): TraceRegistry;
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers.js","sources":["../src/core/PluginSubscriber.ts","../src/core/Store.ts","../src/factories/plugin-subscriber.ts","../src/system/Tracer.ts","../src/system/log/index.ts","../src/system/log/console.ts","../src/system/log/console-group.ts","../src/system/log/print-array.ts","../src/system/log/print-error.ts","../src/system/log/print-object.ts","../src/system/log/print-trace-payload.ts","../src/system/log/log-trace.ts","../src/system/log/print-trace.ts","../src/system/log/trace-console.ts","../src/factories/console-trace-listener.ts","../src/factories/trace-listener.ts","../src/utils/environment.ts","../src/utils/redact.ts"],"sourcesContent":["import Store from \"./Store\";\nimport type { PiniaPluginContext, Store as PiniaStore } from \"pinia\";\nimport type {\n PluginExecutionOptions,\n PluginHydrationScheduler,\n PluginSubscriber as PluginSubscriberInterface,\n PluginSubscriptions,\n StoreClassConstructorParams,\n StoreMutationSubscription,\n StoreOnActionSubscription\n} from \"../types/plugin\";\nimport type Tracer from \"../system/Tracer\";\n\n\n\ntype CreateInstance<Instance = Store> = (store: PiniaStore, options: StoreClassConstructorParams) => Instance | undefined\n\n\n/**\n * Type definition for the function used to create an instance of a store.\n * @template Instance The type of the store instance, defaulting to the base Store class.\n * @param store The Pinia store for which the instance is being created.\n * @param options Additional options for creating the store instance.\n * @returns The created store instance or undefined if creation fails.\n */\nexport default abstract class PluginSubscriber<Instance extends Store> implements PluginSubscriberInterface {\n private _createInstance: CreateInstance\n private _name: string\n private _pluginOptions?: StoreClassConstructorParams\n private _storeInstance?: Instance\n /** Callback function to reset the store instance, if needed. */\n protected _resetStoreCallback?: (store?: PiniaStore) => void\n private _storeOnActionSubscription?: StoreOnActionSubscription\n private _storeMutationSubscription?: StoreMutationSubscription\n private _subscriptions?: PluginSubscriptions\n /**\n * Called when the plugin subscriber has been created for a specific store.\n * This callback can be used to perform any initialization or setup required for the plugin subscriber.\n */\n protected pluginCreated?: (store: PiniaStore) => void\n /** Options for the plugin subscriber's execution. */\n public execution?: PluginExecutionOptions\n /** Scheduler for handling the hydration process of the plugin subscriber. */\n public hydrationScheduler?: PluginHydrationScheduler\n\n\n get name(): string {\n return this._name;\n }\n\n get storeInstance(): Instance | undefined {\n return this._storeInstance\n }\n\n get pluginOptions(): StoreClassConstructorParams | undefined {\n return this._pluginOptions;\n }\n\n set pluginOptions(options: StoreClassConstructorParams | undefined) {\n this._pluginOptions = options;\n }\n\n get resetStoreCallback(): ((store?: PiniaStore) => void) | undefined {\n return this._resetStoreCallback as ((store?: PiniaStore) => void) | undefined;\n }\n\n get storeOnActionSubscription(): StoreOnActionSubscription | undefined {\n return this._storeOnActionSubscription;\n }\n\n get storeMutationSubscription(): StoreMutationSubscription | undefined {\n return this._storeMutationSubscription;\n }\n\n get subscriptions(): PluginSubscriptions | undefined {\n return this._subscriptions\n }\n\n set subscriptions(subscriptions: PluginSubscriptions) {\n this._subscriptions = subscriptions\n }\n\n\n constructor(pluginName: string, createInstanceFunction: CreateInstance) {\n this._name = pluginName\n this._createInstance = createInstanceFunction\n }\n\n /**\n * Called after the store has been hydrated.\n * @param context The Pinia plugin context containing the store and options.\n * @returns A promise that resolves when the post-hydration process is complete, or void if synchronous.\n */\n public afterHydration(_context: PiniaPluginContext): void | Promise<void> {\n return\n }\n\n /**\n * Called when the plugin subscriber needs to hydrate its state.\n * @param context The Pinia plugin context containing the store and options.\n * @returns A promise that resolves when the hydration process is complete, or void if synchronous.\n */\n public hydrate(_context: PiniaPluginContext): void | Promise<void> {\n return\n }\n\n /**\n * Invokes the plugin subscriber with the given context and optional tracer creation function.\n * @param context The Pinia plugin context containing the store and options.\n * @param createTracer Optional function to create a tracer for the plugin.\n * @returns True if the plugin was successfully invoked, otherwise false.\n */\n public invoke({ store, options }: PiniaPluginContext, createTracer?: (name: string) => Tracer): boolean {\n this._storeInstance = this._createInstance(store, {\n ...options,\n ...this.pluginOptions,\n createTracer: createTracer ? () => createTracer?.(this.name) : undefined\n }) as Instance\n\n if (!this._storeInstance) {\n return false\n }\n\n this._subscriptions = this._storeInstance.getSubscriptions()\n this._storeMutationSubscription = this._storeInstance.storeSubscribe\n this._storeOnActionSubscription = this._storeInstance.onAction\n\n if (this.pluginCreated) {\n this.pluginCreated(store)\n }\n\n return true\n }\n}","import { isRef, ref, toRef } from \"vue\"\nimport Tracer from \"../system/Tracer\"\nimport TraceEmitter from \"../system/TraceEmitter\"\nimport { getDefineAStoreSetupContext, hasDeniedFirstChar, setEnhancedStore } from \"../utils/store\"\nimport { isEmpty } from \"../utils/validation\"\n\nimport type {\n PluginSubscriptionOptions,\n PluginSubscriptions,\n StoreClassConstructorParams,\n StoreMutationSubscription,\n StoreMutationSubscriptionCallback,\n StoreMutationSubscriptionReturn,\n StoreOnActionSubscription,\n StoreOnActionSubscriptionCallback,\n StoreOnActionSubscriptionReturn\n} from \"../types/plugin\"\nimport type { Store as PiniaStore, StateTree } from \"pinia\"\nimport type { AnyObject, PluginSubscriberInterface } from \"../types\"\nimport type { StoreOptions, StatePropertyValue } from \"../types/store\"\n\n/**\n * Base class for a Pinia store with enhanced capabilities.\n * Provides structured tracing, plugin subscriptions, and state management utilities.\n * @remarks\n * This class is intended to be extended by specific store implementations\n * that require enhanced capabilities such as structured tracing and plugin subscriptions.\n */\nexport default class Store extends TraceEmitter {\n protected _className = 'Store'\n private _createTracer?: () => Tracer\n private _onAction?: StoreOnActionSubscriptionCallback\n private _options: StoreOptions\n private _store: PiniaStore\n private _storeSubscribe?: StoreMutationSubscriptionCallback\n private _subscriptions: PluginSubscriptions = {}\n\n protected static _requiredKeys?: string[]\n\n get onAction(): StoreOnActionSubscription | undefined {\n if (!this._onAction) {\n return\n }\n\n return () => ({\n store: this.store as PiniaStore,\n callback: this._onAction\n }) as StoreOnActionSubscriptionReturn\n }\n\n set onAction(onAction: StoreOnActionSubscriptionCallback) {\n this._onAction = onAction\n }\n\n get options(): StoreOptions { return this._options }\n\n get state(): StateTree { return this._store.$state }\n\n set state(state: StateTree) { this._store.$state = state }\n\n get store(): AnyObject { return this._store }\n\n get storeSubscribe(): StoreMutationSubscription | undefined {\n if (!this._storeSubscribe) {\n return\n }\n\n return () => ({\n store: this.store as PiniaStore,\n callback: this._storeSubscribe\n }) as StoreMutationSubscriptionReturn\n }\n\n set storeSubscribe(storeSubscribe: StoreMutationSubscriptionCallback) {\n this._storeSubscribe = storeSubscribe\n }\n\n /**\n * Returns the structured trace emitter of this store.\n * Built lazily so that subclasses overriding `_className` are reflected.\n */\n protected override get tracer(): Tracer | undefined {\n if (!this._tracer && this._createTracer) {\n this._tracer = this._createTracer()\n this._tracer.scope = this.store.$id\n }\n\n return this._tracer\n }\n\n /**\n * Constructs a new instance of the store.\n * @param store The Pinia store instance.\n * @param options The plugin store options and subscription options.\n * @remarks\n * This constructor is typically called by the `customizeStore` static method\n * to create an instance of the store with the provided Pinia store and options.\n * @see PluginStoreOptions\n * @see PluginSubscriptionOptions\n */\n constructor(store: PiniaStore, options: StoreClassConstructorParams) {\n super()\n this._options = options.storeOptions as StoreOptions\n this._store = store\n this.initializeTracer(options)\n this.trace('instance:created', store.$id)\n\n if (this._options?.enhancedStore) {\n const ctx = getDefineAStoreSetupContext(this.store)\n\n if (ctx) {\n setEnhancedStore(ctx, this.store)\n this.trace('setup:enhancedStore:success', this.store.$id)\n }\n }\n }\n\n /**\n * Adds a property to the state of this store.\n * @param name The name of the property to add.\n * @param value The value of the property to add.\n */\n addToState(name: string, value?: StatePropertyValue): void {\n if (!this.isOptionApi()) {\n if (!isRef(value)) {\n value = ref<StatePropertyValue>(value)\n }\n }\n\n this.state[name] = value\n this.store[name] = toRef(this.state, name)\n }\n\n /**\n * Adds a subscription for a specific plugin to this store.\n * @param pluginName The name of the plugin for which the subscription is being added.\n * @param subscription The subscription callback or object to add.\n * @param options Additional options for the subscription, including subscription options and target stores.\n */\n addSubscription(\n pluginName: string,\n subscription: PluginSubscriberInterface,\n options?: { subscriptionOptions?: StoreOptions, stores?: PiniaStore[] }\n ): void {\n this._subscriptions[pluginName] = { subscription, ...(options ?? {}) }\n }\n\n /**\n * Called after the store has been hydrated.\n * @returns A promise that resolves when the post-hydration process is complete, or void if synchronous.\n */\n afterHydration(): void | Promise<void> {\n return\n }\n\n /**\n * Create and return a class instance\n * @param store \n * @param options \n * @template Instance The type of the store instance being created.\n * @returns The created store instance of type `Instance`, or undefined if the required keys are not present.\n */\n static customizeStore<Instance extends Store>(\n store: PiniaStore,\n options: StoreClassConstructorParams\n ): Instance | undefined {\n if (options.storeOptions && this.hasRequiredKeys(options.storeOptions)) {\n return new this(store, options) as Instance\n }\n }\n\n /**\n * Retrieves the value of a specific store option.\n * @param optionName The name of the store option to retrieve.\n * @returns The value of the specified store option, or undefined if not found.\n */\n getOption(optionName: keyof StoreOptions) {\n return this.options && (this.options as StoreOptions)[optionName]\n }\n\n /**\n * Retrieves the value of a specific state property.\n * @param propertyName The name of the state property to retrieve.\n * @returns The value of the specified state property, or undefined if not found.\n */\n getStatePropertyValue(propertyName: string) {\n return this.getValue(this.state[propertyName])\n }\n\n /**\n * Retrieves all plugin subscriptions for this store.\n * @returns An object containing all plugin subscriptions, or undefined if there are none.\n */\n getSubscriptions(): PluginSubscriptions | undefined {\n if (isEmpty(this._subscriptions)) {\n return\n }\n\n return this._subscriptions\n }\n\n /**\n * Retrieves the actual value from a potentially reactive reference.\n * @param value The value to unwrap.\n * @returns The unwrapped value if it is a reactive reference, otherwise the original value.\n */\n getValue(value: any) {\n return value?.__v_isRef ? value.value : value\n }\n\n /**\n * Checks if the given property name has a denied first character.\n * @param property The property name to check.\n * @returns True if the property name has a denied first character, otherwise false.\n */\n protected hasDeniedFirstChar(property: string): boolean {\n return hasDeniedFirstChar(property)\n }\n\n /**\n * Checks if the given options object has all the required keys.\n * @param options The options object to check.\n * @returns True if all required keys are present, otherwise false.\n */\n protected static hasRequiredKeys(options: AnyObject): boolean {\n return this._requiredKeys !== undefined && this._requiredKeys?.every(requiredKey => !!options[requiredKey])\n }\n\n /**\n * Hydrates the store, potentially performing asynchronous operations.\n * @returns void or a Promise that resolves when hydration is complete.\n */\n hydrate(): void | Promise<void> {\n return\n }\n\n /**\n * Initializes the tracer for plugin subscriptions if the createTracer option is provided.\n * @param options The plugin subscription options containing the createTracer function.\n */\n private initializeTracer(options: Omit<PluginSubscriptionOptions, 'createTracer'> & { createTracer?: () => Tracer }) {\n this._createTracer = options?.createTracer\n }\n\n /**\n * Checks if the store is using the Options API.\n * @returns True if the store is using the Options API, otherwise false.\n */\n isOptionApi(): boolean { return this.store._isOptionsAPI }\n\n /**\n * Checks if the state object has the specified property.\n * @param property The property name to check.\n * @returns True if the state object has the property, otherwise false.\n */\n stateHas(property: string): boolean { return Object.prototype.hasOwnProperty.call(this.state, property) }\n\n /**\n * Checks if the store object has the specified property.\n * @param property The property name to check.\n * @returns True if the store object has the property, otherwise false.\n */\n storeHas(property: string): boolean { return Object.prototype.hasOwnProperty.call(this.store, property) }\n\n}","import type { PluginSubscriber, PluginSubscriberInvoke } from \"../types/plugin\";\n\n\n/**\n * Creates a new plugin subscriber with the given name, invoke function, and optional properties.\n * @param name - plugin name.\n * @param invoke - function to invoke for the plugin subscriber.\n * @param optionalProps - optional additional properties for the plugin subscriber.\n * @param {Function} optionalProps.afterHydration\n * @param {PluginExecutionOptions} optionalProps.execution\n * @param {Function} optionalProps.hydrate\n * @param {PluginHydrationScheduler} optionalProps.hydrationScheduler\n * @param {Function} optionalProps.resetStoreCallback\n * @param {StoreOnActionSubscription} optionalProps.storeOnActionSubscription\n * @param {StoreMutationSubscription} optionalProps.storeMutationSubscription\n * @param {PluginSubscriptions} optionalProps.subscriptions\n * @param \n * @returns A new plugin subscriber object.\n */\nexport function createPluginSubscriber(\n name: string,\n invoke: PluginSubscriberInvoke,\n optionalProps?: Omit<PluginSubscriber, \"name\" | \"invoke\">\n): PluginSubscriber {\n return {\n name,\n invoke,\n ...optionalProps,\n };\n}","import type { AnyObject } from '../types'\nimport type {\n TraceEvent,\n TraceEventMetadata,\n TraceGroupListener,\n TraceLevel,\n TraceListener,\n TracePayload,\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 _listeners: Array<TraceListener | TraceGroupListener> = []\n private readonly _redactor?: (payload: AnyObject) => AnyObject\n private _scope?: string\n private readonly _source: string\n\n constructor(source: string, listeners: Array<TraceListener | TraceGroupListener>, options: TracerOptions = {}) {\n this._redactor = options.redactor\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 matchListeners(level: TraceLevel, label: string, namespace: string, scope?: string) {\n const metadata: TraceEventMetadata = {\n label,\n level,\n namespace,\n scope: scope ?? this._scope,\n source: this._source\n }\n const matched: Array<TraceListener | TraceGroupListener> = []\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, metadata }\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 const { matched, metadata } = this._listeners.length === 0\n ? { matched: [], metadata: undefined }\n : this.matchListeners(level, label, namespace, scope)\n\n if (!metadata || matched.length === 0) {\n if (level === 'error') {\n console.error('Unhandled error trace event:', error)\n }\n return\n }\n\n const event: TraceEvent = {\n ...metadata,\n ...(error !== undefined && { error }),\n ...(payload !== undefined && { payload: this.resolveAndRedact(payload) }),\n timestamp: Date.now()\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","export function log(logStyle: string, args: any) {\n if (!logStyle) {\n throw new Error('Style instructions are required')\n }\n\n console.log(\n '%c%s',\n logStyle,\n args.shift(),\n ...args\n )\n}\n\nexport const getStyleDefinition = (bgColor: string, color: string = 'white') =>\n `background-color: ${bgColor}; color: ${color}; padding: 1px; margin-right: 5px; font-size: 12px`","import { getStyleDefinition, log } from './index'\nimport type { Console, LogType, StyleDefinition, StyleDefinitions } from '../../types/log'\n\n\nexport abstract class CustomConsole implements Console {\n protected _bgColor: string = 'transparent'\n protected _color: string = '#f2f286'\n protected _icon: string = '🍍⚡'\n protected _errorBgColor: string = '#d24545'\n protected _errorColor: string = 'white'\n protected _errorIcon: string = '🍍⚠️'\n protected _pluginName?: string\n protected _styles: StyleDefinitions = {\n error: { bgColor: this._errorBgColor, color: this._errorColor, icon: this._errorIcon },\n info: { bgColor: this._bgColor, color: this._color, icon: this._icon }\n }\n\n protected formatMessage(message: string, icon: string): string {\n return this._pluginName ? ` [${icon} ${this._pluginName}] \n ${message} \n` : message\n }\n\n protected generateStyle(styleDefinition: StyleDefinition): string {\n return getStyleDefinition(styleDefinition.bgColor, styleDefinition.color)\n }\n\n protected getStyleDefinition(messageType?: LogType): StyleDefinition {\n return this._styles[messageType ?? 'info']\n }\n\n log(...args: any) {\n this.useLog(\n this.getStyleDefinition(),\n args\n )\n }\n\n error(...args: any) {\n const logType = 'error'\n this.useLog(\n this.getStyleDefinition(logType),\n args\n )\n }\n\n protected rebuildArgs(args: string | any[]): any[] {\n if (typeof args === 'string') {\n return [args]\n }\n\n if (Array.isArray(args)) {\n return [args.shift(), ...args]\n }\n\n return [args]\n }\n\n protected useLog(styleDefinition: StyleDefinition, args: any) {\n log(\n this.generateStyle(styleDefinition),\n this.rebuildArgs(args)\n )\n }\n}","/**\n * Utility function to create console groups with different styles.\n * @param groupType The type of console group: 'collapsed', 'expanded', or 'none'.\n * @param args The arguments to be passed to the console group.\n * @returns void\n * \n */\nexport function consoleGroup(groupType: 'collapsed' | 'expanded' | 'none' = 'none', ...args: any[]) {\n if (groupType === 'collapsed') {\n console.groupCollapsed(\n '%c%s',\n 'color: #f7f7b0; padding: 1px; margin-right: 5px; font-size: 11px',\n ...args)\n } else if (groupType === 'expanded') {\n console.group(\n '%c%s',\n 'color: #f7f7b0; padding: 1px; margin-right: 5px; font-size: 11px',\n ...args)\n }\n}","/**\n * Prints an array to the console with a specific label and group type.\n * @param label The label to display for the array.\n * @param payload The array to print.\n * @param icon An optional icon to display alongside the label.\n */\nexport function printArray(\n payload: any[],\n label?: string,\n icon: string = ''\n) {\n if (typeof payload[0] !== 'object') {\n const printablePayload = (typeof payload[0] === 'string') ? payload.join(', ') : payload\n if (label) {\n console.log(\n '%c%s',\n 'color: #f7f7b0; padding: 1px; margin-right: 5px; font-size: 11px',\n `[ ${icon}${label} ]`, printablePayload\n )\n } else {\n console.log(printablePayload)\n }\n }\n\n if (typeof payload[0] === 'object') {\n if (payload[0]?.name) {\n console.log(payload.reduce((acc, item) => {\n if (acc) { acc += '\\r\\n' }\n acc += `- ${item.name}`\n return acc\n }, ''))\n } else if (payload[0]?._id) {\n console.log(payload.reduce((acc, item) => {\n if (acc) { acc += '\\r\\n' }\n acc += `- ${item._id}`\n return acc\n }, ''))\n } else {\n payload.forEach((item: any) => {\n console.dir(item)\n })\n }\n }\n}","export const errorColor = '#f86f63'\n\n/**\n * Prints an error to the console with a specific format.\n * @param payload The error object to print.\n */\nexport function printError(payload: Error) {\n console.groupCollapsed(\n '%c%s',\n `color: ${errorColor}; padding: 1px; margin-right: 5px; font-size: 11px`,\n `[ ${payload.name} ] ${payload.message}`,\n )\n if (payload.cause) {\n console.log('cause:', payload.cause)\n }\n const stack = payload.stack?.split('\\n')\n if (stack) {\n stack.forEach(line => {\n const trace = line.split('@')\n if (Array.isArray(trace)) {\n console.log(trace[0], trace[1])\n }\n })\n }\n console.groupEnd()\n}","import { isRef } from 'vue'\nimport { consoleGroup } from './console-group'\nimport { printArray } from './print-array'\nimport { errorColor, printError } from './print-error'\n\n\nexport function printObject(label: string, payload: object, groupType: 'collapsed' | 'expanded' | 'none' = 'collapsed', source?: string) {\n if (payload instanceof Error) {\n printError(payload)\n }\n\n const isArray = Array.isArray(payload)\n const isEmpty = isArray ? payload.length === 0 : Object.keys(payload).length === 0\n if (isEmpty) {\n console.log(\n '%c%s',\n `color: ${errorColor}; padding: 1px; margin-right: 5px; font-size: 10px`,\n `[ ${label} ] Empty`\n )\n return\n }\n\n const styles: Record<string, string> = {\n environment: '🍃 ',\n options: '🧮 ',\n store: '🏬 ',\n subscribers: '🧩 ',\n 'hooks subscriptions': '🔗 '\n }\n const icon = styles[label] ?? ''\n\n let consoleGroupArgs = source ? [`${icon}${label}`, source] : [`[ ${icon}${label} ]`]\n consoleGroup(groupType, ...consoleGroupArgs)\n\n if (isArray) {\n printArray(payload, groupType === 'none' ? label : undefined, icon)\n } else {\n let emptyKeys: string[] = []\n Object.keys(payload).forEach(key => {\n if (key === 'groupId') {\n return\n }\n\n const value = (payload as Record<string, unknown>)[key]\n if (typeof value === 'object') {\n if (Array.isArray(value)) {\n if (typeof value[0] === 'object') {\n printObject(key, value, 'expanded')\n } else if (typeof value[0] === 'string') {\n printObject(\n key,\n value.map((item: string, index: number) => `${index > 0 ? '\\r\\n ' : ' '}- ${item}`),\n 'expanded'\n )\n } else {\n console.log(\n '%c%s',\n 'color: #cae38f; padding: 1px; margin-right: 5px; font-size: 10px',\n `[ ${key} ]`, isRef(value) ? value.value : value\n )\n }\n } else if (value instanceof Error) {\n console.log(key, { name: value.name, message: value.message, stack: value.stack })\n } else {\n if (isRef(value)) {\n console.log(\n '%c%s',\n 'color: #cae38f; padding: 1px; margin-right: 5px; font-size: 10px',\n `[ ${key} ]`, isRef(value) ? value.value : value\n )\n }\n printObject(key, Object.assign({}, value), 'expanded')\n }\n } else {\n if (!value) {\n emptyKeys.push(key)\n } else {\n const typeOfValue = typeof value\n console.log(\n '%c%s',\n 'color: #b0fa05; padding: 1px; margin-right: 5px; font-size: 10px',\n `[ ${key} ]`, typeOfValue === 'function' ? typeOfValue : value\n )\n }\n }\n })\n if (emptyKeys.length) {\n console.log(\n '%c%s',\n 'color: #f86f63; font-size: 9px',\n `[ Empty properties ]`, emptyKeys\n )\n }\n }\n console.groupEnd()\n}","import { printObject } from './print-object'\nimport type { Store } from 'pinia'\n\nexport function printTracePayload(tracePayload: Record<string, unknown>) {\n Object.keys(tracePayload).forEach((key: string) => {\n if (['groupId', 'label', 'namespace', 'scope', 'source'].includes(key)) {\n return\n }\n const arg = tracePayload[key]\n if (!arg) {\n console.log(\n '%c%s',\n 'color: #f86f63; padding: 1px; margin-right: 5px; font-size: 10px',\n `[ ${key} ] ${arg}`\n )\n return\n }\n\n switch (typeof arg) {\n case 'string': case 'number':\n console.log(\n '%c%s',\n 'color: #fafa05; padding: 1px; margin-right: 5px; font-size: 10px',\n `[ ${key} ]`, arg\n )\n break;\n case 'object':\n switch (key) {\n case 'mutation':\n console.groupCollapsed('[mutation]')\n console.dir(arg)\n console.groupEnd()\n break;\n case 'options':\n printObject(key, (arg as { storeOptions?: unknown })?.storeOptions ?? arg)\n break;\n case 'payload':\n printTracePayload(arg as Record<string, unknown>)\n break;\n case 'store':\n printObject(key, {\n $state: (arg as Store)['$state'],\n $actions: Object.keys(arg).reduce((acc, curr) => {\n if ((curr.startsWith('$') && !['$id', '$state'].includes(curr)) || curr.startsWith('_')) {\n return acc\n }\n\n const value = (arg as Record<string, unknown>)[curr]\n\n if (typeof value !== 'function') {\n if (!acc['computed']) {\n acc['computed'] = []\n }\n (acc['computed'] as string[]).push(curr)\n\n } else {\n acc[curr] = (arg as Record<string, unknown>)[curr]\n }\n\n return acc\n }, {} as Record<string, unknown>)\n })\n break;\n case 'subscribers':\n printObject(key, (arg as { name: string }[]).map(\n (item, index) => `${index > 0 ? '\\r\\n ' : ' '}- ${item.name}`\n ))\n break;\n default:\n printObject(key, arg)\n }\n break;\n case 'function':\n console.dir(arg)\n break;\n default:\n console.info(key, arg)\n }\n })\n}","import { printTracePayload } from './print-trace-payload'\n\n/**\n * Logs trace events to the console with a specific style.\n * @param logStyle - The CSS style string for the log.\n * @param args - The arguments to log, with the first argument being the label.\n * @param pluginName - The name of the plugin generating the log.\n * @returns void\n */\nexport function logTrace(logStyle: string, args: any, pluginName: string) {\n if (!logStyle) {\n throw new Error('Style instructions are required')\n }\n\n const label = args.shift()\n const event = args[0]\n\n\n if (!event?.payload || Object.keys(event.payload).length === 0) {\n console.log(\n '%c%s',\n logStyle,\n `${event?.source === pluginName ? (event?.label ?? event?.namespace) : label}`,\n event?.source\n )\n return\n }\n\n console.groupCollapsed(\n '%c%s',\n logStyle,\n `${label}\n`, event?.source\n )\n\n args.forEach((arg: any) => {\n switch (typeof arg) {\n case 'string':\n console.info(arg)\n break;\n case 'object':\n if (Array.isArray(arg)) {\n console.table(arg)\n } else {\n printTracePayload(arg)\n }\n break;\n case 'function':\n console.dir(arg)\n break;\n default:\n console.info(arg)\n }\n })\n\n\n\n console.groupEnd()\n}","import { isRef } from 'vue'\nimport { printObject } from './print-object'\nimport type { TraceEvent } from '../../types/trace'\n\n\nfunction getPrintablePayload(trace: TraceEvent) {\n const { payload } = trace\n if (payload && Object.keys(payload).length > 0) {\n return Object.keys(payload).reduce((acc, key) => {\n if (!['groupId', 'label', 'namespace', 'scope', 'source'].includes(key)) {\n acc[key] = isRef(payload[key]) ? payload[key].value : payload[key]\n }\n return acc\n }, {} as Record<string, unknown>)\n }\n return undefined\n}\n\n\n/**\n * Prints a trace event to the console.\n * If the trace has a payload, it will be printed as an object.\n * Otherwise, it will print the trace label and source.\n * @param trace The trace event to print.\n * @returns void\n */\nexport function printTrace(trace: TraceEvent) {\n const payload = getPrintablePayload(trace)\n if (payload && Object.keys(payload).length > 0) {\n printObject(trace.label, payload, 'collapsed', trace.source)\n return\n }\n console.log(\n '%c%s',\n 'color: #f8f89f; padding: 1px; margin-right: 5px; font-size: 11px',\n trace.label, trace.source,\n )\n}","import { CustomConsole } from './console'\nimport { logTrace } from './log-trace'\nimport { pluginName } from '../../utils/constants'\nimport { printTrace } from './print-trace'\nimport { printTracePayload } from './print-trace-payload'\nimport type { StyleDefinition } from '../../types/log'\nimport type { ConsoleTraceEvent, ConsoleTraceEventArgs, TraceEvent } from '../../types/trace'\n\nexport class TraceConsole extends CustomConsole {\n protected _pluginName: string = pluginName\n\n constructor(pluginName?: string) {\n super()\n if (pluginName) {\n this._pluginName = pluginName\n }\n }\n\n\n logGroup(groups: ConsoleTraceEvent[]) {\n const firstEntry = groups.shift()\n const context = firstEntry?.[1] as ConsoleTraceEventArgs\n\n console.groupCollapsed(\n '%c%s',\n 'color: #87e47f; padding: 1px; margin-right: 5px; font-size: 11px; font-family: arial',\n `🍍 ${context?.label ?? context?.namespace}`, `[${context?.scope}]`\n )\n if (context?.payload) {\n printTracePayload(context.payload)\n }\n console.groupCollapsed(\n '%c%s',\n 'color: #f1f6b7; padding: 1px; margin-right: 5px; font-size: 11px',\n `[ ✨ traces ]`\n )\n groups.forEach(group => printTrace(group[1] as TraceEvent))\n console.groupEnd()\n console.groupEnd()\n }\n\n protected useLog(styleDefinition: StyleDefinition, args: any) {\n logTrace(\n this.generateStyle(styleDefinition),\n this.rebuildArgs(args),\n this._pluginName\n )\n }\n}","import { TraceConsole } from '../system/log/trace-console'\n\nimport type { Console } from '../types/log'\nimport type {\n ConsoleTraceEvent, ConsoleTraceEventArgs, TraceEvent, TraceListenerGroupBy, ConsoleTraceGroupListener\n} from '../types/trace'\n\n\n/**\n * Builds the console arguments from a trace event.\n * @param event The trace event to build console arguments from.\n * @returns An array containing the formatted trace label and the sanitized event data.\n */\nfunction buildConsoleArgsFromEvent(event: TraceEvent): ConsoleTraceEvent {\n const sanitizedEvent = Object.keys(event).reduce((acc, curr) => {\n if (curr !== 'level' && curr !== 'timestamp') {\n acc[curr] = event[curr as keyof ConsoleTraceEventArgs]\n }\n return acc\n }, {} as Record<string, unknown>)\n\n return [formatTraceLabel(event), sanitizedEvent as ConsoleTraceEventArgs]\n}\n\nfunction formatTraceLabel(event: TraceEvent): string {\n return event.scope\n ? `${event.label} [${event.scope}]`\n : `${event.label}`\n}\n\nfunction log(target: Console, event: TraceEvent): void {\n const consoleMethod = event.level === 'error' ? 'error' : 'log'\n target[consoleMethod](...buildConsoleArgsFromEvent(event))\n}\n\n/**\n * Creates a console trace group listener that groups trace events by the specified key.\n * @param groupBy The key of the trace event metadata to group by.\n * @returns A console trace group listener configured to group trace events by the specified key.\n */\nexport function createConsoleGroupTraceListener(groupBy: TraceListenerGroupBy = 'scope'): ConsoleTraceGroupListener {\n const target = new TraceConsole()\n const groups = new Map<string, ConsoleTraceEvent[]>()\n // Overlapping starts for the same key (e.g. concurrent async mutations of a store) share one group\n const openCounts = new Map<string, number>()\n\n\n function createGroup(key: string) {\n if (!groups.has(key)) {\n groups.set(key, [])\n }\n openCounts.set(key, (openCounts.get(key) ?? 0) + 1)\n }\n\n function logGroup(key: string): void {\n const group = groups.get(key)\n\n if (!group) {\n target.error(`No group found for key \"${key}\"`)\n return\n }\n\n const remaining = (openCounts.get(key) ?? 1) - 1\n if (remaining > 0) {\n openCounts.set(key, remaining)\n return\n }\n\n if (group.length) { target.logGroup(group) }\n groups.delete(key)\n openCounts.delete(key)\n }\n\n return {\n createGroup,\n logGroup,\n handler(event): void {\n const groupKey = (event?.payload?.groupId ?? event[groupBy]) as string\n if (!groups.has(groupKey)) {\n log(target, event)\n return\n }\n\n const group = groups.get(groupKey)\n if (group?.[0]?.[0] === formatTraceLabel(event)) { return }\n\n groups.get(groupKey)?.push(buildConsoleArgsFromEvent(event))\n }\n }\n}\n\n\n","import { createConsoleGroupTraceListener } from \"./console-trace-listener\"\nimport { pluginName, pluginSubscriptionNamespace } from \"../utils/constants\"\n\nimport type {\n TraceEventMetadata,\n TraceFilter,\n TraceFilterFactoryCriterion,\n TraceFilterFactoryParam,\n TraceGroupListener\n} from \"../types/trace\"\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 group listener with optional filtering.\n * @param listenerDef The listener definition or filter criteria for the trace group listener.\n * @param context Print the plugin context (subscribers, store, options, and traces) to the console.. Defaults to true.\n * @param filterMode The mode to apply when evaluating multiple filter criteria: 'every' or 'some'.\n * @param groupBy The key of the trace event metadata to group by.\n * @returns A trace listener configured with group handling and filtering.\n */\nexport function createTraceGroupListener(\n listenerDef: TraceFilterFactoryParam | TraceFilterFactoryCriterion[],\n context: boolean = true,\n filterMode: 'every' | 'some' = 'every',\n groupBy: keyof TraceEventMetadata = 'scope'\n) {\n return {\n groupBy,\n ...createConsoleGroupTraceListener(groupBy),\n ...createTraceFilter(listenerDef, context, filterMode)\n } as TraceGroupListener\n\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":["PluginSubscriber","pluginName","createInstanceFunction","__publicField","options","subscriptions","_context","store","createTracer","Store","TraceEmitter","ctx","getDefineAStoreSetupContext","setEnhancedStore","onAction","state","storeSubscribe","name","value","isRef","ref","toRef","subscription","optionName","propertyName","isEmpty","property","hasDeniedFirstChar","requiredKey","createPluginSubscriber","invoke","optionalProps","resolvePayload","payload","error","source","listeners","scope","label","namespace","resolved","level","metadata","matched","listener","event","error2","logStyle","args","bgColor","color","CustomConsole","message","icon","styleDefinition","getStyleDefinition","messageType","log$1","groupType","printArray","printablePayload","acc","item","errorColor","printError","stack","line","trace","printObject","log","isArray","consoleGroupArgs","consoleGroup","key","index","emptyKeys","typeOfValue","tracePayload","arg","printTracePayload","curr","logTrace","getPrintablePayload","printTrace","TraceConsole","pluginName2","groups","context","group","buildConsoleArgsFromEvent","sanitizedEvent","formatTraceLabel","target","consoleMethod","createConsoleGroupTraceListener","groupBy","openCounts","createGroup","logGroup","remaining","groupKey","createFilter","criteria","mode","comparator","isPluginSubscription","eventValue","result","listenerDef","filterMode","createTraceFilter","pluginSubscriptionNamespace","isProductionEnvironment","DEFAULT_REDACTED_VALUE","defaultRedactedKeys","MAX_DEPTH","createKeyMatcher","keys","exact","patterns","pattern","isTraversable","createRedactor","replacement","isSensitive","includeDefaults","seen","depth","cached","copy2","entry","redact","copy","redactedValue","noop","createTracerRegistry","enabled","redactor","addListener","listenerGroup","createTraceGroupListener","addScopesListener","scopes","clearTraceListeners","getMatchedListener","listenerGroupAction","actionName","groupLabel","Tracer","hasTraceListeners"],"mappings":";;;;;;AAyBA,MAA8BA,GAA8E;AAAA,EAqDxG,YAAIC,GAAcC,GAA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S,IAAA;AAAA,MAEA,SACIT,EAAA;AAAA,MAOR,OAAAA,EAAA;AAAA,MAQO,OAASA,EAAA;AAAA,MACZ,WAAQA,EAAA;AAAA,aAEFA,EAAA;AAAA,MAEN,UAAgB;AAAA,IACZ;AACI,aAAO,OAAA,CAAAW,MAAAA,EAAA,OAAAF,CAAA,CAAA;AAAA,EAAA;AAGX;AACA,WAAIN,EAAW,SAAW;AAAA,EACtB;AAAO,WACX6G,EAAAC,GAAAjH,GAAA;AAEA,IAAIG,EAAS,UACT4G,EAAO/G,CAAA,EAAA,QAAA,CAAAW,MAAA;AACX,YAAAuG,IAAAlH,EAAA,WAAAA,EAAAW,EAAA,OAAA;AAEA,MAAI,YAAsB,YACtBA,EAAMwF,CAAAA,EAAAA;IAEN,CAAA;AAAA,EACI;AAAwG,SAC3G;AAAA,IACD,aAAAM;AAAA,IACJ,mBAAAG;AAAA,IAEA,qBAAAE;AAAA,IACI,eAAMX;AAAAA,MACN,YAAS,CAAAnG,MAAWgH,EAAA,YAAAhH,CAAA;AAAA,MACpB,cAAc,CAAAE,GAAA/B,IAAc,CAAA,UAAWgJ,EAAOjH,MAAiB,EAAA,UAAAsG,GAAA,GAAArI,EAAA,CAAA;AAAA,MAC/D,mBAAAiJ;AAAA,MACJ,YAAA,CAAApH,MAAAgH,EAAA,eAAAhH,CAAA;AAAA,IAEA;AAAA,IACI,mBAAAoH;AAAA,EACA;AACA;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"pinia-plugin-subscription.js","sources":["../src/plugins/createPlugin.ts","../src/plugins/createHydrationPlugin.ts"],"sourcesContent":["import PluginSubscription from \"../core/PluginSubscription\"\n\nimport type { PiniaPlugin } from \"pinia\"\nimport type { PluginSubscriber, PluginSubscriptionOptions } from \"../types/plugin\"\nimport type { RollbackActionParams, StoreOptions } from \"../types/store\"\n\n/**\n * Creates a Pinia plugin that manages the specified plugin subscribers.\n *\n * @param subscribers The list of plugin subscribers to be used by the plugin.\n * @param options The options for configuring the plugin subscription.\n * @returns A Pinia plugin that handles the provided subscribers and options.\n */\nexport function createPlugin(\n subscribers: PluginSubscriber[],\n options?: PluginSubscriptionOptions\n): PiniaPlugin {\n const pluginSubscription = new PluginSubscription(subscribers, options)\n\n return pluginSubscription.plugin.bind(pluginSubscription)\n}\n\ndeclare module 'pinia' {\n export interface PiniaCustomProperties {\n /**\n * Executes an action and restores the previous state snapshot if it fails.\n * Added to every store when the plugin is active.\n *\n * @param params The action name and the state keys to snapshot.\n * @param args The action arguments, passed as a single array (forwarded via `apply`).\n */\n $rollbackAfterFailure: (params: RollbackActionParams, args?: any[]) => Promise<void>\n }\n\n export interface DefineStoreOptionsBase<S, Store> {\n storeOptions?: StoreOptions\n }\n}","import PluginSubscription from '../core/PluginSubscription'\n\nimport type { PiniaPlugin } from 'pinia'\nimport type { PluginSubscriber, PluginSubscriptionOptions } from '../types/plugin'\n\n/**\n * Creates a Pinia plugin that manages hydration for the specified plugin subscribers.\n * @param subscribers The list of plugin subscribers to be used by the hydration plugin.\n * @param options The options for configuring the plugin subscription.\n * @returns A Pinia plugin that handles hydration based on the provided subscribers and options.\n * @deprecated use `createPlugin` with appropriate hydration options instead.\n */\nexport function createHydrationPlugin(\n subscribers: PluginSubscriber[],\n options?: PluginSubscriptionOptions\n): PiniaPlugin {\n const hydrationPlugin = new PluginSubscription(subscribers, {\n execution: options?.execution,\n hydrationScheduler: options?.hydrationScheduler,\n runtimeEnvironment: options?.runtimeEnvironment,\n subscriberExecution: options?.subscriberExecution,\n })\n\n return hydrationPlugin.plugin.bind(hydrationPlugin)\n}\n"],"names":["createPlugin","subscribers","options","pluginSubscription","PluginSubscription","createHydrationPlugin","hydrationPlugin"],"mappings":";;AAaO,SAASA,EACZC,GACAC,GACW;AACX,QAAMC,IAAqB,IAAIC,EAAmBH,GAAaC,CAAO;AAEtE,SAAOC,EAAmB,OAAO,KAAKA,CAAkB;AAC5D;ACRO,SAASE,EACZJ,GACAC,GACW;AACX,QAAMI,IAAkB,IAAIF,EAAmBH,GAAa;AAAA,IACxD,WAAWC,GAAS;AAAA,IACpB,oBAAoBA,GAAS;AAAA,IAC7B,oBAAoBA,GAAS;AAAA,IAC7B,qBAAqBA,GAAS;AAAA,EAAA,CACjC;AAED,SAAOI,EAAgB,OAAO,KAAKA,CAAe;AACtD;"}
@@ -1,23 +0,0 @@
1
- import type { TraceGroupListener, TraceListener, TracePayload, TracerOptions } from '../types/trace';
2
- /**
3
- * Emits structured trace events.
4
- *
5
- * Nothing is allocated when no listener matches:
6
- * the payload is a factory resolved only once a consumer is known.
7
- */
8
- export default class Tracer {
9
- private readonly _listeners;
10
- private readonly _redactor?;
11
- private _scope?;
12
- private readonly _source;
13
- constructor(source: string, listeners: Array<TraceListener | TraceGroupListener>, options?: TracerOptions);
14
- get scope(): string | undefined;
15
- set scope(scope: string | undefined);
16
- get source(): string;
17
- debug(label: string, namespace: string, payload?: TracePayload, scope?: string): void;
18
- /** Relays the error to matching listeners, or reports it when none match. */
19
- error(label: string, namespace: string, error: unknown, payload?: TracePayload, scope?: string): void;
20
- private resolveAndRedact;
21
- private matchListeners;
22
- private emit;
23
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * Utility function to create console groups with different styles.
3
- * @param groupType The type of console group: 'collapsed', 'expanded', or 'none'.
4
- * @param args The arguments to be passed to the console group.
5
- * @returns void
6
- *
7
- */
8
- export declare function consoleGroup(groupType?: 'collapsed' | 'expanded' | 'none', ...args: any[]): void;
@@ -1,18 +0,0 @@
1
- import type { Console, LogType, StyleDefinition, StyleDefinitions } from '../../types/log';
2
- export declare abstract class CustomConsole implements Console {
3
- protected _bgColor: string;
4
- protected _color: string;
5
- protected _icon: string;
6
- protected _errorBgColor: string;
7
- protected _errorColor: string;
8
- protected _errorIcon: string;
9
- protected _pluginName?: string;
10
- protected _styles: StyleDefinitions;
11
- protected formatMessage(message: string, icon: string): string;
12
- protected generateStyle(styleDefinition: StyleDefinition): string;
13
- protected getStyleDefinition(messageType?: LogType): StyleDefinition;
14
- log(...args: any): void;
15
- error(...args: any): void;
16
- protected rebuildArgs(args: string | any[]): any[];
17
- protected useLog(styleDefinition: StyleDefinition, args: any): void;
18
- }
@@ -1,2 +0,0 @@
1
- export declare function log(logStyle: string, args: any): void;
2
- export declare const getStyleDefinition: (bgColor: string, color?: string) => string;
@@ -1,8 +0,0 @@
1
- /**
2
- * Logs trace events to the console with a specific style.
3
- * @param logStyle - The CSS style string for the log.
4
- * @param args - The arguments to log, with the first argument being the label.
5
- * @param pluginName - The name of the plugin generating the log.
6
- * @returns void
7
- */
8
- export declare function logTrace(logStyle: string, args: any, pluginName: string): void;
@@ -1,7 +0,0 @@
1
- /**
2
- * Prints an array to the console with a specific label and group type.
3
- * @param label The label to display for the array.
4
- * @param payload The array to print.
5
- * @param icon An optional icon to display alongside the label.
6
- */
7
- export declare function printArray(payload: any[], label?: string, icon?: string): void;
@@ -1,6 +0,0 @@
1
- export declare const errorColor = "#f86f63";
2
- /**
3
- * Prints an error to the console with a specific format.
4
- * @param payload The error object to print.
5
- */
6
- export declare function printError(payload: Error): void;
@@ -1 +0,0 @@
1
- export declare function printObject(label: string, payload: object, groupType?: 'collapsed' | 'expanded' | 'none', source?: string): void;
@@ -1 +0,0 @@
1
- export declare function printTracePayload(tracePayload: Record<string, unknown>): void;
@@ -1,9 +0,0 @@
1
- import type { TraceEvent } from '../../types/trace';
2
- /**
3
- * Prints a trace event to the console.
4
- * If the trace has a payload, it will be printed as an object.
5
- * Otherwise, it will print the trace label and source.
6
- * @param trace The trace event to print.
7
- * @returns void
8
- */
9
- export declare function printTrace(trace: TraceEvent): void;
@@ -1,9 +0,0 @@
1
- import { CustomConsole } from './console';
2
- import type { StyleDefinition } from '../../types/log';
3
- import type { ConsoleTraceEvent } from '../../types/trace';
4
- export declare class TraceConsole extends CustomConsole {
5
- protected _pluginName: string;
6
- constructor(pluginName?: string);
7
- logGroup(groups: ConsoleTraceEvent[]): void;
8
- protected useLog(styleDefinition: StyleDefinition, args: any): void;
9
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,12 +0,0 @@
1
- /**
2
- * Compile-only contract for the centralized store-options extension point.
3
- * Simulates a subscriber plugin augmenting the contract through interface
4
- * merging, instead of redeclaring pinia's `DefineStoreOptionsBase` (which
5
- * would raise TS2717 on type mismatch in consumer projects).
6
- */
7
- declare module '../types' {
8
- interface StoreOptionsExtensions {
9
- testExtension?: string;
10
- }
11
- }
12
- export {};
@@ -1,3 +0,0 @@
1
- export type ComparisonNumber = '>' | '<' | '>=' | '<=';
2
- export type ComparisonString = 'partial' | 'strict';
3
- export type Comparison = ComparisonNumber | ComparisonString;
@@ -1,13 +0,0 @@
1
- export type ListTypes = "0" | "1" | "2" | "3" | "4" | "5";
2
- export interface List {
3
- '@id'?: string | number;
4
- id?: number;
5
- name?: string;
6
- type?: ListTypes;
7
- }
8
- export type PartialList = Omit<List, '@id' | 'id' | 'name' | 'type'> & {
9
- id?: number;
10
- name?: string;
11
- type?: ListTypes;
12
- };
13
- export type ListTypesMap = Record<ListTypes, string>;
@@ -1,8 +0,0 @@
1
- export interface Console {
2
- log(...args: any): void;
3
- error(...args: any): void;
4
- }
5
- export type LogType = 'error' | 'info';
6
- export type StyleDefinition = Record<StyleDefinitionKeys, string>;
7
- export type StyleDefinitionKeys = 'bgColor' | 'color' | 'icon';
8
- export type StyleDefinitions = Record<LogType, Record<StyleDefinitionKeys, string>>;
@@ -1,4 +0,0 @@
1
- export interface ResourceId {
2
- "@id"?: string;
3
- id?: number;
4
- }
@@ -1,9 +0,0 @@
1
- export default class Performance {
2
- duration: number;
3
- endTime: number;
4
- name: string;
5
- startTime: number;
6
- constructor(name: string);
7
- getStyle(): string;
8
- stop(): void;
9
- }
@@ -1,7 +0,0 @@
1
- /**
2
- * Tells whether the host application is built for production.
3
- * The literal `process.env.NODE_ENV` expression is kept on purpose: consumer bundlers
4
- * (Vite, webpack, Nuxt...) replace it statically. Without a bundler `process` may be
5
- * undefined, in which case the environment is not considered production.
6
- */
7
- export declare function isProductionEnvironment(): boolean;
@@ -1,4 +0,0 @@
1
- import type { AnyObject } from "../types";
2
- import type { Comparison } from "../types/comparison";
3
- export declare function arrayObjectFindAllBy<T extends AnyObject>(arrayOfObject: T[], findBy: Partial<T>, comparison?: Comparison): T[];
4
- export declare function arrayObjectFindBy<T extends AnyObject>(arrayOfObject: T[], findBy: Partial<T>): T | undefined;