canopycms-cdk 0.12.1 → 0.13.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/lambda/asset-transform/dist/handler.js +10943 -107
- package/package.json +4 -4
- package/worker/dist/index.js +1475 -679
- package/worker/dist/index.js.sha256 +1 -1
package/worker/dist/index.js
CHANGED
|
@@ -67,54 +67,54 @@ var require_polyfills = __commonJS({
|
|
|
67
67
|
}
|
|
68
68
|
var chdir;
|
|
69
69
|
module2.exports = patch;
|
|
70
|
-
function patch(
|
|
70
|
+
function patch(fs40) {
|
|
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(fs40);
|
|
73
|
+
}
|
|
74
|
+
if (!fs40.lutimes) {
|
|
75
|
+
patchLutimes(fs40);
|
|
76
|
+
}
|
|
77
|
+
fs40.chown = chownFix(fs40.chown);
|
|
78
|
+
fs40.fchown = chownFix(fs40.fchown);
|
|
79
|
+
fs40.lchown = chownFix(fs40.lchown);
|
|
80
|
+
fs40.chmod = chmodFix(fs40.chmod);
|
|
81
|
+
fs40.fchmod = chmodFix(fs40.fchmod);
|
|
82
|
+
fs40.lchmod = chmodFix(fs40.lchmod);
|
|
83
|
+
fs40.chownSync = chownFixSync(fs40.chownSync);
|
|
84
|
+
fs40.fchownSync = chownFixSync(fs40.fchownSync);
|
|
85
|
+
fs40.lchownSync = chownFixSync(fs40.lchownSync);
|
|
86
|
+
fs40.chmodSync = chmodFixSync(fs40.chmodSync);
|
|
87
|
+
fs40.fchmodSync = chmodFixSync(fs40.fchmodSync);
|
|
88
|
+
fs40.lchmodSync = chmodFixSync(fs40.lchmodSync);
|
|
89
|
+
fs40.stat = statFix(fs40.stat);
|
|
90
|
+
fs40.fstat = statFix(fs40.fstat);
|
|
91
|
+
fs40.lstat = statFix(fs40.lstat);
|
|
92
|
+
fs40.statSync = statFixSync(fs40.statSync);
|
|
93
|
+
fs40.fstatSync = statFixSync(fs40.fstatSync);
|
|
94
|
+
fs40.lstatSync = statFixSync(fs40.lstatSync);
|
|
95
|
+
if (fs40.chmod && !fs40.lchmod) {
|
|
96
|
+
fs40.lchmod = function(path44, mode, cb) {
|
|
97
97
|
if (cb) process.nextTick(cb);
|
|
98
98
|
};
|
|
99
|
-
|
|
99
|
+
fs40.lchmodSync = function() {
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
-
if (
|
|
103
|
-
|
|
102
|
+
if (fs40.chown && !fs40.lchown) {
|
|
103
|
+
fs40.lchown = function(path44, uid, gid, cb) {
|
|
104
104
|
if (cb) process.nextTick(cb);
|
|
105
105
|
};
|
|
106
|
-
|
|
106
|
+
fs40.lchownSync = function() {
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
109
|
if (platform2 === "win32") {
|
|
110
|
-
|
|
110
|
+
fs40.rename = typeof fs40.rename !== "function" ? fs40.rename : (function(fs$rename) {
|
|
111
111
|
function rename(from, to, cb) {
|
|
112
112
|
var start2 = 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() - start2 < 6e4) {
|
|
116
116
|
setTimeout(function() {
|
|
117
|
-
|
|
117
|
+
fs40.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
|
+
})(fs40.rename);
|
|
134
134
|
}
|
|
135
|
-
|
|
135
|
+
fs40.read = typeof fs40.read !== "function" ? fs40.read : (function(fs$read) {
|
|
136
136
|
function read(fd, buffer, offset2, length, position2, 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(fs40, fd, buffer, offset2, length, position2, callback);
|
|
144
144
|
}
|
|
145
145
|
callback_.apply(this, arguments);
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
|
-
return fs$read.call(
|
|
148
|
+
return fs$read.call(fs40, fd, buffer, offset2, length, position2, callback);
|
|
149
149
|
}
|
|
150
150
|
if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
|
|
151
151
|
return read;
|
|
152
|
-
})(
|
|
153
|
-
|
|
152
|
+
})(fs40.read);
|
|
153
|
+
fs40.readSync = typeof fs40.readSync !== "function" ? fs40.readSync : /* @__PURE__ */ (function(fs$readSync) {
|
|
154
154
|
return function(fd, buffer, offset2, length, position2) {
|
|
155
155
|
var eagCounter = 0;
|
|
156
156
|
while (true) {
|
|
157
157
|
try {
|
|
158
|
-
return fs$readSync.call(
|
|
158
|
+
return fs$readSync.call(fs40, fd, buffer, offset2, length, position2);
|
|
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
|
+
})(fs40.readSync);
|
|
169
|
+
function patchLchmod(fs41) {
|
|
170
|
+
fs41.lchmod = function(path44, mode, callback) {
|
|
171
|
+
fs41.open(
|
|
172
|
+
path44,
|
|
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
|
+
fs41.fchmod(fd, mode, function(err2) {
|
|
181
|
+
fs41.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
|
+
fs41.lchmodSync = function(path44, mode) {
|
|
189
|
+
var fd = fs41.openSync(path44, constants2.O_WRONLY | constants2.O_SYMLINK, mode);
|
|
190
190
|
var threw = true;
|
|
191
191
|
var ret;
|
|
192
192
|
try {
|
|
193
|
-
ret =
|
|
193
|
+
ret = fs41.fchmodSync(fd, mode);
|
|
194
194
|
threw = false;
|
|
195
195
|
} finally {
|
|
196
196
|
if (threw) {
|
|
197
197
|
try {
|
|
198
|
-
|
|
198
|
+
fs41.closeSync(fd);
|
|
199
199
|
} catch (er) {
|
|
200
200
|
}
|
|
201
201
|
} else {
|
|
202
|
-
|
|
202
|
+
fs41.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(fs41) {
|
|
209
|
+
if (constants2.hasOwnProperty("O_SYMLINK") && fs41.futimes) {
|
|
210
|
+
fs41.lutimes = function(path44, at2, mt, cb) {
|
|
211
|
+
fs41.open(path44, constants2.O_SYMLINK, function(er, fd) {
|
|
212
212
|
if (er) {
|
|
213
213
|
if (cb) cb(er);
|
|
214
214
|
return;
|
|
215
215
|
}
|
|
216
|
-
|
|
217
|
-
|
|
216
|
+
fs41.futimes(fd, at2, mt, function(er2) {
|
|
217
|
+
fs41.close(fd, function(er22) {
|
|
218
218
|
if (cb) cb(er2 || er22);
|
|
219
219
|
});
|
|
220
220
|
});
|
|
221
221
|
});
|
|
222
222
|
};
|
|
223
|
-
|
|
224
|
-
var fd =
|
|
223
|
+
fs41.lutimesSync = function(path44, at2, mt) {
|
|
224
|
+
var fd = fs41.openSync(path44, constants2.O_SYMLINK);
|
|
225
225
|
var ret;
|
|
226
226
|
var threw = true;
|
|
227
227
|
try {
|
|
228
|
-
ret =
|
|
228
|
+
ret = fs41.futimesSync(fd, at2, mt);
|
|
229
229
|
threw = false;
|
|
230
230
|
} finally {
|
|
231
231
|
if (threw) {
|
|
232
232
|
try {
|
|
233
|
-
|
|
233
|
+
fs41.closeSync(fd);
|
|
234
234
|
} catch (er) {
|
|
235
235
|
}
|
|
236
236
|
} else {
|
|
237
|
-
|
|
237
|
+
fs41.closeSync(fd);
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
return ret;
|
|
241
241
|
};
|
|
242
|
-
} else if (
|
|
243
|
-
|
|
242
|
+
} else if (fs41.futimes) {
|
|
243
|
+
fs41.lutimes = function(_a4, _b, _c9, cb) {
|
|
244
244
|
if (cb) process.nextTick(cb);
|
|
245
245
|
};
|
|
246
|
-
|
|
246
|
+
fs41.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(fs40, 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(fs40, 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(fs40, 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(fs40, 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 options2 ? orig.call(
|
|
302
|
+
return options2 ? orig.call(fs40, target, options2, callback) : orig.call(fs40, target, callback);
|
|
303
303
|
};
|
|
304
304
|
}
|
|
305
305
|
function statFixSync(orig) {
|
|
306
306
|
if (!orig) return orig;
|
|
307
307
|
return function(target, options2) {
|
|
308
|
-
var stats = options2 ? orig.call(
|
|
308
|
+
var stats = options2 ? orig.call(fs40, target, options2) : orig.call(fs40, 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"(exports2, module2) {
|
|
335
335
|
var Stream = __require("stream").Stream;
|
|
336
336
|
module2.exports = legacy;
|
|
337
|
-
function legacy(
|
|
337
|
+
function legacy(fs40) {
|
|
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(path44, options2) {
|
|
343
|
+
if (!(this instanceof ReadStream2)) return new ReadStream2(path44, options2);
|
|
344
344
|
Stream.call(this);
|
|
345
345
|
var self2 = this;
|
|
346
|
-
this.path =
|
|
346
|
+
this.path = path44;
|
|
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
|
+
fs40.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(path44, options2) {
|
|
392
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path44, options2);
|
|
393
393
|
Stream.call(this);
|
|
394
|
-
this.path =
|
|
394
|
+
this.path = path44;
|
|
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 = fs40.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"(exports2, module2) {
|
|
454
|
-
var
|
|
454
|
+
var fs40 = __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 (!fs40[gracefulQueue]) {
|
|
487
487
|
queue = global[gracefulQueue] || [];
|
|
488
|
-
publishQueue(
|
|
489
|
-
|
|
488
|
+
publishQueue(fs40, queue);
|
|
489
|
+
fs40.close = (function(fs$close) {
|
|
490
490
|
function close(fd, cb) {
|
|
491
|
-
return fs$close.call(
|
|
491
|
+
return fs$close.call(fs40, 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
|
+
})(fs40.close);
|
|
504
|
+
fs40.closeSync = (function(fs$closeSync) {
|
|
505
505
|
function closeSync(fd) {
|
|
506
|
-
fs$closeSync.apply(
|
|
506
|
+
fs$closeSync.apply(fs40, 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
|
+
})(fs40.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(fs40[gracefulQueue]);
|
|
517
|
+
__require("assert").equal(fs40[gracefulQueue].length, 0);
|
|
518
518
|
});
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
521
|
var queue;
|
|
522
522
|
if (!global[gracefulQueue]) {
|
|
523
|
-
publishQueue(global,
|
|
524
|
-
}
|
|
525
|
-
module2.exports = patch(clone(
|
|
526
|
-
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !
|
|
527
|
-
module2.exports = patch(
|
|
528
|
-
|
|
529
|
-
}
|
|
530
|
-
function patch(
|
|
531
|
-
polyfills(
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
var fs$readFile =
|
|
536
|
-
|
|
537
|
-
function readFile3(
|
|
523
|
+
publishQueue(global, fs40[gracefulQueue]);
|
|
524
|
+
}
|
|
525
|
+
module2.exports = patch(clone(fs40));
|
|
526
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs40.__patched) {
|
|
527
|
+
module2.exports = patch(fs40);
|
|
528
|
+
fs40.__patched = true;
|
|
529
|
+
}
|
|
530
|
+
function patch(fs41) {
|
|
531
|
+
polyfills(fs41);
|
|
532
|
+
fs41.gracefulify = patch;
|
|
533
|
+
fs41.createReadStream = createReadStream;
|
|
534
|
+
fs41.createWriteStream = createWriteStream;
|
|
535
|
+
var fs$readFile = fs41.readFile;
|
|
536
|
+
fs41.readFile = readFile3;
|
|
537
|
+
function readFile3(path44, options2, cb) {
|
|
538
538
|
if (typeof options2 === "function")
|
|
539
539
|
cb = options2, options2 = null;
|
|
540
|
-
return go$readFile(
|
|
541
|
-
function go$readFile(
|
|
542
|
-
return fs$readFile(
|
|
540
|
+
return go$readFile(path44, options2, cb);
|
|
541
|
+
function go$readFile(path45, options3, cb2, startTime) {
|
|
542
|
+
return fs$readFile(path45, options3, function(err) {
|
|
543
543
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
544
|
-
enqueue([go$readFile, [
|
|
544
|
+
enqueue([go$readFile, [path45, options3, 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 = fs41.writeFile;
|
|
553
|
+
fs41.writeFile = writeFile;
|
|
554
|
+
function writeFile(path44, data4, options2, cb) {
|
|
555
555
|
if (typeof options2 === "function")
|
|
556
556
|
cb = options2, options2 = null;
|
|
557
|
-
return go$writeFile(
|
|
558
|
-
function go$writeFile(
|
|
559
|
-
return fs$writeFile(
|
|
557
|
+
return go$writeFile(path44, data4, options2, cb);
|
|
558
|
+
function go$writeFile(path45, data5, options3, cb2, startTime) {
|
|
559
|
+
return fs$writeFile(path45, data5, options3, function(err) {
|
|
560
560
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
561
|
-
enqueue([go$writeFile, [
|
|
561
|
+
enqueue([go$writeFile, [path45, data5, options3, 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 = fs41.appendFile;
|
|
570
570
|
if (fs$appendFile)
|
|
571
|
-
|
|
572
|
-
function appendFile(
|
|
571
|
+
fs41.appendFile = appendFile;
|
|
572
|
+
function appendFile(path44, data4, options2, cb) {
|
|
573
573
|
if (typeof options2 === "function")
|
|
574
574
|
cb = options2, options2 = null;
|
|
575
|
-
return go$appendFile(
|
|
576
|
-
function go$appendFile(
|
|
577
|
-
return fs$appendFile(
|
|
575
|
+
return go$appendFile(path44, data4, options2, cb);
|
|
576
|
+
function go$appendFile(path45, data5, options3, cb2, startTime) {
|
|
577
|
+
return fs$appendFile(path45, data5, options3, function(err) {
|
|
578
578
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
579
|
-
enqueue([go$appendFile, [
|
|
579
|
+
enqueue([go$appendFile, [path45, data5, options3, 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 = fs41.copyFile;
|
|
588
588
|
if (fs$copyFile)
|
|
589
|
-
|
|
589
|
+
fs41.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 = fs41.readdir;
|
|
608
|
+
fs41.readdir = readdir;
|
|
609
609
|
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
610
|
-
function readdir(
|
|
610
|
+
function readdir(path44, options2, cb) {
|
|
611
611
|
if (typeof options2 === "function")
|
|
612
612
|
cb = options2, options2 = 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(path45, options3, cb2, startTime) {
|
|
614
|
+
return fs$readdir(path45, fs$readdirCallback(
|
|
615
|
+
path45,
|
|
616
616
|
options3,
|
|
617
617
|
cb2,
|
|
618
618
|
startTime
|
|
619
619
|
));
|
|
620
|
-
} : function go$readdir2(
|
|
621
|
-
return fs$readdir(
|
|
622
|
-
|
|
620
|
+
} : function go$readdir2(path45, options3, cb2, startTime) {
|
|
621
|
+
return fs$readdir(path45, options3, fs$readdirCallback(
|
|
622
|
+
path45,
|
|
623
623
|
options3,
|
|
624
624
|
cb2,
|
|
625
625
|
startTime
|
|
626
626
|
));
|
|
627
627
|
};
|
|
628
|
-
return go$readdir(
|
|
629
|
-
function fs$readdirCallback(
|
|
628
|
+
return go$readdir(path44, options2, cb);
|
|
629
|
+
function fs$readdirCallback(path45, options3, 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
|
+
[path45, options3, 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(fs41);
|
|
650
650
|
ReadStream2 = legStreams.ReadStream;
|
|
651
651
|
WriteStream = legStreams.WriteStream;
|
|
652
652
|
}
|
|
653
|
-
var fs$ReadStream =
|
|
653
|
+
var fs$ReadStream = fs41.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 = fs41.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(fs41, "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(fs41, "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(fs41, "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(fs41, "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(path44, options2) {
|
|
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(path44, options2) {
|
|
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(path44, options2) {
|
|
744
|
+
return new fs41.ReadStream(path44, options2);
|
|
745
745
|
}
|
|
746
|
-
function createWriteStream(
|
|
747
|
-
return new
|
|
746
|
+
function createWriteStream(path44, options2) {
|
|
747
|
+
return new fs41.WriteStream(path44, options2);
|
|
748
748
|
}
|
|
749
|
-
var fs$open =
|
|
750
|
-
|
|
751
|
-
function open(
|
|
749
|
+
var fs$open = fs41.open;
|
|
750
|
+
fs41.open = open;
|
|
751
|
+
function open(path44, 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(path44, flags, mode, cb);
|
|
755
|
+
function go$open(path45, flags2, mode2, cb2, startTime) {
|
|
756
|
+
return fs$open(path45, flags2, mode2, function(err, fd) {
|
|
757
757
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
758
|
-
enqueue([go$open, [
|
|
758
|
+
enqueue([go$open, [path45, 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 fs41;
|
|
767
767
|
}
|
|
768
768
|
function enqueue(elem) {
|
|
769
769
|
debug2("ENQUEUE", elem[0].name, elem[1]);
|
|
770
|
-
|
|
770
|
+
fs40[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 < fs40[gracefulQueue].length; ++i10) {
|
|
777
|
+
if (fs40[gracefulQueue][i10].length > 2) {
|
|
778
|
+
fs40[gracefulQueue][i10][3] = now;
|
|
779
|
+
fs40[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 (fs40[gracefulQueue].length === 0)
|
|
788
788
|
return;
|
|
789
|
-
var elem =
|
|
789
|
+
var elem = fs40[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
|
+
fs40[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"(exports2, module2) {
|
|
1244
1244
|
"use strict";
|
|
1245
1245
|
var cacheSymbol = Symbol();
|
|
1246
|
-
function probe(file,
|
|
1247
|
-
const cachedPrecision =
|
|
1246
|
+
function probe(file, fs40, callback) {
|
|
1247
|
+
const cachedPrecision = fs40[cacheSymbol];
|
|
1248
1248
|
if (cachedPrecision) {
|
|
1249
|
-
return
|
|
1249
|
+
return fs40.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
|
+
fs40.utimes(file, mtime, mtime, (err) => {
|
|
1258
1258
|
if (err) {
|
|
1259
1259
|
return callback(err);
|
|
1260
1260
|
}
|
|
1261
|
-
|
|
1261
|
+
fs40.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(fs40, 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"(exports2, module2) {
|
|
1286
1286
|
"use strict";
|
|
1287
|
-
var
|
|
1288
|
-
var
|
|
1287
|
+
var path44 = __require("path");
|
|
1288
|
+
var fs40 = 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, options2, callback) {
|
|
1297
1297
|
if (!options2.realpath) {
|
|
1298
|
-
return callback(null,
|
|
1298
|
+
return callback(null, path44.resolve(file));
|
|
1299
1299
|
}
|
|
1300
1300
|
options2.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: fs40,
|
|
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, options2, callback) {
|
|
1462
1462
|
options2 = {
|
|
1463
|
-
fs:
|
|
1463
|
+
fs: fs40,
|
|
1464
1464
|
realpath: true,
|
|
1465
1465
|
...options2
|
|
1466
1466
|
};
|
|
@@ -1482,7 +1482,7 @@ var require_lockfile = __commonJS({
|
|
|
1482
1482
|
options2 = {
|
|
1483
1483
|
stale: 1e4,
|
|
1484
1484
|
realpath: true,
|
|
1485
|
-
fs:
|
|
1485
|
+
fs: fs40,
|
|
1486
1486
|
...options2
|
|
1487
1487
|
};
|
|
1488
1488
|
options2.stale = Math.max(options2.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"(exports2, module2) {
|
|
1523
1523
|
"use strict";
|
|
1524
|
-
var
|
|
1525
|
-
function createSyncFs(
|
|
1524
|
+
var fs40 = require_graceful_fs();
|
|
1525
|
+
function createSyncFs(fs41) {
|
|
1526
1526
|
const methods = ["mkdir", "realpath", "stat", "rmdir", "utimes"];
|
|
1527
|
-
const newFs = { ...
|
|
1527
|
+
const newFs = { ...fs41 };
|
|
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 = fs41[`${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(options2) {
|
|
1570
1570
|
options2 = { ...options2 };
|
|
1571
|
-
options2.fs = createSyncFs(options2.fs ||
|
|
1571
|
+
options2.fs = createSyncFs(options2.fs || fs40);
|
|
1572
1572
|
if (typeof options2.retries === "number" && options2.retries > 0 || options2.retries && typeof options2.retries.retries === "number" && options2.retries.retries > 0) {
|
|
1573
1573
|
throw Object.assign(new Error("Cannot use retries with the sync api"), { code: "ESYNC" });
|
|
1574
1574
|
}
|
|
@@ -2544,10 +2544,10 @@ var require_src2 = __commonJS({
|
|
|
2544
2544
|
var fs_1 = __require("fs");
|
|
2545
2545
|
var debug_1 = __importDefault2(require_src());
|
|
2546
2546
|
var log11 = debug_1.default("@kwsites/file-exists");
|
|
2547
|
-
function check(
|
|
2548
|
-
log11(`checking %s`,
|
|
2547
|
+
function check(path44, isFile, isDirectory) {
|
|
2548
|
+
log11(`checking %s`, path44);
|
|
2549
2549
|
try {
|
|
2550
|
-
const stat = fs_1.statSync(
|
|
2550
|
+
const stat = fs_1.statSync(path44);
|
|
2551
2551
|
if (stat.isFile() && isFile) {
|
|
2552
2552
|
log11(`[OK] path represents a file`);
|
|
2553
2553
|
return true;
|
|
@@ -2567,8 +2567,8 @@ var require_src2 = __commonJS({
|
|
|
2567
2567
|
throw e9;
|
|
2568
2568
|
}
|
|
2569
2569
|
}
|
|
2570
|
-
function exists3(
|
|
2571
|
-
return check(
|
|
2570
|
+
function exists3(path44, type = exports2.READABLE) {
|
|
2571
|
+
return check(path44, (type & exports2.FILE) > 0, (type & exports2.FOLDER) > 0);
|
|
2572
2572
|
}
|
|
2573
2573
|
exports2.exists = exists3;
|
|
2574
2574
|
exports2.FILE = 1;
|
|
@@ -3061,8 +3061,8 @@ var init_parseUtil = __esm({
|
|
|
3061
3061
|
init_errors();
|
|
3062
3062
|
init_en();
|
|
3063
3063
|
makeIssue = (params) => {
|
|
3064
|
-
const { data: data4, path:
|
|
3065
|
-
const fullPath = [...
|
|
3064
|
+
const { data: data4, path: path44, errorMaps, issueData } = params;
|
|
3065
|
+
const fullPath = [...path44, ...issueData.path || []];
|
|
3066
3066
|
const fullIssue = {
|
|
3067
3067
|
...issueData,
|
|
3068
3068
|
path: fullPath
|
|
@@ -3370,11 +3370,11 @@ var init_types = __esm({
|
|
|
3370
3370
|
init_parseUtil();
|
|
3371
3371
|
init_util2();
|
|
3372
3372
|
ParseInputLazyPath = class {
|
|
3373
|
-
constructor(parent, value,
|
|
3373
|
+
constructor(parent, value, path44, key) {
|
|
3374
3374
|
this._cachedPath = [];
|
|
3375
3375
|
this.parent = parent;
|
|
3376
3376
|
this.data = value;
|
|
3377
|
-
this._path =
|
|
3377
|
+
this._path = path44;
|
|
3378
3378
|
this._key = key;
|
|
3379
3379
|
}
|
|
3380
3380
|
get path() {
|
|
@@ -7037,8 +7037,8 @@ var init_branch_name = __esm({
|
|
|
7037
7037
|
});
|
|
7038
7038
|
|
|
7039
7039
|
// ../canopycms/src/paths/normalize.ts
|
|
7040
|
-
function normalizeFilesystemPath(
|
|
7041
|
-
return
|
|
7040
|
+
function normalizeFilesystemPath(path44) {
|
|
7041
|
+
return path44.split(/[\\/]+/).filter(Boolean).join("/");
|
|
7042
7042
|
}
|
|
7043
7043
|
function entryLogicalPath(collectionLogicalPath, slug) {
|
|
7044
7044
|
return collectionLogicalPath ? `${collectionLogicalPath}/${slug}` : slug;
|
|
@@ -8470,15 +8470,15 @@ var require_dist_node9 = __commonJS({
|
|
|
8470
8470
|
octokit.log.debug("request", options2);
|
|
8471
8471
|
const start2 = Date.now();
|
|
8472
8472
|
const requestOptions = octokit.request.endpoint.parse(options2);
|
|
8473
|
-
const
|
|
8473
|
+
const path44 = requestOptions.url.replace(options2.baseUrl, "");
|
|
8474
8474
|
return request(options2).then((response) => {
|
|
8475
8475
|
octokit.log.info(
|
|
8476
|
-
`${requestOptions.method} ${
|
|
8476
|
+
`${requestOptions.method} ${path44} - ${response.status} in ${Date.now() - start2}ms`
|
|
8477
8477
|
);
|
|
8478
8478
|
return response;
|
|
8479
8479
|
}).catch((error3) => {
|
|
8480
8480
|
octokit.log.info(
|
|
8481
|
-
`${requestOptions.method} ${
|
|
8481
|
+
`${requestOptions.method} ${path44} - ${error3.status} in ${Date.now() - start2}ms`
|
|
8482
8482
|
);
|
|
8483
8483
|
throw error3;
|
|
8484
8484
|
});
|
|
@@ -12572,7 +12572,7 @@ var require_dist_node13 = __commonJS({
|
|
|
12572
12572
|
];
|
|
12573
12573
|
function routeMatcher(paths) {
|
|
12574
12574
|
const regexes = paths.map(
|
|
12575
|
-
(
|
|
12575
|
+
(path44) => path44.split("/").map((c11) => c11.startsWith("{") ? "(?:.+?)" : c11).join("/")
|
|
12576
12576
|
);
|
|
12577
12577
|
const regex2 = `^(?:${regexes.map((r10) => `(?:${r10})`).join("|")})[^/]*$`;
|
|
12578
12578
|
return new RegExp(regex2, "i");
|
|
@@ -12959,17 +12959,17 @@ var require_visit = __commonJS({
|
|
|
12959
12959
|
visit4.BREAK = BREAK;
|
|
12960
12960
|
visit4.SKIP = SKIP3;
|
|
12961
12961
|
visit4.REMOVE = REMOVE;
|
|
12962
|
-
function visit_(key, node2, visitor,
|
|
12963
|
-
const ctrl = callVisitor(key, node2, visitor,
|
|
12962
|
+
function visit_(key, node2, visitor, path44) {
|
|
12963
|
+
const ctrl = callVisitor(key, node2, visitor, path44);
|
|
12964
12964
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
12965
|
-
replaceNode(key,
|
|
12966
|
-
return visit_(key, ctrl, visitor,
|
|
12965
|
+
replaceNode(key, path44, ctrl);
|
|
12966
|
+
return visit_(key, ctrl, visitor, path44);
|
|
12967
12967
|
}
|
|
12968
12968
|
if (typeof ctrl !== "symbol") {
|
|
12969
12969
|
if (identity.isCollection(node2)) {
|
|
12970
|
-
|
|
12970
|
+
path44 = Object.freeze(path44.concat(node2));
|
|
12971
12971
|
for (let i10 = 0; i10 < node2.items.length; ++i10) {
|
|
12972
|
-
const ci = visit_(i10, node2.items[i10], visitor,
|
|
12972
|
+
const ci = visit_(i10, node2.items[i10], visitor, path44);
|
|
12973
12973
|
if (typeof ci === "number")
|
|
12974
12974
|
i10 = ci - 1;
|
|
12975
12975
|
else if (ci === BREAK)
|
|
@@ -12980,13 +12980,13 @@ var require_visit = __commonJS({
|
|
|
12980
12980
|
}
|
|
12981
12981
|
}
|
|
12982
12982
|
} else if (identity.isPair(node2)) {
|
|
12983
|
-
|
|
12984
|
-
const ck = visit_("key", node2.key, visitor,
|
|
12983
|
+
path44 = Object.freeze(path44.concat(node2));
|
|
12984
|
+
const ck = visit_("key", node2.key, visitor, path44);
|
|
12985
12985
|
if (ck === BREAK)
|
|
12986
12986
|
return BREAK;
|
|
12987
12987
|
else if (ck === REMOVE)
|
|
12988
12988
|
node2.key = null;
|
|
12989
|
-
const cv = visit_("value", node2.value, visitor,
|
|
12989
|
+
const cv = visit_("value", node2.value, visitor, path44);
|
|
12990
12990
|
if (cv === BREAK)
|
|
12991
12991
|
return BREAK;
|
|
12992
12992
|
else if (cv === REMOVE)
|
|
@@ -13007,17 +13007,17 @@ var require_visit = __commonJS({
|
|
|
13007
13007
|
visitAsync.BREAK = BREAK;
|
|
13008
13008
|
visitAsync.SKIP = SKIP3;
|
|
13009
13009
|
visitAsync.REMOVE = REMOVE;
|
|
13010
|
-
async function visitAsync_(key, node2, visitor,
|
|
13011
|
-
const ctrl = await callVisitor(key, node2, visitor,
|
|
13010
|
+
async function visitAsync_(key, node2, visitor, path44) {
|
|
13011
|
+
const ctrl = await callVisitor(key, node2, visitor, path44);
|
|
13012
13012
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
13013
|
-
replaceNode(key,
|
|
13014
|
-
return visitAsync_(key, ctrl, visitor,
|
|
13013
|
+
replaceNode(key, path44, ctrl);
|
|
13014
|
+
return visitAsync_(key, ctrl, visitor, path44);
|
|
13015
13015
|
}
|
|
13016
13016
|
if (typeof ctrl !== "symbol") {
|
|
13017
13017
|
if (identity.isCollection(node2)) {
|
|
13018
|
-
|
|
13018
|
+
path44 = Object.freeze(path44.concat(node2));
|
|
13019
13019
|
for (let i10 = 0; i10 < node2.items.length; ++i10) {
|
|
13020
|
-
const ci = await visitAsync_(i10, node2.items[i10], visitor,
|
|
13020
|
+
const ci = await visitAsync_(i10, node2.items[i10], visitor, path44);
|
|
13021
13021
|
if (typeof ci === "number")
|
|
13022
13022
|
i10 = ci - 1;
|
|
13023
13023
|
else if (ci === BREAK)
|
|
@@ -13028,13 +13028,13 @@ var require_visit = __commonJS({
|
|
|
13028
13028
|
}
|
|
13029
13029
|
}
|
|
13030
13030
|
} else if (identity.isPair(node2)) {
|
|
13031
|
-
|
|
13032
|
-
const ck = await visitAsync_("key", node2.key, visitor,
|
|
13031
|
+
path44 = Object.freeze(path44.concat(node2));
|
|
13032
|
+
const ck = await visitAsync_("key", node2.key, visitor, path44);
|
|
13033
13033
|
if (ck === BREAK)
|
|
13034
13034
|
return BREAK;
|
|
13035
13035
|
else if (ck === REMOVE)
|
|
13036
13036
|
node2.key = null;
|
|
13037
|
-
const cv = await visitAsync_("value", node2.value, visitor,
|
|
13037
|
+
const cv = await visitAsync_("value", node2.value, visitor, path44);
|
|
13038
13038
|
if (cv === BREAK)
|
|
13039
13039
|
return BREAK;
|
|
13040
13040
|
else if (cv === REMOVE)
|
|
@@ -13061,23 +13061,23 @@ var require_visit = __commonJS({
|
|
|
13061
13061
|
}
|
|
13062
13062
|
return visitor;
|
|
13063
13063
|
}
|
|
13064
|
-
function callVisitor(key, node2, visitor,
|
|
13064
|
+
function callVisitor(key, node2, visitor, path44) {
|
|
13065
13065
|
if (typeof visitor === "function")
|
|
13066
|
-
return visitor(key, node2,
|
|
13066
|
+
return visitor(key, node2, path44);
|
|
13067
13067
|
if (identity.isMap(node2))
|
|
13068
|
-
return visitor.Map?.(key, node2,
|
|
13068
|
+
return visitor.Map?.(key, node2, path44);
|
|
13069
13069
|
if (identity.isSeq(node2))
|
|
13070
|
-
return visitor.Seq?.(key, node2,
|
|
13070
|
+
return visitor.Seq?.(key, node2, path44);
|
|
13071
13071
|
if (identity.isPair(node2))
|
|
13072
|
-
return visitor.Pair?.(key, node2,
|
|
13072
|
+
return visitor.Pair?.(key, node2, path44);
|
|
13073
13073
|
if (identity.isScalar(node2))
|
|
13074
|
-
return visitor.Scalar?.(key, node2,
|
|
13074
|
+
return visitor.Scalar?.(key, node2, path44);
|
|
13075
13075
|
if (identity.isAlias(node2))
|
|
13076
|
-
return visitor.Alias?.(key, node2,
|
|
13076
|
+
return visitor.Alias?.(key, node2, path44);
|
|
13077
13077
|
return void 0;
|
|
13078
13078
|
}
|
|
13079
|
-
function replaceNode(key,
|
|
13080
|
-
const parent =
|
|
13079
|
+
function replaceNode(key, path44, node2) {
|
|
13080
|
+
const parent = path44[path44.length - 1];
|
|
13081
13081
|
if (identity.isCollection(parent)) {
|
|
13082
13082
|
parent.items[key] = node2;
|
|
13083
13083
|
} else if (identity.isPair(parent)) {
|
|
@@ -13685,10 +13685,10 @@ var require_Collection = __commonJS({
|
|
|
13685
13685
|
var createNode2 = require_createNode();
|
|
13686
13686
|
var identity = require_identity();
|
|
13687
13687
|
var Node3 = require_Node();
|
|
13688
|
-
function collectionFromPath(schema,
|
|
13688
|
+
function collectionFromPath(schema, path44, value) {
|
|
13689
13689
|
let v5 = value;
|
|
13690
|
-
for (let i10 =
|
|
13691
|
-
const k10 =
|
|
13690
|
+
for (let i10 = path44.length - 1; i10 >= 0; --i10) {
|
|
13691
|
+
const k10 = path44[i10];
|
|
13692
13692
|
if (typeof k10 === "number" && Number.isInteger(k10) && k10 >= 0) {
|
|
13693
13693
|
const a9 = [];
|
|
13694
13694
|
a9[k10] = v5;
|
|
@@ -13707,7 +13707,7 @@ var require_Collection = __commonJS({
|
|
|
13707
13707
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
13708
13708
|
});
|
|
13709
13709
|
}
|
|
13710
|
-
var isEmptyPath = (
|
|
13710
|
+
var isEmptyPath = (path44) => path44 == null || typeof path44 === "object" && !!path44[Symbol.iterator]().next().done;
|
|
13711
13711
|
var Collection = class extends Node3.NodeBase {
|
|
13712
13712
|
constructor(type, schema) {
|
|
13713
13713
|
super(type);
|
|
@@ -13737,11 +13737,11 @@ var require_Collection = __commonJS({
|
|
|
13737
13737
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
13738
13738
|
* that already exists in the map.
|
|
13739
13739
|
*/
|
|
13740
|
-
addIn(
|
|
13741
|
-
if (isEmptyPath(
|
|
13740
|
+
addIn(path44, value) {
|
|
13741
|
+
if (isEmptyPath(path44))
|
|
13742
13742
|
this.add(value);
|
|
13743
13743
|
else {
|
|
13744
|
-
const [key, ...rest] =
|
|
13744
|
+
const [key, ...rest] = path44;
|
|
13745
13745
|
const node2 = this.get(key, true);
|
|
13746
13746
|
if (identity.isCollection(node2))
|
|
13747
13747
|
node2.addIn(rest, value);
|
|
@@ -13755,8 +13755,8 @@ var require_Collection = __commonJS({
|
|
|
13755
13755
|
* Removes a value from the collection.
|
|
13756
13756
|
* @returns `true` if the item was found and removed.
|
|
13757
13757
|
*/
|
|
13758
|
-
deleteIn(
|
|
13759
|
-
const [key, ...rest] =
|
|
13758
|
+
deleteIn(path44) {
|
|
13759
|
+
const [key, ...rest] = path44;
|
|
13760
13760
|
if (rest.length === 0)
|
|
13761
13761
|
return this.delete(key);
|
|
13762
13762
|
const node2 = this.get(key, true);
|
|
@@ -13770,8 +13770,8 @@ var require_Collection = __commonJS({
|
|
|
13770
13770
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
13771
13771
|
* `true` (collections are always returned intact).
|
|
13772
13772
|
*/
|
|
13773
|
-
getIn(
|
|
13774
|
-
const [key, ...rest] =
|
|
13773
|
+
getIn(path44, keepScalar) {
|
|
13774
|
+
const [key, ...rest] = path44;
|
|
13775
13775
|
const node2 = this.get(key, true);
|
|
13776
13776
|
if (rest.length === 0)
|
|
13777
13777
|
return !keepScalar && identity.isScalar(node2) ? node2.value : node2;
|
|
@@ -13789,8 +13789,8 @@ var require_Collection = __commonJS({
|
|
|
13789
13789
|
/**
|
|
13790
13790
|
* Checks if the collection includes a value with the key `key`.
|
|
13791
13791
|
*/
|
|
13792
|
-
hasIn(
|
|
13793
|
-
const [key, ...rest] =
|
|
13792
|
+
hasIn(path44) {
|
|
13793
|
+
const [key, ...rest] = path44;
|
|
13794
13794
|
if (rest.length === 0)
|
|
13795
13795
|
return this.has(key);
|
|
13796
13796
|
const node2 = this.get(key, true);
|
|
@@ -13800,8 +13800,8 @@ var require_Collection = __commonJS({
|
|
|
13800
13800
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
13801
13801
|
* boolean to add/remove the item from the set.
|
|
13802
13802
|
*/
|
|
13803
|
-
setIn(
|
|
13804
|
-
const [key, ...rest] =
|
|
13803
|
+
setIn(path44, value) {
|
|
13804
|
+
const [key, ...rest] = path44;
|
|
13805
13805
|
if (rest.length === 0) {
|
|
13806
13806
|
this.set(key, value);
|
|
13807
13807
|
} else {
|
|
@@ -16313,9 +16313,9 @@ var require_Document = __commonJS({
|
|
|
16313
16313
|
this.contents.add(value);
|
|
16314
16314
|
}
|
|
16315
16315
|
/** Adds a value to the document. */
|
|
16316
|
-
addIn(
|
|
16316
|
+
addIn(path44, value) {
|
|
16317
16317
|
if (assertCollection(this.contents))
|
|
16318
|
-
this.contents.addIn(
|
|
16318
|
+
this.contents.addIn(path44, value);
|
|
16319
16319
|
}
|
|
16320
16320
|
/**
|
|
16321
16321
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -16390,14 +16390,14 @@ var require_Document = __commonJS({
|
|
|
16390
16390
|
* Removes a value from the document.
|
|
16391
16391
|
* @returns `true` if the item was found and removed.
|
|
16392
16392
|
*/
|
|
16393
|
-
deleteIn(
|
|
16394
|
-
if (Collection.isEmptyPath(
|
|
16393
|
+
deleteIn(path44) {
|
|
16394
|
+
if (Collection.isEmptyPath(path44)) {
|
|
16395
16395
|
if (this.contents == null)
|
|
16396
16396
|
return false;
|
|
16397
16397
|
this.contents = null;
|
|
16398
16398
|
return true;
|
|
16399
16399
|
}
|
|
16400
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
16400
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path44) : false;
|
|
16401
16401
|
}
|
|
16402
16402
|
/**
|
|
16403
16403
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -16412,10 +16412,10 @@ var require_Document = __commonJS({
|
|
|
16412
16412
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
16413
16413
|
* `true` (collections are always returned intact).
|
|
16414
16414
|
*/
|
|
16415
|
-
getIn(
|
|
16416
|
-
if (Collection.isEmptyPath(
|
|
16415
|
+
getIn(path44, keepScalar) {
|
|
16416
|
+
if (Collection.isEmptyPath(path44))
|
|
16417
16417
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
16418
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
16418
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path44, keepScalar) : void 0;
|
|
16419
16419
|
}
|
|
16420
16420
|
/**
|
|
16421
16421
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -16426,10 +16426,10 @@ var require_Document = __commonJS({
|
|
|
16426
16426
|
/**
|
|
16427
16427
|
* Checks if the document includes a value at `path`.
|
|
16428
16428
|
*/
|
|
16429
|
-
hasIn(
|
|
16430
|
-
if (Collection.isEmptyPath(
|
|
16429
|
+
hasIn(path44) {
|
|
16430
|
+
if (Collection.isEmptyPath(path44))
|
|
16431
16431
|
return this.contents !== void 0;
|
|
16432
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
16432
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path44) : false;
|
|
16433
16433
|
}
|
|
16434
16434
|
/**
|
|
16435
16435
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -16446,13 +16446,13 @@ var require_Document = __commonJS({
|
|
|
16446
16446
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
16447
16447
|
* boolean to add/remove the item from the set.
|
|
16448
16448
|
*/
|
|
16449
|
-
setIn(
|
|
16450
|
-
if (Collection.isEmptyPath(
|
|
16449
|
+
setIn(path44, value) {
|
|
16450
|
+
if (Collection.isEmptyPath(path44)) {
|
|
16451
16451
|
this.contents = value;
|
|
16452
16452
|
} else if (this.contents == null) {
|
|
16453
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
16453
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path44), value);
|
|
16454
16454
|
} else if (assertCollection(this.contents)) {
|
|
16455
|
-
this.contents.setIn(
|
|
16455
|
+
this.contents.setIn(path44, value);
|
|
16456
16456
|
}
|
|
16457
16457
|
}
|
|
16458
16458
|
/**
|
|
@@ -18409,9 +18409,9 @@ var require_cst_visit = __commonJS({
|
|
|
18409
18409
|
visit4.BREAK = BREAK;
|
|
18410
18410
|
visit4.SKIP = SKIP3;
|
|
18411
18411
|
visit4.REMOVE = REMOVE;
|
|
18412
|
-
visit4.itemAtPath = (cst,
|
|
18412
|
+
visit4.itemAtPath = (cst, path44) => {
|
|
18413
18413
|
let item = cst;
|
|
18414
|
-
for (const [field, index2] of
|
|
18414
|
+
for (const [field, index2] of path44) {
|
|
18415
18415
|
const tok = item?.[field];
|
|
18416
18416
|
if (tok && "items" in tok) {
|
|
18417
18417
|
item = tok.items[index2];
|
|
@@ -18420,23 +18420,23 @@ var require_cst_visit = __commonJS({
|
|
|
18420
18420
|
}
|
|
18421
18421
|
return item;
|
|
18422
18422
|
};
|
|
18423
|
-
visit4.parentCollection = (cst,
|
|
18424
|
-
const parent = visit4.itemAtPath(cst,
|
|
18425
|
-
const field =
|
|
18423
|
+
visit4.parentCollection = (cst, path44) => {
|
|
18424
|
+
const parent = visit4.itemAtPath(cst, path44.slice(0, -1));
|
|
18425
|
+
const field = path44[path44.length - 1][0];
|
|
18426
18426
|
const coll = parent?.[field];
|
|
18427
18427
|
if (coll && "items" in coll)
|
|
18428
18428
|
return coll;
|
|
18429
18429
|
throw new Error("Parent collection not found");
|
|
18430
18430
|
};
|
|
18431
|
-
function _visit(
|
|
18432
|
-
let ctrl = visitor(item,
|
|
18431
|
+
function _visit(path44, item, visitor) {
|
|
18432
|
+
let ctrl = visitor(item, path44);
|
|
18433
18433
|
if (typeof ctrl === "symbol")
|
|
18434
18434
|
return ctrl;
|
|
18435
18435
|
for (const field of ["key", "value"]) {
|
|
18436
18436
|
const token = item[field];
|
|
18437
18437
|
if (token && "items" in token) {
|
|
18438
18438
|
for (let i10 = 0; i10 < token.items.length; ++i10) {
|
|
18439
|
-
const ci = _visit(Object.freeze(
|
|
18439
|
+
const ci = _visit(Object.freeze(path44.concat([[field, i10]])), token.items[i10], visitor);
|
|
18440
18440
|
if (typeof ci === "number")
|
|
18441
18441
|
i10 = ci - 1;
|
|
18442
18442
|
else if (ci === BREAK)
|
|
@@ -18447,10 +18447,10 @@ var require_cst_visit = __commonJS({
|
|
|
18447
18447
|
}
|
|
18448
18448
|
}
|
|
18449
18449
|
if (typeof ctrl === "function" && field === "key")
|
|
18450
|
-
ctrl = ctrl(item,
|
|
18450
|
+
ctrl = ctrl(item, path44);
|
|
18451
18451
|
}
|
|
18452
18452
|
}
|
|
18453
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
18453
|
+
return typeof ctrl === "function" ? ctrl(item, path44) : ctrl;
|
|
18454
18454
|
}
|
|
18455
18455
|
exports2.visit = visit4;
|
|
18456
18456
|
}
|
|
@@ -19735,14 +19735,14 @@ var require_parser = __commonJS({
|
|
|
19735
19735
|
case "scalar":
|
|
19736
19736
|
case "single-quoted-scalar":
|
|
19737
19737
|
case "double-quoted-scalar": {
|
|
19738
|
-
const
|
|
19738
|
+
const fs40 = this.flowScalar(this.type);
|
|
19739
19739
|
if (atNextItem || it.value) {
|
|
19740
|
-
map5.items.push({ start: start2, key:
|
|
19740
|
+
map5.items.push({ start: start2, key: fs40, sep: [] });
|
|
19741
19741
|
this.onKeyLine = true;
|
|
19742
19742
|
} else if (it.sep) {
|
|
19743
|
-
this.stack.push(
|
|
19743
|
+
this.stack.push(fs40);
|
|
19744
19744
|
} else {
|
|
19745
|
-
Object.assign(it, { key:
|
|
19745
|
+
Object.assign(it, { key: fs40, sep: [] });
|
|
19746
19746
|
this.onKeyLine = true;
|
|
19747
19747
|
}
|
|
19748
19748
|
return;
|
|
@@ -19870,13 +19870,13 @@ var require_parser = __commonJS({
|
|
|
19870
19870
|
case "scalar":
|
|
19871
19871
|
case "single-quoted-scalar":
|
|
19872
19872
|
case "double-quoted-scalar": {
|
|
19873
|
-
const
|
|
19873
|
+
const fs40 = this.flowScalar(this.type);
|
|
19874
19874
|
if (!it || it.value)
|
|
19875
|
-
fc.items.push({ start: [], key:
|
|
19875
|
+
fc.items.push({ start: [], key: fs40, sep: [] });
|
|
19876
19876
|
else if (it.sep)
|
|
19877
|
-
this.stack.push(
|
|
19877
|
+
this.stack.push(fs40);
|
|
19878
19878
|
else
|
|
19879
|
-
Object.assign(it, { key:
|
|
19879
|
+
Object.assign(it, { key: fs40, sep: [] });
|
|
19880
19880
|
return;
|
|
19881
19881
|
}
|
|
19882
19882
|
case "flow-map-end":
|
|
@@ -23555,7 +23555,7 @@ var require_parse = __commonJS({
|
|
|
23555
23555
|
var require_gray_matter = __commonJS({
|
|
23556
23556
|
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/index.js"(exports2, module2) {
|
|
23557
23557
|
"use strict";
|
|
23558
|
-
var
|
|
23558
|
+
var fs40 = __require("fs");
|
|
23559
23559
|
var sections = require_section_matter();
|
|
23560
23560
|
var defaults = require_defaults();
|
|
23561
23561
|
var stringify2 = require_stringify2();
|
|
@@ -23639,7 +23639,7 @@ var require_gray_matter = __commonJS({
|
|
|
23639
23639
|
return stringify2(file, data4, options2);
|
|
23640
23640
|
};
|
|
23641
23641
|
matter3.read = function(filepath, options2) {
|
|
23642
|
-
const str2 =
|
|
23642
|
+
const str2 = fs40.readFileSync(filepath, "utf8");
|
|
23643
23643
|
const file = matter3(str2, options2);
|
|
23644
23644
|
file.path = filepath;
|
|
23645
23645
|
return file;
|
|
@@ -23786,8 +23786,8 @@ var require_main = __commonJS({
|
|
|
23786
23786
|
return formatter.format(documentText, range3, options2);
|
|
23787
23787
|
}
|
|
23788
23788
|
exports3.format = format3;
|
|
23789
|
-
function modify2(text4,
|
|
23790
|
-
return edit.setProperty(text4,
|
|
23789
|
+
function modify2(text4, path44, value, options2) {
|
|
23790
|
+
return edit.setProperty(text4, path44, value, options2);
|
|
23791
23791
|
}
|
|
23792
23792
|
exports3.modify = modify2;
|
|
23793
23793
|
function applyEdits2(text4, edits) {
|
|
@@ -30955,9 +30955,9 @@ var init_createPaginator = __esm({
|
|
|
30955
30955
|
command5 = withCommand(command5) ?? command5;
|
|
30956
30956
|
return await client.send(command5, ...args);
|
|
30957
30957
|
};
|
|
30958
|
-
get = (fromObject,
|
|
30958
|
+
get = (fromObject, path44) => {
|
|
30959
30959
|
let cursor3 = fromObject;
|
|
30960
|
-
const pathComponents =
|
|
30960
|
+
const pathComponents = path44.split(".");
|
|
30961
30961
|
for (const step of pathComponents) {
|
|
30962
30962
|
if (!cursor3 || typeof cursor3 !== "object") {
|
|
30963
30963
|
return void 0;
|
|
@@ -31975,12 +31975,12 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
31975
31975
|
const password = request.password ?? "";
|
|
31976
31976
|
auth = `${username}:${password}`;
|
|
31977
31977
|
}
|
|
31978
|
-
let
|
|
31978
|
+
let path44 = request.path;
|
|
31979
31979
|
if (queryString) {
|
|
31980
|
-
|
|
31980
|
+
path44 += `?${queryString}`;
|
|
31981
31981
|
}
|
|
31982
31982
|
if (request.fragment) {
|
|
31983
|
-
|
|
31983
|
+
path44 += `#${request.fragment}`;
|
|
31984
31984
|
}
|
|
31985
31985
|
let hostname = request.hostname ?? "";
|
|
31986
31986
|
if (hostname[0] === "[" && hostname.endsWith("]")) {
|
|
@@ -31992,7 +31992,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
31992
31992
|
headers: request.headers,
|
|
31993
31993
|
host: hostname,
|
|
31994
31994
|
method: request.method,
|
|
31995
|
-
path:
|
|
31995
|
+
path: path44,
|
|
31996
31996
|
port: request.port,
|
|
31997
31997
|
agent,
|
|
31998
31998
|
auth
|
|
@@ -32275,16 +32275,16 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
32275
32275
|
reject(err);
|
|
32276
32276
|
};
|
|
32277
32277
|
const queryString = querystringBuilder.buildQueryString(query || {});
|
|
32278
|
-
let
|
|
32278
|
+
let path44 = request.path;
|
|
32279
32279
|
if (queryString) {
|
|
32280
|
-
|
|
32280
|
+
path44 += `?${queryString}`;
|
|
32281
32281
|
}
|
|
32282
32282
|
if (request.fragment) {
|
|
32283
|
-
|
|
32283
|
+
path44 += `#${request.fragment}`;
|
|
32284
32284
|
}
|
|
32285
32285
|
const req = session.request({
|
|
32286
32286
|
...request.headers,
|
|
32287
|
-
[http2.constants.HTTP2_HEADER_PATH]:
|
|
32287
|
+
[http2.constants.HTTP2_HEADER_PATH]: path44,
|
|
32288
32288
|
[http2.constants.HTTP2_HEADER_METHOD]: method
|
|
32289
32289
|
});
|
|
32290
32290
|
session.ref();
|
|
@@ -32471,13 +32471,13 @@ var require_dist_cjs14 = __commonJS({
|
|
|
32471
32471
|
const abortError = buildAbortError(abortSignal);
|
|
32472
32472
|
return Promise.reject(abortError);
|
|
32473
32473
|
}
|
|
32474
|
-
let
|
|
32474
|
+
let path44 = request.path;
|
|
32475
32475
|
const queryString = querystringBuilder.buildQueryString(request.query || {});
|
|
32476
32476
|
if (queryString) {
|
|
32477
|
-
|
|
32477
|
+
path44 += `?${queryString}`;
|
|
32478
32478
|
}
|
|
32479
32479
|
if (request.fragment) {
|
|
32480
|
-
|
|
32480
|
+
path44 += `#${request.fragment}`;
|
|
32481
32481
|
}
|
|
32482
32482
|
let auth = "";
|
|
32483
32483
|
if (request.username != null || request.password != null) {
|
|
@@ -32486,7 +32486,7 @@ var require_dist_cjs14 = __commonJS({
|
|
|
32486
32486
|
auth = `${username}:${password}@`;
|
|
32487
32487
|
}
|
|
32488
32488
|
const { port, method } = request;
|
|
32489
|
-
const url = `${request.protocol}//${auth}${request.hostname}${port ? `:${port}` : ""}${
|
|
32489
|
+
const url = `${request.protocol}//${auth}${request.hostname}${port ? `:${port}` : ""}${path44}`;
|
|
32490
32490
|
const body = method === "GET" || method === "HEAD" ? void 0 : request.body;
|
|
32491
32491
|
const requestOptions = {
|
|
32492
32492
|
body,
|
|
@@ -34718,13 +34718,13 @@ function __disposeResources(env2) {
|
|
|
34718
34718
|
}
|
|
34719
34719
|
return next();
|
|
34720
34720
|
}
|
|
34721
|
-
function __rewriteRelativeImportExtension(
|
|
34722
|
-
if (typeof
|
|
34723
|
-
return
|
|
34721
|
+
function __rewriteRelativeImportExtension(path44, preserveJsx) {
|
|
34722
|
+
if (typeof path44 === "string" && /^\.\.?\//.test(path44)) {
|
|
34723
|
+
return path44.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m7, tsx, d9, ext, cm) {
|
|
34724
34724
|
return tsx ? preserveJsx ? ".jsx" : ".js" : d9 && (!ext || !cm) ? m7 : d9 + ext + "." + cm.toLowerCase() + "js";
|
|
34725
34725
|
});
|
|
34726
34726
|
}
|
|
34727
|
-
return
|
|
34727
|
+
return path44;
|
|
34728
34728
|
}
|
|
34729
34729
|
var extendStatics, __assign, __createBinding, __setModuleDefault, ownKeys, _SuppressedError, tslib_es6_default;
|
|
34730
34730
|
var init_tslib_es6 = __esm({
|
|
@@ -35622,11 +35622,11 @@ var init_HttpBindingProtocol = __esm({
|
|
|
35622
35622
|
const opTraits = translateTraits(operationSchema.traits);
|
|
35623
35623
|
if (opTraits.http) {
|
|
35624
35624
|
request.method = opTraits.http[0];
|
|
35625
|
-
const [
|
|
35625
|
+
const [path44, search2] = opTraits.http[1].split("?");
|
|
35626
35626
|
if (request.path == "/") {
|
|
35627
|
-
request.path =
|
|
35627
|
+
request.path = path44;
|
|
35628
35628
|
} else {
|
|
35629
|
-
request.path +=
|
|
35629
|
+
request.path += path44;
|
|
35630
35630
|
}
|
|
35631
35631
|
const traitSearchParams = new URLSearchParams(search2 ?? "");
|
|
35632
35632
|
Object.assign(query, Object.fromEntries(traitSearchParams));
|
|
@@ -36029,8 +36029,8 @@ var init_requestBuilder = __esm({
|
|
|
36029
36029
|
return this;
|
|
36030
36030
|
}
|
|
36031
36031
|
p(memberName, labelValueProvider, uriLabel, isGreedyLabel) {
|
|
36032
|
-
this.resolvePathStack.push((
|
|
36033
|
-
this.path = resolvedPath(
|
|
36032
|
+
this.resolvePathStack.push((path44) => {
|
|
36033
|
+
this.path = resolvedPath(path44, this.input, memberName, labelValueProvider, uriLabel, isGreedyLabel);
|
|
36034
36034
|
});
|
|
36035
36035
|
return this;
|
|
36036
36036
|
}
|
|
@@ -36680,18 +36680,18 @@ var require_dist_cjs20 = __commonJS({
|
|
|
36680
36680
|
}
|
|
36681
36681
|
};
|
|
36682
36682
|
var booleanEquals2 = (value1, value2) => value1 === value2;
|
|
36683
|
-
var getAttrPathList2 = (
|
|
36684
|
-
const parts =
|
|
36683
|
+
var getAttrPathList2 = (path44) => {
|
|
36684
|
+
const parts = path44.split(".");
|
|
36685
36685
|
const pathList = [];
|
|
36686
36686
|
for (const part of parts) {
|
|
36687
36687
|
const squareBracketIndex = part.indexOf("[");
|
|
36688
36688
|
if (squareBracketIndex !== -1) {
|
|
36689
36689
|
if (part.indexOf("]") !== part.length - 1) {
|
|
36690
|
-
throw new EndpointError2(`Path: '${
|
|
36690
|
+
throw new EndpointError2(`Path: '${path44}' does not end with ']'`);
|
|
36691
36691
|
}
|
|
36692
36692
|
const arrayIndex = part.slice(squareBracketIndex + 1, -1);
|
|
36693
36693
|
if (Number.isNaN(parseInt(arrayIndex))) {
|
|
36694
|
-
throw new EndpointError2(`Invalid array index: '${arrayIndex}' in path: '${
|
|
36694
|
+
throw new EndpointError2(`Invalid array index: '${arrayIndex}' in path: '${path44}'`);
|
|
36695
36695
|
}
|
|
36696
36696
|
if (squareBracketIndex !== 0) {
|
|
36697
36697
|
pathList.push(part.slice(0, squareBracketIndex));
|
|
@@ -36703,9 +36703,9 @@ var require_dist_cjs20 = __commonJS({
|
|
|
36703
36703
|
}
|
|
36704
36704
|
return pathList;
|
|
36705
36705
|
};
|
|
36706
|
-
var getAttr2 = (value,
|
|
36706
|
+
var getAttr2 = (value, path44) => getAttrPathList2(path44).reduce((acc, index2) => {
|
|
36707
36707
|
if (typeof acc !== "object") {
|
|
36708
|
-
throw new EndpointError2(`Index '${index2}' in '${
|
|
36708
|
+
throw new EndpointError2(`Index '${index2}' in '${path44}' not found in '${JSON.stringify(value)}'`);
|
|
36709
36709
|
} else if (Array.isArray(acc)) {
|
|
36710
36710
|
return acc[parseInt(index2)];
|
|
36711
36711
|
}
|
|
@@ -36724,8 +36724,8 @@ var require_dist_cjs20 = __commonJS({
|
|
|
36724
36724
|
return value;
|
|
36725
36725
|
}
|
|
36726
36726
|
if (typeof value === "object" && "hostname" in value) {
|
|
36727
|
-
const { hostname: hostname2, port, protocol: protocol2 = "", path:
|
|
36728
|
-
const url = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${
|
|
36727
|
+
const { hostname: hostname2, port, protocol: protocol2 = "", path: path44 = "", query = {} } = value;
|
|
36728
|
+
const url = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${path44}`);
|
|
36729
36729
|
url.search = Object.entries(query).map(([k10, v5]) => `${k10}=${v5}`).join("&");
|
|
36730
36730
|
return url;
|
|
36731
36731
|
}
|
|
@@ -38170,10 +38170,10 @@ ${longDate}
|
|
|
38170
38170
|
${credentialScope}
|
|
38171
38171
|
${utilHexEncoding.toHex(hashedRequest)}`;
|
|
38172
38172
|
}
|
|
38173
|
-
getCanonicalPath({ path:
|
|
38173
|
+
getCanonicalPath({ path: path44 }) {
|
|
38174
38174
|
if (this.uriEscapePath) {
|
|
38175
38175
|
const normalizedPathSegments = [];
|
|
38176
|
-
for (const pathSegment of
|
|
38176
|
+
for (const pathSegment of path44.split("/")) {
|
|
38177
38177
|
if (pathSegment?.length === 0)
|
|
38178
38178
|
continue;
|
|
38179
38179
|
if (pathSegment === ".")
|
|
@@ -38184,11 +38184,11 @@ ${utilHexEncoding.toHex(hashedRequest)}`;
|
|
|
38184
38184
|
normalizedPathSegments.push(pathSegment);
|
|
38185
38185
|
}
|
|
38186
38186
|
}
|
|
38187
|
-
const normalizedPath = `${
|
|
38187
|
+
const normalizedPath = `${path44?.startsWith("/") ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && path44?.endsWith("/") ? "/" : ""}`;
|
|
38188
38188
|
const doubleEncoded = utilUriEscape.escapeUri(normalizedPath);
|
|
38189
38189
|
return doubleEncoded.replace(/%2F/g, "/");
|
|
38190
38190
|
}
|
|
38191
|
-
return
|
|
38191
|
+
return path44;
|
|
38192
38192
|
}
|
|
38193
38193
|
validateResolvedCredentials(credentials) {
|
|
38194
38194
|
if (typeof credentials !== "object" || typeof credentials.accessKeyId !== "string" || typeof credentials.secretAccessKey !== "string") {
|
|
@@ -39492,11 +39492,11 @@ var init_SmithyRpcV2CborProtocol = __esm({
|
|
|
39492
39492
|
}
|
|
39493
39493
|
}
|
|
39494
39494
|
const { service, operation: operation3 } = (0, import_util_middleware5.getSmithyContext)(context);
|
|
39495
|
-
const
|
|
39495
|
+
const path44 = `/service/${service}/operation/${operation3}`;
|
|
39496
39496
|
if (request.path.endsWith("/")) {
|
|
39497
|
-
request.path +=
|
|
39497
|
+
request.path += path44.slice(1);
|
|
39498
39498
|
} else {
|
|
39499
|
-
request.path +=
|
|
39499
|
+
request.path += path44;
|
|
39500
39500
|
}
|
|
39501
39501
|
return request;
|
|
39502
39502
|
}
|
|
@@ -45141,14 +45141,14 @@ var require_readFile = __commonJS({
|
|
|
45141
45141
|
var promises_1 = __require("node:fs/promises");
|
|
45142
45142
|
exports2.filePromises = {};
|
|
45143
45143
|
exports2.fileIntercept = {};
|
|
45144
|
-
var readFile3 = (
|
|
45145
|
-
if (exports2.fileIntercept[
|
|
45146
|
-
return exports2.fileIntercept[
|
|
45144
|
+
var readFile3 = (path44, options2) => {
|
|
45145
|
+
if (exports2.fileIntercept[path44] !== void 0) {
|
|
45146
|
+
return exports2.fileIntercept[path44];
|
|
45147
45147
|
}
|
|
45148
|
-
if (!exports2.filePromises[
|
|
45149
|
-
exports2.filePromises[
|
|
45148
|
+
if (!exports2.filePromises[path44] || options2?.ignoreCache) {
|
|
45149
|
+
exports2.filePromises[path44] = (0, promises_1.readFile)(path44, "utf8");
|
|
45150
45150
|
}
|
|
45151
|
-
return exports2.filePromises[
|
|
45151
|
+
return exports2.filePromises[path44];
|
|
45152
45152
|
};
|
|
45153
45153
|
exports2.readFile = readFile3;
|
|
45154
45154
|
}
|
|
@@ -45161,7 +45161,7 @@ var require_dist_cjs33 = __commonJS({
|
|
|
45161
45161
|
var getHomeDir2 = require_getHomeDir();
|
|
45162
45162
|
var getSSOTokenFilepath2 = require_getSSOTokenFilepath();
|
|
45163
45163
|
var getSSOTokenFromFile2 = require_getSSOTokenFromFile();
|
|
45164
|
-
var
|
|
45164
|
+
var path44 = __require("path");
|
|
45165
45165
|
var types2 = require_dist_cjs();
|
|
45166
45166
|
var readFile3 = require_readFile();
|
|
45167
45167
|
var ENV_PROFILE2 = "AWS_PROFILE";
|
|
@@ -45183,9 +45183,9 @@ var require_dist_cjs33 = __commonJS({
|
|
|
45183
45183
|
...data4.default && { default: data4.default }
|
|
45184
45184
|
});
|
|
45185
45185
|
var ENV_CONFIG_PATH2 = "AWS_CONFIG_FILE";
|
|
45186
|
-
var getConfigFilepath2 = () => process.env[ENV_CONFIG_PATH2] ||
|
|
45186
|
+
var getConfigFilepath2 = () => process.env[ENV_CONFIG_PATH2] || path44.join(getHomeDir2.getHomeDir(), ".aws", "config");
|
|
45187
45187
|
var ENV_CREDENTIALS_PATH2 = "AWS_SHARED_CREDENTIALS_FILE";
|
|
45188
|
-
var getCredentialsFilepath2 = () => process.env[ENV_CREDENTIALS_PATH2] ||
|
|
45188
|
+
var getCredentialsFilepath2 = () => process.env[ENV_CREDENTIALS_PATH2] || path44.join(getHomeDir2.getHomeDir(), ".aws", "credentials");
|
|
45189
45189
|
var prefixKeyRegex2 = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/;
|
|
45190
45190
|
var profileNameBlockList2 = ["__proto__", "profile __proto__"];
|
|
45191
45191
|
var parseIni2 = (iniData) => {
|
|
@@ -45240,11 +45240,11 @@ var require_dist_cjs33 = __commonJS({
|
|
|
45240
45240
|
const relativeHomeDirPrefix = "~/";
|
|
45241
45241
|
let resolvedFilepath = filepath;
|
|
45242
45242
|
if (filepath.startsWith(relativeHomeDirPrefix)) {
|
|
45243
|
-
resolvedFilepath =
|
|
45243
|
+
resolvedFilepath = path44.join(homeDir, filepath.slice(2));
|
|
45244
45244
|
}
|
|
45245
45245
|
let resolvedConfigFilepath = configFilepath;
|
|
45246
45246
|
if (configFilepath.startsWith(relativeHomeDirPrefix)) {
|
|
45247
|
-
resolvedConfigFilepath =
|
|
45247
|
+
resolvedConfigFilepath = path44.join(homeDir, configFilepath.slice(2));
|
|
45248
45248
|
}
|
|
45249
45249
|
const parsedFiles = await Promise.all([
|
|
45250
45250
|
readFile3.readFile(resolvedConfigFilepath, {
|
|
@@ -45283,8 +45283,8 @@ var require_dist_cjs33 = __commonJS({
|
|
|
45283
45283
|
getFileRecord() {
|
|
45284
45284
|
return readFile3.fileIntercept;
|
|
45285
45285
|
},
|
|
45286
|
-
interceptFile(
|
|
45287
|
-
readFile3.fileIntercept[
|
|
45286
|
+
interceptFile(path45, contents) {
|
|
45287
|
+
readFile3.fileIntercept[path45] = Promise.resolve(contents);
|
|
45288
45288
|
},
|
|
45289
45289
|
getTokenRecord() {
|
|
45290
45290
|
return getSSOTokenFromFile2.tokenIntercept;
|
|
@@ -45609,8 +45609,8 @@ var require_dist_cjs36 = __commonJS({
|
|
|
45609
45609
|
return endpoint.url.href;
|
|
45610
45610
|
}
|
|
45611
45611
|
if ("hostname" in endpoint) {
|
|
45612
|
-
const { protocol, hostname, port, path:
|
|
45613
|
-
return `${protocol}//${hostname}${port ? ":" + port : ""}${
|
|
45612
|
+
const { protocol, hostname, port, path: path44 } = endpoint;
|
|
45613
|
+
return `${protocol}//${hostname}${port ? ":" + port : ""}${path44}`;
|
|
45614
45614
|
}
|
|
45615
45615
|
}
|
|
45616
45616
|
return endpoint;
|
|
@@ -55644,14 +55644,14 @@ var init_readFile = __esm({
|
|
|
55644
55644
|
"../../node_modules/.pnpm/@smithy+core@3.29.7/node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/readFile.js"() {
|
|
55645
55645
|
filePromises = {};
|
|
55646
55646
|
fileIntercept = {};
|
|
55647
|
-
readFile2 = (
|
|
55648
|
-
if (fileIntercept[
|
|
55649
|
-
return fileIntercept[
|
|
55647
|
+
readFile2 = (path44, options2) => {
|
|
55648
|
+
if (fileIntercept[path44] !== void 0) {
|
|
55649
|
+
return fileIntercept[path44];
|
|
55650
55650
|
}
|
|
55651
|
-
if (!filePromises[
|
|
55652
|
-
filePromises[
|
|
55651
|
+
if (!filePromises[path44] || options2?.ignoreCache) {
|
|
55652
|
+
filePromises[path44] = fsReadFile(path44, "utf8");
|
|
55653
55653
|
}
|
|
55654
|
-
return filePromises[
|
|
55654
|
+
return filePromises[path44];
|
|
55655
55655
|
};
|
|
55656
55656
|
}
|
|
55657
55657
|
});
|
|
@@ -55763,8 +55763,8 @@ var init_externalDataInterceptor = __esm({
|
|
|
55763
55763
|
getFileRecord() {
|
|
55764
55764
|
return fileIntercept;
|
|
55765
55765
|
},
|
|
55766
|
-
interceptFile(
|
|
55767
|
-
fileIntercept[
|
|
55766
|
+
interceptFile(path44, contents) {
|
|
55767
|
+
fileIntercept[path44] = Promise.resolve(contents);
|
|
55768
55768
|
},
|
|
55769
55769
|
getTokenRecord() {
|
|
55770
55770
|
return tokenIntercept;
|
|
@@ -58698,8 +58698,8 @@ var init_createConfigValueProvider = __esm({
|
|
|
58698
58698
|
return endpoint.url.href;
|
|
58699
58699
|
}
|
|
58700
58700
|
if ("hostname" in endpoint) {
|
|
58701
|
-
const { protocol, hostname, port, path:
|
|
58702
|
-
return `${protocol}//${hostname}${port ? ":" + port : ""}${
|
|
58701
|
+
const { protocol, hostname, port, path: path44 } = endpoint;
|
|
58702
|
+
return `${protocol}//${hostname}${port ? ":" + port : ""}${path44}`;
|
|
58703
58703
|
}
|
|
58704
58704
|
}
|
|
58705
58705
|
return endpoint;
|
|
@@ -59074,18 +59074,18 @@ var getAttrPathList;
|
|
|
59074
59074
|
var init_getAttrPathList = __esm({
|
|
59075
59075
|
"../../node_modules/.pnpm/@smithy+core@3.29.7/node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/getAttrPathList.js"() {
|
|
59076
59076
|
init_types4();
|
|
59077
|
-
getAttrPathList = (
|
|
59078
|
-
const parts =
|
|
59077
|
+
getAttrPathList = (path44) => {
|
|
59078
|
+
const parts = path44.split(".");
|
|
59079
59079
|
const pathList = [];
|
|
59080
59080
|
for (const part of parts) {
|
|
59081
59081
|
const squareBracketIndex = part.indexOf("[");
|
|
59082
59082
|
if (squareBracketIndex !== -1) {
|
|
59083
59083
|
if (part.indexOf("]") !== part.length - 1) {
|
|
59084
|
-
throw new EndpointError(`Path: '${
|
|
59084
|
+
throw new EndpointError(`Path: '${path44}' does not end with ']'`);
|
|
59085
59085
|
}
|
|
59086
59086
|
const arrayIndex = part.slice(squareBracketIndex + 1, -1);
|
|
59087
59087
|
if (Number.isNaN(parseInt(arrayIndex))) {
|
|
59088
|
-
throw new EndpointError(`Invalid array index: '${arrayIndex}' in path: '${
|
|
59088
|
+
throw new EndpointError(`Invalid array index: '${arrayIndex}' in path: '${path44}'`);
|
|
59089
59089
|
}
|
|
59090
59090
|
if (squareBracketIndex !== 0) {
|
|
59091
59091
|
pathList.push(part.slice(0, squareBracketIndex));
|
|
@@ -59106,9 +59106,9 @@ var init_getAttr = __esm({
|
|
|
59106
59106
|
"../../node_modules/.pnpm/@smithy+core@3.29.7/node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/getAttr.js"() {
|
|
59107
59107
|
init_types4();
|
|
59108
59108
|
init_getAttrPathList();
|
|
59109
|
-
getAttr = (value,
|
|
59109
|
+
getAttr = (value, path44) => getAttrPathList(path44).reduce((acc, index2) => {
|
|
59110
59110
|
if (typeof acc !== "object") {
|
|
59111
|
-
throw new EndpointError(`Index '${index2}' in '${
|
|
59111
|
+
throw new EndpointError(`Index '${index2}' in '${path44}' not found in '${JSON.stringify(value)}'`);
|
|
59112
59112
|
} else if (Array.isArray(acc)) {
|
|
59113
59113
|
const i10 = parseInt(index2);
|
|
59114
59114
|
return acc[i10 < 0 ? acc.length + i10 : i10];
|
|
@@ -59169,8 +59169,8 @@ var init_parseURL = __esm({
|
|
|
59169
59169
|
return value;
|
|
59170
59170
|
}
|
|
59171
59171
|
if (typeof value === "object" && "hostname" in value) {
|
|
59172
|
-
const { hostname: hostname2, port, protocol: protocol2 = "", path:
|
|
59173
|
-
const url = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${
|
|
59172
|
+
const { hostname: hostname2, port, protocol: protocol2 = "", path: path44 = "", query = {} } = value;
|
|
59173
|
+
const url = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${path44}`);
|
|
59174
59174
|
url.search = Object.entries(query).map(([k10, v5]) => `${k10}=${v5}`).join("&");
|
|
59175
59175
|
return url;
|
|
59176
59176
|
}
|
|
@@ -62407,11 +62407,11 @@ var init_HttpBindingProtocol2 = __esm({
|
|
|
62407
62407
|
const opTraits = translateTraits2(operationSchema.traits);
|
|
62408
62408
|
if (opTraits.http) {
|
|
62409
62409
|
request.method = opTraits.http[0];
|
|
62410
|
-
const [
|
|
62410
|
+
const [path44, search2] = opTraits.http[1].split("?");
|
|
62411
62411
|
if (request.path == "/") {
|
|
62412
|
-
request.path =
|
|
62412
|
+
request.path = path44;
|
|
62413
62413
|
} else {
|
|
62414
|
-
request.path +=
|
|
62414
|
+
request.path += path44;
|
|
62415
62415
|
}
|
|
62416
62416
|
const traitSearchParams = new URLSearchParams(search2 ?? "");
|
|
62417
62417
|
for (const [key, value] of traitSearchParams) {
|
|
@@ -62812,8 +62812,8 @@ var init_requestBuilder3 = __esm({
|
|
|
62812
62812
|
return this;
|
|
62813
62813
|
}
|
|
62814
62814
|
p(memberName, labelValueProvider, uriLabel, isGreedyLabel) {
|
|
62815
|
-
this.resolvePathStack.push((
|
|
62816
|
-
this.path = resolvedPath2(
|
|
62815
|
+
this.resolvePathStack.push((path44) => {
|
|
62816
|
+
this.path = resolvedPath2(path44, this.input, memberName, labelValueProvider, uriLabel, isGreedyLabel);
|
|
62817
62817
|
});
|
|
62818
62818
|
return this;
|
|
62819
62819
|
}
|
|
@@ -63452,9 +63452,9 @@ var init_createPaginator2 = __esm({
|
|
|
63452
63452
|
command5 = withCommand(command5) ?? command5;
|
|
63453
63453
|
return await client.send(command5, ...args);
|
|
63454
63454
|
};
|
|
63455
|
-
get2 = (fromObject,
|
|
63455
|
+
get2 = (fromObject, path44) => {
|
|
63456
63456
|
let cursor3 = fromObject;
|
|
63457
|
-
const pathComponents =
|
|
63457
|
+
const pathComponents = path44.split(".");
|
|
63458
63458
|
for (const step of pathComponents) {
|
|
63459
63459
|
if (!cursor3 || typeof cursor3 !== "object") {
|
|
63460
63460
|
return void 0;
|
|
@@ -67025,10 +67025,10 @@ ${longDate}
|
|
|
67025
67025
|
${credentialScope}
|
|
67026
67026
|
${toHex2(hashedRequest)}`;
|
|
67027
67027
|
}
|
|
67028
|
-
getCanonicalPath({ path:
|
|
67028
|
+
getCanonicalPath({ path: path44 }) {
|
|
67029
67029
|
if (this.uriEscapePath) {
|
|
67030
67030
|
const normalizedPathSegments = [];
|
|
67031
|
-
for (const pathSegment of
|
|
67031
|
+
for (const pathSegment of path44.split("/")) {
|
|
67032
67032
|
if (pathSegment?.length === 0)
|
|
67033
67033
|
continue;
|
|
67034
67034
|
if (pathSegment === ".")
|
|
@@ -67039,11 +67039,11 @@ ${toHex2(hashedRequest)}`;
|
|
|
67039
67039
|
normalizedPathSegments.push(pathSegment);
|
|
67040
67040
|
}
|
|
67041
67041
|
}
|
|
67042
|
-
const normalizedPath = `${
|
|
67042
|
+
const normalizedPath = `${path44?.startsWith("/") ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && path44?.endsWith("/") ? "/" : ""}`;
|
|
67043
67043
|
const doubleEncoded = escapeUri2(normalizedPath);
|
|
67044
67044
|
return doubleEncoded.replace(/%2F/g, "/");
|
|
67045
67045
|
}
|
|
67046
|
-
return
|
|
67046
|
+
return path44;
|
|
67047
67047
|
}
|
|
67048
67048
|
validateResolvedCredentials(credentials) {
|
|
67049
67049
|
if (typeof credentials !== "object" || typeof credentials.accessKeyId !== "string" || typeof credentials.secretAccessKey !== "string") {
|
|
@@ -68612,11 +68612,11 @@ var init_SmithyRpcV2CborProtocol2 = __esm({
|
|
|
68612
68612
|
}
|
|
68613
68613
|
}
|
|
68614
68614
|
const { service, operation: operation3 } = getSmithyContext11(context);
|
|
68615
|
-
const
|
|
68615
|
+
const path44 = `/service/${service}/operation/${operation3}`;
|
|
68616
68616
|
if (request.path.endsWith("/")) {
|
|
68617
|
-
request.path +=
|
|
68617
|
+
request.path += path44.slice(1);
|
|
68618
68618
|
} else {
|
|
68619
|
-
request.path +=
|
|
68619
|
+
request.path += path44;
|
|
68620
68620
|
}
|
|
68621
68621
|
return request;
|
|
68622
68622
|
}
|
|
@@ -72020,12 +72020,12 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
72020
72020
|
const password = request.password ?? "";
|
|
72021
72021
|
auth = `${username}:${password}`;
|
|
72022
72022
|
}
|
|
72023
|
-
let
|
|
72023
|
+
let path44 = request.path;
|
|
72024
72024
|
if (queryString) {
|
|
72025
|
-
|
|
72025
|
+
path44 += `?${queryString}`;
|
|
72026
72026
|
}
|
|
72027
72027
|
if (request.fragment) {
|
|
72028
|
-
|
|
72028
|
+
path44 += `#${request.fragment}`;
|
|
72029
72029
|
}
|
|
72030
72030
|
let hostname = request.hostname ?? "";
|
|
72031
72031
|
if (hostname[0] === "[" && hostname.endsWith("]")) {
|
|
@@ -72037,7 +72037,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
72037
72037
|
headers: request.headers,
|
|
72038
72038
|
host: hostname,
|
|
72039
72039
|
method: request.method,
|
|
72040
|
-
path:
|
|
72040
|
+
path: path44,
|
|
72041
72041
|
port: request.port,
|
|
72042
72042
|
agent,
|
|
72043
72043
|
auth
|
|
@@ -72440,16 +72440,16 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
72440
72440
|
reject(err);
|
|
72441
72441
|
};
|
|
72442
72442
|
const queryString = query ? buildQueryString2(query) : "";
|
|
72443
|
-
let
|
|
72443
|
+
let path44 = request.path;
|
|
72444
72444
|
if (queryString) {
|
|
72445
|
-
|
|
72445
|
+
path44 += `?${queryString}`;
|
|
72446
72446
|
}
|
|
72447
72447
|
if (request.fragment) {
|
|
72448
|
-
|
|
72448
|
+
path44 += `#${request.fragment}`;
|
|
72449
72449
|
}
|
|
72450
72450
|
const clientHttp2Stream = session.request({
|
|
72451
72451
|
...request.headers,
|
|
72452
|
-
[constants2.HTTP2_HEADER_PATH]:
|
|
72452
|
+
[constants2.HTTP2_HEADER_PATH]: path44,
|
|
72453
72453
|
[constants2.HTTP2_HEADER_METHOD]: method
|
|
72454
72454
|
});
|
|
72455
72455
|
if (effectiveRequestTimeout) {
|
|
@@ -72531,7 +72531,7 @@ var require_dist_cjs60 = __commonJS({
|
|
|
72531
72531
|
var { setCredentialFeature: setCredentialFeature3 } = (init_client4(), __toCommonJS(client_exports3));
|
|
72532
72532
|
var { CredentialsProviderError: CredentialsProviderError2 } = (init_config3(), __toCommonJS(config_exports));
|
|
72533
72533
|
var { NodeHttpHandler } = require_dist_cjs59();
|
|
72534
|
-
var
|
|
72534
|
+
var fs40 = __require("node:fs/promises");
|
|
72535
72535
|
var { HttpRequest: HttpRequest11 } = (init_protocols3(), __toCommonJS(protocols_exports3));
|
|
72536
72536
|
var { sdkStreamMixin: sdkStreamMixin4, parseRfc3339DateTime: parseRfc3339DateTime3 } = (init_serde2(), __toCommonJS(serde_exports2));
|
|
72537
72537
|
var ECS_CONTAINER_HOST = "169.254.170.2";
|
|
@@ -72655,7 +72655,7 @@ Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
|
|
|
72655
72655
|
const provider = retryWrapper(async () => {
|
|
72656
72656
|
const request = createGetRequest(url);
|
|
72657
72657
|
if (tokenFile) {
|
|
72658
|
-
request.headers.Authorization = validateToken((await
|
|
72658
|
+
request.headers.Authorization = validateToken((await fs40.readFile(tokenFile)).toString());
|
|
72659
72659
|
} else if (token) {
|
|
72660
72660
|
request.headers.Authorization = validateToken(token);
|
|
72661
72661
|
}
|
|
@@ -90737,9 +90737,9 @@ var require_dist_node20 = __commonJS({
|
|
|
90737
90737
|
// ../canopycms/src/worker/cms-worker.ts
|
|
90738
90738
|
var import_proper_lockfile3 = __toESM(require_proper_lockfile(), 1);
|
|
90739
90739
|
import { createHash as createHash2 } from "node:crypto";
|
|
90740
|
-
import
|
|
90740
|
+
import fs38 from "node:fs/promises";
|
|
90741
90741
|
import os from "node:os";
|
|
90742
|
-
import
|
|
90742
|
+
import path41 from "node:path";
|
|
90743
90743
|
|
|
90744
90744
|
// ../canopycms/src/utils/debug.ts
|
|
90745
90745
|
var envFlag = (name3) => typeof process !== "undefined" && process.env[name3] === "true";
|
|
@@ -91924,8 +91924,8 @@ function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
|
|
|
91924
91924
|
function forEachLineWithContent(input, callback) {
|
|
91925
91925
|
return toLinesWithContent(input, true).map((line) => callback(line));
|
|
91926
91926
|
}
|
|
91927
|
-
function folderExists(
|
|
91928
|
-
return (0, import_file_exists.exists)(
|
|
91927
|
+
function folderExists(path44) {
|
|
91928
|
+
return (0, import_file_exists.exists)(path44, import_file_exists.FOLDER);
|
|
91929
91929
|
}
|
|
91930
91930
|
function append(target, item) {
|
|
91931
91931
|
if (Array.isArray(target)) {
|
|
@@ -92327,8 +92327,8 @@ function checkIsRepoRootTask() {
|
|
|
92327
92327
|
commands: commands9,
|
|
92328
92328
|
format: "utf-8",
|
|
92329
92329
|
onError,
|
|
92330
|
-
parser(
|
|
92331
|
-
return /^\.(git)?$/.test(
|
|
92330
|
+
parser(path44) {
|
|
92331
|
+
return /^\.(git)?$/.test(path44.trim());
|
|
92332
92332
|
}
|
|
92333
92333
|
};
|
|
92334
92334
|
}
|
|
@@ -92762,11 +92762,11 @@ function parseGrep(grep) {
|
|
|
92762
92762
|
const paths = /* @__PURE__ */ new Set();
|
|
92763
92763
|
const results = {};
|
|
92764
92764
|
forEachLineWithContent(grep, (input) => {
|
|
92765
|
-
const [
|
|
92766
|
-
paths.add(
|
|
92767
|
-
(results[
|
|
92765
|
+
const [path44, line, preview] = input.split(NULL);
|
|
92766
|
+
paths.add(path44);
|
|
92767
|
+
(results[path44] = results[path44] || []).push({
|
|
92768
92768
|
line: asNumber(line),
|
|
92769
|
-
path:
|
|
92769
|
+
path: path44,
|
|
92770
92770
|
preview
|
|
92771
92771
|
});
|
|
92772
92772
|
});
|
|
@@ -93530,14 +93530,14 @@ var init_hash_object = __esm2({
|
|
|
93530
93530
|
init_task();
|
|
93531
93531
|
}
|
|
93532
93532
|
});
|
|
93533
|
-
function parseInit(bare,
|
|
93533
|
+
function parseInit(bare, path44, text4) {
|
|
93534
93534
|
const response = String(text4).trim();
|
|
93535
93535
|
let result;
|
|
93536
93536
|
if (result = initResponseRegex.exec(response)) {
|
|
93537
|
-
return new InitSummary(bare,
|
|
93537
|
+
return new InitSummary(bare, path44, false, result[1]);
|
|
93538
93538
|
}
|
|
93539
93539
|
if (result = reInitResponseRegex.exec(response)) {
|
|
93540
|
-
return new InitSummary(bare,
|
|
93540
|
+
return new InitSummary(bare, path44, true, result[1]);
|
|
93541
93541
|
}
|
|
93542
93542
|
let gitDir = "";
|
|
93543
93543
|
const tokens = response.split(" ");
|
|
@@ -93548,7 +93548,7 @@ function parseInit(bare, path43, text4) {
|
|
|
93548
93548
|
break;
|
|
93549
93549
|
}
|
|
93550
93550
|
}
|
|
93551
|
-
return new InitSummary(bare,
|
|
93551
|
+
return new InitSummary(bare, path44, /^re/i.test(response), gitDir);
|
|
93552
93552
|
}
|
|
93553
93553
|
var InitSummary;
|
|
93554
93554
|
var initResponseRegex;
|
|
@@ -93557,9 +93557,9 @@ var init_InitSummary = __esm2({
|
|
|
93557
93557
|
"src/lib/responses/InitSummary.ts"() {
|
|
93558
93558
|
"use strict";
|
|
93559
93559
|
InitSummary = class {
|
|
93560
|
-
constructor(bare,
|
|
93560
|
+
constructor(bare, path44, existing, gitDir) {
|
|
93561
93561
|
this.bare = bare;
|
|
93562
|
-
this.path =
|
|
93562
|
+
this.path = path44;
|
|
93563
93563
|
this.existing = existing;
|
|
93564
93564
|
this.gitDir = gitDir;
|
|
93565
93565
|
}
|
|
@@ -93571,7 +93571,7 @@ var init_InitSummary = __esm2({
|
|
|
93571
93571
|
function hasBareCommand(command5) {
|
|
93572
93572
|
return command5.includes(bareCommand);
|
|
93573
93573
|
}
|
|
93574
|
-
function initTask(bare = false,
|
|
93574
|
+
function initTask(bare = false, path44, customArgs) {
|
|
93575
93575
|
const commands9 = ["init", ...customArgs];
|
|
93576
93576
|
if (bare && !hasBareCommand(commands9)) {
|
|
93577
93577
|
commands9.splice(1, 0, bareCommand);
|
|
@@ -93580,7 +93580,7 @@ function initTask(bare = false, path43, customArgs) {
|
|
|
93580
93580
|
commands: commands9,
|
|
93581
93581
|
format: "utf-8",
|
|
93582
93582
|
parser(text4) {
|
|
93583
|
-
return parseInit(commands9.includes("--bare"),
|
|
93583
|
+
return parseInit(commands9.includes("--bare"), path44, text4);
|
|
93584
93584
|
}
|
|
93585
93585
|
};
|
|
93586
93586
|
}
|
|
@@ -94395,12 +94395,12 @@ var init_FileStatusSummary = __esm2({
|
|
|
94395
94395
|
"use strict";
|
|
94396
94396
|
fromPathRegex = /^(.+)\0(.+)$/;
|
|
94397
94397
|
FileStatusSummary = class {
|
|
94398
|
-
constructor(
|
|
94399
|
-
this.path =
|
|
94398
|
+
constructor(path44, index2, working_dir) {
|
|
94399
|
+
this.path = path44;
|
|
94400
94400
|
this.index = index2;
|
|
94401
94401
|
this.working_dir = working_dir;
|
|
94402
94402
|
if (index2 === "R" || working_dir === "R") {
|
|
94403
|
-
const detail = fromPathRegex.exec(
|
|
94403
|
+
const detail = fromPathRegex.exec(path44) || [null, path44, path44];
|
|
94404
94404
|
this.from = detail[2] || "";
|
|
94405
94405
|
this.path = detail[1] || "";
|
|
94406
94406
|
}
|
|
@@ -94431,14 +94431,14 @@ function splitLine(result, lineStr) {
|
|
|
94431
94431
|
default:
|
|
94432
94432
|
return;
|
|
94433
94433
|
}
|
|
94434
|
-
function data4(index2, workingDir,
|
|
94434
|
+
function data4(index2, workingDir, path44) {
|
|
94435
94435
|
const raw = `${index2}${workingDir}`;
|
|
94436
94436
|
const handler = parsers6.get(raw);
|
|
94437
94437
|
if (handler) {
|
|
94438
|
-
handler(result,
|
|
94438
|
+
handler(result, path44);
|
|
94439
94439
|
}
|
|
94440
94440
|
if (raw !== "##" && raw !== "!!") {
|
|
94441
|
-
result.files.push(new FileStatusSummary(
|
|
94441
|
+
result.files.push(new FileStatusSummary(path44, index2, workingDir));
|
|
94442
94442
|
}
|
|
94443
94443
|
}
|
|
94444
94444
|
}
|
|
@@ -94789,9 +94789,9 @@ var init_simple_git_api = __esm2({
|
|
|
94789
94789
|
next
|
|
94790
94790
|
);
|
|
94791
94791
|
}
|
|
94792
|
-
hashObject(
|
|
94792
|
+
hashObject(path44, write) {
|
|
94793
94793
|
return this._runTask(
|
|
94794
|
-
hashObjectTask(
|
|
94794
|
+
hashObjectTask(path44, write === true),
|
|
94795
94795
|
trailingFunctionArgument(arguments)
|
|
94796
94796
|
);
|
|
94797
94797
|
}
|
|
@@ -95145,8 +95145,8 @@ var init_branch = __esm2({
|
|
|
95145
95145
|
}
|
|
95146
95146
|
});
|
|
95147
95147
|
function toPath(input) {
|
|
95148
|
-
const
|
|
95149
|
-
return
|
|
95148
|
+
const path44 = input.trim().replace(/^["']|["']$/g, "");
|
|
95149
|
+
return path44 && normalize(path44);
|
|
95150
95150
|
}
|
|
95151
95151
|
var parseCheckIgnore;
|
|
95152
95152
|
var init_CheckIgnore = __esm2({
|
|
@@ -95431,8 +95431,8 @@ __export2(sub_module_exports, {
|
|
|
95431
95431
|
subModuleTask: () => subModuleTask,
|
|
95432
95432
|
updateSubModuleTask: () => updateSubModuleTask
|
|
95433
95433
|
});
|
|
95434
|
-
function addSubModuleTask(repo,
|
|
95435
|
-
return subModuleTask(["add", repo,
|
|
95434
|
+
function addSubModuleTask(repo, path44) {
|
|
95435
|
+
return subModuleTask(["add", repo, path44]);
|
|
95436
95436
|
}
|
|
95437
95437
|
function initSubModuleTask(customArgs) {
|
|
95438
95438
|
return subModuleTask(["init", ...customArgs]);
|
|
@@ -95746,8 +95746,8 @@ var require_git = __commonJS2({
|
|
|
95746
95746
|
}
|
|
95747
95747
|
return this._runTask(straightThroughStringTask2(command5, this._trimmed), next);
|
|
95748
95748
|
};
|
|
95749
|
-
Git2.prototype.submoduleAdd = function(repo,
|
|
95750
|
-
return this._runTask(addSubModuleTask2(repo,
|
|
95749
|
+
Git2.prototype.submoduleAdd = function(repo, path44, then) {
|
|
95750
|
+
return this._runTask(addSubModuleTask2(repo, path44), trailingFunctionArgument2(arguments));
|
|
95751
95751
|
};
|
|
95752
95752
|
Git2.prototype.submoduleUpdate = function(args, then) {
|
|
95753
95753
|
return this._runTask(
|
|
@@ -97210,6 +97210,42 @@ function personName(id, name3) {
|
|
|
97210
97210
|
}
|
|
97211
97211
|
|
|
97212
97212
|
// ../canopycms/src/editor-url.ts
|
|
97213
|
+
var MAX_URL_LENGTH = 2048;
|
|
97214
|
+
function editorPageUrl(raw) {
|
|
97215
|
+
if (raw.length > MAX_URL_LENGTH) return void 0;
|
|
97216
|
+
let url;
|
|
97217
|
+
try {
|
|
97218
|
+
url = new URL(raw);
|
|
97219
|
+
} catch {
|
|
97220
|
+
return void 0;
|
|
97221
|
+
}
|
|
97222
|
+
if (url.protocol !== "https:" && url.protocol !== "http:") return void 0;
|
|
97223
|
+
if (url.username || url.password) return void 0;
|
|
97224
|
+
const page = `${url.origin}${url.pathname}`;
|
|
97225
|
+
return page.length > MAX_URL_LENGTH ? void 0 : page;
|
|
97226
|
+
}
|
|
97227
|
+
function requestHost(header) {
|
|
97228
|
+
const forwarded = header("x-forwarded-host")?.split(",").at(-1)?.trim();
|
|
97229
|
+
const host = forwarded || header("host")?.trim();
|
|
97230
|
+
return host || void 0;
|
|
97231
|
+
}
|
|
97232
|
+
function normalizeHost(host, protocol) {
|
|
97233
|
+
if (/[\s/\\@?#]/.test(host)) return void 0;
|
|
97234
|
+
try {
|
|
97235
|
+
return new URL(`${protocol}//${host}`).host;
|
|
97236
|
+
} catch {
|
|
97237
|
+
return void 0;
|
|
97238
|
+
}
|
|
97239
|
+
}
|
|
97240
|
+
function resolveEditorUrl(input) {
|
|
97241
|
+
if (input.configured) return editorPageUrl(input.configured);
|
|
97242
|
+
if (!input.claimed || !input.header) return void 0;
|
|
97243
|
+
const claimed = editorPageUrl(input.claimed);
|
|
97244
|
+
const host = requestHost(input.header);
|
|
97245
|
+
if (!claimed || !host) return void 0;
|
|
97246
|
+
const url = new URL(claimed);
|
|
97247
|
+
return normalizeHost(host, url.protocol) === url.host ? claimed : void 0;
|
|
97248
|
+
}
|
|
97213
97249
|
function editorDeepLink(editorUrl, branch, entryPath) {
|
|
97214
97250
|
const url = new URL(editorUrl);
|
|
97215
97251
|
url.searchParams.set("branch", branch);
|
|
@@ -97522,6 +97558,35 @@ function authorizationOf(headers) {
|
|
|
97522
97558
|
// ../canopycms/src/worker/github-gateway.ts
|
|
97523
97559
|
init_error();
|
|
97524
97560
|
|
|
97561
|
+
// ../canopycms/src/worker/github-errors.ts
|
|
97562
|
+
function getHttpStatus2(err) {
|
|
97563
|
+
if (err instanceof Error && "status" in err) {
|
|
97564
|
+
const status = err.status;
|
|
97565
|
+
if (typeof status === "number") return status;
|
|
97566
|
+
}
|
|
97567
|
+
return null;
|
|
97568
|
+
}
|
|
97569
|
+
function getResponseHeaders(err) {
|
|
97570
|
+
if (typeof err !== "object" || err === null || !("response" in err)) return null;
|
|
97571
|
+
const response = err.response;
|
|
97572
|
+
if (typeof response !== "object" || response === null || !("headers" in response)) return null;
|
|
97573
|
+
const headers = response.headers;
|
|
97574
|
+
if (typeof headers !== "object" || headers === null) return null;
|
|
97575
|
+
return headers;
|
|
97576
|
+
}
|
|
97577
|
+
function isRateLimitSignal403(err) {
|
|
97578
|
+
const headers = getResponseHeaders(err);
|
|
97579
|
+
if (headers) {
|
|
97580
|
+
if (headers["x-ratelimit-remaining"] === "0") return true;
|
|
97581
|
+
if (typeof headers["retry-after"] === "string" && headers["retry-after"].length > 0) return true;
|
|
97582
|
+
}
|
|
97583
|
+
if (err instanceof Error && /rate limit/i.test(err.message)) return true;
|
|
97584
|
+
return false;
|
|
97585
|
+
}
|
|
97586
|
+
function isPermissionDenial(err) {
|
|
97587
|
+
return getHttpStatus2(err) === 403 && !isRateLimitSignal403(err);
|
|
97588
|
+
}
|
|
97589
|
+
|
|
97525
97590
|
// ../canopycms/src/worker/github-mirror.ts
|
|
97526
97591
|
import { randomBytes } from "node:crypto";
|
|
97527
97592
|
import fs10 from "node:fs/promises";
|
|
@@ -98050,6 +98115,44 @@ function assertPullRequestText(refusing, branch, text4) {
|
|
|
98050
98115
|
throw new GatewayRefusalError("pull-request", branch, "too-long", `${refusing}: ${over}`);
|
|
98051
98116
|
}
|
|
98052
98117
|
}
|
|
98118
|
+
var MAX_COMMIT_STATUS_DESCRIPTION_LENGTH = 140;
|
|
98119
|
+
var MAX_COMMIT_STATUS_URL_LENGTH = 2048;
|
|
98120
|
+
function assertCommitStatusText(refusing, branch, text4) {
|
|
98121
|
+
if (text4.description.length > MAX_COMMIT_STATUS_DESCRIPTION_LENGTH) {
|
|
98122
|
+
throw new GatewayRefusalError(
|
|
98123
|
+
"commit-status",
|
|
98124
|
+
branch,
|
|
98125
|
+
"too-long",
|
|
98126
|
+
`${refusing}: its description is longer than ${MAX_COMMIT_STATUS_DESCRIPTION_LENGTH} characters`
|
|
98127
|
+
);
|
|
98128
|
+
}
|
|
98129
|
+
if (/[\u0000-\u001f\u007f]/.test(text4.description)) {
|
|
98130
|
+
throw new GatewayRefusalError(
|
|
98131
|
+
"commit-status",
|
|
98132
|
+
branch,
|
|
98133
|
+
"invalid",
|
|
98134
|
+
`${refusing}: its description holds a control character`
|
|
98135
|
+
);
|
|
98136
|
+
}
|
|
98137
|
+
if (text4.targetUrl !== void 0 && !isPlainWebUrl(text4.targetUrl)) {
|
|
98138
|
+
throw new GatewayRefusalError(
|
|
98139
|
+
"commit-status",
|
|
98140
|
+
branch,
|
|
98141
|
+
"invalid",
|
|
98142
|
+
`${refusing}: its target URL is not a plain http(s) URL of at most ${MAX_COMMIT_STATUS_URL_LENGTH} characters`
|
|
98143
|
+
);
|
|
98144
|
+
}
|
|
98145
|
+
}
|
|
98146
|
+
function isPlainWebUrl(raw) {
|
|
98147
|
+
if (raw.length > MAX_COMMIT_STATUS_URL_LENGTH) return false;
|
|
98148
|
+
let url;
|
|
98149
|
+
try {
|
|
98150
|
+
url = new URL(raw);
|
|
98151
|
+
} catch {
|
|
98152
|
+
return false;
|
|
98153
|
+
}
|
|
98154
|
+
return (url.protocol === "https:" || url.protocol === "http:") && !url.username && !url.password;
|
|
98155
|
+
}
|
|
98053
98156
|
function sameBranch(a9, b10) {
|
|
98054
98157
|
return a9 === b10 || sanitizeBranchName(a9) === sanitizeBranchName(b10);
|
|
98055
98158
|
}
|
|
@@ -99589,6 +99692,7 @@ function describeMove(update) {
|
|
|
99589
99692
|
const to = update.to.slice(0, 7);
|
|
99590
99693
|
return update.from === null ? `new branch at ${to}` : `${update.from.slice(0, 7)}..${to}`;
|
|
99591
99694
|
}
|
|
99695
|
+
var CONFLICTS_STATUS_CONTEXT = "CanopyCMS conflicts";
|
|
99592
99696
|
function createLocalGitHubGateway(options2) {
|
|
99593
99697
|
return new LocalGitHubGateway(options2);
|
|
99594
99698
|
}
|
|
@@ -100261,6 +100365,39 @@ var LocalGitHubGateway = class {
|
|
|
100261
100365
|
);
|
|
100262
100366
|
});
|
|
100263
100367
|
}
|
|
100368
|
+
setConflictsStatus(status, signal) {
|
|
100369
|
+
return this.credentialed(signal, async (reach) => {
|
|
100370
|
+
const { pullRequest, sha, state: state3, description, targetUrl } = status;
|
|
100371
|
+
const refusing = `Refusing to set a status on pull request #${pullRequest}`;
|
|
100372
|
+
const pr = await this.assertOwnPullRequest(reach, pullRequest, refusing, signal);
|
|
100373
|
+
assertCommitStatusText(refusing, pr.head.ref, { description, targetUrl });
|
|
100374
|
+
if (pr.head.sha !== sha) {
|
|
100375
|
+
throw new GatewayRefusalError(
|
|
100376
|
+
"commit-status",
|
|
100377
|
+
pr.head.ref,
|
|
100378
|
+
"not-head",
|
|
100379
|
+
`${refusing}: ${sha.slice(0, 7)} is not its head, ${pr.head.sha.slice(0, 7)}`
|
|
100380
|
+
);
|
|
100381
|
+
}
|
|
100382
|
+
try {
|
|
100383
|
+
await this.api(
|
|
100384
|
+
reach,
|
|
100385
|
+
() => this.octokit.repos.createCommitStatus({
|
|
100386
|
+
...this.repo,
|
|
100387
|
+
sha,
|
|
100388
|
+
state: state3,
|
|
100389
|
+
context: CONFLICTS_STATUS_CONTEXT,
|
|
100390
|
+
description,
|
|
100391
|
+
...targetUrl !== void 0 && { target_url: targetUrl },
|
|
100392
|
+
request: { signal }
|
|
100393
|
+
})
|
|
100394
|
+
);
|
|
100395
|
+
} catch (err) {
|
|
100396
|
+
if (isPermissionDenial(err)) reach.failed = false;
|
|
100397
|
+
throw err;
|
|
100398
|
+
}
|
|
100399
|
+
});
|
|
100400
|
+
}
|
|
100264
100401
|
deleteBranch(branch, signal) {
|
|
100265
100402
|
return this.credentialed(signal, async (reach) => {
|
|
100266
100403
|
await assertPlainBranchName(branch, await this.mirror.checkGit(), "delete");
|
|
@@ -100691,7 +100828,7 @@ init_error();
|
|
|
100691
100828
|
init_worker_status();
|
|
100692
100829
|
|
|
100693
100830
|
// ../canopycms/src/version.ts
|
|
100694
|
-
var CANOPYCMS_VERSION = "0.
|
|
100831
|
+
var CANOPYCMS_VERSION = "0.13.0";
|
|
100695
100832
|
|
|
100696
100833
|
// ../canopycms/src/worker/schema-gate.ts
|
|
100697
100834
|
import fs15 from "node:fs/promises";
|
|
@@ -101018,6 +101155,7 @@ var branchMetadataShape = {
|
|
|
101018
101155
|
archivedAt: external_exports.string().optional(),
|
|
101019
101156
|
rebaseFailure: external_exports.object({ message: external_exports.string(), firstAt: external_exports.string(), lastAt: external_exports.string() }).optional(),
|
|
101020
101157
|
historyRewrittenFrom: external_exports.string().optional(),
|
|
101158
|
+
historyRewrittenTo: external_exports.string().optional(),
|
|
101021
101159
|
lastGitHubTip: external_exports.string().optional(),
|
|
101022
101160
|
keptOverGitHub: external_exports.array(external_exports.string()).optional(),
|
|
101023
101161
|
rewrittenOnGitHub: external_exports.string().optional(),
|
|
@@ -101032,13 +101170,16 @@ var branchMetadataShape = {
|
|
|
101032
101170
|
external_exports.object({ kind: external_exports.literal("conflicts") }),
|
|
101033
101171
|
external_exports.object({ kind: external_exports.literal("retargeted"), base: external_exports.string() })
|
|
101034
101172
|
]).optional().catch(void 0),
|
|
101035
|
-
// Dropped when malformed: it
|
|
101173
|
+
// Dropped when malformed, never failing a read: it decorates the PR body, and without `commit`
|
|
101174
|
+
// the worker judges a move against the clone's head before it (worker/github-commits.ts).
|
|
101036
101175
|
review: external_exports.object({
|
|
101037
101176
|
state: external_exports.enum(["approved", "changes-requested"]),
|
|
101038
101177
|
by: external_exports.object({ userId: external_exports.string(), name: external_exports.string().optional() }),
|
|
101039
|
-
at: external_exports.string()
|
|
101178
|
+
at: external_exports.string(),
|
|
101179
|
+
commit: external_exports.string().optional()
|
|
101040
101180
|
}).optional().catch(void 0),
|
|
101041
101181
|
baseUpdateRequestedAt: external_exports.string().optional().catch(void 0),
|
|
101182
|
+
latestChangesWaiting: external_exports.string().optional().catch(void 0),
|
|
101042
101183
|
// Dropped when malformed: it only ends the editor's wait, which then times out instead.
|
|
101043
101184
|
lastBaseUpdate: external_exports.object({
|
|
101044
101185
|
at: external_exports.string(),
|
|
@@ -101866,6 +102007,13 @@ var requests = {
|
|
|
101866
102007
|
mergeSectionIntoBody: external_exports.boolean().optional()
|
|
101867
102008
|
}).strict(),
|
|
101868
102009
|
convertPullRequestToDraft: external_exports.object({ number: prNumber }).strict(),
|
|
102010
|
+
setConflictsStatus: external_exports.object({
|
|
102011
|
+
pullRequest: prNumber,
|
|
102012
|
+
sha: objectId,
|
|
102013
|
+
state: external_exports.enum(["success", "failure"]),
|
|
102014
|
+
description: external_exports.string().max(4096),
|
|
102015
|
+
targetUrl: external_exports.string().max(4096).optional()
|
|
102016
|
+
}).strict(),
|
|
101869
102017
|
deleteBranch: external_exports.object({ branch: name }).strict(),
|
|
101870
102018
|
authSnapshot: external_exports.object({}).strict(),
|
|
101871
102019
|
termination: external_exports.object({}).strict(),
|
|
@@ -101904,6 +102052,7 @@ var answers = {
|
|
|
101904
102052
|
}).strict(),
|
|
101905
102053
|
createOrUpdatePullRequest: pullRequestRef.extend({ created: external_exports.boolean() }).strict(),
|
|
101906
102054
|
convertPullRequestToDraft: empty,
|
|
102055
|
+
setConflictsStatus: empty,
|
|
101907
102056
|
deleteBranch: empty,
|
|
101908
102057
|
authSnapshot: external_exports.object({
|
|
101909
102058
|
users: external_exports.array(
|
|
@@ -101939,6 +102088,7 @@ var JSON_ROUTES = {
|
|
|
101939
102088
|
getPullRequest: `${WIRE_PREFIX}/pull-request/get`,
|
|
101940
102089
|
createOrUpdatePullRequest: `${WIRE_PREFIX}/pull-request/create-or-update`,
|
|
101941
102090
|
convertPullRequestToDraft: `${WIRE_PREFIX}/pull-request/convert-to-draft`,
|
|
102091
|
+
setConflictsStatus: `${WIRE_PREFIX}/pull-request/conflicts-status`,
|
|
101942
102092
|
deleteBranch: `${WIRE_PREFIX}/branch/delete`,
|
|
101943
102093
|
authSnapshot: `${WIRE_PREFIX}/auth-snapshot`,
|
|
101944
102094
|
termination: `${WIRE_PREFIX}/termination`,
|
|
@@ -101989,7 +102139,7 @@ var errorEnvelope = external_exports.discriminatedUnion("kind", [
|
|
|
101989
102139
|
external_exports.object({
|
|
101990
102140
|
kind: external_exports.literal("refusal"),
|
|
101991
102141
|
push: external_exports.boolean(),
|
|
101992
|
-
operation: external_exports.enum(["push", "delete", "pull-request"]),
|
|
102142
|
+
operation: external_exports.enum(["push", "delete", "pull-request", "commit-status"]),
|
|
101993
102143
|
branch: name,
|
|
101994
102144
|
reason: external_exports.enum([
|
|
101995
102145
|
"invalid",
|
|
@@ -101998,7 +102148,8 @@ var errorEnvelope = external_exports.discriminatedUnion("kind", [
|
|
|
101998
102148
|
"other-settings",
|
|
101999
102149
|
"outside-namespace",
|
|
102000
102150
|
"not-a-commit",
|
|
102001
|
-
"too-long"
|
|
102151
|
+
"too-long",
|
|
102152
|
+
"not-head"
|
|
102002
102153
|
]),
|
|
102003
102154
|
message
|
|
102004
102155
|
}).strict(),
|
|
@@ -102150,7 +102301,7 @@ function decodeError(value) {
|
|
|
102150
102301
|
case "refusal": {
|
|
102151
102302
|
const { push: push2, operation: operation3, branch, reason } = envelope;
|
|
102152
102303
|
if (!push2) return new GatewayRefusalError(operation3, branch, reason, envelope.message);
|
|
102153
|
-
if (operation3 !== "push" || reason === "too-long") {
|
|
102304
|
+
if (operation3 !== "push" || reason === "too-long" || reason === "not-head") {
|
|
102154
102305
|
return new GitHubGatewayProtocolError(
|
|
102155
102306
|
`The GitHub gateway answered with a push refusal for ${operation3}, reason ${reason}`
|
|
102156
102307
|
);
|
|
@@ -102227,6 +102378,7 @@ async function markHistoryRewritten(ctx, branchPath, branchRef, expectedSha, rew
|
|
|
102227
102378
|
return {
|
|
102228
102379
|
branch: {
|
|
102229
102380
|
historyRewrittenFrom: typeof marker === "string" ? marker : expectedSha,
|
|
102381
|
+
historyRewrittenTo: rewrittenTip,
|
|
102230
102382
|
lastGitHubTip: rewrittenTip
|
|
102231
102383
|
}
|
|
102232
102384
|
};
|
|
@@ -102237,7 +102389,7 @@ async function clearHistoryRewrittenMarker(ctx, branchPath, branchRef) {
|
|
|
102237
102389
|
try {
|
|
102238
102390
|
const meta = getBranchMetadataFileManager(branchPath, ctx.contentBranchesPath);
|
|
102239
102391
|
await meta.saveIf(
|
|
102240
|
-
{ branch: { historyRewrittenFrom: void 0 } },
|
|
102392
|
+
{ branch: { historyRewrittenFrom: void 0, historyRewrittenTo: void 0 } },
|
|
102241
102393
|
(current2) => current2?.branch.name === branchRef && typeof current2.branch.historyRewrittenFrom === "string"
|
|
102242
102394
|
);
|
|
102243
102395
|
} catch (err) {
|
|
@@ -102246,28 +102398,32 @@ async function clearHistoryRewrittenMarker(ctx, branchPath, branchRef) {
|
|
|
102246
102398
|
);
|
|
102247
102399
|
}
|
|
102248
102400
|
}
|
|
102249
|
-
async function forcePublishToLocalRemote(ctx, branchPath, branchRef, expectedSha) {
|
|
102401
|
+
async function forcePublishToLocalRemote(ctx, branchPath, branchRef, expectedSha, rewrittenTip) {
|
|
102250
102402
|
const pushGit = sharedRepoGit(branchPath, "worktree", { timeout: { block: ctx.taskTimeoutMs } });
|
|
102251
102403
|
try {
|
|
102252
102404
|
await pushGit.raw([
|
|
102253
102405
|
"push",
|
|
102254
|
-
`--force-with-lease
|
|
102406
|
+
`--force-with-lease=refs/heads/${branchRef}:${expectedSha}`,
|
|
102255
102407
|
// Otherwise remote.git's own hooks run, as the worker.
|
|
102256
102408
|
`--receive-pack=${pinnedReceivePack()}`,
|
|
102257
102409
|
// Real flags must precede --end-of-options; everything after it is
|
|
102258
102410
|
// positional (see GitManager.push() for the same guard).
|
|
102259
102411
|
"--end-of-options",
|
|
102260
102412
|
ctx.remoteGitPath,
|
|
102261
|
-
`${
|
|
102413
|
+
`${rewrittenTip}:refs/heads/${branchRef}`
|
|
102262
102414
|
]);
|
|
102263
102415
|
workerLog(` Published rebased ${branchRef} into remote.git`);
|
|
102264
|
-
return
|
|
102416
|
+
return { kind: "published" };
|
|
102265
102417
|
} catch (err) {
|
|
102266
102418
|
const message2 = redactCredentials(getErrorMessage(err));
|
|
102267
|
-
|
|
102268
|
-
|
|
102269
|
-
|
|
102270
|
-
|
|
102419
|
+
if (isStaleLeaseRejection(message2)) {
|
|
102420
|
+
workerLogWarn(
|
|
102421
|
+
` Did not publish rebased ${branchRef} into remote.git: it moved since this cycle read it (concurrent submit?) -- retrying next cycle`
|
|
102422
|
+
);
|
|
102423
|
+
return { kind: "moved" };
|
|
102424
|
+
}
|
|
102425
|
+
workerLogWarn(` Failed to publish rebased ${branchRef} into remote.git: ${message2}`);
|
|
102426
|
+
return { kind: "failed", message: message2 };
|
|
102271
102427
|
}
|
|
102272
102428
|
}
|
|
102273
102429
|
async function enqueueGitHubPush(ctx, branchRef, gatewayPolicy) {
|
|
@@ -102290,28 +102446,39 @@ async function enqueueGitHubPush(ctx, branchRef, gatewayPolicy) {
|
|
|
102290
102446
|
workerLogWarn(` Failed to queue GitHub push for ${branchRef}: ${getErrorMessage(err)}`);
|
|
102291
102447
|
}
|
|
102292
102448
|
}
|
|
102449
|
+
var REWRITE_TIP_UNKNOWN = `this branch's rebased history was recorded without the commit to publish, so neither it nor the base is taken in. A developer publishes the rewrite by hand before the branch is submitted again.`;
|
|
102450
|
+
var COMMIT_ID = /^[0-9a-f]{40}([0-9a-f]{24})?$/;
|
|
102293
102451
|
async function reconcilePendingRewrite(ctx, options2) {
|
|
102294
102452
|
const { branchPath, branchDir, branchRef, headSha, marker, gatewayPolicy } = options2;
|
|
102453
|
+
const target = options2.target !== void 0 && COMMIT_ID.test(options2.target) ? options2.target : void 0;
|
|
102295
102454
|
const publishedSha = await readPublishedSha(ctx, branchRef);
|
|
102296
102455
|
if (publishedSha === null) {
|
|
102297
102456
|
workerLogWarn(
|
|
102298
102457
|
` ${branchDir}: a rewritten history is recorded but ${branchRef} is gone from remote.git -- nothing to publish`
|
|
102299
102458
|
);
|
|
102300
|
-
return;
|
|
102459
|
+
return { kind: "settled" };
|
|
102301
102460
|
}
|
|
102302
|
-
if (publishedSha === headSha) {
|
|
102461
|
+
if (publishedSha === target || publishedSha === headSha) {
|
|
102303
102462
|
await enqueueGitHubPush(ctx, branchRef, gatewayPolicy);
|
|
102304
|
-
return;
|
|
102463
|
+
return { kind: "settled" };
|
|
102305
102464
|
}
|
|
102306
102465
|
if (publishedSha === marker) {
|
|
102307
|
-
if (
|
|
102308
|
-
|
|
102466
|
+
if (target === void 0) return { kind: "failed", reason: REWRITE_TIP_UNKNOWN };
|
|
102467
|
+
const publish = await forcePublishToLocalRemote(ctx, branchPath, branchRef, marker, target);
|
|
102468
|
+
if (publish.kind === "moved") return { kind: "waiting" };
|
|
102469
|
+
if (publish.kind === "failed") {
|
|
102470
|
+
return {
|
|
102471
|
+
kind: "failed",
|
|
102472
|
+
reason: `this branch's rebased history could not be published into the deployment's repository: ${publish.message}`
|
|
102473
|
+
};
|
|
102309
102474
|
}
|
|
102310
|
-
|
|
102475
|
+
await enqueueGitHubPush(ctx, branchRef, gatewayPolicy);
|
|
102476
|
+
return { kind: "settled" };
|
|
102311
102477
|
}
|
|
102312
102478
|
workerLogWarn(
|
|
102313
102479
|
` ${branchDir}: remote.git is at ${publishedSha} for ${branchRef}, which is neither the rebased tip nor the commit the rewrite replaced -- left untouched`
|
|
102314
102480
|
);
|
|
102481
|
+
return { kind: "settled" };
|
|
102315
102482
|
}
|
|
102316
102483
|
async function hasPendingHistoryRewrite(ctx, branchName) {
|
|
102317
102484
|
try {
|
|
@@ -102934,6 +103101,12 @@ function withoutMergesGone(entries, holds) {
|
|
|
102934
103101
|
}
|
|
102935
103102
|
return kept;
|
|
102936
103103
|
}
|
|
103104
|
+
function openConflictCount(entries) {
|
|
103105
|
+
return Object.values(entries).reduce(
|
|
103106
|
+
(n7, entry) => n7 + (entry.kind === "fields" ? (entry.fields ?? []).length : 1),
|
|
103107
|
+
0
|
|
103108
|
+
);
|
|
103109
|
+
}
|
|
102937
103110
|
function conflictFilesOf(entries) {
|
|
102938
103111
|
const conflictFiles = Object.keys(entries).sort();
|
|
102939
103112
|
return {
|
|
@@ -103064,6 +103237,7 @@ init_error();
|
|
|
103064
103237
|
// ../canopycms/src/worker/field-merge.ts
|
|
103065
103238
|
var import_yaml4 = __toESM(require_dist4(), 1);
|
|
103066
103239
|
import path27 from "node:path";
|
|
103240
|
+
init_item_keys();
|
|
103067
103241
|
|
|
103068
103242
|
// ../canopycms/src/content-listing.ts
|
|
103069
103243
|
var import_gray_matter2 = __toESM(require_gray_matter(), 1);
|
|
@@ -103152,8 +103326,8 @@ function detectFormatting(text4) {
|
|
|
103152
103326
|
if (indent2?.startsWith(" ")) return { insertSpaces: false, tabSize: 1, eol };
|
|
103153
103327
|
return { insertSpaces: true, tabSize: indent2?.length ?? 2, eol };
|
|
103154
103328
|
}
|
|
103155
|
-
function insertMember(text4,
|
|
103156
|
-
const at2 = [...
|
|
103329
|
+
function insertMember(text4, path44, key, value, formattingOptions) {
|
|
103330
|
+
const at2 = [...path44, key];
|
|
103157
103331
|
const [edit] = (0, import_jsonc_parser.modify)(text4, at2, value, {});
|
|
103158
103332
|
const closing = edit ? /^[ \t]*\r?\n([ \t]*)\}/.exec(text4.slice(edit.offset)) : null;
|
|
103159
103333
|
if (edit && closing && edit.length === 0 && edit.content.startsWith(",")) {
|
|
@@ -103167,10 +103341,10 @@ function insertMember(text4, path43, key, value, formattingOptions) {
|
|
|
103167
103341
|
}
|
|
103168
103342
|
return (0, import_jsonc_parser.applyEdits)(text4, (0, import_jsonc_parser.modify)(text4, at2, value, { formattingOptions }));
|
|
103169
103343
|
}
|
|
103170
|
-
function removeMember(text4,
|
|
103344
|
+
function removeMember(text4, path44) {
|
|
103171
103345
|
return (0, import_jsonc_parser.applyEdits)(
|
|
103172
103346
|
text4,
|
|
103173
|
-
(0, import_jsonc_parser.modify)(text4,
|
|
103347
|
+
(0, import_jsonc_parser.modify)(text4, path44, void 0, {}).map((edit) => {
|
|
103174
103348
|
const removed = text4.slice(edit.offset, edit.offset + edit.length);
|
|
103175
103349
|
const lead = /^\s+/.exec(removed)?.[0].length ?? 0;
|
|
103176
103350
|
const atMember = /\S/.test(text4.charAt(edit.offset + edit.length));
|
|
@@ -103178,29 +103352,29 @@ function removeMember(text4, path43) {
|
|
|
103178
103352
|
})
|
|
103179
103353
|
);
|
|
103180
103354
|
}
|
|
103181
|
-
function reconcile(text4,
|
|
103355
|
+
function reconcile(text4, path44, before, after, formattingOptions) {
|
|
103182
103356
|
if (isRecord(before) && isRecord(after)) {
|
|
103183
103357
|
if (Object.keys(after).length === 0 && Object.keys(before).length > 0) {
|
|
103184
|
-
return (0, import_jsonc_parser.applyEdits)(text4, (0, import_jsonc_parser.modify)(text4,
|
|
103358
|
+
return (0, import_jsonc_parser.applyEdits)(text4, (0, import_jsonc_parser.modify)(text4, path44, {}, { formattingOptions }));
|
|
103185
103359
|
}
|
|
103186
103360
|
let next = text4;
|
|
103187
103361
|
for (const key of Object.keys(before)) {
|
|
103188
103362
|
if (!Object.prototype.hasOwnProperty.call(after, key))
|
|
103189
|
-
next = removeMember(next, [...
|
|
103363
|
+
next = removeMember(next, [...path44, key]);
|
|
103190
103364
|
}
|
|
103191
103365
|
for (const key of Object.keys(after)) {
|
|
103192
|
-
next = Object.prototype.hasOwnProperty.call(before, key) ? reconcile(next, [...
|
|
103366
|
+
next = Object.prototype.hasOwnProperty.call(before, key) ? reconcile(next, [...path44, key], before[key], after[key], formattingOptions) : insertMember(next, path44, key, after[key], formattingOptions);
|
|
103193
103367
|
}
|
|
103194
103368
|
return next;
|
|
103195
103369
|
}
|
|
103196
103370
|
if (Array.isArray(before) && Array.isArray(after) && before.length === after.length) {
|
|
103197
103371
|
return after.reduce(
|
|
103198
|
-
(next, item, index2) => reconcile(next, [...
|
|
103372
|
+
(next, item, index2) => reconcile(next, [...path44, index2], before[index2], item, formattingOptions),
|
|
103199
103373
|
text4
|
|
103200
103374
|
);
|
|
103201
103375
|
}
|
|
103202
103376
|
if (JSON.stringify(before) === JSON.stringify(after)) return text4;
|
|
103203
|
-
return (0, import_jsonc_parser.applyEdits)(text4, (0, import_jsonc_parser.modify)(text4,
|
|
103377
|
+
return (0, import_jsonc_parser.applyEdits)(text4, (0, import_jsonc_parser.modify)(text4, path44, after, { formattingOptions }));
|
|
103204
103378
|
}
|
|
103205
103379
|
function serializeJson(data4, existingRaw) {
|
|
103206
103380
|
if (existingRaw === void 0) return plainStringify(data4);
|
|
@@ -110517,7 +110691,7 @@ function transformGfmAutolinkLiterals(tree) {
|
|
|
110517
110691
|
{ ignore: ["link", "linkReference"] }
|
|
110518
110692
|
);
|
|
110519
110693
|
}
|
|
110520
|
-
function findUrl(_3, protocol, domain2,
|
|
110694
|
+
function findUrl(_3, protocol, domain2, path44, match2) {
|
|
110521
110695
|
let prefix = "";
|
|
110522
110696
|
if (!previous2(match2)) {
|
|
110523
110697
|
return false;
|
|
@@ -110530,7 +110704,7 @@ function findUrl(_3, protocol, domain2, path43, match2) {
|
|
|
110530
110704
|
if (!isCorrectDomain(domain2)) {
|
|
110531
110705
|
return false;
|
|
110532
110706
|
}
|
|
110533
|
-
const parts = splitUrl(domain2 +
|
|
110707
|
+
const parts = splitUrl(domain2 + path44);
|
|
110534
110708
|
if (!parts[0]) return false;
|
|
110535
110709
|
const result = {
|
|
110536
110710
|
type: "link",
|
|
@@ -120407,14 +120581,14 @@ var SourceSplicer = class {
|
|
|
120407
120581
|
const col = this.column(geometry[0].content);
|
|
120408
120582
|
const oldIndex = new Map(snap.map((s7, i10) => [s7.item, i10]));
|
|
120409
120583
|
const parts = [];
|
|
120410
|
-
const
|
|
120584
|
+
const sourceOf2 = (item) => oldIndex.has(item) ? item : (0, import_yaml.isNode)(item) ? this.replaced.get(item) : void 0;
|
|
120411
120585
|
for (const [k10, item] of seq.items.entries()) {
|
|
120412
120586
|
const j10 = oldIndex.get(item);
|
|
120413
120587
|
let part;
|
|
120414
120588
|
if (j10 !== void 0) {
|
|
120415
120589
|
const start3 = this.chunkStart(geometry, j10);
|
|
120416
120590
|
const inner = (0, import_yaml.isCollection)(item) && this.isDirty(item) ? this.collectionEdits(item) : [];
|
|
120417
|
-
const next = k10 + 1 < seq.items.length ?
|
|
120591
|
+
const next = k10 + 1 < seq.items.length ? sourceOf2(seq.items[k10 + 1]) : END;
|
|
120418
120592
|
const moved = (j10 + 1 < snap.length ? snap[j10 + 1].item : END) !== (next ?? FRESH);
|
|
120419
120593
|
part = inner !== void 0 ? this.applyEdits(start3, geometry[j10].end, [
|
|
120420
120594
|
...inner,
|
|
@@ -121458,16 +121632,16 @@ var Diff = class {
|
|
|
121458
121632
|
}
|
|
121459
121633
|
}
|
|
121460
121634
|
}
|
|
121461
|
-
addToPath(
|
|
121462
|
-
const last2 =
|
|
121635
|
+
addToPath(path44, added, removed, oldPosInc, options2) {
|
|
121636
|
+
const last2 = path44.lastComponent;
|
|
121463
121637
|
if (last2 && !options2.oneChangePerToken && last2.added === added && last2.removed === removed) {
|
|
121464
121638
|
return {
|
|
121465
|
-
oldPos:
|
|
121639
|
+
oldPos: path44.oldPos + oldPosInc,
|
|
121466
121640
|
lastComponent: { count: last2.count + 1, added, removed, previousComponent: last2.previousComponent }
|
|
121467
121641
|
};
|
|
121468
121642
|
} else {
|
|
121469
121643
|
return {
|
|
121470
|
-
oldPos:
|
|
121644
|
+
oldPos: path44.oldPos + oldPosInc,
|
|
121471
121645
|
lastComponent: { count: 1, added, removed, previousComponent: last2 }
|
|
121472
121646
|
};
|
|
121473
121647
|
}
|
|
@@ -121731,7 +121905,7 @@ var ancestorAliases = (ancestorItems, ancestorKeys) => {
|
|
|
121731
121905
|
}
|
|
121732
121906
|
return aliases;
|
|
121733
121907
|
};
|
|
121734
|
-
function alignToAncestor(items, ancestorItems, ancestorKeys, side, inEntry, movedIn) {
|
|
121908
|
+
function alignToAncestor(items, ancestorItems, ancestorKeys, side, inEntry, movedIn, otherSide = []) {
|
|
121735
121909
|
const known = new Set(ancestorKeys);
|
|
121736
121910
|
const aliases = ancestorAliases(ancestorItems, ancestorKeys);
|
|
121737
121911
|
const readKeys2 = itemKeysAsRead(items);
|
|
@@ -121750,31 +121924,64 @@ function alignToAncestor(items, ancestorItems, ancestorKeys, side, inEntry, move
|
|
|
121750
121924
|
if (!isMinted(item)) unheldFresh.add(token);
|
|
121751
121925
|
});
|
|
121752
121926
|
const at2 = new Map(ancestorKeys.map((key, i10) => [key, i10]));
|
|
121753
|
-
const
|
|
121754
|
-
|
|
121927
|
+
const copies = (list5) => new Set(
|
|
121928
|
+
list5.flatMap((item) => {
|
|
121929
|
+
const own4 = ownKey(item);
|
|
121930
|
+
return own4 !== void 0 && !hasContentKeyShape(own4) && !known.has(own4) ? [valueToken(item)] : [];
|
|
121931
|
+
})
|
|
121932
|
+
);
|
|
121933
|
+
const [copied, otherCopied] = [copies(items), copies(otherSide)];
|
|
121934
|
+
const names = (key) => key === void 0 || known.has(key) ? key : aliases.get(key) ?? key;
|
|
121935
|
+
const otherHolds = new Set(
|
|
121936
|
+
otherSide.map((item) => `${names(ownKey(item))}\0${valueToken(item)}`)
|
|
121937
|
+
);
|
|
121938
|
+
const sameRewrite = (j10, own4) => otherHolds.has(`${names(own4)}\0${valueToken(items[j10])}`);
|
|
121939
|
+
const claim = (j10, own4) => {
|
|
121940
|
+
if (!hasContentKeyShape(own4)) return void 0;
|
|
121755
121941
|
const content3 = valueToken(items[j10]);
|
|
121756
121942
|
const holders = unheld2.get(content3) ?? 0;
|
|
121757
|
-
if (holders === 0) return
|
|
121943
|
+
if (holders === 0) return void 0;
|
|
121758
121944
|
const read = readKeys2[j10];
|
|
121759
121945
|
const named2 = read !== void 0 && known.has(read) ? read : aliases.get(own4);
|
|
121760
121946
|
const i10 = named2 === void 0 ? void 0 : at2.get(named2);
|
|
121761
121947
|
if (i10 !== void 0) {
|
|
121762
|
-
if (isMinted(ancestorItems[i10]) && isMinted(items[j10])) return
|
|
121763
|
-
if (!unheldFresh.has(content3)) return
|
|
121764
|
-
|
|
121948
|
+
if (isMinted(ancestorItems[i10]) && isMinted(items[j10])) return void 0;
|
|
121949
|
+
if (!unheldFresh.has(content3)) return void 0;
|
|
121950
|
+
const was = valueToken(ancestorItems[i10]);
|
|
121951
|
+
if (was === content3) return void 0;
|
|
121952
|
+
return copied.has(was) || otherCopied.has(was) && sameRewrite(j10, own4) ? "keyed" : "named";
|
|
121765
121953
|
}
|
|
121766
|
-
return holders === 1;
|
|
121954
|
+
return holders === 1 ? "unnamed" : void 0;
|
|
121955
|
+
};
|
|
121956
|
+
const claims = items.map((item, j10) => {
|
|
121957
|
+
const own4 = ownKey(item);
|
|
121958
|
+
return own4 === void 0 ? void 0 : claim(j10, own4);
|
|
121959
|
+
});
|
|
121960
|
+
const claimants = /* @__PURE__ */ new Map();
|
|
121961
|
+
claims.forEach((c11, j10) => {
|
|
121962
|
+
const content3 = valueToken(items[j10]);
|
|
121963
|
+
if (c11 !== void 0) claimants.set(content3, (claimants.get(content3) ?? 0) + 1);
|
|
121964
|
+
});
|
|
121965
|
+
const usurped = (j10) => {
|
|
121966
|
+
const content3 = valueToken(items[j10]);
|
|
121967
|
+
if (claims[j10] !== "named") return claims[j10] === "unnamed";
|
|
121968
|
+
return (claimants.get(content3) ?? 0) <= (unheld2.get(content3) ?? 0);
|
|
121969
|
+
};
|
|
121970
|
+
const literal2 = new Set(items.flatMap((item) => ownKey(item) ?? []).filter((k10) => known.has(k10)));
|
|
121971
|
+
const aliasOf = (own4) => {
|
|
121972
|
+
const id = inEntry.has(own4) ? void 0 : aliases.get(own4);
|
|
121973
|
+
return id !== void 0 && !literal2.has(id) ? id : void 0;
|
|
121767
121974
|
};
|
|
121768
121975
|
items.forEach((item, j10) => {
|
|
121769
121976
|
const own4 = ownKey(item);
|
|
121770
121977
|
const read = readKeys2[j10];
|
|
121771
|
-
if (own4 !== void 0 && usurped(j10
|
|
121978
|
+
if (own4 !== void 0 && usurped(j10)) {
|
|
121772
121979
|
minted.add(j10);
|
|
121773
121980
|
byContent.add(j10);
|
|
121774
121981
|
stale.add(j10);
|
|
121775
121982
|
return;
|
|
121776
121983
|
}
|
|
121777
|
-
const id = own4 === void 0 ? void 0 : read !== void 0 && known.has(read) ? read : !known.has(own4) ?
|
|
121984
|
+
const id = own4 === void 0 ? void 0 : read !== void 0 && known.has(read) ? read : !known.has(own4) ? aliasOf(own4) : void 0;
|
|
121778
121985
|
if (id !== void 0 && !taken.has(id)) {
|
|
121779
121986
|
ids[j10] = id;
|
|
121780
121987
|
taken.add(id);
|
|
@@ -121949,7 +122156,7 @@ function byPlace(sideGap, ancestorGap, items, ancestorItems) {
|
|
|
121949
122156
|
}
|
|
121950
122157
|
var newIdentity = (side, j10) => `${INTERNAL}${side}${j10}`;
|
|
121951
122158
|
var isNewIdentity = (id) => id.startsWith(INTERNAL);
|
|
121952
|
-
function pairNewItems(baseItems, baseIds, branchItems, branchIds) {
|
|
122159
|
+
function pairNewItems(baseItems, baseIds, branchItems, branchIds, movedHere) {
|
|
121953
122160
|
const baseNew = baseIds.flatMap((id, j10) => isNewIdentity(id) ? [j10] : []);
|
|
121954
122161
|
const branchNew = branchIds.flatMap((id, j10) => isNewIdentity(id) ? [j10] : []);
|
|
121955
122162
|
const pairedBase = /* @__PURE__ */ new Set();
|
|
@@ -121974,7 +122181,12 @@ function pairNewItems(baseItems, baseIds, branchItems, branchIds) {
|
|
|
121974
122181
|
const pairs = (commonPairs(
|
|
121975
122182
|
restBase.map((j10) => valueToken(baseItems[j10])),
|
|
121976
122183
|
restBranch.map((j10) => valueToken(branchItems[j10]))
|
|
121977
|
-
) ?? []).filter(([x6, y3]) =>
|
|
122184
|
+
) ?? []).filter(([x6, y3]) => {
|
|
122185
|
+
const [a9, b10] = [baseItems[restBase[x6]], branchItems[restBranch[y3]]];
|
|
122186
|
+
const [ka, kb] = [ownKey(a9), ownKey(b10)];
|
|
122187
|
+
const movedIn = (k10) => k10 !== void 0 && movedHere(k10);
|
|
122188
|
+
return !(isMinted(a9) && isMinted(b10)) && !(ka !== kb && (movedIn(ka) || movedIn(kb)));
|
|
122189
|
+
});
|
|
121978
122190
|
for (const [x6, y3] of pairs) baseIds[restBase[x6]] = branchIds[restBranch[y3]];
|
|
121979
122191
|
}
|
|
121980
122192
|
function mergeOrder(ancestorIds, baseIds, branchIds) {
|
|
@@ -122331,10 +122543,11 @@ function mergeList(o8, a9, b10, at2, walk2, namedBy) {
|
|
|
122331
122543
|
}
|
|
122332
122544
|
function identifyByKey(O2, a9, b10, inEntry, moved) {
|
|
122333
122545
|
const oKeys = itemKeysAsRead(O2).map((key, i10) => key ?? `${i10}`);
|
|
122334
|
-
const aligned = alignToAncestor(a9, O2, oKeys, "a", inEntry, moved.a);
|
|
122335
|
-
const bAligned = alignToAncestor(b10, O2, oKeys, "b", inEntry, moved.b);
|
|
122546
|
+
const aligned = alignToAncestor(a9, O2, oKeys, "a", inEntry, moved.a, b10);
|
|
122547
|
+
const bAligned = alignToAncestor(b10, O2, oKeys, "b", inEntry, moved.b, a9);
|
|
122336
122548
|
if (!aligned || !bAligned) return void 0;
|
|
122337
|
-
|
|
122549
|
+
const known = new Set(oKeys);
|
|
122550
|
+
pairNewItems(a9, aligned.ids, b10, bAligned.ids, (key) => inEntry.has(key) && !known.has(key));
|
|
122338
122551
|
return {
|
|
122339
122552
|
oKeys,
|
|
122340
122553
|
aIds: aligned.ids,
|
|
@@ -122705,6 +122918,57 @@ function mergeCollectionMeta(ancestor, base, branch) {
|
|
|
122705
122918
|
};
|
|
122706
122919
|
}
|
|
122707
122920
|
|
|
122921
|
+
// ../canopycms/src/merge/rekey.ts
|
|
122922
|
+
init_item_keys();
|
|
122923
|
+
init_field_traversal();
|
|
122924
|
+
var owns = (record, name3) => Object.prototype.hasOwnProperty.call(record, name3);
|
|
122925
|
+
var isRecordList2 = (value) => Array.isArray(value) && value.length > 0 && value.every(isPlainRecord);
|
|
122926
|
+
var looseToken = (value) => {
|
|
122927
|
+
if (isEmptyValue(value)) return "";
|
|
122928
|
+
if (isRecordList2(value)) return `[${value.map(looseToken).sort().join(",")}]`;
|
|
122929
|
+
if (!isPlainRecord(value)) return valueToken(value);
|
|
122930
|
+
const members2 = Object.entries(value).filter(([name3, v5]) => name3 !== ITEM_KEY && !isEmptyValue(v5)).sort(([x6], [y3]) => x6 < y3 ? -1 : x6 > y3 ? 1 : 0);
|
|
122931
|
+
return `{${members2.map(([name3, v5]) => `${JSON.stringify(name3)}:${looseToken(v5)}`).join(",")}}`;
|
|
122932
|
+
};
|
|
122933
|
+
function rekeyAsMerged(merged, fieldMerged) {
|
|
122934
|
+
if (isRecordList2(merged) && isRecordList2(fieldMerged)) {
|
|
122935
|
+
if (merged.length !== fieldMerged.length) return void 0;
|
|
122936
|
+
const pool = fieldMerged.map((item) => ({ item, token: looseToken(item) }));
|
|
122937
|
+
const out = [];
|
|
122938
|
+
for (const item of merged) {
|
|
122939
|
+
const token = looseToken(item);
|
|
122940
|
+
const at2 = pool.findIndex((p8) => p8.token === token);
|
|
122941
|
+
if (at2 === -1) return void 0;
|
|
122942
|
+
const [{ item: match2 }] = pool.splice(at2, 1);
|
|
122943
|
+
const rekeyed = rekeyAsMerged(item, match2);
|
|
122944
|
+
if (rekeyed === void 0) return void 0;
|
|
122945
|
+
out.push(rekeyed);
|
|
122946
|
+
}
|
|
122947
|
+
return out;
|
|
122948
|
+
}
|
|
122949
|
+
if (isPlainRecord(merged) && isPlainRecord(fieldMerged)) {
|
|
122950
|
+
const out = [];
|
|
122951
|
+
const key = owns(fieldMerged, ITEM_KEY) ? fieldMerged[ITEM_KEY] : void 0;
|
|
122952
|
+
for (const [name3, value] of Object.entries(merged)) {
|
|
122953
|
+
if (name3 === ITEM_KEY) {
|
|
122954
|
+
if (key !== void 0) out.push([name3, key]);
|
|
122955
|
+
continue;
|
|
122956
|
+
}
|
|
122957
|
+
const other = owns(fieldMerged, name3) ? fieldMerged[name3] : void 0;
|
|
122958
|
+
const rekeyed = isEmptyValue(value) && isEmptyValue(other) ? value : rekeyAsMerged(value, other);
|
|
122959
|
+
if (rekeyed === void 0) return void 0;
|
|
122960
|
+
out.push([name3, rekeyed]);
|
|
122961
|
+
}
|
|
122962
|
+
for (const [name3, value] of Object.entries(fieldMerged)) {
|
|
122963
|
+
if (owns(merged, name3)) continue;
|
|
122964
|
+
if (name3 === ITEM_KEY) out.push([name3, value]);
|
|
122965
|
+
else if (!isEmptyValue(value)) return void 0;
|
|
122966
|
+
}
|
|
122967
|
+
return Object.fromEntries(out);
|
|
122968
|
+
}
|
|
122969
|
+
return valueToken(merged) === valueToken(fieldMerged) ? merged : void 0;
|
|
122970
|
+
}
|
|
122971
|
+
|
|
122708
122972
|
// ../canopycms/src/worker/field-merge.ts
|
|
122709
122973
|
init_normalize();
|
|
122710
122974
|
init_error();
|
|
@@ -122962,6 +123226,32 @@ var LOCATION = {
|
|
|
122962
123226
|
sidePaths: {},
|
|
122963
123227
|
kind: "changed"
|
|
122964
123228
|
};
|
|
123229
|
+
function readsAs(text4, format3, merged) {
|
|
123230
|
+
try {
|
|
123231
|
+
if (!holdsRecord(text4, format3)) return false;
|
|
123232
|
+
const back = parseEntryParts(text4, format3);
|
|
123233
|
+
return sameContent2(
|
|
123234
|
+
{ data: back.data, ...back.body !== void 0 && { body: back.body } },
|
|
123235
|
+
merged
|
|
123236
|
+
);
|
|
123237
|
+
} catch {
|
|
123238
|
+
return false;
|
|
123239
|
+
}
|
|
123240
|
+
}
|
|
123241
|
+
var withoutItemKeys = (value) => {
|
|
123242
|
+
if (Array.isArray(value)) return value.map(withoutItemKeys);
|
|
123243
|
+
if (!isPlainRecord(value)) return value;
|
|
123244
|
+
return Object.fromEntries(
|
|
123245
|
+
Object.entries(value).filter(([name3]) => name3 !== ITEM_KEY).map(([name3, v5]) => [name3, withoutItemKeys(v5)])
|
|
123246
|
+
);
|
|
123247
|
+
};
|
|
123248
|
+
async function differsInItemKeysOnly(git, x6, y3, contentRoot) {
|
|
123249
|
+
const format3 = formatOf(y3.path);
|
|
123250
|
+
if (!format3 || x6.path !== y3.path || x6.mode !== y3.mode) return false;
|
|
123251
|
+
if (entryLogicalPathOfFile(y3.path, normalizeFilesystemPath(contentRoot)) === null) return false;
|
|
123252
|
+
const [a9, b10] = await Promise.all([readEntry(git, x6, format3), readEntry(git, y3, format3)]);
|
|
123253
|
+
return !!a9 && !!b10 && a9.side.body === b10.side.body && exactToken(withoutItemKeys(a9.side.data)) === exactToken(withoutItemKeys(b10.side.data));
|
|
123254
|
+
}
|
|
122965
123255
|
var Resolver = class {
|
|
122966
123256
|
constructor(args, moves) {
|
|
122967
123257
|
this.args = args;
|
|
@@ -123107,6 +123397,49 @@ var Resolver = class {
|
|
|
123107
123397
|
...merged.keyRemaps.length > 0 && { remaps: merged.keyRemaps }
|
|
123108
123398
|
};
|
|
123109
123399
|
}
|
|
123400
|
+
/** In {@link FieldMergeArgs.rekeyOnly}: git's merged entry under the field merge's item keys. */
|
|
123401
|
+
async rekeyed(unit, gitFile) {
|
|
123402
|
+
const { git } = this.args;
|
|
123403
|
+
const [o8, a9, b10] = [unit.ancestor, sideFile(unit, "base"), sideFile(unit, "branch")];
|
|
123404
|
+
if (!a9 || !b10 || !gitFile || a9.oid === b10.oid) return null;
|
|
123405
|
+
const format3 = formatOf(gitFile.path);
|
|
123406
|
+
if (!format3 || [o8, a9, b10].some((f9) => f9 && formatOf(f9.path) !== format3)) return null;
|
|
123407
|
+
const [oSide, aSide, bSide, gitSide] = await Promise.all(
|
|
123408
|
+
[o8, a9, b10, gitFile].map((f9) => f9 ? readEntry(git, f9, format3) : void 0)
|
|
123409
|
+
);
|
|
123410
|
+
if (!aSide || !bSide || !gitSide || o8 && !oSide) return null;
|
|
123411
|
+
const fields = fieldsFor(this.args.flatSchema, b10.path, this.root);
|
|
123412
|
+
let result;
|
|
123413
|
+
try {
|
|
123414
|
+
result = mergeEntry({
|
|
123415
|
+
format: format3,
|
|
123416
|
+
ancestor: oSide?.side ?? { data: {} },
|
|
123417
|
+
base: aSide.side,
|
|
123418
|
+
branch: bSide.side,
|
|
123419
|
+
...fields && { fields }
|
|
123420
|
+
});
|
|
123421
|
+
} catch {
|
|
123422
|
+
return null;
|
|
123423
|
+
}
|
|
123424
|
+
if (result.kind !== "merged" || result.conflicts.length > 0) return null;
|
|
123425
|
+
if (result.body !== gitSide.side.body) return null;
|
|
123426
|
+
const data4 = rekeyAsMerged(gitSide.side.data, result.data);
|
|
123427
|
+
if (!isPlainRecord(data4) || exactToken(data4) === exactToken(gitSide.side.data)) return null;
|
|
123428
|
+
const merged = { data: data4, ...result.body !== void 0 && { body: result.body } };
|
|
123429
|
+
const file = await this.bytesFor(
|
|
123430
|
+
{
|
|
123431
|
+
base: { file: gitFile, text: gitSide.text },
|
|
123432
|
+
branch: gitFile,
|
|
123433
|
+
isBase: false,
|
|
123434
|
+
isBranch: false,
|
|
123435
|
+
reads: (text4) => readsAs(text4, format3, merged),
|
|
123436
|
+
serialize: (onto) => serializeEntry(format3, merged, onto)
|
|
123437
|
+
},
|
|
123438
|
+
gitFile.path
|
|
123439
|
+
);
|
|
123440
|
+
if (!file) return null;
|
|
123441
|
+
return { file, ...result.keyRemaps.length > 0 && { remaps: result.keyRemaps } };
|
|
123442
|
+
}
|
|
123110
123443
|
/** A `.collection.json` both sides changed and both still have; else git's rule. */
|
|
123111
123444
|
async collectionMeta(unit, gitClean, gitFile) {
|
|
123112
123445
|
const { git } = this.args;
|
|
@@ -123202,7 +123535,11 @@ async function resolveFieldMerge(args) {
|
|
|
123202
123535
|
const gitClean = ![...paths].some((p8) => args.conflicted.has(p8));
|
|
123203
123536
|
const only = gitHeld.size === 1 ? [...gitHeld.values()][0] : void 0;
|
|
123204
123537
|
let resolution;
|
|
123205
|
-
if (
|
|
123538
|
+
if (args.rekeyOnly) {
|
|
123539
|
+
if (unit.kind !== "entry" || !unit.touched.base || !unit.touched.branch) continue;
|
|
123540
|
+
resolution = await resolver2.rekeyed(unit, only);
|
|
123541
|
+
if (resolution === null) continue;
|
|
123542
|
+
} else if (unit.touched.base && unit.touched.branch) {
|
|
123206
123543
|
resolution = unit.kind === "entry" ? await resolver2.entry(unit, gitClean, only) : await resolver2.collectionMeta(unit, gitClean, only);
|
|
123207
123544
|
if (resolution === null) continue;
|
|
123208
123545
|
} else {
|
|
@@ -123257,8 +123594,8 @@ function parseMergeTree(output, head, other) {
|
|
|
123257
123594
|
for (; i10 < fields.length && fields[i10] !== ""; i10++) {
|
|
123258
123595
|
const match2 = /^(\d+) ([0-9a-f]+) (\d)\t([\s\S]*)$/.exec(fields[i10]);
|
|
123259
123596
|
if (!match2) throw new Error(`Unreadable git merge-tree entry: ${JSON.stringify(fields[i10])}`);
|
|
123260
|
-
const [, mode, oid, stage,
|
|
123261
|
-
stages.push({ mode, oid, stage, path:
|
|
123597
|
+
const [, mode, oid, stage, path44] = match2;
|
|
123598
|
+
stages.push({ mode, oid, stage, path: path44 });
|
|
123262
123599
|
}
|
|
123263
123600
|
const unsettled = [];
|
|
123264
123601
|
for (i10++; i10 < fields.length && fields[i10] !== ""; ) {
|
|
@@ -123269,7 +123606,7 @@ function parseMergeTree(output, head, other) {
|
|
|
123269
123606
|
}
|
|
123270
123607
|
i10 += count + 3;
|
|
123271
123608
|
}
|
|
123272
|
-
const undecodable = stages.filter(({ path:
|
|
123609
|
+
const undecodable = stages.filter(({ path: path44 }) => path44.includes("\uFFFD")).map(({ path: path44 }) => path44);
|
|
123273
123610
|
if (undecodable.length > 0) unsettled.push({ kind: "an unreadable file name", paths: [] });
|
|
123274
123611
|
return { tree, stages, unsettled };
|
|
123275
123612
|
}
|
|
@@ -123295,7 +123632,7 @@ async function planMerge(git, clonePath, args) {
|
|
|
123295
123632
|
other
|
|
123296
123633
|
]);
|
|
123297
123634
|
const { tree: gitTree, stages, unsettled } = parseMergeTree(output, head, other);
|
|
123298
|
-
const gitConflicted = [...new Set(stages.map(({ path:
|
|
123635
|
+
const gitConflicted = [...new Set(stages.map(({ path: path44 }) => path44))];
|
|
123299
123636
|
const field = bases.length === 1 ? await resolveFieldMerge({
|
|
123300
123637
|
git,
|
|
123301
123638
|
clonePath,
|
|
@@ -123338,7 +123675,7 @@ async function planMerge(git, clonePath, args) {
|
|
|
123338
123675
|
gitTree,
|
|
123339
123676
|
gitConflicted,
|
|
123340
123677
|
conflicts: conflicts2,
|
|
123341
|
-
keptPaths: [.../* @__PURE__ */ new Set([...field.conflicts.map(({ path:
|
|
123678
|
+
keptPaths: [.../* @__PURE__ */ new Set([...field.conflicts.map(({ path: path44 }) => path44), ...kept])],
|
|
123342
123679
|
keyRemaps: field.keyRemaps,
|
|
123343
123680
|
paths: field.paths,
|
|
123344
123681
|
asGitDoes: gitConflicted.length === 0 && conflicts2.length === 0 && field.keyRemaps.length === 0 && tree === gitTree
|
|
@@ -123372,7 +123709,7 @@ async function commitMerge(git, plan, { head, other, message: message2 }) {
|
|
|
123372
123709
|
return { kind: "built", sha, ...rest };
|
|
123373
123710
|
}
|
|
123374
123711
|
var mergesAsGitDoes = (plan) => plan.kind === "planned" && plan.asGitDoes;
|
|
123375
|
-
async function isCleanMergeOf(git, merged, from, other) {
|
|
123712
|
+
async function isCleanMergeOf(git, merged, from, other, contentRoot) {
|
|
123376
123713
|
const output = await git.raw([
|
|
123377
123714
|
"merge-tree",
|
|
123378
123715
|
"--write-tree",
|
|
@@ -123383,7 +123720,81 @@ async function isCleanMergeOf(git, merged, from, other) {
|
|
|
123383
123720
|
]);
|
|
123384
123721
|
const { tree, stages } = parseMergeTree(output, from, other);
|
|
123385
123722
|
if (stages.length > 0) return false;
|
|
123386
|
-
|
|
123723
|
+
const mergedTree = (await git.revparse(["--verify", "--end-of-options", `${merged}^{tree}`])).trim();
|
|
123724
|
+
if (mergedTree === tree) return true;
|
|
123725
|
+
for (const { before, after } of await changedFiles(git, tree, mergedTree)) {
|
|
123726
|
+
if (!before || !after || !await differsInItemKeysOnly(git, before, after, contentRoot)) {
|
|
123727
|
+
return false;
|
|
123728
|
+
}
|
|
123729
|
+
}
|
|
123730
|
+
return true;
|
|
123731
|
+
}
|
|
123732
|
+
async function buildRekey(git, clonePath, args) {
|
|
123733
|
+
const { from, tip, contentRoot, timeoutMs, message: message2, unchangedIn } = args;
|
|
123734
|
+
const merges = (await git.raw([
|
|
123735
|
+
"rev-list",
|
|
123736
|
+
"--first-parent",
|
|
123737
|
+
"--merges",
|
|
123738
|
+
"--reverse",
|
|
123739
|
+
"--end-of-options",
|
|
123740
|
+
`${from}..${tip}`
|
|
123741
|
+
])).split("\n").filter((line) => OBJECT_ID2.test(line));
|
|
123742
|
+
if (merges.length === 0) return null;
|
|
123743
|
+
const flatSchema = await readSchemaSnapshot(clonePath);
|
|
123744
|
+
const updates = /* @__PURE__ */ new Map();
|
|
123745
|
+
const keyRemaps = [];
|
|
123746
|
+
for (const merge2 of merges) {
|
|
123747
|
+
const parents = (await git.raw(["rev-list", "--parents", "-n", "1", "--end-of-options", merge2])).trim().split(" ").slice(1);
|
|
123748
|
+
if (parents.length !== 2) continue;
|
|
123749
|
+
const bases = (await git.raw(["merge-base", "--all", "--end-of-options", ...parents])).split("\n").filter((line) => OBJECT_ID2.test(line));
|
|
123750
|
+
if (bases.length !== 1) continue;
|
|
123751
|
+
const field = await resolveFieldMerge({
|
|
123752
|
+
git,
|
|
123753
|
+
clonePath,
|
|
123754
|
+
ancestor: bases[0],
|
|
123755
|
+
head: parents[0],
|
|
123756
|
+
other: parents[1],
|
|
123757
|
+
mergedTree: (await git.revparse(["--verify", "--end-of-options", `${merge2}^{tree}`])).trim(),
|
|
123758
|
+
conflicted: /* @__PURE__ */ new Set(),
|
|
123759
|
+
contentRoot,
|
|
123760
|
+
flatSchema,
|
|
123761
|
+
collectionIdOf: (file) => conflictFilesToContentIds([file], contentRoot)[0],
|
|
123762
|
+
timeoutMs,
|
|
123763
|
+
rekeyOnly: true
|
|
123764
|
+
});
|
|
123765
|
+
const applied = /* @__PURE__ */ new Set();
|
|
123766
|
+
for (const [file, blob] of field.updates) {
|
|
123767
|
+
if (!blob || await blobAt(git, merge2, file) !== await blobAt(git, tip, file)) continue;
|
|
123768
|
+
if (unchangedIn && await blobAt(git, unchangedIn.head, file) !== await blobAt(git, unchangedIn.since, file)) {
|
|
123769
|
+
continue;
|
|
123770
|
+
}
|
|
123771
|
+
updates.set(file, blob);
|
|
123772
|
+
const id = parseTypedFilename(path28.posix.basename(file))?.id;
|
|
123773
|
+
if (id !== void 0) applied.add(id);
|
|
123774
|
+
}
|
|
123775
|
+
keyRemaps.push(
|
|
123776
|
+
...field.keyRemaps.filter((r10) => r10.contentId !== void 0 && applied.has(r10.contentId))
|
|
123777
|
+
);
|
|
123778
|
+
}
|
|
123779
|
+
if (updates.size === 0) return null;
|
|
123780
|
+
const tipTree = (await git.revparse(["--verify", "--end-of-options", `${tip}^{tree}`])).trim();
|
|
123781
|
+
const tree = await withUpdates(clonePath, { gitTree: tipTree, updates, timeoutMs });
|
|
123782
|
+
const sha = (await git.raw(["commit-tree", "-p", tip, "-m", message2, "--end-of-options", tree])).trim();
|
|
123783
|
+
return {
|
|
123784
|
+
kind: "built",
|
|
123785
|
+
sha,
|
|
123786
|
+
gitConflicted: [],
|
|
123787
|
+
conflicts: [],
|
|
123788
|
+
keptPaths: [],
|
|
123789
|
+
asGitDoes: false,
|
|
123790
|
+
keyRemaps,
|
|
123791
|
+
paths: /* @__PURE__ */ new Map()
|
|
123792
|
+
};
|
|
123793
|
+
}
|
|
123794
|
+
async function blobAt(git, commit, file) {
|
|
123795
|
+
const out = await git.raw(["rev-parse", "--verify", "--quiet", "--end-of-options", `${commit}:${file}`]).catch(() => "");
|
|
123796
|
+
const oid = out.trim();
|
|
123797
|
+
return OBJECT_ID2.test(oid) ? oid : null;
|
|
123387
123798
|
}
|
|
123388
123799
|
async function withUpdates(clonePath, args) {
|
|
123389
123800
|
const { gitTree, updates, timeoutMs } = args;
|
|
@@ -123449,8 +123860,16 @@ function conflictFilesToContentIds(conflictedFiles, contentRoot) {
|
|
|
123449
123860
|
return [...new Set(conflictIds)];
|
|
123450
123861
|
}
|
|
123451
123862
|
|
|
123863
|
+
// ../canopycms/src/worker/publish-decision.ts
|
|
123864
|
+
async function decidePublish(git, { head, published }) {
|
|
123865
|
+
if (published === null) return { kind: "never-published" };
|
|
123866
|
+
if (published === head) return { kind: "publish" };
|
|
123867
|
+
const { onlyA } = await commitsApart(git, head, published);
|
|
123868
|
+
return onlyA === 0 ? { kind: "publish" } : { kind: "hold" };
|
|
123869
|
+
}
|
|
123870
|
+
|
|
123452
123871
|
// ../canopycms/src/worker/github-commits.ts
|
|
123453
|
-
var
|
|
123872
|
+
var COMMIT_ID2 = /^[0-9a-f]{40}([0-9a-f]{24})?$/;
|
|
123454
123873
|
var MAX_LISTED_PATH_LENGTH = 200;
|
|
123455
123874
|
var REWRITTEN_PUSH_REFUSAL = "This branch was changed on GitHub in a way CanopyCMS can't combine with the work here, so nothing was pushed. Nothing is lost.";
|
|
123456
123875
|
var SEEN_COMMIT_GONE_PUSH_REFUSAL = "A commit this branch had on GitHub is no longer there, so nothing was pushed. Nothing is lost.";
|
|
@@ -123479,7 +123898,9 @@ async function catchUpWithPublished(ctx, args) {
|
|
|
123479
123898
|
await fetchFromRemoteGit(git, ctx.remoteGitPath, `refs/heads/${branchRef}`);
|
|
123480
123899
|
}
|
|
123481
123900
|
const parents = (await git.raw(["rev-list", "--parents", "-n", "1", "--end-of-options", published])).trim().split(" ");
|
|
123482
|
-
|
|
123901
|
+
const builtOnHead = parents.length === 3 && parents[1] === head;
|
|
123902
|
+
const rekeyPastHead = parents.length === 2 && await contains(git, published, head);
|
|
123903
|
+
if (!builtOnHead && !rekeyPastHead) return null;
|
|
123483
123904
|
return fastForward(ctx, args, head, published);
|
|
123484
123905
|
}
|
|
123485
123906
|
async function bringInGitHubCommits(ctx, args) {
|
|
@@ -123520,6 +123941,10 @@ async function bringInGitHubCommits(ctx, args) {
|
|
|
123520
123941
|
}
|
|
123521
123942
|
if (published !== null && published !== head) {
|
|
123522
123943
|
if ((await commitsApart(git, head, published)).onlyA === 0) {
|
|
123944
|
+
if (gitHubTip === published) {
|
|
123945
|
+
const rekeyed = await rekeyTakenIn(ctx, args, head, published);
|
|
123946
|
+
if (rekeyed) return rekeyed;
|
|
123947
|
+
}
|
|
123523
123948
|
const stopped = await fastForward(ctx, args, head, published);
|
|
123524
123949
|
if (stopped) return stopped;
|
|
123525
123950
|
head = published;
|
|
@@ -123565,7 +123990,7 @@ async function rewrittenFrom({ git, metaFile }, tip, head, published) {
|
|
|
123565
123990
|
const { lastGitHubTip, historyRewrittenFrom } = metaFile.branch;
|
|
123566
123991
|
const unrecorded = lastGitHubTip === void 0 && published !== null && published !== head && await contains(git, published, head) && !await contains(git, published, tip) ? published : void 0;
|
|
123567
123992
|
const known = [historyRewrittenFrom, lastGitHubTip ?? unrecorded].filter(
|
|
123568
|
-
(sha) => sha !== void 0 &&
|
|
123993
|
+
(sha) => sha !== void 0 && COMMIT_ID2.test(sha)
|
|
123569
123994
|
);
|
|
123570
123995
|
if (known.length === 0) return null;
|
|
123571
123996
|
if (await contains(git, tip, head) && (published === null || await contains(git, tip, published))) {
|
|
@@ -123639,7 +124064,7 @@ async function fastForward(ctx, args, from, to) {
|
|
|
123639
124064
|
try {
|
|
123640
124065
|
await moveClone(git, branchPath, to);
|
|
123641
124066
|
} catch (err) {
|
|
123642
|
-
if (
|
|
124067
|
+
if (!overwritesSaves(err)) throw err;
|
|
123643
124068
|
workerLog(` ${branchDir}: local changes overlap commits from GitHub, which wait for a submit`);
|
|
123644
124069
|
return { kind: "wait" };
|
|
123645
124070
|
}
|
|
@@ -123657,7 +124082,80 @@ async function fastForward(ctx, args, from, to) {
|
|
|
123657
124082
|
}
|
|
123658
124083
|
return null;
|
|
123659
124084
|
}
|
|
124085
|
+
async function rekeyTakenIn(ctx, args, head, tip) {
|
|
124086
|
+
const { git, branchPath, branchDir, branchRef, gatewayPolicy, lockLost } = args;
|
|
124087
|
+
if (gatewayPolicy && !publishesBranch(gatewayPolicy, branchRef)) return null;
|
|
124088
|
+
const published = await readPublishedSha(ctx, branchRef);
|
|
124089
|
+
if ((await decidePublish(git, { head, published })).kind !== "publish") return null;
|
|
124090
|
+
const built = await rekeyOf(ctx, args, head, tip);
|
|
124091
|
+
if (built === null) return null;
|
|
124092
|
+
const { sha } = built;
|
|
124093
|
+
if (args.dirty && await savesMeet(git, head, sha)) return null;
|
|
124094
|
+
if (published !== null && !await contains(git, sha, published)) return null;
|
|
124095
|
+
const refused = await refuseIncoming(args, head, sha);
|
|
124096
|
+
if (refused) return refused;
|
|
124097
|
+
if (lockLost()) return { kind: "wait" };
|
|
124098
|
+
if (await changesWhatWasReviewed(ctx, args, head, sha)) await returnToReview(ctx, args);
|
|
124099
|
+
await recordMerge(ctx, args, built, { head, also: tip, fromGitHub: true });
|
|
124100
|
+
if (lockLost()) return { kind: "wait" };
|
|
124101
|
+
await recordSeenOnGitHub(ctx, branchRef, tip);
|
|
124102
|
+
if (!await publishPlainToLocalRemote(ctx, branchPath, branchRef, sha)) return { kind: "wait" };
|
|
124103
|
+
await enqueueGitHubPush(ctx, branchRef, gatewayPolicy);
|
|
124104
|
+
if (lockLost()) return { kind: "wait" };
|
|
124105
|
+
try {
|
|
124106
|
+
await moveClone(git, branchPath, sha);
|
|
124107
|
+
} catch (err) {
|
|
124108
|
+
if (!overwritesSaves(err)) throw err;
|
|
124109
|
+
workerLog(` ${branchDir}: local changes overlap commits from GitHub, which wait for a submit`);
|
|
124110
|
+
return { kind: "wait" };
|
|
124111
|
+
}
|
|
124112
|
+
await landed(ctx, args, sha).catch(
|
|
124113
|
+
(err) => workerLogWarn(
|
|
124114
|
+
` ${branchDir}: what this re-key moves is noted on the next cycle: ${getErrorMessage(err)}`
|
|
124115
|
+
)
|
|
124116
|
+
);
|
|
124117
|
+
await recordGitHubTip(ctx, args, tip);
|
|
124118
|
+
workerLog(
|
|
124119
|
+
` ${branchDir}: brought in commits from GitHub, with the items its merges brought in keyed anew (now at ${sha.slice(0, 7)})`
|
|
124120
|
+
);
|
|
124121
|
+
return { kind: "merged", keptEntries: 0 };
|
|
124122
|
+
}
|
|
124123
|
+
function rekeyOf(ctx, { git, branchPath, branchRef }, head, tip, unchangedIn) {
|
|
124124
|
+
return buildRekey(git, branchPath, {
|
|
124125
|
+
from: head,
|
|
124126
|
+
tip,
|
|
124127
|
+
contentRoot: ctx.contentRoot,
|
|
124128
|
+
timeoutMs: ctx.taskTimeoutMs,
|
|
124129
|
+
message: `Key the items that merges on GitHub brought into ${branchRef}`,
|
|
124130
|
+
...unchangedIn && { unchangedIn }
|
|
124131
|
+
});
|
|
124132
|
+
}
|
|
124133
|
+
async function savesMeet(git, from, to) {
|
|
124134
|
+
const saved = new Set(
|
|
124135
|
+
(await git.status([...SHARED_REPO_STATUS_ARGS])).files.flatMap(
|
|
124136
|
+
(f9) => f9.from ? [f9.path, f9.from] : [f9.path]
|
|
124137
|
+
)
|
|
124138
|
+
);
|
|
124139
|
+
const changed = (await git.raw(["diff-tree", "-r", "-z", "--name-only", "--end-of-options", from, to])).split("\0").filter(Boolean);
|
|
124140
|
+
return changed.some((file) => saved.has(file));
|
|
124141
|
+
}
|
|
124142
|
+
var SavesInTheWay = class extends Error {
|
|
124143
|
+
};
|
|
124144
|
+
var overwritesSaves = (err) => err instanceof SavesInTheWay || /would be overwritten/.test(getErrorMessage(err));
|
|
123660
124145
|
async function moveClone(git, branchPath, to) {
|
|
124146
|
+
const deleted = (await git.status([...SHARED_REPO_STATUS_ARGS])).files.flatMap((f9) => [
|
|
124147
|
+
...f9.working_dir === "D" || f9.index === "D" ? [f9.path] : [],
|
|
124148
|
+
...f9.from ? [f9.from] : []
|
|
124149
|
+
]);
|
|
124150
|
+
if (deleted.some((file) => !isCanopyInternalPath(file))) {
|
|
124151
|
+
const changed = new Set(
|
|
124152
|
+
(await git.raw(["diff-tree", "-r", "-z", "--name-only", "--end-of-options", "HEAD", to])).split("\0").filter(Boolean)
|
|
124153
|
+
);
|
|
124154
|
+
const lost = deleted.filter((file) => changed.has(file) && !isCanopyInternalPath(file));
|
|
124155
|
+
if (lost.length > 0) {
|
|
124156
|
+
throw new SavesInTheWay(`saved deletions would be brought back: ${listPaths(lost)}`);
|
|
124157
|
+
}
|
|
124158
|
+
}
|
|
123661
124159
|
await invalidateBranchContentCaches(branchPath);
|
|
123662
124160
|
await git.raw(["merge", "--ff-only", "--end-of-options", to]);
|
|
123663
124161
|
await invalidateBranchContentCaches(branchPath);
|
|
@@ -123665,9 +124163,12 @@ async function moveClone(git, branchPath, to) {
|
|
|
123665
124163
|
async function mergeIntoBranch(ctx, args, merge2) {
|
|
123666
124164
|
const { git, branchPath, branchDir, branchRef, gatewayPolicy, lockLost } = args;
|
|
123667
124165
|
const { head, other, message: message2, fromGitHub, inReview } = merge2;
|
|
124166
|
+
const bases = fromGitHub ? (await git.raw(["merge-base", "--all", "--end-of-options", head, other])).split("\n").filter((line) => COMMIT_ID2.test(line)) : [];
|
|
124167
|
+
const rekey = bases.length === 1 ? await rekeyOf(ctx, args, head, other, { head, since: bases[0] }) : null;
|
|
124168
|
+
const into = rekey?.sha ?? other;
|
|
123668
124169
|
const plan = await planMerge(git, branchPath, {
|
|
123669
124170
|
head,
|
|
123670
|
-
other,
|
|
124171
|
+
other: into,
|
|
123671
124172
|
contentRoot: ctx.contentRoot,
|
|
123672
124173
|
timeoutMs: ctx.taskTimeoutMs
|
|
123673
124174
|
});
|
|
@@ -123681,7 +124182,8 @@ async function mergeIntoBranch(ctx, args, merge2) {
|
|
|
123681
124182
|
reason: `Git cannot merge ${other} into ${branchRef} by rule: ${plan.conflicts.join(", ")}${plan.paths.length > 0 ? ` (${listPaths(plan.paths)})` : ""}. Nothing was changed. To continue, a developer merges them by hand.`
|
|
123682
124183
|
};
|
|
123683
124184
|
}
|
|
123684
|
-
const
|
|
124185
|
+
const merged = await commitMerge(git, plan, { head, other: into, message: message2 });
|
|
124186
|
+
const built = rekey ? { ...merged, keyRemaps: [...rekey.keyRemaps, ...merged.keyRemaps] } : merged;
|
|
123685
124187
|
const { sha, conflicts: conflicts2 } = built;
|
|
123686
124188
|
const refused = await refuseIncoming(args, head, sha);
|
|
123687
124189
|
if (refused) return refused;
|
|
@@ -123692,17 +124194,26 @@ async function mergeIntoBranch(ctx, args, merge2) {
|
|
|
123692
124194
|
if (published !== null && !await contains(git, sha, published)) {
|
|
123693
124195
|
return { kind: "blocked", reason: unpublishable };
|
|
123694
124196
|
}
|
|
123695
|
-
await recordMerge(ctx, args, built, { head, fromGitHub });
|
|
124197
|
+
await recordMerge(ctx, args, built, { head, ...fromGitHub && { also: other }, fromGitHub });
|
|
123696
124198
|
if (lockLost()) return { kind: "wait" };
|
|
123697
124199
|
if (fromGitHub) await recordSeenOnGitHub(ctx, branchRef, other);
|
|
123698
|
-
|
|
124200
|
+
const publish = await decidePublish(git, { head, published });
|
|
124201
|
+
if (publish.kind === "publish") {
|
|
123699
124202
|
if (!await publishPlainToLocalRemote(ctx, branchPath, branchRef, sha)) {
|
|
123700
124203
|
return { kind: "blocked", reason: unpublishable };
|
|
123701
124204
|
}
|
|
123702
124205
|
await enqueueGitHubPush(ctx, branchRef, gatewayPolicy);
|
|
124206
|
+
} else if (publish.kind === "hold") {
|
|
124207
|
+
workerLog(` ${branchDir}: holds work not yet submitted, so the merge stays unpublished`);
|
|
123703
124208
|
}
|
|
123704
124209
|
if (lockLost()) return { kind: "wait" };
|
|
123705
|
-
|
|
124210
|
+
try {
|
|
124211
|
+
await moveClone(git, branchPath, sha);
|
|
124212
|
+
} catch (err) {
|
|
124213
|
+
if (!overwritesSaves(err)) throw err;
|
|
124214
|
+
workerLog(` ${branchDir}: local changes overlap the merge, which waits for a submit`);
|
|
124215
|
+
return { kind: "wait" };
|
|
124216
|
+
}
|
|
123706
124217
|
await landed(ctx, args, sha).catch(
|
|
123707
124218
|
(err) => workerLogWarn(
|
|
123708
124219
|
` ${branchDir}: what this merge kept is noted on the next cycle: ${getErrorMessage(err)}`
|
|
@@ -123711,7 +124222,7 @@ async function mergeIntoBranch(ctx, args, merge2) {
|
|
|
123711
124222
|
if (fromGitHub) await recordGitHubTip(ctx, args, other);
|
|
123712
124223
|
const keptEntries = new Set(conflicts2.map(({ contentId }) => contentId)).size;
|
|
123713
124224
|
workerLog(
|
|
123714
|
-
keptEntries > 0 ? ` ${branchDir}: merged ${other.slice(0, 7)} (${keptEntries} entr${keptEntries === 1 ? "y" : "ies"} with values for a person to choose: ${listPaths(conflicts2.map(({ path:
|
|
124225
|
+
keptEntries > 0 ? ` ${branchDir}: merged ${other.slice(0, 7)} (${keptEntries} entr${keptEntries === 1 ? "y" : "ies"} with values for a person to choose: ${listPaths(conflicts2.map(({ path: path44 }) => path44))})` : ` ${branchDir}: merged ${other.slice(0, 7)}`
|
|
123715
124226
|
);
|
|
123716
124227
|
return { kind: "merged", keptEntries };
|
|
123717
124228
|
}
|
|
@@ -123733,10 +124244,12 @@ async function contains(git, commit, ancestor) {
|
|
|
123733
124244
|
async function changesWhatWasReviewed(ctx, { git, branchPath }, from, to) {
|
|
123734
124245
|
const fresh = (await BranchMetadataFileManager.loadOnly(branchPath))?.branch;
|
|
123735
124246
|
if (fresh?.status !== "approved") return false;
|
|
124247
|
+
const approved = fresh.review?.commit ?? from;
|
|
124248
|
+
if (!await holdsCommit(git, approved)) return true;
|
|
123736
124249
|
await fetchFromRemoteGit(git, ctx.remoteGitPath, fresh.baseBranch ?? ctx.baseBranch);
|
|
123737
124250
|
const base = (await git.revparse(["FETCH_HEAD"])).trim();
|
|
123738
124251
|
const forkPoint = (await git.raw(["merge-base", "--end-of-options", to, base])).trim();
|
|
123739
|
-
return forkPoint === "" || !await isCleanMergeOf(git, to,
|
|
124252
|
+
return forkPoint === "" || !await isCleanMergeOf(git, to, approved, forkPoint, ctx.contentRoot);
|
|
123740
124253
|
}
|
|
123741
124254
|
async function returnToReview(ctx, { branchPath, branchDir, branchRef, metaFile }) {
|
|
123742
124255
|
const saved = await getBranchMetadataFileManager(branchPath, ctx.contentBranchesPath).saveIf(
|
|
@@ -123750,7 +124263,11 @@ async function returnToReview(ctx, { branchPath, branchDir, branchRef, metaFile
|
|
|
123750
124263
|
async function recordMerge(ctx, args, built, merge2) {
|
|
123751
124264
|
const { git, branchPath, branchRef } = args;
|
|
123752
124265
|
const { sha, conflicts: conflicts2, keptPaths, keyRemaps, paths } = built;
|
|
123753
|
-
const inHead = await settleRecord(git, branchPath, merge2.head);
|
|
124266
|
+
const inHead = await settleRecord(git, branchPath, merge2.head, merge2.also);
|
|
124267
|
+
const earlier = (await new MergeConflictStore(branchPath).read())?.landing;
|
|
124268
|
+
if (earlier && earlier.mergeSha !== sha && inHead(earlier.mergeSha)) {
|
|
124269
|
+
await noteKeptOverGitHub(ctx, args, earlier.keptOverGitHub ?? []);
|
|
124270
|
+
}
|
|
123754
124271
|
const state3 = await new MergeConflictStore(branchPath).update((current2) => ({
|
|
123755
124272
|
entries: withFoundConflicts(
|
|
123756
124273
|
withRemappedItemKeys(
|
|
@@ -123794,23 +124311,28 @@ async function landed(ctx, {
|
|
|
123794
124311
|
);
|
|
123795
124312
|
const landing = current2.landing;
|
|
123796
124313
|
if (landing?.mergeSha !== sha) return;
|
|
123797
|
-
|
|
123798
|
-
if (kept.length > 0) {
|
|
123799
|
-
await getBranchMetadataFileManager(branchPath, ctx.contentBranchesPath).update(
|
|
123800
|
-
(existing) => existing?.branch.name === branchRef ? {
|
|
123801
|
-
branch: {
|
|
123802
|
-
keptOverGitHub: [.../* @__PURE__ */ new Set([...existing.branch.keptOverGitHub ?? [], ...kept])]
|
|
123803
|
-
}
|
|
123804
|
-
} : null
|
|
123805
|
-
);
|
|
123806
|
-
await enqueueReviewBlockSync(ctx, branchRef, metaFile);
|
|
123807
|
-
}
|
|
124314
|
+
await noteKeptOverGitHub(ctx, { branchPath, branchRef, metaFile }, landing.keptOverGitHub ?? []);
|
|
123808
124315
|
await store.update((now) => {
|
|
123809
124316
|
if (now?.landing?.mergeSha !== sha) return null;
|
|
123810
124317
|
const { landing: _done, ...rest } = now;
|
|
123811
124318
|
return rest;
|
|
123812
124319
|
});
|
|
123813
124320
|
}
|
|
124321
|
+
async function noteKeptOverGitHub(ctx, {
|
|
124322
|
+
branchPath,
|
|
124323
|
+
branchRef,
|
|
124324
|
+
metaFile
|
|
124325
|
+
}, kept) {
|
|
124326
|
+
if (kept.length === 0) return;
|
|
124327
|
+
await getBranchMetadataFileManager(branchPath, ctx.contentBranchesPath).update(
|
|
124328
|
+
(existing) => existing?.branch.name === branchRef ? {
|
|
124329
|
+
branch: {
|
|
124330
|
+
keptOverGitHub: [.../* @__PURE__ */ new Set([...existing.branch.keptOverGitHub ?? [], ...kept])]
|
|
124331
|
+
}
|
|
124332
|
+
} : null
|
|
124333
|
+
);
|
|
124334
|
+
await enqueueReviewBlockSync(ctx, branchRef, metaFile);
|
|
124335
|
+
}
|
|
123814
124336
|
function mergesNamedBy(entry) {
|
|
123815
124337
|
return [
|
|
123816
124338
|
entry.mergeSha,
|
|
@@ -123832,20 +124354,21 @@ async function mergesHeld(git, state3, tips) {
|
|
|
123832
124354
|
}
|
|
123833
124355
|
return held;
|
|
123834
124356
|
}
|
|
123835
|
-
async function settleRecord(git, branchPath, head) {
|
|
124357
|
+
async function settleRecord(git, branchPath, head, also) {
|
|
123836
124358
|
const store = new MergeConflictStore(branchPath);
|
|
123837
124359
|
const current2 = await store.read();
|
|
123838
124360
|
if (current2 === null) return () => true;
|
|
123839
|
-
const [held] = await mergesHeld(git, current2, [head]);
|
|
124361
|
+
const [held, alsoHeld] = await mergesHeld(git, current2, also ? [head, also] : [head]);
|
|
123840
124362
|
const known = /* @__PURE__ */ new Set([
|
|
123841
124363
|
...Object.values(current2.entries).flatMap(mergesNamedBy),
|
|
123842
124364
|
...(current2.remaps ?? []).map(({ mergeSha }) => mergeSha)
|
|
123843
124365
|
]);
|
|
123844
124366
|
const inHead = (sha) => held.has(sha) || !known.has(sha);
|
|
123845
|
-
|
|
124367
|
+
const kept = (sha) => inHead(sha) || (alsoHeld?.has(sha) ?? false);
|
|
124368
|
+
await applyRemaps(branchPath, inHead, (sha) => !kept(sha)).catch(
|
|
123846
124369
|
(err) => workerLogWarn(` comment threads keep their item keys for now: ${getErrorMessage(err)}`)
|
|
123847
124370
|
);
|
|
123848
|
-
return
|
|
124371
|
+
return kept;
|
|
123849
124372
|
}
|
|
123850
124373
|
async function applyRemaps(branchPath, landed2, gone = () => false) {
|
|
123851
124374
|
const store = new MergeConflictStore(branchPath);
|
|
@@ -123987,30 +124510,6 @@ function isPermanentTaskFailure(err) {
|
|
|
123987
124510
|
if (status === 403 && isRateLimitSignal403(err)) return false;
|
|
123988
124511
|
return status >= 400 && status < 500;
|
|
123989
124512
|
}
|
|
123990
|
-
function getHttpStatus2(err) {
|
|
123991
|
-
if (err instanceof Error && "status" in err) {
|
|
123992
|
-
const status = err.status;
|
|
123993
|
-
if (typeof status === "number") return status;
|
|
123994
|
-
}
|
|
123995
|
-
return null;
|
|
123996
|
-
}
|
|
123997
|
-
function getResponseHeaders(err) {
|
|
123998
|
-
if (typeof err !== "object" || err === null || !("response" in err)) return null;
|
|
123999
|
-
const response = err.response;
|
|
124000
|
-
if (typeof response !== "object" || response === null || !("headers" in response)) return null;
|
|
124001
|
-
const headers = response.headers;
|
|
124002
|
-
if (typeof headers !== "object" || headers === null) return null;
|
|
124003
|
-
return headers;
|
|
124004
|
-
}
|
|
124005
|
-
function isRateLimitSignal403(err) {
|
|
124006
|
-
const headers = getResponseHeaders(err);
|
|
124007
|
-
if (headers) {
|
|
124008
|
-
if (headers["x-ratelimit-remaining"] === "0") return true;
|
|
124009
|
-
if (typeof headers["retry-after"] === "string" && headers["retry-after"].length > 0) return true;
|
|
124010
|
-
}
|
|
124011
|
-
if (err instanceof Error && /rate limit/i.test(err.message)) return true;
|
|
124012
|
-
return false;
|
|
124013
|
-
}
|
|
124014
124513
|
function isSettingsBranch(branch) {
|
|
124015
124514
|
return branch.startsWith(RESERVED_SETTINGS_BRANCH_PREFIX);
|
|
124016
124515
|
}
|
|
@@ -124350,6 +124849,7 @@ async function updateBranchMetadata(ctx, task, result) {
|
|
|
124350
124849
|
return;
|
|
124351
124850
|
}
|
|
124352
124851
|
let found = false;
|
|
124852
|
+
let newPullRequest = false;
|
|
124353
124853
|
await meta.update(
|
|
124354
124854
|
(existing) => {
|
|
124355
124855
|
if (existing?.branch.name !== branch) return null;
|
|
@@ -124368,6 +124868,7 @@ async function updateBranchMetadata(ctx, task, result) {
|
|
|
124368
124868
|
}
|
|
124369
124869
|
if (result.prUrl && !archived) updates.pullRequestUrl = result.prUrl;
|
|
124370
124870
|
if (result.prNumber && !archived) {
|
|
124871
|
+
newPullRequest = existing.branch.pullRequestNumber !== result.prNumber;
|
|
124371
124872
|
updates.pullRequestNumber = result.prNumber;
|
|
124372
124873
|
const terminal = existing.branch.pullRequestState === "merged" || existing.branch.pullRequestState === "closed";
|
|
124373
124874
|
if (!terminal) {
|
|
@@ -124379,6 +124880,7 @@ async function updateBranchMetadata(ctx, task, result) {
|
|
|
124379
124880
|
{ keepUpdatedAt: true }
|
|
124380
124881
|
);
|
|
124381
124882
|
if (!found) noMetadataToRecord(branch, `${task.action} outcome`);
|
|
124883
|
+
if (newPullRequest) ctx.requestBranchSync(branch);
|
|
124382
124884
|
} catch (err) {
|
|
124383
124885
|
workerLogError(
|
|
124384
124886
|
`Failed to update metadata for ${branch}:`,
|
|
@@ -124483,7 +124985,7 @@ async function pushBranchToGitHub(ctx, branch, signal) {
|
|
|
124483
124985
|
};
|
|
124484
124986
|
const readSeen = async () => {
|
|
124485
124987
|
const seen = (await readMetadata())?.branch.lastGitHubTip;
|
|
124486
|
-
return marker === void 0 && seen !== void 0 &&
|
|
124988
|
+
return marker === void 0 && seen !== void 0 && COMMIT_ID2.test(seen) ? seen : void 0;
|
|
124487
124989
|
};
|
|
124488
124990
|
let outgoingSha;
|
|
124489
124991
|
let outcome;
|
|
@@ -124526,6 +125028,7 @@ async function pushBranchToGitHub(ctx, branch, signal) {
|
|
|
124526
125028
|
if (outcome.pastStaleLease) {
|
|
124527
125029
|
await clearHistoryRewrittenMarker(ctx, branchPath, branch);
|
|
124528
125030
|
await recordPushedToGitHub(ctx, branchPath, branch, outgoingSha);
|
|
125031
|
+
wakeForConflictsStatus(ctx, branch, outcome);
|
|
124529
125032
|
logPushOutcome(ctx, branch, outcome, "GitHub had already moved past the rewritten commit");
|
|
124530
125033
|
return;
|
|
124531
125034
|
}
|
|
@@ -124533,8 +125036,12 @@ async function pushBranchToGitHub(ctx, branch, signal) {
|
|
|
124533
125036
|
await clearHistoryRewrittenMarker(ctx, branchPath, branch);
|
|
124534
125037
|
}
|
|
124535
125038
|
await recordPushedToGitHub(ctx, branchPath, branch, outgoingSha);
|
|
125039
|
+
wakeForConflictsStatus(ctx, branch, outcome);
|
|
124536
125040
|
logPushOutcome(ctx, branch, outcome);
|
|
124537
125041
|
}
|
|
125042
|
+
function wakeForConflictsStatus(ctx, branch, outcome) {
|
|
125043
|
+
if (outcome.moved && !isSettingsBranch(branch)) ctx.requestBranchSync(branch);
|
|
125044
|
+
}
|
|
124538
125045
|
function logPushOutcome(ctx, branch, outcome, note) {
|
|
124539
125046
|
const suffix = note === void 0 ? "" : `; ${note}`;
|
|
124540
125047
|
if (outcome.moved) {
|
|
@@ -124733,8 +125240,20 @@ async function carryForwardRewrittenHistory(ctx, args) {
|
|
|
124733
125240
|
);
|
|
124734
125241
|
return;
|
|
124735
125242
|
}
|
|
124736
|
-
|
|
125243
|
+
const publish = await forcePublishToLocalRemote(
|
|
125244
|
+
ctx,
|
|
125245
|
+
branchPath,
|
|
125246
|
+
branchRef,
|
|
125247
|
+
publishedSha,
|
|
125248
|
+
rebasedHead
|
|
125249
|
+
);
|
|
125250
|
+
if (publish.kind === "published") {
|
|
124737
125251
|
await enqueueGitHubPush(ctx, branchRef, gatewayPolicy);
|
|
125252
|
+
} else if (publish.kind === "failed") {
|
|
125253
|
+
const reason = redactCredentials(
|
|
125254
|
+
`this branch's rebased history could not be published into the deployment's repository: ${publish.message}`
|
|
125255
|
+
);
|
|
125256
|
+
await recordRebaseFailure(ctx, branchPath, branchDir, reason, branchRef);
|
|
124738
125257
|
}
|
|
124739
125258
|
} else {
|
|
124740
125259
|
const divergence = `rebased locally, but remote.git holds ${publishedSha} for ${branchRef}, which this clone never had (a direct push to the branch?). Left untouched -- reconcile it before submitting again.`;
|
|
@@ -124755,7 +125274,7 @@ function worthAnotherCycle(branch) {
|
|
|
124755
125274
|
const age = Date.now() - Date.parse(branch.baseUpdateRequestedAt ?? "");
|
|
124756
125275
|
return branch.status === "editing" && isBaseUpdatePending(branch) && age >= -BASE_UPDATE_CLOCK_SKEW_MS && age < BASE_UPDATE_EARLY_RETRY_MS;
|
|
124757
125276
|
}
|
|
124758
|
-
async function answerBaseUpdate(ctx, branchDir, branchPath, probe, outcome,
|
|
125277
|
+
async function answerBaseUpdate(ctx, branchDir, branchPath, probe, outcome, source, requested) {
|
|
124759
125278
|
const { request } = probe;
|
|
124760
125279
|
if (!request) {
|
|
124761
125280
|
if (requested && outcome.kind === "skippedLocked") {
|
|
@@ -124764,21 +125283,20 @@ async function answerBaseUpdate(ctx, branchDir, branchPath, probe, outcome, gitH
|
|
|
124764
125283
|
}
|
|
124765
125284
|
return;
|
|
124766
125285
|
}
|
|
124767
|
-
if (!
|
|
125286
|
+
if (!source || ctx.ensureStatusReport().baseHold) return;
|
|
124768
125287
|
const askAgain = () => {
|
|
124769
125288
|
if (worthAnotherCycle({ status: "editing", baseUpdateRequestedAt: request.requestedAt })) {
|
|
124770
125289
|
ctx.requestBranchSync(request.branchRef);
|
|
124771
125290
|
}
|
|
124772
125291
|
};
|
|
124773
|
-
if (
|
|
125292
|
+
if (source.fetchedAt < Date.parse(request.requestedAt)) return askAgain();
|
|
124774
125293
|
const answer = answerFor(outcome, probe);
|
|
124775
125294
|
if (answer === void 0) return askAgain();
|
|
124776
|
-
|
|
124777
|
-
if (answer !== "failed" && gitHubBase !== void 0 && probe.baseSha !== gitHubBase) {
|
|
125295
|
+
if (answer !== "failed" && source.baseTip !== void 0 && probe.baseSha !== source.baseTip) {
|
|
124778
125296
|
return askAgain();
|
|
124779
125297
|
}
|
|
124780
125298
|
const lastBaseUpdate = {
|
|
124781
|
-
at: new Date(
|
|
125299
|
+
at: new Date(source.fetchedAt).toISOString(),
|
|
124782
125300
|
outcome: answer,
|
|
124783
125301
|
...probe.baseSha !== void 0 && { baseSha: probe.baseSha },
|
|
124784
125302
|
...answer === "conflicts" && { keptEntries: probe.keptEntries }
|
|
@@ -124795,7 +125313,18 @@ async function answerBaseUpdate(ctx, branchDir, branchPath, probe, outcome, gitH
|
|
|
124795
125313
|
);
|
|
124796
125314
|
}
|
|
124797
125315
|
}
|
|
124798
|
-
|
|
125316
|
+
var NO_GITHUB_POLICY = {
|
|
125317
|
+
configured: [],
|
|
125318
|
+
githubDefault: null,
|
|
125319
|
+
namespace: "",
|
|
125320
|
+
legacy: [],
|
|
125321
|
+
settingsBranch: null
|
|
125322
|
+
};
|
|
125323
|
+
var sourceOf = (ctx, gitHub) => ({
|
|
125324
|
+
fetchedAt: gitHub.fetchedAt,
|
|
125325
|
+
baseTip: gitHub.tips.get(ctx.baseBranch)
|
|
125326
|
+
});
|
|
125327
|
+
async function runRebaseCycle(ctx, gatewayPolicy, gitHub, requested = /* @__PURE__ */ new Set(), source = gitHub && sourceOf(ctx, gitHub), local = false) {
|
|
124799
125328
|
const rebased = [];
|
|
124800
125329
|
const skippedDirty = [];
|
|
124801
125330
|
const skippedLocked = [];
|
|
@@ -124812,47 +125341,17 @@ async function runRebaseCycle(ctx, gatewayPolicy, gitHub, requested = /* @__PURE
|
|
|
124812
125341
|
workerLog(" Rebase cycle stopped: the worker is draining");
|
|
124813
125342
|
break;
|
|
124814
125343
|
}
|
|
124815
|
-
|
|
124816
|
-
continue;
|
|
124817
|
-
}
|
|
124818
|
-
const branchPath = path30.join(ctx.contentBranchesPath, branchDir);
|
|
124819
|
-
const gitDir = path30.join(branchPath, ".git");
|
|
124820
|
-
try {
|
|
124821
|
-
const stat = await fs27.stat(gitDir);
|
|
124822
|
-
if (!stat.isDirectory()) {
|
|
124823
|
-
workerLog(` Skipping ${branchDir}: .git is not a directory`);
|
|
124824
|
-
continue;
|
|
124825
|
-
}
|
|
124826
|
-
} catch {
|
|
124827
|
-
workerLog(` Skipping ${branchDir}: no .git directory (not a branch workspace)`);
|
|
124828
|
-
continue;
|
|
124829
|
-
}
|
|
124830
|
-
if (branchDir === ctx.sanitizedBaseBranch) {
|
|
124831
|
-
workerLog(` Skipping ${branchDir}: base branch (refreshed separately)`);
|
|
124832
|
-
continue;
|
|
124833
|
-
}
|
|
124834
|
-
if (isSettingsBranchName(branchDir, ctx.ensureSettingsBranch())) {
|
|
124835
|
-
workerLogWarn(` Skipping ${branchDir}: settings branch, never a content workspace`);
|
|
124836
|
-
continue;
|
|
124837
|
-
}
|
|
124838
|
-
const probe = {};
|
|
124839
|
-
const outcome = await holdAndRebaseOneBranch(
|
|
125344
|
+
const outcome = await syncBranchDir(
|
|
124840
125345
|
ctx,
|
|
124841
125346
|
branchDir,
|
|
124842
|
-
branchPath,
|
|
124843
125347
|
gatewayPolicy,
|
|
124844
125348
|
gitHub,
|
|
124845
|
-
|
|
124846
|
-
|
|
124847
|
-
|
|
124848
|
-
|
|
124849
|
-
branchDir,
|
|
124850
|
-
branchPath,
|
|
124851
|
-
probe,
|
|
124852
|
-
outcome,
|
|
124853
|
-
gitHub,
|
|
124854
|
-
requested.has(branchDir)
|
|
125349
|
+
source,
|
|
125350
|
+
requested.has(branchDir),
|
|
125351
|
+
{},
|
|
125352
|
+
local
|
|
124855
125353
|
);
|
|
125354
|
+
if (outcome === null) continue;
|
|
124856
125355
|
if (outcome.kind === "rebased") rebased.push(branchDir);
|
|
124857
125356
|
else if (outcome.kind === "skippedDirty") skippedDirty.push(branchDir);
|
|
124858
125357
|
else if (outcome.kind === "skippedLocked") skippedLocked.push(branchDir);
|
|
@@ -124863,6 +125362,66 @@ async function runRebaseCycle(ctx, gatewayPolicy, gitHub, requested = /* @__PURE
|
|
|
124863
125362
|
}
|
|
124864
125363
|
return { rebased, skippedDirty, skippedLocked, failed };
|
|
124865
125364
|
}
|
|
125365
|
+
async function syncBranchDir(ctx, branchDir, gatewayPolicy, gitHub, source, requested, probe, local = false) {
|
|
125366
|
+
if (branchDir.startsWith(".") || branchDir === "branches.json") return null;
|
|
125367
|
+
const branchPath = path30.join(ctx.contentBranchesPath, branchDir);
|
|
125368
|
+
const gitDir = path30.join(branchPath, ".git");
|
|
125369
|
+
try {
|
|
125370
|
+
const stat = await fs27.stat(gitDir);
|
|
125371
|
+
if (!stat.isDirectory()) {
|
|
125372
|
+
workerLog(` Skipping ${branchDir}: .git is not a directory`);
|
|
125373
|
+
return null;
|
|
125374
|
+
}
|
|
125375
|
+
} catch {
|
|
125376
|
+
workerLog(` Skipping ${branchDir}: no .git directory (not a branch workspace)`);
|
|
125377
|
+
return null;
|
|
125378
|
+
}
|
|
125379
|
+
if (branchDir === ctx.sanitizedBaseBranch) {
|
|
125380
|
+
workerLog(` Skipping ${branchDir}: base branch (refreshed separately)`);
|
|
125381
|
+
return null;
|
|
125382
|
+
}
|
|
125383
|
+
if (isSettingsBranchName(branchDir, ctx.ensureSettingsBranch())) {
|
|
125384
|
+
workerLogWarn(` Skipping ${branchDir}: settings branch, never a content workspace`);
|
|
125385
|
+
return null;
|
|
125386
|
+
}
|
|
125387
|
+
const outcome = await holdAndRebaseOneBranch(
|
|
125388
|
+
ctx,
|
|
125389
|
+
branchDir,
|
|
125390
|
+
branchPath,
|
|
125391
|
+
local ? NO_GITHUB_POLICY : gatewayPolicy,
|
|
125392
|
+
gitHub,
|
|
125393
|
+
probe,
|
|
125394
|
+
local
|
|
125395
|
+
);
|
|
125396
|
+
await answerBaseUpdate(ctx, branchDir, branchPath, probe, outcome, source, requested);
|
|
125397
|
+
return outcome;
|
|
125398
|
+
}
|
|
125399
|
+
async function syncBranchNow(ctx, branchName) {
|
|
125400
|
+
const startedAt = Date.now();
|
|
125401
|
+
const branchDir = sanitizeBranchName(branchName);
|
|
125402
|
+
const probe = {};
|
|
125403
|
+
const outcome = await syncBranchDir(
|
|
125404
|
+
ctx,
|
|
125405
|
+
branchDir,
|
|
125406
|
+
void 0,
|
|
125407
|
+
void 0,
|
|
125408
|
+
{ fetchedAt: startedAt },
|
|
125409
|
+
true,
|
|
125410
|
+
probe,
|
|
125411
|
+
true
|
|
125412
|
+
);
|
|
125413
|
+
const busy = outcome?.kind === "skippedLocked";
|
|
125414
|
+
const branchPath = path30.join(ctx.contentBranchesPath, branchDir);
|
|
125415
|
+
await getBranchMetadataFileManager(branchPath, ctx.contentBranchesPath).update(
|
|
125416
|
+
(existing) => existing?.branch.name === branchName && existing.branch.status === "editing" && existing.branch.baseUpdateRequestedAt !== void 0 && Date.parse(existing.branch.baseUpdateRequestedAt) <= startedAt && isBaseUpdatePending(existing.branch) ? {
|
|
125417
|
+
branch: {
|
|
125418
|
+
lastBaseUpdate: { at: new Date(startedAt).toISOString(), outcome: "failed" }
|
|
125419
|
+
}
|
|
125420
|
+
} : null,
|
|
125421
|
+
{ keepUpdatedAt: true }
|
|
125422
|
+
);
|
|
125423
|
+
return busy ? "busy" : "answered";
|
|
125424
|
+
}
|
|
124866
125425
|
async function readCloneRef(branchPath) {
|
|
124867
125426
|
try {
|
|
124868
125427
|
const head = (await fs27.readFile(path30.join(branchPath, ".git", "HEAD"), "utf-8")).trim();
|
|
@@ -124897,7 +125456,7 @@ async function restoreRenamedBranch(ctx, branchDir, branchPath, metaFile, namesp
|
|
|
124897
125456
|
return metaFile;
|
|
124898
125457
|
}
|
|
124899
125458
|
}
|
|
124900
|
-
async function holdAndRebaseOneBranch(ctx, branchDir, branchPath, gatewayPolicy, gitHub, probe) {
|
|
125459
|
+
async function holdAndRebaseOneBranch(ctx, branchDir, branchPath, gatewayPolicy, gitHub, probe, local) {
|
|
124901
125460
|
let hold;
|
|
124902
125461
|
try {
|
|
124903
125462
|
hold = await holdProvisionedWorkspace(ctx.contentBranchesPath, branchDir);
|
|
@@ -124919,17 +125478,53 @@ async function holdAndRebaseOneBranch(ctx, branchDir, branchPath, gatewayPolicy,
|
|
|
124919
125478
|
hold.isCompromised,
|
|
124920
125479
|
gatewayPolicy,
|
|
124921
125480
|
gitHub,
|
|
124922
|
-
probe
|
|
125481
|
+
probe,
|
|
125482
|
+
local
|
|
124923
125483
|
);
|
|
124924
125484
|
} finally {
|
|
124925
125485
|
await releaseProvisionedWorkspace(hold.release, branchDir);
|
|
124926
125486
|
}
|
|
124927
125487
|
}
|
|
124928
|
-
async function clearRebaseFailure(ctx, branchPath, branchRef) {
|
|
125488
|
+
async function clearRebaseFailure(ctx, branchPath, branchRef, alsoClear = {}) {
|
|
124929
125489
|
await getBranchMetadataFileManager(branchPath, ctx.contentBranchesPath).update(
|
|
124930
|
-
(current2) => current2?.branch.name === branchRef ? { branch: { rebaseFailure: void 0, ...rewriteCleared(current2.branch) } } : null
|
|
125490
|
+
(current2) => current2?.branch.name === branchRef ? { branch: { rebaseFailure: void 0, ...rewriteCleared(current2.branch), ...alsoClear } } : null
|
|
124931
125491
|
);
|
|
124932
125492
|
}
|
|
125493
|
+
async function noteLatestChangesWaiting(ctx, git, branchPath, metaFile) {
|
|
125494
|
+
if (metaFile.branch.status !== "editing") return;
|
|
125495
|
+
let baseTip;
|
|
125496
|
+
let behind;
|
|
125497
|
+
try {
|
|
125498
|
+
baseTip = await readPublishedSha(ctx, ctx.baseBranch);
|
|
125499
|
+
behind = baseTip !== null && !await contains(git, "HEAD", baseTip);
|
|
125500
|
+
} catch (err) {
|
|
125501
|
+
workerLogWarn(
|
|
125502
|
+
` Could not compare ${escapeForLog(metaFile.branch.name)} with the base: ${getErrorMessage(err)}`
|
|
125503
|
+
);
|
|
125504
|
+
return;
|
|
125505
|
+
}
|
|
125506
|
+
await recordLatestChangesWaiting(
|
|
125507
|
+
ctx,
|
|
125508
|
+
branchPath,
|
|
125509
|
+
metaFile,
|
|
125510
|
+
behind ? baseTip ?? void 0 : void 0
|
|
125511
|
+
);
|
|
125512
|
+
}
|
|
125513
|
+
async function recordLatestChangesWaiting(ctx, branchPath, metaFile, baseSha) {
|
|
125514
|
+
const { name: name3 } = metaFile.branch;
|
|
125515
|
+
const flips = (current2) => current2 === void 0 !== (baseSha === void 0);
|
|
125516
|
+
if (!flips(metaFile.branch.latestChangesWaiting)) return;
|
|
125517
|
+
try {
|
|
125518
|
+
await getBranchMetadataFileManager(branchPath, ctx.contentBranchesPath).update(
|
|
125519
|
+
(current2) => current2?.branch.name === name3 && flips(current2.branch.latestChangesWaiting) ? { branch: { latestChangesWaiting: baseSha } } : null,
|
|
125520
|
+
{ keepUpdatedAt: true }
|
|
125521
|
+
);
|
|
125522
|
+
} catch (err) {
|
|
125523
|
+
workerLogWarn(
|
|
125524
|
+
` Could not record the latest changes waiting for ${escapeForLog(name3)}: ${getErrorMessage(err)}`
|
|
125525
|
+
);
|
|
125526
|
+
}
|
|
125527
|
+
}
|
|
124933
125528
|
async function recordBlocked(ctx, branchDir, branchPath, branchRef, reason) {
|
|
124934
125529
|
const error3 = redactCredentials(reason);
|
|
124935
125530
|
workerLogWarn(` ${branchDir}: ${error3}`);
|
|
@@ -125140,7 +125735,7 @@ async function withContentLockInReview(branchDir, branchPath, isProvisioningLock
|
|
|
125140
125735
|
});
|
|
125141
125736
|
}
|
|
125142
125737
|
}
|
|
125143
|
-
async function rebaseOneBranch(ctx, branchDir, branchPath, isProvisioningLockCompromised, gatewayPolicy, gitHub, probe = {}) {
|
|
125738
|
+
async function rebaseOneBranch(ctx, branchDir, branchPath, isProvisioningLockCompromised, gatewayPolicy, gitHub, probe = {}, local = false) {
|
|
125144
125739
|
let didRebase = false;
|
|
125145
125740
|
try {
|
|
125146
125741
|
const metaFile = await restoreRenamedBranch(
|
|
@@ -125157,6 +125752,7 @@ async function rebaseOneBranch(ctx, branchDir, branchPath, isProvisioningLockCom
|
|
|
125157
125752
|
}
|
|
125158
125753
|
if (metaFile !== null && (branchStatus2 === "submitted" || branchStatus2 === "approved")) {
|
|
125159
125754
|
workerLog(` Skipping ${branchDir} (${branchStatus2})`);
|
|
125755
|
+
await recordLatestChangesWaiting(ctx, branchPath, metaFile);
|
|
125160
125756
|
await reconcileInReview(ctx, branchDir, branchPath, metaFile, isProvisioningLockCompromised);
|
|
125161
125757
|
const outcome = await bringInCommitsForBranchInReview(
|
|
125162
125758
|
ctx,
|
|
@@ -125254,6 +125850,21 @@ async function rebaseOneBranch(ctx, branchDir, branchPath, isProvisioningLockCom
|
|
|
125254
125850
|
gatewayPolicy,
|
|
125255
125851
|
lockLost: lockCompromised
|
|
125256
125852
|
} : null;
|
|
125853
|
+
const skipIfDirty = async () => {
|
|
125854
|
+
if (editorDirt.length === 0) return { kind: "none" };
|
|
125855
|
+
if (metaFile !== null) await noteLatestChangesWaiting(ctx, branchGit, branchPath, metaFile);
|
|
125856
|
+
return { kind: "skippedDirty" };
|
|
125857
|
+
};
|
|
125858
|
+
const tookInByGitHubMerge = async (keptEntries) => {
|
|
125859
|
+
if (editorDirt.length > 0) return await skipIfDirty();
|
|
125860
|
+
const baseTip = await readPublishedSha(ctx, ctx.baseBranch).catch(() => null);
|
|
125861
|
+
const holdsBase = baseTip !== null && await contains(branchGit, "HEAD", baseTip).catch(() => false);
|
|
125862
|
+
if (!holdsBase) return { kind: "none" };
|
|
125863
|
+
probe.baseSha = baseTip;
|
|
125864
|
+
probe.keptEntries = keptEntries;
|
|
125865
|
+
await clearRebaseFailure(ctx, branchPath, branchRef, { latestChangesWaiting: void 0 });
|
|
125866
|
+
return { kind: "rebased" };
|
|
125867
|
+
};
|
|
125257
125868
|
let unpushed = false;
|
|
125258
125869
|
if (commitArgs !== null) {
|
|
125259
125870
|
const outcome = await bringInGitHubCommits(ctx, commitArgs);
|
|
@@ -125261,18 +125872,17 @@ async function rebaseOneBranch(ctx, branchDir, branchPath, isProvisioningLockCom
|
|
|
125261
125872
|
return recordBlocked(ctx, branchDir, branchPath, branchRef, outcome.reason);
|
|
125262
125873
|
}
|
|
125263
125874
|
if (outcome.kind === "unpushed") unpushed = true;
|
|
125264
|
-
else if (outcome.kind
|
|
125265
|
-
|
|
125266
|
-
}
|
|
125875
|
+
else if (outcome.kind === "merged") return await tookInByGitHubMerge(outcome.keptEntries);
|
|
125876
|
+
else if (outcome.kind !== "in-step") return await skipIfDirty();
|
|
125267
125877
|
const caughtUp = await catchUpWithPublished(ctx, commitArgs);
|
|
125268
125878
|
if (caughtUp?.kind === "blocked") {
|
|
125269
125879
|
return recordBlocked(ctx, branchDir, branchPath, branchRef, caughtUp.reason);
|
|
125270
125880
|
}
|
|
125271
|
-
if (caughtUp) return
|
|
125881
|
+
if (caughtUp) return await skipIfDirty();
|
|
125272
125882
|
}
|
|
125273
125883
|
if (editorDirt.length > 0) {
|
|
125274
125884
|
workerLog(` Skipping ${branchDir}: has uncommitted changes`);
|
|
125275
|
-
return
|
|
125885
|
+
return await skipIfDirty();
|
|
125276
125886
|
}
|
|
125277
125887
|
const trackedState = trackedCanopyStateChanges(dirtyCheck);
|
|
125278
125888
|
if (trackedState.length > 0) {
|
|
@@ -125285,14 +125895,22 @@ async function rebaseOneBranch(ctx, branchDir, branchPath, isProvisioningLockCom
|
|
|
125285
125895
|
return { kind: "failed", error: reason };
|
|
125286
125896
|
}
|
|
125287
125897
|
if (canPublish && metaFile?.branch.historyRewrittenFrom) {
|
|
125288
|
-
await reconcilePendingRewrite(ctx, {
|
|
125898
|
+
const pending = await reconcilePendingRewrite(ctx, {
|
|
125289
125899
|
branchPath,
|
|
125290
125900
|
branchDir,
|
|
125291
125901
|
branchRef,
|
|
125292
125902
|
headSha: (await branchGit.revparse(["HEAD"])).trim(),
|
|
125293
125903
|
marker: metaFile.branch.historyRewrittenFrom,
|
|
125904
|
+
target: metaFile.branch.historyRewrittenTo,
|
|
125294
125905
|
gatewayPolicy
|
|
125295
125906
|
});
|
|
125907
|
+
if (pending.kind === "failed") {
|
|
125908
|
+
const reason = redactCredentials(pending.reason);
|
|
125909
|
+
workerLogWarn(` Skipping ${branchDir}: ${reason}`);
|
|
125910
|
+
await recordRebaseFailure(ctx, branchPath, branchDir, reason, branchRef);
|
|
125911
|
+
return { kind: "failed", error: reason };
|
|
125912
|
+
}
|
|
125913
|
+
if (pending.kind === "waiting") return { kind: "none" };
|
|
125296
125914
|
}
|
|
125297
125915
|
await fetchFromRemoteGit(branchGit, ctx.remoteGitPath, ctx.baseBranch);
|
|
125298
125916
|
const fetchedBaseTip = (await branchGit.revparse(["FETCH_HEAD"])).trim();
|
|
@@ -125305,6 +125923,7 @@ async function rebaseOneBranch(ctx, branchDir, branchPath, isProvisioningLockCom
|
|
|
125305
125923
|
if (behindCount === 0) {
|
|
125306
125924
|
probe.upToDate = true;
|
|
125307
125925
|
const currentMeta = await BranchMetadataFileManager.loadOnly(branchPath);
|
|
125926
|
+
if (currentMeta !== null) await recordLatestChangesWaiting(ctx, branchPath, currentMeta);
|
|
125308
125927
|
if (currentMeta?.branch.rebaseFailure === void 0) {
|
|
125309
125928
|
return { kind: "none" };
|
|
125310
125929
|
}
|
|
@@ -125323,7 +125942,8 @@ async function rebaseOneBranch(ctx, branchDir, branchPath, isProvisioningLockCom
|
|
|
125323
125942
|
const cannotReplay = await countAboveBase(["--merges", "--end-of-options", aboveBase]) !== "0" || await countAboveBase(["--end-of-options", aboveBase, "--", CANOPY_META_DIR]) !== "0";
|
|
125324
125943
|
const head = (await branchGit.revparse(["HEAD"])).trim();
|
|
125325
125944
|
const published = canPublish ? await readPublishedSha(ctx, branchRef) : null;
|
|
125326
|
-
const aheadOfPublished = published !== null &&
|
|
125945
|
+
const aheadOfPublished = published !== null && metaFile?.branch.name === branchRef && (local || published !== head && // A rewrite's tip is this branch's own publish, on GitHub or not.
|
|
125946
|
+
(isPublished(metaFile) || published === metaFile.branch.historyRewrittenTo)) && await contains(branchGit, head, published) && !await contains(branchGit, fetchedBaseTip, published);
|
|
125327
125947
|
const takeBaseByMerge = async () => {
|
|
125328
125948
|
if (commitArgs === null) {
|
|
125329
125949
|
const reason = `the base conflicts with this clone's work, and the clone has no branch checked out, or no branch.json, to merge it into`;
|
|
@@ -125348,7 +125968,7 @@ async function rebaseOneBranch(ctx, branchDir, branchPath, isProvisioningLockCom
|
|
|
125348
125968
|
return { kind: "skippedLocked" };
|
|
125349
125969
|
}
|
|
125350
125970
|
probe.keptEntries = outcome.keptEntries;
|
|
125351
|
-
await clearRebaseFailure(ctx, branchPath, branchRef);
|
|
125971
|
+
await clearRebaseFailure(ctx, branchPath, branchRef, { latestChangesWaiting: void 0 });
|
|
125352
125972
|
return { kind: "rebased" };
|
|
125353
125973
|
};
|
|
125354
125974
|
if (commitArgs !== null && (cannotReplay || unpushed || aheadOfPublished)) {
|
|
@@ -125375,6 +125995,7 @@ async function rebaseOneBranch(ctx, branchDir, branchPath, isProvisioningLockCom
|
|
|
125375
125995
|
fetchedBaseTip,
|
|
125376
125996
|
lockCompromised
|
|
125377
125997
|
);
|
|
125998
|
+
const rebasedHead = (await branchGit.revparse(["HEAD"])).trim();
|
|
125378
125999
|
if (completed) await ctx.afterRebaseCompletedForTesting();
|
|
125379
126000
|
if (lockCompromised() && !completed) {
|
|
125380
126001
|
workerLogWarn(
|
|
@@ -125412,7 +126033,8 @@ async function rebaseOneBranch(ctx, branchDir, branchPath, isProvisioningLockCom
|
|
|
125412
126033
|
(existing) => existing !== null && existing.branch.name === metaFile?.branch.name ? {
|
|
125413
126034
|
branch: {
|
|
125414
126035
|
conflictStatus: (existing.branch.conflictFiles?.length ?? 0) > 0 ? "conflicts-detected" : "clean",
|
|
125415
|
-
rebaseFailure: void 0
|
|
126036
|
+
rebaseFailure: void 0,
|
|
126037
|
+
latestChangesWaiting: void 0
|
|
125416
126038
|
}
|
|
125417
126039
|
} : null
|
|
125418
126040
|
);
|
|
@@ -125423,7 +126045,7 @@ async function rebaseOneBranch(ctx, branchDir, branchPath, isProvisioningLockCom
|
|
|
125423
126045
|
branchRef,
|
|
125424
126046
|
publishedSha,
|
|
125425
126047
|
preRebaseHead,
|
|
125426
|
-
rebasedHead
|
|
126048
|
+
rebasedHead,
|
|
125427
126049
|
gatewayPolicy
|
|
125428
126050
|
});
|
|
125429
126051
|
return { kind: "rebased" };
|
|
@@ -125456,8 +126078,8 @@ async function rebaseOneBranch(ctx, branchDir, branchPath, isProvisioningLockCom
|
|
|
125456
126078
|
}
|
|
125457
126079
|
|
|
125458
126080
|
// ../canopycms/src/worker/git-sync.ts
|
|
125459
|
-
import
|
|
125460
|
-
import
|
|
126081
|
+
import fs35 from "node:fs/promises";
|
|
126082
|
+
import path38 from "node:path";
|
|
125461
126083
|
|
|
125462
126084
|
// ../canopycms/src/branch-health.ts
|
|
125463
126085
|
var ORPHAN_YOUTH_THRESHOLD_MS = 15 * 6e4;
|
|
@@ -125918,6 +126540,151 @@ async function sweepArchivedBranches(ctx, now = Date.now()) {
|
|
|
125918
126540
|
return report;
|
|
125919
126541
|
}
|
|
125920
126542
|
|
|
126543
|
+
// ../canopycms/src/worker/conflicts-status.ts
|
|
126544
|
+
import fs31 from "node:fs/promises";
|
|
126545
|
+
import path34 from "node:path";
|
|
126546
|
+
init_error();
|
|
126547
|
+
var MAX_REPORTED_BRANCHES = 50;
|
|
126548
|
+
async function conflictsStatusOf(branchRoot) {
|
|
126549
|
+
try {
|
|
126550
|
+
const record = await new MergeConflictStore(branchRoot).read();
|
|
126551
|
+
if (record?.held) {
|
|
126552
|
+
return {
|
|
126553
|
+
state: "failure",
|
|
126554
|
+
description: "Conflict record set aside: an admin must release the branch in the editor"
|
|
126555
|
+
};
|
|
126556
|
+
}
|
|
126557
|
+
const open = record ? openConflictCount(record.entries) : 0;
|
|
126558
|
+
if (open === 0) return { state: "success", description: "No conflicting changes to resolve" };
|
|
126559
|
+
return {
|
|
126560
|
+
state: "failure",
|
|
126561
|
+
description: open === 1 ? "1 conflicting change to resolve in the editor" : `${open} conflicting changes to resolve in the editor`
|
|
126562
|
+
};
|
|
126563
|
+
} catch (err) {
|
|
126564
|
+
if (err instanceof MergeConflictsFileMalformedError || err instanceof MergeConflictsFileFormatError) {
|
|
126565
|
+
return { state: "failure", description: "Couldn't read this branch's conflicts" };
|
|
126566
|
+
}
|
|
126567
|
+
throw err;
|
|
126568
|
+
}
|
|
126569
|
+
}
|
|
126570
|
+
async function setConflictsStatuses(ctx, githubTips) {
|
|
126571
|
+
let due;
|
|
126572
|
+
let unreadable;
|
|
126573
|
+
try {
|
|
126574
|
+
;
|
|
126575
|
+
({ due, unreadable } = await dueStatuses(ctx, githubTips));
|
|
126576
|
+
} catch (err) {
|
|
126577
|
+
workerLogWarn(
|
|
126578
|
+
`Could not read the branches' conflicts for their status: ${getErrorMessage(err)}`
|
|
126579
|
+
);
|
|
126580
|
+
return null;
|
|
126581
|
+
}
|
|
126582
|
+
const set = ctx.conflictsStatusesSet();
|
|
126583
|
+
const failed = [];
|
|
126584
|
+
let failure;
|
|
126585
|
+
for (const [index2, { branch, status, key }] of due.entries()) {
|
|
126586
|
+
if (ctx.shutdownSignal().aborted) return null;
|
|
126587
|
+
try {
|
|
126588
|
+
await ctx.github().setConflictsStatus(
|
|
126589
|
+
status,
|
|
126590
|
+
AbortSignal.any([ctx.shutdownSignal(), AbortSignal.timeout(ctx.taskTimeoutMs)])
|
|
126591
|
+
);
|
|
126592
|
+
set.set(branch, key);
|
|
126593
|
+
workerLog(
|
|
126594
|
+
`Set the conflicts status of PR #${status.pullRequest} (${escapeForLog(branch)}) at ${status.sha.slice(0, 7)}: ${status.state}`
|
|
126595
|
+
);
|
|
126596
|
+
} catch (err) {
|
|
126597
|
+
if (ctx.shutdownSignal().aborted) return null;
|
|
126598
|
+
if (err instanceof GatewayRefusalError && err.reason === "not-head") {
|
|
126599
|
+
const asked = `not-head:${branch}`;
|
|
126600
|
+
if (set.get(asked) !== status.sha) {
|
|
126601
|
+
set.set(asked, status.sha);
|
|
126602
|
+
ctx.requestBranchSync(branch);
|
|
126603
|
+
}
|
|
126604
|
+
continue;
|
|
126605
|
+
}
|
|
126606
|
+
const message2 = sanitizeErrorMessage(getErrorMessage(err));
|
|
126607
|
+
failed.push(branch);
|
|
126608
|
+
workerLogWarn(`Could not set the conflicts status of ${escapeForLog(branch)}: ${message2}`);
|
|
126609
|
+
const reason = err instanceof GatewayRefusalError ? "other" : isPermissionDenial(err) ? "permission" : isUnreachable(err) ? "unreachable" : "other";
|
|
126610
|
+
if (reason === "permission" || !failure) failure = { reason, message: message2 };
|
|
126611
|
+
if (reason !== "other") {
|
|
126612
|
+
failed.push(...due.slice(index2 + 1).map((d9) => d9.branch));
|
|
126613
|
+
break;
|
|
126614
|
+
}
|
|
126615
|
+
}
|
|
126616
|
+
}
|
|
126617
|
+
for (const u5 of unreadable) failed.push(u5.branch);
|
|
126618
|
+
failure ??= unreadable[0] && { reason: "other", message: unreadable[0].message };
|
|
126619
|
+
if (!failure) return void 0;
|
|
126620
|
+
return {
|
|
126621
|
+
...failure,
|
|
126622
|
+
branches: failed.slice(0, MAX_REPORTED_BRANCHES),
|
|
126623
|
+
count: failed.length,
|
|
126624
|
+
at: (/* @__PURE__ */ new Date()).toISOString()
|
|
126625
|
+
};
|
|
126626
|
+
}
|
|
126627
|
+
function isUnreachable(err) {
|
|
126628
|
+
const status = getHttpStatus2(err);
|
|
126629
|
+
return status === null || status === 403 || status === 408 || status === 429 || status >= 500;
|
|
126630
|
+
}
|
|
126631
|
+
async function dueStatuses(ctx, githubTips) {
|
|
126632
|
+
let entries;
|
|
126633
|
+
try {
|
|
126634
|
+
entries = await fs31.readdir(ctx.contentBranchesPath, { withFileTypes: true });
|
|
126635
|
+
} catch (err) {
|
|
126636
|
+
if (isNodeError(err) && err.code === "ENOENT") return { due: [], unreadable: [] };
|
|
126637
|
+
throw err;
|
|
126638
|
+
}
|
|
126639
|
+
const set = ctx.conflictsStatusesSet();
|
|
126640
|
+
const due = [];
|
|
126641
|
+
const unreadable = [];
|
|
126642
|
+
const cannotRead = (branch, err) => {
|
|
126643
|
+
const message2 = sanitizeErrorMessage(getErrorMessage(err));
|
|
126644
|
+
workerLogWarn(`Could not read ${escapeForLog(branch)} for its conflicts status: ${message2}`);
|
|
126645
|
+
unreadable.push({ branch, message: message2 });
|
|
126646
|
+
};
|
|
126647
|
+
for (const entry of entries.sort((a9, b10) => a9.name.localeCompare(b10.name))) {
|
|
126648
|
+
const dir = entry.name;
|
|
126649
|
+
if (!entry.isDirectory() || dir.startsWith(".") || dir === ctx.sanitizedBaseBranch) continue;
|
|
126650
|
+
const branchRoot = path34.join(ctx.contentBranchesPath, dir);
|
|
126651
|
+
let meta;
|
|
126652
|
+
try {
|
|
126653
|
+
meta = await BranchMetadataFileManager.loadOnly(branchRoot);
|
|
126654
|
+
} catch (err) {
|
|
126655
|
+
if (!(err instanceof BranchMetadataCorruptError) && !(isNodeError(err) && err.code === "ENOENT"))
|
|
126656
|
+
workerLogWarn(
|
|
126657
|
+
`Could not read ${escapeForLog(dir)}'s branch.json for its conflicts status: ` + sanitizeErrorMessage(getErrorMessage(err))
|
|
126658
|
+
);
|
|
126659
|
+
continue;
|
|
126660
|
+
}
|
|
126661
|
+
const branch = meta?.branch;
|
|
126662
|
+
if (!branch || branch.status === "archived" || branch.pullRequestNumber === void 0) continue;
|
|
126663
|
+
if (branch.pullRequestState === "merged" || branch.pullRequestState === "closed") continue;
|
|
126664
|
+
const sha = githubTips.get(branch.name);
|
|
126665
|
+
if (sha === void 0) continue;
|
|
126666
|
+
let text4;
|
|
126667
|
+
try {
|
|
126668
|
+
text4 = await conflictsStatusOf(branchRoot);
|
|
126669
|
+
} catch (err) {
|
|
126670
|
+
cannotRead(branch.name, err);
|
|
126671
|
+
continue;
|
|
126672
|
+
}
|
|
126673
|
+
const editorUrl = branch.editorUrl && resolveEditorUrl({ configured: branch.editorUrl });
|
|
126674
|
+
const link = editorUrl && editorDeepLink(editorUrl, branch.name);
|
|
126675
|
+
const status = {
|
|
126676
|
+
pullRequest: branch.pullRequestNumber,
|
|
126677
|
+
sha,
|
|
126678
|
+
...text4,
|
|
126679
|
+
// A link the gateway would refuse is left off, so it never costs the status.
|
|
126680
|
+
...link && link.length <= MAX_COMMIT_STATUS_URL_LENGTH && { targetUrl: link }
|
|
126681
|
+
};
|
|
126682
|
+
const key = JSON.stringify(status);
|
|
126683
|
+
if (set.get(branch.name) !== key) due.push({ branch: branch.name, status, key });
|
|
126684
|
+
}
|
|
126685
|
+
return { due, unreadable };
|
|
126686
|
+
}
|
|
126687
|
+
|
|
125921
126688
|
// ../canopycms/src/worker/git-sync.ts
|
|
125922
126689
|
init_worker_status();
|
|
125923
126690
|
|
|
@@ -125933,12 +126700,12 @@ async function maintainRemoteGit(gitDir) {
|
|
|
125933
126700
|
}
|
|
125934
126701
|
|
|
125935
126702
|
// ../canopycms/src/worker/sparse-cone.ts
|
|
125936
|
-
import
|
|
125937
|
-
import
|
|
126703
|
+
import fs33 from "node:fs/promises";
|
|
126704
|
+
import path36 from "node:path";
|
|
125938
126705
|
|
|
125939
126706
|
// ../canopycms/src/branch-sparse.ts
|
|
125940
|
-
import
|
|
125941
|
-
import
|
|
126707
|
+
import fs32 from "node:fs/promises";
|
|
126708
|
+
import path35 from "node:path";
|
|
125942
126709
|
init_error();
|
|
125943
126710
|
function sameCone(a9, b10) {
|
|
125944
126711
|
if (a9 === null || b10 === null) return a9 === b10;
|
|
@@ -125947,12 +126714,12 @@ function sameCone(a9, b10) {
|
|
|
125947
126714
|
}
|
|
125948
126715
|
var SPARSE_CONE_RECORD = ".sparse-cone.json";
|
|
125949
126716
|
function isConeDir(dir) {
|
|
125950
|
-
return typeof dir === "string" && dir.length > 0 && !
|
|
126717
|
+
return typeof dir === "string" && dir.length > 0 && !path35.isAbsolute(dir) && !dir.split("/").some((segment) => segment === "" || segment === "." || segment === "..");
|
|
125951
126718
|
}
|
|
125952
126719
|
async function readRecordedSparseCone(contentBranchesRoot) {
|
|
125953
126720
|
let raw;
|
|
125954
126721
|
try {
|
|
125955
|
-
raw = await
|
|
126722
|
+
raw = await fs32.readFile(path35.join(contentBranchesRoot, SPARSE_CONE_RECORD), "utf8");
|
|
125956
126723
|
} catch (err) {
|
|
125957
126724
|
if (isNodeError(err) && err.code === "ENOENT") return void 0;
|
|
125958
126725
|
throw err;
|
|
@@ -125985,15 +126752,15 @@ async function reapplySparseCones(ctx) {
|
|
|
125985
126752
|
if (!recorded) return report;
|
|
125986
126753
|
let entries;
|
|
125987
126754
|
try {
|
|
125988
|
-
entries = await
|
|
126755
|
+
entries = await fs33.readdir(ctx.contentBranchesPath, { withFileTypes: true });
|
|
125989
126756
|
} catch (err) {
|
|
125990
126757
|
if (isNodeError(err) && err.code === "ENOENT") return report;
|
|
125991
126758
|
throw err;
|
|
125992
126759
|
}
|
|
125993
126760
|
const dirNames = entries.filter((entry) => entry.isDirectory() && !entry.name.startsWith(".")).map((entry) => entry.name).sort();
|
|
125994
126761
|
for (const dirName of dirNames) {
|
|
125995
|
-
const branchPath =
|
|
125996
|
-
const isClone = await
|
|
126762
|
+
const branchPath = path36.join(ctx.contentBranchesPath, dirName);
|
|
126763
|
+
const isClone = await fs33.stat(path36.join(branchPath, ".git")).then(
|
|
125997
126764
|
(stat) => stat.isDirectory(),
|
|
125998
126765
|
() => false
|
|
125999
126766
|
);
|
|
@@ -126025,7 +126792,7 @@ async function reapplySparseCones(ctx) {
|
|
|
126025
126792
|
return report;
|
|
126026
126793
|
}
|
|
126027
126794
|
async function reapplyOne(contentBranchesPath, dirName, git, target) {
|
|
126028
|
-
const branchPath =
|
|
126795
|
+
const branchPath = path36.join(contentBranchesPath, dirName);
|
|
126029
126796
|
const hold = await holdProvisionedWorkspace(contentBranchesPath, dirName);
|
|
126030
126797
|
if (hold.kind !== "held") return "skipped";
|
|
126031
126798
|
try {
|
|
@@ -126065,11 +126832,11 @@ async function reapplyOne(contentBranchesPath, dirName, git, target) {
|
|
|
126065
126832
|
|
|
126066
126833
|
// ../canopycms/src/worker/stale-mirror.ts
|
|
126067
126834
|
init_branch_name();
|
|
126068
|
-
import
|
|
126069
|
-
import
|
|
126835
|
+
import fs34 from "node:fs/promises";
|
|
126836
|
+
import path37 from "node:path";
|
|
126070
126837
|
init_error();
|
|
126071
126838
|
async function readEditorWork(ctx) {
|
|
126072
|
-
const workspaces = new Set(await
|
|
126839
|
+
const workspaces = new Set(await fs34.readdir(ctx.contentBranchesPath).catch(() => []));
|
|
126073
126840
|
const queuedPushes = /* @__PURE__ */ new Set();
|
|
126074
126841
|
for (const status of ["pending", "processing"]) {
|
|
126075
126842
|
for (const task of await listTasks(ctx.taskDir, status, Number.POSITIVE_INFINITY)) {
|
|
@@ -126104,7 +126871,7 @@ async function settleStaleMirror(ctx, git, head, ownSettingsBranch, editorWork,
|
|
|
126104
126871
|
throw err;
|
|
126105
126872
|
}
|
|
126106
126873
|
try {
|
|
126107
|
-
if ((await
|
|
126874
|
+
if ((await fs34.readdir(ctx.contentBranchesPath)).includes(dirName)) {
|
|
126108
126875
|
return { kind: "kept", state: "workspace" };
|
|
126109
126876
|
}
|
|
126110
126877
|
const ref2 = `refs/heads/${name3}`;
|
|
@@ -126114,7 +126881,7 @@ async function settleStaleMirror(ctx, git, head, ownSettingsBranch, editorWork,
|
|
|
126114
126881
|
);
|
|
126115
126882
|
} catch (err) {
|
|
126116
126883
|
const message2 = getErrorMessage(err);
|
|
126117
|
-
if (lockHeld(message2) ===
|
|
126884
|
+
if (lockHeld(message2) === path37.join(ctx.remoteGitPath, "packed-refs.lock")) {
|
|
126118
126885
|
return { kind: "packed-refs-locked" };
|
|
126119
126886
|
}
|
|
126120
126887
|
if (/cannot lock ref|Unable to create '[^']*\.lock': File exists/.test(message2)) {
|
|
@@ -126129,7 +126896,7 @@ async function settleStaleMirror(ctx, git, head, ownSettingsBranch, editorWork,
|
|
|
126129
126896
|
}
|
|
126130
126897
|
function lockHeld(message2) {
|
|
126131
126898
|
const match2 = /Unable to create '([^']*)': File exists/.exec(message2);
|
|
126132
|
-
return match2 ?
|
|
126899
|
+
return match2 ? path37.normalize(match2[1]) : null;
|
|
126133
126900
|
}
|
|
126134
126901
|
async function sharesHistory(git, head, baseTip) {
|
|
126135
126902
|
try {
|
|
@@ -126480,6 +127247,7 @@ async function syncGit(ctx) {
|
|
|
126480
127247
|
requested.branches
|
|
126481
127248
|
);
|
|
126482
127249
|
if (stoppedForDrain(ctx, "the cleanup sweeps")) return;
|
|
127250
|
+
const conflictsStatusFailure = await setConflictsStatuses(ctx, githubTips);
|
|
126483
127251
|
await cleanupOldTasks(ctx.taskDir, void 0, ctx.log);
|
|
126484
127252
|
if (health && branchPolicy) {
|
|
126485
127253
|
const report2 = ctx.ensureStatusReport();
|
|
@@ -126504,6 +127272,8 @@ async function syncGit(ctx) {
|
|
|
126504
127272
|
const report = ctx.ensureStatusReport();
|
|
126505
127273
|
report.lastGitSyncAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
126506
127274
|
delete report.lastGitSyncError;
|
|
127275
|
+
if (conflictsStatusFailure) report.conflictsStatusFailure = conflictsStatusFailure;
|
|
127276
|
+
else if (conflictsStatusFailure === void 0) delete report.conflictsStatusFailure;
|
|
126507
127277
|
if (needsOperator !== null) {
|
|
126508
127278
|
report.lastGitSyncError = { message: needsOperator, at: report.lastGitSyncAt };
|
|
126509
127279
|
}
|
|
@@ -126542,7 +127312,7 @@ var reportedForeignDirs = /* @__PURE__ */ new Set();
|
|
|
126542
127312
|
async function repairBranchDirResidue(ctx, now = Date.now()) {
|
|
126543
127313
|
let entries;
|
|
126544
127314
|
try {
|
|
126545
|
-
entries = await
|
|
127315
|
+
entries = await fs35.readdir(ctx.contentBranchesPath, { withFileTypes: true });
|
|
126546
127316
|
} catch (err) {
|
|
126547
127317
|
if (isNodeError(err) && err.code === "ENOENT") return;
|
|
126548
127318
|
throw err;
|
|
@@ -126557,7 +127327,7 @@ async function repairBranchDirResidue(ctx, now = Date.now()) {
|
|
|
126557
127327
|
}
|
|
126558
127328
|
const leftovers = await sweepProvisioningLeftovers(
|
|
126559
127329
|
ctx.contentBranchesPath,
|
|
126560
|
-
|
|
127330
|
+
path38.dirname(ctx.contentBranchesPath),
|
|
126561
127331
|
now
|
|
126562
127332
|
);
|
|
126563
127333
|
for (const { name: name3, action, detail } of leftovers) {
|
|
@@ -126568,8 +127338,8 @@ async function repairBranchDirResidue(ctx, now = Date.now()) {
|
|
|
126568
127338
|
}
|
|
126569
127339
|
}
|
|
126570
127340
|
async function repairOneBranchDir(ctx, dirName, now) {
|
|
126571
|
-
const dirPath =
|
|
126572
|
-
const hasMeta = await
|
|
127341
|
+
const dirPath = path38.join(ctx.contentBranchesPath, dirName);
|
|
127342
|
+
const hasMeta = await fs35.access(path38.join(dirPath, BRANCH_META_DIR, BRANCH_META_FILE)).then(
|
|
126573
127343
|
() => true,
|
|
126574
127344
|
() => false
|
|
126575
127345
|
);
|
|
@@ -126605,7 +127375,7 @@ async function repairOneBranchDir(ctx, dirName, now) {
|
|
|
126605
127375
|
async function cleanupTrashedBranchDirs(ctx) {
|
|
126606
127376
|
let entries;
|
|
126607
127377
|
try {
|
|
126608
|
-
entries = await
|
|
127378
|
+
entries = await fs35.readdir(ctx.contentBranchesPath);
|
|
126609
127379
|
} catch (err) {
|
|
126610
127380
|
if (isNodeError(err) && err.code === "ENOENT") return 0;
|
|
126611
127381
|
throw err;
|
|
@@ -126625,7 +127395,7 @@ async function cleanupTrashedBranchDirs(ctx) {
|
|
|
126625
127395
|
}
|
|
126626
127396
|
if (now - stampDate.getTime() < TRASH_RETENTION_MS) continue;
|
|
126627
127397
|
try {
|
|
126628
|
-
await
|
|
127398
|
+
await fs35.rm(path38.join(ctx.contentBranchesPath, name3), {
|
|
126629
127399
|
recursive: true,
|
|
126630
127400
|
force: true,
|
|
126631
127401
|
maxRetries: 3,
|
|
@@ -126643,7 +127413,7 @@ async function cleanupTrashedBranchDirs(ctx) {
|
|
|
126643
127413
|
}
|
|
126644
127414
|
var warnedTrackedCanopyState = /* @__PURE__ */ new Set();
|
|
126645
127415
|
async function refreshBaseBranchWorkspace(ctx) {
|
|
126646
|
-
const basePath37 =
|
|
127416
|
+
const basePath37 = path38.join(ctx.contentBranchesPath, ctx.sanitizedBaseBranch);
|
|
126647
127417
|
let trackedCanopyMeta;
|
|
126648
127418
|
let releaseProvisioning;
|
|
126649
127419
|
let releaseContentLock;
|
|
@@ -126801,10 +127571,10 @@ async function refreshBaseBranchWorkspace(ctx) {
|
|
|
126801
127571
|
// ../canopycms/src/worker/github-gateway-http.ts
|
|
126802
127572
|
init_error();
|
|
126803
127573
|
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
126804
|
-
import
|
|
127574
|
+
import fs36 from "node:fs/promises";
|
|
126805
127575
|
import http from "node:http";
|
|
126806
127576
|
import net from "node:net";
|
|
126807
|
-
import
|
|
127577
|
+
import path39 from "node:path";
|
|
126808
127578
|
import { PassThrough } from "node:stream";
|
|
126809
127579
|
import { pipeline as pipeline2 } from "node:stream/promises";
|
|
126810
127580
|
var MAX_POLL_WAIT_MS = 25e3;
|
|
@@ -126827,11 +127597,11 @@ async function serveGitHubGateway(gateway, listen, options2 = {}) {
|
|
|
126827
127597
|
if ("fd" in listen) {
|
|
126828
127598
|
await listenOn(server, { fd: listen.fd });
|
|
126829
127599
|
} else {
|
|
126830
|
-
await assertPrivateDirectory(
|
|
127600
|
+
await assertPrivateDirectory(path39.dirname(listen.path));
|
|
126831
127601
|
await removeStaleSocket(listen.path);
|
|
126832
127602
|
await listenOn(server, { path: listen.path });
|
|
126833
127603
|
try {
|
|
126834
|
-
await
|
|
127604
|
+
await fs36.chmod(listen.path, 384);
|
|
126835
127605
|
} catch (err) {
|
|
126836
127606
|
await closeServer(server, handler);
|
|
126837
127607
|
throw err;
|
|
@@ -126872,7 +127642,7 @@ function listenOn(server, options2) {
|
|
|
126872
127642
|
});
|
|
126873
127643
|
}
|
|
126874
127644
|
async function assertPrivateDirectory(dir) {
|
|
126875
|
-
const stat = await
|
|
127645
|
+
const stat = await fs36.lstat(dir);
|
|
126876
127646
|
const uid = process.getuid?.();
|
|
126877
127647
|
if (!stat.isDirectory() || uid !== void 0 && (stat.uid !== uid || (stat.mode & 63) !== 0)) {
|
|
126878
127648
|
throw new Error(
|
|
@@ -126883,7 +127653,7 @@ async function assertPrivateDirectory(dir) {
|
|
|
126883
127653
|
async function removeStaleSocket(socketPath) {
|
|
126884
127654
|
let stat;
|
|
126885
127655
|
try {
|
|
126886
|
-
stat = await
|
|
127656
|
+
stat = await fs36.lstat(socketPath);
|
|
126887
127657
|
} catch (err) {
|
|
126888
127658
|
if (isNodeError(err) && err.code === "ENOENT") return;
|
|
126889
127659
|
throw err;
|
|
@@ -126899,7 +127669,7 @@ async function removeStaleSocket(socketPath) {
|
|
|
126899
127669
|
`Refusing to serve the GitHub gateway at ${socketPath}: a gateway already serves there`
|
|
126900
127670
|
);
|
|
126901
127671
|
}
|
|
126902
|
-
await
|
|
127672
|
+
await fs36.unlink(socketPath);
|
|
126903
127673
|
}
|
|
126904
127674
|
function isServed(socketPath) {
|
|
126905
127675
|
return new Promise((resolve) => {
|
|
@@ -126970,6 +127740,10 @@ var GatewayRequestHandler = class {
|
|
|
126970
127740
|
await gateway.convertPullRequestToDraft(number, signal);
|
|
126971
127741
|
return {};
|
|
126972
127742
|
},
|
|
127743
|
+
setConflictsStatus: async (status, signal) => {
|
|
127744
|
+
await gateway.setConflictsStatus(status, signal);
|
|
127745
|
+
return {};
|
|
127746
|
+
},
|
|
126973
127747
|
deleteBranch: async ({ branch }, signal) => {
|
|
126974
127748
|
await gateway.deleteBranch(branch, signal);
|
|
126975
127749
|
return {};
|
|
@@ -127478,6 +128252,9 @@ var GitHubGatewayClient = class {
|
|
|
127478
128252
|
async convertPullRequestToDraft(number, signal) {
|
|
127479
128253
|
await this.call("convertPullRequestToDraft", { number }, signal);
|
|
127480
128254
|
}
|
|
128255
|
+
async setConflictsStatus(status, signal) {
|
|
128256
|
+
await this.call("setConflictsStatus", status, signal);
|
|
128257
|
+
}
|
|
127481
128258
|
async deleteBranch(branch, signal) {
|
|
127482
128259
|
await this.call("deleteBranch", { branch }, signal);
|
|
127483
128260
|
}
|
|
@@ -127640,9 +128417,9 @@ init_branch_namespace();
|
|
|
127640
128417
|
|
|
127641
128418
|
// ../canopycms/src/worker/self-checks.ts
|
|
127642
128419
|
init_error();
|
|
127643
|
-
import
|
|
128420
|
+
import fs37 from "node:fs/promises";
|
|
127644
128421
|
import net2 from "node:net";
|
|
127645
|
-
import
|
|
128422
|
+
import path40 from "node:path";
|
|
127646
128423
|
var IMDS_HOST = "169.254.169.254";
|
|
127647
128424
|
var IMDS_CONNECT_TIMEOUT_MS = 1e3;
|
|
127648
128425
|
var NO_ROUTE_CODES = /* @__PURE__ */ new Set(["ENETUNREACH", "EAFNOSUPPORT"]);
|
|
@@ -127697,10 +128474,10 @@ async function imdsUnreachable(environment = {}) {
|
|
|
127697
128474
|
};
|
|
127698
128475
|
}
|
|
127699
128476
|
async function onlyLoopback(environment = {}) {
|
|
127700
|
-
const file =
|
|
128477
|
+
const file = path40.join(rootOf(environment), "proc", "self", "net", "dev");
|
|
127701
128478
|
let text4;
|
|
127702
128479
|
try {
|
|
127703
|
-
text4 = await
|
|
128480
|
+
text4 = await fs37.readFile(file, "utf8");
|
|
127704
128481
|
} catch (err) {
|
|
127705
128482
|
return {
|
|
127706
128483
|
check: "network-namespace",
|
|
@@ -127717,21 +128494,21 @@ async function onlyLoopback(environment = {}) {
|
|
|
127717
128494
|
};
|
|
127718
128495
|
}
|
|
127719
128496
|
async function procShowsOnlyOwnProcesses(environment = {}) {
|
|
127720
|
-
const proc =
|
|
128497
|
+
const proc = path40.join(rootOf(environment), "proc");
|
|
127721
128498
|
const uid = environment.uid ?? process.getuid?.();
|
|
127722
128499
|
if (uid === void 0) {
|
|
127723
128500
|
return { check: "proc", ok: false, detail: "this platform has no process uid to compare" };
|
|
127724
128501
|
}
|
|
127725
128502
|
let entries;
|
|
127726
128503
|
try {
|
|
127727
|
-
entries = await
|
|
128504
|
+
entries = await fs37.readdir(proc);
|
|
127728
128505
|
} catch (err) {
|
|
127729
128506
|
return { check: "proc", ok: false, detail: `cannot list ${proc}: ${getErrorMessage(err)}` };
|
|
127730
128507
|
}
|
|
127731
128508
|
const others = [];
|
|
127732
128509
|
for (const entry of entries.filter((name3) => /^\d+$/.test(name3))) {
|
|
127733
128510
|
try {
|
|
127734
|
-
const stat = await
|
|
128511
|
+
const stat = await fs37.stat(path40.join(proc, entry));
|
|
127735
128512
|
if (stat.uid !== uid) others.push(`${entry} (uid ${stat.uid})`);
|
|
127736
128513
|
} catch (err) {
|
|
127737
128514
|
if (!(isNodeError(err) && err.code === "ENOENT")) {
|
|
@@ -127747,9 +128524,9 @@ async function procShowsOnlyOwnProcesses(environment = {}) {
|
|
|
127747
128524
|
};
|
|
127748
128525
|
}
|
|
127749
128526
|
async function homeIsEmpty(environment = {}) {
|
|
127750
|
-
const home =
|
|
128527
|
+
const home = path40.join(rootOf(environment), "home");
|
|
127751
128528
|
try {
|
|
127752
|
-
const entries = await
|
|
128529
|
+
const entries = await fs37.readdir(home);
|
|
127753
128530
|
return {
|
|
127754
128531
|
check: "home",
|
|
127755
128532
|
ok: entries.length === 0,
|
|
@@ -127772,9 +128549,9 @@ function noSecretsInEnv(environment = {}) {
|
|
|
127772
128549
|
};
|
|
127773
128550
|
}
|
|
127774
128551
|
async function efsUnreadable(environment = {}) {
|
|
127775
|
-
const efs =
|
|
128552
|
+
const efs = path40.join(rootOf(environment), "mnt", "efs");
|
|
127776
128553
|
try {
|
|
127777
|
-
await
|
|
128554
|
+
await fs37.readdir(efs);
|
|
127778
128555
|
} catch (err) {
|
|
127779
128556
|
const code2 = isNodeError(err) ? err.code : void 0;
|
|
127780
128557
|
const denied = code2 === "EACCES" || code2 === "EPERM";
|
|
@@ -127791,9 +128568,9 @@ async function efsUnreadable(environment = {}) {
|
|
|
127791
128568
|
};
|
|
127792
128569
|
}
|
|
127793
128570
|
async function corePatternNotPiped(environment = {}) {
|
|
127794
|
-
const file =
|
|
128571
|
+
const file = path40.join(rootOf(environment), "proc", "sys", "kernel", "core_pattern");
|
|
127795
128572
|
try {
|
|
127796
|
-
const pattern = (await
|
|
128573
|
+
const pattern = (await fs37.readFile(file, "utf8")).trim();
|
|
127797
128574
|
const ok3 = !pattern.startsWith("|");
|
|
127798
128575
|
return {
|
|
127799
128576
|
check: "core-pattern",
|
|
@@ -127809,10 +128586,10 @@ async function corePatternNotPiped(environment = {}) {
|
|
|
127809
128586
|
}
|
|
127810
128587
|
}
|
|
127811
128588
|
async function coreLimitZero(environment = {}) {
|
|
127812
|
-
const file =
|
|
128589
|
+
const file = path40.join(rootOf(environment), "proc", "self", "limits");
|
|
127813
128590
|
let text4;
|
|
127814
128591
|
try {
|
|
127815
|
-
text4 = await
|
|
128592
|
+
text4 = await fs37.readFile(file, "utf8");
|
|
127816
128593
|
} catch (err) {
|
|
127817
128594
|
return {
|
|
127818
128595
|
check: "core-limit",
|
|
@@ -127834,11 +128611,11 @@ async function socketAccessIsOthers(environment = {}) {
|
|
|
127834
128611
|
const uid = environment.uid ?? process.getuid?.();
|
|
127835
128612
|
if (uid === void 0) return fail("this platform has no process uid to compare");
|
|
127836
128613
|
const fd = environment.listenFd ?? 3;
|
|
127837
|
-
const proc =
|
|
128614
|
+
const proc = path40.join(rootOf(environment), "proc", "self");
|
|
127838
128615
|
let socketPath;
|
|
127839
128616
|
try {
|
|
127840
|
-
const inode = (await
|
|
127841
|
-
const table = await
|
|
128617
|
+
const inode = (await fs37.stat(path40.join(proc, "fd", String(fd)))).ino;
|
|
128618
|
+
const table = await fs37.readFile(path40.join(proc, "net", "unix"), "utf8");
|
|
127842
128619
|
for (const line of table.split("\n").slice(1)) {
|
|
127843
128620
|
const fields = line.trim().split(/\s+/);
|
|
127844
128621
|
if (fields[6] === String(inode) && fields.length > 7) socketPath = fields.slice(7).join(" ");
|
|
@@ -127846,12 +128623,12 @@ async function socketAccessIsOthers(environment = {}) {
|
|
|
127846
128623
|
} catch (err) {
|
|
127847
128624
|
return fail(`cannot find the socket on descriptor ${fd}: ${getErrorMessage(err)}`);
|
|
127848
128625
|
}
|
|
127849
|
-
if (socketPath === void 0 || !
|
|
128626
|
+
if (socketPath === void 0 || !path40.isAbsolute(socketPath)) {
|
|
127850
128627
|
return fail(`the socket on descriptor ${fd} is not bound to a path`);
|
|
127851
128628
|
}
|
|
127852
128629
|
let node2;
|
|
127853
128630
|
try {
|
|
127854
|
-
node2 = await
|
|
128631
|
+
node2 = await fs37.lstat(socketPath);
|
|
127855
128632
|
} catch (err) {
|
|
127856
128633
|
return fail(`cannot read ${socketPath}: ${getErrorMessage(err)}`);
|
|
127857
128634
|
}
|
|
@@ -127898,8 +128675,8 @@ function tcpConnect(host, port, timeoutMs) {
|
|
|
127898
128675
|
|
|
127899
128676
|
// ../canopycms/src/worker/cms-worker.ts
|
|
127900
128677
|
function defaultStateDirectory(workspacePath) {
|
|
127901
|
-
const key = createHash2("sha256").update(
|
|
127902
|
-
return
|
|
128678
|
+
const key = createHash2("sha256").update(path41.resolve(workspacePath)).digest("hex").slice(0, 16);
|
|
128679
|
+
return path41.join(os.tmpdir(), `canopycms-worker-${key}`);
|
|
127903
128680
|
}
|
|
127904
128681
|
var MAX_REFS_LISTED = 20;
|
|
127905
128682
|
var RemoteGitKeptError = class extends Error {
|
|
@@ -127950,7 +128727,7 @@ function lockWorkerTaskDir(taskDir, lockStaleMs, options2) {
|
|
|
127950
128727
|
const waitMs = options2.waitMs ?? 0;
|
|
127951
128728
|
const intervalMs = Math.max(250, Math.min(5e3, Math.floor(lockStaleMs / 4)));
|
|
127952
128729
|
return import_proper_lockfile3.default.lock(taskDir, {
|
|
127953
|
-
lockfilePath:
|
|
128730
|
+
lockfilePath: path41.join(taskDir, ".worker-lock"),
|
|
127954
128731
|
stale: lockStaleMs,
|
|
127955
128732
|
onCompromised: options2.onCompromised,
|
|
127956
128733
|
...waitMs > 0 ? {
|
|
@@ -127976,10 +128753,10 @@ async function readCarriedFields(taskDir) {
|
|
|
127976
128753
|
};
|
|
127977
128754
|
}
|
|
127978
128755
|
async function recordWorkerStartupFailure(options2) {
|
|
127979
|
-
const taskDir =
|
|
128756
|
+
const taskDir = path41.join(options2.workspacePath, ".tasks");
|
|
127980
128757
|
let release2;
|
|
127981
128758
|
try {
|
|
127982
|
-
await
|
|
128759
|
+
await fs38.mkdir(taskDir, { recursive: true });
|
|
127983
128760
|
release2 = await lockWorkerTaskDir(taskDir, 2 * (options2.lockStaleMs ?? DEFAULT_LOCK_STALE_MS), {
|
|
127984
128761
|
onCompromised: (err) => workerLogError("Worker lock lost while recording a startup failure:", getErrorMessage(err))
|
|
127985
128762
|
});
|
|
@@ -128026,6 +128803,7 @@ var CmsWorker = class {
|
|
|
128026
128803
|
this.releaseLockFn = null;
|
|
128027
128804
|
this.log = cmsTaskQueueLogger;
|
|
128028
128805
|
this.warnedDivergences = /* @__PURE__ */ new Map();
|
|
128806
|
+
this.conflictsStatusesSet = /* @__PURE__ */ new Map();
|
|
128029
128807
|
// Branches asked for since the git sync last took them (requestBranchSync), by directory name.
|
|
128030
128808
|
this.branchSyncRequests = /* @__PURE__ */ new Set();
|
|
128031
128809
|
// Set by any request; cleared by the next cycle, which takes it.
|
|
@@ -128039,12 +128817,12 @@ var CmsWorker = class {
|
|
|
128039
128817
|
this.selfStopped = new Promise((resolve) => {
|
|
128040
128818
|
this.settleSelfStopped = resolve;
|
|
128041
128819
|
});
|
|
128042
|
-
this.taskDir =
|
|
128043
|
-
this.remoteGitPath =
|
|
128044
|
-
this.stateDirectory =
|
|
128820
|
+
this.taskDir = path41.join(config.workspacePath, ".tasks");
|
|
128821
|
+
this.remoteGitPath = path41.join(path41.resolve(config.workspacePath), "remote.git");
|
|
128822
|
+
this.stateDirectory = path41.resolve(
|
|
128045
128823
|
config.stateDirectory ?? defaultStateDirectory(config.workspacePath)
|
|
128046
128824
|
);
|
|
128047
|
-
this.contentBranchesPath =
|
|
128825
|
+
this.contentBranchesPath = path41.join(config.workspacePath, "content-branches");
|
|
128048
128826
|
if (config.baseBranch !== void 0) this.setBaseBranch(config.baseBranch);
|
|
128049
128827
|
this.maxTasksPerCycle = config.maxTasksPerCycle ?? 10;
|
|
128050
128828
|
this.taskTimeoutMs = config.taskTimeoutMs ?? DEFAULT_TASK_TIMEOUT;
|
|
@@ -128057,7 +128835,7 @@ var CmsWorker = class {
|
|
|
128057
128835
|
}
|
|
128058
128836
|
this.archivedBranchRetentionDays = retentionDays;
|
|
128059
128837
|
this.maxRetries = config.maxRetries ?? DEFAULT_MAX_RETRIES2;
|
|
128060
|
-
this.lockFilePath =
|
|
128838
|
+
this.lockFilePath = path41.join(config.workspacePath, ".tasks", ".worker-lock");
|
|
128061
128839
|
this.lockStaleMs = config.lockStaleMs ?? DEFAULT_LOCK_STALE_MS;
|
|
128062
128840
|
this.drainDeadlineMs = config.drainDeadlineMs ?? DEFAULT_DRAIN_DEADLINE_MS;
|
|
128063
128841
|
this.contentRoot = config.contentRoot ?? "content";
|
|
@@ -128146,6 +128924,7 @@ var CmsWorker = class {
|
|
|
128146
128924
|
ensureStatusReport: () => this.ensureStatusReport(),
|
|
128147
128925
|
ensureSettingsBranch: () => this.ensureSettingsBranch(),
|
|
128148
128926
|
warnedDivergences: () => this.warnedDivergences,
|
|
128927
|
+
conflictsStatusesSet: () => this.conflictsStatusesSet,
|
|
128149
128928
|
requestBranchSync: (branchRef) => this.requestBranchSync(branchRef),
|
|
128150
128929
|
takeBranchSyncRequests: () => this.takeBranchSyncRequests(),
|
|
128151
128930
|
afterConflictDetectedForTesting: () => this.afterConflictDetectedForTesting(),
|
|
@@ -128359,7 +129138,7 @@ var CmsWorker = class {
|
|
|
128359
129138
|
* is negligible at the default TTL; a badly wrong clock misjudges liveness.
|
|
128360
129139
|
*/
|
|
128361
129140
|
async acquireLock() {
|
|
128362
|
-
await
|
|
129141
|
+
await fs38.mkdir(this.taskDir, { recursive: true });
|
|
128363
129142
|
try {
|
|
128364
129143
|
this.releaseLockFn = await lockWorkerTaskDir(this.taskDir, this.lockStaleMs, {
|
|
128365
129144
|
onCompromised: (err) => {
|
|
@@ -128521,7 +129300,7 @@ var CmsWorker = class {
|
|
|
128521
129300
|
);
|
|
128522
129301
|
let remoteGitExists;
|
|
128523
129302
|
try {
|
|
128524
|
-
remoteGitExists = await
|
|
129303
|
+
remoteGitExists = await fs38.stat(this.remoteGitPath).then(
|
|
128525
129304
|
() => true,
|
|
128526
129305
|
(err) => {
|
|
128527
129306
|
if (isNodeError(err) && err.code === "ENOENT") return false;
|
|
@@ -128599,7 +129378,7 @@ var CmsWorker = class {
|
|
|
128599
129378
|
);
|
|
128600
129379
|
if (current2 === this.baseBranch) return;
|
|
128601
129380
|
await sharedRepoGit(gitDir, "bare").raw(["symbolic-ref", "HEAD", ref2]);
|
|
128602
|
-
workerLog(`${
|
|
129381
|
+
workerLog(`${path41.basename(gitDir)} HEAD now names the base branch '${this.baseBranch}'`);
|
|
128603
129382
|
}
|
|
128604
129383
|
/**
|
|
128605
129384
|
* Whether the bare repo at `gitDir` has a local `refs/heads/<baseBranch>`.
|
|
@@ -128699,7 +129478,7 @@ var CmsWorker = class {
|
|
|
128699
129478
|
async ensureRemoteGit() {
|
|
128700
129479
|
let exists3;
|
|
128701
129480
|
try {
|
|
128702
|
-
await
|
|
129481
|
+
await fs38.stat(this.remoteGitPath);
|
|
128703
129482
|
exists3 = true;
|
|
128704
129483
|
} catch {
|
|
128705
129484
|
exists3 = false;
|
|
@@ -128719,7 +129498,7 @@ var CmsWorker = class {
|
|
|
128719
129498
|
}
|
|
128720
129499
|
workerLog("Initializing remote.git from GitHub...");
|
|
128721
129500
|
const stagingPath = await this.seedRemoteGitStaging();
|
|
128722
|
-
await
|
|
129501
|
+
await fs38.rename(stagingPath, this.remoteGitPath);
|
|
128723
129502
|
workerLog("remote.git initialized");
|
|
128724
129503
|
}
|
|
128725
129504
|
/**
|
|
@@ -128775,7 +129554,7 @@ var CmsWorker = class {
|
|
|
128775
129554
|
if (err instanceof RemoteGitKeptError) throw err;
|
|
128776
129555
|
throw notReplaced(redactCredentials(getErrorMessage(err)));
|
|
128777
129556
|
});
|
|
128778
|
-
const discardStaging = () =>
|
|
129557
|
+
const discardStaging = () => fs38.rm(stagingPath, { recursive: true, force: true });
|
|
128779
129558
|
let current2;
|
|
128780
129559
|
try {
|
|
128781
129560
|
current2 = await listRemoteGitRefs(this.remoteGitPath);
|
|
@@ -128793,21 +129572,21 @@ var CmsWorker = class {
|
|
|
128793
129572
|
}
|
|
128794
129573
|
const replaced = `${this.remoteGitPath}.replaced-${Date.now()}`;
|
|
128795
129574
|
try {
|
|
128796
|
-
await
|
|
129575
|
+
await fs38.rename(this.remoteGitPath, replaced);
|
|
128797
129576
|
} catch (err) {
|
|
128798
129577
|
await discardStaging();
|
|
128799
129578
|
throw err;
|
|
128800
129579
|
}
|
|
128801
129580
|
try {
|
|
128802
|
-
await
|
|
129581
|
+
await fs38.rename(stagingPath, this.remoteGitPath);
|
|
128803
129582
|
} catch (err) {
|
|
128804
|
-
await
|
|
129583
|
+
await fs38.rename(replaced, this.remoteGitPath);
|
|
128805
129584
|
await discardStaging();
|
|
128806
129585
|
throw err;
|
|
128807
129586
|
}
|
|
128808
129587
|
const after = await listRemoteGitRefs(replaced).catch(() => null);
|
|
128809
129588
|
if (after !== null && sameRefs(refs, after)) {
|
|
128810
|
-
await
|
|
129589
|
+
await fs38.rm(replaced, { recursive: true, force: true, maxRetries: 3 }).catch((err) => {
|
|
128811
129590
|
workerLogWarn(
|
|
128812
129591
|
`Could not remove the replaced remote.git at ${replaced}: ${getErrorMessage(err)}`
|
|
128813
129592
|
);
|
|
@@ -128827,7 +129606,7 @@ var CmsWorker = class {
|
|
|
128827
129606
|
*/
|
|
128828
129607
|
async seedRemoteGitStaging(check) {
|
|
128829
129608
|
const stagingPath = `${this.remoteGitPath}.cloning`;
|
|
128830
|
-
await
|
|
129609
|
+
await fs38.rm(stagingPath, { recursive: true, force: true });
|
|
128831
129610
|
try {
|
|
128832
129611
|
const githubBranches = await seedFromGitHub(
|
|
128833
129612
|
this.transferContext(),
|
|
@@ -128843,7 +129622,7 @@ var CmsWorker = class {
|
|
|
128843
129622
|
if (!(err instanceof RemoteGitKeptError)) {
|
|
128844
129623
|
workerLogError(`remote.git seeding failed: ${redactCredentials(getErrorMessage(err))}`);
|
|
128845
129624
|
}
|
|
128846
|
-
await
|
|
129625
|
+
await fs38.rm(stagingPath, { recursive: true, force: true });
|
|
128847
129626
|
if (err instanceof RemoteGitKeptError) throw err;
|
|
128848
129627
|
if (err instanceof SharedRepoRefusalError) {
|
|
128849
129628
|
throw new SharedRepoRefusalError(
|
|
@@ -128952,7 +129731,7 @@ var CmsWorker = class {
|
|
|
128952
129731
|
* sanitized.
|
|
128953
129732
|
*/
|
|
128954
129733
|
branchWorkspacePath(branchRefName) {
|
|
128955
|
-
return
|
|
129734
|
+
return path41.join(this.contentBranchesPath, sanitizeBranchName(branchRefName));
|
|
128956
129735
|
}
|
|
128957
129736
|
/**
|
|
128958
129737
|
* Test-only seam: awaited inside `rebaseActiveBranches()`'s rebase round,
|
|
@@ -128983,12 +129762,28 @@ var CmsWorker = class {
|
|
|
128983
129762
|
// directly and that calls `pollMergeState` directly. Neither is on
|
|
128984
129763
|
// WorkerContext, so a stub installed on either is a no-op for production.
|
|
128985
129764
|
//
|
|
128986
|
-
// `rebaseActiveBranches` also has a consumer outside the test files:
|
|
128987
|
-
// apps/test-app/app/api/e2e-test/rebase/route.ts drives it from an e2e
|
|
128988
|
-
// fixture route. Do not delete it as unused.
|
|
128989
129765
|
async rebaseActiveBranches(gatewayPolicy, gitHub, requested) {
|
|
128990
129766
|
return runRebaseCycle(this.ctx(), gatewayPolicy, gitHub, requested);
|
|
128991
129767
|
}
|
|
129768
|
+
// --- Runs with no loop ({@link createLocalWorker}) -----------------------
|
|
129769
|
+
/**
|
|
129770
|
+
* Bring the base into one branch now and answer its request for the latest changes
|
|
129771
|
+
* (rebase.ts `syncBranchNow`).
|
|
129772
|
+
*/
|
|
129773
|
+
async syncBranchNow(branchName) {
|
|
129774
|
+
return syncBranchNow(this.ctx(), branchName);
|
|
129775
|
+
}
|
|
129776
|
+
/** Bring the base into every branch now, answering their requests from this run's start. */
|
|
129777
|
+
async syncBranchesNow() {
|
|
129778
|
+
return runRebaseCycle(
|
|
129779
|
+
this.ctx(),
|
|
129780
|
+
void 0,
|
|
129781
|
+
void 0,
|
|
129782
|
+
/* @__PURE__ */ new Set(),
|
|
129783
|
+
{ fetchedAt: Date.now() },
|
|
129784
|
+
true
|
|
129785
|
+
);
|
|
129786
|
+
}
|
|
128992
129787
|
// --- Git-sync cluster (worker/git-sync.ts) -----------------------------
|
|
128993
129788
|
//
|
|
128994
129789
|
// `syncGit` is the public loop entry `scheduleLoop` drives. The three private
|
|
@@ -129027,24 +129822,24 @@ var CmsWorker = class {
|
|
|
129027
129822
|
};
|
|
129028
129823
|
|
|
129029
129824
|
// ../canopycms/src/auth/file-based-auth-cache.ts
|
|
129030
|
-
import
|
|
129031
|
-
import
|
|
129825
|
+
import fs39 from "node:fs/promises";
|
|
129826
|
+
import path42 from "node:path";
|
|
129032
129827
|
var log10 = createDebugLogger({ prefix: "FileBasedAuthCache" });
|
|
129033
129828
|
async function writeAuthCacheSnapshot(cachePath, files) {
|
|
129034
|
-
await
|
|
129829
|
+
await fs39.mkdir(cachePath, { recursive: true });
|
|
129035
129830
|
const timestamp2 = Date.now();
|
|
129036
|
-
const snapshotDir =
|
|
129037
|
-
await
|
|
129831
|
+
const snapshotDir = path42.join(cachePath, `snapshot-${timestamp2}`);
|
|
129832
|
+
await fs39.mkdir(snapshotDir, { recursive: true });
|
|
129038
129833
|
for (const [fileName, data4] of Object.entries(files)) {
|
|
129039
|
-
const tmpPath =
|
|
129040
|
-
const finalPath =
|
|
129041
|
-
await
|
|
129042
|
-
await
|
|
129043
|
-
}
|
|
129044
|
-
const currentLink =
|
|
129045
|
-
const tmpLink =
|
|
129046
|
-
await
|
|
129047
|
-
await
|
|
129834
|
+
const tmpPath = path42.join(snapshotDir, `${fileName}.tmp`);
|
|
129835
|
+
const finalPath = path42.join(snapshotDir, fileName);
|
|
129836
|
+
await fs39.writeFile(tmpPath, JSON.stringify(data4, null, 2), "utf-8");
|
|
129837
|
+
await fs39.rename(tmpPath, finalPath);
|
|
129838
|
+
}
|
|
129839
|
+
const currentLink = path42.join(cachePath, "current");
|
|
129840
|
+
const tmpLink = path42.join(cachePath, `current-${timestamp2}`);
|
|
129841
|
+
await fs39.symlink(path42.basename(snapshotDir), tmpLink);
|
|
129842
|
+
await fs39.rename(tmpLink, currentLink);
|
|
129048
129843
|
await cleanupOldSnapshots(cachePath, 2);
|
|
129049
129844
|
return snapshotDir;
|
|
129050
129845
|
}
|
|
@@ -129061,14 +129856,14 @@ async function writeAuthSnapshot(cachePath, snapshot) {
|
|
|
129061
129856
|
async function cleanupOldSnapshots(cachePath, keepCount) {
|
|
129062
129857
|
let entries;
|
|
129063
129858
|
try {
|
|
129064
|
-
entries = await
|
|
129859
|
+
entries = await fs39.readdir(cachePath);
|
|
129065
129860
|
} catch {
|
|
129066
129861
|
return;
|
|
129067
129862
|
}
|
|
129068
129863
|
const snapshots = entries.filter((e9) => e9.startsWith("snapshot-")).sort().reverse();
|
|
129069
129864
|
for (const snapshot of snapshots.slice(keepCount)) {
|
|
129070
129865
|
try {
|
|
129071
|
-
await
|
|
129866
|
+
await fs39.rm(path42.join(cachePath, snapshot), {
|
|
129072
129867
|
recursive: true,
|
|
129073
129868
|
force: true
|
|
129074
129869
|
});
|
|
@@ -129320,7 +130115,7 @@ async function completeTerminationLifecycleAction(options2 = {}) {
|
|
|
129320
130115
|
|
|
129321
130116
|
// worker/run.ts
|
|
129322
130117
|
init_error();
|
|
129323
|
-
import
|
|
130118
|
+
import path43 from "node:path";
|
|
129324
130119
|
|
|
129325
130120
|
// worker/github-app-auth.ts
|
|
129326
130121
|
var import_auth_app = __toESM(require_dist_node20(), 1);
|
|
@@ -133705,10 +134500,10 @@ var SessionAPI = class extends AbstractAPI {
|
|
|
133705
134500
|
*/
|
|
133706
134501
|
async getToken(sessionId, template, expiresInSeconds) {
|
|
133707
134502
|
this.requireId(sessionId);
|
|
133708
|
-
const
|
|
134503
|
+
const path44 = template ? joinPaths(basePath29, sessionId, "tokens", template) : joinPaths(basePath29, sessionId, "tokens");
|
|
133709
134504
|
const requestOptions = {
|
|
133710
134505
|
method: "POST",
|
|
133711
|
-
path:
|
|
134506
|
+
path: path44
|
|
133712
134507
|
};
|
|
133713
134508
|
if (expiresInSeconds !== void 0) {
|
|
133714
134509
|
requestOptions.bodyParams = { expires_in_seconds: expiresInSeconds };
|
|
@@ -136458,12 +137253,12 @@ function buildRequest(options2) {
|
|
|
136458
137253
|
userAgent = USER_AGENT2,
|
|
136459
137254
|
skipApiVersionInUrl = false
|
|
136460
137255
|
} = options2;
|
|
136461
|
-
const { path:
|
|
137256
|
+
const { path: path44, method, queryParams, headerParams, bodyParams, formData, options: opts } = requestOptions;
|
|
136462
137257
|
const { deepSnakecaseBodyParamKeys = false } = opts || {};
|
|
136463
137258
|
if (requireSecretKey) {
|
|
136464
137259
|
assertValidSecretKey(secretKey);
|
|
136465
137260
|
}
|
|
136466
|
-
const url = skipApiVersionInUrl ? joinPaths(apiUrl,
|
|
137261
|
+
const url = skipApiVersionInUrl ? joinPaths(apiUrl, path44) : joinPaths(apiUrl, apiVersion, path44);
|
|
136467
137262
|
const finalUrl = new URL(url);
|
|
136468
137263
|
if (queryParams) {
|
|
136469
137264
|
const snakecasedQueryParams = snakecase_keys_default({ ...queryParams });
|
|
@@ -138999,7 +139794,7 @@ async function buildSingleProcessWorker(deps, workspacePath) {
|
|
|
138999
139794
|
const { githubToken, githubTokenSecret, githubAppAuth, clerkSecret } = await readWorkerCredentials(env2, deps.getSecret);
|
|
139000
139795
|
const refreshAuthCache = createClerkAuthCacheRefresher({
|
|
139001
139796
|
secret: clerkSecret,
|
|
139002
|
-
cachePath:
|
|
139797
|
+
cachePath: path43.join(workspacePath, ".cache"),
|
|
139003
139798
|
useOrganizationsAsGroups
|
|
139004
139799
|
});
|
|
139005
139800
|
const worker = deps.createWorker({
|
|
@@ -139079,7 +139874,7 @@ async function buildSplitWorker(deps, workspacePath, socketPath, onGatewayWait)
|
|
|
139079
139874
|
}
|
|
139080
139875
|
const refreshAuthCache = health.clerkConfigured ? async () => {
|
|
139081
139876
|
const snapshot = await gateway.authSnapshot();
|
|
139082
|
-
await deps.writeAuthSnapshot(
|
|
139877
|
+
await deps.writeAuthSnapshot(path43.join(workspacePath, ".cache"), snapshot);
|
|
139083
139878
|
workerLog(` ${snapshot.users.length} users, ${snapshot.groups.length} groups`);
|
|
139084
139879
|
} : void 0;
|
|
139085
139880
|
const worker = deps.createWorker({
|
|
@@ -139310,6 +140105,7 @@ function failedGateway(message2, instance) {
|
|
|
139310
140105
|
getPullRequest: refuse,
|
|
139311
140106
|
createOrUpdatePullRequest: refuse,
|
|
139312
140107
|
convertPullRequestToDraft: refuse,
|
|
140108
|
+
setConflictsStatus: refuse,
|
|
139313
140109
|
deleteBranch: refuse,
|
|
139314
140110
|
authSnapshot: refuse,
|
|
139315
140111
|
termination: (signal) => instance.termination(signal),
|