pinia-plugin-subscription 1.0.0-beta.7 → 1.0.0-beta.8
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 +1 -0
- package/dist/chunks/{PluginSubscription-DPu3ft-c.js → PluginSubscription-C_a6v8oi.js} +93 -77
- package/dist/chunks/PluginSubscription-C_a6v8oi.js.map +1 -0
- package/dist/helpers/index.d.ts +1 -0
- package/dist/helpers.js +308 -296
- package/dist/helpers.js.map +1 -1
- package/dist/pinia-plugin-subscription.js +2 -2
- package/dist/types/trace.d.ts +4 -0
- package/dist/utils/traceGroups.d.ts +7 -0
- package/docs/tracing.md +17 -0
- package/package.json +1 -1
- package/dist/chunks/PluginSubscription-DPu3ft-c.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
10
|
### Added
|
|
11
|
+
- `traceGroups` glossary, exported from `pinia-plugin-subscription/helpers`, building the `groupId` emitted by `PluginSubscription` (`onActionAfter`, `onActionError`, `onMutation`, `reset`); documented in `docs/tracing.md`
|
|
11
12
|
- `createPluginSubscriber(name, invoke, optionalProps?)` factory, exported from `pinia-plugin-subscription/helpers`, to build plain-object subscribers; documented in `docs/authoring-plugins.md` and used by the demo plugin
|
|
12
13
|
- Added a dedicated tracing guide, `docs/tracing.md`; the README now only presents tracing and links to it
|
|
13
14
|
- Moved the API reference, import subpaths, development, `Store` summary and testing sections from `README.md` to `docs/authoring-plugins.md`
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var a = (i, s, t) =>
|
|
4
|
-
import { toRaw as
|
|
5
|
-
import { defineStore as
|
|
1
|
+
var w = Object.defineProperty;
|
|
2
|
+
var H = (i, s, t) => s in i ? w(i, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[s] = t;
|
|
3
|
+
var a = (i, s, t) => H(i, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
+
import { toRaw as k } from "vue";
|
|
5
|
+
import { defineStore as E } from "pinia";
|
|
6
6
|
function u(i) {
|
|
7
7
|
if (typeof structuredClone == "function")
|
|
8
8
|
try {
|
|
@@ -28,31 +28,31 @@ function u(i) {
|
|
|
28
28
|
s[t] = u(e);
|
|
29
29
|
return s;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function R(i, s = "all") {
|
|
32
32
|
if (Array.isArray(s)) {
|
|
33
33
|
const t = {};
|
|
34
34
|
for (const e of s)
|
|
35
|
-
e in i && (t[e] = u(
|
|
35
|
+
e in i && (t[e] = u(k(i[e])));
|
|
36
36
|
return t;
|
|
37
37
|
}
|
|
38
38
|
if (s !== "all")
|
|
39
39
|
throw new Error(`Invalid keys parameter: ${s}`);
|
|
40
|
-
return u(
|
|
40
|
+
return u(k(i));
|
|
41
41
|
}
|
|
42
|
-
const
|
|
43
|
-
function
|
|
44
|
-
if (
|
|
42
|
+
const A = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new Map(), $ = /* @__PURE__ */ new WeakSet();
|
|
43
|
+
function x(i, s) {
|
|
44
|
+
if ($.has(i) || typeof i.$dispose != "function")
|
|
45
45
|
return;
|
|
46
46
|
const t = i.$dispose;
|
|
47
|
-
i.$dispose = (...e) => (
|
|
47
|
+
i.$dispose = (...e) => (A.delete(i), b.delete(s), t.apply(i, e)), $.add(i);
|
|
48
48
|
}
|
|
49
49
|
function N(i, s, t) {
|
|
50
50
|
const e = t ? { storeOptions: t } : {};
|
|
51
|
-
return typeof s == "function" ?
|
|
51
|
+
return typeof s == "function" ? g(
|
|
52
52
|
i,
|
|
53
53
|
s,
|
|
54
54
|
e
|
|
55
|
-
) :
|
|
55
|
+
) : v(
|
|
56
56
|
i,
|
|
57
57
|
s,
|
|
58
58
|
e
|
|
@@ -60,51 +60,51 @@ function N(i, s, t) {
|
|
|
60
60
|
}
|
|
61
61
|
function q(i, s, t) {
|
|
62
62
|
const e = t ? { storeOptions: { ...t, enhancedStore: !0 } } : { storeOptions: { enhancedStore: !0 } };
|
|
63
|
-
return
|
|
63
|
+
return g(
|
|
64
64
|
i,
|
|
65
65
|
s,
|
|
66
66
|
e
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function g(i, s, t) {
|
|
70
70
|
const e = {
|
|
71
71
|
id: i,
|
|
72
72
|
extensions: {}
|
|
73
|
-
}, r = t?.storeOptions?.enhancedStore === !0, n =
|
|
73
|
+
}, r = t?.storeOptions?.enhancedStore === !0, n = E(
|
|
74
74
|
i,
|
|
75
75
|
() => s(e),
|
|
76
76
|
t
|
|
77
77
|
);
|
|
78
78
|
return Object.assign(((...c) => {
|
|
79
|
-
r &&
|
|
79
|
+
r && b.set(i, e);
|
|
80
80
|
const o = n(...c);
|
|
81
|
-
return r && (
|
|
81
|
+
return r && (A.set(o, e), b.delete(i), x(o, i)), o;
|
|
82
82
|
}), n);
|
|
83
83
|
}
|
|
84
|
-
function
|
|
85
|
-
return t && (s = { ...s, ...t ?? {} }),
|
|
84
|
+
function v(i, s, t) {
|
|
85
|
+
return t && (s = { ...s, ...t ?? {} }), E(i, s);
|
|
86
86
|
}
|
|
87
|
-
const
|
|
88
|
-
function
|
|
89
|
-
return
|
|
87
|
+
const P = /* @__PURE__ */ new Set(["_", "$"]);
|
|
88
|
+
function T(i) {
|
|
89
|
+
return P.has(i[0]);
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function z(i) {
|
|
92
92
|
const s = i;
|
|
93
|
-
return
|
|
93
|
+
return A.get(i) ?? (typeof s?.$id == "string" ? b.get(s.$id) : void 0);
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function B(i) {
|
|
96
96
|
const s = i.extensions.enhancedStore ?? i.extensions.extending;
|
|
97
97
|
if (!s)
|
|
98
98
|
throw new Error(`${i.id}Store - getEnhancedStore - Error: enhanced store is required`);
|
|
99
99
|
return s;
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function J(i, s) {
|
|
102
102
|
i.extensions.enhancedStore = s, i.extensions.extending = s;
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function S(i, s) {
|
|
105
105
|
return `${i}-${s.$id}`;
|
|
106
106
|
}
|
|
107
|
-
class
|
|
107
|
+
class D {
|
|
108
108
|
constructor() {
|
|
109
109
|
a(this, "_stateSnapshots", /* @__PURE__ */ new Map());
|
|
110
110
|
a(this, "_storeHasRollbackSnapshots", /* @__PURE__ */ new Set());
|
|
@@ -113,7 +113,7 @@ class T {
|
|
|
113
113
|
addRollbackAction(s) {
|
|
114
114
|
typeof s.$rollbackAfterFailure != "function" && (s.$rollbackAfterFailure = async ({ action: t, stateKeys: e }, r = []) => {
|
|
115
115
|
const n = s[t];
|
|
116
|
-
if (typeof n != "function" ||
|
|
116
|
+
if (typeof n != "function" || T(t))
|
|
117
117
|
return;
|
|
118
118
|
const c = !e || e.length === 0 ? "all" : e, o = this.saveStateSnapshot(s, t, c);
|
|
119
119
|
try {
|
|
@@ -127,7 +127,7 @@ class T {
|
|
|
127
127
|
}
|
|
128
128
|
createOnActionCallbacks(s, t) {
|
|
129
129
|
const e = this._storeRollbackSnapshotsParams.get(
|
|
130
|
-
|
|
130
|
+
S(s, t)
|
|
131
131
|
);
|
|
132
132
|
if (!e)
|
|
133
133
|
return;
|
|
@@ -146,7 +146,7 @@ class T {
|
|
|
146
146
|
e && !this._storeHasRollbackSnapshots.has(t.$id) && (Object.keys(e).forEach((r) => {
|
|
147
147
|
const n = e[r];
|
|
148
148
|
n && this._storeRollbackSnapshotsParams.set(
|
|
149
|
-
|
|
149
|
+
S(r, t),
|
|
150
150
|
n
|
|
151
151
|
);
|
|
152
152
|
}), this._storeHasRollbackSnapshots.add(t.$id)), this.addRollbackAction(t);
|
|
@@ -172,7 +172,7 @@ class T {
|
|
|
172
172
|
s && this._stateSnapshots.delete(s);
|
|
173
173
|
}
|
|
174
174
|
saveStateSnapshot(s, t, e) {
|
|
175
|
-
const r =
|
|
175
|
+
const r = R(
|
|
176
176
|
s.$state,
|
|
177
177
|
e
|
|
178
178
|
), n = /* @__PURE__ */ Symbol(`${s.$id}:${t}`);
|
|
@@ -182,7 +182,7 @@ class T {
|
|
|
182
182
|
return this._storeHasRollbackSnapshots.has(s.$id);
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
|
-
class
|
|
185
|
+
class G {
|
|
186
186
|
constructor() {
|
|
187
187
|
a(this, "_tracer");
|
|
188
188
|
a(this, "_traceOptions", {
|
|
@@ -213,21 +213,26 @@ class D {
|
|
|
213
213
|
function O(i) {
|
|
214
214
|
return i ? Array.isArray(i) ? i.length === 0 : typeof i == "object" ? Object.keys(i).length === 0 : typeof i == "string" ? i.trim() === "" : !1 : !(typeof i == "boolean" || typeof i == "number");
|
|
215
215
|
}
|
|
216
|
-
const j = "pinia-plugin-subscription",
|
|
216
|
+
const j = "pinia-plugin-subscription", C = "PluginSubscription", Q = C.toLowerCase(), d = {
|
|
217
|
+
onActionAfter: (i) => `store:onAction:after:${i}`,
|
|
218
|
+
onActionError: (i) => `store:onAction:onError:${i}`,
|
|
219
|
+
onMutation: (i) => `store:onMutation:${i}`,
|
|
220
|
+
reset: (i) => `store:reset:${i}`
|
|
221
|
+
}, M = C, F = {
|
|
217
222
|
environment: "both",
|
|
218
223
|
hydration: "immediate"
|
|
219
224
|
};
|
|
220
|
-
function
|
|
225
|
+
function I(i) {
|
|
221
226
|
if (typeof window < "u" && typeof window.requestAnimationFrame == "function") {
|
|
222
227
|
window.requestAnimationFrame(() => globalThis.setTimeout(i, 0));
|
|
223
228
|
return;
|
|
224
229
|
}
|
|
225
230
|
globalThis.setTimeout(i, 0);
|
|
226
231
|
}
|
|
227
|
-
class
|
|
232
|
+
class U extends G {
|
|
228
233
|
constructor(t, e) {
|
|
229
234
|
super();
|
|
230
|
-
a(this, "_className",
|
|
235
|
+
a(this, "_className", M);
|
|
231
236
|
a(this, "_hydrationScheduler");
|
|
232
237
|
a(this, "_onActionSubscriptions", /* @__PURE__ */ new Map());
|
|
233
238
|
a(this, "_onActionStores", /* @__PURE__ */ new Set());
|
|
@@ -236,14 +241,14 @@ class Q extends D {
|
|
|
236
241
|
a(this, "_options");
|
|
237
242
|
a(this, "_resetStoreCallback", /* @__PURE__ */ new Map());
|
|
238
243
|
a(this, "_disposedStores", /* @__PURE__ */ new WeakSet());
|
|
239
|
-
a(this, "_storeRollbackSnapshotsHandler", new
|
|
244
|
+
a(this, "_storeRollbackSnapshotsHandler", new D());
|
|
240
245
|
a(this, "_subscribers", []);
|
|
241
246
|
a(this, "_subscribersDelivered", /* @__PURE__ */ new Set());
|
|
242
247
|
a(this, "_subscribersScheduled", /* @__PURE__ */ new Set());
|
|
243
248
|
a(this, "_subscriptions", []);
|
|
244
249
|
a(this, "_subscriptionsDelivered", /* @__PURE__ */ new Set());
|
|
245
250
|
a(this, "_subscriptionsScheduled", /* @__PURE__ */ new Set());
|
|
246
|
-
this._hydrationScheduler = e?.hydrationScheduler ??
|
|
251
|
+
this._hydrationScheduler = e?.hydrationScheduler ?? I, this._options = e, this._subscribers = t, this.initializeTracer();
|
|
247
252
|
}
|
|
248
253
|
set subscribers(t) {
|
|
249
254
|
this._subscribers = t;
|
|
@@ -253,11 +258,11 @@ class Q extends D {
|
|
|
253
258
|
return this._subscriptions;
|
|
254
259
|
}
|
|
255
260
|
addOnActionAfterCallback(t, e, r) {
|
|
256
|
-
const n =
|
|
261
|
+
const n = S(t, e);
|
|
257
262
|
this._onActionAfterSubscriptions[n] || (this._onActionAfterSubscriptions[n] = []), this._onActionAfterSubscriptions[n]?.push(r);
|
|
258
263
|
}
|
|
259
264
|
addOnActionOnErrorCallback(t, e, r) {
|
|
260
|
-
const n =
|
|
265
|
+
const n = S(t, e);
|
|
261
266
|
this._onActionOnErrorSubscriptions[n] || (this._onActionOnErrorSubscriptions[n] = []), this._onActionOnErrorSubscriptions[n]?.push(r);
|
|
262
267
|
}
|
|
263
268
|
addResetStoreCallback(t, e) {
|
|
@@ -330,55 +335,65 @@ class Q extends D {
|
|
|
330
335
|
return;
|
|
331
336
|
const e = this._onActionSubscriptions.get(t), r = this._storeRollbackSnapshotsHandler.storeHasRollbackSnapshots(t);
|
|
332
337
|
!e?.size && !r || (this._onActionStores.add(t), t.$onAction(({ after: n, args: c, name: o, onError: h }) => {
|
|
333
|
-
const l = this._onActionSubscriptions.get(t),
|
|
334
|
-
if (!
|
|
338
|
+
const l = this._onActionSubscriptions.get(t), p = l?.size;
|
|
339
|
+
if (!p)
|
|
335
340
|
return;
|
|
336
|
-
this.traceGroupStart(() => ({ args: c, callbacks:
|
|
341
|
+
this.traceGroupStart(() => ({ args: c, callbacks: p, name: o }), t.$id, "onAction");
|
|
337
342
|
let _ = !1;
|
|
338
343
|
const y = () => {
|
|
339
344
|
_ || (_ = !0, this.traceGroupEnd({}, t.$id));
|
|
340
345
|
};
|
|
341
346
|
try {
|
|
342
|
-
const
|
|
347
|
+
const f = S(o, t);
|
|
343
348
|
this._storeRollbackSnapshotsHandler.storeHasRollbackSnapshots(t) && this.createRollbackSnapshot(o, t), l.forEach((m) => m({
|
|
344
349
|
after: this.createOnActionAfterCallbackCollector(o, t),
|
|
345
350
|
args: c,
|
|
346
351
|
name: o,
|
|
347
352
|
onError: this.createOnActionOnErrorCallbackCollector(o, t)
|
|
348
|
-
})), y(), this.executeStoreOnActionAfterCallbacks(n,
|
|
349
|
-
} catch (
|
|
350
|
-
throw y(),
|
|
353
|
+
})), y(), this.executeStoreOnActionAfterCallbacks(n, f, t), this.executeStoreOnActionOnErrorCallbacks(h, f, t), this.clearOnActionCallbacksSubscriptions(f);
|
|
354
|
+
} catch (f) {
|
|
355
|
+
throw y(), f;
|
|
351
356
|
}
|
|
352
357
|
}));
|
|
353
358
|
}
|
|
354
359
|
executeStoreOnActionAfterCallbacks(t, e, r) {
|
|
355
360
|
const n = this._onActionAfterSubscriptions[e], c = n?.length;
|
|
356
361
|
c && t((o) => {
|
|
357
|
-
this.traceGroupStart(
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
362
|
+
this.traceGroupStart(
|
|
363
|
+
() => ({
|
|
364
|
+
callbacks: c,
|
|
365
|
+
groupId: d.onActionAfter(r.$id),
|
|
366
|
+
result: o
|
|
367
|
+
}),
|
|
368
|
+
r.$id,
|
|
369
|
+
"store:onAction:after"
|
|
370
|
+
), n.forEach((h) => {
|
|
361
371
|
try {
|
|
362
372
|
h(o);
|
|
363
373
|
} catch (l) {
|
|
364
|
-
this.traceError("
|
|
374
|
+
this.traceError("storeOnActionAfterCallbacks", l, r.$id);
|
|
365
375
|
}
|
|
366
|
-
}), this.traceGroupEnd(() => ({}), r.$id);
|
|
376
|
+
}), this.traceGroupEnd(() => ({ groupId: d.onActionAfter(r.$id) }), r.$id);
|
|
367
377
|
});
|
|
368
378
|
}
|
|
369
379
|
executeStoreOnActionOnErrorCallbacks(t, e, r) {
|
|
370
380
|
const n = this._onActionOnErrorSubscriptions[e];
|
|
371
381
|
n?.length && t((c) => {
|
|
372
|
-
this.traceGroupStart(
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
382
|
+
this.traceGroupStart(
|
|
383
|
+
() => ({
|
|
384
|
+
callbacks: n.length,
|
|
385
|
+
error: c,
|
|
386
|
+
groupId: d.onActionError(r.$id)
|
|
387
|
+
}),
|
|
388
|
+
r.$id,
|
|
389
|
+
"store:onAction:onError"
|
|
390
|
+
), n.forEach((o) => {
|
|
376
391
|
try {
|
|
377
392
|
o(c);
|
|
378
393
|
} catch (h) {
|
|
379
|
-
this.traceError("
|
|
394
|
+
this.traceError("store:onAction:onError:error", h, r.$id);
|
|
380
395
|
}
|
|
381
|
-
}), this.traceGroupEnd(() => ({}), r.$id);
|
|
396
|
+
}), this.traceGroupEnd(() => ({ groupId: d.onActionError(r.$id) }), r.$id);
|
|
382
397
|
});
|
|
383
398
|
}
|
|
384
399
|
executeSubscriber(t, e) {
|
|
@@ -457,11 +472,11 @@ class Q extends D {
|
|
|
457
472
|
rewriteResetStore({ store: t }, e) {
|
|
458
473
|
const r = u(e);
|
|
459
474
|
t.$reset = () => {
|
|
460
|
-
this.traceGroupStart(() => ({ initialState: r }), t.$id, "store:reset");
|
|
475
|
+
this.traceGroupStart(() => ({ initialState: r, groupId: d.reset(t.$id) }), t.$id, "store:reset");
|
|
461
476
|
try {
|
|
462
477
|
this.executeResetStoreCallbacks(t), t.$patch(u(r));
|
|
463
478
|
} finally {
|
|
464
|
-
this.traceGroupEnd(() => ({ initialState: r }), t.$id);
|
|
479
|
+
this.traceGroupEnd(() => ({ initialState: r, groupId: d.reset(t.$id) }), t.$id);
|
|
465
480
|
}
|
|
466
481
|
};
|
|
467
482
|
}
|
|
@@ -479,11 +494,11 @@ class Q extends D {
|
|
|
479
494
|
storeMutationSubscription(t) {
|
|
480
495
|
const { store: e, callback: r } = t();
|
|
481
496
|
e.$subscribe((n) => {
|
|
482
|
-
this.traceGroupStart(() => ({ mutation: n }), e.$id, "store:
|
|
497
|
+
this.traceGroupStart(() => ({ mutation: n, groupId: d.onMutation(e.$id) }), e.$id, "store:onMutation");
|
|
483
498
|
try {
|
|
484
499
|
r(n);
|
|
485
500
|
} finally {
|
|
486
|
-
this.traceGroupEnd({}, e.$id);
|
|
501
|
+
this.traceGroupEnd(() => ({ mutation: n, groupId: d.onMutation(e.$id) }), e.$id);
|
|
487
502
|
}
|
|
488
503
|
});
|
|
489
504
|
}
|
|
@@ -518,12 +533,12 @@ class Q extends D {
|
|
|
518
533
|
c.invoke(
|
|
519
534
|
{ store: t, options: { ...e, ...l } }
|
|
520
535
|
), this._subscriptionsDelivered.add(this.defineSubscriptionKey(r, t)), O(h) || h?.forEach(
|
|
521
|
-
(
|
|
522
|
-
store:
|
|
536
|
+
(p) => c.invoke({
|
|
537
|
+
store: p,
|
|
523
538
|
options: {
|
|
524
539
|
...e,
|
|
525
540
|
...l,
|
|
526
|
-
...
|
|
541
|
+
...p?.storeOptions ?? {}
|
|
527
542
|
}
|
|
528
543
|
})
|
|
529
544
|
);
|
|
@@ -545,16 +560,17 @@ class Q extends D {
|
|
|
545
560
|
}
|
|
546
561
|
}
|
|
547
562
|
export {
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
563
|
+
U as P,
|
|
564
|
+
G as T,
|
|
565
|
+
Q as a,
|
|
551
566
|
q as b,
|
|
552
|
-
|
|
567
|
+
B as c,
|
|
553
568
|
N as d,
|
|
554
|
-
|
|
555
|
-
|
|
569
|
+
z as g,
|
|
570
|
+
T as h,
|
|
556
571
|
O as i,
|
|
557
572
|
j as p,
|
|
558
|
-
|
|
573
|
+
J as s,
|
|
574
|
+
d as t
|
|
559
575
|
};
|
|
560
|
-
//# sourceMappingURL=PluginSubscription-
|
|
576
|
+
//# sourceMappingURL=PluginSubscription-C_a6v8oi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PluginSubscription-C_a6v8oi.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/utils/traceGroups.ts","../../src/utils/validation/index.ts","../../src/core/PluginSubscription.ts","../../src/utils/constants.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<AnyObject, TExtraExtensions>) => SS,\n options?: StoreOptions\n): SetupStoreDefinition<Id, SS>\n/**\n * Define a store with a setup context and explicit store/state types, e.g.\n * when plugins augment the store with members not returned by the setup function.\n * @template Sto The type of the store.\n * @template Sta The type of the store's state.\n * @template TExtraExtensions The type of the store's extra extensions.\n * @param id The unique identifier for the store.\n * @param storeDefinition The setup function defining the store.\n * @param options Optional store options.\n * @returns The defined store with setup context.\n */\nexport function defineAStoreCtx<Sto, Sta, TExtraExtensions extends Record<string, unknown> = EmptyExtensions>(\n id: string,\n storeDefinition: (ctx: DefineAStoreSetupContext<Sto & Sta, TExtraExtensions>) => AnyObject,\n options?: StoreOptions\n): DefineAStoreDefinition<Sto, Sta>\nexport function defineAStoreCtx(\n id: string,\n storeDefinition: DefineAStoreSetup<AnyObject, any>,\n options?: StoreOptions\n): StoreDefinition {\n const storeOptions: PluginStoreOptions = options\n ? { storeOptions: { ...options, enhancedStore: true } }\n : { storeOptions: { enhancedStore: true } } as PluginStoreOptions\n\n return defineAStoreSetup(\n id,\n storeDefinition,\n storeOptions\n ) as StoreDefinition\n}\n\nexport function defineAStoreSetup<Id extends string, SS>(\n id: Id,\n storeDefinition: DefineAStoreSetup<SS>,\n options: PluginStoreOptions\n): SetupStoreDefinition<Id, SS> {\n const setupContext: DefineAStoreSetupContext<SS> = {\n id,\n extensions: {}\n }\n\n const shouldStoreSetupContext = options?.storeOptions?.enhancedStore === true\n\n // `storeOptions` augments pinia's DefineStoreOptionsBase (see createPlugin.ts);\n // the assertion stays valid in compilation units where the augmentation is not loaded.\n const useStore = defineStore(\n id,\n () => storeDefinition(setupContext),\n options as unknown as DefineAStoreSetupOptions<Id, SS>\n )\n\n return Object.assign(((...args: Parameters<typeof useStore>) => {\n if (shouldStoreSetupContext) {\n defineAStoreSetupContextsById.set(id, setupContext as DefineAStoreSetupContext<AnyObject>)\n }\n\n const store = useStore(...args)\n\n if (shouldStoreSetupContext) {\n defineAStoreSetupContexts.set(store, setupContext as DefineAStoreSetupContext<AnyObject>)\n defineAStoreSetupContextsById.delete(id)\n registerSetupContextCleanupOnDispose(store as AnyObject, id)\n }\n\n return store\n }) as typeof useStore, useStore)\n}\n\nexport function defineAStoreOptionApi<Id extends string, S extends StateTree = {}, G extends _GettersTree<S> = {}, A = {}>(\n id: Id,\n storeDefinition: Omit<DefineStoreOptions<Id, S, G, A>, 'id'>,\n options?: PluginStoreOptions\n): StoreDefinition<Id, S, G, A> {\n if (options) {\n storeDefinition = { ...storeDefinition, ...(options ?? {}) }\n }\n\n return defineStore(id, storeDefinition)\n}\n\nconst deniedFirstChar = new Set<string>(['_', '$'])\n\n/**\n * Check if a property has a denied first character : ['_', '$'].\n * @param property The property name to check.\n * @returns True if the property has a denied first character, false otherwise.\n */\nexport function hasDeniedFirstChar(property: string): boolean {\n return deniedFirstChar.has(property[0] as string)\n}\n\n/**\n * Get the setup context associated with a store instance (or pending store id).\n * @param store The store instance, or an object exposing the store `$id`.\n * @returns The setup context when the store was defined with `enhancedStore` enabled, undefined otherwise.\n */\nexport function getDefineAStoreSetupContext(store: object): DefineAStoreSetupContext<AnyObject> | undefined {\n const storeRecord = store as AnyObject\n\n return defineAStoreSetupContexts.get(store)\n ?? (typeof storeRecord?.$id === 'string'\n ? defineAStoreSetupContextsById.get(storeRecord.$id)\n : undefined)\n}\n\n/**\n * Get the enhanced store from the context.\n * @template TEnhancedStore The type of the enhanced store.\n * @param ctx The context containing the extensions.\n * @returns The enhanced store casted to the specified types.\n */\nexport function getEnhancedStore<TEnhancedStore>(\n ctx: DefineAStoreSetupContext<TEnhancedStore>\n): TEnhancedStore {\n const enhancedStore = ctx.extensions.enhancedStore ?? ctx.extensions.extending\n\n if (!enhancedStore) {\n throw new Error(`${ctx.id}Store - getEnhancedStore - Error: enhanced store is required`)\n }\n\n return enhancedStore\n}\n\n/**\n * Set the enhanced store in context with deprecated alias support.\n * @template TEnhancedStore The type of the enhanced store.\n * @param ctx The context containing the extensions.\n * @param store The store to expose as enhancement.\n */\nexport function setEnhancedStore<TEnhancedStore>(\n ctx: DefineAStoreSetupContext<TEnhancedStore>,\n store: TEnhancedStore\n): void {\n ctx.extensions.enhancedStore = store\n ctx.extensions.extending = store\n}\n\n/**\n * @deprecated Use getEnhancedStore instead.\n */\nexport function getExtendingStore<TEnhancedStore>(\n ctx: DefineAStoreSetupContext<TEnhancedStore>\n): TEnhancedStore {\n console.warn(`${ctx.id}Store - getExtendingStore is deprecated. Use getEnhancedStore instead.`)\n return getEnhancedStore<TEnhancedStore>(ctx)\n}\n\n/**\n * Get the storage key for a given action and store combination.\n * @param actionName The name of the action.\n * @param store The Pinia store instance.\n * @returns The storage key for the action and store combination.\n */\nexport function getActionStoreKey(actionName: string, store: Store): string {\n return `${actionName}-${store.$id}`\n}","import { createStateSnapshot } from \"../factories/state-snapshot\"\nimport { getActionStoreKey, 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 ? '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 suffix = `-${store.$id}`\n\n for (const key of Array.from(this._storeRollbackSnapshotsParams.keys())) {\n if (key.endsWith(suffix)) {\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(`${store.$id}:`)) {\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(`${store.$id}:${actionName}`)\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 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","export function isEmpty(value: any): boolean {\n if (!value) {\n return (typeof value === 'boolean' || typeof value === 'number') ? false : true\n }\n\n if (Array.isArray(value)) {\n return value.length === 0\n }\n\n if (typeof value === 'object') {\n return Object.keys(value).length === 0\n }\n\n if (typeof value === 'string') {\n return value.trim() === ''\n }\n\n return false\n}","import RollbackStateSnapshotsHandler from \"./RollbackStateSnapshotsHandler\"\nimport { deepClone } from '../utils/deep-clone'\nimport { getActionStoreKey } 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 StoreOnActionAfterCallbackParameter,\n StoreOnActionSubscriptionCallback\n} from \"../types/plugin\"\n\n\nconst className = pluginSubscriptionClassName\nconst defaultPluginExecution: Required<PluginExecutionOptions> = {\n environment: 'both',\n hydration: 'immediate'\n}\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 _onActionStores: Set<Store> = new Set()\n private _onActionAfterSubscriptions: Record<string, StoreOnActionAfterCallbackParameter[]> = {}\n private _onActionOnErrorSubscriptions: Record<string, Array<(error: unknown) => void>> = {}\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._resetStoreCallback.delete(store)\n const suffix = `-${store.$id}`\n\n for (const key of Array.from(this._subscribersDelivered)) {\n if (key.endsWith(suffix)) {\n this._subscribersDelivered.delete(key)\n }\n }\n\n for (const key of Array.from(this._subscribersScheduled)) {\n if (key.endsWith(suffix)) {\n this._subscribersScheduled.delete(key)\n }\n }\n\n for (const key of Array.from(this._subscriptionsDelivered)) {\n if (key.endsWith(suffix)) {\n this._subscriptionsDelivered.delete(key)\n }\n }\n\n for (const key of Array.from(this._subscriptionsScheduled)) {\n if (key.endsWith(suffix)) {\n this._subscriptionsScheduled.delete(key)\n }\n }\n\n for (const key of Object.keys(this._onActionAfterSubscriptions)) {\n if (key.endsWith(suffix)) {\n delete this._onActionAfterSubscriptions[key]\n }\n }\n\n for (const key of Object.keys(this._onActionOnErrorSubscriptions)) {\n if (key.endsWith(suffix)) {\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 `${subscriber.name}-${store.$id}`\n }\n\n private defineSubscriptionKey(pluginName: string, store: Store): string {\n return `${pluginName}-${store.$id}`\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 const callbacksLength = callbacks?.size\n if (!callbacksLength) {\n return\n }\n\n this.traceGroupStart(() => ({ args, callbacks: callbacksLength, name }), store.$id, 'onAction')\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.forEach(callback => callback({\n after: this.createOnActionAfterCallbackCollector(name, store),\n args,\n name,\n onError: this.createOnActionOnErrorCallbackCollector(name, store)\n }))\n closeGroup()\n this.executeStoreOnActionAfterCallbacks(after, storageKey, store)\n this.executeStoreOnActionOnErrorCallbacks(onError, storageKey, store)\n this.clearOnActionCallbacksSubscriptions(storageKey)\n } catch (error) {\n closeGroup()\n throw error\n }\n })\n }\n\n private executeStoreOnActionAfterCallbacks(\n after: (callback: (result: any) => void) => void,\n storageKey: string,\n store: Store\n ) {\n const afterCallbacks = this._onActionAfterSubscriptions[storageKey]\n const afterCallbacksLength = afterCallbacks?.length\n\n if (afterCallbacksLength) {\n after((result) => {\n this.traceGroupStart(\n () => ({\n callbacks: afterCallbacksLength,\n groupId: traceGroups.onActionAfter(store.$id),\n result\n }),\n store.$id,\n 'store:onAction:after'\n )\n\n afterCallbacks.forEach(callback => {\n try {\n callback(result)\n } catch (error) {\n this.traceError('storeOnActionAfterCallbacks', error, store.$id)\n }\n })\n\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 ) {\n const onErrorCallbacks = this._onActionOnErrorSubscriptions[storageKey]\n\n if (onErrorCallbacks?.length) {\n onError((error) => {\n this.traceGroupStart(() => ({\n callbacks: onErrorCallbacks.length,\n error,\n groupId: traceGroups.onActionError(store.$id)\n }), store.$id,\n 'store:onAction:onError'\n )\n\n onErrorCallbacks.forEach(callback => {\n try {\n callback(error)\n } catch (err) {\n this.traceError('store:onAction:onError:error', err, store.$id)\n }\n })\n\n this.traceGroupEnd(() => ({ groupId: traceGroups.onActionError(store.$id) }), store.$id)\n })\n }\n }\n\n private executeSubscriber(context: PiniaPluginContext, subscriber: PluginSubscriber): void {\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 = () => {\n try {\n const afterHydration = subscriber.afterHydration?.(context)\n if (afterHydration && typeof (afterHydration as Promise<void>).then === 'function') {\n ; (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 if (hydrateResult && typeof (hydrateResult as Promise<void>).then === 'function') {\n ; (hydrateResult as Promise<void>)\n .then(() => runAfterHydration())\n .catch(error => this.traceError('subscriber:hydrate', error, context.store.$id))\n } else {\n runAfterHydration()\n }\n\n if (subscriber.subscriptions) {\n this.subscriptionDelivery(context, subscriber.subscriptions)\n }\n\n if (subscriber.storeMutationSubscription) {\n this.storeMutationSubscription(subscriber.storeMutationSubscription)\n }\n\n this.storeOnActionSubscription(subscriber)\n\n if (subscriber.resetStoreCallback) {\n this.addResetStoreCallback(context.store, subscriber.resetStoreCallback)\n }\n }\n\n private executeSubscriberSafely(context: PiniaPluginContext, subscriber: PluginSubscriber): void {\n try {\n 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 this.traceGroupStart(() => ({\n environment: this.defineCurrentEnvironment(),\n subscribers: this._subscribers,\n store,\n options\n }), store.$id)\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 this.executeSubscriberSafely(context, subscriber)\n })\n }\n\n private registerStoreCleanup(store: Store): void {\n if (typeof store.$dispose !== 'function') {\n return\n }\n\n const dispose = store.$dispose.bind(store)\n const scopedStore = store as AnyObject\n\n if (scopedStore.__piniaPluginSubscriptionDisposed) {\n return\n }\n\n scopedStore.__piniaPluginSubscriptionDisposed = true\n store.$dispose = () => {\n this._disposedStores.add(store)\n this.clearStoreTracking(store)\n this._storeRollbackSnapshotsHandler.clearStoreTracking(store)\n return dispose()\n }\n }\n\n private rewriteResetStore({ store }: PiniaPluginContext, initState: StateTree): void {\n const safeState = deepClone(initState)\n\n store.$reset = () => {\n 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): void {\n const { store, callback } = subscriber?.storeOnActionSubscription?.() ?? {}\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.executeStoreOnActionSubscription(store)\n }\n\n private storeMutationSubscription(subscription: StoreMutationSubscription): void {\n const { store, callback } = subscription()\n\n store.$subscribe((mutation: SubscriptionCallbackMutation<StateTree>) => {\n this.traceGroupStart(() => ({ mutation, groupId: traceGroups.onMutation(store.$id) }), store.$id, 'store:onMutation')\n try {\n callback(mutation)\n } finally {\n this.traceGroupEnd(() => ({ mutation, groupId: traceGroups.onMutation(store.$id) }), store.$id)\n }\n })\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 if (this._options?.tracerHandler) {\n this._options.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 if (this._options?.tracerHandler) {\n payload = (typeof payload === 'function' ? payload() : (payload ?? {}));\n this._options.tracerHandler.startGroup({\n ...payload,\n scope\n } as TraceEvent)\n this.trace(label ?? 'context', scope, payload)\n }\n }\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()"],"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","RollbackStateSnapshotsHandler","__publicField","action","stateKeys","actionFn","snapshotKey","error","rollbackSnapshotParams","suffix","stateSnapshot","TraceEmitter","payload","namespace","tracer","label","scope","isEmpty","pluginName","pluginSubscriptionClassName","pluginSubscriptionNamespace","traceGroups","storeId","className","defaultPluginExecution","defaultHydrationScheduler","callback","PluginSubscription","subscribers","storageKey","after","onError","subscriber","pluginName2","onActionSubscriptions","hasRollbackSnapshots","name","callbacks","callbacksLength","groupClosed","closeGroup","afterCallbacks","afterCallbacksLength","result","onErrorCallbacks","err","context","subscriberKey","hydrateResult","runAfterHydration","afterHydration","e","execution","scheduler","dispose","scopedStore","initState","safeState","currentEnvironment","subscription","mutation","pluginSubscriptions","pluginSubscription","subscriptionKey","subscriptionOptions","stores","pluginOptions","store2"],"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,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AC5B;AAAA,QACT,CAAA;AAAA,MACA;AAAA,IAEJ,SAAAhB,GAAA;AAEQ,WAAA,WAAA,yBAAyEA,GAAA5E,EAAA,GAAA;AAAA,IAC7E;AAAA,EAEA;AAAA,EACI,cAAKqC,GAAAI,GAAgB;AACrB,IAAA,KAAI,UAAA,iBACA,KAAA,SAAS,cAAQ,WAAA;AAAA,MACrB,GAAA,OAAEJ,KAAA,aAAAA,EAAA,IAAAA,KAAA,CAAA;AAAA,MACE,OAAAI;AAAA,IACJ,CAAA;AAAA,EAER;AAAA,EAEQ,gBAAAJ,GACJI;AAGA,IAAA,KAAO,4BACHJ,IAAM,OAAAA,KAAuB,aAAAA,EAAA,IAAsBM,KAAY,CAAA,GAC/D,KAAA,SAAM;SAGFN;AAAA,MAGA,OAAAI;AAAA,IACJ,CAAA,GAEA,KAAK,sBAAwBA,GAASJ,CAAG;AAAA,EACrC;AAGJ;"}
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -7,4 +7,5 @@ export { getDefineAStoreSetupContext, setEnhancedStore } from "../utils/store";
|
|
|
7
7
|
export { createTracerRegistry } from "../factories/trace-registry";
|
|
8
8
|
export { default as Tracer } from "../system/Tracer";
|
|
9
9
|
export { createConsoleGroupTraceListener } from "../factories/console-trace-listener";
|
|
10
|
+
export { traceGroups } from '../utils/traceGroups';
|
|
10
11
|
export { defaultRedactedKeys } from '../utils/redact';
|