@caspian2026/agent-sdk 0.0.25 → 0.0.26
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/gateway/index.js +98 -22
- package/dist/gateway/worker.js +86 -41
- package/dist/sdk/query.cjs +2 -362
- package/dist/sdk/query.js +2 -367
- package/package.json +4 -6
- package/dist/chunk-04n4fe72.js +0 -107
- package/dist/chunk-04ys66ej.js +0 -344
- package/dist/chunk-07069jq1.js +0 -30
- package/dist/chunk-0731m51q.js +0 -8
- package/dist/chunk-086x4ct4.js +0 -26
- package/dist/chunk-0btqb97n.js +0 -295
- package/dist/chunk-0paqc2yw.js +0 -15
- package/dist/chunk-0r1rjydx.js +0 -145
- package/dist/chunk-0r5bb9j4.js +0 -477
- package/dist/chunk-0t81d427.js +0 -41
- package/dist/chunk-0teq2mz0.js +0 -420
- package/dist/chunk-0vkfrmqm.js +0 -690
- package/dist/chunk-0vp3wfab.js +0 -12
- package/dist/chunk-0warp8dx.js +0 -253
- package/dist/chunk-0xjaqda8.js +0 -1124
- package/dist/chunk-10gzv316.js +0 -62
- package/dist/chunk-11pq9n08.js +0 -168
- package/dist/chunk-1ae3nt9j.js +0 -31
- package/dist/chunk-1fmb0njn.js +0 -396
- package/dist/chunk-1gx78081.js +0 -66
- package/dist/chunk-1h2famwb.js +0 -49
- package/dist/chunk-1ng8xwxz.js +0 -276
- package/dist/chunk-1v7jp29h.js +0 -206
- package/dist/chunk-1xxy5zhb.js +0 -673
- package/dist/chunk-20b73w7w.js +0 -117
- package/dist/chunk-20qxd83a.js +0 -1161
- package/dist/chunk-2239ny9q.js +0 -90
- package/dist/chunk-22d4rnef.js +0 -226
- package/dist/chunk-26wtxbdc.js +0 -13870
- package/dist/chunk-27225bjh.js +0 -618
- package/dist/chunk-2b0e32an.js +0 -5822
- package/dist/chunk-2bfa9w1y.js +0 -323
- package/dist/chunk-2epq04w1.js +0 -63
- package/dist/chunk-2fwze72g.js +0 -24
- package/dist/chunk-2gzv8nrw.js +0 -205
- package/dist/chunk-2mexte1r.js +0 -349
- package/dist/chunk-2mzaqh5g.js +0 -338
- package/dist/chunk-2tb6mzfc.js +0 -81
- package/dist/chunk-2xq0g43w.js +0 -558
- package/dist/chunk-334aeqg9.js +0 -90
- package/dist/chunk-34jx4rjd.js +0 -995
- package/dist/chunk-35w5nhex.js +0 -132
- package/dist/chunk-3c25bcsw.js +0 -17
- package/dist/chunk-3eaxj8dg.js +0 -151
- package/dist/chunk-3fdgrwd2.js +0 -111
- package/dist/chunk-3jw0r58d.js +0 -121
- package/dist/chunk-3mgywd32.js +0 -8
- package/dist/chunk-3nk79af8.js +0 -8
- package/dist/chunk-3vy1jt9p.js +0 -1010
- package/dist/chunk-3x78pd4j.js +0 -153
- package/dist/chunk-47x3dsmn.js +0 -95
- package/dist/chunk-49pqt48n.js +0 -108
- package/dist/chunk-4f7m9fjw.js +0 -317
- package/dist/chunk-4jm600zv.js +0 -13
- package/dist/chunk-4k9d7gxv.js +0 -118
- package/dist/chunk-4net8san.js +0 -155
- package/dist/chunk-4pbx3g7s.js +0 -26
- package/dist/chunk-4v125j4z.js +0 -58
- package/dist/chunk-4vxkv5vz.js +0 -1438
- package/dist/chunk-51fqpjy3.js +0 -121
- package/dist/chunk-52e64f2h.js +0 -439
- package/dist/chunk-52e9mdjv.js +0 -684
- package/dist/chunk-55raexh7.js +0 -14358
- package/dist/chunk-59pq5122.js +0 -269
- package/dist/chunk-5bsj67v1.js +0 -349
- package/dist/chunk-5ccdsxgy.js +0 -74
- package/dist/chunk-5ekyhb1w.js +0 -422
- package/dist/chunk-5gcqdn8x.js +0 -867
- package/dist/chunk-5h5kx2jd.js +0 -34
- package/dist/chunk-5hf3werb.js +0 -193
- package/dist/chunk-5n1jc02d.js +0 -87
- package/dist/chunk-5wfxvxm8.js +0 -127
- package/dist/chunk-5wjebwmn.js +0 -89
- package/dist/chunk-5z28bqne.js +0 -6748
- package/dist/chunk-5zwsxpjn.js +0 -671
- package/dist/chunk-60phw466.js +0 -29
- package/dist/chunk-64c1avct.js +0 -13
- package/dist/chunk-64r16v22.js +0 -162
- package/dist/chunk-65t1r7zs.js +0 -418
- package/dist/chunk-66zry909.js +0 -11
- package/dist/chunk-67hxjjgc.js +0 -731
- package/dist/chunk-68ffk5qa.js +0 -14
- package/dist/chunk-69dr6rrd.js +0 -177
- package/dist/chunk-69n11zng.js +0 -436
- package/dist/chunk-6dj5t602.js +0 -341
- package/dist/chunk-6dngjwkh.js +0 -63
- package/dist/chunk-6dp8sz55.js +0 -3561
- package/dist/chunk-6hqgg0sv.js +0 -103
- package/dist/chunk-6nsd9606.js +0 -790
- package/dist/chunk-6p0hbwz3.js +0 -65
- package/dist/chunk-6ywdv5vg.js +0 -97
- package/dist/chunk-6zc758qw.js +0 -640
- package/dist/chunk-7aw745vx.js +0 -40175
- package/dist/chunk-7fxaphbq.js +0 -116
- package/dist/chunk-7sgtxrsc.js +0 -1059
- package/dist/chunk-7wm5s02e.js +0 -216
- package/dist/chunk-7xdk4109.js +0 -442
- package/dist/chunk-7xyswgjh.js +0 -8
- package/dist/chunk-83hfzbx3.js +0 -10
- package/dist/chunk-87m69h0v.js +0 -219
- package/dist/chunk-8g5pe1gr.js +0 -37
- package/dist/chunk-8jbw0fnf.js +0 -167
- package/dist/chunk-8jf9se66.js +0 -321
- package/dist/chunk-8p65embj.js +0 -875
- package/dist/chunk-8qrmaff1.js +0 -2669
- package/dist/chunk-8r975mwc.js +0 -93
- package/dist/chunk-8yhf030a.js +0 -69
- package/dist/chunk-93emz367.js +0 -107
- package/dist/chunk-948mn975.js +0 -460
- package/dist/chunk-99chkt7r.js +0 -54
- package/dist/chunk-9f7c1hzz.js +0 -50
- package/dist/chunk-9fk9ps1g.js +0 -178
- package/dist/chunk-9rh0k0aq.js +0 -90
- package/dist/chunk-9x5zgy22.js +0 -12
- package/dist/chunk-a0k2vj5b.js +0 -460
- package/dist/chunk-a0m57ssq.js +0 -325
- package/dist/chunk-a0nsmmz1.js +0 -133
- package/dist/chunk-a25jh1v4.js +0 -105
- package/dist/chunk-a4j5ekv0.js +0 -83
- package/dist/chunk-a8k3zf58.js +0 -313
- package/dist/chunk-ah0zarbq.js +0 -260
- package/dist/chunk-ase86y73.js +0 -15
- package/dist/chunk-b0kf00ff.js +0 -637
- package/dist/chunk-b1kcd3ss.js +0 -27
- package/dist/chunk-b8kcqqds.js +0 -93
- package/dist/chunk-bg4x9ex0.js +0 -21
- package/dist/chunk-bh5zqvyc.js +0 -36
- package/dist/chunk-bqrkfekw.js +0 -267
- package/dist/chunk-brjd9zmk.js +0 -42
- package/dist/chunk-byfawrfx.js +0 -121
- package/dist/chunk-c6sjhj89.js +0 -1284
- package/dist/chunk-c7e5yv0q.js +0 -212
- package/dist/chunk-c7jwbe76.js +0 -29030
- package/dist/chunk-cb5v8w7k.js +0 -289
- package/dist/chunk-cdef9v7b.js +0 -27
- package/dist/chunk-cdz5yb0r.js +0 -57
- package/dist/chunk-cgfdkzhb.js +0 -12
- package/dist/chunk-cgqw4x5z.js +0 -155
- package/dist/chunk-cnsj3vq2.js +0 -35
- package/dist/chunk-cqxm7ggc.js +0 -123
- package/dist/chunk-cxrktb5g.js +0 -51
- package/dist/chunk-d089t7dk.js +0 -312
- package/dist/chunk-d1z934cp.js +0 -71
- package/dist/chunk-d4mdda98.js +0 -94
- package/dist/chunk-d7xw8v91.js +0 -332
- package/dist/chunk-dc06c3rw.js +0 -1154
- package/dist/chunk-ddsjkqs4.js +0 -39
- package/dist/chunk-dfzkwynj.js +0 -5368
- package/dist/chunk-dnmp7s85.js +0 -20
- package/dist/chunk-dqqwjkv3.js +0 -8583
- package/dist/chunk-dt2mr4vf.js +0 -2962
- package/dist/chunk-dztm97gg.js +0 -150
- package/dist/chunk-e0abab5b.js +0 -445
- package/dist/chunk-e0ragz46.js +0 -209386
- package/dist/chunk-e9w9zc0g.js +0 -392
- package/dist/chunk-ebwskmsr.js +0 -107
- package/dist/chunk-efztk52j.js +0 -114
- package/dist/chunk-ehd8wacx.js +0 -40
- package/dist/chunk-ehtwnxpg.js +0 -1591
- package/dist/chunk-eqp1rfft.js +0 -17
- package/dist/chunk-etdt1xz3.js +0 -19
- package/dist/chunk-eva785x8.js +0 -88
- package/dist/chunk-ewadzrm8.js +0 -103
- package/dist/chunk-f2ajmcav.js +0 -92
- package/dist/chunk-fajg8x36.js +0 -8158
- package/dist/chunk-fbv4apne.js +0 -51
- package/dist/chunk-fcynwjpm.js +0 -1072
- package/dist/chunk-fev86f95.js +0 -1052
- package/dist/chunk-feyzykye.js +0 -10
- package/dist/chunk-ff85rwvc.js +0 -180
- package/dist/chunk-fk6ktvg2.js +0 -275
- package/dist/chunk-fqak69ft.js +0 -458
- package/dist/chunk-fqwas4jk.js +0 -281
- package/dist/chunk-fs35fdpj.js +0 -439
- package/dist/chunk-fvr3f9s3.js +0 -55
- package/dist/chunk-fyc5fepv.js +0 -10
- package/dist/chunk-g2g9cwt9.js +0 -54
- package/dist/chunk-g4znz46v.js +0 -2335
- package/dist/chunk-g5ts4e6k.js +0 -697
- package/dist/chunk-g6een9wr.js +0 -654
- package/dist/chunk-g7cmtx8r.js +0 -77
- package/dist/chunk-g9f19ttm.js +0 -15
- package/dist/chunk-gc7ap41t.js +0 -516
- package/dist/chunk-gdwdqewd.js +0 -19
- package/dist/chunk-gg14h3n4.js +0 -131
- package/dist/chunk-gg55fns0.js +0 -6440
- package/dist/chunk-gq7zab4e.js +0 -418
- package/dist/chunk-gydw3qy3.js +0 -169
- package/dist/chunk-gz1e8y1w.js +0 -33
- package/dist/chunk-h19r628d.js +0 -91
- package/dist/chunk-h2k8mt3z.js +0 -329
- package/dist/chunk-h9n54swm.js +0 -27
- package/dist/chunk-hakdhagh.js +0 -16606
- package/dist/chunk-hc2chp3g.js +0 -308
- package/dist/chunk-hemcv9t7.js +0 -153
- package/dist/chunk-hm62ntv3.js +0 -20
- package/dist/chunk-hmq09ytj.js +0 -100
- package/dist/chunk-hmv4hhqt.js +0 -2718
- package/dist/chunk-hwfknpxv.js +0 -39
- package/dist/chunk-j5bth84e.js +0 -97
- package/dist/chunk-j64ga6ta.js +0 -8035
- package/dist/chunk-j6v3w4yf.js +0 -244
- package/dist/chunk-jc29d2nm.js +0 -130
- package/dist/chunk-jd32zbps.js +0 -15
- package/dist/chunk-jd4sx4wh.js +0 -594
- package/dist/chunk-jha8n8b9.js +0 -33118
- package/dist/chunk-jj71qx7m.js +0 -122
- package/dist/chunk-jka9vpak.js +0 -114
- package/dist/chunk-jkf6ayv0.js +0 -32
- package/dist/chunk-jpz6t2tt.js +0 -61
- package/dist/chunk-jqt3sw12.js +0 -9114
- package/dist/chunk-jswd1q63.js +0 -101
- package/dist/chunk-jtc4aa2y.js +0 -1543
- package/dist/chunk-jyx3h86z.js +0 -635
- package/dist/chunk-jzthz1bx.js +0 -15
- package/dist/chunk-k0p9w03v.js +0 -4957
- package/dist/chunk-k6x3s7x5.js +0 -211
- package/dist/chunk-k7kmvnnx.js +0 -942
- package/dist/chunk-k8vp0atq.js +0 -2331
- package/dist/chunk-k9vm6x6z.js +0 -257
- package/dist/chunk-kb1edvhs.js +0 -120
- package/dist/chunk-kbhbe33q.js +0 -113
- package/dist/chunk-kgcgpp7z.js +0 -140
- package/dist/chunk-kvywbvqs.js +0 -261
- package/dist/chunk-kwekc97v.js +0 -18
- package/dist/chunk-kwyk9zp1.js +0 -74
- package/dist/chunk-ky1z78ve.js +0 -119
- package/dist/chunk-mcws22k3.js +0 -42
- package/dist/chunk-mr2z79r3.js +0 -1385
- package/dist/chunk-mst9nmns.js +0 -642
- package/dist/chunk-mswx2nma.js +0 -103
- package/dist/chunk-n1e3fjpz.js +0 -266
- package/dist/chunk-n6vjp9yg.js +0 -138
- package/dist/chunk-n84tqtvv.js +0 -120
- package/dist/chunk-n8ssddbw.js +0 -105
- package/dist/chunk-na35whkd.js +0 -227
- package/dist/chunk-netzwgv1.js +0 -154
- package/dist/chunk-ng7j0yy1.js +0 -100
- package/dist/chunk-nmgj86tt.js +0 -24
- package/dist/chunk-ns7x6xam.js +0 -22820
- package/dist/chunk-p7vkh4wx.js +0 -15
- package/dist/chunk-p8na2wwp.js +0 -14
- package/dist/chunk-pe3rkfp2.js +0 -74
- package/dist/chunk-pf0152j3.js +0 -40
- package/dist/chunk-pgtnj1mt.js +0 -705
- package/dist/chunk-ppwjyveh.js +0 -8
- package/dist/chunk-pq5qp2y4.js +0 -388
- package/dist/chunk-pqqxdk5f.js +0 -543
- package/dist/chunk-ps49ymvj.js +0 -43
- package/dist/chunk-pws8gq7m.js +0 -7422
- package/dist/chunk-pwwa7s62.js +0 -11
- package/dist/chunk-pyq0fabn.js +0 -860
- package/dist/chunk-q0p1m40t.js +0 -79
- package/dist/chunk-q0vhv550.js +0 -393
- package/dist/chunk-q7r0kt08.js +0 -1809
- package/dist/chunk-qajrkk97.js +0 -298
- package/dist/chunk-qatfdxvd.js +0 -34
- package/dist/chunk-qb6k2afy.js +0 -153
- package/dist/chunk-qg2qgx8h.js +0 -266
- package/dist/chunk-qkczt8cr.js +0 -24
- package/dist/chunk-qnfx3qtx.js +0 -617
- package/dist/chunk-qp2qdcda.js +0 -100
- package/dist/chunk-qtwgzej9.js +0 -85
- package/dist/chunk-r1dh0ymt.js +0 -91
- package/dist/chunk-r36xvgvv.js +0 -407
- package/dist/chunk-r48he8g3.js +0 -251
- package/dist/chunk-r63tqmtk.js +0 -146
- package/dist/chunk-rbdd3q5k.js +0 -101
- package/dist/chunk-rmbbmd3s.js +0 -68
- package/dist/chunk-rn0v1hk8.js +0 -34
- package/dist/chunk-rnxctq9p.js +0 -1646
- package/dist/chunk-rrs2mchs.js +0 -183
- package/dist/chunk-rtrybvnp.js +0 -209
- package/dist/chunk-rw2wkn45.js +0 -494
- package/dist/chunk-s4kzkdhd.js +0 -847
- package/dist/chunk-s7a0zn7b.js +0 -55
- package/dist/chunk-s8gy4ky9.js +0 -122
- package/dist/chunk-s8kj6ajy.js +0 -32
- package/dist/chunk-sag785ad.js +0 -283
- package/dist/chunk-scqjyben.js +0 -174
- package/dist/chunk-sd36yzx8.js +0 -954
- package/dist/chunk-sdtqm0nm.js +0 -374
- package/dist/chunk-sg60xg0x.js +0 -52
- package/dist/chunk-sgpmpn90.js +0 -35
- package/dist/chunk-sh02d2qn.js +0 -38
- package/dist/chunk-sz9y6z13.js +0 -61
- package/dist/chunk-szj5wvdy.js +0 -28
- package/dist/chunk-t29a6zb5.js +0 -45
- package/dist/chunk-t2b49hcf.js +0 -87
- package/dist/chunk-t2wqdppz.js +0 -445
- package/dist/chunk-t4khqff1.js +0 -16
- package/dist/chunk-t70t2gne.js +0 -121
- package/dist/chunk-t9p85zff.js +0 -24
- package/dist/chunk-tkrstmwz.js +0 -94
- package/dist/chunk-tnyb4exc.js +0 -74
- package/dist/chunk-tpn8jsvw.js +0 -71
- package/dist/chunk-tt7x5j1q.js +0 -111
- package/dist/chunk-tw1p628z.js +0 -984
- package/dist/chunk-twvdafcz.js +0 -528
- package/dist/chunk-tzwjafgn.js +0 -24
- package/dist/chunk-v140t8ay.js +0 -152
- package/dist/chunk-v1kzp02e.js +0 -785
- package/dist/chunk-v4t6dyyh.js +0 -9076
- package/dist/chunk-v78fj8by.js +0 -145
- package/dist/chunk-v8kjswxt.js +0 -61
- package/dist/chunk-v9smspw2.js +0 -4301
- package/dist/chunk-vcfbjkk9.js +0 -201
- package/dist/chunk-ve167rcs.js +0 -148
- package/dist/chunk-vf612n57.js +0 -472
- package/dist/chunk-vhffyae8.js +0 -895
- package/dist/chunk-vkhrrvfq.js +0 -44
- package/dist/chunk-vybkmfhf.js +0 -91
- package/dist/chunk-vyjeh50y.js +0 -2149
- package/dist/chunk-w6m6trzq.js +0 -58
- package/dist/chunk-w9b6kngq.js +0 -234
- package/dist/chunk-wa8yn2p0.js +0 -2007
- package/dist/chunk-wanceff6.js +0 -2840
- package/dist/chunk-wcze2nea.js +0 -336
- package/dist/chunk-wgk9sxk7.js +0 -329
- package/dist/chunk-wnxcgfsd.js +0 -253
- package/dist/chunk-wyjerrr6.js +0 -565
- package/dist/chunk-wz9brkq5.js +0 -60
- package/dist/chunk-x47h283a.js +0 -56
- package/dist/chunk-x59j3x9c.js +0 -98
- package/dist/chunk-x6r4v44b.js +0 -8
- package/dist/chunk-x7fdwq3d.js +0 -33
- package/dist/chunk-x8d2ehd7.js +0 -19
- package/dist/chunk-xeb6075z.js +0 -3435
- package/dist/chunk-xfw2pxwd.js +0 -223
- package/dist/chunk-xh06jc72.js +0 -200
- package/dist/chunk-xhfmdq1y.js +0 -147
- package/dist/chunk-xkwyg1d2.js +0 -195
- package/dist/chunk-xv3era3s.js +0 -8
- package/dist/chunk-xyapc58m.js +0 -87
- package/dist/chunk-xzgnc76g.js +0 -107
- package/dist/chunk-y1784krc.js +0 -19
- package/dist/chunk-y4ca9kqz.js +0 -3830
- package/dist/chunk-y9bhjjdz.js +0 -145
- package/dist/chunk-yb3bxv3w.js +0 -30
- package/dist/chunk-yddek6xk.js +0 -146
- package/dist/chunk-ypaq3d12.js +0 -4265
- package/dist/chunk-yq8z040g.js +0 -111
- package/dist/chunk-yqs481qq.js +0 -1163
- package/dist/chunk-ys9a9c9h.js +0 -105
- package/dist/chunk-yyex5gsf.js +0 -269
- package/dist/chunk-yzn396hn.js +0 -89
- package/dist/chunk-z2dp53wn.js +0 -17
- package/dist/chunk-zay4xp4n.js +0 -251
- package/dist/chunk-zc8bwy57.js +0 -212
- package/dist/chunk-zhx88cfx.js +0 -97
- package/dist/chunk-zkh6f4ct.js +0 -385
- package/dist/chunk-zq56gcca.js +0 -206
- package/dist/chunk-zrkefd22.js +0 -490
- package/dist/chunk-zs5p0yq1.js +0 -1030
- package/dist/chunk-zxh62ved.js +0 -31
- package/dist/chunk-zzm33q8x.js +0 -8
- package/dist/cli.js +0 -220
package/dist/chunk-6nsd9606.js
DELETED
|
@@ -1,790 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
require_graceful_fs
|
|
4
|
-
} from "./chunk-v1kzp02e.js";
|
|
5
|
-
import {
|
|
6
|
-
__commonJS,
|
|
7
|
-
__esm,
|
|
8
|
-
__require
|
|
9
|
-
} from "./chunk-qp2qdcda.js";
|
|
10
|
-
|
|
11
|
-
// src/utils/array.ts
|
|
12
|
-
function intersperse(as, separator) {
|
|
13
|
-
return as.flatMap((a, i) => i ? [separator(i), a] : [a]);
|
|
14
|
-
}
|
|
15
|
-
function count(arr, pred) {
|
|
16
|
-
let n = 0;
|
|
17
|
-
for (const x of arr)
|
|
18
|
-
n += +!!pred(x);
|
|
19
|
-
return n;
|
|
20
|
-
}
|
|
21
|
-
function uniq(xs) {
|
|
22
|
-
return [...new Set(xs)];
|
|
23
|
-
}
|
|
24
|
-
var init_array = () => {};
|
|
25
|
-
|
|
26
|
-
// node_modules/.bun/retry@0.12.0/node_modules/retry/lib/retry_operation.js
|
|
27
|
-
var require_retry_operation = __commonJS((exports, module) => {
|
|
28
|
-
function RetryOperation(timeouts, options) {
|
|
29
|
-
if (typeof options === "boolean") {
|
|
30
|
-
options = { forever: options };
|
|
31
|
-
}
|
|
32
|
-
this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
|
|
33
|
-
this._timeouts = timeouts;
|
|
34
|
-
this._options = options || {};
|
|
35
|
-
this._maxRetryTime = options && options.maxRetryTime || Infinity;
|
|
36
|
-
this._fn = null;
|
|
37
|
-
this._errors = [];
|
|
38
|
-
this._attempts = 1;
|
|
39
|
-
this._operationTimeout = null;
|
|
40
|
-
this._operationTimeoutCb = null;
|
|
41
|
-
this._timeout = null;
|
|
42
|
-
this._operationStart = null;
|
|
43
|
-
if (this._options.forever) {
|
|
44
|
-
this._cachedTimeouts = this._timeouts.slice(0);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
module.exports = RetryOperation;
|
|
48
|
-
RetryOperation.prototype.reset = function() {
|
|
49
|
-
this._attempts = 1;
|
|
50
|
-
this._timeouts = this._originalTimeouts;
|
|
51
|
-
};
|
|
52
|
-
RetryOperation.prototype.stop = function() {
|
|
53
|
-
if (this._timeout) {
|
|
54
|
-
clearTimeout(this._timeout);
|
|
55
|
-
}
|
|
56
|
-
this._timeouts = [];
|
|
57
|
-
this._cachedTimeouts = null;
|
|
58
|
-
};
|
|
59
|
-
RetryOperation.prototype.retry = function(err) {
|
|
60
|
-
if (this._timeout) {
|
|
61
|
-
clearTimeout(this._timeout);
|
|
62
|
-
}
|
|
63
|
-
if (!err) {
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
var currentTime = new Date().getTime();
|
|
67
|
-
if (err && currentTime - this._operationStart >= this._maxRetryTime) {
|
|
68
|
-
this._errors.unshift(new Error("RetryOperation timeout occurred"));
|
|
69
|
-
return false;
|
|
70
|
-
}
|
|
71
|
-
this._errors.push(err);
|
|
72
|
-
var timeout = this._timeouts.shift();
|
|
73
|
-
if (timeout === undefined) {
|
|
74
|
-
if (this._cachedTimeouts) {
|
|
75
|
-
this._errors.splice(this._errors.length - 1, this._errors.length);
|
|
76
|
-
this._timeouts = this._cachedTimeouts.slice(0);
|
|
77
|
-
timeout = this._timeouts.shift();
|
|
78
|
-
} else {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
var self = this;
|
|
83
|
-
var timer = setTimeout(function() {
|
|
84
|
-
self._attempts++;
|
|
85
|
-
if (self._operationTimeoutCb) {
|
|
86
|
-
self._timeout = setTimeout(function() {
|
|
87
|
-
self._operationTimeoutCb(self._attempts);
|
|
88
|
-
}, self._operationTimeout);
|
|
89
|
-
if (self._options.unref) {
|
|
90
|
-
self._timeout.unref();
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
self._fn(self._attempts);
|
|
94
|
-
}, timeout);
|
|
95
|
-
if (this._options.unref) {
|
|
96
|
-
timer.unref();
|
|
97
|
-
}
|
|
98
|
-
return true;
|
|
99
|
-
};
|
|
100
|
-
RetryOperation.prototype.attempt = function(fn, timeoutOps) {
|
|
101
|
-
this._fn = fn;
|
|
102
|
-
if (timeoutOps) {
|
|
103
|
-
if (timeoutOps.timeout) {
|
|
104
|
-
this._operationTimeout = timeoutOps.timeout;
|
|
105
|
-
}
|
|
106
|
-
if (timeoutOps.cb) {
|
|
107
|
-
this._operationTimeoutCb = timeoutOps.cb;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
var self = this;
|
|
111
|
-
if (this._operationTimeoutCb) {
|
|
112
|
-
this._timeout = setTimeout(function() {
|
|
113
|
-
self._operationTimeoutCb();
|
|
114
|
-
}, self._operationTimeout);
|
|
115
|
-
}
|
|
116
|
-
this._operationStart = new Date().getTime();
|
|
117
|
-
this._fn(this._attempts);
|
|
118
|
-
};
|
|
119
|
-
RetryOperation.prototype.try = function(fn) {
|
|
120
|
-
console.log("Using RetryOperation.try() is deprecated");
|
|
121
|
-
this.attempt(fn);
|
|
122
|
-
};
|
|
123
|
-
RetryOperation.prototype.start = function(fn) {
|
|
124
|
-
console.log("Using RetryOperation.start() is deprecated");
|
|
125
|
-
this.attempt(fn);
|
|
126
|
-
};
|
|
127
|
-
RetryOperation.prototype.start = RetryOperation.prototype.try;
|
|
128
|
-
RetryOperation.prototype.errors = function() {
|
|
129
|
-
return this._errors;
|
|
130
|
-
};
|
|
131
|
-
RetryOperation.prototype.attempts = function() {
|
|
132
|
-
return this._attempts;
|
|
133
|
-
};
|
|
134
|
-
RetryOperation.prototype.mainError = function() {
|
|
135
|
-
if (this._errors.length === 0) {
|
|
136
|
-
return null;
|
|
137
|
-
}
|
|
138
|
-
var counts = {};
|
|
139
|
-
var mainError = null;
|
|
140
|
-
var mainErrorCount = 0;
|
|
141
|
-
for (var i = 0;i < this._errors.length; i++) {
|
|
142
|
-
var error = this._errors[i];
|
|
143
|
-
var message = error.message;
|
|
144
|
-
var count2 = (counts[message] || 0) + 1;
|
|
145
|
-
counts[message] = count2;
|
|
146
|
-
if (count2 >= mainErrorCount) {
|
|
147
|
-
mainError = error;
|
|
148
|
-
mainErrorCount = count2;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
return mainError;
|
|
152
|
-
};
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
// node_modules/.bun/retry@0.12.0/node_modules/retry/lib/retry.js
|
|
156
|
-
var require_retry = __commonJS((exports) => {
|
|
157
|
-
var RetryOperation = require_retry_operation();
|
|
158
|
-
exports.operation = function(options) {
|
|
159
|
-
var timeouts = exports.timeouts(options);
|
|
160
|
-
return new RetryOperation(timeouts, {
|
|
161
|
-
forever: options && options.forever,
|
|
162
|
-
unref: options && options.unref,
|
|
163
|
-
maxRetryTime: options && options.maxRetryTime
|
|
164
|
-
});
|
|
165
|
-
};
|
|
166
|
-
exports.timeouts = function(options) {
|
|
167
|
-
if (options instanceof Array) {
|
|
168
|
-
return [].concat(options);
|
|
169
|
-
}
|
|
170
|
-
var opts = {
|
|
171
|
-
retries: 10,
|
|
172
|
-
factor: 2,
|
|
173
|
-
minTimeout: 1 * 1000,
|
|
174
|
-
maxTimeout: Infinity,
|
|
175
|
-
randomize: false
|
|
176
|
-
};
|
|
177
|
-
for (var key in options) {
|
|
178
|
-
opts[key] = options[key];
|
|
179
|
-
}
|
|
180
|
-
if (opts.minTimeout > opts.maxTimeout) {
|
|
181
|
-
throw new Error("minTimeout is greater than maxTimeout");
|
|
182
|
-
}
|
|
183
|
-
var timeouts = [];
|
|
184
|
-
for (var i = 0;i < opts.retries; i++) {
|
|
185
|
-
timeouts.push(this.createTimeout(i, opts));
|
|
186
|
-
}
|
|
187
|
-
if (options && options.forever && !timeouts.length) {
|
|
188
|
-
timeouts.push(this.createTimeout(i, opts));
|
|
189
|
-
}
|
|
190
|
-
timeouts.sort(function(a, b) {
|
|
191
|
-
return a - b;
|
|
192
|
-
});
|
|
193
|
-
return timeouts;
|
|
194
|
-
};
|
|
195
|
-
exports.createTimeout = function(attempt, opts) {
|
|
196
|
-
var random = opts.randomize ? Math.random() + 1 : 1;
|
|
197
|
-
var timeout = Math.round(random * opts.minTimeout * Math.pow(opts.factor, attempt));
|
|
198
|
-
timeout = Math.min(timeout, opts.maxTimeout);
|
|
199
|
-
return timeout;
|
|
200
|
-
};
|
|
201
|
-
exports.wrap = function(obj, options, methods) {
|
|
202
|
-
if (options instanceof Array) {
|
|
203
|
-
methods = options;
|
|
204
|
-
options = null;
|
|
205
|
-
}
|
|
206
|
-
if (!methods) {
|
|
207
|
-
methods = [];
|
|
208
|
-
for (var key in obj) {
|
|
209
|
-
if (typeof obj[key] === "function") {
|
|
210
|
-
methods.push(key);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
for (var i = 0;i < methods.length; i++) {
|
|
215
|
-
var method = methods[i];
|
|
216
|
-
var original = obj[method];
|
|
217
|
-
obj[method] = function retryWrapper(original2) {
|
|
218
|
-
var op = exports.operation(options);
|
|
219
|
-
var args = Array.prototype.slice.call(arguments, 1);
|
|
220
|
-
var callback = args.pop();
|
|
221
|
-
args.push(function(err) {
|
|
222
|
-
if (op.retry(err)) {
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
if (err) {
|
|
226
|
-
arguments[0] = op.mainError();
|
|
227
|
-
}
|
|
228
|
-
callback.apply(this, arguments);
|
|
229
|
-
});
|
|
230
|
-
op.attempt(function() {
|
|
231
|
-
original2.apply(obj, args);
|
|
232
|
-
});
|
|
233
|
-
}.bind(obj, original);
|
|
234
|
-
obj[method].options = options;
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
// node_modules/.bun/signal-exit@3.0.7/node_modules/signal-exit/signals.js
|
|
240
|
-
var require_signals = __commonJS((exports, module) => {
|
|
241
|
-
module.exports = [
|
|
242
|
-
"SIGABRT",
|
|
243
|
-
"SIGALRM",
|
|
244
|
-
"SIGHUP",
|
|
245
|
-
"SIGINT",
|
|
246
|
-
"SIGTERM"
|
|
247
|
-
];
|
|
248
|
-
if (process.platform !== "win32") {
|
|
249
|
-
module.exports.push("SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
250
|
-
}
|
|
251
|
-
if (process.platform === "linux") {
|
|
252
|
-
module.exports.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT", "SIGUNUSED");
|
|
253
|
-
}
|
|
254
|
-
});
|
|
255
|
-
|
|
256
|
-
// node_modules/.bun/signal-exit@3.0.7/node_modules/signal-exit/index.js
|
|
257
|
-
var require_signal_exit = __commonJS((exports, module) => {
|
|
258
|
-
var process2 = global.process;
|
|
259
|
-
var processOk = function(process3) {
|
|
260
|
-
return process3 && typeof process3 === "object" && typeof process3.removeListener === "function" && typeof process3.emit === "function" && typeof process3.reallyExit === "function" && typeof process3.listeners === "function" && typeof process3.kill === "function" && typeof process3.pid === "number" && typeof process3.on === "function";
|
|
261
|
-
};
|
|
262
|
-
if (!processOk(process2)) {
|
|
263
|
-
module.exports = function() {
|
|
264
|
-
return function() {};
|
|
265
|
-
};
|
|
266
|
-
} else {
|
|
267
|
-
assert = __require("assert");
|
|
268
|
-
signals = require_signals();
|
|
269
|
-
isWin = /^win/i.test(process2.platform);
|
|
270
|
-
EE = __require("events");
|
|
271
|
-
if (typeof EE !== "function") {
|
|
272
|
-
EE = EE.EventEmitter;
|
|
273
|
-
}
|
|
274
|
-
if (process2.__signal_exit_emitter__) {
|
|
275
|
-
emitter = process2.__signal_exit_emitter__;
|
|
276
|
-
} else {
|
|
277
|
-
emitter = process2.__signal_exit_emitter__ = new EE;
|
|
278
|
-
emitter.count = 0;
|
|
279
|
-
emitter.emitted = {};
|
|
280
|
-
}
|
|
281
|
-
if (!emitter.infinite) {
|
|
282
|
-
emitter.setMaxListeners(Infinity);
|
|
283
|
-
emitter.infinite = true;
|
|
284
|
-
}
|
|
285
|
-
module.exports = function(cb, opts) {
|
|
286
|
-
if (!processOk(global.process)) {
|
|
287
|
-
return function() {};
|
|
288
|
-
}
|
|
289
|
-
assert.equal(typeof cb, "function", "a callback must be provided for exit handler");
|
|
290
|
-
if (loaded === false) {
|
|
291
|
-
load();
|
|
292
|
-
}
|
|
293
|
-
var ev = "exit";
|
|
294
|
-
if (opts && opts.alwaysLast) {
|
|
295
|
-
ev = "afterexit";
|
|
296
|
-
}
|
|
297
|
-
var remove = function() {
|
|
298
|
-
emitter.removeListener(ev, cb);
|
|
299
|
-
if (emitter.listeners("exit").length === 0 && emitter.listeners("afterexit").length === 0) {
|
|
300
|
-
unload();
|
|
301
|
-
}
|
|
302
|
-
};
|
|
303
|
-
emitter.on(ev, cb);
|
|
304
|
-
return remove;
|
|
305
|
-
};
|
|
306
|
-
unload = function unload2() {
|
|
307
|
-
if (!loaded || !processOk(global.process)) {
|
|
308
|
-
return;
|
|
309
|
-
}
|
|
310
|
-
loaded = false;
|
|
311
|
-
signals.forEach(function(sig) {
|
|
312
|
-
try {
|
|
313
|
-
process2.removeListener(sig, sigListeners[sig]);
|
|
314
|
-
} catch (er) {}
|
|
315
|
-
});
|
|
316
|
-
process2.emit = originalProcessEmit;
|
|
317
|
-
process2.reallyExit = originalProcessReallyExit;
|
|
318
|
-
emitter.count -= 1;
|
|
319
|
-
};
|
|
320
|
-
module.exports.unload = unload;
|
|
321
|
-
emit = function emit2(event, code, signal) {
|
|
322
|
-
if (emitter.emitted[event]) {
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
325
|
-
emitter.emitted[event] = true;
|
|
326
|
-
emitter.emit(event, code, signal);
|
|
327
|
-
};
|
|
328
|
-
sigListeners = {};
|
|
329
|
-
signals.forEach(function(sig) {
|
|
330
|
-
sigListeners[sig] = function listener() {
|
|
331
|
-
if (!processOk(global.process)) {
|
|
332
|
-
return;
|
|
333
|
-
}
|
|
334
|
-
var listeners = process2.listeners(sig);
|
|
335
|
-
if (listeners.length === emitter.count) {
|
|
336
|
-
unload();
|
|
337
|
-
emit("exit", null, sig);
|
|
338
|
-
emit("afterexit", null, sig);
|
|
339
|
-
if (isWin && sig === "SIGHUP") {
|
|
340
|
-
sig = "SIGINT";
|
|
341
|
-
}
|
|
342
|
-
process2.kill(process2.pid, sig);
|
|
343
|
-
}
|
|
344
|
-
};
|
|
345
|
-
});
|
|
346
|
-
module.exports.signals = function() {
|
|
347
|
-
return signals;
|
|
348
|
-
};
|
|
349
|
-
loaded = false;
|
|
350
|
-
load = function load2() {
|
|
351
|
-
if (loaded || !processOk(global.process)) {
|
|
352
|
-
return;
|
|
353
|
-
}
|
|
354
|
-
loaded = true;
|
|
355
|
-
emitter.count += 1;
|
|
356
|
-
signals = signals.filter(function(sig) {
|
|
357
|
-
try {
|
|
358
|
-
process2.on(sig, sigListeners[sig]);
|
|
359
|
-
return true;
|
|
360
|
-
} catch (er) {
|
|
361
|
-
return false;
|
|
362
|
-
}
|
|
363
|
-
});
|
|
364
|
-
process2.emit = processEmit;
|
|
365
|
-
process2.reallyExit = processReallyExit;
|
|
366
|
-
};
|
|
367
|
-
module.exports.load = load;
|
|
368
|
-
originalProcessReallyExit = process2.reallyExit;
|
|
369
|
-
processReallyExit = function processReallyExit2(code) {
|
|
370
|
-
if (!processOk(global.process)) {
|
|
371
|
-
return;
|
|
372
|
-
}
|
|
373
|
-
process2.exitCode = code || 0;
|
|
374
|
-
emit("exit", process2.exitCode, null);
|
|
375
|
-
emit("afterexit", process2.exitCode, null);
|
|
376
|
-
originalProcessReallyExit.call(process2, process2.exitCode);
|
|
377
|
-
};
|
|
378
|
-
originalProcessEmit = process2.emit;
|
|
379
|
-
processEmit = function processEmit2(ev, arg) {
|
|
380
|
-
if (ev === "exit" && processOk(global.process)) {
|
|
381
|
-
if (arg !== undefined) {
|
|
382
|
-
process2.exitCode = arg;
|
|
383
|
-
}
|
|
384
|
-
var ret = originalProcessEmit.apply(this, arguments);
|
|
385
|
-
emit("exit", process2.exitCode, null);
|
|
386
|
-
emit("afterexit", process2.exitCode, null);
|
|
387
|
-
return ret;
|
|
388
|
-
} else {
|
|
389
|
-
return originalProcessEmit.apply(this, arguments);
|
|
390
|
-
}
|
|
391
|
-
};
|
|
392
|
-
}
|
|
393
|
-
var assert;
|
|
394
|
-
var signals;
|
|
395
|
-
var isWin;
|
|
396
|
-
var EE;
|
|
397
|
-
var emitter;
|
|
398
|
-
var unload;
|
|
399
|
-
var emit;
|
|
400
|
-
var sigListeners;
|
|
401
|
-
var loaded;
|
|
402
|
-
var load;
|
|
403
|
-
var originalProcessReallyExit;
|
|
404
|
-
var processReallyExit;
|
|
405
|
-
var originalProcessEmit;
|
|
406
|
-
var processEmit;
|
|
407
|
-
});
|
|
408
|
-
|
|
409
|
-
// node_modules/.bun/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/mtime-precision.js
|
|
410
|
-
var require_mtime_precision = __commonJS((exports, module) => {
|
|
411
|
-
var cacheSymbol = Symbol();
|
|
412
|
-
function probe(file, fs, callback) {
|
|
413
|
-
const cachedPrecision = fs[cacheSymbol];
|
|
414
|
-
if (cachedPrecision) {
|
|
415
|
-
return fs.stat(file, (err, stat) => {
|
|
416
|
-
if (err) {
|
|
417
|
-
return callback(err);
|
|
418
|
-
}
|
|
419
|
-
callback(null, stat.mtime, cachedPrecision);
|
|
420
|
-
});
|
|
421
|
-
}
|
|
422
|
-
const mtime = new Date(Math.ceil(Date.now() / 1000) * 1000 + 5);
|
|
423
|
-
fs.utimes(file, mtime, mtime, (err) => {
|
|
424
|
-
if (err) {
|
|
425
|
-
return callback(err);
|
|
426
|
-
}
|
|
427
|
-
fs.stat(file, (err2, stat) => {
|
|
428
|
-
if (err2) {
|
|
429
|
-
return callback(err2);
|
|
430
|
-
}
|
|
431
|
-
const precision = stat.mtime.getTime() % 1000 === 0 ? "s" : "ms";
|
|
432
|
-
Object.defineProperty(fs, cacheSymbol, { value: precision });
|
|
433
|
-
callback(null, stat.mtime, precision);
|
|
434
|
-
});
|
|
435
|
-
});
|
|
436
|
-
}
|
|
437
|
-
function getMtime(precision) {
|
|
438
|
-
let now = Date.now();
|
|
439
|
-
if (precision === "s") {
|
|
440
|
-
now = Math.ceil(now / 1000) * 1000;
|
|
441
|
-
}
|
|
442
|
-
return new Date(now);
|
|
443
|
-
}
|
|
444
|
-
exports.probe = probe;
|
|
445
|
-
exports.getMtime = getMtime;
|
|
446
|
-
});
|
|
447
|
-
|
|
448
|
-
// node_modules/.bun/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/lockfile.js
|
|
449
|
-
var require_lockfile = __commonJS((exports, module) => {
|
|
450
|
-
var path = __require("path");
|
|
451
|
-
var fs = require_graceful_fs();
|
|
452
|
-
var retry = require_retry();
|
|
453
|
-
var onExit = require_signal_exit();
|
|
454
|
-
var mtimePrecision = require_mtime_precision();
|
|
455
|
-
var locks = {};
|
|
456
|
-
function getLockFile(file, options) {
|
|
457
|
-
return options.lockfilePath || `${file}.lock`;
|
|
458
|
-
}
|
|
459
|
-
function resolveCanonicalPath(file, options, callback) {
|
|
460
|
-
if (!options.realpath) {
|
|
461
|
-
return callback(null, path.resolve(file));
|
|
462
|
-
}
|
|
463
|
-
options.fs.realpath(file, callback);
|
|
464
|
-
}
|
|
465
|
-
function acquireLock(file, options, callback) {
|
|
466
|
-
const lockfilePath = getLockFile(file, options);
|
|
467
|
-
options.fs.mkdir(lockfilePath, (err) => {
|
|
468
|
-
if (!err) {
|
|
469
|
-
return mtimePrecision.probe(lockfilePath, options.fs, (err2, mtime, mtimePrecision2) => {
|
|
470
|
-
if (err2) {
|
|
471
|
-
options.fs.rmdir(lockfilePath, () => {});
|
|
472
|
-
return callback(err2);
|
|
473
|
-
}
|
|
474
|
-
callback(null, mtime, mtimePrecision2);
|
|
475
|
-
});
|
|
476
|
-
}
|
|
477
|
-
if (err.code !== "EEXIST") {
|
|
478
|
-
return callback(err);
|
|
479
|
-
}
|
|
480
|
-
if (options.stale <= 0) {
|
|
481
|
-
return callback(Object.assign(new Error("Lock file is already being held"), { code: "ELOCKED", file }));
|
|
482
|
-
}
|
|
483
|
-
options.fs.stat(lockfilePath, (err2, stat) => {
|
|
484
|
-
if (err2) {
|
|
485
|
-
if (err2.code === "ENOENT") {
|
|
486
|
-
return acquireLock(file, { ...options, stale: 0 }, callback);
|
|
487
|
-
}
|
|
488
|
-
return callback(err2);
|
|
489
|
-
}
|
|
490
|
-
if (!isLockStale(stat, options)) {
|
|
491
|
-
return callback(Object.assign(new Error("Lock file is already being held"), { code: "ELOCKED", file }));
|
|
492
|
-
}
|
|
493
|
-
removeLock(file, options, (err3) => {
|
|
494
|
-
if (err3) {
|
|
495
|
-
return callback(err3);
|
|
496
|
-
}
|
|
497
|
-
acquireLock(file, { ...options, stale: 0 }, callback);
|
|
498
|
-
});
|
|
499
|
-
});
|
|
500
|
-
});
|
|
501
|
-
}
|
|
502
|
-
function isLockStale(stat, options) {
|
|
503
|
-
return stat.mtime.getTime() < Date.now() - options.stale;
|
|
504
|
-
}
|
|
505
|
-
function removeLock(file, options, callback) {
|
|
506
|
-
options.fs.rmdir(getLockFile(file, options), (err) => {
|
|
507
|
-
if (err && err.code !== "ENOENT") {
|
|
508
|
-
return callback(err);
|
|
509
|
-
}
|
|
510
|
-
callback();
|
|
511
|
-
});
|
|
512
|
-
}
|
|
513
|
-
function updateLock(file, options) {
|
|
514
|
-
const lock2 = locks[file];
|
|
515
|
-
if (lock2.updateTimeout) {
|
|
516
|
-
return;
|
|
517
|
-
}
|
|
518
|
-
lock2.updateDelay = lock2.updateDelay || options.update;
|
|
519
|
-
lock2.updateTimeout = setTimeout(() => {
|
|
520
|
-
lock2.updateTimeout = null;
|
|
521
|
-
options.fs.stat(lock2.lockfilePath, (err, stat) => {
|
|
522
|
-
const isOverThreshold = lock2.lastUpdate + options.stale < Date.now();
|
|
523
|
-
if (err) {
|
|
524
|
-
if (err.code === "ENOENT" || isOverThreshold) {
|
|
525
|
-
return setLockAsCompromised(file, lock2, Object.assign(err, { code: "ECOMPROMISED" }));
|
|
526
|
-
}
|
|
527
|
-
lock2.updateDelay = 1000;
|
|
528
|
-
return updateLock(file, options);
|
|
529
|
-
}
|
|
530
|
-
const isMtimeOurs = lock2.mtime.getTime() === stat.mtime.getTime();
|
|
531
|
-
if (!isMtimeOurs) {
|
|
532
|
-
return setLockAsCompromised(file, lock2, Object.assign(new Error("Unable to update lock within the stale threshold"), { code: "ECOMPROMISED" }));
|
|
533
|
-
}
|
|
534
|
-
const mtime = mtimePrecision.getMtime(lock2.mtimePrecision);
|
|
535
|
-
options.fs.utimes(lock2.lockfilePath, mtime, mtime, (err2) => {
|
|
536
|
-
const isOverThreshold2 = lock2.lastUpdate + options.stale < Date.now();
|
|
537
|
-
if (lock2.released) {
|
|
538
|
-
return;
|
|
539
|
-
}
|
|
540
|
-
if (err2) {
|
|
541
|
-
if (err2.code === "ENOENT" || isOverThreshold2) {
|
|
542
|
-
return setLockAsCompromised(file, lock2, Object.assign(err2, { code: "ECOMPROMISED" }));
|
|
543
|
-
}
|
|
544
|
-
lock2.updateDelay = 1000;
|
|
545
|
-
return updateLock(file, options);
|
|
546
|
-
}
|
|
547
|
-
lock2.mtime = mtime;
|
|
548
|
-
lock2.lastUpdate = Date.now();
|
|
549
|
-
lock2.updateDelay = null;
|
|
550
|
-
updateLock(file, options);
|
|
551
|
-
});
|
|
552
|
-
});
|
|
553
|
-
}, lock2.updateDelay);
|
|
554
|
-
if (lock2.updateTimeout.unref) {
|
|
555
|
-
lock2.updateTimeout.unref();
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
function setLockAsCompromised(file, lock2, err) {
|
|
559
|
-
lock2.released = true;
|
|
560
|
-
if (lock2.updateTimeout) {
|
|
561
|
-
clearTimeout(lock2.updateTimeout);
|
|
562
|
-
}
|
|
563
|
-
if (locks[file] === lock2) {
|
|
564
|
-
delete locks[file];
|
|
565
|
-
}
|
|
566
|
-
lock2.options.onCompromised(err);
|
|
567
|
-
}
|
|
568
|
-
function lock(file, options, callback) {
|
|
569
|
-
options = {
|
|
570
|
-
stale: 1e4,
|
|
571
|
-
update: null,
|
|
572
|
-
realpath: true,
|
|
573
|
-
retries: 0,
|
|
574
|
-
fs,
|
|
575
|
-
onCompromised: (err) => {
|
|
576
|
-
throw err;
|
|
577
|
-
},
|
|
578
|
-
...options
|
|
579
|
-
};
|
|
580
|
-
options.retries = options.retries || 0;
|
|
581
|
-
options.retries = typeof options.retries === "number" ? { retries: options.retries } : options.retries;
|
|
582
|
-
options.stale = Math.max(options.stale || 0, 2000);
|
|
583
|
-
options.update = options.update == null ? options.stale / 2 : options.update || 0;
|
|
584
|
-
options.update = Math.max(Math.min(options.update, options.stale / 2), 1000);
|
|
585
|
-
resolveCanonicalPath(file, options, (err, file2) => {
|
|
586
|
-
if (err) {
|
|
587
|
-
return callback(err);
|
|
588
|
-
}
|
|
589
|
-
const operation = retry.operation(options.retries);
|
|
590
|
-
operation.attempt(() => {
|
|
591
|
-
acquireLock(file2, options, (err2, mtime, mtimePrecision2) => {
|
|
592
|
-
if (operation.retry(err2)) {
|
|
593
|
-
return;
|
|
594
|
-
}
|
|
595
|
-
if (err2) {
|
|
596
|
-
return callback(operation.mainError());
|
|
597
|
-
}
|
|
598
|
-
const lock2 = locks[file2] = {
|
|
599
|
-
lockfilePath: getLockFile(file2, options),
|
|
600
|
-
mtime,
|
|
601
|
-
mtimePrecision: mtimePrecision2,
|
|
602
|
-
options,
|
|
603
|
-
lastUpdate: Date.now()
|
|
604
|
-
};
|
|
605
|
-
updateLock(file2, options);
|
|
606
|
-
callback(null, (releasedCallback) => {
|
|
607
|
-
if (lock2.released) {
|
|
608
|
-
return releasedCallback && releasedCallback(Object.assign(new Error("Lock is already released"), { code: "ERELEASED" }));
|
|
609
|
-
}
|
|
610
|
-
unlock(file2, { ...options, realpath: false }, releasedCallback);
|
|
611
|
-
});
|
|
612
|
-
});
|
|
613
|
-
});
|
|
614
|
-
});
|
|
615
|
-
}
|
|
616
|
-
function unlock(file, options, callback) {
|
|
617
|
-
options = {
|
|
618
|
-
fs,
|
|
619
|
-
realpath: true,
|
|
620
|
-
...options
|
|
621
|
-
};
|
|
622
|
-
resolveCanonicalPath(file, options, (err, file2) => {
|
|
623
|
-
if (err) {
|
|
624
|
-
return callback(err);
|
|
625
|
-
}
|
|
626
|
-
const lock2 = locks[file2];
|
|
627
|
-
if (!lock2) {
|
|
628
|
-
return callback(Object.assign(new Error("Lock is not acquired/owned by you"), { code: "ENOTACQUIRED" }));
|
|
629
|
-
}
|
|
630
|
-
lock2.updateTimeout && clearTimeout(lock2.updateTimeout);
|
|
631
|
-
lock2.released = true;
|
|
632
|
-
delete locks[file2];
|
|
633
|
-
removeLock(file2, options, callback);
|
|
634
|
-
});
|
|
635
|
-
}
|
|
636
|
-
function check(file, options, callback) {
|
|
637
|
-
options = {
|
|
638
|
-
stale: 1e4,
|
|
639
|
-
realpath: true,
|
|
640
|
-
fs,
|
|
641
|
-
...options
|
|
642
|
-
};
|
|
643
|
-
options.stale = Math.max(options.stale || 0, 2000);
|
|
644
|
-
resolveCanonicalPath(file, options, (err, file2) => {
|
|
645
|
-
if (err) {
|
|
646
|
-
return callback(err);
|
|
647
|
-
}
|
|
648
|
-
options.fs.stat(getLockFile(file2, options), (err2, stat) => {
|
|
649
|
-
if (err2) {
|
|
650
|
-
return err2.code === "ENOENT" ? callback(null, false) : callback(err2);
|
|
651
|
-
}
|
|
652
|
-
return callback(null, !isLockStale(stat, options));
|
|
653
|
-
});
|
|
654
|
-
});
|
|
655
|
-
}
|
|
656
|
-
function getLocks() {
|
|
657
|
-
return locks;
|
|
658
|
-
}
|
|
659
|
-
onExit(() => {
|
|
660
|
-
for (const file in locks) {
|
|
661
|
-
const options = locks[file].options;
|
|
662
|
-
try {
|
|
663
|
-
options.fs.rmdirSync(getLockFile(file, options));
|
|
664
|
-
} catch (e) {}
|
|
665
|
-
}
|
|
666
|
-
});
|
|
667
|
-
exports.lock = lock;
|
|
668
|
-
exports.unlock = unlock;
|
|
669
|
-
exports.check = check;
|
|
670
|
-
exports.getLocks = getLocks;
|
|
671
|
-
});
|
|
672
|
-
|
|
673
|
-
// node_modules/.bun/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/adapter.js
|
|
674
|
-
var require_adapter = __commonJS((exports, module) => {
|
|
675
|
-
var fs = require_graceful_fs();
|
|
676
|
-
function createSyncFs(fs2) {
|
|
677
|
-
const methods = ["mkdir", "realpath", "stat", "rmdir", "utimes"];
|
|
678
|
-
const newFs = { ...fs2 };
|
|
679
|
-
methods.forEach((method) => {
|
|
680
|
-
newFs[method] = (...args) => {
|
|
681
|
-
const callback = args.pop();
|
|
682
|
-
let ret;
|
|
683
|
-
try {
|
|
684
|
-
ret = fs2[`${method}Sync`](...args);
|
|
685
|
-
} catch (err) {
|
|
686
|
-
return callback(err);
|
|
687
|
-
}
|
|
688
|
-
callback(null, ret);
|
|
689
|
-
};
|
|
690
|
-
});
|
|
691
|
-
return newFs;
|
|
692
|
-
}
|
|
693
|
-
function toPromise(method) {
|
|
694
|
-
return (...args) => new Promise((resolve, reject) => {
|
|
695
|
-
args.push((err, result) => {
|
|
696
|
-
if (err) {
|
|
697
|
-
reject(err);
|
|
698
|
-
} else {
|
|
699
|
-
resolve(result);
|
|
700
|
-
}
|
|
701
|
-
});
|
|
702
|
-
method(...args);
|
|
703
|
-
});
|
|
704
|
-
}
|
|
705
|
-
function toSync(method) {
|
|
706
|
-
return (...args) => {
|
|
707
|
-
let err;
|
|
708
|
-
let result;
|
|
709
|
-
args.push((_err, _result) => {
|
|
710
|
-
err = _err;
|
|
711
|
-
result = _result;
|
|
712
|
-
});
|
|
713
|
-
method(...args);
|
|
714
|
-
if (err) {
|
|
715
|
-
throw err;
|
|
716
|
-
}
|
|
717
|
-
return result;
|
|
718
|
-
};
|
|
719
|
-
}
|
|
720
|
-
function toSyncOptions(options) {
|
|
721
|
-
options = { ...options };
|
|
722
|
-
options.fs = createSyncFs(options.fs || fs);
|
|
723
|
-
if (typeof options.retries === "number" && options.retries > 0 || options.retries && typeof options.retries.retries === "number" && options.retries.retries > 0) {
|
|
724
|
-
throw Object.assign(new Error("Cannot use retries with the sync api"), { code: "ESYNC" });
|
|
725
|
-
}
|
|
726
|
-
return options;
|
|
727
|
-
}
|
|
728
|
-
module.exports = {
|
|
729
|
-
toPromise,
|
|
730
|
-
toSync,
|
|
731
|
-
toSyncOptions
|
|
732
|
-
};
|
|
733
|
-
});
|
|
734
|
-
|
|
735
|
-
// node_modules/.bun/proper-lockfile@4.1.2/node_modules/proper-lockfile/index.js
|
|
736
|
-
var require_proper_lockfile = __commonJS((exports, module) => {
|
|
737
|
-
var lockfile = require_lockfile();
|
|
738
|
-
var { toPromise, toSync, toSyncOptions } = require_adapter();
|
|
739
|
-
async function lock(file, options) {
|
|
740
|
-
const release = await toPromise(lockfile.lock)(file, options);
|
|
741
|
-
return toPromise(release);
|
|
742
|
-
}
|
|
743
|
-
function lockSync(file, options) {
|
|
744
|
-
const release = toSync(lockfile.lock)(file, toSyncOptions(options));
|
|
745
|
-
return toSync(release);
|
|
746
|
-
}
|
|
747
|
-
function unlock(file, options) {
|
|
748
|
-
return toPromise(lockfile.unlock)(file, options);
|
|
749
|
-
}
|
|
750
|
-
function unlockSync(file, options) {
|
|
751
|
-
return toSync(lockfile.unlock)(file, toSyncOptions(options));
|
|
752
|
-
}
|
|
753
|
-
function check(file, options) {
|
|
754
|
-
return toPromise(lockfile.check)(file, options);
|
|
755
|
-
}
|
|
756
|
-
function checkSync(file, options) {
|
|
757
|
-
return toSync(lockfile.check)(file, toSyncOptions(options));
|
|
758
|
-
}
|
|
759
|
-
module.exports = lock;
|
|
760
|
-
module.exports.lock = lock;
|
|
761
|
-
module.exports.unlock = unlock;
|
|
762
|
-
module.exports.lockSync = lockSync;
|
|
763
|
-
module.exports.unlockSync = unlockSync;
|
|
764
|
-
module.exports.check = check;
|
|
765
|
-
module.exports.checkSync = checkSync;
|
|
766
|
-
});
|
|
767
|
-
|
|
768
|
-
// src/utils/lockfile.ts
|
|
769
|
-
function getLockfile() {
|
|
770
|
-
if (!_lockfile) {
|
|
771
|
-
_lockfile = require_proper_lockfile();
|
|
772
|
-
}
|
|
773
|
-
return _lockfile;
|
|
774
|
-
}
|
|
775
|
-
function lock(file, options) {
|
|
776
|
-
return getLockfile().lock(file, options);
|
|
777
|
-
}
|
|
778
|
-
function lockSync(file, options) {
|
|
779
|
-
return getLockfile().lockSync(file, options);
|
|
780
|
-
}
|
|
781
|
-
function unlock(file, options) {
|
|
782
|
-
return getLockfile().unlock(file, options);
|
|
783
|
-
}
|
|
784
|
-
function check(file, options) {
|
|
785
|
-
return getLockfile().check(file, options);
|
|
786
|
-
}
|
|
787
|
-
var _lockfile;
|
|
788
|
-
var init_lockfile = () => {};
|
|
789
|
-
|
|
790
|
-
export { intersperse, count, uniq, init_array, lock, lockSync, unlock, check, init_lockfile };
|