pinia-plugin-subscription 1.0.0-beta.13 → 1.0.0-beta.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -12
- package/CONTRIBUTING.md +10 -1
- package/README.md +11 -9
- package/SECURITY.md +2 -2
- package/dist/chunks/{PluginSubscription-Bkqj4uSK.js → PluginSubscription-GJDsym1O.js} +253 -247
- package/dist/core/PluginSubscriber.d.ts +1 -1
- package/dist/core/PluginSubscription.d.ts +13 -12
- package/dist/core/Store.d.ts +1 -1
- package/dist/helpers/index.d.ts +0 -4
- package/dist/helpers.js +56 -651
- package/dist/pinia-plugin-subscription.js +4 -5
- package/dist/system/TraceEmitter.d.ts +1 -2
- package/dist/types/index.d.ts +1 -2
- package/dist/types/plugin.d.ts +2 -3
- package/dist/types/trace.d.ts +30 -109
- package/dist/utils/traceGroups.d.ts +9 -7
- package/docs/authoring-plugins.md +13 -7
- package/docs/using-plugins.md +28 -19
- package/package.json +9 -4
- package/dist/chunks/PluginSubscription-Bkqj4uSK.js.map +0 -1
- package/dist/factories/console-trace-listener.d.ts +0 -7
- package/dist/factories/trace-listener.d.ts +0 -10
- package/dist/factories/trace-registry.d.ts +0 -2
- package/dist/helpers.js.map +0 -1
- package/dist/pinia-plugin-subscription.js.map +0 -1
- package/dist/system/Tracer.d.ts +0 -23
- package/dist/system/log/console-group.d.ts +0 -8
- package/dist/system/log/console.d.ts +0 -18
- package/dist/system/log/index.d.ts +0 -2
- package/dist/system/log/log-trace.d.ts +0 -8
- package/dist/system/log/print-array.d.ts +0 -7
- package/dist/system/log/print-error.d.ts +0 -6
- package/dist/system/log/print-object.d.ts +0 -1
- package/dist/system/log/print-trace-payload.d.ts +0 -1
- package/dist/system/log/print-trace.d.ts +0 -9
- package/dist/system/log/trace-console.d.ts +0 -9
- package/dist/tests/defineAStore.test-d.d.ts +0 -1
- package/dist/tests/storeOptionsExtensions.test-d.d.ts +0 -12
- package/dist/types/comparison.d.ts +0 -3
- package/dist/types/list.d.ts +0 -13
- package/dist/types/log.d.ts +0 -8
- package/dist/types/resourceId.d.ts +0 -4
- package/dist/utils/Performance.d.ts +0 -9
- package/dist/utils/environment.d.ts +0 -7
- package/dist/utils/object.d.ts +0 -4
- package/dist/utils/redact.d.ts +0 -15
- package/docs/tracing.md +0 -185
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Store from "./Store";
|
|
2
2
|
import type { PiniaPluginContext, Store as PiniaStore } from "pinia";
|
|
3
3
|
import type { PluginExecutionOptions, PluginHydrationScheduler, PluginSubscriber as PluginSubscriberInterface, PluginSubscriptions, StoreClassConstructorParams, StoreMutationSubscription, StoreOnActionSubscription } from "../types/plugin";
|
|
4
|
-
import type Tracer from "../
|
|
4
|
+
import type { Tracer } from "../types/trace";
|
|
5
5
|
type CreateInstance<Instance = Store> = (store: PiniaStore, options: StoreClassConstructorParams) => Instance | undefined;
|
|
6
6
|
/**
|
|
7
7
|
* Type definition for the function used to create an instance of a store.
|
|
@@ -6,6 +6,7 @@ export default class PluginSubscription extends TraceEmitter {
|
|
|
6
6
|
private _hydrationScheduler;
|
|
7
7
|
private _onActionSubscriptions;
|
|
8
8
|
private _onActionSubscriptionsTraces;
|
|
9
|
+
private _actionSeq;
|
|
9
10
|
private _onActionStores;
|
|
10
11
|
private _onActionAfterSubscriptions;
|
|
11
12
|
private _onActionOnErrorSubscriptions;
|
|
@@ -30,6 +31,11 @@ export default class PluginSubscription extends TraceEmitter {
|
|
|
30
31
|
private addResetStoreCallback;
|
|
31
32
|
private clearOnActionCallbacksSubscriptions;
|
|
32
33
|
private clearStoreTracking;
|
|
34
|
+
/**
|
|
35
|
+
* Closes a trace group once `pending` settles, or after the configured timeout so a promise
|
|
36
|
+
* that never settles cannot keep buffering the traces of the store scope.
|
|
37
|
+
*/
|
|
38
|
+
private closeGroupWhenSettled;
|
|
33
39
|
/**
|
|
34
40
|
* Creates a callback collector for the specified action and store.
|
|
35
41
|
* @param actionName The name of the action to collect callbacks for.
|
|
@@ -56,6 +62,8 @@ export default class PluginSubscription extends TraceEmitter {
|
|
|
56
62
|
private defineHydrationScheduler;
|
|
57
63
|
private defineSubscriberKey;
|
|
58
64
|
private defineSubscriptionKey;
|
|
65
|
+
/** Closes a trace group once all async callbacks are settled (immediately if none is pending). */
|
|
66
|
+
private endGroupAfter;
|
|
59
67
|
private executeResetStoreCallbacks;
|
|
60
68
|
/**
|
|
61
69
|
* Executes the store's onAction subscription for the given plugin subscriber.
|
|
@@ -64,13 +72,6 @@ export default class PluginSubscription extends TraceEmitter {
|
|
|
64
72
|
* @returns void
|
|
65
73
|
*/
|
|
66
74
|
private executeStoreOnActionSubscription;
|
|
67
|
-
/**
|
|
68
|
-
* Runs a callback, tracing sync errors and async rejections.
|
|
69
|
-
* @returns a never-rejecting promise when the callback is asynchronous, undefined otherwise.
|
|
70
|
-
*/
|
|
71
|
-
private runCallbackSafely;
|
|
72
|
-
/** Closes a trace group once all async callbacks are settled (immediately if none is pending). */
|
|
73
|
-
private endGroupAfter;
|
|
74
75
|
private executeStoreOnActionAfterCallbacks;
|
|
75
76
|
private executeStoreOnActionOnErrorCallbacks;
|
|
76
77
|
/**
|
|
@@ -88,13 +89,13 @@ export default class PluginSubscription extends TraceEmitter {
|
|
|
88
89
|
*/
|
|
89
90
|
plugin({ store, options }: PiniaPluginContext): void;
|
|
90
91
|
private queueSubscriberExecution;
|
|
91
|
-
/**
|
|
92
|
-
* Closes a trace group once `pending` settles, or after the configured timeout so a promise
|
|
93
|
-
* that never settles cannot keep buffering the traces of the store scope.
|
|
94
|
-
*/
|
|
95
|
-
private closeGroupWhenSettled;
|
|
96
92
|
private registerStoreCleanup;
|
|
97
93
|
private rewriteResetStore;
|
|
94
|
+
/**
|
|
95
|
+
* Runs a callback, tracing sync errors and async rejections.
|
|
96
|
+
* @returns a never-rejecting promise when the callback is asynchronous, undefined otherwise.
|
|
97
|
+
*/
|
|
98
|
+
private runCallbackSafely;
|
|
98
99
|
private shouldInvokePlugin;
|
|
99
100
|
private shouldScheduleAfterHydration;
|
|
100
101
|
private storeOnActionSubscription;
|
package/dist/core/Store.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Tracer from "../system/Tracer";
|
|
2
1
|
import TraceEmitter from "../system/TraceEmitter";
|
|
2
|
+
import type { Tracer } from "../types/trace";
|
|
3
3
|
import type { PluginSubscriptions, StoreClassConstructorParams, StoreMutationSubscription, StoreMutationSubscriptionCallback, StoreOnActionSubscription, StoreOnActionSubscriptionCallback } from "../types/plugin";
|
|
4
4
|
import type { Store as PiniaStore, StateTree } from "pinia";
|
|
5
5
|
import type { AnyObject, PluginSubscriberInterface } from "../types";
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -4,8 +4,4 @@ export { default as Store } from '../core/Store';
|
|
|
4
4
|
export { isEmpty } from '../utils/validation';
|
|
5
5
|
export { createPluginSubscriber } from '../factories/plugin-subscriber';
|
|
6
6
|
export { getDefineAStoreSetupContext, setEnhancedStore } from "../utils/store";
|
|
7
|
-
export { createTracerRegistry } from "../factories/trace-registry";
|
|
8
|
-
export { default as Tracer } from "../system/Tracer";
|
|
9
|
-
export { createConsoleGroupTraceListener } from "../factories/console-trace-listener";
|
|
10
7
|
export { traceGroups } from '../utils/traceGroups';
|
|
11
|
-
export { defaultRedactedKeys } from '../utils/redact';
|