switchroom 0.7.10 → 0.7.13
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/agent-scheduler/index.js +1 -1
- package/dist/cli/switchroom.js +2971 -944
- package/dist/vault/approvals/kernel-server.js +18 -1
- package/dist/vault/broker/server.js +1991 -84
- package/package.json +4 -2
- package/telegram-plugin/dist/foreman/foreman.js +1552 -7
- package/telegram-plugin/dist/gateway/gateway.js +1560 -15
|
@@ -23533,7 +23533,7 @@ var init_schema = __esm(() => {
|
|
|
23533
23533
|
}).optional()
|
|
23534
23534
|
});
|
|
23535
23535
|
VaultConfigSchema = exports_external.object({
|
|
23536
|
-
path: exports_external.string().default("~/.switchroom/vault.enc").describe("Path to encrypted vault file"),
|
|
23536
|
+
path: exports_external.string().default("~/.switchroom/vault/vault.enc").describe("Path to encrypted vault file. v0.7.12+ canonical default is " + "`~/.switchroom/vault/vault.enc` (parent-dir bind-mount enables " + "atomic-rename writes from the broker container). Older installs " + "with `~/.switchroom/vault.enc` are auto-migrated on `switchroom " + "apply`; the legacy path becomes a symlink for v0.7.10/.11 CLI " + "compatibility (sunset in v0.7.14)."),
|
|
23537
23537
|
broker: exports_external.object({
|
|
23538
23538
|
socket: exports_external.string().default("~/.switchroom/vault-broker.sock").describe("Unix domain socket path for the vault-broker daemon"),
|
|
23539
23539
|
enabled: exports_external.boolean().default(true).describe("Whether to start the vault-broker daemon on agent launch"),
|
|
@@ -26791,7 +26791,7 @@ function decodeResponse(line) {
|
|
|
26791
26791
|
const obj = JSON.parse(line);
|
|
26792
26792
|
return ResponseSchema.parse(obj);
|
|
26793
26793
|
}
|
|
26794
|
-
var MAX_FRAME_BYTES, GetRequestSchema, ListRequestSchema, MintGrantRequestSchema, ListGrantsRequestSchema, RevokeGrantRequestSchema, StatusRequestSchema, LockRequestSchema, ApprovalRequestRequestSchema, ApprovalLookupRequestSchema, ApprovalConsumeRequestSchema, ApprovalRevokeRequestSchema, ApprovalListRequestSchema, ApprovalDecisionModeSchema, ApprovalRecordRequestSchema, RequestSchema, VaultEntrySchema, ErrorCode, OkEntryResponseSchema, OkKeysResponseSchema, BrokerStatus, OkStatusResponseSchema, OkLockResponseSchema, OkMintGrantResponseSchema, GrantMetaSchema, OkListGrantsResponseSchema, OkRevokeGrantResponseSchema, OkApprovalRequestResponseSchema, ApprovalDecisionMetaSchema, OkApprovalLookupResponseSchema, OkApprovalConsumeResponseSchema, OkApprovalRevokeResponseSchema, OkApprovalListResponseSchema, OkApprovalRecordResponseSchema, ErrorResponseSchema, ResponseSchema;
|
|
26794
|
+
var MAX_FRAME_BYTES, GetRequestSchema, PutRequestSchema, ListRequestSchema, MintGrantRequestSchema, ListGrantsRequestSchema, RevokeGrantRequestSchema, StatusRequestSchema, LockRequestSchema, ApprovalRequestRequestSchema, ApprovalLookupRequestSchema, ApprovalConsumeRequestSchema, ApprovalRevokeRequestSchema, ApprovalListRequestSchema, ApprovalDecisionModeSchema, ApprovalRecordRequestSchema, RequestSchema, VaultEntrySchema, ErrorCode, OkEntryResponseSchema, OkKeysResponseSchema, BrokerStatus, OkStatusResponseSchema, OkLockResponseSchema, OkPutResponseSchema, OkMintGrantResponseSchema, GrantMetaSchema, OkListGrantsResponseSchema, OkRevokeGrantResponseSchema, OkApprovalRequestResponseSchema, ApprovalDecisionMetaSchema, OkApprovalLookupResponseSchema, OkApprovalConsumeResponseSchema, OkApprovalRevokeResponseSchema, OkApprovalListResponseSchema, OkApprovalRecordResponseSchema, ErrorResponseSchema, ResponseSchema;
|
|
26795
26795
|
var init_protocol = __esm(() => {
|
|
26796
26796
|
init_zod();
|
|
26797
26797
|
MAX_FRAME_BYTES = 64 * 1024;
|
|
@@ -26802,6 +26802,16 @@ var init_protocol = __esm(() => {
|
|
|
26802
26802
|
filename: exports_external.string().optional(),
|
|
26803
26803
|
token: exports_external.string().optional()
|
|
26804
26804
|
});
|
|
26805
|
+
PutRequestSchema = exports_external.object({
|
|
26806
|
+
v: exports_external.literal(1),
|
|
26807
|
+
op: exports_external.literal("put"),
|
|
26808
|
+
key: exports_external.string().min(1),
|
|
26809
|
+
entry: exports_external.union([
|
|
26810
|
+
exports_external.object({ kind: exports_external.literal("string"), value: exports_external.string() }),
|
|
26811
|
+
exports_external.object({ kind: exports_external.literal("binary"), value: exports_external.string() })
|
|
26812
|
+
]),
|
|
26813
|
+
token: exports_external.string().optional()
|
|
26814
|
+
});
|
|
26805
26815
|
ListRequestSchema = exports_external.object({
|
|
26806
26816
|
v: exports_external.literal(1),
|
|
26807
26817
|
op: exports_external.literal("list"),
|
|
@@ -26886,6 +26896,7 @@ var init_protocol = __esm(() => {
|
|
|
26886
26896
|
});
|
|
26887
26897
|
RequestSchema = exports_external.discriminatedUnion("op", [
|
|
26888
26898
|
GetRequestSchema,
|
|
26899
|
+
PutRequestSchema,
|
|
26889
26900
|
ListRequestSchema,
|
|
26890
26901
|
StatusRequestSchema,
|
|
26891
26902
|
LockRequestSchema,
|
|
@@ -26938,6 +26949,11 @@ var init_protocol = __esm(() => {
|
|
|
26938
26949
|
ok: exports_external.literal(true),
|
|
26939
26950
|
locked: exports_external.literal(true)
|
|
26940
26951
|
});
|
|
26952
|
+
OkPutResponseSchema = exports_external.object({
|
|
26953
|
+
ok: exports_external.literal(true),
|
|
26954
|
+
put: exports_external.literal(true),
|
|
26955
|
+
key: exports_external.string()
|
|
26956
|
+
});
|
|
26941
26957
|
OkMintGrantResponseSchema = exports_external.object({
|
|
26942
26958
|
ok: exports_external.literal(true),
|
|
26943
26959
|
token: exports_external.string(),
|
|
@@ -27023,6 +27039,7 @@ var init_protocol = __esm(() => {
|
|
|
27023
27039
|
OkKeysResponseSchema,
|
|
27024
27040
|
OkStatusResponseSchema,
|
|
27025
27041
|
OkLockResponseSchema,
|
|
27042
|
+
OkPutResponseSchema,
|
|
27026
27043
|
OkMintGrantResponseSchema,
|
|
27027
27044
|
OkListGrantsResponseSchema,
|
|
27028
27045
|
OkRevokeGrantResponseSchema,
|
|
@@ -27141,6 +27158,1526 @@ var init_client = __esm(() => {
|
|
|
27141
27158
|
DEFAULT_SOCKET_PATH2 = join26(homedir7(), ".switchroom", "vault-broker.sock");
|
|
27142
27159
|
});
|
|
27143
27160
|
|
|
27161
|
+
// ../node_modules/.bun/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js
|
|
27162
|
+
var require_polyfills = __commonJS((exports, module) => {
|
|
27163
|
+
var constants = __require("constants");
|
|
27164
|
+
var origCwd = process.cwd;
|
|
27165
|
+
var cwd = null;
|
|
27166
|
+
var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
|
|
27167
|
+
process.cwd = function() {
|
|
27168
|
+
if (!cwd)
|
|
27169
|
+
cwd = origCwd.call(process);
|
|
27170
|
+
return cwd;
|
|
27171
|
+
};
|
|
27172
|
+
try {
|
|
27173
|
+
process.cwd();
|
|
27174
|
+
} catch (er) {}
|
|
27175
|
+
if (typeof process.chdir === "function") {
|
|
27176
|
+
chdir = process.chdir;
|
|
27177
|
+
process.chdir = function(d) {
|
|
27178
|
+
cwd = null;
|
|
27179
|
+
chdir.call(process, d);
|
|
27180
|
+
};
|
|
27181
|
+
if (Object.setPrototypeOf)
|
|
27182
|
+
Object.setPrototypeOf(process.chdir, chdir);
|
|
27183
|
+
}
|
|
27184
|
+
var chdir;
|
|
27185
|
+
module.exports = patch;
|
|
27186
|
+
function patch(fs) {
|
|
27187
|
+
if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
|
|
27188
|
+
patchLchmod(fs);
|
|
27189
|
+
}
|
|
27190
|
+
if (!fs.lutimes) {
|
|
27191
|
+
patchLutimes(fs);
|
|
27192
|
+
}
|
|
27193
|
+
fs.chown = chownFix(fs.chown);
|
|
27194
|
+
fs.fchown = chownFix(fs.fchown);
|
|
27195
|
+
fs.lchown = chownFix(fs.lchown);
|
|
27196
|
+
fs.chmod = chmodFix(fs.chmod);
|
|
27197
|
+
fs.fchmod = chmodFix(fs.fchmod);
|
|
27198
|
+
fs.lchmod = chmodFix(fs.lchmod);
|
|
27199
|
+
fs.chownSync = chownFixSync(fs.chownSync);
|
|
27200
|
+
fs.fchownSync = chownFixSync(fs.fchownSync);
|
|
27201
|
+
fs.lchownSync = chownFixSync(fs.lchownSync);
|
|
27202
|
+
fs.chmodSync = chmodFixSync(fs.chmodSync);
|
|
27203
|
+
fs.fchmodSync = chmodFixSync(fs.fchmodSync);
|
|
27204
|
+
fs.lchmodSync = chmodFixSync(fs.lchmodSync);
|
|
27205
|
+
fs.stat = statFix(fs.stat);
|
|
27206
|
+
fs.fstat = statFix(fs.fstat);
|
|
27207
|
+
fs.lstat = statFix(fs.lstat);
|
|
27208
|
+
fs.statSync = statFixSync(fs.statSync);
|
|
27209
|
+
fs.fstatSync = statFixSync(fs.fstatSync);
|
|
27210
|
+
fs.lstatSync = statFixSync(fs.lstatSync);
|
|
27211
|
+
if (fs.chmod && !fs.lchmod) {
|
|
27212
|
+
fs.lchmod = function(path, mode, cb) {
|
|
27213
|
+
if (cb)
|
|
27214
|
+
process.nextTick(cb);
|
|
27215
|
+
};
|
|
27216
|
+
fs.lchmodSync = function() {};
|
|
27217
|
+
}
|
|
27218
|
+
if (fs.chown && !fs.lchown) {
|
|
27219
|
+
fs.lchown = function(path, uid, gid, cb) {
|
|
27220
|
+
if (cb)
|
|
27221
|
+
process.nextTick(cb);
|
|
27222
|
+
};
|
|
27223
|
+
fs.lchownSync = function() {};
|
|
27224
|
+
}
|
|
27225
|
+
if (platform === "win32") {
|
|
27226
|
+
fs.rename = typeof fs.rename !== "function" ? fs.rename : function(fs$rename) {
|
|
27227
|
+
function rename(from, to, cb) {
|
|
27228
|
+
var start = Date.now();
|
|
27229
|
+
var backoff = 0;
|
|
27230
|
+
fs$rename(from, to, function CB(er) {
|
|
27231
|
+
if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 60000) {
|
|
27232
|
+
setTimeout(function() {
|
|
27233
|
+
fs.stat(to, function(stater, st) {
|
|
27234
|
+
if (stater && stater.code === "ENOENT")
|
|
27235
|
+
fs$rename(from, to, CB);
|
|
27236
|
+
else
|
|
27237
|
+
cb(er);
|
|
27238
|
+
});
|
|
27239
|
+
}, backoff);
|
|
27240
|
+
if (backoff < 100)
|
|
27241
|
+
backoff += 10;
|
|
27242
|
+
return;
|
|
27243
|
+
}
|
|
27244
|
+
if (cb)
|
|
27245
|
+
cb(er);
|
|
27246
|
+
});
|
|
27247
|
+
}
|
|
27248
|
+
if (Object.setPrototypeOf)
|
|
27249
|
+
Object.setPrototypeOf(rename, fs$rename);
|
|
27250
|
+
return rename;
|
|
27251
|
+
}(fs.rename);
|
|
27252
|
+
}
|
|
27253
|
+
fs.read = typeof fs.read !== "function" ? fs.read : function(fs$read) {
|
|
27254
|
+
function read(fd, buffer, offset, length, position, callback_) {
|
|
27255
|
+
var callback;
|
|
27256
|
+
if (callback_ && typeof callback_ === "function") {
|
|
27257
|
+
var eagCounter = 0;
|
|
27258
|
+
callback = function(er, _, __) {
|
|
27259
|
+
if (er && er.code === "EAGAIN" && eagCounter < 10) {
|
|
27260
|
+
eagCounter++;
|
|
27261
|
+
return fs$read.call(fs, fd, buffer, offset, length, position, callback);
|
|
27262
|
+
}
|
|
27263
|
+
callback_.apply(this, arguments);
|
|
27264
|
+
};
|
|
27265
|
+
}
|
|
27266
|
+
return fs$read.call(fs, fd, buffer, offset, length, position, callback);
|
|
27267
|
+
}
|
|
27268
|
+
if (Object.setPrototypeOf)
|
|
27269
|
+
Object.setPrototypeOf(read, fs$read);
|
|
27270
|
+
return read;
|
|
27271
|
+
}(fs.read);
|
|
27272
|
+
fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) {
|
|
27273
|
+
return function(fd, buffer, offset, length, position) {
|
|
27274
|
+
var eagCounter = 0;
|
|
27275
|
+
while (true) {
|
|
27276
|
+
try {
|
|
27277
|
+
return fs$readSync.call(fs, fd, buffer, offset, length, position);
|
|
27278
|
+
} catch (er) {
|
|
27279
|
+
if (er.code === "EAGAIN" && eagCounter < 10) {
|
|
27280
|
+
eagCounter++;
|
|
27281
|
+
continue;
|
|
27282
|
+
}
|
|
27283
|
+
throw er;
|
|
27284
|
+
}
|
|
27285
|
+
}
|
|
27286
|
+
};
|
|
27287
|
+
}(fs.readSync);
|
|
27288
|
+
function patchLchmod(fs2) {
|
|
27289
|
+
fs2.lchmod = function(path, mode, callback) {
|
|
27290
|
+
fs2.open(path, constants.O_WRONLY | constants.O_SYMLINK, mode, function(err, fd) {
|
|
27291
|
+
if (err) {
|
|
27292
|
+
if (callback)
|
|
27293
|
+
callback(err);
|
|
27294
|
+
return;
|
|
27295
|
+
}
|
|
27296
|
+
fs2.fchmod(fd, mode, function(err2) {
|
|
27297
|
+
fs2.close(fd, function(err22) {
|
|
27298
|
+
if (callback)
|
|
27299
|
+
callback(err2 || err22);
|
|
27300
|
+
});
|
|
27301
|
+
});
|
|
27302
|
+
});
|
|
27303
|
+
};
|
|
27304
|
+
fs2.lchmodSync = function(path, mode) {
|
|
27305
|
+
var fd = fs2.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode);
|
|
27306
|
+
var threw = true;
|
|
27307
|
+
var ret;
|
|
27308
|
+
try {
|
|
27309
|
+
ret = fs2.fchmodSync(fd, mode);
|
|
27310
|
+
threw = false;
|
|
27311
|
+
} finally {
|
|
27312
|
+
if (threw) {
|
|
27313
|
+
try {
|
|
27314
|
+
fs2.closeSync(fd);
|
|
27315
|
+
} catch (er) {}
|
|
27316
|
+
} else {
|
|
27317
|
+
fs2.closeSync(fd);
|
|
27318
|
+
}
|
|
27319
|
+
}
|
|
27320
|
+
return ret;
|
|
27321
|
+
};
|
|
27322
|
+
}
|
|
27323
|
+
function patchLutimes(fs2) {
|
|
27324
|
+
if (constants.hasOwnProperty("O_SYMLINK") && fs2.futimes) {
|
|
27325
|
+
fs2.lutimes = function(path, at, mt, cb) {
|
|
27326
|
+
fs2.open(path, constants.O_SYMLINK, function(er, fd) {
|
|
27327
|
+
if (er) {
|
|
27328
|
+
if (cb)
|
|
27329
|
+
cb(er);
|
|
27330
|
+
return;
|
|
27331
|
+
}
|
|
27332
|
+
fs2.futimes(fd, at, mt, function(er2) {
|
|
27333
|
+
fs2.close(fd, function(er22) {
|
|
27334
|
+
if (cb)
|
|
27335
|
+
cb(er2 || er22);
|
|
27336
|
+
});
|
|
27337
|
+
});
|
|
27338
|
+
});
|
|
27339
|
+
};
|
|
27340
|
+
fs2.lutimesSync = function(path, at, mt) {
|
|
27341
|
+
var fd = fs2.openSync(path, constants.O_SYMLINK);
|
|
27342
|
+
var ret;
|
|
27343
|
+
var threw = true;
|
|
27344
|
+
try {
|
|
27345
|
+
ret = fs2.futimesSync(fd, at, mt);
|
|
27346
|
+
threw = false;
|
|
27347
|
+
} finally {
|
|
27348
|
+
if (threw) {
|
|
27349
|
+
try {
|
|
27350
|
+
fs2.closeSync(fd);
|
|
27351
|
+
} catch (er) {}
|
|
27352
|
+
} else {
|
|
27353
|
+
fs2.closeSync(fd);
|
|
27354
|
+
}
|
|
27355
|
+
}
|
|
27356
|
+
return ret;
|
|
27357
|
+
};
|
|
27358
|
+
} else if (fs2.futimes) {
|
|
27359
|
+
fs2.lutimes = function(_a, _b, _c, cb) {
|
|
27360
|
+
if (cb)
|
|
27361
|
+
process.nextTick(cb);
|
|
27362
|
+
};
|
|
27363
|
+
fs2.lutimesSync = function() {};
|
|
27364
|
+
}
|
|
27365
|
+
}
|
|
27366
|
+
function chmodFix(orig) {
|
|
27367
|
+
if (!orig)
|
|
27368
|
+
return orig;
|
|
27369
|
+
return function(target, mode, cb) {
|
|
27370
|
+
return orig.call(fs, target, mode, function(er) {
|
|
27371
|
+
if (chownErOk(er))
|
|
27372
|
+
er = null;
|
|
27373
|
+
if (cb)
|
|
27374
|
+
cb.apply(this, arguments);
|
|
27375
|
+
});
|
|
27376
|
+
};
|
|
27377
|
+
}
|
|
27378
|
+
function chmodFixSync(orig) {
|
|
27379
|
+
if (!orig)
|
|
27380
|
+
return orig;
|
|
27381
|
+
return function(target, mode) {
|
|
27382
|
+
try {
|
|
27383
|
+
return orig.call(fs, target, mode);
|
|
27384
|
+
} catch (er) {
|
|
27385
|
+
if (!chownErOk(er))
|
|
27386
|
+
throw er;
|
|
27387
|
+
}
|
|
27388
|
+
};
|
|
27389
|
+
}
|
|
27390
|
+
function chownFix(orig) {
|
|
27391
|
+
if (!orig)
|
|
27392
|
+
return orig;
|
|
27393
|
+
return function(target, uid, gid, cb) {
|
|
27394
|
+
return orig.call(fs, target, uid, gid, function(er) {
|
|
27395
|
+
if (chownErOk(er))
|
|
27396
|
+
er = null;
|
|
27397
|
+
if (cb)
|
|
27398
|
+
cb.apply(this, arguments);
|
|
27399
|
+
});
|
|
27400
|
+
};
|
|
27401
|
+
}
|
|
27402
|
+
function chownFixSync(orig) {
|
|
27403
|
+
if (!orig)
|
|
27404
|
+
return orig;
|
|
27405
|
+
return function(target, uid, gid) {
|
|
27406
|
+
try {
|
|
27407
|
+
return orig.call(fs, target, uid, gid);
|
|
27408
|
+
} catch (er) {
|
|
27409
|
+
if (!chownErOk(er))
|
|
27410
|
+
throw er;
|
|
27411
|
+
}
|
|
27412
|
+
};
|
|
27413
|
+
}
|
|
27414
|
+
function statFix(orig) {
|
|
27415
|
+
if (!orig)
|
|
27416
|
+
return orig;
|
|
27417
|
+
return function(target, options, cb) {
|
|
27418
|
+
if (typeof options === "function") {
|
|
27419
|
+
cb = options;
|
|
27420
|
+
options = null;
|
|
27421
|
+
}
|
|
27422
|
+
function callback(er, stats) {
|
|
27423
|
+
if (stats) {
|
|
27424
|
+
if (stats.uid < 0)
|
|
27425
|
+
stats.uid += 4294967296;
|
|
27426
|
+
if (stats.gid < 0)
|
|
27427
|
+
stats.gid += 4294967296;
|
|
27428
|
+
}
|
|
27429
|
+
if (cb)
|
|
27430
|
+
cb.apply(this, arguments);
|
|
27431
|
+
}
|
|
27432
|
+
return options ? orig.call(fs, target, options, callback) : orig.call(fs, target, callback);
|
|
27433
|
+
};
|
|
27434
|
+
}
|
|
27435
|
+
function statFixSync(orig) {
|
|
27436
|
+
if (!orig)
|
|
27437
|
+
return orig;
|
|
27438
|
+
return function(target, options) {
|
|
27439
|
+
var stats = options ? orig.call(fs, target, options) : orig.call(fs, target);
|
|
27440
|
+
if (stats) {
|
|
27441
|
+
if (stats.uid < 0)
|
|
27442
|
+
stats.uid += 4294967296;
|
|
27443
|
+
if (stats.gid < 0)
|
|
27444
|
+
stats.gid += 4294967296;
|
|
27445
|
+
}
|
|
27446
|
+
return stats;
|
|
27447
|
+
};
|
|
27448
|
+
}
|
|
27449
|
+
function chownErOk(er) {
|
|
27450
|
+
if (!er)
|
|
27451
|
+
return true;
|
|
27452
|
+
if (er.code === "ENOSYS")
|
|
27453
|
+
return true;
|
|
27454
|
+
var nonroot = !process.getuid || process.getuid() !== 0;
|
|
27455
|
+
if (nonroot) {
|
|
27456
|
+
if (er.code === "EINVAL" || er.code === "EPERM")
|
|
27457
|
+
return true;
|
|
27458
|
+
}
|
|
27459
|
+
return false;
|
|
27460
|
+
}
|
|
27461
|
+
}
|
|
27462
|
+
});
|
|
27463
|
+
|
|
27464
|
+
// ../node_modules/.bun/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js
|
|
27465
|
+
var require_legacy_streams = __commonJS((exports, module) => {
|
|
27466
|
+
var Stream = __require("stream").Stream;
|
|
27467
|
+
module.exports = legacy;
|
|
27468
|
+
function legacy(fs) {
|
|
27469
|
+
return {
|
|
27470
|
+
ReadStream,
|
|
27471
|
+
WriteStream
|
|
27472
|
+
};
|
|
27473
|
+
function ReadStream(path, options) {
|
|
27474
|
+
if (!(this instanceof ReadStream))
|
|
27475
|
+
return new ReadStream(path, options);
|
|
27476
|
+
Stream.call(this);
|
|
27477
|
+
var self2 = this;
|
|
27478
|
+
this.path = path;
|
|
27479
|
+
this.fd = null;
|
|
27480
|
+
this.readable = true;
|
|
27481
|
+
this.paused = false;
|
|
27482
|
+
this.flags = "r";
|
|
27483
|
+
this.mode = 438;
|
|
27484
|
+
this.bufferSize = 64 * 1024;
|
|
27485
|
+
options = options || {};
|
|
27486
|
+
var keys = Object.keys(options);
|
|
27487
|
+
for (var index = 0, length = keys.length;index < length; index++) {
|
|
27488
|
+
var key = keys[index];
|
|
27489
|
+
this[key] = options[key];
|
|
27490
|
+
}
|
|
27491
|
+
if (this.encoding)
|
|
27492
|
+
this.setEncoding(this.encoding);
|
|
27493
|
+
if (this.start !== undefined) {
|
|
27494
|
+
if (typeof this.start !== "number") {
|
|
27495
|
+
throw TypeError("start must be a Number");
|
|
27496
|
+
}
|
|
27497
|
+
if (this.end === undefined) {
|
|
27498
|
+
this.end = Infinity;
|
|
27499
|
+
} else if (typeof this.end !== "number") {
|
|
27500
|
+
throw TypeError("end must be a Number");
|
|
27501
|
+
}
|
|
27502
|
+
if (this.start > this.end) {
|
|
27503
|
+
throw new Error("start must be <= end");
|
|
27504
|
+
}
|
|
27505
|
+
this.pos = this.start;
|
|
27506
|
+
}
|
|
27507
|
+
if (this.fd !== null) {
|
|
27508
|
+
process.nextTick(function() {
|
|
27509
|
+
self2._read();
|
|
27510
|
+
});
|
|
27511
|
+
return;
|
|
27512
|
+
}
|
|
27513
|
+
fs.open(this.path, this.flags, this.mode, function(err, fd) {
|
|
27514
|
+
if (err) {
|
|
27515
|
+
self2.emit("error", err);
|
|
27516
|
+
self2.readable = false;
|
|
27517
|
+
return;
|
|
27518
|
+
}
|
|
27519
|
+
self2.fd = fd;
|
|
27520
|
+
self2.emit("open", fd);
|
|
27521
|
+
self2._read();
|
|
27522
|
+
});
|
|
27523
|
+
}
|
|
27524
|
+
function WriteStream(path, options) {
|
|
27525
|
+
if (!(this instanceof WriteStream))
|
|
27526
|
+
return new WriteStream(path, options);
|
|
27527
|
+
Stream.call(this);
|
|
27528
|
+
this.path = path;
|
|
27529
|
+
this.fd = null;
|
|
27530
|
+
this.writable = true;
|
|
27531
|
+
this.flags = "w";
|
|
27532
|
+
this.encoding = "binary";
|
|
27533
|
+
this.mode = 438;
|
|
27534
|
+
this.bytesWritten = 0;
|
|
27535
|
+
options = options || {};
|
|
27536
|
+
var keys = Object.keys(options);
|
|
27537
|
+
for (var index = 0, length = keys.length;index < length; index++) {
|
|
27538
|
+
var key = keys[index];
|
|
27539
|
+
this[key] = options[key];
|
|
27540
|
+
}
|
|
27541
|
+
if (this.start !== undefined) {
|
|
27542
|
+
if (typeof this.start !== "number") {
|
|
27543
|
+
throw TypeError("start must be a Number");
|
|
27544
|
+
}
|
|
27545
|
+
if (this.start < 0) {
|
|
27546
|
+
throw new Error("start must be >= zero");
|
|
27547
|
+
}
|
|
27548
|
+
this.pos = this.start;
|
|
27549
|
+
}
|
|
27550
|
+
this.busy = false;
|
|
27551
|
+
this._queue = [];
|
|
27552
|
+
if (this.fd === null) {
|
|
27553
|
+
this._open = fs.open;
|
|
27554
|
+
this._queue.push([this._open, this.path, this.flags, this.mode, undefined]);
|
|
27555
|
+
this.flush();
|
|
27556
|
+
}
|
|
27557
|
+
}
|
|
27558
|
+
}
|
|
27559
|
+
});
|
|
27560
|
+
|
|
27561
|
+
// ../node_modules/.bun/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js
|
|
27562
|
+
var require_clone = __commonJS((exports, module) => {
|
|
27563
|
+
module.exports = clone;
|
|
27564
|
+
var getPrototypeOf = Object.getPrototypeOf || function(obj) {
|
|
27565
|
+
return obj.__proto__;
|
|
27566
|
+
};
|
|
27567
|
+
function clone(obj) {
|
|
27568
|
+
if (obj === null || typeof obj !== "object")
|
|
27569
|
+
return obj;
|
|
27570
|
+
if (obj instanceof Object)
|
|
27571
|
+
var copy = { __proto__: getPrototypeOf(obj) };
|
|
27572
|
+
else
|
|
27573
|
+
var copy = Object.create(null);
|
|
27574
|
+
Object.getOwnPropertyNames(obj).forEach(function(key) {
|
|
27575
|
+
Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
|
|
27576
|
+
});
|
|
27577
|
+
return copy;
|
|
27578
|
+
}
|
|
27579
|
+
});
|
|
27580
|
+
|
|
27581
|
+
// ../node_modules/.bun/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
|
|
27582
|
+
var require_graceful_fs = __commonJS((exports, module) => {
|
|
27583
|
+
var fs = __require("fs");
|
|
27584
|
+
var polyfills = require_polyfills();
|
|
27585
|
+
var legacy = require_legacy_streams();
|
|
27586
|
+
var clone = require_clone();
|
|
27587
|
+
var util3 = __require("util");
|
|
27588
|
+
var gracefulQueue;
|
|
27589
|
+
var previousSymbol;
|
|
27590
|
+
if (typeof Symbol === "function" && typeof Symbol.for === "function") {
|
|
27591
|
+
gracefulQueue = Symbol.for("graceful-fs.queue");
|
|
27592
|
+
previousSymbol = Symbol.for("graceful-fs.previous");
|
|
27593
|
+
} else {
|
|
27594
|
+
gracefulQueue = "___graceful-fs.queue";
|
|
27595
|
+
previousSymbol = "___graceful-fs.previous";
|
|
27596
|
+
}
|
|
27597
|
+
function noop() {}
|
|
27598
|
+
function publishQueue(context, queue2) {
|
|
27599
|
+
Object.defineProperty(context, gracefulQueue, {
|
|
27600
|
+
get: function() {
|
|
27601
|
+
return queue2;
|
|
27602
|
+
}
|
|
27603
|
+
});
|
|
27604
|
+
}
|
|
27605
|
+
var debug2 = noop;
|
|
27606
|
+
if (util3.debuglog)
|
|
27607
|
+
debug2 = util3.debuglog("gfs4");
|
|
27608
|
+
else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
|
|
27609
|
+
debug2 = function() {
|
|
27610
|
+
var m = util3.format.apply(util3, arguments);
|
|
27611
|
+
m = "GFS4: " + m.split(/\n/).join(`
|
|
27612
|
+
GFS4: `);
|
|
27613
|
+
console.error(m);
|
|
27614
|
+
};
|
|
27615
|
+
if (!fs[gracefulQueue]) {
|
|
27616
|
+
queue = global[gracefulQueue] || [];
|
|
27617
|
+
publishQueue(fs, queue);
|
|
27618
|
+
fs.close = function(fs$close) {
|
|
27619
|
+
function close(fd, cb) {
|
|
27620
|
+
return fs$close.call(fs, fd, function(err) {
|
|
27621
|
+
if (!err) {
|
|
27622
|
+
resetQueue();
|
|
27623
|
+
}
|
|
27624
|
+
if (typeof cb === "function")
|
|
27625
|
+
cb.apply(this, arguments);
|
|
27626
|
+
});
|
|
27627
|
+
}
|
|
27628
|
+
Object.defineProperty(close, previousSymbol, {
|
|
27629
|
+
value: fs$close
|
|
27630
|
+
});
|
|
27631
|
+
return close;
|
|
27632
|
+
}(fs.close);
|
|
27633
|
+
fs.closeSync = function(fs$closeSync) {
|
|
27634
|
+
function closeSync5(fd) {
|
|
27635
|
+
fs$closeSync.apply(fs, arguments);
|
|
27636
|
+
resetQueue();
|
|
27637
|
+
}
|
|
27638
|
+
Object.defineProperty(closeSync5, previousSymbol, {
|
|
27639
|
+
value: fs$closeSync
|
|
27640
|
+
});
|
|
27641
|
+
return closeSync5;
|
|
27642
|
+
}(fs.closeSync);
|
|
27643
|
+
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
|
|
27644
|
+
process.on("exit", function() {
|
|
27645
|
+
debug2(fs[gracefulQueue]);
|
|
27646
|
+
__require("assert").equal(fs[gracefulQueue].length, 0);
|
|
27647
|
+
});
|
|
27648
|
+
}
|
|
27649
|
+
}
|
|
27650
|
+
var queue;
|
|
27651
|
+
if (!global[gracefulQueue]) {
|
|
27652
|
+
publishQueue(global, fs[gracefulQueue]);
|
|
27653
|
+
}
|
|
27654
|
+
module.exports = patch(clone(fs));
|
|
27655
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
|
|
27656
|
+
module.exports = patch(fs);
|
|
27657
|
+
fs.__patched = true;
|
|
27658
|
+
}
|
|
27659
|
+
function patch(fs2) {
|
|
27660
|
+
polyfills(fs2);
|
|
27661
|
+
fs2.gracefulify = patch;
|
|
27662
|
+
fs2.createReadStream = createReadStream;
|
|
27663
|
+
fs2.createWriteStream = createWriteStream;
|
|
27664
|
+
var fs$readFile = fs2.readFile;
|
|
27665
|
+
fs2.readFile = readFile;
|
|
27666
|
+
function readFile(path, options, cb) {
|
|
27667
|
+
if (typeof options === "function")
|
|
27668
|
+
cb = options, options = null;
|
|
27669
|
+
return go$readFile(path, options, cb);
|
|
27670
|
+
function go$readFile(path2, options2, cb2, startTime) {
|
|
27671
|
+
return fs$readFile(path2, options2, function(err) {
|
|
27672
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
27673
|
+
enqueue([go$readFile, [path2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
27674
|
+
else {
|
|
27675
|
+
if (typeof cb2 === "function")
|
|
27676
|
+
cb2.apply(this, arguments);
|
|
27677
|
+
}
|
|
27678
|
+
});
|
|
27679
|
+
}
|
|
27680
|
+
}
|
|
27681
|
+
var fs$writeFile = fs2.writeFile;
|
|
27682
|
+
fs2.writeFile = writeFile;
|
|
27683
|
+
function writeFile(path, data, options, cb) {
|
|
27684
|
+
if (typeof options === "function")
|
|
27685
|
+
cb = options, options = null;
|
|
27686
|
+
return go$writeFile(path, data, options, cb);
|
|
27687
|
+
function go$writeFile(path2, data2, options2, cb2, startTime) {
|
|
27688
|
+
return fs$writeFile(path2, data2, options2, function(err) {
|
|
27689
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
27690
|
+
enqueue([go$writeFile, [path2, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
27691
|
+
else {
|
|
27692
|
+
if (typeof cb2 === "function")
|
|
27693
|
+
cb2.apply(this, arguments);
|
|
27694
|
+
}
|
|
27695
|
+
});
|
|
27696
|
+
}
|
|
27697
|
+
}
|
|
27698
|
+
var fs$appendFile = fs2.appendFile;
|
|
27699
|
+
if (fs$appendFile)
|
|
27700
|
+
fs2.appendFile = appendFile;
|
|
27701
|
+
function appendFile(path, data, options, cb) {
|
|
27702
|
+
if (typeof options === "function")
|
|
27703
|
+
cb = options, options = null;
|
|
27704
|
+
return go$appendFile(path, data, options, cb);
|
|
27705
|
+
function go$appendFile(path2, data2, options2, cb2, startTime) {
|
|
27706
|
+
return fs$appendFile(path2, data2, options2, function(err) {
|
|
27707
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
27708
|
+
enqueue([go$appendFile, [path2, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
27709
|
+
else {
|
|
27710
|
+
if (typeof cb2 === "function")
|
|
27711
|
+
cb2.apply(this, arguments);
|
|
27712
|
+
}
|
|
27713
|
+
});
|
|
27714
|
+
}
|
|
27715
|
+
}
|
|
27716
|
+
var fs$copyFile = fs2.copyFile;
|
|
27717
|
+
if (fs$copyFile)
|
|
27718
|
+
fs2.copyFile = copyFile;
|
|
27719
|
+
function copyFile(src, dest, flags, cb) {
|
|
27720
|
+
if (typeof flags === "function") {
|
|
27721
|
+
cb = flags;
|
|
27722
|
+
flags = 0;
|
|
27723
|
+
}
|
|
27724
|
+
return go$copyFile(src, dest, flags, cb);
|
|
27725
|
+
function go$copyFile(src2, dest2, flags2, cb2, startTime) {
|
|
27726
|
+
return fs$copyFile(src2, dest2, flags2, function(err) {
|
|
27727
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
27728
|
+
enqueue([go$copyFile, [src2, dest2, flags2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
27729
|
+
else {
|
|
27730
|
+
if (typeof cb2 === "function")
|
|
27731
|
+
cb2.apply(this, arguments);
|
|
27732
|
+
}
|
|
27733
|
+
});
|
|
27734
|
+
}
|
|
27735
|
+
}
|
|
27736
|
+
var fs$readdir = fs2.readdir;
|
|
27737
|
+
fs2.readdir = readdir;
|
|
27738
|
+
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
27739
|
+
function readdir(path, options, cb) {
|
|
27740
|
+
if (typeof options === "function")
|
|
27741
|
+
cb = options, options = null;
|
|
27742
|
+
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path2, options2, cb2, startTime) {
|
|
27743
|
+
return fs$readdir(path2, fs$readdirCallback(path2, options2, cb2, startTime));
|
|
27744
|
+
} : function go$readdir2(path2, options2, cb2, startTime) {
|
|
27745
|
+
return fs$readdir(path2, options2, fs$readdirCallback(path2, options2, cb2, startTime));
|
|
27746
|
+
};
|
|
27747
|
+
return go$readdir(path, options, cb);
|
|
27748
|
+
function fs$readdirCallback(path2, options2, cb2, startTime) {
|
|
27749
|
+
return function(err, files) {
|
|
27750
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
27751
|
+
enqueue([
|
|
27752
|
+
go$readdir,
|
|
27753
|
+
[path2, options2, cb2],
|
|
27754
|
+
err,
|
|
27755
|
+
startTime || Date.now(),
|
|
27756
|
+
Date.now()
|
|
27757
|
+
]);
|
|
27758
|
+
else {
|
|
27759
|
+
if (files && files.sort)
|
|
27760
|
+
files.sort();
|
|
27761
|
+
if (typeof cb2 === "function")
|
|
27762
|
+
cb2.call(this, err, files);
|
|
27763
|
+
}
|
|
27764
|
+
};
|
|
27765
|
+
}
|
|
27766
|
+
}
|
|
27767
|
+
if (process.version.substr(0, 4) === "v0.8") {
|
|
27768
|
+
var legStreams = legacy(fs2);
|
|
27769
|
+
ReadStream = legStreams.ReadStream;
|
|
27770
|
+
WriteStream = legStreams.WriteStream;
|
|
27771
|
+
}
|
|
27772
|
+
var fs$ReadStream = fs2.ReadStream;
|
|
27773
|
+
if (fs$ReadStream) {
|
|
27774
|
+
ReadStream.prototype = Object.create(fs$ReadStream.prototype);
|
|
27775
|
+
ReadStream.prototype.open = ReadStream$open;
|
|
27776
|
+
}
|
|
27777
|
+
var fs$WriteStream = fs2.WriteStream;
|
|
27778
|
+
if (fs$WriteStream) {
|
|
27779
|
+
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
|
|
27780
|
+
WriteStream.prototype.open = WriteStream$open;
|
|
27781
|
+
}
|
|
27782
|
+
Object.defineProperty(fs2, "ReadStream", {
|
|
27783
|
+
get: function() {
|
|
27784
|
+
return ReadStream;
|
|
27785
|
+
},
|
|
27786
|
+
set: function(val) {
|
|
27787
|
+
ReadStream = val;
|
|
27788
|
+
},
|
|
27789
|
+
enumerable: true,
|
|
27790
|
+
configurable: true
|
|
27791
|
+
});
|
|
27792
|
+
Object.defineProperty(fs2, "WriteStream", {
|
|
27793
|
+
get: function() {
|
|
27794
|
+
return WriteStream;
|
|
27795
|
+
},
|
|
27796
|
+
set: function(val) {
|
|
27797
|
+
WriteStream = val;
|
|
27798
|
+
},
|
|
27799
|
+
enumerable: true,
|
|
27800
|
+
configurable: true
|
|
27801
|
+
});
|
|
27802
|
+
var FileReadStream = ReadStream;
|
|
27803
|
+
Object.defineProperty(fs2, "FileReadStream", {
|
|
27804
|
+
get: function() {
|
|
27805
|
+
return FileReadStream;
|
|
27806
|
+
},
|
|
27807
|
+
set: function(val) {
|
|
27808
|
+
FileReadStream = val;
|
|
27809
|
+
},
|
|
27810
|
+
enumerable: true,
|
|
27811
|
+
configurable: true
|
|
27812
|
+
});
|
|
27813
|
+
var FileWriteStream = WriteStream;
|
|
27814
|
+
Object.defineProperty(fs2, "FileWriteStream", {
|
|
27815
|
+
get: function() {
|
|
27816
|
+
return FileWriteStream;
|
|
27817
|
+
},
|
|
27818
|
+
set: function(val) {
|
|
27819
|
+
FileWriteStream = val;
|
|
27820
|
+
},
|
|
27821
|
+
enumerable: true,
|
|
27822
|
+
configurable: true
|
|
27823
|
+
});
|
|
27824
|
+
function ReadStream(path, options) {
|
|
27825
|
+
if (this instanceof ReadStream)
|
|
27826
|
+
return fs$ReadStream.apply(this, arguments), this;
|
|
27827
|
+
else
|
|
27828
|
+
return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
|
|
27829
|
+
}
|
|
27830
|
+
function ReadStream$open() {
|
|
27831
|
+
var that = this;
|
|
27832
|
+
open(that.path, that.flags, that.mode, function(err, fd) {
|
|
27833
|
+
if (err) {
|
|
27834
|
+
if (that.autoClose)
|
|
27835
|
+
that.destroy();
|
|
27836
|
+
that.emit("error", err);
|
|
27837
|
+
} else {
|
|
27838
|
+
that.fd = fd;
|
|
27839
|
+
that.emit("open", fd);
|
|
27840
|
+
that.read();
|
|
27841
|
+
}
|
|
27842
|
+
});
|
|
27843
|
+
}
|
|
27844
|
+
function WriteStream(path, options) {
|
|
27845
|
+
if (this instanceof WriteStream)
|
|
27846
|
+
return fs$WriteStream.apply(this, arguments), this;
|
|
27847
|
+
else
|
|
27848
|
+
return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
|
|
27849
|
+
}
|
|
27850
|
+
function WriteStream$open() {
|
|
27851
|
+
var that = this;
|
|
27852
|
+
open(that.path, that.flags, that.mode, function(err, fd) {
|
|
27853
|
+
if (err) {
|
|
27854
|
+
that.destroy();
|
|
27855
|
+
that.emit("error", err);
|
|
27856
|
+
} else {
|
|
27857
|
+
that.fd = fd;
|
|
27858
|
+
that.emit("open", fd);
|
|
27859
|
+
}
|
|
27860
|
+
});
|
|
27861
|
+
}
|
|
27862
|
+
function createReadStream(path, options) {
|
|
27863
|
+
return new fs2.ReadStream(path, options);
|
|
27864
|
+
}
|
|
27865
|
+
function createWriteStream(path, options) {
|
|
27866
|
+
return new fs2.WriteStream(path, options);
|
|
27867
|
+
}
|
|
27868
|
+
var fs$open = fs2.open;
|
|
27869
|
+
fs2.open = open;
|
|
27870
|
+
function open(path, flags, mode, cb) {
|
|
27871
|
+
if (typeof mode === "function")
|
|
27872
|
+
cb = mode, mode = null;
|
|
27873
|
+
return go$open(path, flags, mode, cb);
|
|
27874
|
+
function go$open(path2, flags2, mode2, cb2, startTime) {
|
|
27875
|
+
return fs$open(path2, flags2, mode2, function(err, fd) {
|
|
27876
|
+
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
27877
|
+
enqueue([go$open, [path2, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
27878
|
+
else {
|
|
27879
|
+
if (typeof cb2 === "function")
|
|
27880
|
+
cb2.apply(this, arguments);
|
|
27881
|
+
}
|
|
27882
|
+
});
|
|
27883
|
+
}
|
|
27884
|
+
}
|
|
27885
|
+
return fs2;
|
|
27886
|
+
}
|
|
27887
|
+
function enqueue(elem) {
|
|
27888
|
+
debug2("ENQUEUE", elem[0].name, elem[1]);
|
|
27889
|
+
fs[gracefulQueue].push(elem);
|
|
27890
|
+
retry();
|
|
27891
|
+
}
|
|
27892
|
+
var retryTimer;
|
|
27893
|
+
function resetQueue() {
|
|
27894
|
+
var now = Date.now();
|
|
27895
|
+
for (var i = 0;i < fs[gracefulQueue].length; ++i) {
|
|
27896
|
+
if (fs[gracefulQueue][i].length > 2) {
|
|
27897
|
+
fs[gracefulQueue][i][3] = now;
|
|
27898
|
+
fs[gracefulQueue][i][4] = now;
|
|
27899
|
+
}
|
|
27900
|
+
}
|
|
27901
|
+
retry();
|
|
27902
|
+
}
|
|
27903
|
+
function retry() {
|
|
27904
|
+
clearTimeout(retryTimer);
|
|
27905
|
+
retryTimer = undefined;
|
|
27906
|
+
if (fs[gracefulQueue].length === 0)
|
|
27907
|
+
return;
|
|
27908
|
+
var elem = fs[gracefulQueue].shift();
|
|
27909
|
+
var fn = elem[0];
|
|
27910
|
+
var args = elem[1];
|
|
27911
|
+
var err = elem[2];
|
|
27912
|
+
var startTime = elem[3];
|
|
27913
|
+
var lastTime = elem[4];
|
|
27914
|
+
if (startTime === undefined) {
|
|
27915
|
+
debug2("RETRY", fn.name, args);
|
|
27916
|
+
fn.apply(null, args);
|
|
27917
|
+
} else if (Date.now() - startTime >= 60000) {
|
|
27918
|
+
debug2("TIMEOUT", fn.name, args);
|
|
27919
|
+
var cb = args.pop();
|
|
27920
|
+
if (typeof cb === "function")
|
|
27921
|
+
cb.call(null, err);
|
|
27922
|
+
} else {
|
|
27923
|
+
var sinceAttempt = Date.now() - lastTime;
|
|
27924
|
+
var sinceStart = Math.max(lastTime - startTime, 1);
|
|
27925
|
+
var desiredDelay = Math.min(sinceStart * 1.2, 100);
|
|
27926
|
+
if (sinceAttempt >= desiredDelay) {
|
|
27927
|
+
debug2("RETRY", fn.name, args);
|
|
27928
|
+
fn.apply(null, args.concat([startTime]));
|
|
27929
|
+
} else {
|
|
27930
|
+
fs[gracefulQueue].push(elem);
|
|
27931
|
+
}
|
|
27932
|
+
}
|
|
27933
|
+
if (retryTimer === undefined) {
|
|
27934
|
+
retryTimer = setTimeout(retry, 0);
|
|
27935
|
+
}
|
|
27936
|
+
}
|
|
27937
|
+
});
|
|
27938
|
+
|
|
27939
|
+
// ../node_modules/.bun/retry@0.12.0/node_modules/retry/lib/retry_operation.js
|
|
27940
|
+
var require_retry_operation = __commonJS((exports, module) => {
|
|
27941
|
+
function RetryOperation(timeouts, options) {
|
|
27942
|
+
if (typeof options === "boolean") {
|
|
27943
|
+
options = { forever: options };
|
|
27944
|
+
}
|
|
27945
|
+
this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
|
|
27946
|
+
this._timeouts = timeouts;
|
|
27947
|
+
this._options = options || {};
|
|
27948
|
+
this._maxRetryTime = options && options.maxRetryTime || Infinity;
|
|
27949
|
+
this._fn = null;
|
|
27950
|
+
this._errors = [];
|
|
27951
|
+
this._attempts = 1;
|
|
27952
|
+
this._operationTimeout = null;
|
|
27953
|
+
this._operationTimeoutCb = null;
|
|
27954
|
+
this._timeout = null;
|
|
27955
|
+
this._operationStart = null;
|
|
27956
|
+
if (this._options.forever) {
|
|
27957
|
+
this._cachedTimeouts = this._timeouts.slice(0);
|
|
27958
|
+
}
|
|
27959
|
+
}
|
|
27960
|
+
module.exports = RetryOperation;
|
|
27961
|
+
RetryOperation.prototype.reset = function() {
|
|
27962
|
+
this._attempts = 1;
|
|
27963
|
+
this._timeouts = this._originalTimeouts;
|
|
27964
|
+
};
|
|
27965
|
+
RetryOperation.prototype.stop = function() {
|
|
27966
|
+
if (this._timeout) {
|
|
27967
|
+
clearTimeout(this._timeout);
|
|
27968
|
+
}
|
|
27969
|
+
this._timeouts = [];
|
|
27970
|
+
this._cachedTimeouts = null;
|
|
27971
|
+
};
|
|
27972
|
+
RetryOperation.prototype.retry = function(err) {
|
|
27973
|
+
if (this._timeout) {
|
|
27974
|
+
clearTimeout(this._timeout);
|
|
27975
|
+
}
|
|
27976
|
+
if (!err) {
|
|
27977
|
+
return false;
|
|
27978
|
+
}
|
|
27979
|
+
var currentTime = new Date().getTime();
|
|
27980
|
+
if (err && currentTime - this._operationStart >= this._maxRetryTime) {
|
|
27981
|
+
this._errors.unshift(new Error("RetryOperation timeout occurred"));
|
|
27982
|
+
return false;
|
|
27983
|
+
}
|
|
27984
|
+
this._errors.push(err);
|
|
27985
|
+
var timeout = this._timeouts.shift();
|
|
27986
|
+
if (timeout === undefined) {
|
|
27987
|
+
if (this._cachedTimeouts) {
|
|
27988
|
+
this._errors.splice(this._errors.length - 1, this._errors.length);
|
|
27989
|
+
this._timeouts = this._cachedTimeouts.slice(0);
|
|
27990
|
+
timeout = this._timeouts.shift();
|
|
27991
|
+
} else {
|
|
27992
|
+
return false;
|
|
27993
|
+
}
|
|
27994
|
+
}
|
|
27995
|
+
var self2 = this;
|
|
27996
|
+
var timer = setTimeout(function() {
|
|
27997
|
+
self2._attempts++;
|
|
27998
|
+
if (self2._operationTimeoutCb) {
|
|
27999
|
+
self2._timeout = setTimeout(function() {
|
|
28000
|
+
self2._operationTimeoutCb(self2._attempts);
|
|
28001
|
+
}, self2._operationTimeout);
|
|
28002
|
+
if (self2._options.unref) {
|
|
28003
|
+
self2._timeout.unref();
|
|
28004
|
+
}
|
|
28005
|
+
}
|
|
28006
|
+
self2._fn(self2._attempts);
|
|
28007
|
+
}, timeout);
|
|
28008
|
+
if (this._options.unref) {
|
|
28009
|
+
timer.unref();
|
|
28010
|
+
}
|
|
28011
|
+
return true;
|
|
28012
|
+
};
|
|
28013
|
+
RetryOperation.prototype.attempt = function(fn, timeoutOps) {
|
|
28014
|
+
this._fn = fn;
|
|
28015
|
+
if (timeoutOps) {
|
|
28016
|
+
if (timeoutOps.timeout) {
|
|
28017
|
+
this._operationTimeout = timeoutOps.timeout;
|
|
28018
|
+
}
|
|
28019
|
+
if (timeoutOps.cb) {
|
|
28020
|
+
this._operationTimeoutCb = timeoutOps.cb;
|
|
28021
|
+
}
|
|
28022
|
+
}
|
|
28023
|
+
var self2 = this;
|
|
28024
|
+
if (this._operationTimeoutCb) {
|
|
28025
|
+
this._timeout = setTimeout(function() {
|
|
28026
|
+
self2._operationTimeoutCb();
|
|
28027
|
+
}, self2._operationTimeout);
|
|
28028
|
+
}
|
|
28029
|
+
this._operationStart = new Date().getTime();
|
|
28030
|
+
this._fn(this._attempts);
|
|
28031
|
+
};
|
|
28032
|
+
RetryOperation.prototype.try = function(fn) {
|
|
28033
|
+
console.log("Using RetryOperation.try() is deprecated");
|
|
28034
|
+
this.attempt(fn);
|
|
28035
|
+
};
|
|
28036
|
+
RetryOperation.prototype.start = function(fn) {
|
|
28037
|
+
console.log("Using RetryOperation.start() is deprecated");
|
|
28038
|
+
this.attempt(fn);
|
|
28039
|
+
};
|
|
28040
|
+
RetryOperation.prototype.start = RetryOperation.prototype.try;
|
|
28041
|
+
RetryOperation.prototype.errors = function() {
|
|
28042
|
+
return this._errors;
|
|
28043
|
+
};
|
|
28044
|
+
RetryOperation.prototype.attempts = function() {
|
|
28045
|
+
return this._attempts;
|
|
28046
|
+
};
|
|
28047
|
+
RetryOperation.prototype.mainError = function() {
|
|
28048
|
+
if (this._errors.length === 0) {
|
|
28049
|
+
return null;
|
|
28050
|
+
}
|
|
28051
|
+
var counts = {};
|
|
28052
|
+
var mainError = null;
|
|
28053
|
+
var mainErrorCount = 0;
|
|
28054
|
+
for (var i = 0;i < this._errors.length; i++) {
|
|
28055
|
+
var error = this._errors[i];
|
|
28056
|
+
var message = error.message;
|
|
28057
|
+
var count = (counts[message] || 0) + 1;
|
|
28058
|
+
counts[message] = count;
|
|
28059
|
+
if (count >= mainErrorCount) {
|
|
28060
|
+
mainError = error;
|
|
28061
|
+
mainErrorCount = count;
|
|
28062
|
+
}
|
|
28063
|
+
}
|
|
28064
|
+
return mainError;
|
|
28065
|
+
};
|
|
28066
|
+
});
|
|
28067
|
+
|
|
28068
|
+
// ../node_modules/.bun/retry@0.12.0/node_modules/retry/lib/retry.js
|
|
28069
|
+
var require_retry = __commonJS((exports) => {
|
|
28070
|
+
var RetryOperation = require_retry_operation();
|
|
28071
|
+
exports.operation = function(options) {
|
|
28072
|
+
var timeouts = exports.timeouts(options);
|
|
28073
|
+
return new RetryOperation(timeouts, {
|
|
28074
|
+
forever: options && options.forever,
|
|
28075
|
+
unref: options && options.unref,
|
|
28076
|
+
maxRetryTime: options && options.maxRetryTime
|
|
28077
|
+
});
|
|
28078
|
+
};
|
|
28079
|
+
exports.timeouts = function(options) {
|
|
28080
|
+
if (options instanceof Array) {
|
|
28081
|
+
return [].concat(options);
|
|
28082
|
+
}
|
|
28083
|
+
var opts = {
|
|
28084
|
+
retries: 10,
|
|
28085
|
+
factor: 2,
|
|
28086
|
+
minTimeout: 1 * 1000,
|
|
28087
|
+
maxTimeout: Infinity,
|
|
28088
|
+
randomize: false
|
|
28089
|
+
};
|
|
28090
|
+
for (var key in options) {
|
|
28091
|
+
opts[key] = options[key];
|
|
28092
|
+
}
|
|
28093
|
+
if (opts.minTimeout > opts.maxTimeout) {
|
|
28094
|
+
throw new Error("minTimeout is greater than maxTimeout");
|
|
28095
|
+
}
|
|
28096
|
+
var timeouts = [];
|
|
28097
|
+
for (var i = 0;i < opts.retries; i++) {
|
|
28098
|
+
timeouts.push(this.createTimeout(i, opts));
|
|
28099
|
+
}
|
|
28100
|
+
if (options && options.forever && !timeouts.length) {
|
|
28101
|
+
timeouts.push(this.createTimeout(i, opts));
|
|
28102
|
+
}
|
|
28103
|
+
timeouts.sort(function(a, b) {
|
|
28104
|
+
return a - b;
|
|
28105
|
+
});
|
|
28106
|
+
return timeouts;
|
|
28107
|
+
};
|
|
28108
|
+
exports.createTimeout = function(attempt, opts) {
|
|
28109
|
+
var random = opts.randomize ? Math.random() + 1 : 1;
|
|
28110
|
+
var timeout = Math.round(random * opts.minTimeout * Math.pow(opts.factor, attempt));
|
|
28111
|
+
timeout = Math.min(timeout, opts.maxTimeout);
|
|
28112
|
+
return timeout;
|
|
28113
|
+
};
|
|
28114
|
+
exports.wrap = function(obj, options, methods) {
|
|
28115
|
+
if (options instanceof Array) {
|
|
28116
|
+
methods = options;
|
|
28117
|
+
options = null;
|
|
28118
|
+
}
|
|
28119
|
+
if (!methods) {
|
|
28120
|
+
methods = [];
|
|
28121
|
+
for (var key in obj) {
|
|
28122
|
+
if (typeof obj[key] === "function") {
|
|
28123
|
+
methods.push(key);
|
|
28124
|
+
}
|
|
28125
|
+
}
|
|
28126
|
+
}
|
|
28127
|
+
for (var i = 0;i < methods.length; i++) {
|
|
28128
|
+
var method = methods[i];
|
|
28129
|
+
var original = obj[method];
|
|
28130
|
+
obj[method] = function retryWrapper(original2) {
|
|
28131
|
+
var op = exports.operation(options);
|
|
28132
|
+
var args = Array.prototype.slice.call(arguments, 1);
|
|
28133
|
+
var callback = args.pop();
|
|
28134
|
+
args.push(function(err) {
|
|
28135
|
+
if (op.retry(err)) {
|
|
28136
|
+
return;
|
|
28137
|
+
}
|
|
28138
|
+
if (err) {
|
|
28139
|
+
arguments[0] = op.mainError();
|
|
28140
|
+
}
|
|
28141
|
+
callback.apply(this, arguments);
|
|
28142
|
+
});
|
|
28143
|
+
op.attempt(function() {
|
|
28144
|
+
original2.apply(obj, args);
|
|
28145
|
+
});
|
|
28146
|
+
}.bind(obj, original);
|
|
28147
|
+
obj[method].options = options;
|
|
28148
|
+
}
|
|
28149
|
+
};
|
|
28150
|
+
});
|
|
28151
|
+
|
|
28152
|
+
// ../node_modules/.bun/signal-exit@3.0.7/node_modules/signal-exit/signals.js
|
|
28153
|
+
var require_signals = __commonJS((exports, module) => {
|
|
28154
|
+
module.exports = [
|
|
28155
|
+
"SIGABRT",
|
|
28156
|
+
"SIGALRM",
|
|
28157
|
+
"SIGHUP",
|
|
28158
|
+
"SIGINT",
|
|
28159
|
+
"SIGTERM"
|
|
28160
|
+
];
|
|
28161
|
+
if (process.platform !== "win32") {
|
|
28162
|
+
module.exports.push("SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
28163
|
+
}
|
|
28164
|
+
if (process.platform === "linux") {
|
|
28165
|
+
module.exports.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT", "SIGUNUSED");
|
|
28166
|
+
}
|
|
28167
|
+
});
|
|
28168
|
+
|
|
28169
|
+
// ../node_modules/.bun/signal-exit@3.0.7/node_modules/signal-exit/index.js
|
|
28170
|
+
var require_signal_exit = __commonJS((exports, module) => {
|
|
28171
|
+
var process2 = global.process;
|
|
28172
|
+
var processOk = function(process3) {
|
|
28173
|
+
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";
|
|
28174
|
+
};
|
|
28175
|
+
if (!processOk(process2)) {
|
|
28176
|
+
module.exports = function() {
|
|
28177
|
+
return function() {};
|
|
28178
|
+
};
|
|
28179
|
+
} else {
|
|
28180
|
+
assert = __require("assert");
|
|
28181
|
+
signals = require_signals();
|
|
28182
|
+
isWin = /^win/i.test(process2.platform);
|
|
28183
|
+
EE = __require("events");
|
|
28184
|
+
if (typeof EE !== "function") {
|
|
28185
|
+
EE = EE.EventEmitter;
|
|
28186
|
+
}
|
|
28187
|
+
if (process2.__signal_exit_emitter__) {
|
|
28188
|
+
emitter = process2.__signal_exit_emitter__;
|
|
28189
|
+
} else {
|
|
28190
|
+
emitter = process2.__signal_exit_emitter__ = new EE;
|
|
28191
|
+
emitter.count = 0;
|
|
28192
|
+
emitter.emitted = {};
|
|
28193
|
+
}
|
|
28194
|
+
if (!emitter.infinite) {
|
|
28195
|
+
emitter.setMaxListeners(Infinity);
|
|
28196
|
+
emitter.infinite = true;
|
|
28197
|
+
}
|
|
28198
|
+
module.exports = function(cb, opts) {
|
|
28199
|
+
if (!processOk(global.process)) {
|
|
28200
|
+
return function() {};
|
|
28201
|
+
}
|
|
28202
|
+
assert.equal(typeof cb, "function", "a callback must be provided for exit handler");
|
|
28203
|
+
if (loaded === false) {
|
|
28204
|
+
load();
|
|
28205
|
+
}
|
|
28206
|
+
var ev = "exit";
|
|
28207
|
+
if (opts && opts.alwaysLast) {
|
|
28208
|
+
ev = "afterexit";
|
|
28209
|
+
}
|
|
28210
|
+
var remove = function() {
|
|
28211
|
+
emitter.removeListener(ev, cb);
|
|
28212
|
+
if (emitter.listeners("exit").length === 0 && emitter.listeners("afterexit").length === 0) {
|
|
28213
|
+
unload();
|
|
28214
|
+
}
|
|
28215
|
+
};
|
|
28216
|
+
emitter.on(ev, cb);
|
|
28217
|
+
return remove;
|
|
28218
|
+
};
|
|
28219
|
+
unload = function unload2() {
|
|
28220
|
+
if (!loaded || !processOk(global.process)) {
|
|
28221
|
+
return;
|
|
28222
|
+
}
|
|
28223
|
+
loaded = false;
|
|
28224
|
+
signals.forEach(function(sig) {
|
|
28225
|
+
try {
|
|
28226
|
+
process2.removeListener(sig, sigListeners[sig]);
|
|
28227
|
+
} catch (er) {}
|
|
28228
|
+
});
|
|
28229
|
+
process2.emit = originalProcessEmit;
|
|
28230
|
+
process2.reallyExit = originalProcessReallyExit;
|
|
28231
|
+
emitter.count -= 1;
|
|
28232
|
+
};
|
|
28233
|
+
module.exports.unload = unload;
|
|
28234
|
+
emit = function emit2(event, code, signal) {
|
|
28235
|
+
if (emitter.emitted[event]) {
|
|
28236
|
+
return;
|
|
28237
|
+
}
|
|
28238
|
+
emitter.emitted[event] = true;
|
|
28239
|
+
emitter.emit(event, code, signal);
|
|
28240
|
+
};
|
|
28241
|
+
sigListeners = {};
|
|
28242
|
+
signals.forEach(function(sig) {
|
|
28243
|
+
sigListeners[sig] = function listener() {
|
|
28244
|
+
if (!processOk(global.process)) {
|
|
28245
|
+
return;
|
|
28246
|
+
}
|
|
28247
|
+
var listeners = process2.listeners(sig);
|
|
28248
|
+
if (listeners.length === emitter.count) {
|
|
28249
|
+
unload();
|
|
28250
|
+
emit("exit", null, sig);
|
|
28251
|
+
emit("afterexit", null, sig);
|
|
28252
|
+
if (isWin && sig === "SIGHUP") {
|
|
28253
|
+
sig = "SIGINT";
|
|
28254
|
+
}
|
|
28255
|
+
process2.kill(process2.pid, sig);
|
|
28256
|
+
}
|
|
28257
|
+
};
|
|
28258
|
+
});
|
|
28259
|
+
module.exports.signals = function() {
|
|
28260
|
+
return signals;
|
|
28261
|
+
};
|
|
28262
|
+
loaded = false;
|
|
28263
|
+
load = function load2() {
|
|
28264
|
+
if (loaded || !processOk(global.process)) {
|
|
28265
|
+
return;
|
|
28266
|
+
}
|
|
28267
|
+
loaded = true;
|
|
28268
|
+
emitter.count += 1;
|
|
28269
|
+
signals = signals.filter(function(sig) {
|
|
28270
|
+
try {
|
|
28271
|
+
process2.on(sig, sigListeners[sig]);
|
|
28272
|
+
return true;
|
|
28273
|
+
} catch (er) {
|
|
28274
|
+
return false;
|
|
28275
|
+
}
|
|
28276
|
+
});
|
|
28277
|
+
process2.emit = processEmit;
|
|
28278
|
+
process2.reallyExit = processReallyExit;
|
|
28279
|
+
};
|
|
28280
|
+
module.exports.load = load;
|
|
28281
|
+
originalProcessReallyExit = process2.reallyExit;
|
|
28282
|
+
processReallyExit = function processReallyExit2(code) {
|
|
28283
|
+
if (!processOk(global.process)) {
|
|
28284
|
+
return;
|
|
28285
|
+
}
|
|
28286
|
+
process2.exitCode = code || 0;
|
|
28287
|
+
emit("exit", process2.exitCode, null);
|
|
28288
|
+
emit("afterexit", process2.exitCode, null);
|
|
28289
|
+
originalProcessReallyExit.call(process2, process2.exitCode);
|
|
28290
|
+
};
|
|
28291
|
+
originalProcessEmit = process2.emit;
|
|
28292
|
+
processEmit = function processEmit2(ev, arg) {
|
|
28293
|
+
if (ev === "exit" && processOk(global.process)) {
|
|
28294
|
+
if (arg !== undefined) {
|
|
28295
|
+
process2.exitCode = arg;
|
|
28296
|
+
}
|
|
28297
|
+
var ret = originalProcessEmit.apply(this, arguments);
|
|
28298
|
+
emit("exit", process2.exitCode, null);
|
|
28299
|
+
emit("afterexit", process2.exitCode, null);
|
|
28300
|
+
return ret;
|
|
28301
|
+
} else {
|
|
28302
|
+
return originalProcessEmit.apply(this, arguments);
|
|
28303
|
+
}
|
|
28304
|
+
};
|
|
28305
|
+
}
|
|
28306
|
+
var assert;
|
|
28307
|
+
var signals;
|
|
28308
|
+
var isWin;
|
|
28309
|
+
var EE;
|
|
28310
|
+
var emitter;
|
|
28311
|
+
var unload;
|
|
28312
|
+
var emit;
|
|
28313
|
+
var sigListeners;
|
|
28314
|
+
var loaded;
|
|
28315
|
+
var load;
|
|
28316
|
+
var originalProcessReallyExit;
|
|
28317
|
+
var processReallyExit;
|
|
28318
|
+
var originalProcessEmit;
|
|
28319
|
+
var processEmit;
|
|
28320
|
+
});
|
|
28321
|
+
|
|
28322
|
+
// ../node_modules/.bun/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/mtime-precision.js
|
|
28323
|
+
var require_mtime_precision = __commonJS((exports, module) => {
|
|
28324
|
+
var cacheSymbol = Symbol();
|
|
28325
|
+
function probe(file, fs, callback) {
|
|
28326
|
+
const cachedPrecision = fs[cacheSymbol];
|
|
28327
|
+
if (cachedPrecision) {
|
|
28328
|
+
return fs.stat(file, (err, stat) => {
|
|
28329
|
+
if (err) {
|
|
28330
|
+
return callback(err);
|
|
28331
|
+
}
|
|
28332
|
+
callback(null, stat.mtime, cachedPrecision);
|
|
28333
|
+
});
|
|
28334
|
+
}
|
|
28335
|
+
const mtime = new Date(Math.ceil(Date.now() / 1000) * 1000 + 5);
|
|
28336
|
+
fs.utimes(file, mtime, mtime, (err) => {
|
|
28337
|
+
if (err) {
|
|
28338
|
+
return callback(err);
|
|
28339
|
+
}
|
|
28340
|
+
fs.stat(file, (err2, stat) => {
|
|
28341
|
+
if (err2) {
|
|
28342
|
+
return callback(err2);
|
|
28343
|
+
}
|
|
28344
|
+
const precision = stat.mtime.getTime() % 1000 === 0 ? "s" : "ms";
|
|
28345
|
+
Object.defineProperty(fs, cacheSymbol, { value: precision });
|
|
28346
|
+
callback(null, stat.mtime, precision);
|
|
28347
|
+
});
|
|
28348
|
+
});
|
|
28349
|
+
}
|
|
28350
|
+
function getMtime(precision) {
|
|
28351
|
+
let now = Date.now();
|
|
28352
|
+
if (precision === "s") {
|
|
28353
|
+
now = Math.ceil(now / 1000) * 1000;
|
|
28354
|
+
}
|
|
28355
|
+
return new Date(now);
|
|
28356
|
+
}
|
|
28357
|
+
exports.probe = probe;
|
|
28358
|
+
exports.getMtime = getMtime;
|
|
28359
|
+
});
|
|
28360
|
+
|
|
28361
|
+
// ../node_modules/.bun/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/lockfile.js
|
|
28362
|
+
var require_lockfile = __commonJS((exports, module) => {
|
|
28363
|
+
var path = __require("path");
|
|
28364
|
+
var fs = require_graceful_fs();
|
|
28365
|
+
var retry = require_retry();
|
|
28366
|
+
var onExit = require_signal_exit();
|
|
28367
|
+
var mtimePrecision = require_mtime_precision();
|
|
28368
|
+
var locks = {};
|
|
28369
|
+
function getLockFile(file, options) {
|
|
28370
|
+
return options.lockfilePath || `${file}.lock`;
|
|
28371
|
+
}
|
|
28372
|
+
function resolveCanonicalPath(file, options, callback) {
|
|
28373
|
+
if (!options.realpath) {
|
|
28374
|
+
return callback(null, path.resolve(file));
|
|
28375
|
+
}
|
|
28376
|
+
options.fs.realpath(file, callback);
|
|
28377
|
+
}
|
|
28378
|
+
function acquireLock(file, options, callback) {
|
|
28379
|
+
const lockfilePath = getLockFile(file, options);
|
|
28380
|
+
options.fs.mkdir(lockfilePath, (err) => {
|
|
28381
|
+
if (!err) {
|
|
28382
|
+
return mtimePrecision.probe(lockfilePath, options.fs, (err2, mtime, mtimePrecision2) => {
|
|
28383
|
+
if (err2) {
|
|
28384
|
+
options.fs.rmdir(lockfilePath, () => {});
|
|
28385
|
+
return callback(err2);
|
|
28386
|
+
}
|
|
28387
|
+
callback(null, mtime, mtimePrecision2);
|
|
28388
|
+
});
|
|
28389
|
+
}
|
|
28390
|
+
if (err.code !== "EEXIST") {
|
|
28391
|
+
return callback(err);
|
|
28392
|
+
}
|
|
28393
|
+
if (options.stale <= 0) {
|
|
28394
|
+
return callback(Object.assign(new Error("Lock file is already being held"), { code: "ELOCKED", file }));
|
|
28395
|
+
}
|
|
28396
|
+
options.fs.stat(lockfilePath, (err2, stat) => {
|
|
28397
|
+
if (err2) {
|
|
28398
|
+
if (err2.code === "ENOENT") {
|
|
28399
|
+
return acquireLock(file, { ...options, stale: 0 }, callback);
|
|
28400
|
+
}
|
|
28401
|
+
return callback(err2);
|
|
28402
|
+
}
|
|
28403
|
+
if (!isLockStale(stat, options)) {
|
|
28404
|
+
return callback(Object.assign(new Error("Lock file is already being held"), { code: "ELOCKED", file }));
|
|
28405
|
+
}
|
|
28406
|
+
removeLock(file, options, (err3) => {
|
|
28407
|
+
if (err3) {
|
|
28408
|
+
return callback(err3);
|
|
28409
|
+
}
|
|
28410
|
+
acquireLock(file, { ...options, stale: 0 }, callback);
|
|
28411
|
+
});
|
|
28412
|
+
});
|
|
28413
|
+
});
|
|
28414
|
+
}
|
|
28415
|
+
function isLockStale(stat, options) {
|
|
28416
|
+
return stat.mtime.getTime() < Date.now() - options.stale;
|
|
28417
|
+
}
|
|
28418
|
+
function removeLock(file, options, callback) {
|
|
28419
|
+
options.fs.rmdir(getLockFile(file, options), (err) => {
|
|
28420
|
+
if (err && err.code !== "ENOENT") {
|
|
28421
|
+
return callback(err);
|
|
28422
|
+
}
|
|
28423
|
+
callback();
|
|
28424
|
+
});
|
|
28425
|
+
}
|
|
28426
|
+
function updateLock(file, options) {
|
|
28427
|
+
const lock2 = locks[file];
|
|
28428
|
+
if (lock2.updateTimeout) {
|
|
28429
|
+
return;
|
|
28430
|
+
}
|
|
28431
|
+
lock2.updateDelay = lock2.updateDelay || options.update;
|
|
28432
|
+
lock2.updateTimeout = setTimeout(() => {
|
|
28433
|
+
lock2.updateTimeout = null;
|
|
28434
|
+
options.fs.stat(lock2.lockfilePath, (err, stat) => {
|
|
28435
|
+
const isOverThreshold = lock2.lastUpdate + options.stale < Date.now();
|
|
28436
|
+
if (err) {
|
|
28437
|
+
if (err.code === "ENOENT" || isOverThreshold) {
|
|
28438
|
+
return setLockAsCompromised(file, lock2, Object.assign(err, { code: "ECOMPROMISED" }));
|
|
28439
|
+
}
|
|
28440
|
+
lock2.updateDelay = 1000;
|
|
28441
|
+
return updateLock(file, options);
|
|
28442
|
+
}
|
|
28443
|
+
const isMtimeOurs = lock2.mtime.getTime() === stat.mtime.getTime();
|
|
28444
|
+
if (!isMtimeOurs) {
|
|
28445
|
+
return setLockAsCompromised(file, lock2, Object.assign(new Error("Unable to update lock within the stale threshold"), { code: "ECOMPROMISED" }));
|
|
28446
|
+
}
|
|
28447
|
+
const mtime = mtimePrecision.getMtime(lock2.mtimePrecision);
|
|
28448
|
+
options.fs.utimes(lock2.lockfilePath, mtime, mtime, (err2) => {
|
|
28449
|
+
const isOverThreshold2 = lock2.lastUpdate + options.stale < Date.now();
|
|
28450
|
+
if (lock2.released) {
|
|
28451
|
+
return;
|
|
28452
|
+
}
|
|
28453
|
+
if (err2) {
|
|
28454
|
+
if (err2.code === "ENOENT" || isOverThreshold2) {
|
|
28455
|
+
return setLockAsCompromised(file, lock2, Object.assign(err2, { code: "ECOMPROMISED" }));
|
|
28456
|
+
}
|
|
28457
|
+
lock2.updateDelay = 1000;
|
|
28458
|
+
return updateLock(file, options);
|
|
28459
|
+
}
|
|
28460
|
+
lock2.mtime = mtime;
|
|
28461
|
+
lock2.lastUpdate = Date.now();
|
|
28462
|
+
lock2.updateDelay = null;
|
|
28463
|
+
updateLock(file, options);
|
|
28464
|
+
});
|
|
28465
|
+
});
|
|
28466
|
+
}, lock2.updateDelay);
|
|
28467
|
+
if (lock2.updateTimeout.unref) {
|
|
28468
|
+
lock2.updateTimeout.unref();
|
|
28469
|
+
}
|
|
28470
|
+
}
|
|
28471
|
+
function setLockAsCompromised(file, lock2, err) {
|
|
28472
|
+
lock2.released = true;
|
|
28473
|
+
if (lock2.updateTimeout) {
|
|
28474
|
+
clearTimeout(lock2.updateTimeout);
|
|
28475
|
+
}
|
|
28476
|
+
if (locks[file] === lock2) {
|
|
28477
|
+
delete locks[file];
|
|
28478
|
+
}
|
|
28479
|
+
lock2.options.onCompromised(err);
|
|
28480
|
+
}
|
|
28481
|
+
function lock(file, options, callback) {
|
|
28482
|
+
options = {
|
|
28483
|
+
stale: 1e4,
|
|
28484
|
+
update: null,
|
|
28485
|
+
realpath: true,
|
|
28486
|
+
retries: 0,
|
|
28487
|
+
fs,
|
|
28488
|
+
onCompromised: (err) => {
|
|
28489
|
+
throw err;
|
|
28490
|
+
},
|
|
28491
|
+
...options
|
|
28492
|
+
};
|
|
28493
|
+
options.retries = options.retries || 0;
|
|
28494
|
+
options.retries = typeof options.retries === "number" ? { retries: options.retries } : options.retries;
|
|
28495
|
+
options.stale = Math.max(options.stale || 0, 2000);
|
|
28496
|
+
options.update = options.update == null ? options.stale / 2 : options.update || 0;
|
|
28497
|
+
options.update = Math.max(Math.min(options.update, options.stale / 2), 1000);
|
|
28498
|
+
resolveCanonicalPath(file, options, (err, file2) => {
|
|
28499
|
+
if (err) {
|
|
28500
|
+
return callback(err);
|
|
28501
|
+
}
|
|
28502
|
+
const operation = retry.operation(options.retries);
|
|
28503
|
+
operation.attempt(() => {
|
|
28504
|
+
acquireLock(file2, options, (err2, mtime, mtimePrecision2) => {
|
|
28505
|
+
if (operation.retry(err2)) {
|
|
28506
|
+
return;
|
|
28507
|
+
}
|
|
28508
|
+
if (err2) {
|
|
28509
|
+
return callback(operation.mainError());
|
|
28510
|
+
}
|
|
28511
|
+
const lock2 = locks[file2] = {
|
|
28512
|
+
lockfilePath: getLockFile(file2, options),
|
|
28513
|
+
mtime,
|
|
28514
|
+
mtimePrecision: mtimePrecision2,
|
|
28515
|
+
options,
|
|
28516
|
+
lastUpdate: Date.now()
|
|
28517
|
+
};
|
|
28518
|
+
updateLock(file2, options);
|
|
28519
|
+
callback(null, (releasedCallback) => {
|
|
28520
|
+
if (lock2.released) {
|
|
28521
|
+
return releasedCallback && releasedCallback(Object.assign(new Error("Lock is already released"), { code: "ERELEASED" }));
|
|
28522
|
+
}
|
|
28523
|
+
unlock(file2, { ...options, realpath: false }, releasedCallback);
|
|
28524
|
+
});
|
|
28525
|
+
});
|
|
28526
|
+
});
|
|
28527
|
+
});
|
|
28528
|
+
}
|
|
28529
|
+
function unlock(file, options, callback) {
|
|
28530
|
+
options = {
|
|
28531
|
+
fs,
|
|
28532
|
+
realpath: true,
|
|
28533
|
+
...options
|
|
28534
|
+
};
|
|
28535
|
+
resolveCanonicalPath(file, options, (err, file2) => {
|
|
28536
|
+
if (err) {
|
|
28537
|
+
return callback(err);
|
|
28538
|
+
}
|
|
28539
|
+
const lock2 = locks[file2];
|
|
28540
|
+
if (!lock2) {
|
|
28541
|
+
return callback(Object.assign(new Error("Lock is not acquired/owned by you"), { code: "ENOTACQUIRED" }));
|
|
28542
|
+
}
|
|
28543
|
+
lock2.updateTimeout && clearTimeout(lock2.updateTimeout);
|
|
28544
|
+
lock2.released = true;
|
|
28545
|
+
delete locks[file2];
|
|
28546
|
+
removeLock(file2, options, callback);
|
|
28547
|
+
});
|
|
28548
|
+
}
|
|
28549
|
+
function check(file, options, callback) {
|
|
28550
|
+
options = {
|
|
28551
|
+
stale: 1e4,
|
|
28552
|
+
realpath: true,
|
|
28553
|
+
fs,
|
|
28554
|
+
...options
|
|
28555
|
+
};
|
|
28556
|
+
options.stale = Math.max(options.stale || 0, 2000);
|
|
28557
|
+
resolveCanonicalPath(file, options, (err, file2) => {
|
|
28558
|
+
if (err) {
|
|
28559
|
+
return callback(err);
|
|
28560
|
+
}
|
|
28561
|
+
options.fs.stat(getLockFile(file2, options), (err2, stat) => {
|
|
28562
|
+
if (err2) {
|
|
28563
|
+
return err2.code === "ENOENT" ? callback(null, false) : callback(err2);
|
|
28564
|
+
}
|
|
28565
|
+
return callback(null, !isLockStale(stat, options));
|
|
28566
|
+
});
|
|
28567
|
+
});
|
|
28568
|
+
}
|
|
28569
|
+
function getLocks() {
|
|
28570
|
+
return locks;
|
|
28571
|
+
}
|
|
28572
|
+
onExit(() => {
|
|
28573
|
+
for (const file in locks) {
|
|
28574
|
+
const options = locks[file].options;
|
|
28575
|
+
try {
|
|
28576
|
+
options.fs.rmdirSync(getLockFile(file, options));
|
|
28577
|
+
} catch (e) {}
|
|
28578
|
+
}
|
|
28579
|
+
});
|
|
28580
|
+
exports.lock = lock;
|
|
28581
|
+
exports.unlock = unlock;
|
|
28582
|
+
exports.check = check;
|
|
28583
|
+
exports.getLocks = getLocks;
|
|
28584
|
+
});
|
|
28585
|
+
|
|
28586
|
+
// ../node_modules/.bun/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/adapter.js
|
|
28587
|
+
var require_adapter = __commonJS((exports, module) => {
|
|
28588
|
+
var fs = require_graceful_fs();
|
|
28589
|
+
function createSyncFs(fs2) {
|
|
28590
|
+
const methods = ["mkdir", "realpath", "stat", "rmdir", "utimes"];
|
|
28591
|
+
const newFs = { ...fs2 };
|
|
28592
|
+
methods.forEach((method) => {
|
|
28593
|
+
newFs[method] = (...args) => {
|
|
28594
|
+
const callback = args.pop();
|
|
28595
|
+
let ret;
|
|
28596
|
+
try {
|
|
28597
|
+
ret = fs2[`${method}Sync`](...args);
|
|
28598
|
+
} catch (err) {
|
|
28599
|
+
return callback(err);
|
|
28600
|
+
}
|
|
28601
|
+
callback(null, ret);
|
|
28602
|
+
};
|
|
28603
|
+
});
|
|
28604
|
+
return newFs;
|
|
28605
|
+
}
|
|
28606
|
+
function toPromise(method) {
|
|
28607
|
+
return (...args) => new Promise((resolve7, reject) => {
|
|
28608
|
+
args.push((err, result) => {
|
|
28609
|
+
if (err) {
|
|
28610
|
+
reject(err);
|
|
28611
|
+
} else {
|
|
28612
|
+
resolve7(result);
|
|
28613
|
+
}
|
|
28614
|
+
});
|
|
28615
|
+
method(...args);
|
|
28616
|
+
});
|
|
28617
|
+
}
|
|
28618
|
+
function toSync(method) {
|
|
28619
|
+
return (...args) => {
|
|
28620
|
+
let err;
|
|
28621
|
+
let result;
|
|
28622
|
+
args.push((_err, _result) => {
|
|
28623
|
+
err = _err;
|
|
28624
|
+
result = _result;
|
|
28625
|
+
});
|
|
28626
|
+
method(...args);
|
|
28627
|
+
if (err) {
|
|
28628
|
+
throw err;
|
|
28629
|
+
}
|
|
28630
|
+
return result;
|
|
28631
|
+
};
|
|
28632
|
+
}
|
|
28633
|
+
function toSyncOptions(options) {
|
|
28634
|
+
options = { ...options };
|
|
28635
|
+
options.fs = createSyncFs(options.fs || fs);
|
|
28636
|
+
if (typeof options.retries === "number" && options.retries > 0 || options.retries && typeof options.retries.retries === "number" && options.retries.retries > 0) {
|
|
28637
|
+
throw Object.assign(new Error("Cannot use retries with the sync api"), { code: "ESYNC" });
|
|
28638
|
+
}
|
|
28639
|
+
return options;
|
|
28640
|
+
}
|
|
28641
|
+
module.exports = {
|
|
28642
|
+
toPromise,
|
|
28643
|
+
toSync,
|
|
28644
|
+
toSyncOptions
|
|
28645
|
+
};
|
|
28646
|
+
});
|
|
28647
|
+
|
|
28648
|
+
// ../node_modules/.bun/proper-lockfile@4.1.2/node_modules/proper-lockfile/index.js
|
|
28649
|
+
var require_proper_lockfile = __commonJS((exports, module) => {
|
|
28650
|
+
var lockfile = require_lockfile();
|
|
28651
|
+
var { toPromise, toSync, toSyncOptions } = require_adapter();
|
|
28652
|
+
async function lock(file, options) {
|
|
28653
|
+
const release = await toPromise(lockfile.lock)(file, options);
|
|
28654
|
+
return toPromise(release);
|
|
28655
|
+
}
|
|
28656
|
+
function lockSync(file, options) {
|
|
28657
|
+
const release = toSync(lockfile.lock)(file, toSyncOptions(options));
|
|
28658
|
+
return toSync(release);
|
|
28659
|
+
}
|
|
28660
|
+
function unlock(file, options) {
|
|
28661
|
+
return toPromise(lockfile.unlock)(file, options);
|
|
28662
|
+
}
|
|
28663
|
+
function unlockSync(file, options) {
|
|
28664
|
+
return toSync(lockfile.unlock)(file, toSyncOptions(options));
|
|
28665
|
+
}
|
|
28666
|
+
function check(file, options) {
|
|
28667
|
+
return toPromise(lockfile.check)(file, options);
|
|
28668
|
+
}
|
|
28669
|
+
function checkSync(file, options) {
|
|
28670
|
+
return toSync(lockfile.check)(file, toSyncOptions(options));
|
|
28671
|
+
}
|
|
28672
|
+
module.exports = lock;
|
|
28673
|
+
module.exports.lock = lock;
|
|
28674
|
+
module.exports.unlock = unlock;
|
|
28675
|
+
module.exports.lockSync = lockSync;
|
|
28676
|
+
module.exports.unlockSync = unlockSync;
|
|
28677
|
+
module.exports.check = check;
|
|
28678
|
+
module.exports.checkSync = checkSync;
|
|
28679
|
+
});
|
|
28680
|
+
|
|
27144
28681
|
// ../src/vault/vault.ts
|
|
27145
28682
|
import { randomBytes as randomBytes4, scryptSync, createCipheriv, createDecipheriv } from "node:crypto";
|
|
27146
28683
|
import {
|
|
@@ -27208,8 +28745,16 @@ function openVault(passphrase, vaultPath) {
|
|
|
27208
28745
|
}
|
|
27209
28746
|
return normalizeSecrets(vaultData.secrets ?? {});
|
|
27210
28747
|
}
|
|
27211
|
-
var SCRYPT_N = 32768, SCRYPT_R = 8, SCRYPT_P = 1, SCRYPT_MAXMEM, VaultError, LEGACY_SCRYPT_N = 16384;
|
|
28748
|
+
var import_proper_lockfile, KNOWN_VAULT_ARTIFACT_NAMES, SCRYPT_N = 32768, SCRYPT_R = 8, SCRYPT_P = 1, SCRYPT_MAXMEM, VaultError, LEGACY_SCRYPT_N = 16384;
|
|
27212
28749
|
var init_vault = __esm(() => {
|
|
28750
|
+
import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
|
|
28751
|
+
KNOWN_VAULT_ARTIFACT_NAMES = new Set([
|
|
28752
|
+
"vault.enc",
|
|
28753
|
+
"vault.enc.bak",
|
|
28754
|
+
"vault.enc.tmp",
|
|
28755
|
+
"vault.enc.lock",
|
|
28756
|
+
".vault.enc.symlink-tmp"
|
|
28757
|
+
]);
|
|
27213
28758
|
SCRYPT_MAXMEM = 128 * 1024 * 1024;
|
|
27214
28759
|
VaultError = class VaultError extends Error {
|
|
27215
28760
|
constructor(message) {
|
|
@@ -27222,10 +28767,10 @@ var init_vault = __esm(() => {
|
|
|
27222
28767
|
// ../src/vault/resolver.ts
|
|
27223
28768
|
import {
|
|
27224
28769
|
chmodSync as chmodSync3,
|
|
27225
|
-
closeSync as
|
|
28770
|
+
closeSync as closeSync6,
|
|
27226
28771
|
mkdirSync as mkdirSync16,
|
|
27227
28772
|
mkdtempSync,
|
|
27228
|
-
openSync as
|
|
28773
|
+
openSync as openSync6,
|
|
27229
28774
|
rmSync as rmSync3,
|
|
27230
28775
|
statSync as statSync9,
|
|
27231
28776
|
writeSync as writeSync2
|
|
@@ -27293,11 +28838,11 @@ function materializationRoot() {
|
|
|
27293
28838
|
}
|
|
27294
28839
|
function writeFileExclusive(filePath, content) {
|
|
27295
28840
|
const buf = typeof content === "string" ? Buffer.from(content, "utf8") : content;
|
|
27296
|
-
const fd =
|
|
28841
|
+
const fd = openSync6(filePath, fsConstants.O_WRONLY | fsConstants.O_CREAT | fsConstants.O_EXCL, 384);
|
|
27297
28842
|
try {
|
|
27298
28843
|
writeSync2(fd, buf);
|
|
27299
28844
|
} finally {
|
|
27300
|
-
|
|
28845
|
+
closeSync6(fd);
|
|
27301
28846
|
}
|
|
27302
28847
|
}
|
|
27303
28848
|
function materializeFilesEntry(key, files) {
|
|
@@ -28590,8 +30135,8 @@ import {
|
|
|
28590
30135
|
renameSync as renameSync16,
|
|
28591
30136
|
realpathSync,
|
|
28592
30137
|
chmodSync as chmodSync4,
|
|
28593
|
-
openSync as
|
|
28594
|
-
closeSync as
|
|
30138
|
+
openSync as openSync7,
|
|
30139
|
+
closeSync as closeSync7,
|
|
28595
30140
|
existsSync as existsSync25,
|
|
28596
30141
|
unlinkSync as unlinkSync14
|
|
28597
30142
|
} from "fs";
|
|
@@ -40750,10 +42295,10 @@ function sweepStaleTurnActiveMarker(stateDir, opts) {
|
|
|
40750
42295
|
}
|
|
40751
42296
|
|
|
40752
42297
|
// ../src/build-info.ts
|
|
40753
|
-
var VERSION = "0.7.
|
|
40754
|
-
var COMMIT_SHA = "
|
|
40755
|
-
var COMMIT_DATE = "2026-05-
|
|
40756
|
-
var LATEST_PR =
|
|
42298
|
+
var VERSION = "0.7.13";
|
|
42299
|
+
var COMMIT_SHA = "67ad70ac";
|
|
42300
|
+
var COMMIT_DATE = "2026-05-11T04:44:52+10:00";
|
|
42301
|
+
var LATEST_PR = 959;
|
|
40757
42302
|
var COMMITS_AHEAD_OF_TAG = 0;
|
|
40758
42303
|
|
|
40759
42304
|
// gateway/unhandled-rejection-policy.ts
|
|
@@ -44776,7 +46321,7 @@ function spawnSwitchroomDetached(args, onFailure) {
|
|
|
44776
46321
|
let outFd = null;
|
|
44777
46322
|
try {
|
|
44778
46323
|
mkdirSync18(STATE_DIR, { recursive: true });
|
|
44779
|
-
outFd =
|
|
46324
|
+
outFd = openSync7(logPath, "a");
|
|
44780
46325
|
writeFileSync21(logPath, `
|
|
44781
46326
|
[${new Date().toISOString()}] spawn ${SWITCHROOM_CLI} ${fullArgs.join(" ")}
|
|
44782
46327
|
`, { flag: "a" });
|
|
@@ -44791,7 +46336,7 @@ function spawnSwitchroomDetached(args, onFailure) {
|
|
|
44791
46336
|
});
|
|
44792
46337
|
if (outFd != null) {
|
|
44793
46338
|
try {
|
|
44794
|
-
|
|
46339
|
+
closeSync7(outFd);
|
|
44795
46340
|
} catch {}
|
|
44796
46341
|
}
|
|
44797
46342
|
if (onFailure) {
|