canopycms-cdk 0.8.3 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/worker/dist/index.js
CHANGED
|
@@ -67,54 +67,54 @@ var require_polyfills = __commonJS({
|
|
|
67
67
|
}
|
|
68
68
|
var chdir;
|
|
69
69
|
module.exports = patch;
|
|
70
|
-
function patch(
|
|
70
|
+
function patch(fs37) {
|
|
71
71
|
if (constants2.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
|
|
72
|
-
patchLchmod(
|
|
73
|
-
}
|
|
74
|
-
if (!
|
|
75
|
-
patchLutimes(
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if (
|
|
96
|
-
|
|
72
|
+
patchLchmod(fs37);
|
|
73
|
+
}
|
|
74
|
+
if (!fs37.lutimes) {
|
|
75
|
+
patchLutimes(fs37);
|
|
76
|
+
}
|
|
77
|
+
fs37.chown = chownFix(fs37.chown);
|
|
78
|
+
fs37.fchown = chownFix(fs37.fchown);
|
|
79
|
+
fs37.lchown = chownFix(fs37.lchown);
|
|
80
|
+
fs37.chmod = chmodFix(fs37.chmod);
|
|
81
|
+
fs37.fchmod = chmodFix(fs37.fchmod);
|
|
82
|
+
fs37.lchmod = chmodFix(fs37.lchmod);
|
|
83
|
+
fs37.chownSync = chownFixSync(fs37.chownSync);
|
|
84
|
+
fs37.fchownSync = chownFixSync(fs37.fchownSync);
|
|
85
|
+
fs37.lchownSync = chownFixSync(fs37.lchownSync);
|
|
86
|
+
fs37.chmodSync = chmodFixSync(fs37.chmodSync);
|
|
87
|
+
fs37.fchmodSync = chmodFixSync(fs37.fchmodSync);
|
|
88
|
+
fs37.lchmodSync = chmodFixSync(fs37.lchmodSync);
|
|
89
|
+
fs37.stat = statFix(fs37.stat);
|
|
90
|
+
fs37.fstat = statFix(fs37.fstat);
|
|
91
|
+
fs37.lstat = statFix(fs37.lstat);
|
|
92
|
+
fs37.statSync = statFixSync(fs37.statSync);
|
|
93
|
+
fs37.fstatSync = statFixSync(fs37.fstatSync);
|
|
94
|
+
fs37.lstatSync = statFixSync(fs37.lstatSync);
|
|
95
|
+
if (fs37.chmod && !fs37.lchmod) {
|
|
96
|
+
fs37.lchmod = function(path39, mode, cb) {
|
|
97
97
|
if (cb) process.nextTick(cb);
|
|
98
98
|
};
|
|
99
|
-
|
|
99
|
+
fs37.lchmodSync = function() {
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
-
if (
|
|
103
|
-
|
|
102
|
+
if (fs37.chown && !fs37.lchown) {
|
|
103
|
+
fs37.lchown = function(path39, uid, gid, cb) {
|
|
104
104
|
if (cb) process.nextTick(cb);
|
|
105
105
|
};
|
|
106
|
-
|
|
106
|
+
fs37.lchownSync = function() {
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
109
|
if (platform2 === "win32") {
|
|
110
|
-
|
|
110
|
+
fs37.rename = typeof fs37.rename !== "function" ? fs37.rename : (function(fs$rename) {
|
|
111
111
|
function rename(from, to, cb) {
|
|
112
112
|
var start = Date.now();
|
|
113
113
|
var backoff = 0;
|
|
114
114
|
fs$rename(from, to, function CB(er) {
|
|
115
115
|
if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
|
|
116
116
|
setTimeout(function() {
|
|
117
|
-
|
|
117
|
+
fs37.stat(to, function(stater, st) {
|
|
118
118
|
if (stater && stater.code === "ENOENT")
|
|
119
119
|
fs$rename(from, to, CB);
|
|
120
120
|
else
|
|
@@ -130,9 +130,9 @@ var require_polyfills = __commonJS({
|
|
|
130
130
|
}
|
|
131
131
|
if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
|
|
132
132
|
return rename;
|
|
133
|
-
})(
|
|
133
|
+
})(fs37.rename);
|
|
134
134
|
}
|
|
135
|
-
|
|
135
|
+
fs37.read = typeof fs37.read !== "function" ? fs37.read : (function(fs$read) {
|
|
136
136
|
function read(fd, buffer, offset, length, position, callback_) {
|
|
137
137
|
var callback;
|
|
138
138
|
if (callback_ && typeof callback_ === "function") {
|
|
@@ -140,22 +140,22 @@ var require_polyfills = __commonJS({
|
|
|
140
140
|
callback = function(er, _3, __) {
|
|
141
141
|
if (er && er.code === "EAGAIN" && eagCounter < 10) {
|
|
142
142
|
eagCounter++;
|
|
143
|
-
return fs$read.call(
|
|
143
|
+
return fs$read.call(fs37, fd, buffer, offset, length, position, callback);
|
|
144
144
|
}
|
|
145
145
|
callback_.apply(this, arguments);
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
|
-
return fs$read.call(
|
|
148
|
+
return fs$read.call(fs37, fd, buffer, offset, length, position, callback);
|
|
149
149
|
}
|
|
150
150
|
if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
|
|
151
151
|
return read;
|
|
152
|
-
})(
|
|
153
|
-
|
|
152
|
+
})(fs37.read);
|
|
153
|
+
fs37.readSync = typeof fs37.readSync !== "function" ? fs37.readSync : /* @__PURE__ */ (function(fs$readSync) {
|
|
154
154
|
return function(fd, buffer, offset, length, position) {
|
|
155
155
|
var eagCounter = 0;
|
|
156
156
|
while (true) {
|
|
157
157
|
try {
|
|
158
|
-
return fs$readSync.call(
|
|
158
|
+
return fs$readSync.call(fs37, fd, buffer, offset, length, position);
|
|
159
159
|
} catch (er) {
|
|
160
160
|
if (er.code === "EAGAIN" && eagCounter < 10) {
|
|
161
161
|
eagCounter++;
|
|
@@ -165,11 +165,11 @@ var require_polyfills = __commonJS({
|
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
};
|
|
168
|
-
})(
|
|
169
|
-
function patchLchmod(
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
168
|
+
})(fs37.readSync);
|
|
169
|
+
function patchLchmod(fs38) {
|
|
170
|
+
fs38.lchmod = function(path39, mode, callback) {
|
|
171
|
+
fs38.open(
|
|
172
|
+
path39,
|
|
173
173
|
constants2.O_WRONLY | constants2.O_SYMLINK,
|
|
174
174
|
mode,
|
|
175
175
|
function(err, fd) {
|
|
@@ -177,80 +177,80 @@ var require_polyfills = __commonJS({
|
|
|
177
177
|
if (callback) callback(err);
|
|
178
178
|
return;
|
|
179
179
|
}
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
fs38.fchmod(fd, mode, function(err2) {
|
|
181
|
+
fs38.close(fd, function(err22) {
|
|
182
182
|
if (callback) callback(err2 || err22);
|
|
183
183
|
});
|
|
184
184
|
});
|
|
185
185
|
}
|
|
186
186
|
);
|
|
187
187
|
};
|
|
188
|
-
|
|
189
|
-
var fd =
|
|
188
|
+
fs38.lchmodSync = function(path39, mode) {
|
|
189
|
+
var fd = fs38.openSync(path39, constants2.O_WRONLY | constants2.O_SYMLINK, mode);
|
|
190
190
|
var threw = true;
|
|
191
191
|
var ret;
|
|
192
192
|
try {
|
|
193
|
-
ret =
|
|
193
|
+
ret = fs38.fchmodSync(fd, mode);
|
|
194
194
|
threw = false;
|
|
195
195
|
} finally {
|
|
196
196
|
if (threw) {
|
|
197
197
|
try {
|
|
198
|
-
|
|
198
|
+
fs38.closeSync(fd);
|
|
199
199
|
} catch (er) {
|
|
200
200
|
}
|
|
201
201
|
} else {
|
|
202
|
-
|
|
202
|
+
fs38.closeSync(fd);
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
return ret;
|
|
206
206
|
};
|
|
207
207
|
}
|
|
208
|
-
function patchLutimes(
|
|
209
|
-
if (constants2.hasOwnProperty("O_SYMLINK") &&
|
|
210
|
-
|
|
211
|
-
|
|
208
|
+
function patchLutimes(fs38) {
|
|
209
|
+
if (constants2.hasOwnProperty("O_SYMLINK") && fs38.futimes) {
|
|
210
|
+
fs38.lutimes = function(path39, at, mt, cb) {
|
|
211
|
+
fs38.open(path39, constants2.O_SYMLINK, function(er, fd) {
|
|
212
212
|
if (er) {
|
|
213
213
|
if (cb) cb(er);
|
|
214
214
|
return;
|
|
215
215
|
}
|
|
216
|
-
|
|
217
|
-
|
|
216
|
+
fs38.futimes(fd, at, mt, function(er2) {
|
|
217
|
+
fs38.close(fd, function(er22) {
|
|
218
218
|
if (cb) cb(er2 || er22);
|
|
219
219
|
});
|
|
220
220
|
});
|
|
221
221
|
});
|
|
222
222
|
};
|
|
223
|
-
|
|
224
|
-
var fd =
|
|
223
|
+
fs38.lutimesSync = function(path39, at, mt) {
|
|
224
|
+
var fd = fs38.openSync(path39, constants2.O_SYMLINK);
|
|
225
225
|
var ret;
|
|
226
226
|
var threw = true;
|
|
227
227
|
try {
|
|
228
|
-
ret =
|
|
228
|
+
ret = fs38.futimesSync(fd, at, mt);
|
|
229
229
|
threw = false;
|
|
230
230
|
} finally {
|
|
231
231
|
if (threw) {
|
|
232
232
|
try {
|
|
233
|
-
|
|
233
|
+
fs38.closeSync(fd);
|
|
234
234
|
} catch (er) {
|
|
235
235
|
}
|
|
236
236
|
} else {
|
|
237
|
-
|
|
237
|
+
fs38.closeSync(fd);
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
return ret;
|
|
241
241
|
};
|
|
242
|
-
} else if (
|
|
243
|
-
|
|
242
|
+
} else if (fs38.futimes) {
|
|
243
|
+
fs38.lutimes = function(_a4, _b, _c9, cb) {
|
|
244
244
|
if (cb) process.nextTick(cb);
|
|
245
245
|
};
|
|
246
|
-
|
|
246
|
+
fs38.lutimesSync = function() {
|
|
247
247
|
};
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
250
|
function chmodFix(orig) {
|
|
251
251
|
if (!orig) return orig;
|
|
252
252
|
return function(target, mode, cb) {
|
|
253
|
-
return orig.call(
|
|
253
|
+
return orig.call(fs37, target, mode, function(er) {
|
|
254
254
|
if (chownErOk(er)) er = null;
|
|
255
255
|
if (cb) cb.apply(this, arguments);
|
|
256
256
|
});
|
|
@@ -260,7 +260,7 @@ var require_polyfills = __commonJS({
|
|
|
260
260
|
if (!orig) return orig;
|
|
261
261
|
return function(target, mode) {
|
|
262
262
|
try {
|
|
263
|
-
return orig.call(
|
|
263
|
+
return orig.call(fs37, target, mode);
|
|
264
264
|
} catch (er) {
|
|
265
265
|
if (!chownErOk(er)) throw er;
|
|
266
266
|
}
|
|
@@ -269,7 +269,7 @@ var require_polyfills = __commonJS({
|
|
|
269
269
|
function chownFix(orig) {
|
|
270
270
|
if (!orig) return orig;
|
|
271
271
|
return function(target, uid, gid, cb) {
|
|
272
|
-
return orig.call(
|
|
272
|
+
return orig.call(fs37, target, uid, gid, function(er) {
|
|
273
273
|
if (chownErOk(er)) er = null;
|
|
274
274
|
if (cb) cb.apply(this, arguments);
|
|
275
275
|
});
|
|
@@ -279,7 +279,7 @@ var require_polyfills = __commonJS({
|
|
|
279
279
|
if (!orig) return orig;
|
|
280
280
|
return function(target, uid, gid) {
|
|
281
281
|
try {
|
|
282
|
-
return orig.call(
|
|
282
|
+
return orig.call(fs37, target, uid, gid);
|
|
283
283
|
} catch (er) {
|
|
284
284
|
if (!chownErOk(er)) throw er;
|
|
285
285
|
}
|
|
@@ -299,13 +299,13 @@ var require_polyfills = __commonJS({
|
|
|
299
299
|
}
|
|
300
300
|
if (cb) cb.apply(this, arguments);
|
|
301
301
|
}
|
|
302
|
-
return options ? orig.call(
|
|
302
|
+
return options ? orig.call(fs37, target, options, callback) : orig.call(fs37, target, callback);
|
|
303
303
|
};
|
|
304
304
|
}
|
|
305
305
|
function statFixSync(orig) {
|
|
306
306
|
if (!orig) return orig;
|
|
307
307
|
return function(target, options) {
|
|
308
|
-
var stats = options ? orig.call(
|
|
308
|
+
var stats = options ? orig.call(fs37, target, options) : orig.call(fs37, target);
|
|
309
309
|
if (stats) {
|
|
310
310
|
if (stats.uid < 0) stats.uid += 4294967296;
|
|
311
311
|
if (stats.gid < 0) stats.gid += 4294967296;
|
|
@@ -334,16 +334,16 @@ var require_legacy_streams = __commonJS({
|
|
|
334
334
|
"../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js"(exports, module) {
|
|
335
335
|
var Stream = __require("stream").Stream;
|
|
336
336
|
module.exports = legacy;
|
|
337
|
-
function legacy(
|
|
337
|
+
function legacy(fs37) {
|
|
338
338
|
return {
|
|
339
339
|
ReadStream: ReadStream2,
|
|
340
340
|
WriteStream
|
|
341
341
|
};
|
|
342
|
-
function ReadStream2(
|
|
343
|
-
if (!(this instanceof ReadStream2)) return new ReadStream2(
|
|
342
|
+
function ReadStream2(path39, options) {
|
|
343
|
+
if (!(this instanceof ReadStream2)) return new ReadStream2(path39, options);
|
|
344
344
|
Stream.call(this);
|
|
345
345
|
var self2 = this;
|
|
346
|
-
this.path =
|
|
346
|
+
this.path = path39;
|
|
347
347
|
this.fd = null;
|
|
348
348
|
this.readable = true;
|
|
349
349
|
this.paused = false;
|
|
@@ -377,7 +377,7 @@ var require_legacy_streams = __commonJS({
|
|
|
377
377
|
});
|
|
378
378
|
return;
|
|
379
379
|
}
|
|
380
|
-
|
|
380
|
+
fs37.open(this.path, this.flags, this.mode, function(err, fd) {
|
|
381
381
|
if (err) {
|
|
382
382
|
self2.emit("error", err);
|
|
383
383
|
self2.readable = false;
|
|
@@ -388,10 +388,10 @@ var require_legacy_streams = __commonJS({
|
|
|
388
388
|
self2._read();
|
|
389
389
|
});
|
|
390
390
|
}
|
|
391
|
-
function WriteStream(
|
|
392
|
-
if (!(this instanceof WriteStream)) return new WriteStream(
|
|
391
|
+
function WriteStream(path39, options) {
|
|
392
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path39, options);
|
|
393
393
|
Stream.call(this);
|
|
394
|
-
this.path =
|
|
394
|
+
this.path = path39;
|
|
395
395
|
this.fd = null;
|
|
396
396
|
this.writable = true;
|
|
397
397
|
this.flags = "w";
|
|
@@ -416,7 +416,7 @@ var require_legacy_streams = __commonJS({
|
|
|
416
416
|
this.busy = false;
|
|
417
417
|
this._queue = [];
|
|
418
418
|
if (this.fd === null) {
|
|
419
|
-
this._open =
|
|
419
|
+
this._open = fs37.open;
|
|
420
420
|
this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
|
|
421
421
|
this.flush();
|
|
422
422
|
}
|
|
@@ -451,7 +451,7 @@ var require_clone = __commonJS({
|
|
|
451
451
|
// ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
|
|
452
452
|
var require_graceful_fs = __commonJS({
|
|
453
453
|
"../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js"(exports, module) {
|
|
454
|
-
var
|
|
454
|
+
var fs37 = __require("fs");
|
|
455
455
|
var polyfills = require_polyfills();
|
|
456
456
|
var legacy = require_legacy_streams();
|
|
457
457
|
var clone = require_clone();
|
|
@@ -483,12 +483,12 @@ var require_graceful_fs = __commonJS({
|
|
|
483
483
|
m7 = "GFS4: " + m7.split(/\n/).join("\nGFS4: ");
|
|
484
484
|
console.error(m7);
|
|
485
485
|
};
|
|
486
|
-
if (!
|
|
486
|
+
if (!fs37[gracefulQueue]) {
|
|
487
487
|
queue = global[gracefulQueue] || [];
|
|
488
|
-
publishQueue(
|
|
489
|
-
|
|
488
|
+
publishQueue(fs37, queue);
|
|
489
|
+
fs37.close = (function(fs$close) {
|
|
490
490
|
function close(fd, cb) {
|
|
491
|
-
return fs$close.call(
|
|
491
|
+
return fs$close.call(fs37, fd, function(err) {
|
|
492
492
|
if (!err) {
|
|
493
493
|
resetQueue();
|
|
494
494
|
}
|
|
@@ -500,48 +500,48 @@ var require_graceful_fs = __commonJS({
|
|
|
500
500
|
value: fs$close
|
|
501
501
|
});
|
|
502
502
|
return close;
|
|
503
|
-
})(
|
|
504
|
-
|
|
503
|
+
})(fs37.close);
|
|
504
|
+
fs37.closeSync = (function(fs$closeSync) {
|
|
505
505
|
function closeSync(fd) {
|
|
506
|
-
fs$closeSync.apply(
|
|
506
|
+
fs$closeSync.apply(fs37, arguments);
|
|
507
507
|
resetQueue();
|
|
508
508
|
}
|
|
509
509
|
Object.defineProperty(closeSync, previousSymbol, {
|
|
510
510
|
value: fs$closeSync
|
|
511
511
|
});
|
|
512
512
|
return closeSync;
|
|
513
|
-
})(
|
|
513
|
+
})(fs37.closeSync);
|
|
514
514
|
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
|
|
515
515
|
process.on("exit", function() {
|
|
516
|
-
debug2(
|
|
517
|
-
__require("assert").equal(
|
|
516
|
+
debug2(fs37[gracefulQueue]);
|
|
517
|
+
__require("assert").equal(fs37[gracefulQueue].length, 0);
|
|
518
518
|
});
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
521
|
var queue;
|
|
522
522
|
if (!global[gracefulQueue]) {
|
|
523
|
-
publishQueue(global,
|
|
524
|
-
}
|
|
525
|
-
module.exports = patch(clone(
|
|
526
|
-
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !
|
|
527
|
-
module.exports = patch(
|
|
528
|
-
|
|
529
|
-
}
|
|
530
|
-
function patch(
|
|
531
|
-
polyfills(
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
var fs$readFile =
|
|
536
|
-
|
|
537
|
-
function readFile3(
|
|
523
|
+
publishQueue(global, fs37[gracefulQueue]);
|
|
524
|
+
}
|
|
525
|
+
module.exports = patch(clone(fs37));
|
|
526
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs37.__patched) {
|
|
527
|
+
module.exports = patch(fs37);
|
|
528
|
+
fs37.__patched = true;
|
|
529
|
+
}
|
|
530
|
+
function patch(fs38) {
|
|
531
|
+
polyfills(fs38);
|
|
532
|
+
fs38.gracefulify = patch;
|
|
533
|
+
fs38.createReadStream = createReadStream;
|
|
534
|
+
fs38.createWriteStream = createWriteStream;
|
|
535
|
+
var fs$readFile = fs38.readFile;
|
|
536
|
+
fs38.readFile = readFile3;
|
|
537
|
+
function readFile3(path39, options, cb) {
|
|
538
538
|
if (typeof options === "function")
|
|
539
539
|
cb = options, options = null;
|
|
540
|
-
return go$readFile(
|
|
541
|
-
function go$readFile(
|
|
542
|
-
return fs$readFile(
|
|
540
|
+
return go$readFile(path39, options, cb);
|
|
541
|
+
function go$readFile(path40, options2, cb2, startTime) {
|
|
542
|
+
return fs$readFile(path40, options2, function(err) {
|
|
543
543
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
544
|
-
enqueue([go$readFile, [
|
|
544
|
+
enqueue([go$readFile, [path40, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
545
545
|
else {
|
|
546
546
|
if (typeof cb2 === "function")
|
|
547
547
|
cb2.apply(this, arguments);
|
|
@@ -549,16 +549,16 @@ var require_graceful_fs = __commonJS({
|
|
|
549
549
|
});
|
|
550
550
|
}
|
|
551
551
|
}
|
|
552
|
-
var fs$writeFile =
|
|
553
|
-
|
|
554
|
-
function writeFile(
|
|
552
|
+
var fs$writeFile = fs38.writeFile;
|
|
553
|
+
fs38.writeFile = writeFile;
|
|
554
|
+
function writeFile(path39, data3, options, cb) {
|
|
555
555
|
if (typeof options === "function")
|
|
556
556
|
cb = options, options = null;
|
|
557
|
-
return go$writeFile(
|
|
558
|
-
function go$writeFile(
|
|
559
|
-
return fs$writeFile(
|
|
557
|
+
return go$writeFile(path39, data3, options, cb);
|
|
558
|
+
function go$writeFile(path40, data4, options2, cb2, startTime) {
|
|
559
|
+
return fs$writeFile(path40, data4, options2, function(err) {
|
|
560
560
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
561
|
-
enqueue([go$writeFile, [
|
|
561
|
+
enqueue([go$writeFile, [path40, data4, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
562
562
|
else {
|
|
563
563
|
if (typeof cb2 === "function")
|
|
564
564
|
cb2.apply(this, arguments);
|
|
@@ -566,17 +566,17 @@ var require_graceful_fs = __commonJS({
|
|
|
566
566
|
});
|
|
567
567
|
}
|
|
568
568
|
}
|
|
569
|
-
var fs$appendFile =
|
|
569
|
+
var fs$appendFile = fs38.appendFile;
|
|
570
570
|
if (fs$appendFile)
|
|
571
|
-
|
|
572
|
-
function appendFile(
|
|
571
|
+
fs38.appendFile = appendFile;
|
|
572
|
+
function appendFile(path39, data3, options, cb) {
|
|
573
573
|
if (typeof options === "function")
|
|
574
574
|
cb = options, options = null;
|
|
575
|
-
return go$appendFile(
|
|
576
|
-
function go$appendFile(
|
|
577
|
-
return fs$appendFile(
|
|
575
|
+
return go$appendFile(path39, data3, options, cb);
|
|
576
|
+
function go$appendFile(path40, data4, options2, cb2, startTime) {
|
|
577
|
+
return fs$appendFile(path40, data4, options2, function(err) {
|
|
578
578
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
579
|
-
enqueue([go$appendFile, [
|
|
579
|
+
enqueue([go$appendFile, [path40, data4, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
580
580
|
else {
|
|
581
581
|
if (typeof cb2 === "function")
|
|
582
582
|
cb2.apply(this, arguments);
|
|
@@ -584,9 +584,9 @@ var require_graceful_fs = __commonJS({
|
|
|
584
584
|
});
|
|
585
585
|
}
|
|
586
586
|
}
|
|
587
|
-
var fs$copyFile =
|
|
587
|
+
var fs$copyFile = fs38.copyFile;
|
|
588
588
|
if (fs$copyFile)
|
|
589
|
-
|
|
589
|
+
fs38.copyFile = copyFile;
|
|
590
590
|
function copyFile(src, dest, flags, cb) {
|
|
591
591
|
if (typeof flags === "function") {
|
|
592
592
|
cb = flags;
|
|
@@ -604,34 +604,34 @@ var require_graceful_fs = __commonJS({
|
|
|
604
604
|
});
|
|
605
605
|
}
|
|
606
606
|
}
|
|
607
|
-
var fs$readdir =
|
|
608
|
-
|
|
607
|
+
var fs$readdir = fs38.readdir;
|
|
608
|
+
fs38.readdir = readdir;
|
|
609
609
|
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
610
|
-
function readdir(
|
|
610
|
+
function readdir(path39, options, cb) {
|
|
611
611
|
if (typeof options === "function")
|
|
612
612
|
cb = options, options = null;
|
|
613
|
-
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(
|
|
614
|
-
return fs$readdir(
|
|
615
|
-
|
|
613
|
+
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path40, options2, cb2, startTime) {
|
|
614
|
+
return fs$readdir(path40, fs$readdirCallback(
|
|
615
|
+
path40,
|
|
616
616
|
options2,
|
|
617
617
|
cb2,
|
|
618
618
|
startTime
|
|
619
619
|
));
|
|
620
|
-
} : function go$readdir2(
|
|
621
|
-
return fs$readdir(
|
|
622
|
-
|
|
620
|
+
} : function go$readdir2(path40, options2, cb2, startTime) {
|
|
621
|
+
return fs$readdir(path40, options2, fs$readdirCallback(
|
|
622
|
+
path40,
|
|
623
623
|
options2,
|
|
624
624
|
cb2,
|
|
625
625
|
startTime
|
|
626
626
|
));
|
|
627
627
|
};
|
|
628
|
-
return go$readdir(
|
|
629
|
-
function fs$readdirCallback(
|
|
628
|
+
return go$readdir(path39, options, cb);
|
|
629
|
+
function fs$readdirCallback(path40, options2, cb2, startTime) {
|
|
630
630
|
return function(err, files) {
|
|
631
631
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
632
632
|
enqueue([
|
|
633
633
|
go$readdir,
|
|
634
|
-
[
|
|
634
|
+
[path40, options2, cb2],
|
|
635
635
|
err,
|
|
636
636
|
startTime || Date.now(),
|
|
637
637
|
Date.now()
|
|
@@ -646,21 +646,21 @@ var require_graceful_fs = __commonJS({
|
|
|
646
646
|
}
|
|
647
647
|
}
|
|
648
648
|
if (process.version.substr(0, 4) === "v0.8") {
|
|
649
|
-
var legStreams = legacy(
|
|
649
|
+
var legStreams = legacy(fs38);
|
|
650
650
|
ReadStream2 = legStreams.ReadStream;
|
|
651
651
|
WriteStream = legStreams.WriteStream;
|
|
652
652
|
}
|
|
653
|
-
var fs$ReadStream =
|
|
653
|
+
var fs$ReadStream = fs38.ReadStream;
|
|
654
654
|
if (fs$ReadStream) {
|
|
655
655
|
ReadStream2.prototype = Object.create(fs$ReadStream.prototype);
|
|
656
656
|
ReadStream2.prototype.open = ReadStream$open;
|
|
657
657
|
}
|
|
658
|
-
var fs$WriteStream =
|
|
658
|
+
var fs$WriteStream = fs38.WriteStream;
|
|
659
659
|
if (fs$WriteStream) {
|
|
660
660
|
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
|
|
661
661
|
WriteStream.prototype.open = WriteStream$open;
|
|
662
662
|
}
|
|
663
|
-
Object.defineProperty(
|
|
663
|
+
Object.defineProperty(fs38, "ReadStream", {
|
|
664
664
|
get: function() {
|
|
665
665
|
return ReadStream2;
|
|
666
666
|
},
|
|
@@ -670,7 +670,7 @@ var require_graceful_fs = __commonJS({
|
|
|
670
670
|
enumerable: true,
|
|
671
671
|
configurable: true
|
|
672
672
|
});
|
|
673
|
-
Object.defineProperty(
|
|
673
|
+
Object.defineProperty(fs38, "WriteStream", {
|
|
674
674
|
get: function() {
|
|
675
675
|
return WriteStream;
|
|
676
676
|
},
|
|
@@ -681,7 +681,7 @@ var require_graceful_fs = __commonJS({
|
|
|
681
681
|
configurable: true
|
|
682
682
|
});
|
|
683
683
|
var FileReadStream = ReadStream2;
|
|
684
|
-
Object.defineProperty(
|
|
684
|
+
Object.defineProperty(fs38, "FileReadStream", {
|
|
685
685
|
get: function() {
|
|
686
686
|
return FileReadStream;
|
|
687
687
|
},
|
|
@@ -692,7 +692,7 @@ var require_graceful_fs = __commonJS({
|
|
|
692
692
|
configurable: true
|
|
693
693
|
});
|
|
694
694
|
var FileWriteStream = WriteStream;
|
|
695
|
-
Object.defineProperty(
|
|
695
|
+
Object.defineProperty(fs38, "FileWriteStream", {
|
|
696
696
|
get: function() {
|
|
697
697
|
return FileWriteStream;
|
|
698
698
|
},
|
|
@@ -702,7 +702,7 @@ var require_graceful_fs = __commonJS({
|
|
|
702
702
|
enumerable: true,
|
|
703
703
|
configurable: true
|
|
704
704
|
});
|
|
705
|
-
function ReadStream2(
|
|
705
|
+
function ReadStream2(path39, options) {
|
|
706
706
|
if (this instanceof ReadStream2)
|
|
707
707
|
return fs$ReadStream.apply(this, arguments), this;
|
|
708
708
|
else
|
|
@@ -722,7 +722,7 @@ var require_graceful_fs = __commonJS({
|
|
|
722
722
|
}
|
|
723
723
|
});
|
|
724
724
|
}
|
|
725
|
-
function WriteStream(
|
|
725
|
+
function WriteStream(path39, options) {
|
|
726
726
|
if (this instanceof WriteStream)
|
|
727
727
|
return fs$WriteStream.apply(this, arguments), this;
|
|
728
728
|
else
|
|
@@ -740,22 +740,22 @@ var require_graceful_fs = __commonJS({
|
|
|
740
740
|
}
|
|
741
741
|
});
|
|
742
742
|
}
|
|
743
|
-
function createReadStream(
|
|
744
|
-
return new
|
|
743
|
+
function createReadStream(path39, options) {
|
|
744
|
+
return new fs38.ReadStream(path39, options);
|
|
745
745
|
}
|
|
746
|
-
function createWriteStream(
|
|
747
|
-
return new
|
|
746
|
+
function createWriteStream(path39, options) {
|
|
747
|
+
return new fs38.WriteStream(path39, options);
|
|
748
748
|
}
|
|
749
|
-
var fs$open =
|
|
750
|
-
|
|
751
|
-
function open(
|
|
749
|
+
var fs$open = fs38.open;
|
|
750
|
+
fs38.open = open;
|
|
751
|
+
function open(path39, flags, mode, cb) {
|
|
752
752
|
if (typeof mode === "function")
|
|
753
753
|
cb = mode, mode = null;
|
|
754
|
-
return go$open(
|
|
755
|
-
function go$open(
|
|
756
|
-
return fs$open(
|
|
754
|
+
return go$open(path39, flags, mode, cb);
|
|
755
|
+
function go$open(path40, flags2, mode2, cb2, startTime) {
|
|
756
|
+
return fs$open(path40, flags2, mode2, function(err, fd) {
|
|
757
757
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
758
|
-
enqueue([go$open, [
|
|
758
|
+
enqueue([go$open, [path40, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
759
759
|
else {
|
|
760
760
|
if (typeof cb2 === "function")
|
|
761
761
|
cb2.apply(this, arguments);
|
|
@@ -763,20 +763,20 @@ var require_graceful_fs = __commonJS({
|
|
|
763
763
|
});
|
|
764
764
|
}
|
|
765
765
|
}
|
|
766
|
-
return
|
|
766
|
+
return fs38;
|
|
767
767
|
}
|
|
768
768
|
function enqueue(elem) {
|
|
769
769
|
debug2("ENQUEUE", elem[0].name, elem[1]);
|
|
770
|
-
|
|
770
|
+
fs37[gracefulQueue].push(elem);
|
|
771
771
|
retry2();
|
|
772
772
|
}
|
|
773
773
|
var retryTimer;
|
|
774
774
|
function resetQueue() {
|
|
775
775
|
var now = Date.now();
|
|
776
|
-
for (var i10 = 0; i10 <
|
|
777
|
-
if (
|
|
778
|
-
|
|
779
|
-
|
|
776
|
+
for (var i10 = 0; i10 < fs37[gracefulQueue].length; ++i10) {
|
|
777
|
+
if (fs37[gracefulQueue][i10].length > 2) {
|
|
778
|
+
fs37[gracefulQueue][i10][3] = now;
|
|
779
|
+
fs37[gracefulQueue][i10][4] = now;
|
|
780
780
|
}
|
|
781
781
|
}
|
|
782
782
|
retry2();
|
|
@@ -784,9 +784,9 @@ var require_graceful_fs = __commonJS({
|
|
|
784
784
|
function retry2() {
|
|
785
785
|
clearTimeout(retryTimer);
|
|
786
786
|
retryTimer = void 0;
|
|
787
|
-
if (
|
|
787
|
+
if (fs37[gracefulQueue].length === 0)
|
|
788
788
|
return;
|
|
789
|
-
var elem =
|
|
789
|
+
var elem = fs37[gracefulQueue].shift();
|
|
790
790
|
var fn = elem[0];
|
|
791
791
|
var args = elem[1];
|
|
792
792
|
var err = elem[2];
|
|
@@ -808,7 +808,7 @@ var require_graceful_fs = __commonJS({
|
|
|
808
808
|
debug2("RETRY", fn.name, args);
|
|
809
809
|
fn.apply(null, args.concat([startTime]));
|
|
810
810
|
} else {
|
|
811
|
-
|
|
811
|
+
fs37[gracefulQueue].push(elem);
|
|
812
812
|
}
|
|
813
813
|
}
|
|
814
814
|
if (retryTimer === void 0) {
|
|
@@ -1243,10 +1243,10 @@ var require_mtime_precision = __commonJS({
|
|
|
1243
1243
|
"../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/mtime-precision.js"(exports, module) {
|
|
1244
1244
|
"use strict";
|
|
1245
1245
|
var cacheSymbol = Symbol();
|
|
1246
|
-
function probe(file,
|
|
1247
|
-
const cachedPrecision =
|
|
1246
|
+
function probe(file, fs37, callback) {
|
|
1247
|
+
const cachedPrecision = fs37[cacheSymbol];
|
|
1248
1248
|
if (cachedPrecision) {
|
|
1249
|
-
return
|
|
1249
|
+
return fs37.stat(file, (err, stat) => {
|
|
1250
1250
|
if (err) {
|
|
1251
1251
|
return callback(err);
|
|
1252
1252
|
}
|
|
@@ -1254,16 +1254,16 @@ var require_mtime_precision = __commonJS({
|
|
|
1254
1254
|
});
|
|
1255
1255
|
}
|
|
1256
1256
|
const mtime = new Date(Math.ceil(Date.now() / 1e3) * 1e3 + 5);
|
|
1257
|
-
|
|
1257
|
+
fs37.utimes(file, mtime, mtime, (err) => {
|
|
1258
1258
|
if (err) {
|
|
1259
1259
|
return callback(err);
|
|
1260
1260
|
}
|
|
1261
|
-
|
|
1261
|
+
fs37.stat(file, (err2, stat) => {
|
|
1262
1262
|
if (err2) {
|
|
1263
1263
|
return callback(err2);
|
|
1264
1264
|
}
|
|
1265
1265
|
const precision = stat.mtime.getTime() % 1e3 === 0 ? "s" : "ms";
|
|
1266
|
-
Object.defineProperty(
|
|
1266
|
+
Object.defineProperty(fs37, cacheSymbol, { value: precision });
|
|
1267
1267
|
callback(null, stat.mtime, precision);
|
|
1268
1268
|
});
|
|
1269
1269
|
});
|
|
@@ -1284,8 +1284,8 @@ var require_mtime_precision = __commonJS({
|
|
|
1284
1284
|
var require_lockfile = __commonJS({
|
|
1285
1285
|
"../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/lockfile.js"(exports, module) {
|
|
1286
1286
|
"use strict";
|
|
1287
|
-
var
|
|
1288
|
-
var
|
|
1287
|
+
var path39 = __require("path");
|
|
1288
|
+
var fs37 = require_graceful_fs();
|
|
1289
1289
|
var retry2 = require_retry2();
|
|
1290
1290
|
var onExit = require_signal_exit();
|
|
1291
1291
|
var mtimePrecision = require_mtime_precision();
|
|
@@ -1295,7 +1295,7 @@ var require_lockfile = __commonJS({
|
|
|
1295
1295
|
}
|
|
1296
1296
|
function resolveCanonicalPath(file, options, callback) {
|
|
1297
1297
|
if (!options.realpath) {
|
|
1298
|
-
return callback(null,
|
|
1298
|
+
return callback(null, path39.resolve(file));
|
|
1299
1299
|
}
|
|
1300
1300
|
options.fs.realpath(file, callback);
|
|
1301
1301
|
}
|
|
@@ -1416,7 +1416,7 @@ var require_lockfile = __commonJS({
|
|
|
1416
1416
|
update: null,
|
|
1417
1417
|
realpath: true,
|
|
1418
1418
|
retries: 0,
|
|
1419
|
-
fs:
|
|
1419
|
+
fs: fs37,
|
|
1420
1420
|
onCompromised: (err) => {
|
|
1421
1421
|
throw err;
|
|
1422
1422
|
},
|
|
@@ -1460,7 +1460,7 @@ var require_lockfile = __commonJS({
|
|
|
1460
1460
|
}
|
|
1461
1461
|
function unlock(file, options, callback) {
|
|
1462
1462
|
options = {
|
|
1463
|
-
fs:
|
|
1463
|
+
fs: fs37,
|
|
1464
1464
|
realpath: true,
|
|
1465
1465
|
...options
|
|
1466
1466
|
};
|
|
@@ -1482,7 +1482,7 @@ var require_lockfile = __commonJS({
|
|
|
1482
1482
|
options = {
|
|
1483
1483
|
stale: 1e4,
|
|
1484
1484
|
realpath: true,
|
|
1485
|
-
fs:
|
|
1485
|
+
fs: fs37,
|
|
1486
1486
|
...options
|
|
1487
1487
|
};
|
|
1488
1488
|
options.stale = Math.max(options.stale || 0, 2e3);
|
|
@@ -1521,16 +1521,16 @@ var require_lockfile = __commonJS({
|
|
|
1521
1521
|
var require_adapter = __commonJS({
|
|
1522
1522
|
"../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/adapter.js"(exports, module) {
|
|
1523
1523
|
"use strict";
|
|
1524
|
-
var
|
|
1525
|
-
function createSyncFs(
|
|
1524
|
+
var fs37 = require_graceful_fs();
|
|
1525
|
+
function createSyncFs(fs38) {
|
|
1526
1526
|
const methods = ["mkdir", "realpath", "stat", "rmdir", "utimes"];
|
|
1527
|
-
const newFs = { ...
|
|
1527
|
+
const newFs = { ...fs38 };
|
|
1528
1528
|
methods.forEach((method) => {
|
|
1529
1529
|
newFs[method] = (...args) => {
|
|
1530
1530
|
const callback = args.pop();
|
|
1531
1531
|
let ret;
|
|
1532
1532
|
try {
|
|
1533
|
-
ret =
|
|
1533
|
+
ret = fs38[`${method}Sync`](...args);
|
|
1534
1534
|
} catch (err) {
|
|
1535
1535
|
return callback(err);
|
|
1536
1536
|
}
|
|
@@ -1568,7 +1568,7 @@ var require_adapter = __commonJS({
|
|
|
1568
1568
|
}
|
|
1569
1569
|
function toSyncOptions(options) {
|
|
1570
1570
|
options = { ...options };
|
|
1571
|
-
options.fs = createSyncFs(options.fs ||
|
|
1571
|
+
options.fs = createSyncFs(options.fs || fs37);
|
|
1572
1572
|
if (typeof options.retries === "number" && options.retries > 0 || options.retries && typeof options.retries.retries === "number" && options.retries.retries > 0) {
|
|
1573
1573
|
throw Object.assign(new Error("Cannot use retries with the sync api"), { code: "ESYNC" });
|
|
1574
1574
|
}
|
|
@@ -1721,6 +1721,20 @@ function getErrorMessage(err) {
|
|
|
1721
1721
|
}
|
|
1722
1722
|
return String(err);
|
|
1723
1723
|
}
|
|
1724
|
+
function sanitizeErrorMessage(message2) {
|
|
1725
|
+
let result = redactCredentials(message2);
|
|
1726
|
+
result = result.replace(/\bfile:\/\/[^\s'")]*/g, "<path>");
|
|
1727
|
+
const cwd = typeof process !== "undefined" && typeof process.cwd === "function" ? process.cwd() : "/";
|
|
1728
|
+
if (cwd !== "/") {
|
|
1729
|
+
result = result.split(`${cwd}/`).join("");
|
|
1730
|
+
const cwdPattern = cwd.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1731
|
+
result = result.replace(new RegExp(`${cwdPattern}(?=[\\s'"),:;]|$)`, "g"), ".");
|
|
1732
|
+
}
|
|
1733
|
+
result = result.replace(/'\/[^']*'/g, "'<path>'").replace(/"\/[^"]*"/g, '"<path>"');
|
|
1734
|
+
result = result.replace(/(^|[\s'"(=:,[])\/(?:[^/\s'")]+\/)+[^/\s'")]*/g, "$1<path>");
|
|
1735
|
+
result = result.replace(/[A-Za-z]:\\[^\s'")]+/g, "<path>");
|
|
1736
|
+
return result;
|
|
1737
|
+
}
|
|
1724
1738
|
function redactCredentials(message2) {
|
|
1725
1739
|
let result = message2;
|
|
1726
1740
|
result = result.replace(/(:\/\/)[^/\s@]+@/g, "$1***@");
|
|
@@ -2530,10 +2544,10 @@ var require_src2 = __commonJS({
|
|
|
2530
2544
|
var fs_1 = __require("fs");
|
|
2531
2545
|
var debug_1 = __importDefault2(require_src());
|
|
2532
2546
|
var log6 = debug_1.default("@kwsites/file-exists");
|
|
2533
|
-
function check(
|
|
2534
|
-
log6(`checking %s`,
|
|
2547
|
+
function check(path39, isFile, isDirectory) {
|
|
2548
|
+
log6(`checking %s`, path39);
|
|
2535
2549
|
try {
|
|
2536
|
-
const stat = fs_1.statSync(
|
|
2550
|
+
const stat = fs_1.statSync(path39);
|
|
2537
2551
|
if (stat.isFile() && isFile) {
|
|
2538
2552
|
log6(`[OK] path represents a file`);
|
|
2539
2553
|
return true;
|
|
@@ -2553,8 +2567,8 @@ var require_src2 = __commonJS({
|
|
|
2553
2567
|
throw e9;
|
|
2554
2568
|
}
|
|
2555
2569
|
}
|
|
2556
|
-
function exists3(
|
|
2557
|
-
return check(
|
|
2570
|
+
function exists3(path39, type = exports.READABLE) {
|
|
2571
|
+
return check(path39, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
|
|
2558
2572
|
}
|
|
2559
2573
|
exports.exists = exists3;
|
|
2560
2574
|
exports.FILE = 1;
|
|
@@ -3047,8 +3061,8 @@ var init_parseUtil = __esm({
|
|
|
3047
3061
|
init_errors();
|
|
3048
3062
|
init_en();
|
|
3049
3063
|
makeIssue = (params) => {
|
|
3050
|
-
const { data: data3, path:
|
|
3051
|
-
const fullPath = [...
|
|
3064
|
+
const { data: data3, path: path39, errorMaps, issueData } = params;
|
|
3065
|
+
const fullPath = [...path39, ...issueData.path || []];
|
|
3052
3066
|
const fullIssue = {
|
|
3053
3067
|
...issueData,
|
|
3054
3068
|
path: fullPath
|
|
@@ -3356,11 +3370,11 @@ var init_types = __esm({
|
|
|
3356
3370
|
init_parseUtil();
|
|
3357
3371
|
init_util2();
|
|
3358
3372
|
ParseInputLazyPath = class {
|
|
3359
|
-
constructor(parent, value,
|
|
3373
|
+
constructor(parent, value, path39, key) {
|
|
3360
3374
|
this._cachedPath = [];
|
|
3361
3375
|
this.parent = parent;
|
|
3362
3376
|
this.data = value;
|
|
3363
|
-
this._path =
|
|
3377
|
+
this._path = path39;
|
|
3364
3378
|
this._key = key;
|
|
3365
3379
|
}
|
|
3366
3380
|
get path() {
|
|
@@ -7023,8 +7037,8 @@ var init_branch_name = __esm({
|
|
|
7023
7037
|
});
|
|
7024
7038
|
|
|
7025
7039
|
// ../canopycms/src/paths/normalize.ts
|
|
7026
|
-
function normalizeFilesystemPath(
|
|
7027
|
-
return
|
|
7040
|
+
function normalizeFilesystemPath(path39) {
|
|
7041
|
+
return path39.split(/[\\/]+/).filter(Boolean).join("/");
|
|
7028
7042
|
}
|
|
7029
7043
|
var init_normalize = __esm({
|
|
7030
7044
|
"../canopycms/src/paths/normalize.ts"() {
|
|
@@ -8328,15 +8342,15 @@ var require_dist_node9 = __commonJS({
|
|
|
8328
8342
|
octokit.log.debug("request", options);
|
|
8329
8343
|
const start = Date.now();
|
|
8330
8344
|
const requestOptions = octokit.request.endpoint.parse(options);
|
|
8331
|
-
const
|
|
8345
|
+
const path39 = requestOptions.url.replace(options.baseUrl, "");
|
|
8332
8346
|
return request(options).then((response) => {
|
|
8333
8347
|
octokit.log.info(
|
|
8334
|
-
`${requestOptions.method} ${
|
|
8348
|
+
`${requestOptions.method} ${path39} - ${response.status} in ${Date.now() - start}ms`
|
|
8335
8349
|
);
|
|
8336
8350
|
return response;
|
|
8337
8351
|
}).catch((error3) => {
|
|
8338
8352
|
octokit.log.info(
|
|
8339
|
-
`${requestOptions.method} ${
|
|
8353
|
+
`${requestOptions.method} ${path39} - ${error3.status} in ${Date.now() - start}ms`
|
|
8340
8354
|
);
|
|
8341
8355
|
throw error3;
|
|
8342
8356
|
});
|
|
@@ -12430,7 +12444,7 @@ var require_dist_node13 = __commonJS({
|
|
|
12430
12444
|
];
|
|
12431
12445
|
function routeMatcher(paths) {
|
|
12432
12446
|
const regexes = paths.map(
|
|
12433
|
-
(
|
|
12447
|
+
(path39) => path39.split("/").map((c11) => c11.startsWith("{") ? "(?:.+?)" : c11).join("/")
|
|
12434
12448
|
);
|
|
12435
12449
|
const regex2 = `^(?:${regexes.map((r10) => `(?:${r10})`).join("|")})[^/]*$`;
|
|
12436
12450
|
return new RegExp(regex2, "i");
|
|
@@ -13531,9 +13545,9 @@ var init_createPaginator = __esm({
|
|
|
13531
13545
|
command5 = withCommand(command5) ?? command5;
|
|
13532
13546
|
return await client.send(command5, ...args);
|
|
13533
13547
|
};
|
|
13534
|
-
get = (fromObject,
|
|
13548
|
+
get = (fromObject, path39) => {
|
|
13535
13549
|
let cursor3 = fromObject;
|
|
13536
|
-
const pathComponents =
|
|
13550
|
+
const pathComponents = path39.split(".");
|
|
13537
13551
|
for (const step of pathComponents) {
|
|
13538
13552
|
if (!cursor3 || typeof cursor3 !== "object") {
|
|
13539
13553
|
return void 0;
|
|
@@ -14551,12 +14565,12 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
14551
14565
|
const password = request.password ?? "";
|
|
14552
14566
|
auth = `${username}:${password}`;
|
|
14553
14567
|
}
|
|
14554
|
-
let
|
|
14568
|
+
let path39 = request.path;
|
|
14555
14569
|
if (queryString) {
|
|
14556
|
-
|
|
14570
|
+
path39 += `?${queryString}`;
|
|
14557
14571
|
}
|
|
14558
14572
|
if (request.fragment) {
|
|
14559
|
-
|
|
14573
|
+
path39 += `#${request.fragment}`;
|
|
14560
14574
|
}
|
|
14561
14575
|
let hostname = request.hostname ?? "";
|
|
14562
14576
|
if (hostname[0] === "[" && hostname.endsWith("]")) {
|
|
@@ -14568,7 +14582,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
14568
14582
|
headers: request.headers,
|
|
14569
14583
|
host: hostname,
|
|
14570
14584
|
method: request.method,
|
|
14571
|
-
path:
|
|
14585
|
+
path: path39,
|
|
14572
14586
|
port: request.port,
|
|
14573
14587
|
agent,
|
|
14574
14588
|
auth
|
|
@@ -14851,16 +14865,16 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
14851
14865
|
reject(err);
|
|
14852
14866
|
};
|
|
14853
14867
|
const queryString = querystringBuilder.buildQueryString(query || {});
|
|
14854
|
-
let
|
|
14868
|
+
let path39 = request.path;
|
|
14855
14869
|
if (queryString) {
|
|
14856
|
-
|
|
14870
|
+
path39 += `?${queryString}`;
|
|
14857
14871
|
}
|
|
14858
14872
|
if (request.fragment) {
|
|
14859
|
-
|
|
14873
|
+
path39 += `#${request.fragment}`;
|
|
14860
14874
|
}
|
|
14861
14875
|
const req = session.request({
|
|
14862
14876
|
...request.headers,
|
|
14863
|
-
[http2.constants.HTTP2_HEADER_PATH]:
|
|
14877
|
+
[http2.constants.HTTP2_HEADER_PATH]: path39,
|
|
14864
14878
|
[http2.constants.HTTP2_HEADER_METHOD]: method
|
|
14865
14879
|
});
|
|
14866
14880
|
session.ref();
|
|
@@ -15047,13 +15061,13 @@ var require_dist_cjs14 = __commonJS({
|
|
|
15047
15061
|
const abortError = buildAbortError(abortSignal);
|
|
15048
15062
|
return Promise.reject(abortError);
|
|
15049
15063
|
}
|
|
15050
|
-
let
|
|
15064
|
+
let path39 = request.path;
|
|
15051
15065
|
const queryString = querystringBuilder.buildQueryString(request.query || {});
|
|
15052
15066
|
if (queryString) {
|
|
15053
|
-
|
|
15067
|
+
path39 += `?${queryString}`;
|
|
15054
15068
|
}
|
|
15055
15069
|
if (request.fragment) {
|
|
15056
|
-
|
|
15070
|
+
path39 += `#${request.fragment}`;
|
|
15057
15071
|
}
|
|
15058
15072
|
let auth = "";
|
|
15059
15073
|
if (request.username != null || request.password != null) {
|
|
@@ -15062,7 +15076,7 @@ var require_dist_cjs14 = __commonJS({
|
|
|
15062
15076
|
auth = `${username}:${password}@`;
|
|
15063
15077
|
}
|
|
15064
15078
|
const { port, method } = request;
|
|
15065
|
-
const url = `${request.protocol}//${auth}${request.hostname}${port ? `:${port}` : ""}${
|
|
15079
|
+
const url = `${request.protocol}//${auth}${request.hostname}${port ? `:${port}` : ""}${path39}`;
|
|
15066
15080
|
const body = method === "GET" || method === "HEAD" ? void 0 : request.body;
|
|
15067
15081
|
const requestOptions = {
|
|
15068
15082
|
body,
|
|
@@ -17294,13 +17308,13 @@ function __disposeResources(env2) {
|
|
|
17294
17308
|
}
|
|
17295
17309
|
return next();
|
|
17296
17310
|
}
|
|
17297
|
-
function __rewriteRelativeImportExtension(
|
|
17298
|
-
if (typeof
|
|
17299
|
-
return
|
|
17311
|
+
function __rewriteRelativeImportExtension(path39, preserveJsx) {
|
|
17312
|
+
if (typeof path39 === "string" && /^\.\.?\//.test(path39)) {
|
|
17313
|
+
return path39.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m7, tsx, d9, ext, cm) {
|
|
17300
17314
|
return tsx ? preserveJsx ? ".jsx" : ".js" : d9 && (!ext || !cm) ? m7 : d9 + ext + "." + cm.toLowerCase() + "js";
|
|
17301
17315
|
});
|
|
17302
17316
|
}
|
|
17303
|
-
return
|
|
17317
|
+
return path39;
|
|
17304
17318
|
}
|
|
17305
17319
|
var extendStatics, __assign, __createBinding, __setModuleDefault, ownKeys, _SuppressedError, tslib_es6_default;
|
|
17306
17320
|
var init_tslib_es6 = __esm({
|
|
@@ -18198,11 +18212,11 @@ var init_HttpBindingProtocol = __esm({
|
|
|
18198
18212
|
const opTraits = translateTraits(operationSchema.traits);
|
|
18199
18213
|
if (opTraits.http) {
|
|
18200
18214
|
request.method = opTraits.http[0];
|
|
18201
|
-
const [
|
|
18215
|
+
const [path39, search] = opTraits.http[1].split("?");
|
|
18202
18216
|
if (request.path == "/") {
|
|
18203
|
-
request.path =
|
|
18217
|
+
request.path = path39;
|
|
18204
18218
|
} else {
|
|
18205
|
-
request.path +=
|
|
18219
|
+
request.path += path39;
|
|
18206
18220
|
}
|
|
18207
18221
|
const traitSearchParams = new URLSearchParams(search ?? "");
|
|
18208
18222
|
Object.assign(query, Object.fromEntries(traitSearchParams));
|
|
@@ -18605,8 +18619,8 @@ var init_requestBuilder = __esm({
|
|
|
18605
18619
|
return this;
|
|
18606
18620
|
}
|
|
18607
18621
|
p(memberName, labelValueProvider, uriLabel, isGreedyLabel) {
|
|
18608
|
-
this.resolvePathStack.push((
|
|
18609
|
-
this.path = resolvedPath(
|
|
18622
|
+
this.resolvePathStack.push((path39) => {
|
|
18623
|
+
this.path = resolvedPath(path39, this.input, memberName, labelValueProvider, uriLabel, isGreedyLabel);
|
|
18610
18624
|
});
|
|
18611
18625
|
return this;
|
|
18612
18626
|
}
|
|
@@ -19256,18 +19270,18 @@ var require_dist_cjs20 = __commonJS({
|
|
|
19256
19270
|
}
|
|
19257
19271
|
};
|
|
19258
19272
|
var booleanEquals2 = (value1, value2) => value1 === value2;
|
|
19259
|
-
var getAttrPathList2 = (
|
|
19260
|
-
const parts =
|
|
19273
|
+
var getAttrPathList2 = (path39) => {
|
|
19274
|
+
const parts = path39.split(".");
|
|
19261
19275
|
const pathList = [];
|
|
19262
19276
|
for (const part of parts) {
|
|
19263
19277
|
const squareBracketIndex = part.indexOf("[");
|
|
19264
19278
|
if (squareBracketIndex !== -1) {
|
|
19265
19279
|
if (part.indexOf("]") !== part.length - 1) {
|
|
19266
|
-
throw new EndpointError2(`Path: '${
|
|
19280
|
+
throw new EndpointError2(`Path: '${path39}' does not end with ']'`);
|
|
19267
19281
|
}
|
|
19268
19282
|
const arrayIndex = part.slice(squareBracketIndex + 1, -1);
|
|
19269
19283
|
if (Number.isNaN(parseInt(arrayIndex))) {
|
|
19270
|
-
throw new EndpointError2(`Invalid array index: '${arrayIndex}' in path: '${
|
|
19284
|
+
throw new EndpointError2(`Invalid array index: '${arrayIndex}' in path: '${path39}'`);
|
|
19271
19285
|
}
|
|
19272
19286
|
if (squareBracketIndex !== 0) {
|
|
19273
19287
|
pathList.push(part.slice(0, squareBracketIndex));
|
|
@@ -19279,9 +19293,9 @@ var require_dist_cjs20 = __commonJS({
|
|
|
19279
19293
|
}
|
|
19280
19294
|
return pathList;
|
|
19281
19295
|
};
|
|
19282
|
-
var getAttr2 = (value,
|
|
19296
|
+
var getAttr2 = (value, path39) => getAttrPathList2(path39).reduce((acc, index) => {
|
|
19283
19297
|
if (typeof acc !== "object") {
|
|
19284
|
-
throw new EndpointError2(`Index '${index}' in '${
|
|
19298
|
+
throw new EndpointError2(`Index '${index}' in '${path39}' not found in '${JSON.stringify(value)}'`);
|
|
19285
19299
|
} else if (Array.isArray(acc)) {
|
|
19286
19300
|
return acc[parseInt(index)];
|
|
19287
19301
|
}
|
|
@@ -19300,8 +19314,8 @@ var require_dist_cjs20 = __commonJS({
|
|
|
19300
19314
|
return value;
|
|
19301
19315
|
}
|
|
19302
19316
|
if (typeof value === "object" && "hostname" in value) {
|
|
19303
|
-
const { hostname: hostname2, port, protocol: protocol2 = "", path:
|
|
19304
|
-
const url = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${
|
|
19317
|
+
const { hostname: hostname2, port, protocol: protocol2 = "", path: path39 = "", query = {} } = value;
|
|
19318
|
+
const url = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${path39}`);
|
|
19305
19319
|
url.search = Object.entries(query).map(([k10, v5]) => `${k10}=${v5}`).join("&");
|
|
19306
19320
|
return url;
|
|
19307
19321
|
}
|
|
@@ -20746,10 +20760,10 @@ ${longDate}
|
|
|
20746
20760
|
${credentialScope}
|
|
20747
20761
|
${utilHexEncoding.toHex(hashedRequest)}`;
|
|
20748
20762
|
}
|
|
20749
|
-
getCanonicalPath({ path:
|
|
20763
|
+
getCanonicalPath({ path: path39 }) {
|
|
20750
20764
|
if (this.uriEscapePath) {
|
|
20751
20765
|
const normalizedPathSegments = [];
|
|
20752
|
-
for (const pathSegment of
|
|
20766
|
+
for (const pathSegment of path39.split("/")) {
|
|
20753
20767
|
if (pathSegment?.length === 0)
|
|
20754
20768
|
continue;
|
|
20755
20769
|
if (pathSegment === ".")
|
|
@@ -20760,11 +20774,11 @@ ${utilHexEncoding.toHex(hashedRequest)}`;
|
|
|
20760
20774
|
normalizedPathSegments.push(pathSegment);
|
|
20761
20775
|
}
|
|
20762
20776
|
}
|
|
20763
|
-
const normalizedPath = `${
|
|
20777
|
+
const normalizedPath = `${path39?.startsWith("/") ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && path39?.endsWith("/") ? "/" : ""}`;
|
|
20764
20778
|
const doubleEncoded = utilUriEscape.escapeUri(normalizedPath);
|
|
20765
20779
|
return doubleEncoded.replace(/%2F/g, "/");
|
|
20766
20780
|
}
|
|
20767
|
-
return
|
|
20781
|
+
return path39;
|
|
20768
20782
|
}
|
|
20769
20783
|
validateResolvedCredentials(credentials) {
|
|
20770
20784
|
if (typeof credentials !== "object" || typeof credentials.accessKeyId !== "string" || typeof credentials.secretAccessKey !== "string") {
|
|
@@ -22068,11 +22082,11 @@ var init_SmithyRpcV2CborProtocol = __esm({
|
|
|
22068
22082
|
}
|
|
22069
22083
|
}
|
|
22070
22084
|
const { service, operation: operation3 } = (0, import_util_middleware5.getSmithyContext)(context);
|
|
22071
|
-
const
|
|
22085
|
+
const path39 = `/service/${service}/operation/${operation3}`;
|
|
22072
22086
|
if (request.path.endsWith("/")) {
|
|
22073
|
-
request.path +=
|
|
22087
|
+
request.path += path39.slice(1);
|
|
22074
22088
|
} else {
|
|
22075
|
-
request.path +=
|
|
22089
|
+
request.path += path39;
|
|
22076
22090
|
}
|
|
22077
22091
|
return request;
|
|
22078
22092
|
}
|
|
@@ -27717,14 +27731,14 @@ var require_readFile = __commonJS({
|
|
|
27717
27731
|
var promises_1 = __require("node:fs/promises");
|
|
27718
27732
|
exports.filePromises = {};
|
|
27719
27733
|
exports.fileIntercept = {};
|
|
27720
|
-
var readFile3 = (
|
|
27721
|
-
if (exports.fileIntercept[
|
|
27722
|
-
return exports.fileIntercept[
|
|
27734
|
+
var readFile3 = (path39, options) => {
|
|
27735
|
+
if (exports.fileIntercept[path39] !== void 0) {
|
|
27736
|
+
return exports.fileIntercept[path39];
|
|
27723
27737
|
}
|
|
27724
|
-
if (!exports.filePromises[
|
|
27725
|
-
exports.filePromises[
|
|
27738
|
+
if (!exports.filePromises[path39] || options?.ignoreCache) {
|
|
27739
|
+
exports.filePromises[path39] = (0, promises_1.readFile)(path39, "utf8");
|
|
27726
27740
|
}
|
|
27727
|
-
return exports.filePromises[
|
|
27741
|
+
return exports.filePromises[path39];
|
|
27728
27742
|
};
|
|
27729
27743
|
exports.readFile = readFile3;
|
|
27730
27744
|
}
|
|
@@ -27737,7 +27751,7 @@ var require_dist_cjs33 = __commonJS({
|
|
|
27737
27751
|
var getHomeDir2 = require_getHomeDir();
|
|
27738
27752
|
var getSSOTokenFilepath2 = require_getSSOTokenFilepath();
|
|
27739
27753
|
var getSSOTokenFromFile2 = require_getSSOTokenFromFile();
|
|
27740
|
-
var
|
|
27754
|
+
var path39 = __require("path");
|
|
27741
27755
|
var types = require_dist_cjs();
|
|
27742
27756
|
var readFile3 = require_readFile();
|
|
27743
27757
|
var ENV_PROFILE2 = "AWS_PROFILE";
|
|
@@ -27759,9 +27773,9 @@ var require_dist_cjs33 = __commonJS({
|
|
|
27759
27773
|
...data3.default && { default: data3.default }
|
|
27760
27774
|
});
|
|
27761
27775
|
var ENV_CONFIG_PATH2 = "AWS_CONFIG_FILE";
|
|
27762
|
-
var getConfigFilepath2 = () => process.env[ENV_CONFIG_PATH2] ||
|
|
27776
|
+
var getConfigFilepath2 = () => process.env[ENV_CONFIG_PATH2] || path39.join(getHomeDir2.getHomeDir(), ".aws", "config");
|
|
27763
27777
|
var ENV_CREDENTIALS_PATH2 = "AWS_SHARED_CREDENTIALS_FILE";
|
|
27764
|
-
var getCredentialsFilepath2 = () => process.env[ENV_CREDENTIALS_PATH2] ||
|
|
27778
|
+
var getCredentialsFilepath2 = () => process.env[ENV_CREDENTIALS_PATH2] || path39.join(getHomeDir2.getHomeDir(), ".aws", "credentials");
|
|
27765
27779
|
var prefixKeyRegex2 = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/;
|
|
27766
27780
|
var profileNameBlockList2 = ["__proto__", "profile __proto__"];
|
|
27767
27781
|
var parseIni2 = (iniData) => {
|
|
@@ -27816,11 +27830,11 @@ var require_dist_cjs33 = __commonJS({
|
|
|
27816
27830
|
const relativeHomeDirPrefix = "~/";
|
|
27817
27831
|
let resolvedFilepath = filepath;
|
|
27818
27832
|
if (filepath.startsWith(relativeHomeDirPrefix)) {
|
|
27819
|
-
resolvedFilepath =
|
|
27833
|
+
resolvedFilepath = path39.join(homeDir, filepath.slice(2));
|
|
27820
27834
|
}
|
|
27821
27835
|
let resolvedConfigFilepath = configFilepath;
|
|
27822
27836
|
if (configFilepath.startsWith(relativeHomeDirPrefix)) {
|
|
27823
|
-
resolvedConfigFilepath =
|
|
27837
|
+
resolvedConfigFilepath = path39.join(homeDir, configFilepath.slice(2));
|
|
27824
27838
|
}
|
|
27825
27839
|
const parsedFiles = await Promise.all([
|
|
27826
27840
|
readFile3.readFile(resolvedConfigFilepath, {
|
|
@@ -27859,8 +27873,8 @@ var require_dist_cjs33 = __commonJS({
|
|
|
27859
27873
|
getFileRecord() {
|
|
27860
27874
|
return readFile3.fileIntercept;
|
|
27861
27875
|
},
|
|
27862
|
-
interceptFile(
|
|
27863
|
-
readFile3.fileIntercept[
|
|
27876
|
+
interceptFile(path40, contents) {
|
|
27877
|
+
readFile3.fileIntercept[path40] = Promise.resolve(contents);
|
|
27864
27878
|
},
|
|
27865
27879
|
getTokenRecord() {
|
|
27866
27880
|
return getSSOTokenFromFile2.tokenIntercept;
|
|
@@ -28185,8 +28199,8 @@ var require_dist_cjs36 = __commonJS({
|
|
|
28185
28199
|
return endpoint.url.href;
|
|
28186
28200
|
}
|
|
28187
28201
|
if ("hostname" in endpoint) {
|
|
28188
|
-
const { protocol, hostname, port, path:
|
|
28189
|
-
return `${protocol}//${hostname}${port ? ":" + port : ""}${
|
|
28202
|
+
const { protocol, hostname, port, path: path39 } = endpoint;
|
|
28203
|
+
return `${protocol}//${hostname}${port ? ":" + port : ""}${path39}`;
|
|
28190
28204
|
}
|
|
28191
28205
|
}
|
|
28192
28206
|
return endpoint;
|
|
@@ -38220,14 +38234,14 @@ var init_readFile = __esm({
|
|
|
38220
38234
|
"../../node_modules/.pnpm/@smithy+core@3.29.7/node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/readFile.js"() {
|
|
38221
38235
|
filePromises = {};
|
|
38222
38236
|
fileIntercept = {};
|
|
38223
|
-
readFile2 = (
|
|
38224
|
-
if (fileIntercept[
|
|
38225
|
-
return fileIntercept[
|
|
38237
|
+
readFile2 = (path39, options) => {
|
|
38238
|
+
if (fileIntercept[path39] !== void 0) {
|
|
38239
|
+
return fileIntercept[path39];
|
|
38226
38240
|
}
|
|
38227
|
-
if (!filePromises[
|
|
38228
|
-
filePromises[
|
|
38241
|
+
if (!filePromises[path39] || options?.ignoreCache) {
|
|
38242
|
+
filePromises[path39] = fsReadFile(path39, "utf8");
|
|
38229
38243
|
}
|
|
38230
|
-
return filePromises[
|
|
38244
|
+
return filePromises[path39];
|
|
38231
38245
|
};
|
|
38232
38246
|
}
|
|
38233
38247
|
});
|
|
@@ -38339,8 +38353,8 @@ var init_externalDataInterceptor = __esm({
|
|
|
38339
38353
|
getFileRecord() {
|
|
38340
38354
|
return fileIntercept;
|
|
38341
38355
|
},
|
|
38342
|
-
interceptFile(
|
|
38343
|
-
fileIntercept[
|
|
38356
|
+
interceptFile(path39, contents) {
|
|
38357
|
+
fileIntercept[path39] = Promise.resolve(contents);
|
|
38344
38358
|
},
|
|
38345
38359
|
getTokenRecord() {
|
|
38346
38360
|
return tokenIntercept;
|
|
@@ -41274,8 +41288,8 @@ var init_createConfigValueProvider = __esm({
|
|
|
41274
41288
|
return endpoint.url.href;
|
|
41275
41289
|
}
|
|
41276
41290
|
if ("hostname" in endpoint) {
|
|
41277
|
-
const { protocol, hostname, port, path:
|
|
41278
|
-
return `${protocol}//${hostname}${port ? ":" + port : ""}${
|
|
41291
|
+
const { protocol, hostname, port, path: path39 } = endpoint;
|
|
41292
|
+
return `${protocol}//${hostname}${port ? ":" + port : ""}${path39}`;
|
|
41279
41293
|
}
|
|
41280
41294
|
}
|
|
41281
41295
|
return endpoint;
|
|
@@ -41650,18 +41664,18 @@ var getAttrPathList;
|
|
|
41650
41664
|
var init_getAttrPathList = __esm({
|
|
41651
41665
|
"../../node_modules/.pnpm/@smithy+core@3.29.7/node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/getAttrPathList.js"() {
|
|
41652
41666
|
init_types4();
|
|
41653
|
-
getAttrPathList = (
|
|
41654
|
-
const parts =
|
|
41667
|
+
getAttrPathList = (path39) => {
|
|
41668
|
+
const parts = path39.split(".");
|
|
41655
41669
|
const pathList = [];
|
|
41656
41670
|
for (const part of parts) {
|
|
41657
41671
|
const squareBracketIndex = part.indexOf("[");
|
|
41658
41672
|
if (squareBracketIndex !== -1) {
|
|
41659
41673
|
if (part.indexOf("]") !== part.length - 1) {
|
|
41660
|
-
throw new EndpointError(`Path: '${
|
|
41674
|
+
throw new EndpointError(`Path: '${path39}' does not end with ']'`);
|
|
41661
41675
|
}
|
|
41662
41676
|
const arrayIndex = part.slice(squareBracketIndex + 1, -1);
|
|
41663
41677
|
if (Number.isNaN(parseInt(arrayIndex))) {
|
|
41664
|
-
throw new EndpointError(`Invalid array index: '${arrayIndex}' in path: '${
|
|
41678
|
+
throw new EndpointError(`Invalid array index: '${arrayIndex}' in path: '${path39}'`);
|
|
41665
41679
|
}
|
|
41666
41680
|
if (squareBracketIndex !== 0) {
|
|
41667
41681
|
pathList.push(part.slice(0, squareBracketIndex));
|
|
@@ -41682,9 +41696,9 @@ var init_getAttr = __esm({
|
|
|
41682
41696
|
"../../node_modules/.pnpm/@smithy+core@3.29.7/node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/getAttr.js"() {
|
|
41683
41697
|
init_types4();
|
|
41684
41698
|
init_getAttrPathList();
|
|
41685
|
-
getAttr = (value,
|
|
41699
|
+
getAttr = (value, path39) => getAttrPathList(path39).reduce((acc, index) => {
|
|
41686
41700
|
if (typeof acc !== "object") {
|
|
41687
|
-
throw new EndpointError(`Index '${index}' in '${
|
|
41701
|
+
throw new EndpointError(`Index '${index}' in '${path39}' not found in '${JSON.stringify(value)}'`);
|
|
41688
41702
|
} else if (Array.isArray(acc)) {
|
|
41689
41703
|
const i10 = parseInt(index);
|
|
41690
41704
|
return acc[i10 < 0 ? acc.length + i10 : i10];
|
|
@@ -41745,8 +41759,8 @@ var init_parseURL = __esm({
|
|
|
41745
41759
|
return value;
|
|
41746
41760
|
}
|
|
41747
41761
|
if (typeof value === "object" && "hostname" in value) {
|
|
41748
|
-
const { hostname: hostname2, port, protocol: protocol2 = "", path:
|
|
41749
|
-
const url = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${
|
|
41762
|
+
const { hostname: hostname2, port, protocol: protocol2 = "", path: path39 = "", query = {} } = value;
|
|
41763
|
+
const url = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${path39}`);
|
|
41750
41764
|
url.search = Object.entries(query).map(([k10, v5]) => `${k10}=${v5}`).join("&");
|
|
41751
41765
|
return url;
|
|
41752
41766
|
}
|
|
@@ -44983,11 +44997,11 @@ var init_HttpBindingProtocol2 = __esm({
|
|
|
44983
44997
|
const opTraits = translateTraits2(operationSchema.traits);
|
|
44984
44998
|
if (opTraits.http) {
|
|
44985
44999
|
request.method = opTraits.http[0];
|
|
44986
|
-
const [
|
|
45000
|
+
const [path39, search] = opTraits.http[1].split("?");
|
|
44987
45001
|
if (request.path == "/") {
|
|
44988
|
-
request.path =
|
|
45002
|
+
request.path = path39;
|
|
44989
45003
|
} else {
|
|
44990
|
-
request.path +=
|
|
45004
|
+
request.path += path39;
|
|
44991
45005
|
}
|
|
44992
45006
|
const traitSearchParams = new URLSearchParams(search ?? "");
|
|
44993
45007
|
for (const [key, value] of traitSearchParams) {
|
|
@@ -45388,8 +45402,8 @@ var init_requestBuilder3 = __esm({
|
|
|
45388
45402
|
return this;
|
|
45389
45403
|
}
|
|
45390
45404
|
p(memberName, labelValueProvider, uriLabel, isGreedyLabel) {
|
|
45391
|
-
this.resolvePathStack.push((
|
|
45392
|
-
this.path = resolvedPath2(
|
|
45405
|
+
this.resolvePathStack.push((path39) => {
|
|
45406
|
+
this.path = resolvedPath2(path39, this.input, memberName, labelValueProvider, uriLabel, isGreedyLabel);
|
|
45393
45407
|
});
|
|
45394
45408
|
return this;
|
|
45395
45409
|
}
|
|
@@ -46028,9 +46042,9 @@ var init_createPaginator2 = __esm({
|
|
|
46028
46042
|
command5 = withCommand(command5) ?? command5;
|
|
46029
46043
|
return await client.send(command5, ...args);
|
|
46030
46044
|
};
|
|
46031
|
-
get2 = (fromObject,
|
|
46045
|
+
get2 = (fromObject, path39) => {
|
|
46032
46046
|
let cursor3 = fromObject;
|
|
46033
|
-
const pathComponents =
|
|
46047
|
+
const pathComponents = path39.split(".");
|
|
46034
46048
|
for (const step of pathComponents) {
|
|
46035
46049
|
if (!cursor3 || typeof cursor3 !== "object") {
|
|
46036
46050
|
return void 0;
|
|
@@ -49601,10 +49615,10 @@ ${longDate}
|
|
|
49601
49615
|
${credentialScope}
|
|
49602
49616
|
${toHex2(hashedRequest)}`;
|
|
49603
49617
|
}
|
|
49604
|
-
getCanonicalPath({ path:
|
|
49618
|
+
getCanonicalPath({ path: path39 }) {
|
|
49605
49619
|
if (this.uriEscapePath) {
|
|
49606
49620
|
const normalizedPathSegments = [];
|
|
49607
|
-
for (const pathSegment of
|
|
49621
|
+
for (const pathSegment of path39.split("/")) {
|
|
49608
49622
|
if (pathSegment?.length === 0)
|
|
49609
49623
|
continue;
|
|
49610
49624
|
if (pathSegment === ".")
|
|
@@ -49615,11 +49629,11 @@ ${toHex2(hashedRequest)}`;
|
|
|
49615
49629
|
normalizedPathSegments.push(pathSegment);
|
|
49616
49630
|
}
|
|
49617
49631
|
}
|
|
49618
|
-
const normalizedPath = `${
|
|
49632
|
+
const normalizedPath = `${path39?.startsWith("/") ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && path39?.endsWith("/") ? "/" : ""}`;
|
|
49619
49633
|
const doubleEncoded = escapeUri2(normalizedPath);
|
|
49620
49634
|
return doubleEncoded.replace(/%2F/g, "/");
|
|
49621
49635
|
}
|
|
49622
|
-
return
|
|
49636
|
+
return path39;
|
|
49623
49637
|
}
|
|
49624
49638
|
validateResolvedCredentials(credentials) {
|
|
49625
49639
|
if (typeof credentials !== "object" || typeof credentials.accessKeyId !== "string" || typeof credentials.secretAccessKey !== "string") {
|
|
@@ -51188,11 +51202,11 @@ var init_SmithyRpcV2CborProtocol2 = __esm({
|
|
|
51188
51202
|
}
|
|
51189
51203
|
}
|
|
51190
51204
|
const { service, operation: operation3 } = getSmithyContext11(context);
|
|
51191
|
-
const
|
|
51205
|
+
const path39 = `/service/${service}/operation/${operation3}`;
|
|
51192
51206
|
if (request.path.endsWith("/")) {
|
|
51193
|
-
request.path +=
|
|
51207
|
+
request.path += path39.slice(1);
|
|
51194
51208
|
} else {
|
|
51195
|
-
request.path +=
|
|
51209
|
+
request.path += path39;
|
|
51196
51210
|
}
|
|
51197
51211
|
return request;
|
|
51198
51212
|
}
|
|
@@ -54596,12 +54610,12 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
54596
54610
|
const password = request.password ?? "";
|
|
54597
54611
|
auth = `${username}:${password}`;
|
|
54598
54612
|
}
|
|
54599
|
-
let
|
|
54613
|
+
let path39 = request.path;
|
|
54600
54614
|
if (queryString) {
|
|
54601
|
-
|
|
54615
|
+
path39 += `?${queryString}`;
|
|
54602
54616
|
}
|
|
54603
54617
|
if (request.fragment) {
|
|
54604
|
-
|
|
54618
|
+
path39 += `#${request.fragment}`;
|
|
54605
54619
|
}
|
|
54606
54620
|
let hostname = request.hostname ?? "";
|
|
54607
54621
|
if (hostname[0] === "[" && hostname.endsWith("]")) {
|
|
@@ -54613,7 +54627,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
54613
54627
|
headers: request.headers,
|
|
54614
54628
|
host: hostname,
|
|
54615
54629
|
method: request.method,
|
|
54616
|
-
path:
|
|
54630
|
+
path: path39,
|
|
54617
54631
|
port: request.port,
|
|
54618
54632
|
agent,
|
|
54619
54633
|
auth
|
|
@@ -55016,16 +55030,16 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
55016
55030
|
reject(err);
|
|
55017
55031
|
};
|
|
55018
55032
|
const queryString = query ? buildQueryString2(query) : "";
|
|
55019
|
-
let
|
|
55033
|
+
let path39 = request.path;
|
|
55020
55034
|
if (queryString) {
|
|
55021
|
-
|
|
55035
|
+
path39 += `?${queryString}`;
|
|
55022
55036
|
}
|
|
55023
55037
|
if (request.fragment) {
|
|
55024
|
-
|
|
55038
|
+
path39 += `#${request.fragment}`;
|
|
55025
55039
|
}
|
|
55026
55040
|
const clientHttp2Stream = session.request({
|
|
55027
55041
|
...request.headers,
|
|
55028
|
-
[constants2.HTTP2_HEADER_PATH]:
|
|
55042
|
+
[constants2.HTTP2_HEADER_PATH]: path39,
|
|
55029
55043
|
[constants2.HTTP2_HEADER_METHOD]: method
|
|
55030
55044
|
});
|
|
55031
55045
|
if (effectiveRequestTimeout) {
|
|
@@ -55107,7 +55121,7 @@ var require_dist_cjs60 = __commonJS({
|
|
|
55107
55121
|
var { setCredentialFeature: setCredentialFeature3 } = (init_client4(), __toCommonJS(client_exports3));
|
|
55108
55122
|
var { CredentialsProviderError: CredentialsProviderError2 } = (init_config3(), __toCommonJS(config_exports));
|
|
55109
55123
|
var { NodeHttpHandler } = require_dist_cjs59();
|
|
55110
|
-
var
|
|
55124
|
+
var fs37 = __require("node:fs/promises");
|
|
55111
55125
|
var { HttpRequest: HttpRequest11 } = (init_protocols3(), __toCommonJS(protocols_exports3));
|
|
55112
55126
|
var { sdkStreamMixin: sdkStreamMixin4, parseRfc3339DateTime: parseRfc3339DateTime3 } = (init_serde2(), __toCommonJS(serde_exports2));
|
|
55113
55127
|
var ECS_CONTAINER_HOST = "169.254.170.2";
|
|
@@ -55231,7 +55245,7 @@ Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
|
|
|
55231
55245
|
const provider = retryWrapper(async () => {
|
|
55232
55246
|
const request = createGetRequest(url);
|
|
55233
55247
|
if (tokenFile) {
|
|
55234
|
-
request.headers.Authorization = validateToken((await
|
|
55248
|
+
request.headers.Authorization = validateToken((await fs37.readFile(tokenFile)).toString());
|
|
55235
55249
|
} else if (token) {
|
|
55236
55250
|
request.headers.Authorization = validateToken(token);
|
|
55237
55251
|
}
|
|
@@ -73313,9 +73327,9 @@ var require_dist_node20 = __commonJS({
|
|
|
73313
73327
|
// ../canopycms/src/worker/cms-worker.ts
|
|
73314
73328
|
var import_proper_lockfile3 = __toESM(require_proper_lockfile(), 1);
|
|
73315
73329
|
import { createHash as createHash2 } from "node:crypto";
|
|
73316
|
-
import
|
|
73330
|
+
import fs35 from "node:fs/promises";
|
|
73317
73331
|
import os from "node:os";
|
|
73318
|
-
import
|
|
73332
|
+
import path36 from "node:path";
|
|
73319
73333
|
|
|
73320
73334
|
// ../canopycms/src/utils/debug.ts
|
|
73321
73335
|
var envFlag = (name2) => typeof process !== "undefined" && process.env[name2] === "true";
|
|
@@ -74500,8 +74514,8 @@ function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
|
|
|
74500
74514
|
function forEachLineWithContent(input, callback) {
|
|
74501
74515
|
return toLinesWithContent(input, true).map((line) => callback(line));
|
|
74502
74516
|
}
|
|
74503
|
-
function folderExists(
|
|
74504
|
-
return (0, import_file_exists.exists)(
|
|
74517
|
+
function folderExists(path39) {
|
|
74518
|
+
return (0, import_file_exists.exists)(path39, import_file_exists.FOLDER);
|
|
74505
74519
|
}
|
|
74506
74520
|
function append(target, item) {
|
|
74507
74521
|
if (Array.isArray(target)) {
|
|
@@ -74903,8 +74917,8 @@ function checkIsRepoRootTask() {
|
|
|
74903
74917
|
commands: commands9,
|
|
74904
74918
|
format: "utf-8",
|
|
74905
74919
|
onError,
|
|
74906
|
-
parser(
|
|
74907
|
-
return /^\.(git)?$/.test(
|
|
74920
|
+
parser(path39) {
|
|
74921
|
+
return /^\.(git)?$/.test(path39.trim());
|
|
74908
74922
|
}
|
|
74909
74923
|
};
|
|
74910
74924
|
}
|
|
@@ -75338,11 +75352,11 @@ function parseGrep(grep) {
|
|
|
75338
75352
|
const paths = /* @__PURE__ */ new Set();
|
|
75339
75353
|
const results = {};
|
|
75340
75354
|
forEachLineWithContent(grep, (input) => {
|
|
75341
|
-
const [
|
|
75342
|
-
paths.add(
|
|
75343
|
-
(results[
|
|
75355
|
+
const [path39, line, preview] = input.split(NULL);
|
|
75356
|
+
paths.add(path39);
|
|
75357
|
+
(results[path39] = results[path39] || []).push({
|
|
75344
75358
|
line: asNumber(line),
|
|
75345
|
-
path:
|
|
75359
|
+
path: path39,
|
|
75346
75360
|
preview
|
|
75347
75361
|
});
|
|
75348
75362
|
});
|
|
@@ -76106,14 +76120,14 @@ var init_hash_object = __esm2({
|
|
|
76106
76120
|
init_task();
|
|
76107
76121
|
}
|
|
76108
76122
|
});
|
|
76109
|
-
function parseInit(bare,
|
|
76123
|
+
function parseInit(bare, path39, text) {
|
|
76110
76124
|
const response = String(text).trim();
|
|
76111
76125
|
let result;
|
|
76112
76126
|
if (result = initResponseRegex.exec(response)) {
|
|
76113
|
-
return new InitSummary(bare,
|
|
76127
|
+
return new InitSummary(bare, path39, false, result[1]);
|
|
76114
76128
|
}
|
|
76115
76129
|
if (result = reInitResponseRegex.exec(response)) {
|
|
76116
|
-
return new InitSummary(bare,
|
|
76130
|
+
return new InitSummary(bare, path39, true, result[1]);
|
|
76117
76131
|
}
|
|
76118
76132
|
let gitDir = "";
|
|
76119
76133
|
const tokens = response.split(" ");
|
|
@@ -76124,7 +76138,7 @@ function parseInit(bare, path37, text) {
|
|
|
76124
76138
|
break;
|
|
76125
76139
|
}
|
|
76126
76140
|
}
|
|
76127
|
-
return new InitSummary(bare,
|
|
76141
|
+
return new InitSummary(bare, path39, /^re/i.test(response), gitDir);
|
|
76128
76142
|
}
|
|
76129
76143
|
var InitSummary;
|
|
76130
76144
|
var initResponseRegex;
|
|
@@ -76133,9 +76147,9 @@ var init_InitSummary = __esm2({
|
|
|
76133
76147
|
"src/lib/responses/InitSummary.ts"() {
|
|
76134
76148
|
"use strict";
|
|
76135
76149
|
InitSummary = class {
|
|
76136
|
-
constructor(bare,
|
|
76150
|
+
constructor(bare, path39, existing, gitDir) {
|
|
76137
76151
|
this.bare = bare;
|
|
76138
|
-
this.path =
|
|
76152
|
+
this.path = path39;
|
|
76139
76153
|
this.existing = existing;
|
|
76140
76154
|
this.gitDir = gitDir;
|
|
76141
76155
|
}
|
|
@@ -76147,7 +76161,7 @@ var init_InitSummary = __esm2({
|
|
|
76147
76161
|
function hasBareCommand(command5) {
|
|
76148
76162
|
return command5.includes(bareCommand);
|
|
76149
76163
|
}
|
|
76150
|
-
function initTask(bare = false,
|
|
76164
|
+
function initTask(bare = false, path39, customArgs) {
|
|
76151
76165
|
const commands9 = ["init", ...customArgs];
|
|
76152
76166
|
if (bare && !hasBareCommand(commands9)) {
|
|
76153
76167
|
commands9.splice(1, 0, bareCommand);
|
|
@@ -76156,7 +76170,7 @@ function initTask(bare = false, path37, customArgs) {
|
|
|
76156
76170
|
commands: commands9,
|
|
76157
76171
|
format: "utf-8",
|
|
76158
76172
|
parser(text) {
|
|
76159
|
-
return parseInit(commands9.includes("--bare"),
|
|
76173
|
+
return parseInit(commands9.includes("--bare"), path39, text);
|
|
76160
76174
|
}
|
|
76161
76175
|
};
|
|
76162
76176
|
}
|
|
@@ -76971,12 +76985,12 @@ var init_FileStatusSummary = __esm2({
|
|
|
76971
76985
|
"use strict";
|
|
76972
76986
|
fromPathRegex = /^(.+)\0(.+)$/;
|
|
76973
76987
|
FileStatusSummary = class {
|
|
76974
|
-
constructor(
|
|
76975
|
-
this.path =
|
|
76988
|
+
constructor(path39, index, working_dir) {
|
|
76989
|
+
this.path = path39;
|
|
76976
76990
|
this.index = index;
|
|
76977
76991
|
this.working_dir = working_dir;
|
|
76978
76992
|
if (index === "R" || working_dir === "R") {
|
|
76979
|
-
const detail = fromPathRegex.exec(
|
|
76993
|
+
const detail = fromPathRegex.exec(path39) || [null, path39, path39];
|
|
76980
76994
|
this.from = detail[2] || "";
|
|
76981
76995
|
this.path = detail[1] || "";
|
|
76982
76996
|
}
|
|
@@ -77007,14 +77021,14 @@ function splitLine(result, lineStr) {
|
|
|
77007
77021
|
default:
|
|
77008
77022
|
return;
|
|
77009
77023
|
}
|
|
77010
|
-
function data3(index, workingDir,
|
|
77024
|
+
function data3(index, workingDir, path39) {
|
|
77011
77025
|
const raw = `${index}${workingDir}`;
|
|
77012
77026
|
const handler = parsers6.get(raw);
|
|
77013
77027
|
if (handler) {
|
|
77014
|
-
handler(result,
|
|
77028
|
+
handler(result, path39);
|
|
77015
77029
|
}
|
|
77016
77030
|
if (raw !== "##" && raw !== "!!") {
|
|
77017
|
-
result.files.push(new FileStatusSummary(
|
|
77031
|
+
result.files.push(new FileStatusSummary(path39, index, workingDir));
|
|
77018
77032
|
}
|
|
77019
77033
|
}
|
|
77020
77034
|
}
|
|
@@ -77365,9 +77379,9 @@ var init_simple_git_api = __esm2({
|
|
|
77365
77379
|
next
|
|
77366
77380
|
);
|
|
77367
77381
|
}
|
|
77368
|
-
hashObject(
|
|
77382
|
+
hashObject(path39, write) {
|
|
77369
77383
|
return this._runTask(
|
|
77370
|
-
hashObjectTask(
|
|
77384
|
+
hashObjectTask(path39, write === true),
|
|
77371
77385
|
trailingFunctionArgument(arguments)
|
|
77372
77386
|
);
|
|
77373
77387
|
}
|
|
@@ -77721,8 +77735,8 @@ var init_branch = __esm2({
|
|
|
77721
77735
|
}
|
|
77722
77736
|
});
|
|
77723
77737
|
function toPath(input) {
|
|
77724
|
-
const
|
|
77725
|
-
return
|
|
77738
|
+
const path39 = input.trim().replace(/^["']|["']$/g, "");
|
|
77739
|
+
return path39 && normalize(path39);
|
|
77726
77740
|
}
|
|
77727
77741
|
var parseCheckIgnore;
|
|
77728
77742
|
var init_CheckIgnore = __esm2({
|
|
@@ -78007,8 +78021,8 @@ __export2(sub_module_exports, {
|
|
|
78007
78021
|
subModuleTask: () => subModuleTask,
|
|
78008
78022
|
updateSubModuleTask: () => updateSubModuleTask
|
|
78009
78023
|
});
|
|
78010
|
-
function addSubModuleTask(repo,
|
|
78011
|
-
return subModuleTask(["add", repo,
|
|
78024
|
+
function addSubModuleTask(repo, path39) {
|
|
78025
|
+
return subModuleTask(["add", repo, path39]);
|
|
78012
78026
|
}
|
|
78013
78027
|
function initSubModuleTask(customArgs) {
|
|
78014
78028
|
return subModuleTask(["init", ...customArgs]);
|
|
@@ -78322,8 +78336,8 @@ var require_git = __commonJS2({
|
|
|
78322
78336
|
}
|
|
78323
78337
|
return this._runTask(straightThroughStringTask2(command5, this._trimmed), next);
|
|
78324
78338
|
};
|
|
78325
|
-
Git2.prototype.submoduleAdd = function(repo,
|
|
78326
|
-
return this._runTask(addSubModuleTask2(repo,
|
|
78339
|
+
Git2.prototype.submoduleAdd = function(repo, path39, then) {
|
|
78340
|
+
return this._runTask(addSubModuleTask2(repo, path39), trailingFunctionArgument2(arguments));
|
|
78327
78341
|
};
|
|
78328
78342
|
Git2.prototype.submoduleUpdate = function(args, then) {
|
|
78329
78343
|
return this._runTask(
|
|
@@ -83163,7 +83177,7 @@ init_error();
|
|
|
83163
83177
|
init_worker_status();
|
|
83164
83178
|
|
|
83165
83179
|
// ../canopycms/src/version.ts
|
|
83166
|
-
var CANOPYCMS_VERSION = "0.
|
|
83180
|
+
var CANOPYCMS_VERSION = "0.10.0";
|
|
83167
83181
|
|
|
83168
83182
|
// ../canopycms/src/worker/schema-gate.ts
|
|
83169
83183
|
import fs14 from "node:fs/promises";
|
|
@@ -83487,6 +83501,7 @@ var branchMetadataShape = {
|
|
|
83487
83501
|
merged: "merged"
|
|
83488
83502
|
}).optional(),
|
|
83489
83503
|
mergedAt: external_exports.string().optional(),
|
|
83504
|
+
archivedAt: external_exports.string().optional(),
|
|
83490
83505
|
rebaseFailure: external_exports.object({ message: external_exports.string(), firstAt: external_exports.string(), lastAt: external_exports.string() }).optional(),
|
|
83491
83506
|
historyRewrittenFrom: external_exports.string().optional(),
|
|
83492
83507
|
lastGitHubTip: external_exports.string().optional(),
|
|
@@ -84144,11 +84159,13 @@ function mergeBranchMetadata(existing, version, incoming, now = (/* @__PURE__ */
|
|
|
84144
84159
|
}
|
|
84145
84160
|
var awaitsSubmitRetry = ({ submitUnfinished, status }) => submitUnfinished === true && (status === "submitted" || status === "approved");
|
|
84146
84161
|
var owesSubmit = (branch) => awaitsSubmitRetry(branch) || branch.syncStatus === "pending-sync" && (branch.status === "submitted" || branch.status === "approved");
|
|
84147
|
-
function buildMergedBranchUpdate(branch,
|
|
84162
|
+
function buildMergedBranchUpdate(branch, mergedAt = /* @__PURE__ */ new Date()) {
|
|
84148
84163
|
return {
|
|
84149
84164
|
status: "archived",
|
|
84150
84165
|
pullRequestState: "merged",
|
|
84151
|
-
mergedAt:
|
|
84166
|
+
mergedAt: mergedAt.toISOString(),
|
|
84167
|
+
// Now, not the merge: retention's clock must not start before a worker outage that hid it.
|
|
84168
|
+
archivedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
84152
84169
|
// The merge settled every conflict the record named.
|
|
84153
84170
|
conflictStatus: "clean",
|
|
84154
84171
|
conflictFiles: [],
|
|
@@ -84262,7 +84279,22 @@ async function readStatusObject(taskDir) {
|
|
|
84262
84279
|
}
|
|
84263
84280
|
|
|
84264
84281
|
// ../canopycms/src/worker/task-runner.ts
|
|
84265
|
-
import
|
|
84282
|
+
import fs23 from "node:fs/promises";
|
|
84283
|
+
|
|
84284
|
+
// ../canopycms/src/utils/fs.ts
|
|
84285
|
+
init_error();
|
|
84286
|
+
import fs20 from "node:fs/promises";
|
|
84287
|
+
async function filePathExists(filePath) {
|
|
84288
|
+
try {
|
|
84289
|
+
await fs20.stat(filePath);
|
|
84290
|
+
return true;
|
|
84291
|
+
} catch (err) {
|
|
84292
|
+
if (isNotFoundError2(err)) return false;
|
|
84293
|
+
throw err;
|
|
84294
|
+
}
|
|
84295
|
+
}
|
|
84296
|
+
|
|
84297
|
+
// ../canopycms/src/worker/task-runner.ts
|
|
84266
84298
|
init_branch_name();
|
|
84267
84299
|
init_error();
|
|
84268
84300
|
|
|
@@ -84780,7 +84812,7 @@ async function recordSeenOnGitHub(ctx, branchName, sha) {
|
|
|
84780
84812
|
init_worker_status();
|
|
84781
84813
|
|
|
84782
84814
|
// ../canopycms/src/comment-store.ts
|
|
84783
|
-
import
|
|
84815
|
+
import fs21 from "node:fs/promises";
|
|
84784
84816
|
import path22 from "node:path";
|
|
84785
84817
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
84786
84818
|
init_error();
|
|
@@ -84807,7 +84839,7 @@ var CommentStore = class {
|
|
|
84807
84839
|
async listThreadsStrict() {
|
|
84808
84840
|
let content;
|
|
84809
84841
|
try {
|
|
84810
|
-
content = await
|
|
84842
|
+
content = await fs21.readFile(this.filePath, "utf-8");
|
|
84811
84843
|
} catch (err) {
|
|
84812
84844
|
if (isNotFoundError2(err)) return [];
|
|
84813
84845
|
throw err;
|
|
@@ -84831,7 +84863,7 @@ var CommentStore = class {
|
|
|
84831
84863
|
*/
|
|
84832
84864
|
async loadWithVersion() {
|
|
84833
84865
|
try {
|
|
84834
|
-
const content = await
|
|
84866
|
+
const content = await fs21.readFile(this.filePath, "utf-8");
|
|
84835
84867
|
const parsed = JSON.parse(content);
|
|
84836
84868
|
const version = parsed.version ?? 0;
|
|
84837
84869
|
return { data: { ...parsed, version }, version };
|
|
@@ -85059,7 +85091,7 @@ init_error();
|
|
|
85059
85091
|
|
|
85060
85092
|
// ../canopycms/src/worker/branch-merge.ts
|
|
85061
85093
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
85062
|
-
import
|
|
85094
|
+
import fs22 from "node:fs/promises";
|
|
85063
85095
|
import path23 from "node:path";
|
|
85064
85096
|
init_normalize();
|
|
85065
85097
|
init_types2();
|
|
@@ -85079,8 +85111,8 @@ function parseMergeTree(output, head, other) {
|
|
|
85079
85111
|
for (; i10 < fields.length && fields[i10] !== ""; i10++) {
|
|
85080
85112
|
const match2 = /^(\d+) ([0-9a-f]+) (\d)\t([\s\S]*)$/.exec(fields[i10]);
|
|
85081
85113
|
if (!match2) throw new Error(`Unreadable git merge-tree entry: ${JSON.stringify(fields[i10])}`);
|
|
85082
|
-
const [, mode, oid, stage,
|
|
85083
|
-
stages.push({ mode, oid, stage, path:
|
|
85114
|
+
const [, mode, oid, stage, path39] = match2;
|
|
85115
|
+
stages.push({ mode, oid, stage, path: path39 });
|
|
85084
85116
|
}
|
|
85085
85117
|
const unsettled = /* @__PURE__ */ new Set();
|
|
85086
85118
|
for (i10++; i10 < fields.length && fields[i10] !== ""; ) {
|
|
@@ -85088,7 +85120,7 @@ function parseMergeTree(output, head, other) {
|
|
|
85088
85120
|
if (kind?.startsWith("CONFLICT") && !SETTLED_BY_KEEPING_HEAD.has(kind)) unsettled.add(kind);
|
|
85089
85121
|
i10 += parseInt(fields[i10], 10) + 3;
|
|
85090
85122
|
}
|
|
85091
|
-
if (stages.some(({ path:
|
|
85123
|
+
if (stages.some(({ path: path39 }) => path39.includes("\uFFFD"))) unsettled.add("an unreadable file name");
|
|
85092
85124
|
return { tree, stages, unsettled: [...unsettled] };
|
|
85093
85125
|
}
|
|
85094
85126
|
async function buildMergeCommit(git, clonePath, args) {
|
|
@@ -85102,7 +85134,7 @@ async function buildMergeCommit(git, clonePath, args) {
|
|
|
85102
85134
|
other
|
|
85103
85135
|
]);
|
|
85104
85136
|
const { tree: mergedTree, stages, unsettled } = parseMergeTree(output, head, other);
|
|
85105
|
-
const conflicted = [...new Set(stages.map(({ path:
|
|
85137
|
+
const conflicted = [...new Set(stages.map(({ path: path39 }) => path39))];
|
|
85106
85138
|
if (unsettled.length > 0) return { kind: "unsettled", conflicts: unsettled, paths: conflicted };
|
|
85107
85139
|
const tree = stages.length === 0 ? mergedTree : await keepHeadStages(clonePath, { mergedTree, stages, conflicted, timeoutMs });
|
|
85108
85140
|
const sha = (await git.raw(["commit-tree", "-p", head, "-p", other, "-m", message2, "--end-of-options", tree])).trim();
|
|
@@ -85141,7 +85173,7 @@ async function keepHeadStages(clonePath, args) {
|
|
|
85141
85173
|
await runGit(["update-index", "-z", "--index-info"], { ...options, stdin: entries.join("") });
|
|
85142
85174
|
return (await runGit(["write-tree"], options)).trim();
|
|
85143
85175
|
} finally {
|
|
85144
|
-
await
|
|
85176
|
+
await fs22.rm(indexFile, { force: true }).catch(() => {
|
|
85145
85177
|
});
|
|
85146
85178
|
}
|
|
85147
85179
|
}
|
|
@@ -85212,11 +85244,12 @@ function isPublished({ branch }) {
|
|
|
85212
85244
|
async function bringInGitHubCommits(ctx, args) {
|
|
85213
85245
|
const { git, branchRef, metaFile, dirty, gatewayPolicy } = args;
|
|
85214
85246
|
const { branch } = metaFile;
|
|
85215
|
-
if (branch.name !== branchRef
|
|
85247
|
+
if (branch.name !== branchRef) return { kind: "in-step" };
|
|
85216
85248
|
const gitHubTip = args.gitHub?.tips.get(branchRef);
|
|
85217
85249
|
if (args.gitHub !== void 0 && gitHubTip === void 0 && branch.rewrittenOnGitHub) {
|
|
85218
85250
|
await clearRewritten(ctx, args);
|
|
85219
85251
|
}
|
|
85252
|
+
if (!isPublished(metaFile)) return { kind: "in-step" };
|
|
85220
85253
|
const published = await readPublishedSha(ctx, branchRef);
|
|
85221
85254
|
const tip = gitHubTip ?? published;
|
|
85222
85255
|
if (tip === null) return { kind: "in-step" };
|
|
@@ -85832,10 +85865,10 @@ async function isSupersededSubmit(ctx, task, branch) {
|
|
|
85832
85865
|
const { submittedAt, requeuedFrom } = task.payload;
|
|
85833
85866
|
if (typeof submittedAt !== "string") return false;
|
|
85834
85867
|
const live = await BranchMetadataFileManager.loadOnly(ctx.branchWorkspacePath(branch));
|
|
85835
|
-
|
|
85868
|
+
const firstRun = !task.retryCount && requeuedFrom === void 0;
|
|
85869
|
+
if (live === null) return !firstRun && !await filePathExists(ctx.branchWorkspacePath(branch));
|
|
85836
85870
|
const { status, submittedAt: recorded } = live.branch;
|
|
85837
85871
|
if (status === "archived") return true;
|
|
85838
|
-
const firstRun = !task.retryCount && requeuedFrom === void 0;
|
|
85839
85872
|
if (firstRun && (recorded === void 0 || recorded < submittedAt)) return false;
|
|
85840
85873
|
return status !== "submitted" && status !== "approved" || recorded !== submittedAt;
|
|
85841
85874
|
}
|
|
@@ -85858,7 +85891,7 @@ async function updateBranchMetadata(ctx, task, result) {
|
|
|
85858
85891
|
if (!branch) return;
|
|
85859
85892
|
const branchPath = ctx.branchWorkspacePath(branch);
|
|
85860
85893
|
try {
|
|
85861
|
-
await
|
|
85894
|
+
await fs23.stat(branchPath);
|
|
85862
85895
|
} catch {
|
|
85863
85896
|
return;
|
|
85864
85897
|
}
|
|
@@ -85892,7 +85925,7 @@ async function updateBranchMetadata(ctx, task, result) {
|
|
|
85892
85925
|
};
|
|
85893
85926
|
const archived = existing.branch.status === "archived";
|
|
85894
85927
|
if (archived && result.prNumber) {
|
|
85895
|
-
workerLogWarn(`Not recording pull request #${result.prNumber} on
|
|
85928
|
+
workerLogWarn(`Not recording pull request #${result.prNumber} on archived ${branch}`);
|
|
85896
85929
|
}
|
|
85897
85930
|
if (result.prUrl && !archived) updates.pullRequestUrl = result.prUrl;
|
|
85898
85931
|
if (result.prNumber && !archived) {
|
|
@@ -85919,7 +85952,7 @@ async function updateBranchMetadataOnFailure(ctx, task, error3, options) {
|
|
|
85919
85952
|
if (!branch) return;
|
|
85920
85953
|
const branchPath = ctx.branchWorkspacePath(branch);
|
|
85921
85954
|
try {
|
|
85922
|
-
await
|
|
85955
|
+
await fs23.stat(branchPath);
|
|
85923
85956
|
} catch {
|
|
85924
85957
|
return;
|
|
85925
85958
|
}
|
|
@@ -86074,7 +86107,7 @@ function logPushOutcome(ctx, branch, outcome, note) {
|
|
|
86074
86107
|
async function recordPushedToGitHub(ctx, branchPath, branch, sha) {
|
|
86075
86108
|
if (isSettingsBranch(branch)) return;
|
|
86076
86109
|
try {
|
|
86077
|
-
await
|
|
86110
|
+
await fs23.stat(branchPath);
|
|
86078
86111
|
} catch {
|
|
86079
86112
|
return;
|
|
86080
86113
|
}
|
|
@@ -86090,7 +86123,7 @@ async function recordPushedToGitHub(ctx, branchPath, branch, sha) {
|
|
|
86090
86123
|
}
|
|
86091
86124
|
|
|
86092
86125
|
// ../canopycms/src/worker/rebase.ts
|
|
86093
|
-
import
|
|
86126
|
+
import fs25 from "node:fs/promises";
|
|
86094
86127
|
import path26 from "node:path";
|
|
86095
86128
|
init_branch_name();
|
|
86096
86129
|
|
|
@@ -86115,7 +86148,7 @@ function tryAcquireContentWriteLock(branchRoot, onCompromised) {
|
|
|
86115
86148
|
var heldRoots = new AsyncLocalStorage();
|
|
86116
86149
|
|
|
86117
86150
|
// ../canopycms/src/worker/provisioned-workspace.ts
|
|
86118
|
-
import
|
|
86151
|
+
import fs24 from "node:fs/promises";
|
|
86119
86152
|
import path25 from "node:path";
|
|
86120
86153
|
init_error();
|
|
86121
86154
|
async function holdProvisionedWorkspace(contentBranchesPath, dirName) {
|
|
@@ -86138,11 +86171,11 @@ async function holdProvisionedWorkspace(contentBranchesPath, dirName) {
|
|
|
86138
86171
|
}
|
|
86139
86172
|
const root5 = path25.join(contentBranchesPath, dirName);
|
|
86140
86173
|
const [gitIsDir, hasMetadata] = await Promise.all([
|
|
86141
|
-
|
|
86174
|
+
fs24.stat(path25.join(root5, ".git")).then(
|
|
86142
86175
|
(stat) => stat.isDirectory(),
|
|
86143
86176
|
() => false
|
|
86144
86177
|
),
|
|
86145
|
-
|
|
86178
|
+
fs24.stat(path25.join(root5, BRANCH_META_DIR, BRANCH_META_FILE)).then(
|
|
86146
86179
|
() => true,
|
|
86147
86180
|
() => false
|
|
86148
86181
|
)
|
|
@@ -86317,7 +86350,7 @@ async function runRebaseCycle(ctx, gatewayPolicy, gitHub) {
|
|
|
86317
86350
|
const failed = [];
|
|
86318
86351
|
let branchDirs;
|
|
86319
86352
|
try {
|
|
86320
|
-
branchDirs = await
|
|
86353
|
+
branchDirs = await fs25.readdir(ctx.contentBranchesPath);
|
|
86321
86354
|
} catch {
|
|
86322
86355
|
return { rebased, skippedDirty, skippedLocked, failed };
|
|
86323
86356
|
}
|
|
@@ -86332,7 +86365,7 @@ async function runRebaseCycle(ctx, gatewayPolicy, gitHub) {
|
|
|
86332
86365
|
const branchPath = path26.join(ctx.contentBranchesPath, branchDir);
|
|
86333
86366
|
const gitDir = path26.join(branchPath, ".git");
|
|
86334
86367
|
try {
|
|
86335
|
-
const stat = await
|
|
86368
|
+
const stat = await fs25.stat(gitDir);
|
|
86336
86369
|
if (!stat.isDirectory()) {
|
|
86337
86370
|
workerLog(` Skipping ${branchDir}: .git is not a directory`);
|
|
86338
86371
|
continue;
|
|
@@ -86362,7 +86395,7 @@ async function runRebaseCycle(ctx, gatewayPolicy, gitHub) {
|
|
|
86362
86395
|
}
|
|
86363
86396
|
async function readCloneRef(branchPath) {
|
|
86364
86397
|
try {
|
|
86365
|
-
const head = (await
|
|
86398
|
+
const head = (await fs25.readFile(path26.join(branchPath, ".git", "HEAD"), "utf-8")).trim();
|
|
86366
86399
|
return head.startsWith("ref: refs/heads/") ? head.slice("ref: refs/heads/".length) : null;
|
|
86367
86400
|
} catch {
|
|
86368
86401
|
return null;
|
|
@@ -86445,7 +86478,9 @@ async function bringInCommitsForBranchInReview(ctx, branchDir, branchPath, metaF
|
|
|
86445
86478
|
const gitHubTip = gitHub?.tips.get(branchRef);
|
|
86446
86479
|
if (gitHubTip === void 0) {
|
|
86447
86480
|
if (gitHub === void 0) return { kind: "none" };
|
|
86448
|
-
const { rebaseFailure, rewrittenOnGitHub } = metaFile.branch;
|
|
86481
|
+
const { rebaseFailure, rewrittenOnGitHub, pullRequestNumber } = metaFile.branch;
|
|
86482
|
+
if (rewrittenOnGitHub !== void 0 && pullRequestNumber !== void 0)
|
|
86483
|
+
return { kind: "none" };
|
|
86449
86484
|
if (rebaseFailure !== void 0 || rewrittenOnGitHub !== void 0) {
|
|
86450
86485
|
await clearRebaseFailure(ctx, branchPath, branchRef);
|
|
86451
86486
|
}
|
|
@@ -86872,15 +86907,15 @@ async function rebaseOneBranch(ctx, branchDir, branchPath, isProvisioningLockCom
|
|
|
86872
86907
|
}
|
|
86873
86908
|
|
|
86874
86909
|
// ../canopycms/src/worker/git-sync.ts
|
|
86875
|
-
import
|
|
86876
|
-
import
|
|
86910
|
+
import fs32 from "node:fs/promises";
|
|
86911
|
+
import path33 from "node:path";
|
|
86877
86912
|
|
|
86878
86913
|
// ../canopycms/src/branch-health.ts
|
|
86879
86914
|
var ORPHAN_YOUTH_THRESHOLD_MS = 15 * 6e4;
|
|
86880
86915
|
|
|
86881
86916
|
// ../canopycms/src/branch-provisioning.ts
|
|
86882
86917
|
import { createHash, randomBytes as randomBytes2 } from "node:crypto";
|
|
86883
|
-
import
|
|
86918
|
+
import fs26 from "node:fs/promises";
|
|
86884
86919
|
import path27 from "node:path";
|
|
86885
86920
|
init_branch_name();
|
|
86886
86921
|
init_error();
|
|
@@ -86911,10 +86946,11 @@ var STAGING_PREFIX2 = ".prov-";
|
|
|
86911
86946
|
var REPAIR_PREFIX = ".repair-";
|
|
86912
86947
|
var TRASH_PREFIX = ".trash-";
|
|
86913
86948
|
var DELETING_PREFIX = ".deleting-";
|
|
86949
|
+
var deletingDirName = (dirName, now = /* @__PURE__ */ new Date()) => stampedName(DELETING_PREFIX, dirName, now);
|
|
86914
86950
|
var NO_GIT = { hasGitDir: false, configLock: false, hasIndex: false };
|
|
86915
86951
|
async function listDir(dirPath) {
|
|
86916
86952
|
try {
|
|
86917
|
-
return await
|
|
86953
|
+
return await fs26.readdir(dirPath);
|
|
86918
86954
|
} catch (err) {
|
|
86919
86955
|
if (isNodeError(err) && (err.code === "ENOENT" || err.code === "ENOTDIR")) return null;
|
|
86920
86956
|
throw err;
|
|
@@ -86942,7 +86978,7 @@ function sameRemote(url, expected) {
|
|
|
86942
86978
|
async function classifyFinalDir(dirPath, expectedRemoteUrl) {
|
|
86943
86979
|
let stat;
|
|
86944
86980
|
try {
|
|
86945
|
-
stat = await
|
|
86981
|
+
stat = await fs26.lstat(dirPath);
|
|
86946
86982
|
} catch (err) {
|
|
86947
86983
|
if (isNotFoundError2(err)) return { kind: "vacant" };
|
|
86948
86984
|
throw err;
|
|
@@ -86963,7 +86999,7 @@ async function classifyFinalDir(dirPath, expectedRemoteUrl) {
|
|
|
86963
86999
|
const gitPath = path27.join(dirPath, ".git");
|
|
86964
87000
|
let gitStat;
|
|
86965
87001
|
try {
|
|
86966
|
-
gitStat = await
|
|
87002
|
+
gitStat = await fs26.lstat(gitPath);
|
|
86967
87003
|
} catch (err) {
|
|
86968
87004
|
if (isNotFoundError2(err)) return { kind: "residue", signature: NO_GIT };
|
|
86969
87005
|
throw err;
|
|
@@ -86977,7 +87013,7 @@ async function classifyFinalDir(dirPath, expectedRemoteUrl) {
|
|
|
86977
87013
|
};
|
|
86978
87014
|
let config;
|
|
86979
87015
|
try {
|
|
86980
|
-
config = await
|
|
87016
|
+
config = await fs26.readFile(path27.join(gitPath, "config"), "utf8");
|
|
86981
87017
|
} catch {
|
|
86982
87018
|
return { kind: "residue", signature };
|
|
86983
87019
|
}
|
|
@@ -86986,7 +87022,7 @@ async function classifyFinalDir(dirPath, expectedRemoteUrl) {
|
|
|
86986
87022
|
async function quietAgeMs(dirPath, now = Date.now()) {
|
|
86987
87023
|
const mtimes = await Promise.all(
|
|
86988
87024
|
["", ".git", BRANCH_META_DIR].map(
|
|
86989
|
-
(sub) =>
|
|
87025
|
+
(sub) => fs26.lstat(path27.join(dirPath, sub)).then(
|
|
86990
87026
|
(stat) => stat.mtimeMs,
|
|
86991
87027
|
() => 0
|
|
86992
87028
|
)
|
|
@@ -86998,7 +87034,7 @@ async function quarantineResidueAt(baseRoot, dirName, options) {
|
|
|
86998
87034
|
const finalPath = path27.join(baseRoot, dirName);
|
|
86999
87035
|
let inode;
|
|
87000
87036
|
try {
|
|
87001
|
-
inode = (await
|
|
87037
|
+
inode = (await fs26.lstat(finalPath)).ino;
|
|
87002
87038
|
} catch (err) {
|
|
87003
87039
|
if (isNotFoundError2(err)) return { kind: "vacant" };
|
|
87004
87040
|
throw err;
|
|
@@ -87006,14 +87042,14 @@ async function quarantineResidueAt(baseRoot, dirName, options) {
|
|
|
87006
87042
|
const candidateName = stampedName(REPAIR_PREFIX, dirName, /* @__PURE__ */ new Date());
|
|
87007
87043
|
const candidate = path27.join(baseRoot, candidateName);
|
|
87008
87044
|
try {
|
|
87009
|
-
await
|
|
87045
|
+
await fs26.rename(finalPath, candidate);
|
|
87010
87046
|
} catch (err) {
|
|
87011
87047
|
if (isNotFoundError2(err)) return { kind: "vacant" };
|
|
87012
87048
|
throw err;
|
|
87013
87049
|
}
|
|
87014
87050
|
const moveBack = async (why) => {
|
|
87015
87051
|
try {
|
|
87016
|
-
await
|
|
87052
|
+
await fs26.rename(candidate, finalPath);
|
|
87017
87053
|
} catch (err) {
|
|
87018
87054
|
canopyLogError(
|
|
87019
87055
|
`[canopy] Could not move '${dirName}' back from ${candidateName} after ${why}: ${getErrorMessage(err)}. The worker's sweep restores or trashes it.`
|
|
@@ -87028,7 +87064,7 @@ async function quarantineResidueAt(baseRoot, dirName, options) {
|
|
|
87028
87064
|
);
|
|
87029
87065
|
if (reason === void 0 && state3.kind === "residue") {
|
|
87030
87066
|
const trashName = stampedName(TRASH_PREFIX, dirName, /* @__PURE__ */ new Date());
|
|
87031
|
-
await
|
|
87067
|
+
await fs26.rename(candidate, path27.join(baseRoot, trashName));
|
|
87032
87068
|
const { hasGitDir, configLock, hasIndex } = state3.signature;
|
|
87033
87069
|
canopyLogWarn(
|
|
87034
87070
|
`[canopy] Quarantined unfinished branch directory '${dirName}' as ${trashName} (git=${hasGitDir} config.lock=${configLock} index=${hasIndex} quiet=${Math.round(quiet / 1e3)}s)`
|
|
@@ -87040,7 +87076,7 @@ async function quarantineResidueAt(baseRoot, dirName, options) {
|
|
|
87040
87076
|
}
|
|
87041
87077
|
async function judgeQuarantineCandidate(candidate, inode, options) {
|
|
87042
87078
|
const state3 = await classifyFinalDir(candidate, options.expectedRemoteUrl);
|
|
87043
|
-
const moved = await
|
|
87079
|
+
const moved = await fs26.lstat(candidate).catch(() => null);
|
|
87044
87080
|
const quiet = await quietAgeMs(candidate, options.now);
|
|
87045
87081
|
let reason;
|
|
87046
87082
|
if (!moved || moved.ino !== inode) reason = "replaced";
|
|
@@ -87049,6 +87085,15 @@ async function judgeQuarantineCandidate(candidate, inode, options) {
|
|
|
87049
87085
|
else if (quiet < options.minQuietMs) reason = "too-young";
|
|
87050
87086
|
return { state: state3, quiet, reason };
|
|
87051
87087
|
}
|
|
87088
|
+
async function removeLeftoverDir(dirPath) {
|
|
87089
|
+
try {
|
|
87090
|
+
await fs26.rm(dirPath, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
|
87091
|
+
} catch (err) {
|
|
87092
|
+
canopyLogWarn(
|
|
87093
|
+
`[canopy] Could not remove ${dirPath}; the worker sweeps it: ${getErrorMessage(err)}`
|
|
87094
|
+
);
|
|
87095
|
+
}
|
|
87096
|
+
}
|
|
87052
87097
|
async function sweepByAge(root5, rules, now) {
|
|
87053
87098
|
const entries = await listDir(root5) ?? [];
|
|
87054
87099
|
const actions = [];
|
|
@@ -87057,7 +87102,7 @@ async function sweepByAge(root5, rules, now) {
|
|
|
87057
87102
|
const stamp = rule ? parseDirStamp(name2) : null;
|
|
87058
87103
|
if (!rule || !stamp || now - stamp.getTime() < rule.maxAgeMs) continue;
|
|
87059
87104
|
try {
|
|
87060
|
-
await
|
|
87105
|
+
await fs26.rm(path27.join(root5, name2), {
|
|
87061
87106
|
recursive: true,
|
|
87062
87107
|
force: true,
|
|
87063
87108
|
maxRetries: 3,
|
|
@@ -87086,8 +87131,8 @@ async function recoverRepairDir(baseRoot, name2) {
|
|
|
87086
87131
|
}
|
|
87087
87132
|
try {
|
|
87088
87133
|
const finalPath = path27.join(baseRoot, dirName);
|
|
87089
|
-
if (await
|
|
87090
|
-
await
|
|
87134
|
+
if (await fs26.lstat(finalPath).catch(() => null) === null) {
|
|
87135
|
+
await fs26.rename(repairPath, finalPath);
|
|
87091
87136
|
return { name: name2, action: "restored", detail: dirName };
|
|
87092
87137
|
}
|
|
87093
87138
|
} finally {
|
|
@@ -87096,7 +87141,7 @@ async function recoverRepairDir(baseRoot, name2) {
|
|
|
87096
87141
|
}
|
|
87097
87142
|
}
|
|
87098
87143
|
const trashName = `${TRASH_PREFIX}${name2.slice(REPAIR_PREFIX.length)}`;
|
|
87099
|
-
await
|
|
87144
|
+
await fs26.rename(repairPath, path27.join(baseRoot, trashName));
|
|
87100
87145
|
return { name: name2, action: "trashed", detail: trashName };
|
|
87101
87146
|
}
|
|
87102
87147
|
async function sweepProvisioningLeftovers(baseRoot, workspaceRoot, now = Date.now()) {
|
|
@@ -87133,6 +87178,198 @@ async function sweepProvisioningLeftovers(baseRoot, workspaceRoot, now = Date.no
|
|
|
87133
87178
|
// ../canopycms/src/worker/git-sync.ts
|
|
87134
87179
|
init_branch_name();
|
|
87135
87180
|
init_error();
|
|
87181
|
+
|
|
87182
|
+
// ../canopycms/src/worker/archived-sweep.ts
|
|
87183
|
+
import fs28 from "node:fs/promises";
|
|
87184
|
+
import path29 from "node:path";
|
|
87185
|
+
|
|
87186
|
+
// ../canopycms/src/branch-archive.ts
|
|
87187
|
+
var archivedTime = (branch) => {
|
|
87188
|
+
const recorded = branch.archivedAt ?? branch.mergedAt;
|
|
87189
|
+
if (recorded === void 0) return void 0;
|
|
87190
|
+
const time3 = Date.parse(recorded);
|
|
87191
|
+
return Number.isNaN(time3) ? void 0 : time3;
|
|
87192
|
+
};
|
|
87193
|
+
var archivedBefore = (branch, cutoffMs) => {
|
|
87194
|
+
const time3 = archivedTime(branch);
|
|
87195
|
+
return branch.status === "archived" && time3 !== void 0 && time3 < cutoffMs;
|
|
87196
|
+
};
|
|
87197
|
+
var ageDeletionHold = (branch) => branch.mergedAt === void 0 ? "not-merged" : branch.unpublishedAtMerge === true || branch.rewrittenOnGitHub !== void 0 ? "unpublished" : void 0;
|
|
87198
|
+
var deletableByAge = (branch, cutoffMs) => archivedBefore(branch, cutoffMs) && ageDeletionHold(branch) === void 0;
|
|
87199
|
+
var archivedCutoff = (days, now) => now - days * 24 * 60 * 6e4;
|
|
87200
|
+
|
|
87201
|
+
// ../canopycms/src/branch-delete.ts
|
|
87202
|
+
import fs27 from "node:fs/promises";
|
|
87203
|
+
import path28 from "node:path";
|
|
87204
|
+
init_branch_name();
|
|
87205
|
+
init_error();
|
|
87206
|
+
init_logger();
|
|
87207
|
+
async function deleteBranchWorkspace(options) {
|
|
87208
|
+
const { context, registry: registry2, remoteCopies, stillWanted } = options;
|
|
87209
|
+
const metadataFile = path28.join(context.branchRoot, BRANCH_META_DIR, BRANCH_META_FILE);
|
|
87210
|
+
let cleanupWarning;
|
|
87211
|
+
let deletingPath;
|
|
87212
|
+
const warn = (warning2) => {
|
|
87213
|
+
cleanupWarning = cleanupWarning ? `${cleanupWarning}; ${warning2}` : warning2;
|
|
87214
|
+
};
|
|
87215
|
+
let wanted = true;
|
|
87216
|
+
try {
|
|
87217
|
+
await withOccFileLock(metadataFile, async () => {
|
|
87218
|
+
if (stillWanted) {
|
|
87219
|
+
const current = await readBranchMetadataFile(context.branchRoot);
|
|
87220
|
+
if (current === null || !stillWanted(current.branch)) {
|
|
87221
|
+
wanted = false;
|
|
87222
|
+
return;
|
|
87223
|
+
}
|
|
87224
|
+
}
|
|
87225
|
+
if (context.branchRoot === context.baseRoot) {
|
|
87226
|
+
await fs27.unlink(metadataFile).catch((err) => {
|
|
87227
|
+
if (!isNotFoundError2(err)) throw err;
|
|
87228
|
+
});
|
|
87229
|
+
return;
|
|
87230
|
+
}
|
|
87231
|
+
const target = path28.join(context.baseRoot, deletingDirName(path28.basename(context.branchRoot)));
|
|
87232
|
+
try {
|
|
87233
|
+
await fs27.rename(context.branchRoot, target);
|
|
87234
|
+
deletingPath = target;
|
|
87235
|
+
} catch (err) {
|
|
87236
|
+
if (isNotFoundError2(err)) return;
|
|
87237
|
+
await fs27.unlink(metadataFile).catch(() => {
|
|
87238
|
+
});
|
|
87239
|
+
warn(`Failed to remove branch directory: ${sanitizeErrorMessage(getErrorMessage(err))}`);
|
|
87240
|
+
canopyLogError(
|
|
87241
|
+
`CanopyCMS: Failed to move branch directory for ${context.branch.name} aside:`,
|
|
87242
|
+
getErrorMessage(err)
|
|
87243
|
+
);
|
|
87244
|
+
}
|
|
87245
|
+
});
|
|
87246
|
+
} catch (err) {
|
|
87247
|
+
if (!await filePathExists(context.branchRoot)) return { kind: "kept" };
|
|
87248
|
+
return { kind: "busy", error: getErrorMessage(err) };
|
|
87249
|
+
}
|
|
87250
|
+
if (!wanted) return { kind: "kept" };
|
|
87251
|
+
const sanitizedDeleted = sanitizeBranchName(context.branch.name);
|
|
87252
|
+
if (remoteCopies && sanitizedDeleted !== sanitizeBranchName(remoteCopies.baseBranch) && !sanitizedDeleted.startsWith(RESERVED_SETTINGS_BRANCH_PREFIX)) {
|
|
87253
|
+
try {
|
|
87254
|
+
await remoteCopies.deleteMirrorHead();
|
|
87255
|
+
} catch (err) {
|
|
87256
|
+
warn(
|
|
87257
|
+
`Failed to remove the deleted branch's head from the local mirror: ${sanitizeErrorMessage(getErrorMessage(err))}`
|
|
87258
|
+
);
|
|
87259
|
+
canopyLogWarn(
|
|
87260
|
+
`CanopyCMS: failed to remove deleted branch's mirror head (branch ${context.branch.name}): ${getErrorMessage(err)}`
|
|
87261
|
+
);
|
|
87262
|
+
}
|
|
87263
|
+
const warning2 = await remoteCopies.deleteOnGitHub();
|
|
87264
|
+
if (warning2) warn(warning2);
|
|
87265
|
+
}
|
|
87266
|
+
try {
|
|
87267
|
+
await registry2.invalidate();
|
|
87268
|
+
} catch (err) {
|
|
87269
|
+
warn(`Failed to refresh the branch list: ${sanitizeErrorMessage(getErrorMessage(err))}`);
|
|
87270
|
+
}
|
|
87271
|
+
if (deletingPath) await removeLeftoverDir(deletingPath);
|
|
87272
|
+
return { kind: "deleted", ...cleanupWarning && { cleanupWarning } };
|
|
87273
|
+
}
|
|
87274
|
+
|
|
87275
|
+
// ../canopycms/src/worker/archived-sweep.ts
|
|
87276
|
+
init_branch_name();
|
|
87277
|
+
init_error();
|
|
87278
|
+
var MAX_ARCHIVED_SWEEP_PER_CYCLE = 25;
|
|
87279
|
+
async function listDueBranches(ctx, cutoff) {
|
|
87280
|
+
const settingsBranch = ctx.ensureSettingsBranch();
|
|
87281
|
+
const due = [];
|
|
87282
|
+
const entries = await fs28.readdir(ctx.contentBranchesPath, { withFileTypes: true });
|
|
87283
|
+
for (const entry of entries) {
|
|
87284
|
+
const dirName = entry.name;
|
|
87285
|
+
if (!entry.isDirectory() || dirName.startsWith(".")) continue;
|
|
87286
|
+
if (dirName === ctx.sanitizedBaseBranch || isSettingsBranchName(dirName, settingsBranch)) {
|
|
87287
|
+
continue;
|
|
87288
|
+
}
|
|
87289
|
+
let branch;
|
|
87290
|
+
try {
|
|
87291
|
+
const metaFile = await BranchMetadataFileManager.loadOnly(
|
|
87292
|
+
path29.join(ctx.contentBranchesPath, dirName)
|
|
87293
|
+
);
|
|
87294
|
+
branch = metaFile?.branch;
|
|
87295
|
+
} catch (err) {
|
|
87296
|
+
if (!(err instanceof BranchMetadataCorruptError)) {
|
|
87297
|
+
workerLogWarn(`Skipping ${dirName} in the archived sweep: ${getErrorMessage(err)}`);
|
|
87298
|
+
}
|
|
87299
|
+
}
|
|
87300
|
+
if (branch !== void 0 && sanitizeBranchName(branch.name) === dirName && (branch.baseBranch === void 0 || sanitizeBranchName(branch.baseBranch) !== dirName) && deletableByAge(branch, cutoff)) {
|
|
87301
|
+
due.push({ dirName, branch });
|
|
87302
|
+
}
|
|
87303
|
+
}
|
|
87304
|
+
return due.sort((a9, b10) => (archivedTime(a9.branch) ?? 0) - (archivedTime(b10.branch) ?? 0));
|
|
87305
|
+
}
|
|
87306
|
+
async function sweepArchivedBranches(ctx, now = Date.now()) {
|
|
87307
|
+
if (ctx.archivedBranchRetentionDays === void 0) return void 0;
|
|
87308
|
+
const cutoff = archivedCutoff(ctx.archivedBranchRetentionDays, now);
|
|
87309
|
+
let due;
|
|
87310
|
+
try {
|
|
87311
|
+
due = await listDueBranches(ctx, cutoff);
|
|
87312
|
+
} catch (err) {
|
|
87313
|
+
if (!isNotFoundError2(err)) {
|
|
87314
|
+
workerLogError("Could not list archived branches to sweep:", getErrorMessage(err));
|
|
87315
|
+
}
|
|
87316
|
+
return void 0;
|
|
87317
|
+
}
|
|
87318
|
+
if (due.length === 0) return void 0;
|
|
87319
|
+
const report = {
|
|
87320
|
+
deleted: [],
|
|
87321
|
+
skippedLocked: [],
|
|
87322
|
+
failed: [],
|
|
87323
|
+
deferred: Math.max(0, due.length - MAX_ARCHIVED_SWEEP_PER_CYCLE),
|
|
87324
|
+
warnings: []
|
|
87325
|
+
};
|
|
87326
|
+
const registry2 = new BranchRegistry(ctx.contentBranchesPath);
|
|
87327
|
+
for (const { dirName, branch } of due.slice(0, MAX_ARCHIVED_SWEEP_PER_CYCLE)) {
|
|
87328
|
+
if (ctx.isDraining()) break;
|
|
87329
|
+
const { name: name2 } = branch;
|
|
87330
|
+
try {
|
|
87331
|
+
const hold = await holdProvisionedWorkspace(ctx.contentBranchesPath, dirName);
|
|
87332
|
+
if (hold.kind === "locked") {
|
|
87333
|
+
report.skippedLocked.push(name2);
|
|
87334
|
+
continue;
|
|
87335
|
+
}
|
|
87336
|
+
if (hold.kind === "not-provisioned") continue;
|
|
87337
|
+
try {
|
|
87338
|
+
if (hold.isCompromised()) {
|
|
87339
|
+
report.skippedLocked.push(name2);
|
|
87340
|
+
continue;
|
|
87341
|
+
}
|
|
87342
|
+
const outcome = await deleteBranchWorkspace({
|
|
87343
|
+
context: {
|
|
87344
|
+
baseRoot: ctx.contentBranchesPath,
|
|
87345
|
+
branchRoot: path29.join(ctx.contentBranchesPath, dirName),
|
|
87346
|
+
branch
|
|
87347
|
+
},
|
|
87348
|
+
registry: registry2,
|
|
87349
|
+
stillWanted: (current) => current.name === name2 && deletableByAge(current, cutoff)
|
|
87350
|
+
});
|
|
87351
|
+
if (outcome.kind === "deleted") {
|
|
87352
|
+
report.deleted.push(name2);
|
|
87353
|
+
workerLog(` Deleted archived branch ${escapeForLog(name2)}: past the retention period`);
|
|
87354
|
+
if (outcome.cleanupWarning) report.warnings.push(`${name2}: ${outcome.cleanupWarning}`);
|
|
87355
|
+
} else if (outcome.kind === "busy") {
|
|
87356
|
+
report.failed.push({ branch: name2, error: sanitizeErrorMessage(outcome.error) });
|
|
87357
|
+
}
|
|
87358
|
+
} finally {
|
|
87359
|
+
await releaseProvisionedWorkspace(hold.release, dirName);
|
|
87360
|
+
}
|
|
87361
|
+
} catch (err) {
|
|
87362
|
+
report.failed.push({ branch: name2, error: sanitizeErrorMessage(getErrorMessage(err)) });
|
|
87363
|
+
}
|
|
87364
|
+
}
|
|
87365
|
+
for (const { branch, error: error3 } of report.failed) {
|
|
87366
|
+
workerLogWarn(` Could not delete archived branch ${escapeForLog(branch)}: ${error3}`);
|
|
87367
|
+
}
|
|
87368
|
+
for (const warning2 of report.warnings) workerLogWarn(` ${escapeForLog(warning2)}`);
|
|
87369
|
+
return report;
|
|
87370
|
+
}
|
|
87371
|
+
|
|
87372
|
+
// ../canopycms/src/worker/git-sync.ts
|
|
87136
87373
|
init_worker_status();
|
|
87137
87374
|
|
|
87138
87375
|
// ../canopycms/src/worker/remote-git-maintenance.ts
|
|
@@ -87147,12 +87384,12 @@ async function maintainRemoteGit(gitDir) {
|
|
|
87147
87384
|
}
|
|
87148
87385
|
|
|
87149
87386
|
// ../canopycms/src/worker/sparse-cone.ts
|
|
87150
|
-
import
|
|
87151
|
-
import
|
|
87387
|
+
import fs30 from "node:fs/promises";
|
|
87388
|
+
import path31 from "node:path";
|
|
87152
87389
|
|
|
87153
87390
|
// ../canopycms/src/branch-sparse.ts
|
|
87154
|
-
import
|
|
87155
|
-
import
|
|
87391
|
+
import fs29 from "node:fs/promises";
|
|
87392
|
+
import path30 from "node:path";
|
|
87156
87393
|
init_error();
|
|
87157
87394
|
function sameCone(a9, b10) {
|
|
87158
87395
|
if (a9 === null || b10 === null) return a9 === b10;
|
|
@@ -87161,12 +87398,12 @@ function sameCone(a9, b10) {
|
|
|
87161
87398
|
}
|
|
87162
87399
|
var SPARSE_CONE_RECORD = ".sparse-cone.json";
|
|
87163
87400
|
function isConeDir(dir) {
|
|
87164
|
-
return typeof dir === "string" && dir.length > 0 && !
|
|
87401
|
+
return typeof dir === "string" && dir.length > 0 && !path30.isAbsolute(dir) && !dir.split("/").some((segment) => segment === "" || segment === "." || segment === "..");
|
|
87165
87402
|
}
|
|
87166
87403
|
async function readRecordedSparseCone(contentBranchesRoot) {
|
|
87167
87404
|
let raw;
|
|
87168
87405
|
try {
|
|
87169
|
-
raw = await
|
|
87406
|
+
raw = await fs29.readFile(path30.join(contentBranchesRoot, SPARSE_CONE_RECORD), "utf8");
|
|
87170
87407
|
} catch (err) {
|
|
87171
87408
|
if (isNodeError(err) && err.code === "ENOENT") return void 0;
|
|
87172
87409
|
throw err;
|
|
@@ -87199,15 +87436,15 @@ async function reapplySparseCones(ctx) {
|
|
|
87199
87436
|
if (!recorded) return report;
|
|
87200
87437
|
let entries;
|
|
87201
87438
|
try {
|
|
87202
|
-
entries = await
|
|
87439
|
+
entries = await fs30.readdir(ctx.contentBranchesPath, { withFileTypes: true });
|
|
87203
87440
|
} catch (err) {
|
|
87204
87441
|
if (isNodeError(err) && err.code === "ENOENT") return report;
|
|
87205
87442
|
throw err;
|
|
87206
87443
|
}
|
|
87207
87444
|
const dirNames = entries.filter((entry) => entry.isDirectory() && !entry.name.startsWith(".")).map((entry) => entry.name).sort();
|
|
87208
87445
|
for (const dirName of dirNames) {
|
|
87209
|
-
const branchPath =
|
|
87210
|
-
const isClone = await
|
|
87446
|
+
const branchPath = path31.join(ctx.contentBranchesPath, dirName);
|
|
87447
|
+
const isClone = await fs30.stat(path31.join(branchPath, ".git")).then(
|
|
87211
87448
|
(stat) => stat.isDirectory(),
|
|
87212
87449
|
() => false
|
|
87213
87450
|
);
|
|
@@ -87239,7 +87476,7 @@ async function reapplySparseCones(ctx) {
|
|
|
87239
87476
|
return report;
|
|
87240
87477
|
}
|
|
87241
87478
|
async function reapplyOne(contentBranchesPath, dirName, git, target) {
|
|
87242
|
-
const branchPath =
|
|
87479
|
+
const branchPath = path31.join(contentBranchesPath, dirName);
|
|
87243
87480
|
const hold = await holdProvisionedWorkspace(contentBranchesPath, dirName);
|
|
87244
87481
|
if (hold.kind !== "held") return "skipped";
|
|
87245
87482
|
try {
|
|
@@ -87279,11 +87516,11 @@ async function reapplyOne(contentBranchesPath, dirName, git, target) {
|
|
|
87279
87516
|
|
|
87280
87517
|
// ../canopycms/src/worker/stale-mirror.ts
|
|
87281
87518
|
init_branch_name();
|
|
87282
|
-
import
|
|
87283
|
-
import
|
|
87519
|
+
import fs31 from "node:fs/promises";
|
|
87520
|
+
import path32 from "node:path";
|
|
87284
87521
|
init_error();
|
|
87285
87522
|
async function readEditorWork(ctx) {
|
|
87286
|
-
const workspaces = new Set(await
|
|
87523
|
+
const workspaces = new Set(await fs31.readdir(ctx.contentBranchesPath).catch(() => []));
|
|
87287
87524
|
const queuedPushes = /* @__PURE__ */ new Set();
|
|
87288
87525
|
for (const status of ["pending", "processing"]) {
|
|
87289
87526
|
for (const task of await listTasks(ctx.taskDir, status, Number.POSITIVE_INFINITY)) {
|
|
@@ -87318,7 +87555,7 @@ async function settleStaleMirror(ctx, git, head, ownSettingsBranch, editorWork,
|
|
|
87318
87555
|
throw err;
|
|
87319
87556
|
}
|
|
87320
87557
|
try {
|
|
87321
|
-
if ((await
|
|
87558
|
+
if ((await fs31.readdir(ctx.contentBranchesPath)).includes(dirName)) {
|
|
87322
87559
|
return { kind: "kept", state: "workspace" };
|
|
87323
87560
|
}
|
|
87324
87561
|
const ref = `refs/heads/${name2}`;
|
|
@@ -87328,7 +87565,7 @@ async function settleStaleMirror(ctx, git, head, ownSettingsBranch, editorWork,
|
|
|
87328
87565
|
);
|
|
87329
87566
|
} catch (err) {
|
|
87330
87567
|
const message2 = getErrorMessage(err);
|
|
87331
|
-
if (lockHeld(message2) ===
|
|
87568
|
+
if (lockHeld(message2) === path32.join(ctx.remoteGitPath, "packed-refs.lock")) {
|
|
87332
87569
|
return { kind: "packed-refs-locked" };
|
|
87333
87570
|
}
|
|
87334
87571
|
if (/cannot lock ref|Unable to create '[^']*\.lock': File exists/.test(message2)) {
|
|
@@ -87343,7 +87580,7 @@ async function settleStaleMirror(ctx, git, head, ownSettingsBranch, editorWork,
|
|
|
87343
87580
|
}
|
|
87344
87581
|
function lockHeld(message2) {
|
|
87345
87582
|
const match2 = /Unable to create '([^']*)': File exists/.exec(message2);
|
|
87346
|
-
return match2 ?
|
|
87583
|
+
return match2 ? path32.normalize(match2[1]) : null;
|
|
87347
87584
|
}
|
|
87348
87585
|
async function sharesHistory(git, head, baseTip) {
|
|
87349
87586
|
try {
|
|
@@ -87711,6 +87948,7 @@ async function syncGit(ctx) {
|
|
|
87711
87948
|
if (trashRemoved > 0) {
|
|
87712
87949
|
workerLog(`Removed ${trashRemoved} expired trashed branch dir(s)`);
|
|
87713
87950
|
}
|
|
87951
|
+
const archivedSweep = await sweepArchivedBranches(ctx);
|
|
87714
87952
|
const report = ctx.ensureStatusReport();
|
|
87715
87953
|
report.lastGitSyncAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
87716
87954
|
delete report.lastGitSyncError;
|
|
@@ -87720,6 +87958,7 @@ async function syncGit(ctx) {
|
|
|
87720
87958
|
report.lastGitSync = {
|
|
87721
87959
|
durationMs: Date.now() - cycleStartedAt,
|
|
87722
87960
|
rebased: rebaseSummary.rebased,
|
|
87961
|
+
...archivedSweep && { archivedSweep },
|
|
87723
87962
|
skippedDirty: baseRefresh.outcome === "skipped-dirty" ? [ctx.sanitizedBaseBranch, ...rebaseSummary.skippedDirty] : rebaseSummary.skippedDirty,
|
|
87724
87963
|
skippedLocked: baseRefresh.outcome === "skipped-locked" ? [ctx.sanitizedBaseBranch, ...rebaseSummary.skippedLocked] : rebaseSummary.skippedLocked,
|
|
87725
87964
|
failed: rebaseSummary.failed,
|
|
@@ -87751,7 +87990,7 @@ var reportedForeignDirs = /* @__PURE__ */ new Set();
|
|
|
87751
87990
|
async function repairBranchDirResidue(ctx, now = Date.now()) {
|
|
87752
87991
|
let entries;
|
|
87753
87992
|
try {
|
|
87754
|
-
entries = await
|
|
87993
|
+
entries = await fs32.readdir(ctx.contentBranchesPath, { withFileTypes: true });
|
|
87755
87994
|
} catch (err) {
|
|
87756
87995
|
if (isNodeError(err) && err.code === "ENOENT") return;
|
|
87757
87996
|
throw err;
|
|
@@ -87766,7 +88005,7 @@ async function repairBranchDirResidue(ctx, now = Date.now()) {
|
|
|
87766
88005
|
}
|
|
87767
88006
|
const leftovers = await sweepProvisioningLeftovers(
|
|
87768
88007
|
ctx.contentBranchesPath,
|
|
87769
|
-
|
|
88008
|
+
path33.dirname(ctx.contentBranchesPath),
|
|
87770
88009
|
now
|
|
87771
88010
|
);
|
|
87772
88011
|
for (const { name: name2, action, detail } of leftovers) {
|
|
@@ -87777,8 +88016,8 @@ async function repairBranchDirResidue(ctx, now = Date.now()) {
|
|
|
87777
88016
|
}
|
|
87778
88017
|
}
|
|
87779
88018
|
async function repairOneBranchDir(ctx, dirName, now) {
|
|
87780
|
-
const dirPath =
|
|
87781
|
-
const hasMeta = await
|
|
88019
|
+
const dirPath = path33.join(ctx.contentBranchesPath, dirName);
|
|
88020
|
+
const hasMeta = await fs32.access(path33.join(dirPath, BRANCH_META_DIR, BRANCH_META_FILE)).then(
|
|
87782
88021
|
() => true,
|
|
87783
88022
|
() => false
|
|
87784
88023
|
);
|
|
@@ -87814,7 +88053,7 @@ async function repairOneBranchDir(ctx, dirName, now) {
|
|
|
87814
88053
|
async function cleanupTrashedBranchDirs(ctx) {
|
|
87815
88054
|
let entries;
|
|
87816
88055
|
try {
|
|
87817
|
-
entries = await
|
|
88056
|
+
entries = await fs32.readdir(ctx.contentBranchesPath);
|
|
87818
88057
|
} catch (err) {
|
|
87819
88058
|
if (isNodeError(err) && err.code === "ENOENT") return 0;
|
|
87820
88059
|
throw err;
|
|
@@ -87834,7 +88073,7 @@ async function cleanupTrashedBranchDirs(ctx) {
|
|
|
87834
88073
|
}
|
|
87835
88074
|
if (now - stampDate.getTime() < TRASH_RETENTION_MS) continue;
|
|
87836
88075
|
try {
|
|
87837
|
-
await
|
|
88076
|
+
await fs32.rm(path33.join(ctx.contentBranchesPath, name2), {
|
|
87838
88077
|
recursive: true,
|
|
87839
88078
|
force: true,
|
|
87840
88079
|
maxRetries: 3,
|
|
@@ -87852,7 +88091,7 @@ async function cleanupTrashedBranchDirs(ctx) {
|
|
|
87852
88091
|
}
|
|
87853
88092
|
var warnedTrackedCanopyState = /* @__PURE__ */ new Set();
|
|
87854
88093
|
async function refreshBaseBranchWorkspace(ctx) {
|
|
87855
|
-
const basePath37 =
|
|
88094
|
+
const basePath37 = path33.join(ctx.contentBranchesPath, ctx.sanitizedBaseBranch);
|
|
87856
88095
|
let trackedCanopyMeta;
|
|
87857
88096
|
let releaseProvisioning;
|
|
87858
88097
|
let releaseContentLock;
|
|
@@ -88010,10 +88249,10 @@ async function refreshBaseBranchWorkspace(ctx) {
|
|
|
88010
88249
|
// ../canopycms/src/worker/github-gateway-http.ts
|
|
88011
88250
|
init_error();
|
|
88012
88251
|
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
88013
|
-
import
|
|
88252
|
+
import fs33 from "node:fs/promises";
|
|
88014
88253
|
import http from "node:http";
|
|
88015
88254
|
import net from "node:net";
|
|
88016
|
-
import
|
|
88255
|
+
import path34 from "node:path";
|
|
88017
88256
|
import { PassThrough } from "node:stream";
|
|
88018
88257
|
import { pipeline as pipeline2 } from "node:stream/promises";
|
|
88019
88258
|
var MAX_POLL_WAIT_MS = 25e3;
|
|
@@ -88036,11 +88275,11 @@ async function serveGitHubGateway(gateway, listen, options = {}) {
|
|
|
88036
88275
|
if ("fd" in listen) {
|
|
88037
88276
|
await listenOn(server, { fd: listen.fd });
|
|
88038
88277
|
} else {
|
|
88039
|
-
await assertPrivateDirectory(
|
|
88278
|
+
await assertPrivateDirectory(path34.dirname(listen.path));
|
|
88040
88279
|
await removeStaleSocket(listen.path);
|
|
88041
88280
|
await listenOn(server, { path: listen.path });
|
|
88042
88281
|
try {
|
|
88043
|
-
await
|
|
88282
|
+
await fs33.chmod(listen.path, 384);
|
|
88044
88283
|
} catch (err) {
|
|
88045
88284
|
await closeServer(server, handler);
|
|
88046
88285
|
throw err;
|
|
@@ -88081,7 +88320,7 @@ function listenOn(server, options) {
|
|
|
88081
88320
|
});
|
|
88082
88321
|
}
|
|
88083
88322
|
async function assertPrivateDirectory(dir) {
|
|
88084
|
-
const stat = await
|
|
88323
|
+
const stat = await fs33.lstat(dir);
|
|
88085
88324
|
const uid = process.getuid?.();
|
|
88086
88325
|
if (!stat.isDirectory() || uid !== void 0 && (stat.uid !== uid || (stat.mode & 63) !== 0)) {
|
|
88087
88326
|
throw new Error(
|
|
@@ -88092,7 +88331,7 @@ async function assertPrivateDirectory(dir) {
|
|
|
88092
88331
|
async function removeStaleSocket(socketPath) {
|
|
88093
88332
|
let stat;
|
|
88094
88333
|
try {
|
|
88095
|
-
stat = await
|
|
88334
|
+
stat = await fs33.lstat(socketPath);
|
|
88096
88335
|
} catch (err) {
|
|
88097
88336
|
if (isNodeError(err) && err.code === "ENOENT") return;
|
|
88098
88337
|
throw err;
|
|
@@ -88108,7 +88347,7 @@ async function removeStaleSocket(socketPath) {
|
|
|
88108
88347
|
`Refusing to serve the GitHub gateway at ${socketPath}: a gateway already serves there`
|
|
88109
88348
|
);
|
|
88110
88349
|
}
|
|
88111
|
-
await
|
|
88350
|
+
await fs33.unlink(socketPath);
|
|
88112
88351
|
}
|
|
88113
88352
|
function isServed(socketPath) {
|
|
88114
88353
|
return new Promise((resolve) => {
|
|
@@ -88840,9 +89079,9 @@ init_branch_namespace();
|
|
|
88840
89079
|
|
|
88841
89080
|
// ../canopycms/src/worker/self-checks.ts
|
|
88842
89081
|
init_error();
|
|
88843
|
-
import
|
|
89082
|
+
import fs34 from "node:fs/promises";
|
|
88844
89083
|
import net2 from "node:net";
|
|
88845
|
-
import
|
|
89084
|
+
import path35 from "node:path";
|
|
88846
89085
|
var IMDS_HOST = "169.254.169.254";
|
|
88847
89086
|
var IMDS_CONNECT_TIMEOUT_MS = 1e3;
|
|
88848
89087
|
var NO_ROUTE_CODES = /* @__PURE__ */ new Set(["ENETUNREACH", "EAFNOSUPPORT"]);
|
|
@@ -88897,10 +89136,10 @@ async function imdsUnreachable(environment = {}) {
|
|
|
88897
89136
|
};
|
|
88898
89137
|
}
|
|
88899
89138
|
async function onlyLoopback(environment = {}) {
|
|
88900
|
-
const file =
|
|
89139
|
+
const file = path35.join(rootOf(environment), "proc", "self", "net", "dev");
|
|
88901
89140
|
let text;
|
|
88902
89141
|
try {
|
|
88903
|
-
text = await
|
|
89142
|
+
text = await fs34.readFile(file, "utf8");
|
|
88904
89143
|
} catch (err) {
|
|
88905
89144
|
return {
|
|
88906
89145
|
check: "network-namespace",
|
|
@@ -88917,21 +89156,21 @@ async function onlyLoopback(environment = {}) {
|
|
|
88917
89156
|
};
|
|
88918
89157
|
}
|
|
88919
89158
|
async function procShowsOnlyOwnProcesses(environment = {}) {
|
|
88920
|
-
const proc =
|
|
89159
|
+
const proc = path35.join(rootOf(environment), "proc");
|
|
88921
89160
|
const uid = environment.uid ?? process.getuid?.();
|
|
88922
89161
|
if (uid === void 0) {
|
|
88923
89162
|
return { check: "proc", ok: false, detail: "this platform has no process uid to compare" };
|
|
88924
89163
|
}
|
|
88925
89164
|
let entries;
|
|
88926
89165
|
try {
|
|
88927
|
-
entries = await
|
|
89166
|
+
entries = await fs34.readdir(proc);
|
|
88928
89167
|
} catch (err) {
|
|
88929
89168
|
return { check: "proc", ok: false, detail: `cannot list ${proc}: ${getErrorMessage(err)}` };
|
|
88930
89169
|
}
|
|
88931
89170
|
const others = [];
|
|
88932
89171
|
for (const entry of entries.filter((name2) => /^\d+$/.test(name2))) {
|
|
88933
89172
|
try {
|
|
88934
|
-
const stat = await
|
|
89173
|
+
const stat = await fs34.stat(path35.join(proc, entry));
|
|
88935
89174
|
if (stat.uid !== uid) others.push(`${entry} (uid ${stat.uid})`);
|
|
88936
89175
|
} catch (err) {
|
|
88937
89176
|
if (!(isNodeError(err) && err.code === "ENOENT")) {
|
|
@@ -88947,9 +89186,9 @@ async function procShowsOnlyOwnProcesses(environment = {}) {
|
|
|
88947
89186
|
};
|
|
88948
89187
|
}
|
|
88949
89188
|
async function homeIsEmpty(environment = {}) {
|
|
88950
|
-
const home =
|
|
89189
|
+
const home = path35.join(rootOf(environment), "home");
|
|
88951
89190
|
try {
|
|
88952
|
-
const entries = await
|
|
89191
|
+
const entries = await fs34.readdir(home);
|
|
88953
89192
|
return {
|
|
88954
89193
|
check: "home",
|
|
88955
89194
|
ok: entries.length === 0,
|
|
@@ -88972,9 +89211,9 @@ function noSecretsInEnv(environment = {}) {
|
|
|
88972
89211
|
};
|
|
88973
89212
|
}
|
|
88974
89213
|
async function efsUnreadable(environment = {}) {
|
|
88975
|
-
const efs =
|
|
89214
|
+
const efs = path35.join(rootOf(environment), "mnt", "efs");
|
|
88976
89215
|
try {
|
|
88977
|
-
await
|
|
89216
|
+
await fs34.readdir(efs);
|
|
88978
89217
|
} catch (err) {
|
|
88979
89218
|
const code = isNodeError(err) ? err.code : void 0;
|
|
88980
89219
|
const denied = code === "EACCES" || code === "EPERM";
|
|
@@ -88991,9 +89230,9 @@ async function efsUnreadable(environment = {}) {
|
|
|
88991
89230
|
};
|
|
88992
89231
|
}
|
|
88993
89232
|
async function corePatternNotPiped(environment = {}) {
|
|
88994
|
-
const file =
|
|
89233
|
+
const file = path35.join(rootOf(environment), "proc", "sys", "kernel", "core_pattern");
|
|
88995
89234
|
try {
|
|
88996
|
-
const pattern = (await
|
|
89235
|
+
const pattern = (await fs34.readFile(file, "utf8")).trim();
|
|
88997
89236
|
const ok = !pattern.startsWith("|");
|
|
88998
89237
|
return {
|
|
88999
89238
|
check: "core-pattern",
|
|
@@ -89009,10 +89248,10 @@ async function corePatternNotPiped(environment = {}) {
|
|
|
89009
89248
|
}
|
|
89010
89249
|
}
|
|
89011
89250
|
async function coreLimitZero(environment = {}) {
|
|
89012
|
-
const file =
|
|
89251
|
+
const file = path35.join(rootOf(environment), "proc", "self", "limits");
|
|
89013
89252
|
let text;
|
|
89014
89253
|
try {
|
|
89015
|
-
text = await
|
|
89254
|
+
text = await fs34.readFile(file, "utf8");
|
|
89016
89255
|
} catch (err) {
|
|
89017
89256
|
return {
|
|
89018
89257
|
check: "core-limit",
|
|
@@ -89034,11 +89273,11 @@ async function socketAccessIsOthers(environment = {}) {
|
|
|
89034
89273
|
const uid = environment.uid ?? process.getuid?.();
|
|
89035
89274
|
if (uid === void 0) return fail("this platform has no process uid to compare");
|
|
89036
89275
|
const fd = environment.listenFd ?? 3;
|
|
89037
|
-
const proc =
|
|
89276
|
+
const proc = path35.join(rootOf(environment), "proc", "self");
|
|
89038
89277
|
let socketPath;
|
|
89039
89278
|
try {
|
|
89040
|
-
const inode = (await
|
|
89041
|
-
const table = await
|
|
89279
|
+
const inode = (await fs34.stat(path35.join(proc, "fd", String(fd)))).ino;
|
|
89280
|
+
const table = await fs34.readFile(path35.join(proc, "net", "unix"), "utf8");
|
|
89042
89281
|
for (const line of table.split("\n").slice(1)) {
|
|
89043
89282
|
const fields = line.trim().split(/\s+/);
|
|
89044
89283
|
if (fields[6] === String(inode) && fields.length > 7) socketPath = fields.slice(7).join(" ");
|
|
@@ -89046,12 +89285,12 @@ async function socketAccessIsOthers(environment = {}) {
|
|
|
89046
89285
|
} catch (err) {
|
|
89047
89286
|
return fail(`cannot find the socket on descriptor ${fd}: ${getErrorMessage(err)}`);
|
|
89048
89287
|
}
|
|
89049
|
-
if (socketPath === void 0 || !
|
|
89288
|
+
if (socketPath === void 0 || !path35.isAbsolute(socketPath)) {
|
|
89050
89289
|
return fail(`the socket on descriptor ${fd} is not bound to a path`);
|
|
89051
89290
|
}
|
|
89052
89291
|
let node;
|
|
89053
89292
|
try {
|
|
89054
|
-
node = await
|
|
89293
|
+
node = await fs34.lstat(socketPath);
|
|
89055
89294
|
} catch (err) {
|
|
89056
89295
|
return fail(`cannot read ${socketPath}: ${getErrorMessage(err)}`);
|
|
89057
89296
|
}
|
|
@@ -89098,8 +89337,8 @@ function tcpConnect(host, port, timeoutMs) {
|
|
|
89098
89337
|
|
|
89099
89338
|
// ../canopycms/src/worker/cms-worker.ts
|
|
89100
89339
|
function defaultStateDirectory(workspacePath) {
|
|
89101
|
-
const key = createHash2("sha256").update(
|
|
89102
|
-
return
|
|
89340
|
+
const key = createHash2("sha256").update(path36.resolve(workspacePath)).digest("hex").slice(0, 16);
|
|
89341
|
+
return path36.join(os.tmpdir(), `canopycms-worker-${key}`);
|
|
89103
89342
|
}
|
|
89104
89343
|
var MAX_REFS_LISTED = 20;
|
|
89105
89344
|
var RemoteGitKeptError = class extends Error {
|
|
@@ -89150,7 +89389,7 @@ function lockWorkerTaskDir(taskDir, lockStaleMs, options) {
|
|
|
89150
89389
|
const waitMs = options.waitMs ?? 0;
|
|
89151
89390
|
const intervalMs = Math.max(250, Math.min(5e3, Math.floor(lockStaleMs / 4)));
|
|
89152
89391
|
return import_proper_lockfile3.default.lock(taskDir, {
|
|
89153
|
-
lockfilePath:
|
|
89392
|
+
lockfilePath: path36.join(taskDir, ".worker-lock"),
|
|
89154
89393
|
stale: lockStaleMs,
|
|
89155
89394
|
onCompromised: options.onCompromised,
|
|
89156
89395
|
...waitMs > 0 ? {
|
|
@@ -89176,10 +89415,10 @@ async function readCarriedFields(taskDir) {
|
|
|
89176
89415
|
};
|
|
89177
89416
|
}
|
|
89178
89417
|
async function recordWorkerStartupFailure(options) {
|
|
89179
|
-
const taskDir =
|
|
89418
|
+
const taskDir = path36.join(options.workspacePath, ".tasks");
|
|
89180
89419
|
let release2;
|
|
89181
89420
|
try {
|
|
89182
|
-
await
|
|
89421
|
+
await fs35.mkdir(taskDir, { recursive: true });
|
|
89183
89422
|
release2 = await lockWorkerTaskDir(taskDir, 2 * (options.lockStaleMs ?? DEFAULT_LOCK_STALE_MS), {
|
|
89184
89423
|
onCompromised: (err) => workerLogError("Worker lock lost while recording a startup failure:", getErrorMessage(err))
|
|
89185
89424
|
});
|
|
@@ -89234,18 +89473,25 @@ var CmsWorker = class {
|
|
|
89234
89473
|
this.selfStopped = new Promise((resolve) => {
|
|
89235
89474
|
this.settleSelfStopped = resolve;
|
|
89236
89475
|
});
|
|
89237
|
-
this.taskDir =
|
|
89238
|
-
this.remoteGitPath =
|
|
89239
|
-
this.stateDirectory =
|
|
89476
|
+
this.taskDir = path36.join(config.workspacePath, ".tasks");
|
|
89477
|
+
this.remoteGitPath = path36.join(path36.resolve(config.workspacePath), "remote.git");
|
|
89478
|
+
this.stateDirectory = path36.resolve(
|
|
89240
89479
|
config.stateDirectory ?? defaultStateDirectory(config.workspacePath)
|
|
89241
89480
|
);
|
|
89242
|
-
this.contentBranchesPath =
|
|
89481
|
+
this.contentBranchesPath = path36.join(config.workspacePath, "content-branches");
|
|
89243
89482
|
if (config.baseBranch !== void 0) this.setBaseBranch(config.baseBranch);
|
|
89244
89483
|
this.maxTasksPerCycle = config.maxTasksPerCycle ?? 10;
|
|
89245
89484
|
this.taskTimeoutMs = config.taskTimeoutMs ?? DEFAULT_TASK_TIMEOUT;
|
|
89246
89485
|
this.gitSyncIntervalMs = config.gitSyncInterval ?? 5 * 6e4;
|
|
89486
|
+
const retentionDays = config.archivedBranchRetentionDays;
|
|
89487
|
+
if (retentionDays !== void 0 && !(Number.isInteger(retentionDays) && retentionDays > 0)) {
|
|
89488
|
+
throw new Error(
|
|
89489
|
+
`archivedBranchRetentionDays must be a positive whole number of days, not ${retentionDays}`
|
|
89490
|
+
);
|
|
89491
|
+
}
|
|
89492
|
+
this.archivedBranchRetentionDays = retentionDays;
|
|
89247
89493
|
this.maxRetries = config.maxRetries ?? DEFAULT_MAX_RETRIES2;
|
|
89248
|
-
this.lockFilePath =
|
|
89494
|
+
this.lockFilePath = path36.join(config.workspacePath, ".tasks", ".worker-lock");
|
|
89249
89495
|
this.lockStaleMs = config.lockStaleMs ?? DEFAULT_LOCK_STALE_MS;
|
|
89250
89496
|
this.drainDeadlineMs = config.drainDeadlineMs ?? DEFAULT_DRAIN_DEADLINE_MS;
|
|
89251
89497
|
this.contentRoot = config.contentRoot ?? "content";
|
|
@@ -89264,7 +89510,8 @@ var CmsWorker = class {
|
|
|
89264
89510
|
version: 1,
|
|
89265
89511
|
workerVersion: CANOPYCMS_VERSION,
|
|
89266
89512
|
startedAt: now,
|
|
89267
|
-
updatedAt: now
|
|
89513
|
+
updatedAt: now,
|
|
89514
|
+
archivedBranchRetentionDays: this.archivedBranchRetentionDays
|
|
89268
89515
|
};
|
|
89269
89516
|
}
|
|
89270
89517
|
return this.statusReport;
|
|
@@ -89317,6 +89564,7 @@ var CmsWorker = class {
|
|
|
89317
89564
|
contentBranchesPath: this.contentBranchesPath,
|
|
89318
89565
|
contentRoot: this.contentRoot,
|
|
89319
89566
|
schemaHoldMaxMs: this.schemaHoldMaxMs,
|
|
89567
|
+
archivedBranchRetentionDays: this.archivedBranchRetentionDays,
|
|
89320
89568
|
taskTimeoutMs: this.taskTimeoutMs,
|
|
89321
89569
|
gitSyncIntervalMs: this.gitSyncIntervalMs,
|
|
89322
89570
|
maxTasksPerCycle: this.maxTasksPerCycle,
|
|
@@ -89538,7 +89786,7 @@ var CmsWorker = class {
|
|
|
89538
89786
|
* is negligible at the default TTL; a badly wrong clock misjudges liveness.
|
|
89539
89787
|
*/
|
|
89540
89788
|
async acquireLock() {
|
|
89541
|
-
await
|
|
89789
|
+
await fs35.mkdir(this.taskDir, { recursive: true });
|
|
89542
89790
|
try {
|
|
89543
89791
|
this.releaseLockFn = await lockWorkerTaskDir(this.taskDir, this.lockStaleMs, {
|
|
89544
89792
|
onCompromised: (err) => {
|
|
@@ -89672,7 +89920,7 @@ var CmsWorker = class {
|
|
|
89672
89920
|
);
|
|
89673
89921
|
let remoteGitExists;
|
|
89674
89922
|
try {
|
|
89675
|
-
remoteGitExists = await
|
|
89923
|
+
remoteGitExists = await fs35.stat(this.remoteGitPath).then(
|
|
89676
89924
|
() => true,
|
|
89677
89925
|
(err) => {
|
|
89678
89926
|
if (isNodeError(err) && err.code === "ENOENT") return false;
|
|
@@ -89750,7 +89998,7 @@ var CmsWorker = class {
|
|
|
89750
89998
|
);
|
|
89751
89999
|
if (current === this.baseBranch) return;
|
|
89752
90000
|
await sharedRepoGit(gitDir, "bare").raw(["symbolic-ref", "HEAD", ref]);
|
|
89753
|
-
workerLog(`${
|
|
90001
|
+
workerLog(`${path36.basename(gitDir)} HEAD now names the base branch '${this.baseBranch}'`);
|
|
89754
90002
|
}
|
|
89755
90003
|
/**
|
|
89756
90004
|
* Whether the bare repo at `gitDir` has a local `refs/heads/<baseBranch>`.
|
|
@@ -89850,7 +90098,7 @@ var CmsWorker = class {
|
|
|
89850
90098
|
async ensureRemoteGit() {
|
|
89851
90099
|
let exists3;
|
|
89852
90100
|
try {
|
|
89853
|
-
await
|
|
90101
|
+
await fs35.stat(this.remoteGitPath);
|
|
89854
90102
|
exists3 = true;
|
|
89855
90103
|
} catch {
|
|
89856
90104
|
exists3 = false;
|
|
@@ -89870,7 +90118,7 @@ var CmsWorker = class {
|
|
|
89870
90118
|
}
|
|
89871
90119
|
workerLog("Initializing remote.git from GitHub...");
|
|
89872
90120
|
const stagingPath = await this.seedRemoteGitStaging();
|
|
89873
|
-
await
|
|
90121
|
+
await fs35.rename(stagingPath, this.remoteGitPath);
|
|
89874
90122
|
workerLog("remote.git initialized");
|
|
89875
90123
|
}
|
|
89876
90124
|
/**
|
|
@@ -89926,7 +90174,7 @@ var CmsWorker = class {
|
|
|
89926
90174
|
if (err instanceof RemoteGitKeptError) throw err;
|
|
89927
90175
|
throw notReplaced(redactCredentials(getErrorMessage(err)));
|
|
89928
90176
|
});
|
|
89929
|
-
const discardStaging = () =>
|
|
90177
|
+
const discardStaging = () => fs35.rm(stagingPath, { recursive: true, force: true });
|
|
89930
90178
|
let current;
|
|
89931
90179
|
try {
|
|
89932
90180
|
current = await listRemoteGitRefs(this.remoteGitPath);
|
|
@@ -89944,21 +90192,21 @@ var CmsWorker = class {
|
|
|
89944
90192
|
}
|
|
89945
90193
|
const replaced = `${this.remoteGitPath}.replaced-${Date.now()}`;
|
|
89946
90194
|
try {
|
|
89947
|
-
await
|
|
90195
|
+
await fs35.rename(this.remoteGitPath, replaced);
|
|
89948
90196
|
} catch (err) {
|
|
89949
90197
|
await discardStaging();
|
|
89950
90198
|
throw err;
|
|
89951
90199
|
}
|
|
89952
90200
|
try {
|
|
89953
|
-
await
|
|
90201
|
+
await fs35.rename(stagingPath, this.remoteGitPath);
|
|
89954
90202
|
} catch (err) {
|
|
89955
|
-
await
|
|
90203
|
+
await fs35.rename(replaced, this.remoteGitPath);
|
|
89956
90204
|
await discardStaging();
|
|
89957
90205
|
throw err;
|
|
89958
90206
|
}
|
|
89959
90207
|
const after = await listRemoteGitRefs(replaced).catch(() => null);
|
|
89960
90208
|
if (after !== null && sameRefs(refs, after)) {
|
|
89961
|
-
await
|
|
90209
|
+
await fs35.rm(replaced, { recursive: true, force: true, maxRetries: 3 }).catch((err) => {
|
|
89962
90210
|
workerLogWarn(
|
|
89963
90211
|
`Could not remove the replaced remote.git at ${replaced}: ${getErrorMessage(err)}`
|
|
89964
90212
|
);
|
|
@@ -89978,7 +90226,7 @@ var CmsWorker = class {
|
|
|
89978
90226
|
*/
|
|
89979
90227
|
async seedRemoteGitStaging(check) {
|
|
89980
90228
|
const stagingPath = `${this.remoteGitPath}.cloning`;
|
|
89981
|
-
await
|
|
90229
|
+
await fs35.rm(stagingPath, { recursive: true, force: true });
|
|
89982
90230
|
try {
|
|
89983
90231
|
const githubBranches = await seedFromGitHub(
|
|
89984
90232
|
this.transferContext(),
|
|
@@ -89994,7 +90242,7 @@ var CmsWorker = class {
|
|
|
89994
90242
|
if (!(err instanceof RemoteGitKeptError)) {
|
|
89995
90243
|
workerLogError(`remote.git seeding failed: ${redactCredentials(getErrorMessage(err))}`);
|
|
89996
90244
|
}
|
|
89997
|
-
await
|
|
90245
|
+
await fs35.rm(stagingPath, { recursive: true, force: true });
|
|
89998
90246
|
if (err instanceof RemoteGitKeptError) throw err;
|
|
89999
90247
|
if (err instanceof SharedRepoRefusalError) {
|
|
90000
90248
|
throw new SharedRepoRefusalError(
|
|
@@ -90103,7 +90351,7 @@ var CmsWorker = class {
|
|
|
90103
90351
|
* sanitized.
|
|
90104
90352
|
*/
|
|
90105
90353
|
branchWorkspacePath(branchRefName) {
|
|
90106
|
-
return
|
|
90354
|
+
return path36.join(this.contentBranchesPath, sanitizeBranchName(branchRefName));
|
|
90107
90355
|
}
|
|
90108
90356
|
/**
|
|
90109
90357
|
* Test-only seam: awaited inside `rebaseActiveBranches()`'s conflict round,
|
|
@@ -90178,24 +90426,24 @@ var CmsWorker = class {
|
|
|
90178
90426
|
};
|
|
90179
90427
|
|
|
90180
90428
|
// ../canopycms/src/auth/file-based-auth-cache.ts
|
|
90181
|
-
import
|
|
90182
|
-
import
|
|
90429
|
+
import fs36 from "node:fs/promises";
|
|
90430
|
+
import path37 from "node:path";
|
|
90183
90431
|
var log5 = createDebugLogger({ prefix: "FileBasedAuthCache" });
|
|
90184
90432
|
async function writeAuthCacheSnapshot(cachePath, files) {
|
|
90185
|
-
await
|
|
90433
|
+
await fs36.mkdir(cachePath, { recursive: true });
|
|
90186
90434
|
const timestamp2 = Date.now();
|
|
90187
|
-
const snapshotDir =
|
|
90188
|
-
await
|
|
90435
|
+
const snapshotDir = path37.join(cachePath, `snapshot-${timestamp2}`);
|
|
90436
|
+
await fs36.mkdir(snapshotDir, { recursive: true });
|
|
90189
90437
|
for (const [fileName, data3] of Object.entries(files)) {
|
|
90190
|
-
const tmpPath =
|
|
90191
|
-
const finalPath =
|
|
90192
|
-
await
|
|
90193
|
-
await
|
|
90194
|
-
}
|
|
90195
|
-
const currentLink =
|
|
90196
|
-
const tmpLink =
|
|
90197
|
-
await
|
|
90198
|
-
await
|
|
90438
|
+
const tmpPath = path37.join(snapshotDir, `${fileName}.tmp`);
|
|
90439
|
+
const finalPath = path37.join(snapshotDir, fileName);
|
|
90440
|
+
await fs36.writeFile(tmpPath, JSON.stringify(data3, null, 2), "utf-8");
|
|
90441
|
+
await fs36.rename(tmpPath, finalPath);
|
|
90442
|
+
}
|
|
90443
|
+
const currentLink = path37.join(cachePath, "current");
|
|
90444
|
+
const tmpLink = path37.join(cachePath, `current-${timestamp2}`);
|
|
90445
|
+
await fs36.symlink(path37.basename(snapshotDir), tmpLink);
|
|
90446
|
+
await fs36.rename(tmpLink, currentLink);
|
|
90199
90447
|
await cleanupOldSnapshots(cachePath, 2);
|
|
90200
90448
|
return snapshotDir;
|
|
90201
90449
|
}
|
|
@@ -90212,14 +90460,14 @@ async function writeAuthSnapshot(cachePath, snapshot) {
|
|
|
90212
90460
|
async function cleanupOldSnapshots(cachePath, keepCount) {
|
|
90213
90461
|
let entries;
|
|
90214
90462
|
try {
|
|
90215
|
-
entries = await
|
|
90463
|
+
entries = await fs36.readdir(cachePath);
|
|
90216
90464
|
} catch {
|
|
90217
90465
|
return;
|
|
90218
90466
|
}
|
|
90219
90467
|
const snapshots = entries.filter((e9) => e9.startsWith("snapshot-")).sort().reverse();
|
|
90220
90468
|
for (const snapshot of snapshots.slice(keepCount)) {
|
|
90221
90469
|
try {
|
|
90222
|
-
await
|
|
90470
|
+
await fs36.rm(path37.join(cachePath, snapshot), {
|
|
90223
90471
|
recursive: true,
|
|
90224
90472
|
force: true
|
|
90225
90473
|
});
|
|
@@ -90471,7 +90719,7 @@ async function completeTerminationLifecycleAction(options = {}) {
|
|
|
90471
90719
|
|
|
90472
90720
|
// worker/run.ts
|
|
90473
90721
|
init_error();
|
|
90474
|
-
import
|
|
90722
|
+
import path38 from "node:path";
|
|
90475
90723
|
|
|
90476
90724
|
// worker/github-app-auth.ts
|
|
90477
90725
|
var import_auth_app = __toESM(require_dist_node20(), 1);
|
|
@@ -94856,10 +95104,10 @@ var SessionAPI = class extends AbstractAPI {
|
|
|
94856
95104
|
*/
|
|
94857
95105
|
async getToken(sessionId, template, expiresInSeconds) {
|
|
94858
95106
|
this.requireId(sessionId);
|
|
94859
|
-
const
|
|
95107
|
+
const path39 = template ? joinPaths(basePath29, sessionId, "tokens", template) : joinPaths(basePath29, sessionId, "tokens");
|
|
94860
95108
|
const requestOptions = {
|
|
94861
95109
|
method: "POST",
|
|
94862
|
-
path:
|
|
95110
|
+
path: path39
|
|
94863
95111
|
};
|
|
94864
95112
|
if (expiresInSeconds !== void 0) {
|
|
94865
95113
|
requestOptions.bodyParams = { expires_in_seconds: expiresInSeconds };
|
|
@@ -97609,12 +97857,12 @@ function buildRequest(options) {
|
|
|
97609
97857
|
userAgent = USER_AGENT2,
|
|
97610
97858
|
skipApiVersionInUrl = false
|
|
97611
97859
|
} = options;
|
|
97612
|
-
const { path:
|
|
97860
|
+
const { path: path39, method, queryParams, headerParams, bodyParams, formData, options: opts } = requestOptions;
|
|
97613
97861
|
const { deepSnakecaseBodyParamKeys = false } = opts || {};
|
|
97614
97862
|
if (requireSecretKey) {
|
|
97615
97863
|
assertValidSecretKey(secretKey);
|
|
97616
97864
|
}
|
|
97617
|
-
const url = skipApiVersionInUrl ? joinPaths(apiUrl,
|
|
97865
|
+
const url = skipApiVersionInUrl ? joinPaths(apiUrl, path39) : joinPaths(apiUrl, apiVersion, path39);
|
|
97618
97866
|
const finalUrl = new URL(url);
|
|
97619
97867
|
if (queryParams) {
|
|
97620
97868
|
const snakecasedQueryParams = snakecase_keys_default({ ...queryParams });
|
|
@@ -100023,6 +100271,17 @@ function parseProtectedBranches(env2) {
|
|
|
100023
100271
|
function parseLegacyBranches(env2) {
|
|
100024
100272
|
return parseBranchList(env2, LEGACY_BRANCHES_ENV);
|
|
100025
100273
|
}
|
|
100274
|
+
var ARCHIVED_BRANCH_RETENTION_ENV = "CANOPYCMS_ARCHIVED_BRANCH_RETENTION_DAYS";
|
|
100275
|
+
function parseArchivedBranchRetentionDays(env2) {
|
|
100276
|
+
const raw = env2[ARCHIVED_BRANCH_RETENTION_ENV]?.trim();
|
|
100277
|
+
if (!raw) return void 0;
|
|
100278
|
+
if (!/^[1-9][0-9]*$/.test(raw)) {
|
|
100279
|
+
throw new Error(
|
|
100280
|
+
`${ARCHIVED_BRANCH_RETENTION_ENV} must be a positive whole number of days, not ${JSON.stringify(raw)}`
|
|
100281
|
+
);
|
|
100282
|
+
}
|
|
100283
|
+
return Number(raw);
|
|
100284
|
+
}
|
|
100026
100285
|
var WORKER_STATE_DIRECTORY_MISSING = 'StateDirectory=canopy-worker is not set on the worker unit, and every worker contract requires it, so the worker does not start without it. Add it to the [Service] section of canopy-worker.service (see "The worker instance" in docs/deploying-to-aws.md).';
|
|
100027
100286
|
function readRepoEnv(env2, missingStateDirectory) {
|
|
100028
100287
|
const githubOwner = env2.CANOPYCMS_GITHUB_OWNER;
|
|
@@ -100114,6 +100373,7 @@ function commonWorkerConfig(env2) {
|
|
|
100114
100373
|
return {
|
|
100115
100374
|
// Unset, CmsWorker detects it rather than assuming 'main'.
|
|
100116
100375
|
baseBranch: env2.CANOPYCMS_BASE_BRANCH || void 0,
|
|
100376
|
+
archivedBranchRetentionDays: parseArchivedBranchRetentionDays(env2),
|
|
100117
100377
|
// deploymentName is deliberately NOT passed: CmsWorker resolves it through
|
|
100118
100378
|
// resolveDeploymentName, which reads CANOPYCMS_DEPLOYMENT_NAME itself,
|
|
100119
100379
|
// applies the same env > config > 'prod' precedence as the Lambda, and
|
|
@@ -100138,7 +100398,7 @@ async function buildSingleProcessWorker(deps, workspacePath) {
|
|
|
100138
100398
|
const { githubToken, githubTokenSecret, githubAppAuth, clerkSecret } = await readWorkerCredentials(env2, deps.getSecret);
|
|
100139
100399
|
const refreshAuthCache = createClerkAuthCacheRefresher({
|
|
100140
100400
|
secret: clerkSecret,
|
|
100141
|
-
cachePath:
|
|
100401
|
+
cachePath: path38.join(workspacePath, ".cache"),
|
|
100142
100402
|
useOrganizationsAsGroups
|
|
100143
100403
|
});
|
|
100144
100404
|
const worker = deps.createWorker({
|
|
@@ -100218,7 +100478,7 @@ async function buildSplitWorker(deps, workspacePath, socketPath, onGatewayWait)
|
|
|
100218
100478
|
}
|
|
100219
100479
|
const refreshAuthCache = health.clerkConfigured ? async () => {
|
|
100220
100480
|
const snapshot = await gateway.authSnapshot();
|
|
100221
|
-
await deps.writeAuthSnapshot(
|
|
100481
|
+
await deps.writeAuthSnapshot(path38.join(workspacePath, ".cache"), snapshot);
|
|
100222
100482
|
workerLog(` ${snapshot.users.length} users, ${snapshot.groups.length} groups`);
|
|
100223
100483
|
} : void 0;
|
|
100224
100484
|
const worker = deps.createWorker({
|