@alistigo/claude-storage-plugin 0.2.16 → 0.4.0
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/dist/index.js +332 -1003
- package/dist/index.js.map +1 -1
- package/package.json +5 -8
package/dist/index.js
CHANGED
|
@@ -1,804 +1,115 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
function
|
|
22
|
-
var t = Ie(e, n);
|
|
23
|
-
if (!Ue(t))
|
|
24
|
-
throw TypeError("Stringified UUID is invalid");
|
|
25
|
-
return t;
|
|
26
|
-
}
|
|
27
|
-
var G, $e = new Uint8Array(16);
|
|
28
|
-
function Fe() {
|
|
29
|
-
if (!G && (G = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !G))
|
|
30
|
-
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
31
|
-
return G($e);
|
|
32
|
-
}
|
|
33
|
-
var me = null, he = null, A = 0;
|
|
34
|
-
function Re(e, n, t) {
|
|
35
|
-
e = e || {};
|
|
36
|
-
var i = 0, c = n || new Uint8Array(16), m = e.random || (e.rng || Fe)(), _ = e.msecs !== void 0 ? e.msecs : Date.now(), I = e.seq !== void 0 ? e.seq : null, E = he, p = me;
|
|
37
|
-
return _ > A && e.msecs === void 0 && (A = _, I !== null && (E = null, p = null)), I !== null && (I > 2147483647 && (I = 2147483647), E = I >>> 19 & 4095, p = I & 524287), (E === null || p === null) && (E = m[6] & 127, E = E << 8 | m[7], p = m[8] & 63, p = p << 8 | m[9], p = p << 5 | m[10] >>> 3), _ + 1e4 > A && I === null ? ++p > 524287 && (p = 0, ++E > 4095 && (E = 0, A++)) : A = _, he = E, me = p, c[i++] = A / 1099511627776 & 255, c[i++] = A / 4294967296 & 255, c[i++] = A / 16777216 & 255, c[i++] = A / 65536 & 255, c[i++] = A / 256 & 255, c[i++] = A & 255, c[i++] = E >>> 4 & 15 | 112, c[i++] = E & 255, c[i++] = p >>> 13 & 63 | 128, c[i++] = p >>> 5 & 255, c[i++] = p << 3 & 255 | m[10] & 7, c[i++] = m[11], c[i++] = m[12], c[i++] = m[13], c[i++] = m[14], c[i++] = m[15], n || Ie(c);
|
|
38
|
-
}
|
|
39
|
-
function Ve(e) {
|
|
40
|
-
let n;
|
|
41
|
-
const t = new Uint8Array(16);
|
|
42
|
-
return t[0] = (n = parseInt(e.slice(0, 8), 16)) >>> 24, t[1] = n >>> 16 & 255, t[2] = n >>> 8 & 255, t[3] = n & 255, t[4] = (n = parseInt(e.slice(9, 13), 16)) >>> 8, t[5] = n & 255, t[6] = (n = parseInt(e.slice(14, 18), 16)) >>> 8, t[7] = n & 255, t[8] = (n = parseInt(e.slice(19, 23), 16)) >>> 8, t[9] = n & 255, t[10] = (n = parseInt(e.slice(24, 36), 16)) / 1099511627776 & 255, t[11] = n / 4294967296 & 255, t[12] = n >>> 24 & 255, t[13] = n >>> 16 & 255, t[14] = n >>> 8 & 255, t[15] = n & 255, t;
|
|
43
|
-
}
|
|
44
|
-
var h = "0123456789abcdefghjkmnpqrstvwxyz", s = new Uint8Array([
|
|
45
|
-
255,
|
|
46
|
-
255,
|
|
47
|
-
255,
|
|
48
|
-
255,
|
|
49
|
-
255,
|
|
50
|
-
255,
|
|
51
|
-
255,
|
|
52
|
-
255,
|
|
53
|
-
255,
|
|
54
|
-
255,
|
|
55
|
-
255,
|
|
56
|
-
255,
|
|
57
|
-
255,
|
|
58
|
-
255,
|
|
59
|
-
255,
|
|
60
|
-
255,
|
|
61
|
-
255,
|
|
62
|
-
255,
|
|
63
|
-
255,
|
|
64
|
-
255,
|
|
65
|
-
255,
|
|
66
|
-
255,
|
|
67
|
-
255,
|
|
68
|
-
255,
|
|
69
|
-
255,
|
|
70
|
-
255,
|
|
71
|
-
255,
|
|
72
|
-
255,
|
|
73
|
-
255,
|
|
74
|
-
255,
|
|
75
|
-
255,
|
|
76
|
-
255,
|
|
77
|
-
255,
|
|
78
|
-
255,
|
|
79
|
-
255,
|
|
80
|
-
255,
|
|
81
|
-
255,
|
|
82
|
-
255,
|
|
83
|
-
255,
|
|
84
|
-
255,
|
|
85
|
-
255,
|
|
86
|
-
255,
|
|
87
|
-
255,
|
|
88
|
-
255,
|
|
89
|
-
255,
|
|
90
|
-
255,
|
|
91
|
-
255,
|
|
92
|
-
255,
|
|
93
|
-
0,
|
|
94
|
-
1,
|
|
95
|
-
2,
|
|
96
|
-
3,
|
|
97
|
-
4,
|
|
98
|
-
5,
|
|
99
|
-
6,
|
|
100
|
-
7,
|
|
101
|
-
8,
|
|
102
|
-
9,
|
|
103
|
-
255,
|
|
104
|
-
255,
|
|
105
|
-
255,
|
|
106
|
-
255,
|
|
107
|
-
255,
|
|
108
|
-
255,
|
|
109
|
-
255,
|
|
110
|
-
255,
|
|
111
|
-
255,
|
|
112
|
-
255,
|
|
113
|
-
255,
|
|
114
|
-
255,
|
|
115
|
-
255,
|
|
116
|
-
255,
|
|
117
|
-
255,
|
|
118
|
-
255,
|
|
119
|
-
255,
|
|
120
|
-
255,
|
|
121
|
-
255,
|
|
122
|
-
255,
|
|
123
|
-
255,
|
|
124
|
-
255,
|
|
125
|
-
255,
|
|
126
|
-
255,
|
|
127
|
-
255,
|
|
128
|
-
255,
|
|
129
|
-
255,
|
|
130
|
-
255,
|
|
131
|
-
255,
|
|
132
|
-
255,
|
|
133
|
-
255,
|
|
134
|
-
255,
|
|
135
|
-
255,
|
|
136
|
-
255,
|
|
137
|
-
255,
|
|
138
|
-
255,
|
|
139
|
-
255,
|
|
140
|
-
255,
|
|
141
|
-
255,
|
|
142
|
-
10,
|
|
143
|
-
11,
|
|
144
|
-
12,
|
|
145
|
-
13,
|
|
146
|
-
14,
|
|
147
|
-
15,
|
|
148
|
-
16,
|
|
149
|
-
17,
|
|
150
|
-
255,
|
|
151
|
-
18,
|
|
152
|
-
19,
|
|
153
|
-
255,
|
|
154
|
-
20,
|
|
155
|
-
21,
|
|
156
|
-
255,
|
|
157
|
-
22,
|
|
158
|
-
23,
|
|
159
|
-
24,
|
|
160
|
-
25,
|
|
161
|
-
26,
|
|
162
|
-
255,
|
|
163
|
-
27,
|
|
164
|
-
28,
|
|
165
|
-
29,
|
|
166
|
-
30,
|
|
167
|
-
31,
|
|
168
|
-
255,
|
|
169
|
-
255,
|
|
170
|
-
255,
|
|
171
|
-
255,
|
|
172
|
-
255,
|
|
173
|
-
255,
|
|
174
|
-
255,
|
|
175
|
-
255,
|
|
176
|
-
255,
|
|
177
|
-
255,
|
|
178
|
-
255,
|
|
179
|
-
255,
|
|
180
|
-
255,
|
|
181
|
-
255,
|
|
182
|
-
255,
|
|
183
|
-
255,
|
|
184
|
-
255,
|
|
185
|
-
255,
|
|
186
|
-
255,
|
|
187
|
-
255,
|
|
188
|
-
255,
|
|
189
|
-
255,
|
|
190
|
-
255,
|
|
191
|
-
255,
|
|
192
|
-
255,
|
|
193
|
-
255,
|
|
194
|
-
255,
|
|
195
|
-
255,
|
|
196
|
-
255,
|
|
197
|
-
255,
|
|
198
|
-
255,
|
|
199
|
-
255,
|
|
200
|
-
255,
|
|
201
|
-
255,
|
|
202
|
-
255,
|
|
203
|
-
255,
|
|
204
|
-
255,
|
|
205
|
-
255,
|
|
206
|
-
255,
|
|
207
|
-
255,
|
|
208
|
-
255,
|
|
209
|
-
255,
|
|
210
|
-
255,
|
|
211
|
-
255,
|
|
212
|
-
255,
|
|
213
|
-
255,
|
|
214
|
-
255,
|
|
215
|
-
255,
|
|
216
|
-
255,
|
|
217
|
-
255,
|
|
218
|
-
255,
|
|
219
|
-
255,
|
|
220
|
-
255,
|
|
221
|
-
255,
|
|
222
|
-
255,
|
|
223
|
-
255,
|
|
224
|
-
255,
|
|
225
|
-
255,
|
|
226
|
-
255,
|
|
227
|
-
255,
|
|
228
|
-
255,
|
|
229
|
-
255,
|
|
230
|
-
255,
|
|
231
|
-
255,
|
|
232
|
-
255,
|
|
233
|
-
255,
|
|
234
|
-
255,
|
|
235
|
-
255,
|
|
236
|
-
255,
|
|
237
|
-
255,
|
|
238
|
-
255,
|
|
239
|
-
255,
|
|
240
|
-
255,
|
|
241
|
-
255,
|
|
242
|
-
255,
|
|
243
|
-
255,
|
|
244
|
-
255,
|
|
245
|
-
255,
|
|
246
|
-
255,
|
|
247
|
-
255,
|
|
248
|
-
255,
|
|
249
|
-
255,
|
|
250
|
-
255,
|
|
251
|
-
255,
|
|
252
|
-
255,
|
|
253
|
-
255,
|
|
254
|
-
255,
|
|
255
|
-
255,
|
|
256
|
-
255,
|
|
257
|
-
255,
|
|
258
|
-
255,
|
|
259
|
-
255,
|
|
260
|
-
255,
|
|
261
|
-
255,
|
|
262
|
-
255,
|
|
263
|
-
255,
|
|
264
|
-
255,
|
|
265
|
-
255,
|
|
266
|
-
255,
|
|
267
|
-
255,
|
|
268
|
-
255,
|
|
269
|
-
255,
|
|
270
|
-
255,
|
|
271
|
-
255,
|
|
272
|
-
255,
|
|
273
|
-
255,
|
|
274
|
-
255,
|
|
275
|
-
255,
|
|
276
|
-
255,
|
|
277
|
-
255,
|
|
278
|
-
255,
|
|
279
|
-
255,
|
|
280
|
-
255,
|
|
281
|
-
255,
|
|
282
|
-
255,
|
|
283
|
-
255,
|
|
284
|
-
255,
|
|
285
|
-
255,
|
|
286
|
-
255,
|
|
287
|
-
255,
|
|
288
|
-
255,
|
|
289
|
-
255,
|
|
290
|
-
255,
|
|
291
|
-
255,
|
|
292
|
-
255,
|
|
293
|
-
255,
|
|
294
|
-
255,
|
|
295
|
-
255,
|
|
296
|
-
255,
|
|
297
|
-
255,
|
|
298
|
-
255,
|
|
299
|
-
255,
|
|
300
|
-
255
|
|
301
|
-
]);
|
|
302
|
-
function ie(e) {
|
|
303
|
-
const n = new Array(26).fill("");
|
|
304
|
-
if (e.length !== 16)
|
|
305
|
-
throw new Error(
|
|
306
|
-
`Invalid length. Expected 16 bytes, got ${e.length}. Input: ${e}`
|
|
307
|
-
);
|
|
308
|
-
return n[0] = h[(e[0] & 224) >> 5], n[1] = h[e[0] & 31], n[2] = h[(e[1] & 248) >> 3], n[3] = h[(e[1] & 7) << 2 | (e[2] & 192) >> 6], n[4] = h[(e[2] & 62) >> 1], n[5] = h[(e[2] & 1) << 4 | (e[3] & 240) >> 4], n[6] = h[(e[3] & 15) << 1 | (e[4] & 128) >> 7], n[7] = h[(e[4] & 124) >> 2], n[8] = h[(e[4] & 3) << 3 | (e[5] & 224) >> 5], n[9] = h[e[5] & 31], n[10] = h[(e[6] & 248) >> 3], n[11] = h[(e[6] & 7) << 2 | (e[7] & 192) >> 6], n[12] = h[(e[7] & 62) >> 1], n[13] = h[(e[7] & 1) << 4 | (e[8] & 240) >> 4], n[14] = h[(e[8] & 15) << 1 | (e[9] & 128) >> 7], n[15] = h[(e[9] & 124) >> 2], n[16] = h[(e[9] & 3) << 3 | (e[10] & 224) >> 5], n[17] = h[e[10] & 31], n[18] = h[(e[11] & 248) >> 3], n[19] = h[(e[11] & 7) << 2 | (e[12] & 192) >> 6], n[20] = h[(e[12] & 62) >> 1], n[21] = h[(e[12] & 1) << 4 | (e[13] & 240) >> 4], n[22] = h[(e[13] & 15) << 1 | (e[14] & 128) >> 7], n[23] = h[(e[14] & 124) >> 2], n[24] = h[(e[14] & 3) << 3 | (e[15] & 224) >> 5], n[25] = h[e[15] & 31], n.join("");
|
|
309
|
-
}
|
|
310
|
-
function xe(e) {
|
|
311
|
-
if (e.length !== 26)
|
|
312
|
-
throw new Error(
|
|
313
|
-
`Invalid length. Expected 26 bytes, got ${e.length}. Input: ${e}`
|
|
314
|
-
);
|
|
315
|
-
const t = new TextEncoder().encode(e);
|
|
316
|
-
if (s[t[0]] === 255 || s[t[1]] === 255 || s[t[2]] === 255 || s[t[3]] === 255 || s[t[4]] === 255 || s[t[5]] === 255 || s[t[6]] === 255 || s[t[7]] === 255 || s[t[8]] === 255 || s[t[9]] === 255 || s[t[10]] === 255 || s[t[11]] === 255 || s[t[12]] === 255 || s[t[13]] === 255 || s[t[14]] === 255 || s[t[15]] === 255 || s[t[16]] === 255 || s[t[17]] === 255 || s[t[18]] === 255 || s[t[19]] === 255 || s[t[20]] === 255 || s[t[21]] === 255 || s[t[22]] === 255 || s[t[23]] === 255 || s[t[24]] === 255 || s[t[25]] === 255)
|
|
317
|
-
throw new Error("Invalid base32 character");
|
|
318
|
-
const i = new Uint8Array(16);
|
|
319
|
-
return i[0] = s[t[0]] << 5 | s[t[1]], i[1] = s[t[2]] << 3 | s[t[3]] >> 2, i[2] = (s[t[3]] & 3) << 6 | s[t[4]] << 1 | s[t[5]] >> 4, i[3] = (s[t[5]] & 15) << 4 | s[t[6]] >> 1, i[4] = (s[t[6]] & 1) << 7 | s[t[7]] << 2 | s[t[8]] >> 3, i[5] = (s[t[8]] & 7) << 5 | s[t[9]], i[6] = s[t[10]] << 3 | s[t[11]] >> 2, i[7] = (s[t[11]] & 3) << 6 | s[t[12]] << 1 | s[t[13]] >> 4, i[8] = (s[t[13]] & 15) << 4 | s[t[14]] >> 1, i[9] = (s[t[14]] & 1) << 7 | s[t[15]] << 2 | s[t[16]] >> 3, i[10] = (s[t[16]] & 7) << 5 | s[t[17]], i[11] = s[t[18]] << 3 | s[t[19]] >> 2, i[12] = (s[t[19]] & 3) << 6 | s[t[20]] << 1 | s[t[21]] >> 4, i[13] = (s[t[21]] & 15) << 4 | s[t[22]] >> 1, i[14] = (s[t[22]] & 1) << 7 | s[t[23]] << 2 | s[t[24]] >> 3, i[15] = (s[t[24]] & 7) << 5 | s[t[25]], i;
|
|
320
|
-
}
|
|
321
|
-
function qe(e) {
|
|
322
|
-
if (e.length > 63)
|
|
323
|
-
return !1;
|
|
324
|
-
let n, t, i;
|
|
325
|
-
for (t = 0, i = e.length; t < i; t += 1) {
|
|
326
|
-
n = e.charCodeAt(t);
|
|
327
|
-
const c = n > 96 && n < 123, m = n === 95;
|
|
328
|
-
if ((t === 0 || t === i - 1) && !c || !(c || m))
|
|
329
|
-
return !1;
|
|
330
|
-
}
|
|
331
|
-
return !0;
|
|
332
|
-
}
|
|
333
|
-
var Ne = class extends Error {
|
|
334
|
-
constructor(e) {
|
|
335
|
-
super(`Invalid prefix "${e}". Must be at most 63 ASCII letters [a-z_]`), this.name = "InvalidPrefixError";
|
|
336
|
-
}
|
|
337
|
-
}, Me = class extends Error {
|
|
338
|
-
constructor(e, n) {
|
|
339
|
-
super(`Invalid TypeId. Prefix mismatch. Expected ${e}, got ${n}`), this.name = "PrefixMismatchError";
|
|
340
|
-
}
|
|
341
|
-
}, Be = class extends Error {
|
|
342
|
-
constructor(e) {
|
|
343
|
-
super(`Invalid TypeId. Prefix cannot be empty when there's a separator: ${e}`), this.name = "EmptyPrefixError";
|
|
344
|
-
}
|
|
345
|
-
}, Le = class extends Error {
|
|
346
|
-
constructor(e) {
|
|
347
|
-
super(`Invalid length. Suffix should have 26 characters, got ${e}`), this.name = "InvalidSuffixLengthError";
|
|
348
|
-
}
|
|
349
|
-
}, He = class extends Error {
|
|
350
|
-
constructor(e) {
|
|
351
|
-
super(`Invalid suffix. First character "${e}" must be in the range [0-7]`), this.name = "InvalidSuffixCharacterError";
|
|
352
|
-
}
|
|
353
|
-
}, Ge = class extends Error {
|
|
354
|
-
constructor(e, n) {
|
|
355
|
-
super(`Cannot convert TypeID of type ${e} to type ${n}`), this.name = "TypeIDConversionError";
|
|
356
|
-
}
|
|
357
|
-
};
|
|
358
|
-
function Se(e = "", n = "") {
|
|
359
|
-
if (!qe(e))
|
|
360
|
-
throw new Ne(e);
|
|
361
|
-
let t;
|
|
362
|
-
if (n)
|
|
363
|
-
t = n;
|
|
364
|
-
else {
|
|
365
|
-
const i = new Uint8Array(16);
|
|
366
|
-
Re(void 0, i), t = ie(i);
|
|
367
|
-
}
|
|
368
|
-
if (t.length !== 26)
|
|
369
|
-
throw new Le(t.length);
|
|
370
|
-
if (t[0] > "7")
|
|
371
|
-
throw new He(t[0]);
|
|
372
|
-
return xe(t), e === "" ? t : `${e}_${t}`;
|
|
373
|
-
}
|
|
374
|
-
function Ke(e, n) {
|
|
375
|
-
let t, i;
|
|
376
|
-
const c = e.lastIndexOf("_");
|
|
377
|
-
if (c === -1)
|
|
378
|
-
t = "", i = e;
|
|
379
|
-
else if (t = e.substring(0, c), i = e.substring(c + 1), !t)
|
|
380
|
-
throw new Be(e);
|
|
381
|
-
if (!i)
|
|
382
|
-
throw new Le(0);
|
|
383
|
-
if (n && t !== n)
|
|
384
|
-
throw new Me(n, t);
|
|
385
|
-
return Se(t, i);
|
|
386
|
-
}
|
|
387
|
-
function ge(e) {
|
|
388
|
-
const n = e.lastIndexOf("_");
|
|
389
|
-
return n === -1 ? "" : e.substring(0, n);
|
|
390
|
-
}
|
|
391
|
-
function ve(e) {
|
|
392
|
-
const n = e.lastIndexOf("_");
|
|
393
|
-
return n === -1 ? e : e.substring(n + 1);
|
|
394
|
-
}
|
|
395
|
-
var D = class {
|
|
396
|
-
constructor(e, n = "") {
|
|
397
|
-
this.prefix = e, this.suffix = n;
|
|
398
|
-
const t = Se(e, n);
|
|
399
|
-
this.prefix = ge(t), this.suffix = ve(t);
|
|
400
|
-
}
|
|
401
|
-
getType() {
|
|
402
|
-
return this.prefix;
|
|
403
|
-
}
|
|
404
|
-
getSuffix() {
|
|
405
|
-
return this.suffix;
|
|
406
|
-
}
|
|
407
|
-
asType(e) {
|
|
408
|
-
const n = this;
|
|
409
|
-
if (n.prefix !== e)
|
|
410
|
-
throw new Ge(n.prefix, e);
|
|
411
|
-
return n;
|
|
412
|
-
}
|
|
413
|
-
toUUIDBytes() {
|
|
414
|
-
return xe(this.suffix);
|
|
415
|
-
}
|
|
416
|
-
toUUID() {
|
|
417
|
-
return Pe(this.toUUIDBytes());
|
|
418
|
-
}
|
|
419
|
-
toString() {
|
|
420
|
-
return this.prefix === "" ? this.suffix : `${this.prefix}_${this.suffix}`;
|
|
421
|
-
}
|
|
422
|
-
static fromString(e, n) {
|
|
423
|
-
const t = Ke(e, n);
|
|
424
|
-
return new D(ge(t), ve(t));
|
|
425
|
-
}
|
|
426
|
-
static fromUUIDBytes(e, n) {
|
|
427
|
-
const t = ie(n);
|
|
428
|
-
return new D(e, t);
|
|
429
|
-
}
|
|
430
|
-
static fromUUID(e, n) {
|
|
431
|
-
const t = ie(Ve(n));
|
|
432
|
-
return new D(e, t);
|
|
433
|
-
}
|
|
434
|
-
};
|
|
435
|
-
function se(e = "", n = "") {
|
|
436
|
-
return new D(e, n);
|
|
437
|
-
}
|
|
438
|
-
function Je() {
|
|
439
|
-
return se("lse");
|
|
440
|
-
}
|
|
441
|
-
function pe(e) {
|
|
442
|
-
return D.fromString(e, "lse");
|
|
443
|
-
}
|
|
444
|
-
function K() {
|
|
445
|
-
return se("lev");
|
|
446
|
-
}
|
|
447
|
-
function Xe(e) {
|
|
448
|
-
return D.fromString(e, "lev");
|
|
449
|
-
}
|
|
450
|
-
function Qe() {
|
|
451
|
-
return se("lst");
|
|
452
|
-
}
|
|
453
|
-
function Oe(e) {
|
|
454
|
-
return D.fromString(e, "lst");
|
|
455
|
-
}
|
|
456
|
-
function We(e) {
|
|
457
|
-
const n = new Date(e);
|
|
458
|
-
if (Number.isNaN(n.getTime()))
|
|
459
|
-
throw new Q(`Invalid Timestamp: "${e}" does not parse as a valid date`);
|
|
460
|
-
return e;
|
|
461
|
-
}
|
|
462
|
-
function J() {
|
|
463
|
-
return (/* @__PURE__ */ new Date()).toISOString();
|
|
464
|
-
}
|
|
465
|
-
class W {
|
|
466
|
-
#t;
|
|
467
|
-
#i;
|
|
468
|
-
#n;
|
|
469
|
-
#e;
|
|
470
|
-
constructor(n) {
|
|
471
|
-
this.#t = n, this.#i = void 0, this.#n = /* @__PURE__ */ new Map(), this.#e = [];
|
|
472
|
-
}
|
|
473
|
-
get id() {
|
|
474
|
-
return this.#t;
|
|
475
|
-
}
|
|
476
|
-
get title() {
|
|
477
|
-
return this.#i;
|
|
478
|
-
}
|
|
479
|
-
get elements() {
|
|
480
|
-
return [...this.#n.values()];
|
|
481
|
-
}
|
|
482
|
-
// ─────────────────────────────────────────────── Factory
|
|
483
|
-
/**
|
|
484
|
-
* Creates a new List aggregate and emits ListCreated.
|
|
485
|
-
* Generates a ListId if not provided in the command.
|
|
486
|
-
*/
|
|
487
|
-
static create(n) {
|
|
488
|
-
const t = n.listId ?? Qe(), i = new W(t), c = {
|
|
489
|
-
type: "ListCreated",
|
|
490
|
-
listEventId: K(),
|
|
491
|
-
listId: t,
|
|
492
|
-
actorId: n.actorId,
|
|
493
|
-
timestamp: J(),
|
|
494
|
-
...n.title !== void 0 ? { title: n.title } : {}
|
|
495
|
-
};
|
|
496
|
-
return i.#r(c), i.#e.push(c), { list: i, event: c };
|
|
497
|
-
}
|
|
498
|
-
// ─────────────────────────────────────────────── Rehydration
|
|
499
|
-
/**
|
|
500
|
-
* Reconstructs a List from its full event log.
|
|
501
|
-
* The resulting List has no uncommitted events.
|
|
502
|
-
*/
|
|
503
|
-
static rehydrate(n, t) {
|
|
504
|
-
const i = new W(n);
|
|
505
|
-
for (const c of t)
|
|
506
|
-
i.#r(c);
|
|
507
|
-
return i;
|
|
508
|
-
}
|
|
509
|
-
// ─────────────────────────────────────────────── Command Handlers
|
|
510
|
-
/**
|
|
511
|
-
* Appends a new ListElement to the List.
|
|
512
|
-
* Invariant: content must be non-empty after trimming (enforced at ListElementContent creation).
|
|
513
|
-
*/
|
|
514
|
-
addListElement(n) {
|
|
515
|
-
const t = Je(), i = {
|
|
516
|
-
type: "ListElementAdded",
|
|
517
|
-
listEventId: K(),
|
|
518
|
-
listId: this.#t,
|
|
519
|
-
actorId: n.actorId,
|
|
520
|
-
timestamp: J(),
|
|
521
|
-
listElementId: t,
|
|
522
|
-
content: n.content
|
|
523
|
-
};
|
|
524
|
-
return this.#r(i), this.#e.push(i), i;
|
|
525
|
-
}
|
|
526
|
-
/**
|
|
527
|
-
* Removes a ListElement from the List by its stable identity.
|
|
528
|
-
* Invariant: the ListElementId must exist in the current elements.
|
|
529
|
-
* Throws ListElementNotFoundError if not found.
|
|
530
|
-
*/
|
|
531
|
-
deleteListElement(n) {
|
|
532
|
-
const t = n.listElementId.toString();
|
|
533
|
-
if (!this.#n.has(t))
|
|
534
|
-
throw new ke(t);
|
|
535
|
-
const i = {
|
|
536
|
-
type: "ListElementDeleted",
|
|
537
|
-
listEventId: K(),
|
|
538
|
-
listId: this.#t,
|
|
539
|
-
actorId: n.actorId,
|
|
540
|
-
timestamp: J(),
|
|
541
|
-
listElementId: n.listElementId
|
|
542
|
-
};
|
|
543
|
-
return this.#r(i), this.#e.push(i), i;
|
|
544
|
-
}
|
|
545
|
-
/**
|
|
546
|
-
* Emits a ListExported audit event.
|
|
547
|
-
* Export is always valid — no invariants to check.
|
|
548
|
-
*/
|
|
549
|
-
exportListDocument(n) {
|
|
550
|
-
const t = {
|
|
551
|
-
type: "ListExported",
|
|
552
|
-
listEventId: K(),
|
|
553
|
-
listId: this.#t,
|
|
554
|
-
actorId: n.actorId,
|
|
555
|
-
timestamp: J(),
|
|
556
|
-
format: "json-ld"
|
|
557
|
-
};
|
|
558
|
-
return this.#r(t), this.#e.push(t), t;
|
|
559
|
-
}
|
|
560
|
-
// ─────────────────────────────────────────────── Uncommitted Events
|
|
561
|
-
/** Returns all events emitted since the last load/save. */
|
|
562
|
-
getUncommittedEvents() {
|
|
563
|
-
return [...this.#e];
|
|
564
|
-
}
|
|
565
|
-
/** Clears uncommitted events after they have been persisted. */
|
|
566
|
-
markEventsAsCommitted() {
|
|
567
|
-
this.#e.length = 0;
|
|
568
|
-
}
|
|
569
|
-
// ─────────────────────────────────────────────── Private State Mutation
|
|
570
|
-
/** Mutates state from a single event. Used by both command handlers and rehydration. */
|
|
571
|
-
#r(n) {
|
|
572
|
-
({
|
|
573
|
-
ListCreated: (i) => {
|
|
574
|
-
this.#i = i.title;
|
|
575
|
-
},
|
|
576
|
-
ListElementAdded: (i) => {
|
|
577
|
-
this.#n.set(i.listElementId.toString(), {
|
|
578
|
-
id: i.listElementId,
|
|
579
|
-
content: i.content,
|
|
580
|
-
addedAt: i.timestamp
|
|
581
|
-
});
|
|
582
|
-
},
|
|
583
|
-
ListElementDeleted: (i) => {
|
|
584
|
-
this.#n.delete(i.listElementId.toString());
|
|
585
|
-
},
|
|
586
|
-
// Audit-only event — no state change
|
|
587
|
-
ListExported: (i) => {
|
|
588
|
-
}
|
|
589
|
-
})[n.type](n);
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
function Ze(e) {
|
|
593
|
-
return D.fromString(e, "act");
|
|
594
|
-
}
|
|
595
|
-
const be = 2e3;
|
|
596
|
-
function Ye(e) {
|
|
597
|
-
const n = e.trim();
|
|
598
|
-
if (n.length === 0)
|
|
599
|
-
throw new Q("ListElementContent cannot be empty");
|
|
600
|
-
if (n.length > be)
|
|
601
|
-
throw new Q(`ListElementContent exceeds maximum length of ${be} characters`);
|
|
602
|
-
return n;
|
|
603
|
-
}
|
|
604
|
-
const et = {
|
|
605
|
-
"@vocab": "https://schema.org/",
|
|
606
|
-
alistigo: "https://alistigo.ai/vocab/"
|
|
607
|
-
}, tt = "1.0.0";
|
|
608
|
-
function nt(e) {
|
|
609
|
-
const n = {
|
|
610
|
-
"alistigo:listEventId": e.listEventId.toString(),
|
|
611
|
-
"alistigo:listId": e.listId.toString(),
|
|
612
|
-
"alistigo:actorId": e.actorId.toString(),
|
|
613
|
-
"alistigo:timestamp": e.timestamp
|
|
614
|
-
};
|
|
615
|
-
switch (e.type) {
|
|
616
|
-
case "ListCreated":
|
|
617
|
-
return {
|
|
618
|
-
...n,
|
|
619
|
-
"alistigo:eventType": "ListCreated",
|
|
620
|
-
...e.title !== void 0 ? { name: e.title } : {}
|
|
621
|
-
};
|
|
622
|
-
case "ListElementAdded":
|
|
623
|
-
return {
|
|
624
|
-
...n,
|
|
625
|
-
"alistigo:eventType": "ListElementAdded",
|
|
626
|
-
"alistigo:listElementId": e.listElementId.toString(),
|
|
627
|
-
name: e.content
|
|
628
|
-
};
|
|
629
|
-
case "ListElementDeleted":
|
|
630
|
-
return {
|
|
631
|
-
...n,
|
|
632
|
-
"alistigo:eventType": "ListElementDeleted",
|
|
633
|
-
"alistigo:listElementId": e.listElementId.toString()
|
|
634
|
-
};
|
|
635
|
-
case "ListExported":
|
|
636
|
-
return {
|
|
637
|
-
...n,
|
|
638
|
-
"alistigo:eventType": "ListExported"
|
|
639
|
-
};
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
function rt(e) {
|
|
643
|
-
const n = {
|
|
644
|
-
listEventId: Xe(e["alistigo:listEventId"]),
|
|
645
|
-
listId: Oe(e["alistigo:listId"]),
|
|
646
|
-
actorId: Ze(e["alistigo:actorId"]),
|
|
647
|
-
timestamp: We(e["alistigo:timestamp"])
|
|
648
|
-
};
|
|
649
|
-
switch (e["alistigo:eventType"]) {
|
|
650
|
-
case "ListCreated": {
|
|
651
|
-
const t = e;
|
|
652
|
-
return {
|
|
653
|
-
...n,
|
|
654
|
-
type: "ListCreated",
|
|
655
|
-
...t.name !== void 0 ? { title: t.name } : {}
|
|
656
|
-
};
|
|
657
|
-
}
|
|
658
|
-
case "ListElementAdded": {
|
|
659
|
-
const t = e;
|
|
660
|
-
return {
|
|
661
|
-
...n,
|
|
662
|
-
type: "ListElementAdded",
|
|
663
|
-
listElementId: pe(t["alistigo:listElementId"]),
|
|
664
|
-
content: Ye(t.name)
|
|
665
|
-
};
|
|
666
|
-
}
|
|
667
|
-
case "ListElementDeleted":
|
|
668
|
-
return {
|
|
669
|
-
...n,
|
|
670
|
-
type: "ListElementDeleted",
|
|
671
|
-
listElementId: pe(e["alistigo:listElementId"])
|
|
672
|
-
};
|
|
673
|
-
case "ListExported":
|
|
674
|
-
return {
|
|
675
|
-
...n,
|
|
676
|
-
type: "ListExported",
|
|
677
|
-
format: "json-ld"
|
|
678
|
-
};
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
const ye = {
|
|
682
|
-
serialize(e, n) {
|
|
683
|
-
const t = n?.["alistigo:listEventLog"] ?? [], i = e.getUncommittedEvents().map(nt), c = e.elements.map((_, I) => ({
|
|
684
|
-
"@type": "ListItem",
|
|
685
|
-
"alistigo:listElementId": _.id.toString(),
|
|
686
|
-
position: I + 1,
|
|
687
|
-
name: _.content
|
|
688
|
-
})), m = {
|
|
689
|
-
"@context": et,
|
|
690
|
-
"@type": "ItemList",
|
|
691
|
-
"alistigo:listId": e.id.toString(),
|
|
692
|
-
"alistigo:schemaVersion": tt,
|
|
693
|
-
itemListElement: c,
|
|
694
|
-
"alistigo:listEventLog": [...t, ...i]
|
|
695
|
-
};
|
|
696
|
-
return e.title !== void 0 && (m.name = e.title), m;
|
|
697
|
-
},
|
|
698
|
-
deserialize(e) {
|
|
699
|
-
const n = Oe(e["alistigo:listId"]), t = e["alistigo:listEventLog"].map(rt);
|
|
700
|
-
return W.rehydrate(n, t);
|
|
701
|
-
}
|
|
702
|
-
};
|
|
703
|
-
function it(e) {
|
|
704
|
-
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
705
|
-
}
|
|
706
|
-
var F = { exports: {} }, re, Ee;
|
|
707
|
-
function st() {
|
|
708
|
-
if (Ee) return re;
|
|
709
|
-
Ee = 1;
|
|
710
|
-
function e(t) {
|
|
1
|
+
function le() {
|
|
2
|
+
try {
|
|
3
|
+
return new URL(document.baseURI).pathname;
|
|
4
|
+
} catch {
|
|
5
|
+
return "";
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
function ue() {
|
|
9
|
+
if (window.claudeArtifactStatus === "published")
|
|
10
|
+
return { published: !0, artifactId: null };
|
|
11
|
+
const d = le().match(/^\/artifact\/([0-9a-f-]{36})/i);
|
|
12
|
+
return { published: !!d, artifactId: d?.[1] ?? null };
|
|
13
|
+
}
|
|
14
|
+
function ce(d) {
|
|
15
|
+
return d && d.__esModule && Object.prototype.hasOwnProperty.call(d, "default") ? d.default : d;
|
|
16
|
+
}
|
|
17
|
+
var F = { exports: {} }, G, Z;
|
|
18
|
+
function fe() {
|
|
19
|
+
if (Z) return G;
|
|
20
|
+
Z = 1;
|
|
21
|
+
function d(i) {
|
|
711
22
|
try {
|
|
712
|
-
return JSON.stringify(
|
|
23
|
+
return JSON.stringify(i);
|
|
713
24
|
} catch {
|
|
714
25
|
return '"[Circular]"';
|
|
715
26
|
}
|
|
716
27
|
}
|
|
717
|
-
|
|
718
|
-
function
|
|
719
|
-
var
|
|
720
|
-
if (typeof
|
|
721
|
-
var
|
|
722
|
-
if (
|
|
723
|
-
var
|
|
724
|
-
|
|
725
|
-
for (var
|
|
726
|
-
|
|
727
|
-
return
|
|
28
|
+
G = s;
|
|
29
|
+
function s(i, u, m) {
|
|
30
|
+
var E = m && m.stringify || d, V = 1;
|
|
31
|
+
if (typeof i == "object" && i !== null) {
|
|
32
|
+
var z = u.length + V;
|
|
33
|
+
if (z === 1) return i;
|
|
34
|
+
var C = new Array(z);
|
|
35
|
+
C[0] = E(i);
|
|
36
|
+
for (var k = 1; k < z; k++)
|
|
37
|
+
C[k] = E(u[k]);
|
|
38
|
+
return C.join(" ");
|
|
728
39
|
}
|
|
729
|
-
if (typeof
|
|
730
|
-
return
|
|
731
|
-
var
|
|
732
|
-
if (
|
|
733
|
-
for (var
|
|
734
|
-
if (
|
|
735
|
-
switch (
|
|
40
|
+
if (typeof i != "string")
|
|
41
|
+
return i;
|
|
42
|
+
var w = u.length;
|
|
43
|
+
if (w === 0) return i;
|
|
44
|
+
for (var v = "", h = 1 - V, c = -1, j = i && i.length || 0, l = 0; l < j; ) {
|
|
45
|
+
if (i.charCodeAt(l) === 37 && l + 1 < j) {
|
|
46
|
+
switch (c = c > -1 ? c : 0, i.charCodeAt(l + 1)) {
|
|
736
47
|
case 100:
|
|
737
48
|
// 'd'
|
|
738
49
|
case 102:
|
|
739
|
-
if (
|
|
740
|
-
|
|
50
|
+
if (h >= w || u[h] == null) break;
|
|
51
|
+
c < l && (v += i.slice(c, l)), v += Number(u[h]), c = l + 2, l++;
|
|
741
52
|
break;
|
|
742
53
|
case 105:
|
|
743
|
-
if (
|
|
744
|
-
|
|
54
|
+
if (h >= w || u[h] == null) break;
|
|
55
|
+
c < l && (v += i.slice(c, l)), v += Math.floor(Number(u[h])), c = l + 2, l++;
|
|
745
56
|
break;
|
|
746
57
|
case 79:
|
|
747
58
|
// 'O'
|
|
748
59
|
case 111:
|
|
749
60
|
// 'o'
|
|
750
61
|
case 106:
|
|
751
|
-
if (
|
|
752
|
-
|
|
753
|
-
var
|
|
754
|
-
if (
|
|
755
|
-
|
|
62
|
+
if (h >= w || u[h] === void 0) break;
|
|
63
|
+
c < l && (v += i.slice(c, l));
|
|
64
|
+
var R = typeof u[h];
|
|
65
|
+
if (R === "string") {
|
|
66
|
+
v += "'" + u[h] + "'", c = l + 2, l++;
|
|
756
67
|
break;
|
|
757
68
|
}
|
|
758
|
-
if (
|
|
759
|
-
|
|
69
|
+
if (R === "function") {
|
|
70
|
+
v += u[h].name || "<anonymous>", c = l + 2, l++;
|
|
760
71
|
break;
|
|
761
72
|
}
|
|
762
|
-
|
|
73
|
+
v += E(u[h]), c = l + 2, l++;
|
|
763
74
|
break;
|
|
764
75
|
case 115:
|
|
765
|
-
if (
|
|
76
|
+
if (h >= w)
|
|
766
77
|
break;
|
|
767
|
-
|
|
78
|
+
c < l && (v += i.slice(c, l)), v += String(u[h]), c = l + 2, l++;
|
|
768
79
|
break;
|
|
769
80
|
case 37:
|
|
770
|
-
|
|
81
|
+
c < l && (v += i.slice(c, l)), v += "%", c = l + 2, l++, h--;
|
|
771
82
|
break;
|
|
772
83
|
}
|
|
773
|
-
++
|
|
84
|
+
++h;
|
|
774
85
|
}
|
|
775
|
-
++
|
|
86
|
+
++l;
|
|
776
87
|
}
|
|
777
|
-
return
|
|
778
|
-
}
|
|
779
|
-
return
|
|
780
|
-
}
|
|
781
|
-
var
|
|
782
|
-
function
|
|
783
|
-
if (
|
|
784
|
-
|
|
785
|
-
const
|
|
786
|
-
F.exports =
|
|
787
|
-
const
|
|
788
|
-
mapHttpRequest:
|
|
789
|
-
mapHttpResponse:
|
|
790
|
-
wrapRequestSerializer:
|
|
791
|
-
wrapResponseSerializer:
|
|
792
|
-
wrapErrorSerializer:
|
|
793
|
-
req:
|
|
794
|
-
res:
|
|
795
|
-
err:
|
|
796
|
-
errWithCause:
|
|
88
|
+
return c === -1 ? i : (c < j && (v += i.slice(c)), v);
|
|
89
|
+
}
|
|
90
|
+
return G;
|
|
91
|
+
}
|
|
92
|
+
var ee;
|
|
93
|
+
function de() {
|
|
94
|
+
if (ee) return F.exports;
|
|
95
|
+
ee = 1;
|
|
96
|
+
const d = fe();
|
|
97
|
+
F.exports = w;
|
|
98
|
+
const s = oe().console || {}, i = {
|
|
99
|
+
mapHttpRequest: I,
|
|
100
|
+
mapHttpResponse: I,
|
|
101
|
+
wrapRequestSerializer: N,
|
|
102
|
+
wrapResponseSerializer: N,
|
|
103
|
+
wrapErrorSerializer: N,
|
|
104
|
+
req: I,
|
|
105
|
+
res: I,
|
|
106
|
+
err: J,
|
|
107
|
+
errWithCause: J
|
|
797
108
|
};
|
|
798
|
-
function
|
|
799
|
-
return
|
|
109
|
+
function u(e, t) {
|
|
110
|
+
return e === "silent" ? 1 / 0 : t.levels.values[e];
|
|
800
111
|
}
|
|
801
|
-
const
|
|
112
|
+
const m = /* @__PURE__ */ Symbol("pino.logFuncs"), E = /* @__PURE__ */ Symbol("pino.hierarchy"), V = {
|
|
802
113
|
error: "log",
|
|
803
114
|
fatal: "error",
|
|
804
115
|
warn: "error",
|
|
@@ -806,110 +117,110 @@ function ot() {
|
|
|
806
117
|
debug: "log",
|
|
807
118
|
trace: "log"
|
|
808
119
|
};
|
|
809
|
-
function
|
|
810
|
-
const
|
|
811
|
-
logger:
|
|
812
|
-
parent:
|
|
120
|
+
function z(e, t) {
|
|
121
|
+
const n = {
|
|
122
|
+
logger: t,
|
|
123
|
+
parent: e[E]
|
|
813
124
|
};
|
|
814
|
-
|
|
125
|
+
t[E] = n;
|
|
815
126
|
}
|
|
816
|
-
function
|
|
817
|
-
const
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
}),
|
|
821
|
-
}
|
|
822
|
-
function
|
|
823
|
-
return Array.isArray(
|
|
824
|
-
return
|
|
825
|
-
}) :
|
|
826
|
-
}
|
|
827
|
-
function
|
|
828
|
-
|
|
829
|
-
const
|
|
830
|
-
if (
|
|
127
|
+
function C(e, t, n) {
|
|
128
|
+
const a = {};
|
|
129
|
+
t.forEach((o) => {
|
|
130
|
+
a[o] = n[o] ? n[o] : s[o] || s[V[o] || "log"] || L;
|
|
131
|
+
}), e[m] = a;
|
|
132
|
+
}
|
|
133
|
+
function k(e, t) {
|
|
134
|
+
return Array.isArray(e) ? e.filter(function(a) {
|
|
135
|
+
return a !== "!stdSerializers.err";
|
|
136
|
+
}) : e === !0 ? Object.keys(t) : !1;
|
|
137
|
+
}
|
|
138
|
+
function w(e) {
|
|
139
|
+
e = e || {}, e.browser = e.browser || {};
|
|
140
|
+
const t = e.browser.transmit;
|
|
141
|
+
if (t && typeof t.send != "function")
|
|
831
142
|
throw Error("pino: transmit option must have a send function");
|
|
832
|
-
const
|
|
833
|
-
|
|
834
|
-
const
|
|
835
|
-
let
|
|
836
|
-
Array.isArray(
|
|
837
|
-
const
|
|
838
|
-
typeof
|
|
839
|
-
|
|
840
|
-
}), (
|
|
841
|
-
const
|
|
842
|
-
|
|
843
|
-
get:
|
|
844
|
-
}), Object.defineProperty(
|
|
845
|
-
get:
|
|
846
|
-
set:
|
|
143
|
+
const n = e.browser.write || s;
|
|
144
|
+
e.browser.write && (e.browser.asObject = !0);
|
|
145
|
+
const a = e.serializers || {}, o = k(e.browser.serialize, a);
|
|
146
|
+
let g = e.browser.serialize;
|
|
147
|
+
Array.isArray(e.browser.serialize) && e.browser.serialize.indexOf("!stdSerializers.err") > -1 && (g = !1);
|
|
148
|
+
const O = Object.keys(e.customLevels || {}), f = ["error", "fatal", "warn", "info", "debug", "trace"].concat(O);
|
|
149
|
+
typeof n == "function" && f.forEach(function(p) {
|
|
150
|
+
n[p] = n;
|
|
151
|
+
}), (e.enabled === !1 || e.browser.disabled) && (e.level = "silent");
|
|
152
|
+
const y = e.level || "info", r = Object.create(n);
|
|
153
|
+
r.log || (r.log = L), C(r, f, n), z({}, r), Object.defineProperty(r, "levelVal", {
|
|
154
|
+
get: S
|
|
155
|
+
}), Object.defineProperty(r, "level", {
|
|
156
|
+
get: D,
|
|
157
|
+
set: x
|
|
847
158
|
});
|
|
848
|
-
const
|
|
849
|
-
transmit:
|
|
850
|
-
serialize:
|
|
851
|
-
asObject:
|
|
852
|
-
asObjectBindingsOnly:
|
|
853
|
-
formatters:
|
|
854
|
-
levels:
|
|
855
|
-
timestamp:
|
|
856
|
-
messageKey:
|
|
857
|
-
onChild:
|
|
159
|
+
const b = {
|
|
160
|
+
transmit: t,
|
|
161
|
+
serialize: o,
|
|
162
|
+
asObject: e.browser.asObject,
|
|
163
|
+
asObjectBindingsOnly: e.browser.asObjectBindingsOnly,
|
|
164
|
+
formatters: e.browser.formatters,
|
|
165
|
+
levels: f,
|
|
166
|
+
timestamp: ie(e),
|
|
167
|
+
messageKey: e.messageKey || "msg",
|
|
168
|
+
onChild: e.onChild || L
|
|
858
169
|
};
|
|
859
|
-
|
|
860
|
-
return this.levels.values[
|
|
861
|
-
},
|
|
862
|
-
return
|
|
863
|
-
},
|
|
864
|
-
function
|
|
865
|
-
return
|
|
170
|
+
r.levels = v(e), r.level = y, r.isLevelEnabled = function(p) {
|
|
171
|
+
return this.levels.values[p] ? this.levels.values[p] >= this.levels.values[this.level] : !1;
|
|
172
|
+
}, r.setMaxListeners = r.getMaxListeners = r.emit = r.addListener = r.on = r.prependListener = r.once = r.prependOnceListener = r.removeListener = r.removeAllListeners = r.listeners = r.listenerCount = r.eventNames = r.write = r.flush = L, r.serializers = a, r._serialize = o, r._stdErrSerialize = g, r.child = function(...p) {
|
|
173
|
+
return Q.call(this, b, ...p);
|
|
174
|
+
}, t && (r._logEvent = K());
|
|
175
|
+
function S() {
|
|
176
|
+
return u(this.level, this);
|
|
866
177
|
}
|
|
867
|
-
function
|
|
178
|
+
function D() {
|
|
868
179
|
return this._level;
|
|
869
180
|
}
|
|
870
|
-
function
|
|
871
|
-
if (
|
|
872
|
-
throw Error("unknown level " +
|
|
873
|
-
this._level =
|
|
874
|
-
|
|
181
|
+
function x(p) {
|
|
182
|
+
if (p !== "silent" && !this.levels.values[p])
|
|
183
|
+
throw Error("unknown level " + p);
|
|
184
|
+
this._level = p, j(this, b, r, "error"), j(this, b, r, "fatal"), j(this, b, r, "warn"), j(this, b, r, "info"), j(this, b, r, "debug"), j(this, b, r, "trace"), O.forEach((_) => {
|
|
185
|
+
j(this, b, r, _);
|
|
875
186
|
});
|
|
876
187
|
}
|
|
877
|
-
function
|
|
878
|
-
if (!
|
|
188
|
+
function Q(p, _, A) {
|
|
189
|
+
if (!_)
|
|
879
190
|
throw new Error("missing bindings for child Pino");
|
|
880
|
-
|
|
881
|
-
const
|
|
882
|
-
if (
|
|
883
|
-
var B = Object.assign({},
|
|
884
|
-
delete
|
|
191
|
+
A = A || {}, o && _.serializers && (A.serializers = _.serializers);
|
|
192
|
+
const $ = A.serializers;
|
|
193
|
+
if (o && $) {
|
|
194
|
+
var B = Object.assign({}, a, $), X = e.browser.serialize === !0 ? Object.keys(B) : o;
|
|
195
|
+
delete _.serializers, U([_], X, B, this._stdErrSerialize);
|
|
885
196
|
}
|
|
886
|
-
function
|
|
887
|
-
this._childLevel = (
|
|
888
|
-
[].concat(
|
|
197
|
+
function Y(M) {
|
|
198
|
+
this._childLevel = (M._childLevel | 0) + 1, this.bindings = _, B && (this.serializers = B, this._serialize = X), t && (this._logEvent = K(
|
|
199
|
+
[].concat(M._logEvent.bindings, _)
|
|
889
200
|
));
|
|
890
201
|
}
|
|
891
|
-
|
|
892
|
-
const
|
|
893
|
-
return
|
|
894
|
-
return
|
|
895
|
-
},
|
|
202
|
+
Y.prototype = this;
|
|
203
|
+
const P = new Y(this);
|
|
204
|
+
return z(this, P), P.child = function(...M) {
|
|
205
|
+
return Q.call(this, p, ...M);
|
|
206
|
+
}, P.level = A.level || this.level, p.onChild(P), P;
|
|
896
207
|
}
|
|
897
|
-
return
|
|
208
|
+
return r;
|
|
898
209
|
}
|
|
899
|
-
function
|
|
900
|
-
const
|
|
210
|
+
function v(e) {
|
|
211
|
+
const t = e.customLevels || {}, n = Object.assign({}, w.levels.values, t), a = Object.assign({}, w.levels.labels, h(t));
|
|
901
212
|
return {
|
|
902
|
-
values:
|
|
903
|
-
labels:
|
|
213
|
+
values: n,
|
|
214
|
+
labels: a
|
|
904
215
|
};
|
|
905
216
|
}
|
|
906
|
-
function
|
|
907
|
-
const
|
|
908
|
-
return Object.keys(
|
|
909
|
-
|
|
910
|
-
}),
|
|
217
|
+
function h(e) {
|
|
218
|
+
const t = {};
|
|
219
|
+
return Object.keys(e).forEach(function(n) {
|
|
220
|
+
t[e[n]] = n;
|
|
221
|
+
}), t;
|
|
911
222
|
}
|
|
912
|
-
|
|
223
|
+
w.levels = {
|
|
913
224
|
values: {
|
|
914
225
|
fatal: 60,
|
|
915
226
|
error: 50,
|
|
@@ -926,146 +237,146 @@ function ot() {
|
|
|
926
237
|
50: "error",
|
|
927
238
|
60: "fatal"
|
|
928
239
|
}
|
|
929
|
-
},
|
|
930
|
-
function
|
|
931
|
-
const
|
|
932
|
-
|
|
933
|
-
let
|
|
934
|
-
for (;
|
|
935
|
-
|
|
936
|
-
return
|
|
937
|
-
}
|
|
938
|
-
function
|
|
939
|
-
if (Object.defineProperty(
|
|
940
|
-
value:
|
|
240
|
+
}, w.stdSerializers = i, w.stdTimeFunctions = Object.assign({}, { nullTime: W, epochTime: H, unixTime: se, isoTime: ae });
|
|
241
|
+
function c(e) {
|
|
242
|
+
const t = [];
|
|
243
|
+
e.bindings && t.push(e.bindings);
|
|
244
|
+
let n = e[E];
|
|
245
|
+
for (; n.parent; )
|
|
246
|
+
n = n.parent, n.logger.bindings && t.push(n.logger.bindings);
|
|
247
|
+
return t.reverse();
|
|
248
|
+
}
|
|
249
|
+
function j(e, t, n, a) {
|
|
250
|
+
if (Object.defineProperty(e, a, {
|
|
251
|
+
value: u(e.level, n) > u(a, n) ? L : n[m][a],
|
|
941
252
|
writable: !0,
|
|
942
253
|
enumerable: !0,
|
|
943
254
|
configurable: !0
|
|
944
|
-
}),
|
|
945
|
-
if (!
|
|
946
|
-
const
|
|
947
|
-
if (
|
|
255
|
+
}), e[a] === L) {
|
|
256
|
+
if (!t.transmit) return;
|
|
257
|
+
const g = t.transmit.level || e.level, O = u(g, n);
|
|
258
|
+
if (u(a, n) < O) return;
|
|
948
259
|
}
|
|
949
|
-
|
|
950
|
-
const
|
|
951
|
-
|
|
260
|
+
e[a] = R(e, t, n, a);
|
|
261
|
+
const o = c(e);
|
|
262
|
+
o.length !== 0 && (e[a] = l(o, e[a]));
|
|
952
263
|
}
|
|
953
|
-
function
|
|
264
|
+
function l(e, t) {
|
|
954
265
|
return function() {
|
|
955
|
-
return
|
|
266
|
+
return t.apply(this, [...e, ...arguments]);
|
|
956
267
|
};
|
|
957
268
|
}
|
|
958
|
-
function
|
|
959
|
-
return /* @__PURE__ */ (function(
|
|
269
|
+
function R(e, t, n, a) {
|
|
270
|
+
return /* @__PURE__ */ (function(o) {
|
|
960
271
|
return function() {
|
|
961
|
-
const
|
|
962
|
-
for (var
|
|
963
|
-
var
|
|
964
|
-
if (
|
|
965
|
-
const
|
|
966
|
-
if (
|
|
967
|
-
|
|
968
|
-
ts:
|
|
969
|
-
methodLevel:
|
|
970
|
-
methodValue:
|
|
971
|
-
transmitValue:
|
|
972
|
-
send:
|
|
973
|
-
val:
|
|
974
|
-
},
|
|
272
|
+
const O = t.timestamp(), f = new Array(arguments.length), y = Object.getPrototypeOf && Object.getPrototypeOf(this) === s ? s : this;
|
|
273
|
+
for (var r = 0; r < f.length; r++) f[r] = arguments[r];
|
|
274
|
+
var b = !1;
|
|
275
|
+
if (t.serialize && (U(f, this._serialize, this.serializers, this._stdErrSerialize), b = !0), t.asObject || t.formatters ? o.call(y, ...re(this, a, f, O, t)) : o.apply(y, f), t.transmit) {
|
|
276
|
+
const S = t.transmit.level || e._level, D = u(S, n), x = u(a, n);
|
|
277
|
+
if (x < D) return;
|
|
278
|
+
ne(this, {
|
|
279
|
+
ts: O,
|
|
280
|
+
methodLevel: a,
|
|
281
|
+
methodValue: x,
|
|
282
|
+
transmitValue: n.levels.values[t.transmit.level || e._level],
|
|
283
|
+
send: t.transmit.send,
|
|
284
|
+
val: u(e._level, n)
|
|
285
|
+
}, f, b);
|
|
975
286
|
}
|
|
976
287
|
};
|
|
977
|
-
})(
|
|
288
|
+
})(e[m][a]);
|
|
978
289
|
}
|
|
979
|
-
function
|
|
290
|
+
function re(e, t, n, a, o) {
|
|
980
291
|
const {
|
|
981
|
-
level:
|
|
982
|
-
log:
|
|
983
|
-
} =
|
|
984
|
-
let
|
|
985
|
-
const
|
|
986
|
-
let
|
|
987
|
-
if (
|
|
988
|
-
const
|
|
989
|
-
Object.assign(
|
|
292
|
+
level: g,
|
|
293
|
+
log: O = (S) => S
|
|
294
|
+
} = o.formatters || {}, f = n.slice();
|
|
295
|
+
let y = f[0];
|
|
296
|
+
const r = {};
|
|
297
|
+
let b = (e._childLevel | 0) + 1;
|
|
298
|
+
if (b < 1 && (b = 1), a && (r.time = a), g) {
|
|
299
|
+
const S = g(t, e.levels.values[t]);
|
|
300
|
+
Object.assign(r, S);
|
|
990
301
|
} else
|
|
991
|
-
|
|
992
|
-
if (
|
|
993
|
-
if (
|
|
994
|
-
for (;
|
|
995
|
-
Object.assign(
|
|
996
|
-
return [
|
|
302
|
+
r.level = e.levels.values[t];
|
|
303
|
+
if (o.asObjectBindingsOnly) {
|
|
304
|
+
if (y !== null && typeof y == "object")
|
|
305
|
+
for (; b-- && typeof f[0] == "object"; )
|
|
306
|
+
Object.assign(r, f.shift());
|
|
307
|
+
return [O(r), ...f];
|
|
997
308
|
} else {
|
|
998
|
-
if (
|
|
999
|
-
for (;
|
|
1000
|
-
Object.assign(
|
|
1001
|
-
|
|
1002
|
-
} else typeof
|
|
1003
|
-
return
|
|
309
|
+
if (y !== null && typeof y == "object") {
|
|
310
|
+
for (; b-- && typeof f[0] == "object"; )
|
|
311
|
+
Object.assign(r, f.shift());
|
|
312
|
+
y = f.length ? d(f.shift(), f) : void 0;
|
|
313
|
+
} else typeof y == "string" && (y = d(f.shift(), f));
|
|
314
|
+
return y !== void 0 && (r[o.messageKey] = y), [O(r)];
|
|
1004
315
|
}
|
|
1005
316
|
}
|
|
1006
|
-
function
|
|
1007
|
-
for (const
|
|
1008
|
-
if (
|
|
1009
|
-
|
|
1010
|
-
else if (typeof
|
|
1011
|
-
for (const
|
|
1012
|
-
|
|
1013
|
-
}
|
|
1014
|
-
function
|
|
1015
|
-
const
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
),
|
|
1022
|
-
return
|
|
1023
|
-
}),
|
|
1024
|
-
}
|
|
1025
|
-
function
|
|
317
|
+
function U(e, t, n, a) {
|
|
318
|
+
for (const o in e)
|
|
319
|
+
if (a && e[o] instanceof Error)
|
|
320
|
+
e[o] = w.stdSerializers.err(e[o]);
|
|
321
|
+
else if (typeof e[o] == "object" && !Array.isArray(e[o]) && t)
|
|
322
|
+
for (const g in e[o])
|
|
323
|
+
t.indexOf(g) > -1 && g in n && (e[o][g] = n[g](e[o][g]));
|
|
324
|
+
}
|
|
325
|
+
function ne(e, t, n, a = !1) {
|
|
326
|
+
const o = t.send, g = t.ts, O = t.methodLevel, f = t.methodValue, y = t.val, r = e._logEvent.bindings;
|
|
327
|
+
a || U(
|
|
328
|
+
n,
|
|
329
|
+
e._serialize || Object.keys(e.serializers),
|
|
330
|
+
e.serializers,
|
|
331
|
+
e._stdErrSerialize === void 0 ? !0 : e._stdErrSerialize
|
|
332
|
+
), e._logEvent.ts = g, e._logEvent.messages = n.filter(function(b) {
|
|
333
|
+
return r.indexOf(b) === -1;
|
|
334
|
+
}), e._logEvent.level.label = O, e._logEvent.level.value = f, o(O, e._logEvent, y), e._logEvent = K(r);
|
|
335
|
+
}
|
|
336
|
+
function K(e) {
|
|
1026
337
|
return {
|
|
1027
338
|
ts: 0,
|
|
1028
339
|
messages: [],
|
|
1029
|
-
bindings:
|
|
340
|
+
bindings: e || [],
|
|
1030
341
|
level: { label: "", value: 0 }
|
|
1031
342
|
};
|
|
1032
343
|
}
|
|
1033
|
-
function
|
|
1034
|
-
const
|
|
1035
|
-
type:
|
|
1036
|
-
msg:
|
|
1037
|
-
stack:
|
|
344
|
+
function J(e) {
|
|
345
|
+
const t = {
|
|
346
|
+
type: e.constructor.name,
|
|
347
|
+
msg: e.message,
|
|
348
|
+
stack: e.stack
|
|
1038
349
|
};
|
|
1039
|
-
for (const
|
|
1040
|
-
|
|
1041
|
-
return
|
|
350
|
+
for (const n in e)
|
|
351
|
+
t[n] === void 0 && (t[n] = e[n]);
|
|
352
|
+
return t;
|
|
1042
353
|
}
|
|
1043
|
-
function
|
|
1044
|
-
return typeof
|
|
354
|
+
function ie(e) {
|
|
355
|
+
return typeof e.timestamp == "function" ? e.timestamp : e.timestamp === !1 ? W : H;
|
|
1045
356
|
}
|
|
1046
|
-
function
|
|
357
|
+
function I() {
|
|
1047
358
|
return {};
|
|
1048
359
|
}
|
|
1049
|
-
function
|
|
1050
|
-
return
|
|
360
|
+
function N(e) {
|
|
361
|
+
return e;
|
|
1051
362
|
}
|
|
1052
|
-
function
|
|
363
|
+
function L() {
|
|
1053
364
|
}
|
|
1054
|
-
function
|
|
365
|
+
function W() {
|
|
1055
366
|
return !1;
|
|
1056
367
|
}
|
|
1057
|
-
function
|
|
368
|
+
function H() {
|
|
1058
369
|
return Date.now();
|
|
1059
370
|
}
|
|
1060
|
-
function
|
|
371
|
+
function se() {
|
|
1061
372
|
return Math.round(Date.now() / 1e3);
|
|
1062
373
|
}
|
|
1063
|
-
function
|
|
374
|
+
function ae() {
|
|
1064
375
|
return new Date(Date.now()).toISOString();
|
|
1065
376
|
}
|
|
1066
|
-
function
|
|
1067
|
-
function
|
|
1068
|
-
return typeof
|
|
377
|
+
function oe() {
|
|
378
|
+
function e(t) {
|
|
379
|
+
return typeof t < "u" && t;
|
|
1069
380
|
}
|
|
1070
381
|
try {
|
|
1071
382
|
return typeof globalThis < "u" || Object.defineProperty(Object.prototype, "globalThis", {
|
|
@@ -1075,89 +386,106 @@ function ot() {
|
|
|
1075
386
|
configurable: !0
|
|
1076
387
|
}), globalThis;
|
|
1077
388
|
} catch {
|
|
1078
|
-
return
|
|
389
|
+
return e(self) || e(window) || e(this) || {};
|
|
1079
390
|
}
|
|
1080
391
|
}
|
|
1081
|
-
return F.exports.default =
|
|
392
|
+
return F.exports.default = w, F.exports.pino = w, F.exports;
|
|
1082
393
|
}
|
|
1083
|
-
var
|
|
1084
|
-
const
|
|
394
|
+
var he = de();
|
|
395
|
+
const be = /* @__PURE__ */ ce(he), me = be({
|
|
1085
396
|
level: "silent",
|
|
1086
397
|
browser: { asObject: !0 }
|
|
1087
|
-
}),
|
|
1088
|
-
function
|
|
398
|
+
}), te = (d, s) => me.child({ module: d, ...s }), ve = te("alistigo:claude-storage:retry"), ge = 1e3, ye = 3;
|
|
399
|
+
function we(d, s) {
|
|
1089
400
|
return Promise.race([
|
|
1090
|
-
|
|
401
|
+
d().then((i) => ({ tag: "ok", value: i })).catch((i) => ({ tag: "error", err: i })),
|
|
1091
402
|
new Promise(
|
|
1092
|
-
(
|
|
403
|
+
(i) => setTimeout(() => i({ tag: "timeout" }), s)
|
|
1093
404
|
)
|
|
1094
405
|
]);
|
|
1095
406
|
}
|
|
1096
|
-
|
|
1097
|
-
|
|
407
|
+
async function T(d, s = ge, i = ye) {
|
|
408
|
+
for (let u = 0; u <= i; u++) {
|
|
409
|
+
const m = await we(d, s);
|
|
410
|
+
if (m.tag === "ok") return m.value;
|
|
411
|
+
if (m.tag === "error") throw m.err;
|
|
412
|
+
u < i && ve.debug({ attempt: u }, "claude storage timed out, retrying");
|
|
413
|
+
}
|
|
414
|
+
throw new Error(`Claude storage timed out after ${i + 1} attempts`);
|
|
415
|
+
}
|
|
416
|
+
const q = te("alistigo:claude-storage");
|
|
417
|
+
class pe {
|
|
1098
418
|
get storage() {
|
|
1099
|
-
const
|
|
1100
|
-
if (!
|
|
419
|
+
const s = window.storage;
|
|
420
|
+
if (!s)
|
|
1101
421
|
throw new Error(
|
|
1102
|
-
"
|
|
422
|
+
"ClaudeKeyValueStore requires window.storage — check isClaudeArtifactContext() first"
|
|
1103
423
|
);
|
|
1104
|
-
return
|
|
424
|
+
return s;
|
|
1105
425
|
}
|
|
1106
|
-
|
|
426
|
+
requirePublished() {
|
|
427
|
+
if (!ue().published)
|
|
428
|
+
throw new Error(
|
|
429
|
+
"Storage is unavailable in draft mode — publish the artifact and open it via its public URL."
|
|
430
|
+
);
|
|
431
|
+
}
|
|
432
|
+
async get(s) {
|
|
433
|
+
this.requirePublished();
|
|
1107
434
|
try {
|
|
1108
|
-
|
|
1109
|
-
const
|
|
1110
|
-
return
|
|
1111
|
-
} catch (
|
|
1112
|
-
|
|
435
|
+
q.debug({ key: s }, "get");
|
|
436
|
+
const i = await T(() => this.storage.get(s));
|
|
437
|
+
return JSON.parse(i.value);
|
|
438
|
+
} catch (i) {
|
|
439
|
+
q.debug({ key: s, err: i }, "get returned nothing (key may not exist)");
|
|
1113
440
|
return;
|
|
1114
441
|
}
|
|
1115
442
|
}
|
|
1116
|
-
async
|
|
1117
|
-
|
|
1118
|
-
await V(this.storage.set(R(n.id), JSON.stringify(i))), X.debug({ key: R(n.id) }, "saved to claude storage");
|
|
443
|
+
async set(s, i) {
|
|
444
|
+
this.requirePublished(), q.debug({ key: s }, "set"), await T(() => this.storage.set(s, JSON.stringify(i)));
|
|
1119
445
|
}
|
|
1120
|
-
async
|
|
446
|
+
async del(s) {
|
|
447
|
+
this.requirePublished(), q.debug({ key: s }, "del"), await T(() => this.storage.delete(s));
|
|
448
|
+
}
|
|
449
|
+
async list(s = "") {
|
|
450
|
+
this.requirePublished();
|
|
1121
451
|
try {
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
X.debug({ err: t }, "loadDocument from claude storage returned nothing (key may not exist)");
|
|
1126
|
-
return;
|
|
452
|
+
return q.debug({ prefix: s }, "list"), (await T(() => this.storage.list(s)))?.keys ?? [];
|
|
453
|
+
} catch {
|
|
454
|
+
return [];
|
|
1127
455
|
}
|
|
1128
456
|
}
|
|
1129
457
|
}
|
|
1130
|
-
function
|
|
458
|
+
function Oe() {
|
|
1131
459
|
return typeof window < "u" && typeof window.claude?.complete == "function";
|
|
1132
460
|
}
|
|
1133
|
-
const
|
|
1134
|
-
version:
|
|
1135
|
-
},
|
|
461
|
+
const je = "0.4.0", Ee = {
|
|
462
|
+
version: je
|
|
463
|
+
}, Se = {
|
|
1136
464
|
name: "@alistigo/claude-storage-plugin",
|
|
1137
|
-
version:
|
|
465
|
+
version: Ee.version,
|
|
1138
466
|
type: "storage",
|
|
1139
467
|
storage: {
|
|
1140
468
|
isAvailable() {
|
|
1141
|
-
return
|
|
469
|
+
return Oe();
|
|
1142
470
|
},
|
|
1143
471
|
createStore() {
|
|
1144
|
-
return new
|
|
472
|
+
return new pe();
|
|
1145
473
|
},
|
|
1146
|
-
async listKeys(
|
|
1147
|
-
const
|
|
1148
|
-
if (!
|
|
474
|
+
async listKeys(d = "") {
|
|
475
|
+
const s = window.storage;
|
|
476
|
+
if (!s) return [];
|
|
1149
477
|
try {
|
|
1150
|
-
const
|
|
1151
|
-
return
|
|
1152
|
-
|
|
478
|
+
const i = await T(() => s.list(d));
|
|
479
|
+
return i ? (await Promise.all(
|
|
480
|
+
i.keys.map(async (m) => {
|
|
1153
481
|
try {
|
|
1154
|
-
const
|
|
1155
|
-
return { key:
|
|
482
|
+
const E = await T(() => s.get(m));
|
|
483
|
+
return { key: m, value: E.value };
|
|
1156
484
|
} catch {
|
|
1157
485
|
return null;
|
|
1158
486
|
}
|
|
1159
487
|
})
|
|
1160
|
-
)).filter((
|
|
488
|
+
)).filter((m) => m !== null) : [];
|
|
1161
489
|
} catch {
|
|
1162
490
|
return [];
|
|
1163
491
|
}
|
|
@@ -1165,8 +493,9 @@ const ht = "0.2.16", gt = {
|
|
|
1165
493
|
}
|
|
1166
494
|
};
|
|
1167
495
|
export {
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
496
|
+
pe as ClaudeKeyValueStore,
|
|
497
|
+
Se as default,
|
|
498
|
+
Oe as isClaudeArtifactContext,
|
|
499
|
+
T as withStorageRetry
|
|
1171
500
|
};
|
|
1172
501
|
//# sourceMappingURL=index.js.map
|