pinia-plugin-subscription 1.0.0-beta.10 → 1.0.0-beta.11
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/helpers.js +256 -236
- package/dist/helpers.js.map +1 -1
- package/dist/system/log.d.ts +1 -1
- package/docs/tracing.md +2 -0
- package/package.json +1 -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
|
### Changed
|
|
11
|
+
- Console trace groups now prefer `payload.groupId` over the configured `groupBy` key; events sharing a key across overlapping groups are buffered until all those groups close, while events without an open group are printed immediately. See `docs/tracing.md`
|
|
11
12
|
- `storeMutationSubscription` now supports several subscribers per store, like `storeOnActionSubscription`: a single `$subscribe` is registered per store and dispatches to every callback. A failing callback is reported through `traceError` without blocking the others, subscriber names are tracked, and the hook is unsubscribed when the store is disposed
|
|
12
13
|
- `storeOnActionSubscription` now receives the Pinia plugin context; action trace labels include the invoked action name
|
|
13
14
|
|
package/dist/helpers.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var u = (
|
|
4
|
-
import { T as
|
|
1
|
+
var $ = Object.defineProperty;
|
|
2
|
+
var O = (s, e, t) => e in s ? $(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var u = (s, e, t) => O(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { T as C, g as w, s as T, i as j, h as I, p as S, a as z } from "./chunks/PluginSubscription-BbN48iuP.js";
|
|
5
5
|
import { P as fe, t as he } from "./chunks/PluginSubscription-BbN48iuP.js";
|
|
6
|
-
import { isRef as
|
|
6
|
+
import { isRef as b, ref as L, toRef as k } from "vue";
|
|
7
7
|
class ce {
|
|
8
8
|
constructor(e, t) {
|
|
9
9
|
u(this, "_createInstance");
|
|
@@ -50,16 +50,16 @@ class ce {
|
|
|
50
50
|
}
|
|
51
51
|
hydrate(e) {
|
|
52
52
|
}
|
|
53
|
-
invoke({ store: e, options: t },
|
|
53
|
+
invoke({ store: e, options: t }, r) {
|
|
54
54
|
return this._storeInstance = this._createInstance(e, {
|
|
55
55
|
...t,
|
|
56
56
|
...this.pluginOptions,
|
|
57
|
-
createTracer:
|
|
57
|
+
createTracer: r ? () => r?.(this.name) : void 0
|
|
58
58
|
}), this._storeInstance ? (this._subscriptions = this._storeInstance.getSubscriptions(), this._storeMutationSubscription = this._storeInstance.storeSubscribe, this._storeOnActionSubscription = this._storeInstance.onAction, this.pluginCreated && this.pluginCreated(e), !0) : !1;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
class P extends
|
|
62
|
-
constructor(t,
|
|
61
|
+
class P extends C {
|
|
62
|
+
constructor(t, r) {
|
|
63
63
|
super();
|
|
64
64
|
u(this, "_className", "Store");
|
|
65
65
|
u(this, "_createTracer");
|
|
@@ -68,8 +68,8 @@ class P extends O {
|
|
|
68
68
|
u(this, "_store");
|
|
69
69
|
u(this, "_storeSubscribe");
|
|
70
70
|
u(this, "_subscriptions", {});
|
|
71
|
-
if (this._options =
|
|
72
|
-
const o =
|
|
71
|
+
if (this._options = r.storeOptions, this._store = t, this.initializeTracer(r), this.trace("instance:created", t.$id), this._options?.enhancedStore) {
|
|
72
|
+
const o = w(this.store);
|
|
73
73
|
o && (T(o, this.store), this.trace("setup:enhancedStore:success", this.store.$id));
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -108,17 +108,17 @@ class P extends O {
|
|
|
108
108
|
get tracer() {
|
|
109
109
|
return !this._tracer && this._createTracer && (this._tracer = this._createTracer(), this._tracer.scope = this.store.$id), this._tracer;
|
|
110
110
|
}
|
|
111
|
-
addToState(t,
|
|
112
|
-
this.isOptionApi() ||
|
|
111
|
+
addToState(t, r) {
|
|
112
|
+
this.isOptionApi() || b(r) || (r = L(r)), this.state[t] = r, this.store[t] = k(this.state, t);
|
|
113
113
|
}
|
|
114
|
-
addSubscription(t,
|
|
115
|
-
this._subscriptions[t] = { subscription:
|
|
114
|
+
addSubscription(t, r, o) {
|
|
115
|
+
this._subscriptions[t] = { subscription: r, ...o ?? {} };
|
|
116
116
|
}
|
|
117
117
|
afterHydration() {
|
|
118
118
|
}
|
|
119
|
-
static customizeStore(t,
|
|
120
|
-
if (
|
|
121
|
-
return new this(t,
|
|
119
|
+
static customizeStore(t, r) {
|
|
120
|
+
if (r.storeOptions && this.hasRequiredKeys(r.storeOptions))
|
|
121
|
+
return new this(t, r);
|
|
122
122
|
}
|
|
123
123
|
getOption(t) {
|
|
124
124
|
return this.options && this.options[t];
|
|
@@ -127,17 +127,17 @@ class P extends O {
|
|
|
127
127
|
return this.getValue(this.state[t]);
|
|
128
128
|
}
|
|
129
129
|
getSubscriptions() {
|
|
130
|
-
if (!
|
|
130
|
+
if (!j(this._subscriptions))
|
|
131
131
|
return this._subscriptions;
|
|
132
132
|
}
|
|
133
133
|
getValue(t) {
|
|
134
134
|
return t?.__v_isRef ? t.value : t;
|
|
135
135
|
}
|
|
136
136
|
hasDeniedFirstChar(t) {
|
|
137
|
-
return
|
|
137
|
+
return I(t);
|
|
138
138
|
}
|
|
139
139
|
static hasRequiredKeys(t) {
|
|
140
|
-
return this._requiredKeys !== void 0 && this._requiredKeys?.every((
|
|
140
|
+
return this._requiredKeys !== void 0 && this._requiredKeys?.every((r) => !!t[r]);
|
|
141
141
|
}
|
|
142
142
|
hydrate() {
|
|
143
143
|
}
|
|
@@ -155,29 +155,29 @@ class P extends O {
|
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
u(P, "_requiredKeys");
|
|
158
|
-
function ae(
|
|
158
|
+
function ae(s, e, t) {
|
|
159
159
|
return {
|
|
160
|
-
name:
|
|
160
|
+
name: s,
|
|
161
161
|
invoke: e,
|
|
162
162
|
...t
|
|
163
163
|
};
|
|
164
164
|
}
|
|
165
|
-
function M(
|
|
166
|
-
if (typeof
|
|
167
|
-
return
|
|
165
|
+
function M(s) {
|
|
166
|
+
if (typeof s != "function")
|
|
167
|
+
return s;
|
|
168
168
|
try {
|
|
169
|
-
return
|
|
169
|
+
return s();
|
|
170
170
|
} catch (e) {
|
|
171
171
|
return { __tracePayloadError: e };
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
class R {
|
|
175
|
-
constructor(e, t,
|
|
175
|
+
constructor(e, t, r = {}) {
|
|
176
176
|
u(this, "_listeners", []);
|
|
177
177
|
u(this, "_redactor");
|
|
178
178
|
u(this, "_scope");
|
|
179
179
|
u(this, "_source");
|
|
180
|
-
this._redactor =
|
|
180
|
+
this._redactor = r.redactor, this._scope = r.scope, this._source = e, this._listeners = t;
|
|
181
181
|
}
|
|
182
182
|
get scope() {
|
|
183
183
|
return this._scope;
|
|
@@ -188,11 +188,11 @@ class R {
|
|
|
188
188
|
get source() {
|
|
189
189
|
return this._source;
|
|
190
190
|
}
|
|
191
|
-
debug(e, t,
|
|
192
|
-
this.emit("debug", e, t,
|
|
191
|
+
debug(e, t, r, o) {
|
|
192
|
+
this.emit("debug", e, t, r, o);
|
|
193
193
|
}
|
|
194
|
-
error(e, t,
|
|
195
|
-
this.emit("error", e, t, o,
|
|
194
|
+
error(e, t, r, o, l) {
|
|
195
|
+
this.emit("error", e, t, o, l, r);
|
|
196
196
|
}
|
|
197
197
|
resolveAndRedact(e) {
|
|
198
198
|
const t = M(e);
|
|
@@ -200,143 +200,158 @@ class R {
|
|
|
200
200
|
return t;
|
|
201
201
|
try {
|
|
202
202
|
return this._redactor(t);
|
|
203
|
-
} catch (
|
|
204
|
-
return { __traceRedactionError:
|
|
203
|
+
} catch (r) {
|
|
204
|
+
return { __traceRedactionError: r instanceof Error ? r.message : String(r) };
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
matchListeners(e, t,
|
|
208
|
-
const
|
|
207
|
+
matchListeners(e, t, r, o) {
|
|
208
|
+
const l = {
|
|
209
209
|
label: t,
|
|
210
210
|
level: e,
|
|
211
|
-
namespace:
|
|
211
|
+
namespace: r,
|
|
212
212
|
scope: o ?? this._scope,
|
|
213
213
|
source: this._source
|
|
214
|
-
},
|
|
215
|
-
for (const
|
|
214
|
+
}, n = [];
|
|
215
|
+
for (const a of this._listeners)
|
|
216
216
|
try {
|
|
217
|
-
|
|
218
|
-
} catch (
|
|
219
|
-
console.error("Error in trace listener filter:",
|
|
217
|
+
a.filter(l) && n.push(a);
|
|
218
|
+
} catch (c) {
|
|
219
|
+
console.error("Error in trace listener filter:", c);
|
|
220
220
|
}
|
|
221
|
-
return { matched:
|
|
221
|
+
return { matched: n, metadata: l };
|
|
222
222
|
}
|
|
223
|
-
emit(e, t,
|
|
224
|
-
const { matched:
|
|
225
|
-
if (!
|
|
226
|
-
e === "error" && console.error("Unhandled error trace event:",
|
|
223
|
+
emit(e, t, r, o, l, n) {
|
|
224
|
+
const { matched: a, metadata: c } = this._listeners.length === 0 ? { matched: [], metadata: void 0 } : this.matchListeners(e, t, r, l);
|
|
225
|
+
if (!c || a.length === 0) {
|
|
226
|
+
e === "error" && console.error("Unhandled error trace event:", n);
|
|
227
227
|
return;
|
|
228
228
|
}
|
|
229
229
|
const f = {
|
|
230
|
-
...
|
|
231
|
-
...
|
|
230
|
+
...c,
|
|
231
|
+
...n !== void 0 && { error: n },
|
|
232
232
|
...o !== void 0 && { payload: this.resolveAndRedact(o) },
|
|
233
233
|
timestamp: Date.now()
|
|
234
234
|
};
|
|
235
|
-
for (const
|
|
235
|
+
for (const i of a)
|
|
236
236
|
try {
|
|
237
|
-
|
|
237
|
+
i.handler(f);
|
|
238
238
|
} catch (p) {
|
|
239
239
|
console.error("Error in trace listener:", p);
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
|
-
const
|
|
244
|
-
function D(
|
|
245
|
-
const { payload: e } =
|
|
243
|
+
const x = "#f86f63", G = (s, e = "white") => `background-color: ${s}; color: ${e}; padding: 1px; margin-right: 5px; font-size: 12px`;
|
|
244
|
+
function D(s) {
|
|
245
|
+
const { payload: e } = s;
|
|
246
246
|
if (e && Object.keys(e).length > 0)
|
|
247
|
-
return Object.keys(e).reduce((t,
|
|
247
|
+
return Object.keys(e).reduce((t, r) => (["groupId", "label", "namespace", "scope", "source"].includes(r) || (t[r] = b(e[r]) ? e[r].value : e[r]), t), {});
|
|
248
248
|
}
|
|
249
|
-
function d(
|
|
249
|
+
function d(s, e, t = "collapsed", r) {
|
|
250
250
|
if (e instanceof Error) {
|
|
251
251
|
console.groupCollapsed(
|
|
252
252
|
"%c%s",
|
|
253
|
-
`color: ${
|
|
253
|
+
`color: ${x}; padding: 1px; margin-right: 5px; font-size: 11px`,
|
|
254
254
|
`[ ${e.name} ] ${e.message}`
|
|
255
255
|
), e.cause && console.log("cause:", e.cause);
|
|
256
|
-
const
|
|
256
|
+
const c = e.stack?.split(`
|
|
257
257
|
`);
|
|
258
|
-
|
|
259
|
-
const
|
|
260
|
-
Array.isArray(
|
|
258
|
+
c && c.forEach((f) => {
|
|
259
|
+
const i = f.split("@");
|
|
260
|
+
Array.isArray(i) && console.log(i[0], i[1]);
|
|
261
261
|
}), console.groupEnd();
|
|
262
262
|
}
|
|
263
|
-
|
|
263
|
+
const o = Array.isArray(e);
|
|
264
|
+
if (o ? e.length === 0 : Object.keys(e).length === 0) {
|
|
264
265
|
console.log(
|
|
265
266
|
"%c%s",
|
|
266
|
-
`color: ${
|
|
267
|
-
`[ ${
|
|
267
|
+
`color: ${x}; padding: 1px; margin-right: 5px; font-size: 10px`,
|
|
268
|
+
`[ ${s} ] Empty`
|
|
268
269
|
);
|
|
269
270
|
return;
|
|
270
271
|
}
|
|
271
|
-
|
|
272
|
+
if (t === "none" || o && typeof e[0] != "object") {
|
|
273
|
+
console.log(
|
|
274
|
+
"%c%s",
|
|
275
|
+
"color: #f7f7b0; padding: 1px; margin-right: 5px; font-size: 11px",
|
|
276
|
+
`[ ${s} ]`,
|
|
277
|
+
e
|
|
278
|
+
);
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
const a = {
|
|
272
282
|
options: "📚 ",
|
|
273
283
|
store: "🏪 ",
|
|
274
284
|
subscribers: "🧩 ",
|
|
275
285
|
"hooks subscriptions": "🔗 "
|
|
276
|
-
}[
|
|
277
|
-
if (t ?
|
|
286
|
+
}[s] ?? "";
|
|
287
|
+
if (t === "collapsed" ? r ? console.groupCollapsed(
|
|
278
288
|
"%c%s",
|
|
279
289
|
"color: #f7f7b0; padding: 1px; margin-right: 5px; font-size: 11px",
|
|
280
|
-
`${
|
|
281
|
-
|
|
290
|
+
`${a} ${s}`,
|
|
291
|
+
r
|
|
282
292
|
) : console.groupCollapsed(
|
|
283
293
|
"%c%s",
|
|
284
294
|
"color: #f7f7b0; padding: 1px; margin-right: 5px; font-size: 11px",
|
|
285
|
-
`[ ${
|
|
286
|
-
) : console.group(
|
|
295
|
+
`[ ${a}${s} ]`
|
|
296
|
+
) : t === "expanded" && console.group(
|
|
287
297
|
"%c%s",
|
|
288
298
|
"color: #f7f7b0; padding: 1px; margin-right: 5px; font-size: 11px",
|
|
289
|
-
`[ ${
|
|
290
|
-
),
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
}) : e.forEach((a, f) => {
|
|
294
|
-
console.log(
|
|
295
|
-
"%c%s",
|
|
296
|
-
"color: #cae38f; padding: 1px; margin-right: 5px; font-size: 10px",
|
|
297
|
-
`[ ${f} ]`,
|
|
298
|
-
a
|
|
299
|
-
);
|
|
299
|
+
`[ ${a} ${s} ]`
|
|
300
|
+
), o && typeof e[0] == "object")
|
|
301
|
+
e.forEach((c) => {
|
|
302
|
+
c.name ? d(c.name, c) : c._id ? d(c._id, c) : console.dir(c);
|
|
300
303
|
});
|
|
301
304
|
else {
|
|
302
|
-
let
|
|
305
|
+
let c = [];
|
|
303
306
|
Object.keys(e).forEach((f) => {
|
|
304
307
|
if (f === "groupId")
|
|
305
308
|
return;
|
|
306
|
-
const
|
|
307
|
-
|
|
308
|
-
"
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
309
|
+
const i = e[f];
|
|
310
|
+
if (typeof i == "object")
|
|
311
|
+
Array.isArray(i) ? typeof i[0] == "object" ? d(f, i, "expanded") : console.log(
|
|
312
|
+
"%c%s",
|
|
313
|
+
"color: #cae38f; padding: 1px; margin-right: 5px; font-size: 10px",
|
|
314
|
+
`[ ${f} ]`,
|
|
315
|
+
b(i) ? i.value : i
|
|
316
|
+
) : i instanceof Error ? console.log(f, { name: i.name, message: i.message, stack: i.stack }) : d(f, Object.assign({}, i), "expanded");
|
|
317
|
+
else if (!i)
|
|
318
|
+
c.push(f);
|
|
319
|
+
else {
|
|
320
|
+
const p = typeof i;
|
|
321
|
+
console.log(
|
|
322
|
+
"%c%s",
|
|
323
|
+
"color: #b0fa05; padding: 1px; margin-right: 5px; font-size: 10px",
|
|
324
|
+
`[ ${f} ]`,
|
|
325
|
+
p === "function" ? p : i
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
}), c.length && console.log(
|
|
314
329
|
"%c%s",
|
|
315
330
|
"color: #f86f63; font-size: 9px",
|
|
316
331
|
"[ Empty properties ]",
|
|
317
|
-
|
|
332
|
+
c
|
|
318
333
|
);
|
|
319
334
|
}
|
|
320
335
|
console.groupEnd();
|
|
321
336
|
}
|
|
322
|
-
function N(
|
|
323
|
-
const e = D(
|
|
337
|
+
function N(s) {
|
|
338
|
+
const e = D(s);
|
|
324
339
|
if (e && Object.keys(e).length > 0) {
|
|
325
|
-
d(
|
|
340
|
+
d(s.label, e, "collapsed", s.source);
|
|
326
341
|
return;
|
|
327
342
|
}
|
|
328
343
|
console.log(
|
|
329
344
|
"%c%s",
|
|
330
345
|
"color: #f8f89f; padding: 1px; margin-right: 5px; font-size: 11px",
|
|
331
|
-
|
|
332
|
-
|
|
346
|
+
s.label,
|
|
347
|
+
s.source
|
|
333
348
|
);
|
|
334
349
|
}
|
|
335
|
-
function
|
|
336
|
-
Object.keys(
|
|
350
|
+
function _(s) {
|
|
351
|
+
Object.keys(s).forEach((e) => {
|
|
337
352
|
if (["groupId", "label", "namespace", "scope", "source"].includes(e))
|
|
338
353
|
return;
|
|
339
|
-
const t =
|
|
354
|
+
const t = s[e];
|
|
340
355
|
if (!t) {
|
|
341
356
|
console.log(
|
|
342
357
|
"%c%s",
|
|
@@ -364,12 +379,12 @@ function b(r) {
|
|
|
364
379
|
d(e, t?.storeOptions ?? t);
|
|
365
380
|
break;
|
|
366
381
|
case "payload":
|
|
367
|
-
|
|
382
|
+
_(t);
|
|
368
383
|
break;
|
|
369
384
|
case "store":
|
|
370
385
|
d(e, {
|
|
371
386
|
$state: t.$state,
|
|
372
|
-
$actions: Object.keys(t).reduce((
|
|
387
|
+
$actions: Object.keys(t).reduce((r, o) => (o.startsWith("$") && !["$id", "$state"].includes(o) || o.startsWith("_") || (typeof t[o] != "function" ? (r.computed || (r.computed = []), r.computed.push(o)) : r[o] = t[o]), r), {})
|
|
373
388
|
});
|
|
374
389
|
break;
|
|
375
390
|
default:
|
|
@@ -384,48 +399,48 @@ function b(r) {
|
|
|
384
399
|
}
|
|
385
400
|
});
|
|
386
401
|
}
|
|
387
|
-
function W(
|
|
388
|
-
if (!
|
|
402
|
+
function W(s, e) {
|
|
403
|
+
if (!s)
|
|
389
404
|
throw new Error("Style instructions are required");
|
|
390
405
|
console.log(
|
|
391
406
|
"%c%s",
|
|
392
|
-
|
|
407
|
+
s,
|
|
393
408
|
e.shift(),
|
|
394
409
|
...e
|
|
395
410
|
);
|
|
396
411
|
}
|
|
397
|
-
function q(
|
|
398
|
-
if (!
|
|
412
|
+
function q(s, e, t) {
|
|
413
|
+
if (!s)
|
|
399
414
|
throw new Error("Style instructions are required");
|
|
400
|
-
const
|
|
415
|
+
const r = e.shift(), o = e[0];
|
|
401
416
|
if (!o?.payload || Object.keys(o.payload).length === 0) {
|
|
402
417
|
console.log(
|
|
403
418
|
"%c%s",
|
|
404
|
-
|
|
405
|
-
`${o?.source === t ? o?.label ?? o?.namespace :
|
|
419
|
+
s,
|
|
420
|
+
`${o?.source === t ? o?.label ?? o?.namespace : r}`,
|
|
406
421
|
o?.source
|
|
407
422
|
);
|
|
408
423
|
return;
|
|
409
424
|
}
|
|
410
425
|
console.groupCollapsed(
|
|
411
426
|
"%c%s",
|
|
412
|
-
|
|
413
|
-
`${
|
|
427
|
+
s,
|
|
428
|
+
`${r}
|
|
414
429
|
`,
|
|
415
430
|
o?.source
|
|
416
|
-
), e.forEach((
|
|
417
|
-
switch (typeof
|
|
431
|
+
), e.forEach((l) => {
|
|
432
|
+
switch (typeof l) {
|
|
418
433
|
case "string":
|
|
419
|
-
console.info(
|
|
434
|
+
console.info(l);
|
|
420
435
|
break;
|
|
421
436
|
case "object":
|
|
422
|
-
Array.isArray(
|
|
437
|
+
Array.isArray(l) ? console.table(l) : _(l);
|
|
423
438
|
break;
|
|
424
439
|
case "function":
|
|
425
|
-
console.dir(
|
|
440
|
+
console.dir(l);
|
|
426
441
|
break;
|
|
427
442
|
default:
|
|
428
|
-
console.info(
|
|
443
|
+
console.info(l);
|
|
429
444
|
}
|
|
430
445
|
}), console.groupEnd();
|
|
431
446
|
}
|
|
@@ -479,7 +494,7 @@ class K {
|
|
|
479
494
|
class V extends K {
|
|
480
495
|
constructor(t) {
|
|
481
496
|
super();
|
|
482
|
-
u(this, "_pluginName",
|
|
497
|
+
u(this, "_pluginName", S);
|
|
483
498
|
t && (this._pluginName = t);
|
|
484
499
|
}
|
|
485
500
|
logGroup(t) {
|
|
@@ -489,108 +504,113 @@ class V extends K {
|
|
|
489
504
|
"color: #87e47f; padding: 1px; margin-right: 5px; font-size: 11px; font-family: arial",
|
|
490
505
|
`🍍 ${o?.label ?? o?.namespace}`,
|
|
491
506
|
`[${o?.scope}]`
|
|
492
|
-
), o?.payload &&
|
|
507
|
+
), o?.payload && _(o.payload), console.groupCollapsed(
|
|
493
508
|
"%c%s",
|
|
494
509
|
"color: #f1f6b7; padding: 1px; margin-right: 5px; font-size: 11px",
|
|
495
510
|
"[ ✨ traces ]"
|
|
496
|
-
), t.forEach((
|
|
511
|
+
), t.forEach((l) => N(l[1])), console.groupEnd(), console.groupEnd();
|
|
497
512
|
}
|
|
498
|
-
useLog(t,
|
|
513
|
+
useLog(t, r) {
|
|
499
514
|
q(
|
|
500
515
|
this.generateStyle(t),
|
|
501
|
-
this.rebuildArgs(
|
|
516
|
+
this.rebuildArgs(r),
|
|
502
517
|
this._pluginName
|
|
503
518
|
);
|
|
504
519
|
}
|
|
505
520
|
}
|
|
506
|
-
function
|
|
507
|
-
const e = Object.keys(
|
|
508
|
-
return [F(
|
|
521
|
+
function A(s) {
|
|
522
|
+
const e = Object.keys(s).reduce((t, r) => (r !== "level" && r !== "timestamp" && (t[r] = s[r]), t), {});
|
|
523
|
+
return [F(s), e];
|
|
509
524
|
}
|
|
510
|
-
function F(
|
|
511
|
-
return
|
|
525
|
+
function F(s) {
|
|
526
|
+
return s.scope ? `${s.label} [${s.scope}]` : `${s.label}`;
|
|
512
527
|
}
|
|
513
|
-
function H(
|
|
528
|
+
function H(s, e) {
|
|
514
529
|
const t = e.level === "error" ? "error" : "log";
|
|
515
|
-
|
|
530
|
+
s[t](...A(e));
|
|
516
531
|
}
|
|
517
|
-
function B(
|
|
518
|
-
const e = new V(), t = /* @__PURE__ */ new Map();
|
|
519
|
-
function
|
|
520
|
-
t.set(
|
|
521
|
-
}
|
|
522
|
-
function
|
|
523
|
-
const
|
|
524
|
-
if (!
|
|
525
|
-
e.error(`No group found for key "${
|
|
532
|
+
function B(s = "scope") {
|
|
533
|
+
const e = new V(), t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
534
|
+
function o(n) {
|
|
535
|
+
t.has(n) || t.set(n, []), r.set(n, (r.get(n) ?? 0) + 1);
|
|
536
|
+
}
|
|
537
|
+
function l(n) {
|
|
538
|
+
const a = t.get(n);
|
|
539
|
+
if (!a) {
|
|
540
|
+
e.error(`No group found for key "${n}"`);
|
|
526
541
|
return;
|
|
527
542
|
}
|
|
528
|
-
c
|
|
543
|
+
const c = (r.get(n) ?? 1) - 1;
|
|
544
|
+
if (c > 0) {
|
|
545
|
+
r.set(n, c);
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
a.length && e.logGroup(a), t.delete(n), r.delete(n);
|
|
529
549
|
}
|
|
530
550
|
return {
|
|
531
|
-
createGroup:
|
|
532
|
-
logGroup:
|
|
533
|
-
handler(
|
|
534
|
-
const
|
|
535
|
-
if (!t.has(
|
|
536
|
-
H(e,
|
|
551
|
+
createGroup: o,
|
|
552
|
+
logGroup: l,
|
|
553
|
+
handler(n) {
|
|
554
|
+
const a = n?.payload?.groupId ?? n[s];
|
|
555
|
+
if (!t.has(a)) {
|
|
556
|
+
H(e, n);
|
|
537
557
|
return;
|
|
538
558
|
}
|
|
539
|
-
t.get(
|
|
559
|
+
t.get(a)?.push(A(n));
|
|
540
560
|
}
|
|
541
561
|
};
|
|
542
562
|
}
|
|
543
|
-
function
|
|
544
|
-
return (
|
|
545
|
-
if (
|
|
563
|
+
function E(s, e = !0, t) {
|
|
564
|
+
return (r) => s[t](({ comparator: o = "equals", target: l, value: n }) => {
|
|
565
|
+
if (l === "namespace" && e && X(r))
|
|
546
566
|
return !0;
|
|
547
|
-
const
|
|
548
|
-
if (typeof
|
|
549
|
-
let
|
|
567
|
+
const a = r[l];
|
|
568
|
+
if (typeof a != "string") return !1;
|
|
569
|
+
let c = !1;
|
|
550
570
|
switch (o) {
|
|
551
571
|
case "equals":
|
|
552
|
-
|
|
572
|
+
c = a === n;
|
|
553
573
|
break;
|
|
554
574
|
case "contains":
|
|
555
|
-
|
|
575
|
+
c = a.includes(n);
|
|
556
576
|
break;
|
|
557
577
|
case "startsWith":
|
|
558
|
-
|
|
578
|
+
c = a.startsWith(n);
|
|
559
579
|
break;
|
|
560
580
|
case "endsWith":
|
|
561
|
-
|
|
581
|
+
c = a.endsWith(n);
|
|
562
582
|
break;
|
|
563
583
|
default:
|
|
564
|
-
|
|
584
|
+
c = !1;
|
|
565
585
|
break;
|
|
566
586
|
}
|
|
567
|
-
return
|
|
587
|
+
return c;
|
|
568
588
|
});
|
|
569
589
|
}
|
|
570
|
-
function U(
|
|
590
|
+
function U(s, e = !0, t = "every", r = "scope") {
|
|
571
591
|
return {
|
|
572
|
-
groupBy:
|
|
573
|
-
...B(
|
|
574
|
-
...
|
|
592
|
+
groupBy: r,
|
|
593
|
+
...B(r),
|
|
594
|
+
...v(s, e, t)
|
|
575
595
|
};
|
|
576
596
|
}
|
|
577
|
-
function
|
|
578
|
-
return Array.isArray(
|
|
579
|
-
...
|
|
580
|
-
filter: Array.isArray(
|
|
597
|
+
function v(s, e = !0, t = "every") {
|
|
598
|
+
return Array.isArray(s) ? { filter: E(s, e, t) } : {
|
|
599
|
+
...s,
|
|
600
|
+
filter: Array.isArray(s.filter) ? E(s.filter, e, t) : s.filter
|
|
581
601
|
};
|
|
582
602
|
}
|
|
583
|
-
function
|
|
584
|
-
return
|
|
603
|
+
function X(s) {
|
|
604
|
+
return s?.source === S && (!s?.namespace || s.namespace.startsWith(z));
|
|
585
605
|
}
|
|
586
|
-
function
|
|
606
|
+
function J() {
|
|
587
607
|
try {
|
|
588
608
|
return process.env.NODE_ENV === "production";
|
|
589
609
|
} catch {
|
|
590
610
|
return !1;
|
|
591
611
|
}
|
|
592
612
|
}
|
|
593
|
-
const
|
|
613
|
+
const Q = "[REDACTED]", Y = [
|
|
594
614
|
/pass(word|wd|phrase|code)|^pwd/i,
|
|
595
615
|
/secret/i,
|
|
596
616
|
/token/i,
|
|
@@ -600,113 +620,113 @@ const Y = "[REDACTED]", Z = [
|
|
|
600
620
|
/credential/i,
|
|
601
621
|
/cookie/i,
|
|
602
622
|
/cipher/i
|
|
603
|
-
],
|
|
604
|
-
function ee(
|
|
623
|
+
], Z = 12;
|
|
624
|
+
function ee(s) {
|
|
605
625
|
const e = /* @__PURE__ */ new Set(), t = [];
|
|
606
|
-
for (const
|
|
607
|
-
typeof
|
|
608
|
-
return (
|
|
626
|
+
for (const r of s)
|
|
627
|
+
typeof r == "string" ? e.add(r.toLowerCase()) : t.push(new RegExp(r.source, r.flags.replace(/[gy]/g, "")));
|
|
628
|
+
return (r) => e.has(r.toLowerCase()) || t.some((o) => o.test(r));
|
|
609
629
|
}
|
|
610
|
-
function te(
|
|
611
|
-
return
|
|
630
|
+
function te(s) {
|
|
631
|
+
return s === null || typeof s != "object" ? !1 : !(s instanceof Date || s instanceof RegExp || s instanceof Error || s instanceof Promise || s instanceof WeakMap || s instanceof WeakSet);
|
|
612
632
|
}
|
|
613
|
-
function re(
|
|
614
|
-
const { includeDefaults: e = !0, keys: t = [], replacement:
|
|
615
|
-
function
|
|
616
|
-
if (!te(
|
|
617
|
-
return
|
|
618
|
-
const f =
|
|
633
|
+
function re(s = !0) {
|
|
634
|
+
const { includeDefaults: e = !0, keys: t = [], replacement: r = Q } = s === !0 ? {} : s, o = ee([...e ? Y : [], ...t]);
|
|
635
|
+
function l(n, a, c) {
|
|
636
|
+
if (!te(n))
|
|
637
|
+
return n;
|
|
638
|
+
const f = a.get(n);
|
|
619
639
|
if (f !== void 0)
|
|
620
640
|
return f;
|
|
621
|
-
if (
|
|
641
|
+
if (c >= Z)
|
|
622
642
|
return "[MaxDepth]";
|
|
623
|
-
if (
|
|
643
|
+
if (n instanceof Map) {
|
|
624
644
|
const p = /* @__PURE__ */ new Map();
|
|
625
|
-
return
|
|
626
|
-
p.set(g, typeof g == "string" && o(g) ?
|
|
645
|
+
return a.set(n, p), n.forEach((h, g) => {
|
|
646
|
+
p.set(g, typeof g == "string" && o(g) ? r : l(h, a, c + 1));
|
|
627
647
|
}), p;
|
|
628
648
|
}
|
|
629
|
-
if (
|
|
649
|
+
if (n instanceof Set) {
|
|
630
650
|
const p = /* @__PURE__ */ new Set();
|
|
631
|
-
return
|
|
651
|
+
return a.set(n, p), n.forEach((h) => p.add(l(h, a, c + 1))), p;
|
|
632
652
|
}
|
|
633
|
-
if (Array.isArray(
|
|
653
|
+
if (Array.isArray(n)) {
|
|
634
654
|
const p = [];
|
|
635
|
-
return
|
|
655
|
+
return a.set(n, p), n.forEach((h) => p.push(l(h, a, c + 1))), p;
|
|
636
656
|
}
|
|
637
|
-
const
|
|
638
|
-
|
|
639
|
-
for (const p of Object.keys(
|
|
640
|
-
const h = o(p) ?
|
|
641
|
-
Object.defineProperty(
|
|
657
|
+
const i = {};
|
|
658
|
+
a.set(n, i);
|
|
659
|
+
for (const p of Object.keys(n)) {
|
|
660
|
+
const h = o(p) ? r : l(n[p], a, c + 1);
|
|
661
|
+
Object.defineProperty(i, p, {
|
|
642
662
|
configurable: !0,
|
|
643
663
|
enumerable: !0,
|
|
644
664
|
value: h,
|
|
645
665
|
writable: !0
|
|
646
666
|
});
|
|
647
667
|
}
|
|
648
|
-
return
|
|
668
|
+
return i;
|
|
649
669
|
}
|
|
650
|
-
return (
|
|
670
|
+
return (n) => l(n, /* @__PURE__ */ new WeakMap(), 0);
|
|
651
671
|
}
|
|
652
672
|
const se = () => {
|
|
653
673
|
};
|
|
654
|
-
function ue({ enabled:
|
|
655
|
-
const t = e ? re(e === !0 ? !0 : e) : void 0,
|
|
656
|
-
function o(
|
|
657
|
-
if (!
|
|
674
|
+
function ue({ enabled: s = !J(), redact: e = !1 } = {}) {
|
|
675
|
+
const t = e ? re(e === !0 ? !0 : e) : void 0, r = [];
|
|
676
|
+
function o(i, { context: p = !0, filterMode: h = "every", groupBy: g = "scope" } = {}) {
|
|
677
|
+
if (!s)
|
|
658
678
|
return se;
|
|
659
|
-
const
|
|
660
|
-
|
|
679
|
+
const m = U(
|
|
680
|
+
i,
|
|
661
681
|
!!p,
|
|
662
682
|
h ?? "every",
|
|
663
683
|
g ?? "scope"
|
|
664
684
|
);
|
|
665
|
-
return
|
|
666
|
-
const
|
|
667
|
-
|
|
685
|
+
return r.push(m), () => {
|
|
686
|
+
const y = r.indexOf(m);
|
|
687
|
+
y !== -1 && r.splice(y, 1);
|
|
668
688
|
};
|
|
669
689
|
}
|
|
670
|
-
function i
|
|
690
|
+
function l(i, p = !0) {
|
|
671
691
|
return o(
|
|
672
|
-
|
|
692
|
+
i.map((h) => ({ target: "scope", value: h })),
|
|
673
693
|
{ context: p, filterMode: "some", groupBy: "scope" }
|
|
674
694
|
);
|
|
675
695
|
}
|
|
676
|
-
function
|
|
677
|
-
|
|
696
|
+
function n() {
|
|
697
|
+
r.length = 0;
|
|
678
698
|
}
|
|
679
|
-
function
|
|
699
|
+
function a(i) {
|
|
680
700
|
const p = {
|
|
681
|
-
groupId:
|
|
682
|
-
label:
|
|
683
|
-
level:
|
|
684
|
-
namespace:
|
|
685
|
-
scope:
|
|
686
|
-
source:
|
|
701
|
+
groupId: i.groupId,
|
|
702
|
+
label: i.label,
|
|
703
|
+
level: i.level,
|
|
704
|
+
namespace: i.namespace,
|
|
705
|
+
scope: i.scope,
|
|
706
|
+
source: i.source
|
|
687
707
|
};
|
|
688
|
-
return
|
|
708
|
+
return r.filter((h) => h.filter(p));
|
|
689
709
|
}
|
|
690
|
-
function
|
|
691
|
-
return
|
|
710
|
+
function c() {
|
|
711
|
+
return r.length > 0;
|
|
692
712
|
}
|
|
693
|
-
function f(
|
|
694
|
-
|
|
713
|
+
function f(i, p) {
|
|
714
|
+
r.length && a(p).forEach((h) => {
|
|
695
715
|
const g = p.groupId ?? p[h.groupBy];
|
|
696
|
-
typeof g == "string" && h[
|
|
716
|
+
typeof g == "string" && h[i](g);
|
|
697
717
|
});
|
|
698
718
|
}
|
|
699
719
|
return {
|
|
700
720
|
addListener: o,
|
|
701
|
-
addScopesListener:
|
|
702
|
-
clearTraceListeners:
|
|
721
|
+
addScopesListener: l,
|
|
722
|
+
clearTraceListeners: n,
|
|
703
723
|
tracerHandler: {
|
|
704
|
-
closeGroup: (
|
|
705
|
-
createTracer: (
|
|
706
|
-
hasTraceListeners:
|
|
707
|
-
startGroup: (
|
|
724
|
+
closeGroup: (i) => f("logGroup", i),
|
|
725
|
+
createTracer: (i, p = {}) => new R(i, r, { redactor: t, ...p }),
|
|
726
|
+
hasTraceListeners: c,
|
|
727
|
+
startGroup: (i) => f("createGroup", i)
|
|
708
728
|
},
|
|
709
|
-
hasTraceListeners:
|
|
729
|
+
hasTraceListeners: c
|
|
710
730
|
};
|
|
711
731
|
}
|
|
712
732
|
export {
|
|
@@ -717,9 +737,9 @@ export {
|
|
|
717
737
|
B as createConsoleGroupTraceListener,
|
|
718
738
|
ae as createPluginSubscriber,
|
|
719
739
|
ue as createTracerRegistry,
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
740
|
+
Y as defaultRedactedKeys,
|
|
741
|
+
w as getDefineAStoreSetupContext,
|
|
742
|
+
j as isEmpty,
|
|
723
743
|
T as setEnhancedStore,
|
|
724
744
|
he as traceGroups
|
|
725
745
|
};
|
package/dist/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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.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","import { pluginName } from '../utils/constants'\nimport type { Console, LogType, StyleDefinition, StyleDefinitions } from '../types/log'\nimport type { ConsoleTraceEvent, ConsoleTraceEventArgs, TraceEvent } from '../types/trace'\nimport type { Store } from 'pinia'\n\n\nconst errorColor = '#f86f63'\nconst style = (bgColor: string, color: string = 'white') =>\n `background-color: ${bgColor}; color: ${color}; padding: 1px; margin-right: 5px; font-size: 12px`\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] = payload[key]\n }\n return acc\n }, {} as Record<string, unknown>)\n }\n return undefined\n}\n\nexport function printObject(label: string, payload: object, groupCollapsed: boolean = true, source?: string) {\n if (payload instanceof 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 }\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 options: '📚 ',\n store: '🏪 ',\n subscribers: '🧩 ',\n 'hooks subscriptions': '🔗 '\n }\n const icon = styles[label] ?? ''\n\n if (groupCollapsed) {\n if (source) {\n console.groupCollapsed(\n '%c%s',\n 'color: #f7f7b0; padding: 1px; margin-right: 5px; font-size: 11px',\n `${icon} ${label}`, source)\n } else {\n console.groupCollapsed(\n '%c%s',\n 'color: #f7f7b0; padding: 1px; margin-right: 5px; font-size: 11px',\n `[ ${icon}${label} ]`)\n }\n } else {\n console.group(\n '%c%s',\n 'color: #f7f7b0; padding: 1px; margin-right: 5px; font-size: 11px',\n `[ ${icon} ${label} ]`)\n }\n\n if (Array.isArray(payload)) {\n if (typeof payload[0] === 'object') {\n payload.forEach((item: any) => {\n if (item.name) {\n printObject(item.name, item)\n } else if (item._id) {\n printObject(item._id, item)\n } else {\n console.dir(item)\n }\n })\n } else {\n payload.forEach((item: any, index: number) => {\n console.log(\n '%c%s',\n 'color: #cae38f; padding: 1px; margin-right: 5px; font-size: 10px',\n `[ ${index} ]`, item\n )\n })\n }\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, false)\n } else {\n console.group(key)\n console.log(value)\n console.groupEnd()\n }\n } else if (value instanceof Error) {\n console.log(key, { name: value.name, message: value.message, stack: value.stack })\n } else {\n printObject(key, Object.assign({}, value), false)\n }\n } else {\n if (!value) {\n emptyKeys.push(key)\n } else {\n console.log(\n '%c%s',\n 'color: #b0fa05; padding: 1px; margin-right: 5px; font-size: 10px',\n `[ ${key} ]`, 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}\n\nfunction printTrace(trace: TraceEvent) {\n const payload = getPrintablePayload(trace)\n if (payload && Object.keys(payload).length > 0) {\n printObject(trace.label, payload, true, 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}\n\nfunction 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 acc[curr] = (arg as Record<string, unknown>)[curr]\n return acc\n }, {} as Record<string, unknown>)\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}\nexport 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\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}\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 style(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\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'\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\n\n function createGroup(key: string) {\n groups.set(key, [])\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 if (group.length) { target.logGroup(group) }\n groups.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 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","style","bgColor","color","getPrintablePayload","trace","acc","key","printObject","groupCollapsed","errorColor","stack","line","icon","item","index","emptyKeys","printTrace","printTracePayload","tracePayload","arg","curr","log$1","logStyle","args","logTrace","pluginName2","CustomConsole","message","styleDefinition","messageType","log","TraceConsole","groups","context","group","buildConsoleArgsFromEvent","sanitizedEvent","formatTraceLabel","target","consoleMethod","createConsoleGroupTraceListener","groupBy","createGroup","logGroup","groupKey","createFilter","criteria","mode","comparator","isPluginSubscription","eventValue","result","createTraceGroupListener","listenerDef","filterMode","createTraceFilter","pluginSubscriptionNamespace","isProductionEnvironment","DEFAULT_REDACTED_VALUE","MAX_DEPTH","createKeyMatcher","keys","exact","patterns","pattern","isTraversable","createRedactor","replacement","isSensitive","includeDefaults","defaultRedactedKeys","seen","depth","cached","copy2","entry","redact","copy","redactedValue","noop","createTracerRegistry","enabled","redactor","addListener","listenerGroup","addScopesListener","scopes","clearTraceListeners","getMatchedListener","listenerGroupAction","actionName","groupLabel","Tracer","hasTraceListeners"],"mappings":";;;;;;AAyBA,MAA8BA,GAA8E;AAAA,EAqDxG,YAAIC,GAAcC,GAAoC;AApD9C,IAAAC,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA;AAEE,IAAAA,EAAA;AACF,IAAAA,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA;AAAA,IAAAA,EAAA;AAAA,IAAAA,EAAA;AAKE,IAAAA,EAAA;AAwCN,SAAK,QAAAF,GACT,KAAA,kBAAAC;AAAA,EAGA;AAAA,EA1CO,IAAA,OAAA;AAAA,WAAA,KAAA;AAAA,EAEA;AAAA,EAGP,IAAI,gBAAe;AACf,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,IAAI,gBAAsC;AACtC,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,IAAI,cAAAE,GAAyD;AACzD,SAAA,iBAAYA;AAAA,EAChB;AAAA,EAEA,IAAI,qBAAc;AACd,WAAK,KAAA;AAAA,EACT;AAAA,EAEA,IAAI,4BAAiE;AACjE,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,IAAI,4BAAmE;AACnE,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,IAAI;AACA,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,IAAI,cA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":"helpers.js","sources":["../src/core/PluginSubscriber.ts","../src/core/Store.ts","../src/factories/plugin-subscriber.ts","../src/system/Tracer.ts","../src/system/log.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","import { pluginName } from '../utils/constants'\nimport type { Console, LogType, StyleDefinition, StyleDefinitions } from '../types/log'\nimport type { ConsoleTraceEvent, ConsoleTraceEventArgs, TraceEvent } from '../types/trace'\nimport type { Store } from 'pinia'\nimport { isRef } from 'vue'\n\n\nconst errorColor = '#f86f63'\nconst style = (bgColor: string, color: string = 'white') =>\n `background-color: ${bgColor}; color: ${color}; padding: 1px; margin-right: 5px; font-size: 12px`\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\nexport function printObject(label: string, payload: object, groupType: 'collapsed' | 'expanded' | 'none' = 'collapsed', source?: string) {\n if (payload instanceof 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 }\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 if (groupType === 'none' || (isArray && typeof payload[0] !== 'object')) {\n console.log(\n '%c%s',\n 'color: #f7f7b0; padding: 1px; margin-right: 5px; font-size: 11px',\n `[ ${label} ]`, payload\n )\n return\n }\n\n const styles: Record<string, string> = {\n options: '📚 ',\n store: '🏪 ',\n subscribers: '🧩 ',\n 'hooks subscriptions': '🔗 '\n }\n const icon = styles[label] ?? ''\n\n if (groupType === 'collapsed') {\n if (source) {\n console.groupCollapsed(\n '%c%s',\n 'color: #f7f7b0; padding: 1px; margin-right: 5px; font-size: 11px',\n `${icon} ${label}`, source)\n } else {\n console.groupCollapsed(\n '%c%s',\n 'color: #f7f7b0; padding: 1px; margin-right: 5px; font-size: 11px',\n `[ ${icon}${label} ]`)\n }\n } else if (groupType === 'expanded') {\n console.group(\n '%c%s',\n 'color: #f7f7b0; padding: 1px; margin-right: 5px; font-size: 11px',\n `[ ${icon} ${label} ]`)\n }\n\n if (isArray && typeof payload[0] === 'object') {\n payload.forEach((item: any) => {\n if (item.name) {\n printObject(item.name, item)\n } else if (item._id) {\n printObject(item._id, item)\n } else {\n console.dir(item)\n }\n })\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 {\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 } else if (value instanceof Error) {\n console.log(key, { name: value.name, message: value.message, stack: value.stack })\n } else {\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}\n\nfunction 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}\n\nfunction 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 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}\nexport 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\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}\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 style(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\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'\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 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","style","bgColor","color","getPrintablePayload","trace","acc","key","printObject","groupType","errorColor","stack","line","isArray","icon","item","emptyKeys","typeOfValue","printTrace","printTracePayload","tracePayload","arg","curr","log$1","logStyle","args","logTrace","pluginName2","CustomConsole","message","styleDefinition","messageType","log","TraceConsole","groups","context","group","buildConsoleArgsFromEvent","sanitizedEvent","formatTraceLabel","target","consoleMethod","createConsoleGroupTraceListener","groupBy","createGroup","openCounts","logGroup","remaining","groupKey","criteria","mode","comparator","isPluginSubscription","eventValue","result","createTraceGroupListener","filterMode","listenerDef","createTraceFilter","createFilter","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","index","addScopesListener","scopes","clearTraceListeners","getMatchedListener","listenerGroupAction","actionName","groupLabel","Tracer","hasTraceListeners"],"mappings":";;;;;;AAyBA,MAA8BA,GAA8E;AAAA,EAqDxG,YAAIC,GAAcC,GAAoC;AApD9C,IAAAC,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA;AAEE,IAAAA,EAAA;AACF,IAAAA,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA;AAAA,IAAAA,EAAA;AAAA,IAAAA,EAAA;AAKE,IAAAA,EAAA;AAwCN,SAAK,QAAAF,GACT,KAAA,kBAAAC;AAAA,EAGA;AAAA,EA1CO,IAAA,OAAA;AAAA,WAAA,KAAA;AAAA,EAEA;AAAA,EAGP,IAAI,gBAAe;AACf,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,IAAI,gBAAsC;AACtC,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,IAAI,cAAAE,GAAyD;AACzD,SAAA,iBAAYA;AAAA,EAChB;AAAA,EAEA,IAAI,qBAAc;AACd,WAAK,KAAA;AAAA,EACT;AAAA,EAEA,IAAI,4BAAiE;AACjE,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,IAAI,4BAAmE;AACnE,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,IAAI;AACA,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,IAAI,cAAAC,GAAiD;AACjD,SAAA,iBAAYA;AAAA,EAChB;AAAA,EASI,eAAKC,GAAkB;AAAA,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UACTuG,EAAO1G,CAAA,EAAA,QAAA,CAAAW,MAAA;AACX,YAAAkG,IAAA7G,EAAA,WAAAA,EAAAW,EAAA,OAAA;AAEA,MAAI,YAAsB,YACtBA,EAAMmF,CAAAA,EAAAA;IAEN,CAAA;AAAA,EACI;AAAwG,SAC3G;AAAA,IACD,aAAAM;AAAA,IACJ,mBAAAG;AAAA,IAEA,qBAAAE;AAAA,IACI,eAAMX;AAAAA,MACN,YAAS,CAAA9F,MAAW2G,EAAA,YAAA3G,CAAA;AAAA,MACpB,cAAc,CAAAE,GAAA/B,IAAc,CAAA,UAAW2I,EAAO5G,MAAiB,EAAA,UAAAiG,GAAA,GAAAhI,EAAA,CAAA;AAAA,MAC/D,mBAAA4I;AAAA,MACJ,YAAA,CAAA/G,MAAA2G,EAAA,eAAA3G,CAAA;AAAA,IAEA;AAAA,IACI,mBAAA+G;AAAA,EACA;AACA;"}
|
package/dist/system/log.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Console, LogType, StyleDefinition, StyleDefinitions } from '../types/log';
|
|
2
2
|
import type { ConsoleTraceEvent } from '../types/trace';
|
|
3
|
-
export declare function printObject(label: string, payload: object,
|
|
3
|
+
export declare function printObject(label: string, payload: object, groupType?: 'collapsed' | 'expanded' | 'none', source?: string): void;
|
|
4
4
|
export declare function log(logStyle: string, args: any): void;
|
|
5
5
|
export declare function logTrace(logStyle: string, args: any, pluginName: string): void;
|
|
6
6
|
export declare abstract class CustomConsole implements Console {
|
package/docs/tracing.md
CHANGED
|
@@ -156,6 +156,8 @@ Trace groups opened by `onAction`, `$subscribe` and `$reset` are always closed,
|
|
|
156
156
|
|
|
157
157
|
Normal trace events do not write to a console. The registry created by `createTracerRegistry()` uses the console's grouped output for the events matching its listeners: register listeners as shown in the [quick start](#quick-start) and pass `tracerHandler` to the plugin. Groups default to the `scope` metadata field; use the `groupBy` option of `addListener()` to group by another field.
|
|
158
158
|
|
|
159
|
+
When an event has a `payload.groupId`, that value takes precedence over the configured `groupBy` field as its console-group key. Events without an open group for their key are printed immediately outside a group. If multiple groups with the same key are opened concurrently, their events share one buffer; the buffered group is printed only after every matching open has been closed.
|
|
160
|
+
|
|
159
161
|
`CustomConsole` remains exported from `pinia-plugin-subscription/helpers` for plugins not yet migrated to the tracer.
|
|
160
162
|
|
|
161
163
|
## Error reporting
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pinia-plugin-subscription",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.11",
|
|
4
4
|
"description": "Pinia plugin for Vue.js that helps building Pinia plugins by centralizing subscriber registration and providing a Store base class for store helpers.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|