canopycms-cdk 0.0.67 → 0.0.68-int.93
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 +52 -28
- package/package.json +4 -4
- package/worker/dist/index.js +691 -408
package/worker/dist/index.js
CHANGED
|
@@ -624,7 +624,7 @@ var require_node = __commonJS({
|
|
|
624
624
|
var tty = __require("tty");
|
|
625
625
|
var util2 = __require("util");
|
|
626
626
|
exports.init = init;
|
|
627
|
-
exports.log =
|
|
627
|
+
exports.log = log8;
|
|
628
628
|
exports.formatArgs = formatArgs;
|
|
629
629
|
exports.save = save;
|
|
630
630
|
exports.load = load;
|
|
@@ -759,7 +759,7 @@ var require_node = __commonJS({
|
|
|
759
759
|
}
|
|
760
760
|
return (/* @__PURE__ */ new Date()).toISOString() + " ";
|
|
761
761
|
}
|
|
762
|
-
function
|
|
762
|
+
function log8(...args) {
|
|
763
763
|
return process.stderr.write(util2.formatWithOptions(exports.inspectOpts, ...args) + "\n");
|
|
764
764
|
}
|
|
765
765
|
function save(namespaces) {
|
|
@@ -813,32 +813,32 @@ var require_src2 = __commonJS({
|
|
|
813
813
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
814
814
|
var fs_1 = __require("fs");
|
|
815
815
|
var debug_1 = __importDefault2(require_src());
|
|
816
|
-
var
|
|
817
|
-
function check(
|
|
818
|
-
|
|
816
|
+
var log8 = debug_1.default("@kwsites/file-exists");
|
|
817
|
+
function check(path22, isFile, isDirectory) {
|
|
818
|
+
log8(`checking %s`, path22);
|
|
819
819
|
try {
|
|
820
|
-
const stat = fs_1.statSync(
|
|
820
|
+
const stat = fs_1.statSync(path22);
|
|
821
821
|
if (stat.isFile() && isFile) {
|
|
822
|
-
|
|
822
|
+
log8(`[OK] path represents a file`);
|
|
823
823
|
return true;
|
|
824
824
|
}
|
|
825
825
|
if (stat.isDirectory() && isDirectory) {
|
|
826
|
-
|
|
826
|
+
log8(`[OK] path represents a directory`);
|
|
827
827
|
return true;
|
|
828
828
|
}
|
|
829
|
-
|
|
829
|
+
log8(`[FAIL] path represents something other than a file or directory`);
|
|
830
830
|
return false;
|
|
831
831
|
} catch (e5) {
|
|
832
832
|
if (e5.code === "ENOENT") {
|
|
833
|
-
|
|
833
|
+
log8(`[FAIL] path is not accessible: %o`, e5);
|
|
834
834
|
return false;
|
|
835
835
|
}
|
|
836
|
-
|
|
836
|
+
log8(`[FATAL] %o`, e5);
|
|
837
837
|
throw e5;
|
|
838
838
|
}
|
|
839
839
|
}
|
|
840
|
-
function exists2(
|
|
841
|
-
return check(
|
|
840
|
+
function exists2(path22, type = exports.READABLE) {
|
|
841
|
+
return check(path22, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
|
|
842
842
|
}
|
|
843
843
|
exports.exists = exists2;
|
|
844
844
|
exports.FILE = 1;
|
|
@@ -927,54 +927,54 @@ var require_polyfills = __commonJS({
|
|
|
927
927
|
}
|
|
928
928
|
var chdir;
|
|
929
929
|
module.exports = patch;
|
|
930
|
-
function patch(
|
|
930
|
+
function patch(fs17) {
|
|
931
931
|
if (constants2.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
|
|
932
|
-
patchLchmod(
|
|
933
|
-
}
|
|
934
|
-
if (!
|
|
935
|
-
patchLutimes(
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
if (
|
|
956
|
-
|
|
932
|
+
patchLchmod(fs17);
|
|
933
|
+
}
|
|
934
|
+
if (!fs17.lutimes) {
|
|
935
|
+
patchLutimes(fs17);
|
|
936
|
+
}
|
|
937
|
+
fs17.chown = chownFix(fs17.chown);
|
|
938
|
+
fs17.fchown = chownFix(fs17.fchown);
|
|
939
|
+
fs17.lchown = chownFix(fs17.lchown);
|
|
940
|
+
fs17.chmod = chmodFix(fs17.chmod);
|
|
941
|
+
fs17.fchmod = chmodFix(fs17.fchmod);
|
|
942
|
+
fs17.lchmod = chmodFix(fs17.lchmod);
|
|
943
|
+
fs17.chownSync = chownFixSync(fs17.chownSync);
|
|
944
|
+
fs17.fchownSync = chownFixSync(fs17.fchownSync);
|
|
945
|
+
fs17.lchownSync = chownFixSync(fs17.lchownSync);
|
|
946
|
+
fs17.chmodSync = chmodFixSync(fs17.chmodSync);
|
|
947
|
+
fs17.fchmodSync = chmodFixSync(fs17.fchmodSync);
|
|
948
|
+
fs17.lchmodSync = chmodFixSync(fs17.lchmodSync);
|
|
949
|
+
fs17.stat = statFix(fs17.stat);
|
|
950
|
+
fs17.fstat = statFix(fs17.fstat);
|
|
951
|
+
fs17.lstat = statFix(fs17.lstat);
|
|
952
|
+
fs17.statSync = statFixSync(fs17.statSync);
|
|
953
|
+
fs17.fstatSync = statFixSync(fs17.fstatSync);
|
|
954
|
+
fs17.lstatSync = statFixSync(fs17.lstatSync);
|
|
955
|
+
if (fs17.chmod && !fs17.lchmod) {
|
|
956
|
+
fs17.lchmod = function(path22, mode, cb) {
|
|
957
957
|
if (cb) process.nextTick(cb);
|
|
958
958
|
};
|
|
959
|
-
|
|
959
|
+
fs17.lchmodSync = function() {
|
|
960
960
|
};
|
|
961
961
|
}
|
|
962
|
-
if (
|
|
963
|
-
|
|
962
|
+
if (fs17.chown && !fs17.lchown) {
|
|
963
|
+
fs17.lchown = function(path22, uid, gid, cb) {
|
|
964
964
|
if (cb) process.nextTick(cb);
|
|
965
965
|
};
|
|
966
|
-
|
|
966
|
+
fs17.lchownSync = function() {
|
|
967
967
|
};
|
|
968
968
|
}
|
|
969
969
|
if (platform === "win32") {
|
|
970
|
-
|
|
970
|
+
fs17.rename = typeof fs17.rename !== "function" ? fs17.rename : (function(fs$rename) {
|
|
971
971
|
function rename(from, to, cb) {
|
|
972
972
|
var start = Date.now();
|
|
973
973
|
var backoff = 0;
|
|
974
974
|
fs$rename(from, to, function CB(er) {
|
|
975
975
|
if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
|
|
976
976
|
setTimeout(function() {
|
|
977
|
-
|
|
977
|
+
fs17.stat(to, function(stater, st) {
|
|
978
978
|
if (stater && stater.code === "ENOENT")
|
|
979
979
|
fs$rename(from, to, CB);
|
|
980
980
|
else
|
|
@@ -990,9 +990,9 @@ var require_polyfills = __commonJS({
|
|
|
990
990
|
}
|
|
991
991
|
if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
|
|
992
992
|
return rename;
|
|
993
|
-
})(
|
|
993
|
+
})(fs17.rename);
|
|
994
994
|
}
|
|
995
|
-
|
|
995
|
+
fs17.read = typeof fs17.read !== "function" ? fs17.read : (function(fs$read) {
|
|
996
996
|
function read(fd, buffer, offset, length, position, callback_) {
|
|
997
997
|
var callback;
|
|
998
998
|
if (callback_ && typeof callback_ === "function") {
|
|
@@ -1000,22 +1000,22 @@ var require_polyfills = __commonJS({
|
|
|
1000
1000
|
callback = function(er, _3, __) {
|
|
1001
1001
|
if (er && er.code === "EAGAIN" && eagCounter < 10) {
|
|
1002
1002
|
eagCounter++;
|
|
1003
|
-
return fs$read.call(
|
|
1003
|
+
return fs$read.call(fs17, fd, buffer, offset, length, position, callback);
|
|
1004
1004
|
}
|
|
1005
1005
|
callback_.apply(this, arguments);
|
|
1006
1006
|
};
|
|
1007
1007
|
}
|
|
1008
|
-
return fs$read.call(
|
|
1008
|
+
return fs$read.call(fs17, fd, buffer, offset, length, position, callback);
|
|
1009
1009
|
}
|
|
1010
1010
|
if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
|
|
1011
1011
|
return read;
|
|
1012
|
-
})(
|
|
1013
|
-
|
|
1012
|
+
})(fs17.read);
|
|
1013
|
+
fs17.readSync = typeof fs17.readSync !== "function" ? fs17.readSync : /* @__PURE__ */ (function(fs$readSync) {
|
|
1014
1014
|
return function(fd, buffer, offset, length, position) {
|
|
1015
1015
|
var eagCounter = 0;
|
|
1016
1016
|
while (true) {
|
|
1017
1017
|
try {
|
|
1018
|
-
return fs$readSync.call(
|
|
1018
|
+
return fs$readSync.call(fs17, fd, buffer, offset, length, position);
|
|
1019
1019
|
} catch (er) {
|
|
1020
1020
|
if (er.code === "EAGAIN" && eagCounter < 10) {
|
|
1021
1021
|
eagCounter++;
|
|
@@ -1025,11 +1025,11 @@ var require_polyfills = __commonJS({
|
|
|
1025
1025
|
}
|
|
1026
1026
|
}
|
|
1027
1027
|
};
|
|
1028
|
-
})(
|
|
1029
|
-
function patchLchmod(
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1028
|
+
})(fs17.readSync);
|
|
1029
|
+
function patchLchmod(fs18) {
|
|
1030
|
+
fs18.lchmod = function(path22, mode, callback) {
|
|
1031
|
+
fs18.open(
|
|
1032
|
+
path22,
|
|
1033
1033
|
constants2.O_WRONLY | constants2.O_SYMLINK,
|
|
1034
1034
|
mode,
|
|
1035
1035
|
function(err, fd) {
|
|
@@ -1037,80 +1037,80 @@ var require_polyfills = __commonJS({
|
|
|
1037
1037
|
if (callback) callback(err);
|
|
1038
1038
|
return;
|
|
1039
1039
|
}
|
|
1040
|
-
|
|
1041
|
-
|
|
1040
|
+
fs18.fchmod(fd, mode, function(err2) {
|
|
1041
|
+
fs18.close(fd, function(err22) {
|
|
1042
1042
|
if (callback) callback(err2 || err22);
|
|
1043
1043
|
});
|
|
1044
1044
|
});
|
|
1045
1045
|
}
|
|
1046
1046
|
);
|
|
1047
1047
|
};
|
|
1048
|
-
|
|
1049
|
-
var fd =
|
|
1048
|
+
fs18.lchmodSync = function(path22, mode) {
|
|
1049
|
+
var fd = fs18.openSync(path22, constants2.O_WRONLY | constants2.O_SYMLINK, mode);
|
|
1050
1050
|
var threw = true;
|
|
1051
1051
|
var ret;
|
|
1052
1052
|
try {
|
|
1053
|
-
ret =
|
|
1053
|
+
ret = fs18.fchmodSync(fd, mode);
|
|
1054
1054
|
threw = false;
|
|
1055
1055
|
} finally {
|
|
1056
1056
|
if (threw) {
|
|
1057
1057
|
try {
|
|
1058
|
-
|
|
1058
|
+
fs18.closeSync(fd);
|
|
1059
1059
|
} catch (er) {
|
|
1060
1060
|
}
|
|
1061
1061
|
} else {
|
|
1062
|
-
|
|
1062
|
+
fs18.closeSync(fd);
|
|
1063
1063
|
}
|
|
1064
1064
|
}
|
|
1065
1065
|
return ret;
|
|
1066
1066
|
};
|
|
1067
1067
|
}
|
|
1068
|
-
function patchLutimes(
|
|
1069
|
-
if (constants2.hasOwnProperty("O_SYMLINK") &&
|
|
1070
|
-
|
|
1071
|
-
|
|
1068
|
+
function patchLutimes(fs18) {
|
|
1069
|
+
if (constants2.hasOwnProperty("O_SYMLINK") && fs18.futimes) {
|
|
1070
|
+
fs18.lutimes = function(path22, at, mt, cb) {
|
|
1071
|
+
fs18.open(path22, constants2.O_SYMLINK, function(er, fd) {
|
|
1072
1072
|
if (er) {
|
|
1073
1073
|
if (cb) cb(er);
|
|
1074
1074
|
return;
|
|
1075
1075
|
}
|
|
1076
|
-
|
|
1077
|
-
|
|
1076
|
+
fs18.futimes(fd, at, mt, function(er2) {
|
|
1077
|
+
fs18.close(fd, function(er22) {
|
|
1078
1078
|
if (cb) cb(er2 || er22);
|
|
1079
1079
|
});
|
|
1080
1080
|
});
|
|
1081
1081
|
});
|
|
1082
1082
|
};
|
|
1083
|
-
|
|
1084
|
-
var fd =
|
|
1083
|
+
fs18.lutimesSync = function(path22, at, mt) {
|
|
1084
|
+
var fd = fs18.openSync(path22, constants2.O_SYMLINK);
|
|
1085
1085
|
var ret;
|
|
1086
1086
|
var threw = true;
|
|
1087
1087
|
try {
|
|
1088
|
-
ret =
|
|
1088
|
+
ret = fs18.futimesSync(fd, at, mt);
|
|
1089
1089
|
threw = false;
|
|
1090
1090
|
} finally {
|
|
1091
1091
|
if (threw) {
|
|
1092
1092
|
try {
|
|
1093
|
-
|
|
1093
|
+
fs18.closeSync(fd);
|
|
1094
1094
|
} catch (er) {
|
|
1095
1095
|
}
|
|
1096
1096
|
} else {
|
|
1097
|
-
|
|
1097
|
+
fs18.closeSync(fd);
|
|
1098
1098
|
}
|
|
1099
1099
|
}
|
|
1100
1100
|
return ret;
|
|
1101
1101
|
};
|
|
1102
|
-
} else if (
|
|
1103
|
-
|
|
1102
|
+
} else if (fs18.futimes) {
|
|
1103
|
+
fs18.lutimes = function(_a3, _b, _c5, cb) {
|
|
1104
1104
|
if (cb) process.nextTick(cb);
|
|
1105
1105
|
};
|
|
1106
|
-
|
|
1106
|
+
fs18.lutimesSync = function() {
|
|
1107
1107
|
};
|
|
1108
1108
|
}
|
|
1109
1109
|
}
|
|
1110
1110
|
function chmodFix(orig) {
|
|
1111
1111
|
if (!orig) return orig;
|
|
1112
1112
|
return function(target, mode, cb) {
|
|
1113
|
-
return orig.call(
|
|
1113
|
+
return orig.call(fs17, target, mode, function(er) {
|
|
1114
1114
|
if (chownErOk(er)) er = null;
|
|
1115
1115
|
if (cb) cb.apply(this, arguments);
|
|
1116
1116
|
});
|
|
@@ -1120,7 +1120,7 @@ var require_polyfills = __commonJS({
|
|
|
1120
1120
|
if (!orig) return orig;
|
|
1121
1121
|
return function(target, mode) {
|
|
1122
1122
|
try {
|
|
1123
|
-
return orig.call(
|
|
1123
|
+
return orig.call(fs17, target, mode);
|
|
1124
1124
|
} catch (er) {
|
|
1125
1125
|
if (!chownErOk(er)) throw er;
|
|
1126
1126
|
}
|
|
@@ -1129,7 +1129,7 @@ var require_polyfills = __commonJS({
|
|
|
1129
1129
|
function chownFix(orig) {
|
|
1130
1130
|
if (!orig) return orig;
|
|
1131
1131
|
return function(target, uid, gid, cb) {
|
|
1132
|
-
return orig.call(
|
|
1132
|
+
return orig.call(fs17, target, uid, gid, function(er) {
|
|
1133
1133
|
if (chownErOk(er)) er = null;
|
|
1134
1134
|
if (cb) cb.apply(this, arguments);
|
|
1135
1135
|
});
|
|
@@ -1139,7 +1139,7 @@ var require_polyfills = __commonJS({
|
|
|
1139
1139
|
if (!orig) return orig;
|
|
1140
1140
|
return function(target, uid, gid) {
|
|
1141
1141
|
try {
|
|
1142
|
-
return orig.call(
|
|
1142
|
+
return orig.call(fs17, target, uid, gid);
|
|
1143
1143
|
} catch (er) {
|
|
1144
1144
|
if (!chownErOk(er)) throw er;
|
|
1145
1145
|
}
|
|
@@ -1159,13 +1159,13 @@ var require_polyfills = __commonJS({
|
|
|
1159
1159
|
}
|
|
1160
1160
|
if (cb) cb.apply(this, arguments);
|
|
1161
1161
|
}
|
|
1162
|
-
return options ? orig.call(
|
|
1162
|
+
return options ? orig.call(fs17, target, options, callback) : orig.call(fs17, target, callback);
|
|
1163
1163
|
};
|
|
1164
1164
|
}
|
|
1165
1165
|
function statFixSync(orig) {
|
|
1166
1166
|
if (!orig) return orig;
|
|
1167
1167
|
return function(target, options) {
|
|
1168
|
-
var stats = options ? orig.call(
|
|
1168
|
+
var stats = options ? orig.call(fs17, target, options) : orig.call(fs17, target);
|
|
1169
1169
|
if (stats) {
|
|
1170
1170
|
if (stats.uid < 0) stats.uid += 4294967296;
|
|
1171
1171
|
if (stats.gid < 0) stats.gid += 4294967296;
|
|
@@ -1194,16 +1194,16 @@ var require_legacy_streams = __commonJS({
|
|
|
1194
1194
|
"../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js"(exports, module) {
|
|
1195
1195
|
var Stream = __require("stream").Stream;
|
|
1196
1196
|
module.exports = legacy;
|
|
1197
|
-
function legacy(
|
|
1197
|
+
function legacy(fs17) {
|
|
1198
1198
|
return {
|
|
1199
1199
|
ReadStream,
|
|
1200
1200
|
WriteStream
|
|
1201
1201
|
};
|
|
1202
|
-
function ReadStream(
|
|
1203
|
-
if (!(this instanceof ReadStream)) return new ReadStream(
|
|
1202
|
+
function ReadStream(path22, options) {
|
|
1203
|
+
if (!(this instanceof ReadStream)) return new ReadStream(path22, options);
|
|
1204
1204
|
Stream.call(this);
|
|
1205
1205
|
var self2 = this;
|
|
1206
|
-
this.path =
|
|
1206
|
+
this.path = path22;
|
|
1207
1207
|
this.fd = null;
|
|
1208
1208
|
this.readable = true;
|
|
1209
1209
|
this.paused = false;
|
|
@@ -1237,7 +1237,7 @@ var require_legacy_streams = __commonJS({
|
|
|
1237
1237
|
});
|
|
1238
1238
|
return;
|
|
1239
1239
|
}
|
|
1240
|
-
|
|
1240
|
+
fs17.open(this.path, this.flags, this.mode, function(err, fd) {
|
|
1241
1241
|
if (err) {
|
|
1242
1242
|
self2.emit("error", err);
|
|
1243
1243
|
self2.readable = false;
|
|
@@ -1248,10 +1248,10 @@ var require_legacy_streams = __commonJS({
|
|
|
1248
1248
|
self2._read();
|
|
1249
1249
|
});
|
|
1250
1250
|
}
|
|
1251
|
-
function WriteStream(
|
|
1252
|
-
if (!(this instanceof WriteStream)) return new WriteStream(
|
|
1251
|
+
function WriteStream(path22, options) {
|
|
1252
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path22, options);
|
|
1253
1253
|
Stream.call(this);
|
|
1254
|
-
this.path =
|
|
1254
|
+
this.path = path22;
|
|
1255
1255
|
this.fd = null;
|
|
1256
1256
|
this.writable = true;
|
|
1257
1257
|
this.flags = "w";
|
|
@@ -1276,7 +1276,7 @@ var require_legacy_streams = __commonJS({
|
|
|
1276
1276
|
this.busy = false;
|
|
1277
1277
|
this._queue = [];
|
|
1278
1278
|
if (this.fd === null) {
|
|
1279
|
-
this._open =
|
|
1279
|
+
this._open = fs17.open;
|
|
1280
1280
|
this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
|
|
1281
1281
|
this.flush();
|
|
1282
1282
|
}
|
|
@@ -1311,7 +1311,7 @@ var require_clone = __commonJS({
|
|
|
1311
1311
|
// ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
|
|
1312
1312
|
var require_graceful_fs = __commonJS({
|
|
1313
1313
|
"../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js"(exports, module) {
|
|
1314
|
-
var
|
|
1314
|
+
var fs17 = __require("fs");
|
|
1315
1315
|
var polyfills = require_polyfills();
|
|
1316
1316
|
var legacy = require_legacy_streams();
|
|
1317
1317
|
var clone = require_clone();
|
|
@@ -1343,12 +1343,12 @@ var require_graceful_fs = __commonJS({
|
|
|
1343
1343
|
m5 = "GFS4: " + m5.split(/\n/).join("\nGFS4: ");
|
|
1344
1344
|
console.error(m5);
|
|
1345
1345
|
};
|
|
1346
|
-
if (!
|
|
1346
|
+
if (!fs17[gracefulQueue]) {
|
|
1347
1347
|
queue = global[gracefulQueue] || [];
|
|
1348
|
-
publishQueue(
|
|
1349
|
-
|
|
1348
|
+
publishQueue(fs17, queue);
|
|
1349
|
+
fs17.close = (function(fs$close) {
|
|
1350
1350
|
function close(fd, cb) {
|
|
1351
|
-
return fs$close.call(
|
|
1351
|
+
return fs$close.call(fs17, fd, function(err) {
|
|
1352
1352
|
if (!err) {
|
|
1353
1353
|
resetQueue();
|
|
1354
1354
|
}
|
|
@@ -1360,48 +1360,48 @@ var require_graceful_fs = __commonJS({
|
|
|
1360
1360
|
value: fs$close
|
|
1361
1361
|
});
|
|
1362
1362
|
return close;
|
|
1363
|
-
})(
|
|
1364
|
-
|
|
1363
|
+
})(fs17.close);
|
|
1364
|
+
fs17.closeSync = (function(fs$closeSync) {
|
|
1365
1365
|
function closeSync(fd) {
|
|
1366
|
-
fs$closeSync.apply(
|
|
1366
|
+
fs$closeSync.apply(fs17, arguments);
|
|
1367
1367
|
resetQueue();
|
|
1368
1368
|
}
|
|
1369
1369
|
Object.defineProperty(closeSync, previousSymbol, {
|
|
1370
1370
|
value: fs$closeSync
|
|
1371
1371
|
});
|
|
1372
1372
|
return closeSync;
|
|
1373
|
-
})(
|
|
1373
|
+
})(fs17.closeSync);
|
|
1374
1374
|
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
|
|
1375
1375
|
process.on("exit", function() {
|
|
1376
|
-
debug2(
|
|
1377
|
-
__require("assert").equal(
|
|
1376
|
+
debug2(fs17[gracefulQueue]);
|
|
1377
|
+
__require("assert").equal(fs17[gracefulQueue].length, 0);
|
|
1378
1378
|
});
|
|
1379
1379
|
}
|
|
1380
1380
|
}
|
|
1381
1381
|
var queue;
|
|
1382
1382
|
if (!global[gracefulQueue]) {
|
|
1383
|
-
publishQueue(global,
|
|
1384
|
-
}
|
|
1385
|
-
module.exports = patch(clone(
|
|
1386
|
-
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !
|
|
1387
|
-
module.exports = patch(
|
|
1388
|
-
|
|
1389
|
-
}
|
|
1390
|
-
function patch(
|
|
1391
|
-
polyfills(
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
var fs$readFile =
|
|
1396
|
-
|
|
1397
|
-
function readFile(
|
|
1383
|
+
publishQueue(global, fs17[gracefulQueue]);
|
|
1384
|
+
}
|
|
1385
|
+
module.exports = patch(clone(fs17));
|
|
1386
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs17.__patched) {
|
|
1387
|
+
module.exports = patch(fs17);
|
|
1388
|
+
fs17.__patched = true;
|
|
1389
|
+
}
|
|
1390
|
+
function patch(fs18) {
|
|
1391
|
+
polyfills(fs18);
|
|
1392
|
+
fs18.gracefulify = patch;
|
|
1393
|
+
fs18.createReadStream = createReadStream;
|
|
1394
|
+
fs18.createWriteStream = createWriteStream;
|
|
1395
|
+
var fs$readFile = fs18.readFile;
|
|
1396
|
+
fs18.readFile = readFile;
|
|
1397
|
+
function readFile(path22, options, cb) {
|
|
1398
1398
|
if (typeof options === "function")
|
|
1399
1399
|
cb = options, options = null;
|
|
1400
|
-
return go$readFile(
|
|
1401
|
-
function go$readFile(
|
|
1402
|
-
return fs$readFile(
|
|
1400
|
+
return go$readFile(path22, options, cb);
|
|
1401
|
+
function go$readFile(path23, options2, cb2, startTime) {
|
|
1402
|
+
return fs$readFile(path23, options2, function(err) {
|
|
1403
1403
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
1404
|
-
enqueue([go$readFile, [
|
|
1404
|
+
enqueue([go$readFile, [path23, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
1405
1405
|
else {
|
|
1406
1406
|
if (typeof cb2 === "function")
|
|
1407
1407
|
cb2.apply(this, arguments);
|
|
@@ -1409,16 +1409,16 @@ var require_graceful_fs = __commonJS({
|
|
|
1409
1409
|
});
|
|
1410
1410
|
}
|
|
1411
1411
|
}
|
|
1412
|
-
var fs$writeFile =
|
|
1413
|
-
|
|
1414
|
-
function writeFile(
|
|
1412
|
+
var fs$writeFile = fs18.writeFile;
|
|
1413
|
+
fs18.writeFile = writeFile;
|
|
1414
|
+
function writeFile(path22, data2, options, cb) {
|
|
1415
1415
|
if (typeof options === "function")
|
|
1416
1416
|
cb = options, options = null;
|
|
1417
|
-
return go$writeFile(
|
|
1418
|
-
function go$writeFile(
|
|
1419
|
-
return fs$writeFile(
|
|
1417
|
+
return go$writeFile(path22, data2, options, cb);
|
|
1418
|
+
function go$writeFile(path23, data3, options2, cb2, startTime) {
|
|
1419
|
+
return fs$writeFile(path23, data3, options2, function(err) {
|
|
1420
1420
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
1421
|
-
enqueue([go$writeFile, [
|
|
1421
|
+
enqueue([go$writeFile, [path23, data3, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
1422
1422
|
else {
|
|
1423
1423
|
if (typeof cb2 === "function")
|
|
1424
1424
|
cb2.apply(this, arguments);
|
|
@@ -1426,17 +1426,17 @@ var require_graceful_fs = __commonJS({
|
|
|
1426
1426
|
});
|
|
1427
1427
|
}
|
|
1428
1428
|
}
|
|
1429
|
-
var fs$appendFile =
|
|
1429
|
+
var fs$appendFile = fs18.appendFile;
|
|
1430
1430
|
if (fs$appendFile)
|
|
1431
|
-
|
|
1432
|
-
function appendFile(
|
|
1431
|
+
fs18.appendFile = appendFile;
|
|
1432
|
+
function appendFile(path22, data2, options, cb) {
|
|
1433
1433
|
if (typeof options === "function")
|
|
1434
1434
|
cb = options, options = null;
|
|
1435
|
-
return go$appendFile(
|
|
1436
|
-
function go$appendFile(
|
|
1437
|
-
return fs$appendFile(
|
|
1435
|
+
return go$appendFile(path22, data2, options, cb);
|
|
1436
|
+
function go$appendFile(path23, data3, options2, cb2, startTime) {
|
|
1437
|
+
return fs$appendFile(path23, data3, options2, function(err) {
|
|
1438
1438
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
1439
|
-
enqueue([go$appendFile, [
|
|
1439
|
+
enqueue([go$appendFile, [path23, data3, options2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
1440
1440
|
else {
|
|
1441
1441
|
if (typeof cb2 === "function")
|
|
1442
1442
|
cb2.apply(this, arguments);
|
|
@@ -1444,9 +1444,9 @@ var require_graceful_fs = __commonJS({
|
|
|
1444
1444
|
});
|
|
1445
1445
|
}
|
|
1446
1446
|
}
|
|
1447
|
-
var fs$copyFile =
|
|
1447
|
+
var fs$copyFile = fs18.copyFile;
|
|
1448
1448
|
if (fs$copyFile)
|
|
1449
|
-
|
|
1449
|
+
fs18.copyFile = copyFile;
|
|
1450
1450
|
function copyFile(src, dest, flags, cb) {
|
|
1451
1451
|
if (typeof flags === "function") {
|
|
1452
1452
|
cb = flags;
|
|
@@ -1464,34 +1464,34 @@ var require_graceful_fs = __commonJS({
|
|
|
1464
1464
|
});
|
|
1465
1465
|
}
|
|
1466
1466
|
}
|
|
1467
|
-
var fs$readdir =
|
|
1468
|
-
|
|
1467
|
+
var fs$readdir = fs18.readdir;
|
|
1468
|
+
fs18.readdir = readdir;
|
|
1469
1469
|
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
1470
|
-
function readdir(
|
|
1470
|
+
function readdir(path22, options, cb) {
|
|
1471
1471
|
if (typeof options === "function")
|
|
1472
1472
|
cb = options, options = null;
|
|
1473
|
-
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(
|
|
1474
|
-
return fs$readdir(
|
|
1475
|
-
|
|
1473
|
+
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path23, options2, cb2, startTime) {
|
|
1474
|
+
return fs$readdir(path23, fs$readdirCallback(
|
|
1475
|
+
path23,
|
|
1476
1476
|
options2,
|
|
1477
1477
|
cb2,
|
|
1478
1478
|
startTime
|
|
1479
1479
|
));
|
|
1480
|
-
} : function go$readdir2(
|
|
1481
|
-
return fs$readdir(
|
|
1482
|
-
|
|
1480
|
+
} : function go$readdir2(path23, options2, cb2, startTime) {
|
|
1481
|
+
return fs$readdir(path23, options2, fs$readdirCallback(
|
|
1482
|
+
path23,
|
|
1483
1483
|
options2,
|
|
1484
1484
|
cb2,
|
|
1485
1485
|
startTime
|
|
1486
1486
|
));
|
|
1487
1487
|
};
|
|
1488
|
-
return go$readdir(
|
|
1489
|
-
function fs$readdirCallback(
|
|
1488
|
+
return go$readdir(path22, options, cb);
|
|
1489
|
+
function fs$readdirCallback(path23, options2, cb2, startTime) {
|
|
1490
1490
|
return function(err, files) {
|
|
1491
1491
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
1492
1492
|
enqueue([
|
|
1493
1493
|
go$readdir,
|
|
1494
|
-
[
|
|
1494
|
+
[path23, options2, cb2],
|
|
1495
1495
|
err,
|
|
1496
1496
|
startTime || Date.now(),
|
|
1497
1497
|
Date.now()
|
|
@@ -1506,21 +1506,21 @@ var require_graceful_fs = __commonJS({
|
|
|
1506
1506
|
}
|
|
1507
1507
|
}
|
|
1508
1508
|
if (process.version.substr(0, 4) === "v0.8") {
|
|
1509
|
-
var legStreams = legacy(
|
|
1509
|
+
var legStreams = legacy(fs18);
|
|
1510
1510
|
ReadStream = legStreams.ReadStream;
|
|
1511
1511
|
WriteStream = legStreams.WriteStream;
|
|
1512
1512
|
}
|
|
1513
|
-
var fs$ReadStream =
|
|
1513
|
+
var fs$ReadStream = fs18.ReadStream;
|
|
1514
1514
|
if (fs$ReadStream) {
|
|
1515
1515
|
ReadStream.prototype = Object.create(fs$ReadStream.prototype);
|
|
1516
1516
|
ReadStream.prototype.open = ReadStream$open;
|
|
1517
1517
|
}
|
|
1518
|
-
var fs$WriteStream =
|
|
1518
|
+
var fs$WriteStream = fs18.WriteStream;
|
|
1519
1519
|
if (fs$WriteStream) {
|
|
1520
1520
|
WriteStream.prototype = Object.create(fs$WriteStream.prototype);
|
|
1521
1521
|
WriteStream.prototype.open = WriteStream$open;
|
|
1522
1522
|
}
|
|
1523
|
-
Object.defineProperty(
|
|
1523
|
+
Object.defineProperty(fs18, "ReadStream", {
|
|
1524
1524
|
get: function() {
|
|
1525
1525
|
return ReadStream;
|
|
1526
1526
|
},
|
|
@@ -1530,7 +1530,7 @@ var require_graceful_fs = __commonJS({
|
|
|
1530
1530
|
enumerable: true,
|
|
1531
1531
|
configurable: true
|
|
1532
1532
|
});
|
|
1533
|
-
Object.defineProperty(
|
|
1533
|
+
Object.defineProperty(fs18, "WriteStream", {
|
|
1534
1534
|
get: function() {
|
|
1535
1535
|
return WriteStream;
|
|
1536
1536
|
},
|
|
@@ -1541,7 +1541,7 @@ var require_graceful_fs = __commonJS({
|
|
|
1541
1541
|
configurable: true
|
|
1542
1542
|
});
|
|
1543
1543
|
var FileReadStream = ReadStream;
|
|
1544
|
-
Object.defineProperty(
|
|
1544
|
+
Object.defineProperty(fs18, "FileReadStream", {
|
|
1545
1545
|
get: function() {
|
|
1546
1546
|
return FileReadStream;
|
|
1547
1547
|
},
|
|
@@ -1552,7 +1552,7 @@ var require_graceful_fs = __commonJS({
|
|
|
1552
1552
|
configurable: true
|
|
1553
1553
|
});
|
|
1554
1554
|
var FileWriteStream = WriteStream;
|
|
1555
|
-
Object.defineProperty(
|
|
1555
|
+
Object.defineProperty(fs18, "FileWriteStream", {
|
|
1556
1556
|
get: function() {
|
|
1557
1557
|
return FileWriteStream;
|
|
1558
1558
|
},
|
|
@@ -1562,7 +1562,7 @@ var require_graceful_fs = __commonJS({
|
|
|
1562
1562
|
enumerable: true,
|
|
1563
1563
|
configurable: true
|
|
1564
1564
|
});
|
|
1565
|
-
function ReadStream(
|
|
1565
|
+
function ReadStream(path22, options) {
|
|
1566
1566
|
if (this instanceof ReadStream)
|
|
1567
1567
|
return fs$ReadStream.apply(this, arguments), this;
|
|
1568
1568
|
else
|
|
@@ -1582,7 +1582,7 @@ var require_graceful_fs = __commonJS({
|
|
|
1582
1582
|
}
|
|
1583
1583
|
});
|
|
1584
1584
|
}
|
|
1585
|
-
function WriteStream(
|
|
1585
|
+
function WriteStream(path22, options) {
|
|
1586
1586
|
if (this instanceof WriteStream)
|
|
1587
1587
|
return fs$WriteStream.apply(this, arguments), this;
|
|
1588
1588
|
else
|
|
@@ -1600,22 +1600,22 @@ var require_graceful_fs = __commonJS({
|
|
|
1600
1600
|
}
|
|
1601
1601
|
});
|
|
1602
1602
|
}
|
|
1603
|
-
function createReadStream(
|
|
1604
|
-
return new
|
|
1603
|
+
function createReadStream(path22, options) {
|
|
1604
|
+
return new fs18.ReadStream(path22, options);
|
|
1605
1605
|
}
|
|
1606
|
-
function createWriteStream(
|
|
1607
|
-
return new
|
|
1606
|
+
function createWriteStream(path22, options) {
|
|
1607
|
+
return new fs18.WriteStream(path22, options);
|
|
1608
1608
|
}
|
|
1609
|
-
var fs$open =
|
|
1610
|
-
|
|
1611
|
-
function open(
|
|
1609
|
+
var fs$open = fs18.open;
|
|
1610
|
+
fs18.open = open;
|
|
1611
|
+
function open(path22, flags, mode, cb) {
|
|
1612
1612
|
if (typeof mode === "function")
|
|
1613
1613
|
cb = mode, mode = null;
|
|
1614
|
-
return go$open(
|
|
1615
|
-
function go$open(
|
|
1616
|
-
return fs$open(
|
|
1614
|
+
return go$open(path22, flags, mode, cb);
|
|
1615
|
+
function go$open(path23, flags2, mode2, cb2, startTime) {
|
|
1616
|
+
return fs$open(path23, flags2, mode2, function(err, fd) {
|
|
1617
1617
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
1618
|
-
enqueue([go$open, [
|
|
1618
|
+
enqueue([go$open, [path23, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
|
|
1619
1619
|
else {
|
|
1620
1620
|
if (typeof cb2 === "function")
|
|
1621
1621
|
cb2.apply(this, arguments);
|
|
@@ -1623,20 +1623,20 @@ var require_graceful_fs = __commonJS({
|
|
|
1623
1623
|
});
|
|
1624
1624
|
}
|
|
1625
1625
|
}
|
|
1626
|
-
return
|
|
1626
|
+
return fs18;
|
|
1627
1627
|
}
|
|
1628
1628
|
function enqueue(elem) {
|
|
1629
1629
|
debug2("ENQUEUE", elem[0].name, elem[1]);
|
|
1630
|
-
|
|
1630
|
+
fs17[gracefulQueue].push(elem);
|
|
1631
1631
|
retry2();
|
|
1632
1632
|
}
|
|
1633
1633
|
var retryTimer;
|
|
1634
1634
|
function resetQueue() {
|
|
1635
1635
|
var now = Date.now();
|
|
1636
|
-
for (var i6 = 0; i6 <
|
|
1637
|
-
if (
|
|
1638
|
-
|
|
1639
|
-
|
|
1636
|
+
for (var i6 = 0; i6 < fs17[gracefulQueue].length; ++i6) {
|
|
1637
|
+
if (fs17[gracefulQueue][i6].length > 2) {
|
|
1638
|
+
fs17[gracefulQueue][i6][3] = now;
|
|
1639
|
+
fs17[gracefulQueue][i6][4] = now;
|
|
1640
1640
|
}
|
|
1641
1641
|
}
|
|
1642
1642
|
retry2();
|
|
@@ -1644,9 +1644,9 @@ var require_graceful_fs = __commonJS({
|
|
|
1644
1644
|
function retry2() {
|
|
1645
1645
|
clearTimeout(retryTimer);
|
|
1646
1646
|
retryTimer = void 0;
|
|
1647
|
-
if (
|
|
1647
|
+
if (fs17[gracefulQueue].length === 0)
|
|
1648
1648
|
return;
|
|
1649
|
-
var elem =
|
|
1649
|
+
var elem = fs17[gracefulQueue].shift();
|
|
1650
1650
|
var fn = elem[0];
|
|
1651
1651
|
var args = elem[1];
|
|
1652
1652
|
var err = elem[2];
|
|
@@ -1668,7 +1668,7 @@ var require_graceful_fs = __commonJS({
|
|
|
1668
1668
|
debug2("RETRY", fn.name, args);
|
|
1669
1669
|
fn.apply(null, args.concat([startTime]));
|
|
1670
1670
|
} else {
|
|
1671
|
-
|
|
1671
|
+
fs17[gracefulQueue].push(elem);
|
|
1672
1672
|
}
|
|
1673
1673
|
}
|
|
1674
1674
|
if (retryTimer === void 0) {
|
|
@@ -2103,10 +2103,10 @@ var require_mtime_precision = __commonJS({
|
|
|
2103
2103
|
"../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/mtime-precision.js"(exports, module) {
|
|
2104
2104
|
"use strict";
|
|
2105
2105
|
var cacheSymbol = Symbol();
|
|
2106
|
-
function probe(file,
|
|
2107
|
-
const cachedPrecision =
|
|
2106
|
+
function probe(file, fs17, callback) {
|
|
2107
|
+
const cachedPrecision = fs17[cacheSymbol];
|
|
2108
2108
|
if (cachedPrecision) {
|
|
2109
|
-
return
|
|
2109
|
+
return fs17.stat(file, (err, stat) => {
|
|
2110
2110
|
if (err) {
|
|
2111
2111
|
return callback(err);
|
|
2112
2112
|
}
|
|
@@ -2114,16 +2114,16 @@ var require_mtime_precision = __commonJS({
|
|
|
2114
2114
|
});
|
|
2115
2115
|
}
|
|
2116
2116
|
const mtime = new Date(Math.ceil(Date.now() / 1e3) * 1e3 + 5);
|
|
2117
|
-
|
|
2117
|
+
fs17.utimes(file, mtime, mtime, (err) => {
|
|
2118
2118
|
if (err) {
|
|
2119
2119
|
return callback(err);
|
|
2120
2120
|
}
|
|
2121
|
-
|
|
2121
|
+
fs17.stat(file, (err2, stat) => {
|
|
2122
2122
|
if (err2) {
|
|
2123
2123
|
return callback(err2);
|
|
2124
2124
|
}
|
|
2125
2125
|
const precision = stat.mtime.getTime() % 1e3 === 0 ? "s" : "ms";
|
|
2126
|
-
Object.defineProperty(
|
|
2126
|
+
Object.defineProperty(fs17, cacheSymbol, { value: precision });
|
|
2127
2127
|
callback(null, stat.mtime, precision);
|
|
2128
2128
|
});
|
|
2129
2129
|
});
|
|
@@ -2144,8 +2144,8 @@ var require_mtime_precision = __commonJS({
|
|
|
2144
2144
|
var require_lockfile = __commonJS({
|
|
2145
2145
|
"../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/lockfile.js"(exports, module) {
|
|
2146
2146
|
"use strict";
|
|
2147
|
-
var
|
|
2148
|
-
var
|
|
2147
|
+
var path22 = __require("path");
|
|
2148
|
+
var fs17 = require_graceful_fs();
|
|
2149
2149
|
var retry2 = require_retry2();
|
|
2150
2150
|
var onExit = require_signal_exit();
|
|
2151
2151
|
var mtimePrecision = require_mtime_precision();
|
|
@@ -2155,7 +2155,7 @@ var require_lockfile = __commonJS({
|
|
|
2155
2155
|
}
|
|
2156
2156
|
function resolveCanonicalPath(file, options, callback) {
|
|
2157
2157
|
if (!options.realpath) {
|
|
2158
|
-
return callback(null,
|
|
2158
|
+
return callback(null, path22.resolve(file));
|
|
2159
2159
|
}
|
|
2160
2160
|
options.fs.realpath(file, callback);
|
|
2161
2161
|
}
|
|
@@ -2276,7 +2276,7 @@ var require_lockfile = __commonJS({
|
|
|
2276
2276
|
update: null,
|
|
2277
2277
|
realpath: true,
|
|
2278
2278
|
retries: 0,
|
|
2279
|
-
fs:
|
|
2279
|
+
fs: fs17,
|
|
2280
2280
|
onCompromised: (err) => {
|
|
2281
2281
|
throw err;
|
|
2282
2282
|
},
|
|
@@ -2320,7 +2320,7 @@ var require_lockfile = __commonJS({
|
|
|
2320
2320
|
}
|
|
2321
2321
|
function unlock(file, options, callback) {
|
|
2322
2322
|
options = {
|
|
2323
|
-
fs:
|
|
2323
|
+
fs: fs17,
|
|
2324
2324
|
realpath: true,
|
|
2325
2325
|
...options
|
|
2326
2326
|
};
|
|
@@ -2342,7 +2342,7 @@ var require_lockfile = __commonJS({
|
|
|
2342
2342
|
options = {
|
|
2343
2343
|
stale: 1e4,
|
|
2344
2344
|
realpath: true,
|
|
2345
|
-
fs:
|
|
2345
|
+
fs: fs17,
|
|
2346
2346
|
...options
|
|
2347
2347
|
};
|
|
2348
2348
|
options.stale = Math.max(options.stale || 0, 2e3);
|
|
@@ -2381,16 +2381,16 @@ var require_lockfile = __commonJS({
|
|
|
2381
2381
|
var require_adapter = __commonJS({
|
|
2382
2382
|
"../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/adapter.js"(exports, module) {
|
|
2383
2383
|
"use strict";
|
|
2384
|
-
var
|
|
2385
|
-
function createSyncFs(
|
|
2384
|
+
var fs17 = require_graceful_fs();
|
|
2385
|
+
function createSyncFs(fs18) {
|
|
2386
2386
|
const methods = ["mkdir", "realpath", "stat", "rmdir", "utimes"];
|
|
2387
|
-
const newFs = { ...
|
|
2387
|
+
const newFs = { ...fs18 };
|
|
2388
2388
|
methods.forEach((method) => {
|
|
2389
2389
|
newFs[method] = (...args) => {
|
|
2390
2390
|
const callback = args.pop();
|
|
2391
2391
|
let ret;
|
|
2392
2392
|
try {
|
|
2393
|
-
ret =
|
|
2393
|
+
ret = fs18[`${method}Sync`](...args);
|
|
2394
2394
|
} catch (err) {
|
|
2395
2395
|
return callback(err);
|
|
2396
2396
|
}
|
|
@@ -2428,7 +2428,7 @@ var require_adapter = __commonJS({
|
|
|
2428
2428
|
}
|
|
2429
2429
|
function toSyncOptions(options) {
|
|
2430
2430
|
options = { ...options };
|
|
2431
|
-
options.fs = createSyncFs(options.fs ||
|
|
2431
|
+
options.fs = createSyncFs(options.fs || fs17);
|
|
2432
2432
|
if (typeof options.retries === "number" && options.retries > 0 || options.retries && typeof options.retries.retries === "number" && options.retries.retries > 0) {
|
|
2433
2433
|
throw Object.assign(new Error("Cannot use retries with the sync api"), { code: "ESYNC" });
|
|
2434
2434
|
}
|
|
@@ -3215,7 +3215,7 @@ var require_dist_node5 = __commonJS({
|
|
|
3215
3215
|
}
|
|
3216
3216
|
function fetchWrapper(requestOptions) {
|
|
3217
3217
|
var _a3, _b, _c5, _d;
|
|
3218
|
-
const
|
|
3218
|
+
const log8 = requestOptions.request && requestOptions.request.log ? requestOptions.request.log : console;
|
|
3219
3219
|
const parseSuccessResponseBody = ((_a3 = requestOptions.request) == null ? void 0 : _a3.parseSuccessResponseBody) !== false;
|
|
3220
3220
|
if (isPlainObject(requestOptions.body) || Array.isArray(requestOptions.body)) {
|
|
3221
3221
|
requestOptions.body = JSON.stringify(requestOptions.body);
|
|
@@ -3250,7 +3250,7 @@ var require_dist_node5 = __commonJS({
|
|
|
3250
3250
|
if ("deprecation" in headers) {
|
|
3251
3251
|
const matches2 = headers.link && headers.link.match(/<([^<>]+)>; rel="deprecation"/);
|
|
3252
3252
|
const deprecationLink = matches2 && matches2.pop();
|
|
3253
|
-
|
|
3253
|
+
log8.warn(
|
|
3254
3254
|
`[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${headers.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}`
|
|
3255
3255
|
);
|
|
3256
3256
|
}
|
|
@@ -3785,15 +3785,15 @@ var require_dist_node9 = __commonJS({
|
|
|
3785
3785
|
octokit.log.debug("request", options);
|
|
3786
3786
|
const start = Date.now();
|
|
3787
3787
|
const requestOptions = octokit.request.endpoint.parse(options);
|
|
3788
|
-
const
|
|
3788
|
+
const path22 = requestOptions.url.replace(options.baseUrl, "");
|
|
3789
3789
|
return request(options).then((response) => {
|
|
3790
3790
|
octokit.log.info(
|
|
3791
|
-
`${requestOptions.method} ${
|
|
3791
|
+
`${requestOptions.method} ${path22} - ${response.status} in ${Date.now() - start}ms`
|
|
3792
3792
|
);
|
|
3793
3793
|
return response;
|
|
3794
3794
|
}).catch((error2) => {
|
|
3795
3795
|
octokit.log.info(
|
|
3796
|
-
`${requestOptions.method} ${
|
|
3796
|
+
`${requestOptions.method} ${path22} - ${error2.status} in ${Date.now() - start}ms`
|
|
3797
3797
|
);
|
|
3798
3798
|
throw error2;
|
|
3799
3799
|
});
|
|
@@ -7887,7 +7887,7 @@ var require_dist_node13 = __commonJS({
|
|
|
7887
7887
|
];
|
|
7888
7888
|
function routeMatcher(paths) {
|
|
7889
7889
|
const regexes = paths.map(
|
|
7890
|
-
(
|
|
7890
|
+
(path22) => path22.split("/").map((c7) => c7.startsWith("{") ? "(?:.+?)" : c7).join("/")
|
|
7891
7891
|
);
|
|
7892
7892
|
const regex2 = `^(?:${regexes.map((r6) => `(?:${r6})`).join("|")})[^/]*$`;
|
|
7893
7893
|
return new RegExp(regex2, "i");
|
|
@@ -8517,8 +8517,8 @@ var init_parseUtil = __esm({
|
|
|
8517
8517
|
init_errors();
|
|
8518
8518
|
init_en();
|
|
8519
8519
|
makeIssue = (params) => {
|
|
8520
|
-
const { data: data2, path:
|
|
8521
|
-
const fullPath = [...
|
|
8520
|
+
const { data: data2, path: path22, errorMaps, issueData } = params;
|
|
8521
|
+
const fullPath = [...path22, ...issueData.path || []];
|
|
8522
8522
|
const fullIssue = {
|
|
8523
8523
|
...issueData,
|
|
8524
8524
|
path: fullPath
|
|
@@ -8826,11 +8826,11 @@ var init_types2 = __esm({
|
|
|
8826
8826
|
init_parseUtil();
|
|
8827
8827
|
init_util2();
|
|
8828
8828
|
ParseInputLazyPath = class {
|
|
8829
|
-
constructor(parent, value,
|
|
8829
|
+
constructor(parent, value, path22, key) {
|
|
8830
8830
|
this._cachedPath = [];
|
|
8831
8831
|
this.parent = parent;
|
|
8832
8832
|
this.data = value;
|
|
8833
|
-
this._path =
|
|
8833
|
+
this._path = path22;
|
|
8834
8834
|
this._key = key;
|
|
8835
8835
|
}
|
|
8836
8836
|
get path() {
|
|
@@ -12297,7 +12297,8 @@ var init_field = __esm({
|
|
|
12297
12297
|
});
|
|
12298
12298
|
objectFieldSchema = fieldBaseSchema.extend({
|
|
12299
12299
|
type: external_exports.literal("object"),
|
|
12300
|
-
fields: external_exports.array(external_exports.lazy(() => fieldHolder[0])).min(1)
|
|
12300
|
+
fields: external_exports.array(external_exports.lazy(() => fieldHolder[0])).min(1),
|
|
12301
|
+
itemTitleField: external_exports.string().min(1).optional()
|
|
12301
12302
|
});
|
|
12302
12303
|
inlineGroupFieldSchema = external_exports.object({
|
|
12303
12304
|
type: external_exports.literal("group"),
|
|
@@ -12538,6 +12539,9 @@ var init_config2 = __esm({
|
|
|
12538
12539
|
defaultRemoteUrl: defaultRemoteUrlSchema.optional(),
|
|
12539
12540
|
gitBotAuthorName: gitBotAuthorNameSchema,
|
|
12540
12541
|
gitBotAuthorEmail: gitBotAuthorEmailSchema,
|
|
12542
|
+
// Unset reads as on for Edited-by and off for Co-authored-by (services.ts submitBranch).
|
|
12543
|
+
gitEditedByTrailers: external_exports.boolean().optional(),
|
|
12544
|
+
gitCoAuthoredByTrailers: external_exports.boolean().optional(),
|
|
12541
12545
|
githubTokenEnvVar: githubTokenEnvVarSchema.optional(),
|
|
12542
12546
|
// Required by design (follow-up to SEC-C1): a prod deploy that omits `mode` must fail
|
|
12543
12547
|
// validation loudly rather than silently running header-trusting dev auth semantics.
|
|
@@ -12549,7 +12553,6 @@ var init_config2 = __esm({
|
|
|
12549
12553
|
// Default false/unset — the standard AWS Lambda+worker topology must leave this unset.
|
|
12550
12554
|
allowNetworkRemoteInProd: external_exports.boolean().optional(),
|
|
12551
12555
|
settingsBranch: external_exports.string().optional(),
|
|
12552
|
-
autoCreateSettingsPR: external_exports.boolean().optional(),
|
|
12553
12556
|
// `.optional()`, NOT bare `deploymentNameSchema`: its own `.default('prod')` would make
|
|
12554
12557
|
// `parse(undefined)` resolve to 'prod' instead of staying `undefined`, collapsing the
|
|
12555
12558
|
// env > config > modeDefault precedence chain `resolveDeploymentName`
|
|
@@ -12588,8 +12591,8 @@ var init_permissions = __esm({
|
|
|
12588
12591
|
});
|
|
12589
12592
|
|
|
12590
12593
|
// ../canopycms/src/paths/normalize.ts
|
|
12591
|
-
function normalizeFilesystemPath(
|
|
12592
|
-
return
|
|
12594
|
+
function normalizeFilesystemPath(path22) {
|
|
12595
|
+
return path22.split(/[\\/]+/).filter(Boolean).join("/");
|
|
12593
12596
|
}
|
|
12594
12597
|
var init_normalize = __esm({
|
|
12595
12598
|
"../canopycms/src/paths/normalize.ts"() {
|
|
@@ -13739,9 +13742,9 @@ var init_createPaginator = __esm({
|
|
|
13739
13742
|
command = withCommand(command) ?? command;
|
|
13740
13743
|
return await client.send(command, ...args);
|
|
13741
13744
|
};
|
|
13742
|
-
get = (fromObject,
|
|
13745
|
+
get = (fromObject, path22) => {
|
|
13743
13746
|
let cursor2 = fromObject;
|
|
13744
|
-
const pathComponents =
|
|
13747
|
+
const pathComponents = path22.split(".");
|
|
13745
13748
|
for (const step of pathComponents) {
|
|
13746
13749
|
if (!cursor2 || typeof cursor2 !== "object") {
|
|
13747
13750
|
return void 0;
|
|
@@ -14759,12 +14762,12 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
14759
14762
|
const password = request.password ?? "";
|
|
14760
14763
|
auth = `${username}:${password}`;
|
|
14761
14764
|
}
|
|
14762
|
-
let
|
|
14765
|
+
let path22 = request.path;
|
|
14763
14766
|
if (queryString) {
|
|
14764
|
-
|
|
14767
|
+
path22 += `?${queryString}`;
|
|
14765
14768
|
}
|
|
14766
14769
|
if (request.fragment) {
|
|
14767
|
-
|
|
14770
|
+
path22 += `#${request.fragment}`;
|
|
14768
14771
|
}
|
|
14769
14772
|
let hostname = request.hostname ?? "";
|
|
14770
14773
|
if (hostname[0] === "[" && hostname.endsWith("]")) {
|
|
@@ -14776,7 +14779,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
14776
14779
|
headers: request.headers,
|
|
14777
14780
|
host: hostname,
|
|
14778
14781
|
method: request.method,
|
|
14779
|
-
path:
|
|
14782
|
+
path: path22,
|
|
14780
14783
|
port: request.port,
|
|
14781
14784
|
agent,
|
|
14782
14785
|
auth
|
|
@@ -15059,16 +15062,16 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
15059
15062
|
reject(err);
|
|
15060
15063
|
};
|
|
15061
15064
|
const queryString = querystringBuilder.buildQueryString(query || {});
|
|
15062
|
-
let
|
|
15065
|
+
let path22 = request.path;
|
|
15063
15066
|
if (queryString) {
|
|
15064
|
-
|
|
15067
|
+
path22 += `?${queryString}`;
|
|
15065
15068
|
}
|
|
15066
15069
|
if (request.fragment) {
|
|
15067
|
-
|
|
15070
|
+
path22 += `#${request.fragment}`;
|
|
15068
15071
|
}
|
|
15069
15072
|
const req = session.request({
|
|
15070
15073
|
...request.headers,
|
|
15071
|
-
[http2.constants.HTTP2_HEADER_PATH]:
|
|
15074
|
+
[http2.constants.HTTP2_HEADER_PATH]: path22,
|
|
15072
15075
|
[http2.constants.HTTP2_HEADER_METHOD]: method
|
|
15073
15076
|
});
|
|
15074
15077
|
session.ref();
|
|
@@ -15255,13 +15258,13 @@ var require_dist_cjs14 = __commonJS({
|
|
|
15255
15258
|
const abortError = buildAbortError(abortSignal);
|
|
15256
15259
|
return Promise.reject(abortError);
|
|
15257
15260
|
}
|
|
15258
|
-
let
|
|
15261
|
+
let path22 = request.path;
|
|
15259
15262
|
const queryString = querystringBuilder.buildQueryString(request.query || {});
|
|
15260
15263
|
if (queryString) {
|
|
15261
|
-
|
|
15264
|
+
path22 += `?${queryString}`;
|
|
15262
15265
|
}
|
|
15263
15266
|
if (request.fragment) {
|
|
15264
|
-
|
|
15267
|
+
path22 += `#${request.fragment}`;
|
|
15265
15268
|
}
|
|
15266
15269
|
let auth = "";
|
|
15267
15270
|
if (request.username != null || request.password != null) {
|
|
@@ -15270,7 +15273,7 @@ var require_dist_cjs14 = __commonJS({
|
|
|
15270
15273
|
auth = `${username}:${password}@`;
|
|
15271
15274
|
}
|
|
15272
15275
|
const { port, method } = request;
|
|
15273
|
-
const url = `${request.protocol}//${auth}${request.hostname}${port ? `:${port}` : ""}${
|
|
15276
|
+
const url = `${request.protocol}//${auth}${request.hostname}${port ? `:${port}` : ""}${path22}`;
|
|
15274
15277
|
const body = method === "GET" || method === "HEAD" ? void 0 : request.body;
|
|
15275
15278
|
const requestOptions = {
|
|
15276
15279
|
body,
|
|
@@ -17502,13 +17505,13 @@ function __disposeResources(env) {
|
|
|
17502
17505
|
}
|
|
17503
17506
|
return next();
|
|
17504
17507
|
}
|
|
17505
|
-
function __rewriteRelativeImportExtension(
|
|
17506
|
-
if (typeof
|
|
17507
|
-
return
|
|
17508
|
+
function __rewriteRelativeImportExtension(path22, preserveJsx) {
|
|
17509
|
+
if (typeof path22 === "string" && /^\.\.?\//.test(path22)) {
|
|
17510
|
+
return path22.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m5, tsx, d5, ext, cm) {
|
|
17508
17511
|
return tsx ? preserveJsx ? ".jsx" : ".js" : d5 && (!ext || !cm) ? m5 : d5 + ext + "." + cm.toLowerCase() + "js";
|
|
17509
17512
|
});
|
|
17510
17513
|
}
|
|
17511
|
-
return
|
|
17514
|
+
return path22;
|
|
17512
17515
|
}
|
|
17513
17516
|
var extendStatics, __assign, __createBinding, __setModuleDefault, ownKeys, _SuppressedError, tslib_es6_default;
|
|
17514
17517
|
var init_tslib_es6 = __esm({
|
|
@@ -18406,11 +18409,11 @@ var init_HttpBindingProtocol = __esm({
|
|
|
18406
18409
|
const opTraits = translateTraits(operationSchema.traits);
|
|
18407
18410
|
if (opTraits.http) {
|
|
18408
18411
|
request.method = opTraits.http[0];
|
|
18409
|
-
const [
|
|
18412
|
+
const [path22, search] = opTraits.http[1].split("?");
|
|
18410
18413
|
if (request.path == "/") {
|
|
18411
|
-
request.path =
|
|
18414
|
+
request.path = path22;
|
|
18412
18415
|
} else {
|
|
18413
|
-
request.path +=
|
|
18416
|
+
request.path += path22;
|
|
18414
18417
|
}
|
|
18415
18418
|
const traitSearchParams = new URLSearchParams(search ?? "");
|
|
18416
18419
|
Object.assign(query, Object.fromEntries(traitSearchParams));
|
|
@@ -18813,8 +18816,8 @@ var init_requestBuilder = __esm({
|
|
|
18813
18816
|
return this;
|
|
18814
18817
|
}
|
|
18815
18818
|
p(memberName, labelValueProvider, uriLabel, isGreedyLabel) {
|
|
18816
|
-
this.resolvePathStack.push((
|
|
18817
|
-
this.path = resolvedPath(
|
|
18819
|
+
this.resolvePathStack.push((path22) => {
|
|
18820
|
+
this.path = resolvedPath(path22, this.input, memberName, labelValueProvider, uriLabel, isGreedyLabel);
|
|
18818
18821
|
});
|
|
18819
18822
|
return this;
|
|
18820
18823
|
}
|
|
@@ -19464,18 +19467,18 @@ var require_dist_cjs20 = __commonJS({
|
|
|
19464
19467
|
}
|
|
19465
19468
|
};
|
|
19466
19469
|
var booleanEquals = (value1, value2) => value1 === value2;
|
|
19467
|
-
var getAttrPathList = (
|
|
19468
|
-
const parts =
|
|
19470
|
+
var getAttrPathList = (path22) => {
|
|
19471
|
+
const parts = path22.split(".");
|
|
19469
19472
|
const pathList = [];
|
|
19470
19473
|
for (const part of parts) {
|
|
19471
19474
|
const squareBracketIndex = part.indexOf("[");
|
|
19472
19475
|
if (squareBracketIndex !== -1) {
|
|
19473
19476
|
if (part.indexOf("]") !== part.length - 1) {
|
|
19474
|
-
throw new EndpointError(`Path: '${
|
|
19477
|
+
throw new EndpointError(`Path: '${path22}' does not end with ']'`);
|
|
19475
19478
|
}
|
|
19476
19479
|
const arrayIndex = part.slice(squareBracketIndex + 1, -1);
|
|
19477
19480
|
if (Number.isNaN(parseInt(arrayIndex))) {
|
|
19478
|
-
throw new EndpointError(`Invalid array index: '${arrayIndex}' in path: '${
|
|
19481
|
+
throw new EndpointError(`Invalid array index: '${arrayIndex}' in path: '${path22}'`);
|
|
19479
19482
|
}
|
|
19480
19483
|
if (squareBracketIndex !== 0) {
|
|
19481
19484
|
pathList.push(part.slice(0, squareBracketIndex));
|
|
@@ -19487,9 +19490,9 @@ var require_dist_cjs20 = __commonJS({
|
|
|
19487
19490
|
}
|
|
19488
19491
|
return pathList;
|
|
19489
19492
|
};
|
|
19490
|
-
var getAttr = (value,
|
|
19493
|
+
var getAttr = (value, path22) => getAttrPathList(path22).reduce((acc, index) => {
|
|
19491
19494
|
if (typeof acc !== "object") {
|
|
19492
|
-
throw new EndpointError(`Index '${index}' in '${
|
|
19495
|
+
throw new EndpointError(`Index '${index}' in '${path22}' not found in '${JSON.stringify(value)}'`);
|
|
19493
19496
|
} else if (Array.isArray(acc)) {
|
|
19494
19497
|
return acc[parseInt(index)];
|
|
19495
19498
|
}
|
|
@@ -19508,8 +19511,8 @@ var require_dist_cjs20 = __commonJS({
|
|
|
19508
19511
|
return value;
|
|
19509
19512
|
}
|
|
19510
19513
|
if (typeof value === "object" && "hostname" in value) {
|
|
19511
|
-
const { hostname: hostname2, port, protocol: protocol2 = "", path:
|
|
19512
|
-
const url = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${
|
|
19514
|
+
const { hostname: hostname2, port, protocol: protocol2 = "", path: path22 = "", query = {} } = value;
|
|
19515
|
+
const url = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${path22}`);
|
|
19513
19516
|
url.search = Object.entries(query).map(([k6, v5]) => `${k6}=${v5}`).join("&");
|
|
19514
19517
|
return url;
|
|
19515
19518
|
}
|
|
@@ -20954,10 +20957,10 @@ ${longDate}
|
|
|
20954
20957
|
${credentialScope}
|
|
20955
20958
|
${utilHexEncoding.toHex(hashedRequest)}`;
|
|
20956
20959
|
}
|
|
20957
|
-
getCanonicalPath({ path:
|
|
20960
|
+
getCanonicalPath({ path: path22 }) {
|
|
20958
20961
|
if (this.uriEscapePath) {
|
|
20959
20962
|
const normalizedPathSegments = [];
|
|
20960
|
-
for (const pathSegment of
|
|
20963
|
+
for (const pathSegment of path22.split("/")) {
|
|
20961
20964
|
if (pathSegment?.length === 0)
|
|
20962
20965
|
continue;
|
|
20963
20966
|
if (pathSegment === ".")
|
|
@@ -20968,11 +20971,11 @@ ${utilHexEncoding.toHex(hashedRequest)}`;
|
|
|
20968
20971
|
normalizedPathSegments.push(pathSegment);
|
|
20969
20972
|
}
|
|
20970
20973
|
}
|
|
20971
|
-
const normalizedPath = `${
|
|
20974
|
+
const normalizedPath = `${path22?.startsWith("/") ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && path22?.endsWith("/") ? "/" : ""}`;
|
|
20972
20975
|
const doubleEncoded = utilUriEscape.escapeUri(normalizedPath);
|
|
20973
20976
|
return doubleEncoded.replace(/%2F/g, "/");
|
|
20974
20977
|
}
|
|
20975
|
-
return
|
|
20978
|
+
return path22;
|
|
20976
20979
|
}
|
|
20977
20980
|
validateResolvedCredentials(credentials) {
|
|
20978
20981
|
if (typeof credentials !== "object" || typeof credentials.accessKeyId !== "string" || typeof credentials.secretAccessKey !== "string") {
|
|
@@ -22276,11 +22279,11 @@ var init_SmithyRpcV2CborProtocol = __esm({
|
|
|
22276
22279
|
}
|
|
22277
22280
|
}
|
|
22278
22281
|
const { service, operation: operation2 } = (0, import_util_middleware5.getSmithyContext)(context);
|
|
22279
|
-
const
|
|
22282
|
+
const path22 = `/service/${service}/operation/${operation2}`;
|
|
22280
22283
|
if (request.path.endsWith("/")) {
|
|
22281
|
-
request.path +=
|
|
22284
|
+
request.path += path22.slice(1);
|
|
22282
22285
|
} else {
|
|
22283
|
-
request.path +=
|
|
22286
|
+
request.path += path22;
|
|
22284
22287
|
}
|
|
22285
22288
|
return request;
|
|
22286
22289
|
}
|
|
@@ -27925,14 +27928,14 @@ var require_readFile = __commonJS({
|
|
|
27925
27928
|
var promises_1 = __require("node:fs/promises");
|
|
27926
27929
|
exports.filePromises = {};
|
|
27927
27930
|
exports.fileIntercept = {};
|
|
27928
|
-
var readFile = (
|
|
27929
|
-
if (exports.fileIntercept[
|
|
27930
|
-
return exports.fileIntercept[
|
|
27931
|
+
var readFile = (path22, options) => {
|
|
27932
|
+
if (exports.fileIntercept[path22] !== void 0) {
|
|
27933
|
+
return exports.fileIntercept[path22];
|
|
27931
27934
|
}
|
|
27932
|
-
if (!exports.filePromises[
|
|
27933
|
-
exports.filePromises[
|
|
27935
|
+
if (!exports.filePromises[path22] || options?.ignoreCache) {
|
|
27936
|
+
exports.filePromises[path22] = (0, promises_1.readFile)(path22, "utf8");
|
|
27934
27937
|
}
|
|
27935
|
-
return exports.filePromises[
|
|
27938
|
+
return exports.filePromises[path22];
|
|
27936
27939
|
};
|
|
27937
27940
|
exports.readFile = readFile;
|
|
27938
27941
|
}
|
|
@@ -27945,7 +27948,7 @@ var require_dist_cjs33 = __commonJS({
|
|
|
27945
27948
|
var getHomeDir = require_getHomeDir();
|
|
27946
27949
|
var getSSOTokenFilepath = require_getSSOTokenFilepath();
|
|
27947
27950
|
var getSSOTokenFromFile = require_getSSOTokenFromFile();
|
|
27948
|
-
var
|
|
27951
|
+
var path22 = __require("path");
|
|
27949
27952
|
var types = require_dist_cjs();
|
|
27950
27953
|
var readFile = require_readFile();
|
|
27951
27954
|
var ENV_PROFILE = "AWS_PROFILE";
|
|
@@ -27967,9 +27970,9 @@ var require_dist_cjs33 = __commonJS({
|
|
|
27967
27970
|
...data2.default && { default: data2.default }
|
|
27968
27971
|
});
|
|
27969
27972
|
var ENV_CONFIG_PATH = "AWS_CONFIG_FILE";
|
|
27970
|
-
var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] ||
|
|
27973
|
+
var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || path22.join(getHomeDir.getHomeDir(), ".aws", "config");
|
|
27971
27974
|
var ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE";
|
|
27972
|
-
var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] ||
|
|
27975
|
+
var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || path22.join(getHomeDir.getHomeDir(), ".aws", "credentials");
|
|
27973
27976
|
var prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/;
|
|
27974
27977
|
var profileNameBlockList = ["__proto__", "profile __proto__"];
|
|
27975
27978
|
var parseIni = (iniData) => {
|
|
@@ -28024,11 +28027,11 @@ var require_dist_cjs33 = __commonJS({
|
|
|
28024
28027
|
const relativeHomeDirPrefix = "~/";
|
|
28025
28028
|
let resolvedFilepath = filepath;
|
|
28026
28029
|
if (filepath.startsWith(relativeHomeDirPrefix)) {
|
|
28027
|
-
resolvedFilepath =
|
|
28030
|
+
resolvedFilepath = path22.join(homeDir, filepath.slice(2));
|
|
28028
28031
|
}
|
|
28029
28032
|
let resolvedConfigFilepath = configFilepath;
|
|
28030
28033
|
if (configFilepath.startsWith(relativeHomeDirPrefix)) {
|
|
28031
|
-
resolvedConfigFilepath =
|
|
28034
|
+
resolvedConfigFilepath = path22.join(homeDir, configFilepath.slice(2));
|
|
28032
28035
|
}
|
|
28033
28036
|
const parsedFiles = await Promise.all([
|
|
28034
28037
|
readFile.readFile(resolvedConfigFilepath, {
|
|
@@ -28067,8 +28070,8 @@ var require_dist_cjs33 = __commonJS({
|
|
|
28067
28070
|
getFileRecord() {
|
|
28068
28071
|
return readFile.fileIntercept;
|
|
28069
28072
|
},
|
|
28070
|
-
interceptFile(
|
|
28071
|
-
readFile.fileIntercept[
|
|
28073
|
+
interceptFile(path23, contents) {
|
|
28074
|
+
readFile.fileIntercept[path23] = Promise.resolve(contents);
|
|
28072
28075
|
},
|
|
28073
28076
|
getTokenRecord() {
|
|
28074
28077
|
return getSSOTokenFromFile.tokenIntercept;
|
|
@@ -28393,8 +28396,8 @@ var require_dist_cjs36 = __commonJS({
|
|
|
28393
28396
|
return endpoint.url.href;
|
|
28394
28397
|
}
|
|
28395
28398
|
if ("hostname" in endpoint) {
|
|
28396
|
-
const { protocol, hostname, port, path:
|
|
28397
|
-
return `${protocol}//${hostname}${port ? ":" + port : ""}${
|
|
28399
|
+
const { protocol, hostname, port, path: path22 } = endpoint;
|
|
28400
|
+
return `${protocol}//${hostname}${port ? ":" + port : ""}${path22}`;
|
|
28398
28401
|
}
|
|
28399
28402
|
}
|
|
28400
28403
|
return endpoint;
|
|
@@ -43186,9 +43189,9 @@ var require_dist_node20 = __commonJS({
|
|
|
43186
43189
|
"[@octokit/auth-app] installationId is set to a falsy value"
|
|
43187
43190
|
);
|
|
43188
43191
|
}
|
|
43189
|
-
const
|
|
43190
|
-
if (typeof
|
|
43191
|
-
|
|
43192
|
+
const log8 = options.log || {};
|
|
43193
|
+
if (typeof log8.warn !== "function") {
|
|
43194
|
+
log8.warn = console.warn.bind(console);
|
|
43192
43195
|
}
|
|
43193
43196
|
const request = options.request || import_request.request.defaults({
|
|
43194
43197
|
headers: {
|
|
@@ -43203,7 +43206,7 @@ var require_dist_node20 = __commonJS({
|
|
|
43203
43206
|
options,
|
|
43204
43207
|
options.installationId ? { installationId: Number(options.installationId) } : {},
|
|
43205
43208
|
{
|
|
43206
|
-
log:
|
|
43209
|
+
log: log8,
|
|
43207
43210
|
oauthApp: (0, import_auth_oauth_app.createOAuthAppAuth)({
|
|
43208
43211
|
clientType: "github-app",
|
|
43209
43212
|
clientId: options.clientId || "",
|
|
@@ -43220,8 +43223,8 @@ var require_dist_node20 = __commonJS({
|
|
|
43220
43223
|
});
|
|
43221
43224
|
|
|
43222
43225
|
// ../canopycms/src/worker/cms-worker.ts
|
|
43223
|
-
import
|
|
43224
|
-
import
|
|
43226
|
+
import fs15 from "node:fs/promises";
|
|
43227
|
+
import path19 from "node:path";
|
|
43225
43228
|
|
|
43226
43229
|
// ../../node_modules/.pnpm/simple-git@3.36.0/node_modules/simple-git/dist/esm/index.js
|
|
43227
43230
|
var import_file_exists = __toESM(require_dist(), 1);
|
|
@@ -43812,8 +43815,8 @@ function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
|
|
|
43812
43815
|
function forEachLineWithContent(input, callback) {
|
|
43813
43816
|
return toLinesWithContent(input, true).map((line) => callback(line));
|
|
43814
43817
|
}
|
|
43815
|
-
function folderExists(
|
|
43816
|
-
return (0, import_file_exists.exists)(
|
|
43818
|
+
function folderExists(path22) {
|
|
43819
|
+
return (0, import_file_exists.exists)(path22, import_file_exists.FOLDER);
|
|
43817
43820
|
}
|
|
43818
43821
|
function append(target, item) {
|
|
43819
43822
|
if (Array.isArray(target)) {
|
|
@@ -44215,8 +44218,8 @@ function checkIsRepoRootTask() {
|
|
|
44215
44218
|
commands: commands5,
|
|
44216
44219
|
format: "utf-8",
|
|
44217
44220
|
onError,
|
|
44218
|
-
parser(
|
|
44219
|
-
return /^\.(git)?$/.test(
|
|
44221
|
+
parser(path22) {
|
|
44222
|
+
return /^\.(git)?$/.test(path22.trim());
|
|
44220
44223
|
}
|
|
44221
44224
|
};
|
|
44222
44225
|
}
|
|
@@ -44650,11 +44653,11 @@ function parseGrep(grep) {
|
|
|
44650
44653
|
const paths = /* @__PURE__ */ new Set();
|
|
44651
44654
|
const results = {};
|
|
44652
44655
|
forEachLineWithContent(grep, (input) => {
|
|
44653
|
-
const [
|
|
44654
|
-
paths.add(
|
|
44655
|
-
(results[
|
|
44656
|
+
const [path22, line, preview] = input.split(NULL);
|
|
44657
|
+
paths.add(path22);
|
|
44658
|
+
(results[path22] = results[path22] || []).push({
|
|
44656
44659
|
line: asNumber(line),
|
|
44657
|
-
path:
|
|
44660
|
+
path: path22,
|
|
44658
44661
|
preview
|
|
44659
44662
|
});
|
|
44660
44663
|
});
|
|
@@ -45164,11 +45167,11 @@ function taskCallback(task, response, callback = NOOP) {
|
|
|
45164
45167
|
response.then(onSuccess, onError2);
|
|
45165
45168
|
}
|
|
45166
45169
|
function addDeprecationNoticeToError(err) {
|
|
45167
|
-
let
|
|
45170
|
+
let log8 = (name) => {
|
|
45168
45171
|
console.warn(
|
|
45169
45172
|
`simple-git deprecation notice: accessing GitResponseError.${name} should be GitResponseError.git.${name}, this will no longer be available in version 3`
|
|
45170
45173
|
);
|
|
45171
|
-
|
|
45174
|
+
log8 = NOOP;
|
|
45172
45175
|
};
|
|
45173
45176
|
return Object.create(err, Object.getOwnPropertyNames(err.git).reduce(descriptorReducer, {}));
|
|
45174
45177
|
function descriptorReducer(all, name) {
|
|
@@ -45179,7 +45182,7 @@ function addDeprecationNoticeToError(err) {
|
|
|
45179
45182
|
enumerable: false,
|
|
45180
45183
|
configurable: false,
|
|
45181
45184
|
get() {
|
|
45182
|
-
|
|
45185
|
+
log8(name);
|
|
45183
45186
|
return err.git[name];
|
|
45184
45187
|
}
|
|
45185
45188
|
};
|
|
@@ -45418,14 +45421,14 @@ var init_hash_object = __esm2({
|
|
|
45418
45421
|
init_task();
|
|
45419
45422
|
}
|
|
45420
45423
|
});
|
|
45421
|
-
function parseInit(bare,
|
|
45424
|
+
function parseInit(bare, path22, text) {
|
|
45422
45425
|
const response = String(text).trim();
|
|
45423
45426
|
let result;
|
|
45424
45427
|
if (result = initResponseRegex.exec(response)) {
|
|
45425
|
-
return new InitSummary(bare,
|
|
45428
|
+
return new InitSummary(bare, path22, false, result[1]);
|
|
45426
45429
|
}
|
|
45427
45430
|
if (result = reInitResponseRegex.exec(response)) {
|
|
45428
|
-
return new InitSummary(bare,
|
|
45431
|
+
return new InitSummary(bare, path22, true, result[1]);
|
|
45429
45432
|
}
|
|
45430
45433
|
let gitDir = "";
|
|
45431
45434
|
const tokens = response.split(" ");
|
|
@@ -45436,7 +45439,7 @@ function parseInit(bare, path20, text) {
|
|
|
45436
45439
|
break;
|
|
45437
45440
|
}
|
|
45438
45441
|
}
|
|
45439
|
-
return new InitSummary(bare,
|
|
45442
|
+
return new InitSummary(bare, path22, /^re/i.test(response), gitDir);
|
|
45440
45443
|
}
|
|
45441
45444
|
var InitSummary;
|
|
45442
45445
|
var initResponseRegex;
|
|
@@ -45445,9 +45448,9 @@ var init_InitSummary = __esm2({
|
|
|
45445
45448
|
"src/lib/responses/InitSummary.ts"() {
|
|
45446
45449
|
"use strict";
|
|
45447
45450
|
InitSummary = class {
|
|
45448
|
-
constructor(bare,
|
|
45451
|
+
constructor(bare, path22, existing, gitDir) {
|
|
45449
45452
|
this.bare = bare;
|
|
45450
|
-
this.path =
|
|
45453
|
+
this.path = path22;
|
|
45451
45454
|
this.existing = existing;
|
|
45452
45455
|
this.gitDir = gitDir;
|
|
45453
45456
|
}
|
|
@@ -45459,7 +45462,7 @@ var init_InitSummary = __esm2({
|
|
|
45459
45462
|
function hasBareCommand(command) {
|
|
45460
45463
|
return command.includes(bareCommand);
|
|
45461
45464
|
}
|
|
45462
|
-
function initTask(bare = false,
|
|
45465
|
+
function initTask(bare = false, path22, customArgs) {
|
|
45463
45466
|
const commands5 = ["init", ...customArgs];
|
|
45464
45467
|
if (bare && !hasBareCommand(commands5)) {
|
|
45465
45468
|
commands5.splice(1, 0, bareCommand);
|
|
@@ -45468,7 +45471,7 @@ function initTask(bare = false, path20, customArgs) {
|
|
|
45468
45471
|
commands: commands5,
|
|
45469
45472
|
format: "utf-8",
|
|
45470
45473
|
parser(text) {
|
|
45471
|
-
return parseInit(commands5.includes("--bare"),
|
|
45474
|
+
return parseInit(commands5.includes("--bare"), path22, text);
|
|
45472
45475
|
}
|
|
45473
45476
|
};
|
|
45474
45477
|
}
|
|
@@ -46283,12 +46286,12 @@ var init_FileStatusSummary = __esm2({
|
|
|
46283
46286
|
"use strict";
|
|
46284
46287
|
fromPathRegex = /^(.+)\0(.+)$/;
|
|
46285
46288
|
FileStatusSummary = class {
|
|
46286
|
-
constructor(
|
|
46287
|
-
this.path =
|
|
46289
|
+
constructor(path22, index, working_dir) {
|
|
46290
|
+
this.path = path22;
|
|
46288
46291
|
this.index = index;
|
|
46289
46292
|
this.working_dir = working_dir;
|
|
46290
46293
|
if (index === "R" || working_dir === "R") {
|
|
46291
|
-
const detail = fromPathRegex.exec(
|
|
46294
|
+
const detail = fromPathRegex.exec(path22) || [null, path22, path22];
|
|
46292
46295
|
this.from = detail[2] || "";
|
|
46293
46296
|
this.path = detail[1] || "";
|
|
46294
46297
|
}
|
|
@@ -46319,14 +46322,14 @@ function splitLine(result, lineStr) {
|
|
|
46319
46322
|
default:
|
|
46320
46323
|
return;
|
|
46321
46324
|
}
|
|
46322
|
-
function data2(index, workingDir,
|
|
46325
|
+
function data2(index, workingDir, path22) {
|
|
46323
46326
|
const raw = `${index}${workingDir}`;
|
|
46324
46327
|
const handler = parsers6.get(raw);
|
|
46325
46328
|
if (handler) {
|
|
46326
|
-
handler(result,
|
|
46329
|
+
handler(result, path22);
|
|
46327
46330
|
}
|
|
46328
46331
|
if (raw !== "##" && raw !== "!!") {
|
|
46329
|
-
result.files.push(new FileStatusSummary(
|
|
46332
|
+
result.files.push(new FileStatusSummary(path22, index, workingDir));
|
|
46330
46333
|
}
|
|
46331
46334
|
}
|
|
46332
46335
|
}
|
|
@@ -46677,9 +46680,9 @@ var init_simple_git_api = __esm2({
|
|
|
46677
46680
|
next
|
|
46678
46681
|
);
|
|
46679
46682
|
}
|
|
46680
|
-
hashObject(
|
|
46683
|
+
hashObject(path22, write) {
|
|
46681
46684
|
return this._runTask(
|
|
46682
|
-
hashObjectTask(
|
|
46685
|
+
hashObjectTask(path22, write === true),
|
|
46683
46686
|
trailingFunctionArgument(arguments)
|
|
46684
46687
|
);
|
|
46685
46688
|
}
|
|
@@ -47033,8 +47036,8 @@ var init_branch = __esm2({
|
|
|
47033
47036
|
}
|
|
47034
47037
|
});
|
|
47035
47038
|
function toPath(input) {
|
|
47036
|
-
const
|
|
47037
|
-
return
|
|
47039
|
+
const path22 = input.trim().replace(/^["']|["']$/g, "");
|
|
47040
|
+
return path22 && normalize(path22);
|
|
47038
47041
|
}
|
|
47039
47042
|
var parseCheckIgnore;
|
|
47040
47043
|
var init_CheckIgnore = __esm2({
|
|
@@ -47319,8 +47322,8 @@ __export2(sub_module_exports, {
|
|
|
47319
47322
|
subModuleTask: () => subModuleTask,
|
|
47320
47323
|
updateSubModuleTask: () => updateSubModuleTask
|
|
47321
47324
|
});
|
|
47322
|
-
function addSubModuleTask(repo,
|
|
47323
|
-
return subModuleTask(["add", repo,
|
|
47325
|
+
function addSubModuleTask(repo, path22) {
|
|
47326
|
+
return subModuleTask(["add", repo, path22]);
|
|
47324
47327
|
}
|
|
47325
47328
|
function initSubModuleTask(customArgs) {
|
|
47326
47329
|
return subModuleTask(["init", ...customArgs]);
|
|
@@ -47634,8 +47637,8 @@ var require_git = __commonJS2({
|
|
|
47634
47637
|
}
|
|
47635
47638
|
return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
|
|
47636
47639
|
};
|
|
47637
|
-
Git2.prototype.submoduleAdd = function(repo,
|
|
47638
|
-
return this._runTask(addSubModuleTask2(repo,
|
|
47640
|
+
Git2.prototype.submoduleAdd = function(repo, path22, then) {
|
|
47641
|
+
return this._runTask(addSubModuleTask2(repo, path22), trailingFunctionArgument2(arguments));
|
|
47639
47642
|
};
|
|
47640
47643
|
Git2.prototype.submoduleUpdate = function(args, then) {
|
|
47641
47644
|
return this._runTask(
|
|
@@ -48243,6 +48246,10 @@ var DebugLogger = class {
|
|
|
48243
48246
|
throw new Error(errorMsg);
|
|
48244
48247
|
}
|
|
48245
48248
|
}
|
|
48249
|
+
/**
|
|
48250
|
+
* Keyed by label alone, so two overlapping timers with one label overwrite each other;
|
|
48251
|
+
* anything that can run concurrently uses {@link timed}.
|
|
48252
|
+
*/
|
|
48246
48253
|
time(label) {
|
|
48247
48254
|
this.timers.set(label, Date.now());
|
|
48248
48255
|
}
|
|
@@ -48257,12 +48264,16 @@ var DebugLogger = class {
|
|
|
48257
48264
|
this.debug(category, `${label} completed`, { durationMs: duration });
|
|
48258
48265
|
return duration;
|
|
48259
48266
|
}
|
|
48267
|
+
/**
|
|
48268
|
+
* Log `<label> completed {durationMs}` once `fn` settles. The start time is local to the
|
|
48269
|
+
* call, so concurrent spans with the same label on one logger never overwrite each other.
|
|
48270
|
+
*/
|
|
48260
48271
|
async timed(category, label, fn) {
|
|
48261
|
-
|
|
48272
|
+
const start = Date.now();
|
|
48262
48273
|
try {
|
|
48263
48274
|
return await fn();
|
|
48264
48275
|
} finally {
|
|
48265
|
-
this.
|
|
48276
|
+
this.debug(category, `${label} completed`, { durationMs: Date.now() - start });
|
|
48266
48277
|
}
|
|
48267
48278
|
}
|
|
48268
48279
|
};
|
|
@@ -48643,6 +48654,27 @@ function isFileExistsError(err) {
|
|
|
48643
48654
|
|
|
48644
48655
|
// ../canopycms/src/github-service.ts
|
|
48645
48656
|
init_logger();
|
|
48657
|
+
|
|
48658
|
+
// ../canopycms/src/submission-attribution.ts
|
|
48659
|
+
init_logger();
|
|
48660
|
+
var PR_SECTION_START = "<!-- canopycms:submission:start -->";
|
|
48661
|
+
var PR_SECTION_END = "<!-- canopycms:submission:end -->";
|
|
48662
|
+
function mergePrSection(existing, section) {
|
|
48663
|
+
const body = existing ?? "";
|
|
48664
|
+
for (let end = body.indexOf(PR_SECTION_END); end >= 0; ) {
|
|
48665
|
+
const start = body.lastIndexOf(PR_SECTION_START, end - PR_SECTION_START.length);
|
|
48666
|
+
if (start >= 0) {
|
|
48667
|
+
return body.slice(0, start) + section + body.slice(end + PR_SECTION_END.length);
|
|
48668
|
+
}
|
|
48669
|
+
end = body.indexOf(PR_SECTION_END, end + PR_SECTION_END.length);
|
|
48670
|
+
}
|
|
48671
|
+
const human = body.split(PR_SECTION_START).join("").split(PR_SECTION_END).join("").trimEnd();
|
|
48672
|
+
return human ? `${human}
|
|
48673
|
+
|
|
48674
|
+
${section}` : section;
|
|
48675
|
+
}
|
|
48676
|
+
|
|
48677
|
+
// ../canopycms/src/github-service.ts
|
|
48646
48678
|
var ThrottledOctokit = import_rest.Octokit.plugin(import_plugin_throttling.throttling);
|
|
48647
48679
|
var shouldRetryRateLimit = (retryAfter, retryCount) => retryCount < 2 && retryAfter <= 60;
|
|
48648
48680
|
var shouldRetrySecondaryRateLimit = (retryAfter, retryCount) => retryCount < 1 && retryAfter <= 60;
|
|
@@ -48668,6 +48700,7 @@ function createCanopyOctokit(options) {
|
|
|
48668
48700
|
}
|
|
48669
48701
|
async function createOrUpdatePullRequest(params) {
|
|
48670
48702
|
const { octokit, owner, repo, head, base, title, body, markReadyIfDraft, signal } = params;
|
|
48703
|
+
const mergeSection = params.mergeSectionIntoBody === true;
|
|
48671
48704
|
const requestOption = signal ? { request: { signal } } : {};
|
|
48672
48705
|
const existingPRs = await octokit.pulls.list({
|
|
48673
48706
|
owner,
|
|
@@ -48692,7 +48725,7 @@ async function createOrUpdatePullRequest(params) {
|
|
|
48692
48725
|
repo,
|
|
48693
48726
|
pull_number: existing.number,
|
|
48694
48727
|
title,
|
|
48695
|
-
body,
|
|
48728
|
+
body: mergeSection ? mergePrSection(existing.body, body) : body,
|
|
48696
48729
|
...requestOption
|
|
48697
48730
|
});
|
|
48698
48731
|
if (markReadyIfDraft && existing.draft) {
|
|
@@ -48925,7 +48958,7 @@ function installWorkerLogger() {
|
|
|
48925
48958
|
}
|
|
48926
48959
|
|
|
48927
48960
|
// ../canopycms/src/worker/task-runner.ts
|
|
48928
|
-
import
|
|
48961
|
+
import fs11 from "node:fs/promises";
|
|
48929
48962
|
|
|
48930
48963
|
// ../canopycms/src/branch-metadata.ts
|
|
48931
48964
|
import fs7 from "node:fs/promises";
|
|
@@ -49493,6 +49526,10 @@ var getBranchMetadataFileManager = (branchRoot, baseRoot, options) => {
|
|
|
49493
49526
|
return BranchMetadataFileManager.get(branchRoot, baseRoot, options);
|
|
49494
49527
|
};
|
|
49495
49528
|
|
|
49529
|
+
// ../canopycms/src/git-manager.ts
|
|
49530
|
+
import fs10 from "node:fs/promises";
|
|
49531
|
+
import path13 from "node:path";
|
|
49532
|
+
|
|
49496
49533
|
// ../canopycms/src/content-index-registry.ts
|
|
49497
49534
|
import path10 from "node:path";
|
|
49498
49535
|
var registry = /* @__PURE__ */ new Map();
|
|
@@ -49588,19 +49625,10 @@ var STATIC_DEPLOY_USER = Object.freeze({
|
|
|
49588
49625
|
name: "Static Deploy"
|
|
49589
49626
|
});
|
|
49590
49627
|
|
|
49591
|
-
// ../canopycms/src/
|
|
49592
|
-
|
|
49593
|
-
|
|
49594
|
-
|
|
49595
|
-
var RESOURCE2 = "content-index";
|
|
49596
|
-
async function bumpContentIndexGeneration(root) {
|
|
49597
|
-
return bumpResourceGeneration(root, RESOURCE2);
|
|
49598
|
-
}
|
|
49599
|
-
async function invalidateBranchContentCaches(root) {
|
|
49600
|
-
await bumpContentIndexGeneration(root);
|
|
49601
|
-
await bumpResourceGeneration(root, SCHEMA_GENERATION_RESOURCE);
|
|
49602
|
-
invalidateContentIndexesForRoot(root);
|
|
49603
|
-
}
|
|
49628
|
+
// ../canopycms/src/utils/request-timing.ts
|
|
49629
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
49630
|
+
var storage = new AsyncLocalStorage();
|
|
49631
|
+
var log4 = createDebugLogger({ prefix: "CanopyCMS" });
|
|
49604
49632
|
|
|
49605
49633
|
// ../canopycms/src/utils/git.ts
|
|
49606
49634
|
import fs8 from "node:fs/promises";
|
|
@@ -49616,6 +49644,10 @@ var STALE_LEASE_REASON = "stale info";
|
|
|
49616
49644
|
function isStaleLeaseRejection(message) {
|
|
49617
49645
|
return message.includes(REJECTED_MARKER) && message.includes(STALE_LEASE_REASON);
|
|
49618
49646
|
}
|
|
49647
|
+
var WORKFLOW_REFUSAL_PATTERN = /refusing to allow an? [^`\n]+? to create or update workflow `([^`\n]+)`/;
|
|
49648
|
+
function workflowPushRefusalFile(message) {
|
|
49649
|
+
return WORKFLOW_REFUSAL_PATTERN.exec(message)?.[1] ?? null;
|
|
49650
|
+
}
|
|
49619
49651
|
async function resolveGitDir(repoPath) {
|
|
49620
49652
|
const dotGit = path11.join(repoPath, ".git");
|
|
49621
49653
|
let stat;
|
|
@@ -49635,6 +49667,10 @@ async function resolveGitDir(repoPath) {
|
|
|
49635
49667
|
return null;
|
|
49636
49668
|
}
|
|
49637
49669
|
}
|
|
49670
|
+
var CANOPY_META_DIR = ".canopy-meta";
|
|
49671
|
+
function isCanopyInternalPath(repoRelativePath) {
|
|
49672
|
+
return repoRelativePath === CANOPY_META_DIR || repoRelativePath.startsWith(`${CANOPY_META_DIR}/`);
|
|
49673
|
+
}
|
|
49638
49674
|
async function isRebaseInProgress(repoPath) {
|
|
49639
49675
|
const gitDir = await resolveGitDir(repoPath);
|
|
49640
49676
|
if (!gitDir) return false;
|
|
@@ -49646,17 +49682,35 @@ async function isRebaseInProgress(repoPath) {
|
|
|
49646
49682
|
return results.some(Boolean);
|
|
49647
49683
|
}
|
|
49648
49684
|
|
|
49685
|
+
// ../canopycms/src/branch-schema-cache.ts
|
|
49686
|
+
var SCHEMA_CACHE_FILE = "schema-cache.json";
|
|
49687
|
+
var SCHEMA_GENERATION_RESOURCE = "schema";
|
|
49688
|
+
|
|
49689
|
+
// ../canopycms/src/content-index-generation.ts
|
|
49690
|
+
var RESOURCE2 = "content-index";
|
|
49691
|
+
async function bumpContentIndexGeneration(root) {
|
|
49692
|
+
return bumpResourceGeneration(root, RESOURCE2);
|
|
49693
|
+
}
|
|
49694
|
+
async function invalidateBranchContentCaches(root) {
|
|
49695
|
+
await bumpContentIndexGeneration(root);
|
|
49696
|
+
await bumpResourceGeneration(root, SCHEMA_GENERATION_RESOURCE);
|
|
49697
|
+
invalidateContentIndexesForRoot(root);
|
|
49698
|
+
}
|
|
49699
|
+
|
|
49649
49700
|
// ../canopycms/src/utils/provisioning-lock.ts
|
|
49650
49701
|
var import_proper_lockfile2 = __toESM(require_proper_lockfile(), 1);
|
|
49651
49702
|
import fs9 from "node:fs/promises";
|
|
49652
49703
|
import path12 from "node:path";
|
|
49653
49704
|
init_logger();
|
|
49654
|
-
|
|
49705
|
+
var PROVISIONING_LOCK_STALE_MS = 9e4;
|
|
49706
|
+
function provisioningLockOptions(lockPath, retries, onCompromised, staleMs) {
|
|
49655
49707
|
return {
|
|
49656
49708
|
lockfilePath: lockPath,
|
|
49657
49709
|
realpath: false,
|
|
49658
49710
|
retries,
|
|
49659
|
-
stale:
|
|
49711
|
+
stale: staleMs,
|
|
49712
|
+
// Fixed, not stale/2: every holder refreshes at 15s whatever threshold it judges others by.
|
|
49713
|
+
update: 15e3,
|
|
49660
49714
|
// proper-lockfile invokes this from inside its refresh timer, so ANY throw escaping here is
|
|
49661
49715
|
// an uncaught exception that kills the process. Call sites are told not to throw (see
|
|
49662
49716
|
// OnLockCompromised); this makes it structural rather than a convention, and also covers the
|
|
@@ -49699,15 +49753,21 @@ function releaseIgnoringAlreadyReleased(release, lockPath) {
|
|
|
49699
49753
|
}
|
|
49700
49754
|
};
|
|
49701
49755
|
}
|
|
49702
|
-
|
|
49756
|
+
function branchProvisioningLockName(dirName) {
|
|
49757
|
+
return `.${dirName}.init.lock`;
|
|
49758
|
+
}
|
|
49759
|
+
async function tryAcquireProvisioningLock(lockTargetDir2, lockName, onCompromised, staleMs = PROVISIONING_LOCK_STALE_MS) {
|
|
49703
49760
|
await fs9.mkdir(lockTargetDir2, { recursive: true });
|
|
49704
49761
|
const lockPath = path12.join(lockTargetDir2, lockName);
|
|
49705
|
-
const release = await import_proper_lockfile2.default.lock(
|
|
49762
|
+
const release = await import_proper_lockfile2.default.lock(
|
|
49763
|
+
lockPath,
|
|
49764
|
+
provisioningLockOptions(lockPath, 0, onCompromised, staleMs)
|
|
49765
|
+
);
|
|
49706
49766
|
return releaseIgnoringAlreadyReleased(release, lockPath);
|
|
49707
49767
|
}
|
|
49708
49768
|
|
|
49709
49769
|
// ../canopycms/src/git-manager.ts
|
|
49710
|
-
var
|
|
49770
|
+
var log5 = createDebugLogger({ prefix: "GitManager" });
|
|
49711
49771
|
var GIT_ENV_PASSTHROUGH = /^(PATH|HOME|USER|LANG|LC_[A-Z]+|TZ|TMPDIR|GIT_(AUTHOR|COMMITTER)_(NAME|EMAIL|DATE)|GIT_TERMINAL_PROMPT|GIT_TRACE[0-9A-Z_]*)$/;
|
|
49712
49772
|
var FORCE_C_LOCALE = { LC_ALL: "C", LANG: "C" };
|
|
49713
49773
|
function gitChildEnv(overrides) {
|
|
@@ -49727,9 +49787,28 @@ function gitNetworkChildEnv() {
|
|
|
49727
49787
|
return { ...env, ...FORCE_C_LOCALE };
|
|
49728
49788
|
}
|
|
49729
49789
|
var GITHUB_TRACKING_REF_PREFIX = "refs/remotes/github/";
|
|
49790
|
+
async function ensureGitExcludePattern(repoPath, pattern) {
|
|
49791
|
+
const excludePath = path13.join(repoPath, ".git", "info", "exclude");
|
|
49792
|
+
await fs10.mkdir(path13.dirname(excludePath), { recursive: true });
|
|
49793
|
+
let content = "";
|
|
49794
|
+
try {
|
|
49795
|
+
content = await fs10.readFile(excludePath, "utf-8");
|
|
49796
|
+
} catch (err) {
|
|
49797
|
+
if (!isNotFoundError2(err)) throw err;
|
|
49798
|
+
}
|
|
49799
|
+
const lines = content.split("\n");
|
|
49800
|
+
if (lines.some((line) => line.trim() === pattern)) {
|
|
49801
|
+
log5.debug("git", "Pattern already in .git/info/exclude", { pattern });
|
|
49802
|
+
return;
|
|
49803
|
+
}
|
|
49804
|
+
const needsLeadingNewline = content.length > 0 && !content.endsWith("\n");
|
|
49805
|
+
const newContent = content + (needsLeadingNewline ? "\n" : "") + pattern + "\n";
|
|
49806
|
+
await fs10.writeFile(excludePath, newContent, "utf-8");
|
|
49807
|
+
log5.debug("git", "Added pattern to .git/info/exclude", { pattern });
|
|
49808
|
+
}
|
|
49730
49809
|
|
|
49731
49810
|
// ../canopycms/src/worker/history-rewrite.ts
|
|
49732
|
-
import
|
|
49811
|
+
import path14 from "node:path";
|
|
49733
49812
|
async function readPublishedSha(ctx, branchRef) {
|
|
49734
49813
|
try {
|
|
49735
49814
|
const out = await simpleGit().raw([
|
|
@@ -49823,7 +49902,7 @@ async function reconcilePendingRewrite(ctx, options) {
|
|
|
49823
49902
|
}
|
|
49824
49903
|
async function hasPendingHistoryRewrite(ctx, branchName) {
|
|
49825
49904
|
try {
|
|
49826
|
-
const branchPath =
|
|
49905
|
+
const branchPath = path14.join(ctx.contentBranchesPath, sanitizeBranchName(branchName));
|
|
49827
49906
|
const metaFile = await BranchMetadataFileManager.loadOnly(branchPath);
|
|
49828
49907
|
return typeof metaFile?.branch.historyRewrittenFrom === "string";
|
|
49829
49908
|
} catch {
|
|
@@ -49866,6 +49945,9 @@ function isRateLimitSignal403(err) {
|
|
|
49866
49945
|
if (err instanceof Error && /rate limit/i.test(err.message)) return true;
|
|
49867
49946
|
return false;
|
|
49868
49947
|
}
|
|
49948
|
+
function isSettingsBranch(branch) {
|
|
49949
|
+
return branch.startsWith(RESERVED_SETTINGS_BRANCH_PREFIX);
|
|
49950
|
+
}
|
|
49869
49951
|
function requireString(payload2, key) {
|
|
49870
49952
|
const val = payload2[key];
|
|
49871
49953
|
if (typeof val !== "string")
|
|
@@ -49992,6 +50074,11 @@ async function executeTask(ctx, task, signal) {
|
|
|
49992
50074
|
`Refusing to push-and-create-or-update-pr for "${branch}": it is the base branch -- submitting the base branch is never valid`
|
|
49993
50075
|
);
|
|
49994
50076
|
}
|
|
50077
|
+
if (isSettingsBranch(branch)) {
|
|
50078
|
+
await ctx.pushBranchToGitHub(branch);
|
|
50079
|
+
workerLog(`Pushed settings branch ${branch}; settings branches never get a PR`);
|
|
50080
|
+
return { pushed: true };
|
|
50081
|
+
}
|
|
49995
50082
|
await ctx.pushBranchToGitHub(branch);
|
|
49996
50083
|
const result = await createOrUpdatePullRequest({
|
|
49997
50084
|
octokit: ctx.octokit(),
|
|
@@ -50001,9 +50088,9 @@ async function executeTask(ctx, task, signal) {
|
|
|
50001
50088
|
base,
|
|
50002
50089
|
title: optionalString(payload2, "title", `Submit ${branch}`),
|
|
50003
50090
|
body: optionalString(payload2, "body", ""),
|
|
50004
|
-
// Content submits (api/github-sync.ts) set
|
|
50005
|
-
// syncs (services.ts) deliberately don't.
|
|
50091
|
+
// Content submits (api/github-sync.ts) set both.
|
|
50006
50092
|
markReadyIfDraft: payload2.markReadyIfDraft === true,
|
|
50093
|
+
mergeSectionIntoBody: payload2.mergeSectionIntoBody === true,
|
|
50007
50094
|
signal
|
|
50008
50095
|
});
|
|
50009
50096
|
workerLog(
|
|
@@ -50056,7 +50143,7 @@ async function updateBranchMetadata(ctx, task, result) {
|
|
|
50056
50143
|
if (!branch) return;
|
|
50057
50144
|
const branchPath = ctx.branchWorkspacePath(branch);
|
|
50058
50145
|
try {
|
|
50059
|
-
await
|
|
50146
|
+
await fs11.stat(branchPath);
|
|
50060
50147
|
} catch {
|
|
50061
50148
|
return;
|
|
50062
50149
|
}
|
|
@@ -50092,7 +50179,7 @@ async function updateBranchMetadataOnFailure(ctx, task, error2) {
|
|
|
50092
50179
|
if (!branch) return;
|
|
50093
50180
|
const branchPath = ctx.branchWorkspacePath(branch);
|
|
50094
50181
|
try {
|
|
50095
|
-
await
|
|
50182
|
+
await fs11.stat(branchPath);
|
|
50096
50183
|
} catch {
|
|
50097
50184
|
return;
|
|
50098
50185
|
}
|
|
@@ -50108,6 +50195,13 @@ async function updateBranchMetadataOnFailure(ctx, task, error2) {
|
|
|
50108
50195
|
);
|
|
50109
50196
|
}
|
|
50110
50197
|
}
|
|
50198
|
+
function throwIfWorkflowRefusal(branch, message) {
|
|
50199
|
+
const file = workflowPushRefusalFile(message);
|
|
50200
|
+
if (file === null) return;
|
|
50201
|
+
throw new PermanentTaskError(
|
|
50202
|
+
`Push refused for branch "${branch}": it would put a version of ${file} on GitHub that GitHub does not already have, and this deployment's GitHub credential is deliberately not allowed to change workflow files. Such a change usually comes from outside the editor, such as a direct push to this branch. Nothing was pushed, and retrying will not help until a developer with permission to change workflow files resolves it on GitHub.`
|
|
50203
|
+
);
|
|
50204
|
+
}
|
|
50111
50205
|
async function pushBranchToGitHub(ctx, branch) {
|
|
50112
50206
|
const git = simpleGit({
|
|
50113
50207
|
baseDir: ctx.remoteGitPath,
|
|
@@ -50136,11 +50230,13 @@ async function pushBranchToGitHub(ctx, branch) {
|
|
|
50136
50230
|
}
|
|
50137
50231
|
} catch (err) {
|
|
50138
50232
|
const message = getErrorMessage2(err);
|
|
50233
|
+
throwIfWorkflowRefusal(branch, message);
|
|
50139
50234
|
if (marker && isStaleLeaseRejection(message)) {
|
|
50140
50235
|
try {
|
|
50141
50236
|
await git.push(githubUrl, branch);
|
|
50142
50237
|
} catch (retryErr) {
|
|
50143
50238
|
const retryMessage = getErrorMessage2(retryErr);
|
|
50239
|
+
throwIfWorkflowRefusal(branch, retryMessage);
|
|
50144
50240
|
if (isNonFastForwardRejection(retryMessage)) {
|
|
50145
50241
|
throw new PermanentTaskError(
|
|
50146
50242
|
`Push rejected for branch "${branch}": GitHub's tip is neither the commit this deployment last published nor an ancestor of what it is pushing, so the branch has genuinely diverged and nothing was overwritten. Something else moved it on GitHub -- a direct push, or another CanopyCMS deployment sharing this repository.`
|
|
@@ -50166,27 +50262,110 @@ async function pushBranchToGitHub(ctx, branch) {
|
|
|
50166
50262
|
}
|
|
50167
50263
|
|
|
50168
50264
|
// ../canopycms/src/worker/rebase.ts
|
|
50169
|
-
import
|
|
50170
|
-
import
|
|
50265
|
+
import fs13 from "node:fs/promises";
|
|
50266
|
+
import path17 from "node:path";
|
|
50171
50267
|
init_normalize();
|
|
50172
50268
|
init_types3();
|
|
50173
50269
|
|
|
50174
50270
|
// ../canopycms/src/utils/content-write-lock.ts
|
|
50175
|
-
import
|
|
50271
|
+
import path15 from "node:path";
|
|
50176
50272
|
init_logger();
|
|
50177
50273
|
var META_DIR2 = ".canopy-meta";
|
|
50178
50274
|
var CONTENT_WRITE_LOCK_NAME = "content-write.lock";
|
|
50179
50275
|
function lockTargetDir(branchRoot) {
|
|
50180
|
-
return
|
|
50276
|
+
return path15.join(path15.resolve(branchRoot), META_DIR2);
|
|
50181
50277
|
}
|
|
50278
|
+
var CONTENT_WRITE_LOCK_STALE_MS = 3e4;
|
|
50182
50279
|
function tryAcquireContentWriteLock(branchRoot, onCompromised) {
|
|
50183
50280
|
return tryAcquireProvisioningLock(
|
|
50184
50281
|
lockTargetDir(branchRoot),
|
|
50185
50282
|
CONTENT_WRITE_LOCK_NAME,
|
|
50186
|
-
onCompromised
|
|
50283
|
+
onCompromised,
|
|
50284
|
+
CONTENT_WRITE_LOCK_STALE_MS
|
|
50187
50285
|
);
|
|
50188
50286
|
}
|
|
50189
50287
|
|
|
50288
|
+
// ../canopycms/src/worker/provisioned-workspace.ts
|
|
50289
|
+
import fs12 from "node:fs/promises";
|
|
50290
|
+
import path16 from "node:path";
|
|
50291
|
+
async function holdProvisionedWorkspace(contentBranchesPath, dirName) {
|
|
50292
|
+
let release;
|
|
50293
|
+
let compromised = false;
|
|
50294
|
+
try {
|
|
50295
|
+
release = await tryAcquireProvisioningLock(
|
|
50296
|
+
contentBranchesPath,
|
|
50297
|
+
branchProvisioningLockName(dirName),
|
|
50298
|
+
(err) => {
|
|
50299
|
+
compromised = true;
|
|
50300
|
+
workerLogWarn(
|
|
50301
|
+
` Provisioning lock for ${dirName} was compromised mid-hold: ${getErrorMessage2(err)}`
|
|
50302
|
+
);
|
|
50303
|
+
}
|
|
50304
|
+
);
|
|
50305
|
+
} catch (err) {
|
|
50306
|
+
if (isNodeError(err) && err.code === "ELOCKED") return { kind: "locked" };
|
|
50307
|
+
throw err;
|
|
50308
|
+
}
|
|
50309
|
+
const root = path16.join(contentBranchesPath, dirName);
|
|
50310
|
+
const [gitIsDir, hasMetadata] = await Promise.all([
|
|
50311
|
+
fs12.stat(path16.join(root, ".git")).then(
|
|
50312
|
+
(stat) => stat.isDirectory(),
|
|
50313
|
+
() => false
|
|
50314
|
+
),
|
|
50315
|
+
fs12.stat(path16.join(root, BRANCH_META_DIR, BRANCH_META_FILE)).then(
|
|
50316
|
+
() => true,
|
|
50317
|
+
() => false
|
|
50318
|
+
)
|
|
50319
|
+
]);
|
|
50320
|
+
if (gitIsDir && hasMetadata) return { kind: "held", release, isCompromised: () => compromised };
|
|
50321
|
+
await releaseProvisionedWorkspace(release, dirName);
|
|
50322
|
+
return { kind: "not-provisioned" };
|
|
50323
|
+
}
|
|
50324
|
+
async function releaseProvisionedWorkspace(release, dirName) {
|
|
50325
|
+
await release().catch((err) => {
|
|
50326
|
+
workerLogWarn(
|
|
50327
|
+
` Failed to release the provisioning lock for ${dirName}: ${getErrorMessage2(err)}`
|
|
50328
|
+
);
|
|
50329
|
+
});
|
|
50330
|
+
}
|
|
50331
|
+
|
|
50332
|
+
// ../canopycms/src/worker/canopy-state.ts
|
|
50333
|
+
var TRACKED_CANOPY_STATE_FIX = "run `git rm -r --cached .canopy-meta` in the site repo, add `.canopy-meta/` to its .gitignore, and commit";
|
|
50334
|
+
var MAX_REPORTED_PATHS = 10;
|
|
50335
|
+
var RETIRED_SCHEMA_CACHE_PATH = `${CANOPY_META_DIR}/${SCHEMA_CACHE_FILE}`;
|
|
50336
|
+
function isUntracked(file) {
|
|
50337
|
+
return file.index === "?" && file.working_dir === "?";
|
|
50338
|
+
}
|
|
50339
|
+
function splitNul(out) {
|
|
50340
|
+
return out.split("\0").filter((entry) => entry.length > 0);
|
|
50341
|
+
}
|
|
50342
|
+
async function listTrackedCanopyState(git) {
|
|
50343
|
+
return splitNul(await git.raw(["ls-files", "-z", "--", CANOPY_META_DIR]));
|
|
50344
|
+
}
|
|
50345
|
+
async function restoreRetiredSchemaCache(git, status) {
|
|
50346
|
+
const entry = status.files.find((f5) => f5.path === RETIRED_SCHEMA_CACHE_PATH);
|
|
50347
|
+
if (!entry || entry.index === "?" || entry.index === "A") return false;
|
|
50348
|
+
await git.raw(["checkout", "HEAD", "--", RETIRED_SCHEMA_CACHE_PATH]);
|
|
50349
|
+
return true;
|
|
50350
|
+
}
|
|
50351
|
+
function trackedCanopyStateChanges(status) {
|
|
50352
|
+
return status.files.filter((f5) => isCanopyInternalPath(f5.path) && !isUntracked(f5)).map((f5) => f5.path);
|
|
50353
|
+
}
|
|
50354
|
+
async function splitByUpstreamTracking(git, paths, tip) {
|
|
50355
|
+
if (paths.length === 0) return { droppedUpstream: [], stillTracked: [] };
|
|
50356
|
+
const tracked = new Set(
|
|
50357
|
+
splitNul(await git.raw(["ls-tree", "-r", "-z", "--name-only", tip, "--", CANOPY_META_DIR]))
|
|
50358
|
+
);
|
|
50359
|
+
return {
|
|
50360
|
+
droppedUpstream: paths.filter((p6) => !tracked.has(p6)),
|
|
50361
|
+
stillTracked: paths.filter((p6) => tracked.has(p6))
|
|
50362
|
+
};
|
|
50363
|
+
}
|
|
50364
|
+
async function untrackInIndex(git, paths) {
|
|
50365
|
+
if (paths.length === 0) return;
|
|
50366
|
+
await git.raw(["rm", "--cached", "--ignore-unmatch", "-q", "--", ...paths]);
|
|
50367
|
+
}
|
|
50368
|
+
|
|
50190
50369
|
// ../canopycms/src/worker/rebase.ts
|
|
50191
50370
|
async function pollMergeState(ctx, branchDir, branchPath, metaFile) {
|
|
50192
50371
|
const prNumber = metaFile?.branch.pullRequestNumber;
|
|
@@ -50314,13 +50493,13 @@ async function runRebaseRounds(ctx, branchGit, branchDir, fetchedBaseTip, isLock
|
|
|
50314
50493
|
function conflictFilesToContentIds(conflictedFiles, contentRoot) {
|
|
50315
50494
|
const normalizedContentRoot = normalizeFilesystemPath(contentRoot);
|
|
50316
50495
|
const conflictIds = [...new Set(conflictedFiles)].map((f5) => {
|
|
50317
|
-
const fileId = extractIdFromFilename(
|
|
50496
|
+
const fileId = extractIdFromFilename(path17.basename(f5));
|
|
50318
50497
|
if (fileId) return fileId;
|
|
50319
|
-
const parentDir =
|
|
50498
|
+
const parentDir = path17.basename(path17.dirname(f5));
|
|
50320
50499
|
const dirId = extractIdFromFilename(parentDir);
|
|
50321
50500
|
if (dirId) return dirId;
|
|
50322
|
-
const parentPath = normalizeFilesystemPath(
|
|
50323
|
-
if (
|
|
50501
|
+
const parentPath = normalizeFilesystemPath(path17.dirname(f5));
|
|
50502
|
+
if (path17.basename(f5) === ".collection.json" && parentPath === normalizedContentRoot) {
|
|
50324
50503
|
return ROOT_COLLECTION_ID;
|
|
50325
50504
|
}
|
|
50326
50505
|
return null;
|
|
@@ -50349,7 +50528,7 @@ async function runRebaseCycle(ctx) {
|
|
|
50349
50528
|
const failed = [];
|
|
50350
50529
|
let branchDirs;
|
|
50351
50530
|
try {
|
|
50352
|
-
branchDirs = await
|
|
50531
|
+
branchDirs = await fs13.readdir(ctx.contentBranchesPath);
|
|
50353
50532
|
} catch {
|
|
50354
50533
|
return { rebased, skippedDirty, skippedLocked, failed };
|
|
50355
50534
|
}
|
|
@@ -50357,10 +50536,10 @@ async function runRebaseCycle(ctx) {
|
|
|
50357
50536
|
if (branchDir.startsWith(".") || branchDir === "branches.json") {
|
|
50358
50537
|
continue;
|
|
50359
50538
|
}
|
|
50360
|
-
const branchPath =
|
|
50361
|
-
const gitDir =
|
|
50539
|
+
const branchPath = path17.join(ctx.contentBranchesPath, branchDir);
|
|
50540
|
+
const gitDir = path17.join(branchPath, ".git");
|
|
50362
50541
|
try {
|
|
50363
|
-
const stat = await
|
|
50542
|
+
const stat = await fs13.stat(gitDir);
|
|
50364
50543
|
if (!stat.isDirectory()) {
|
|
50365
50544
|
workerLog(` Skipping ${branchDir}: .git is not a directory`);
|
|
50366
50545
|
continue;
|
|
@@ -50373,7 +50552,7 @@ async function runRebaseCycle(ctx) {
|
|
|
50373
50552
|
workerLog(` Skipping ${branchDir}: base branch (refreshed separately)`);
|
|
50374
50553
|
continue;
|
|
50375
50554
|
}
|
|
50376
|
-
const outcome = await
|
|
50555
|
+
const outcome = await holdAndRebaseOneBranch(ctx, branchDir, branchPath);
|
|
50377
50556
|
if (outcome.kind === "rebased") rebased.push(branchDir);
|
|
50378
50557
|
else if (outcome.kind === "skippedDirty") skippedDirty.push(branchDir);
|
|
50379
50558
|
else if (outcome.kind === "skippedLocked") skippedLocked.push(branchDir);
|
|
@@ -50384,7 +50563,30 @@ async function runRebaseCycle(ctx) {
|
|
|
50384
50563
|
}
|
|
50385
50564
|
return { rebased, skippedDirty, skippedLocked, failed };
|
|
50386
50565
|
}
|
|
50387
|
-
async function
|
|
50566
|
+
async function holdAndRebaseOneBranch(ctx, branchDir, branchPath) {
|
|
50567
|
+
let hold;
|
|
50568
|
+
try {
|
|
50569
|
+
hold = await holdProvisionedWorkspace(ctx.contentBranchesPath, branchDir);
|
|
50570
|
+
} catch (err) {
|
|
50571
|
+
const error2 = redactCredentials(`could not take the provisioning lock: ${getErrorMessage2(err)}`);
|
|
50572
|
+
workerLogWarn(` Skipping ${branchDir}: ${error2}`);
|
|
50573
|
+
return { kind: "failed", error: error2 };
|
|
50574
|
+
}
|
|
50575
|
+
if (hold.kind === "locked") {
|
|
50576
|
+
workerLog(` Skipping ${branchDir}: provisioning lock held elsewhere (retrying next cycle)`);
|
|
50577
|
+
return { kind: "skippedLocked" };
|
|
50578
|
+
}
|
|
50579
|
+
if (hold.kind === "not-provisioned") {
|
|
50580
|
+
workerLog(` Skipping ${branchDir}: not yet provisioned (no branch.json)`);
|
|
50581
|
+
return { kind: "none" };
|
|
50582
|
+
}
|
|
50583
|
+
try {
|
|
50584
|
+
return await rebaseOneBranch(ctx, branchDir, branchPath, hold.isCompromised);
|
|
50585
|
+
} finally {
|
|
50586
|
+
await releaseProvisionedWorkspace(hold.release, branchDir);
|
|
50587
|
+
}
|
|
50588
|
+
}
|
|
50589
|
+
async function rebaseOneBranch(ctx, branchDir, branchPath, isProvisioningLockCompromised) {
|
|
50388
50590
|
let didRebase = false;
|
|
50389
50591
|
try {
|
|
50390
50592
|
const metaFile = await BranchMetadataFileManager.loadOnly(branchPath);
|
|
@@ -50409,6 +50611,7 @@ async function rebaseOneBranch(ctx, branchDir, branchPath) {
|
|
|
50409
50611
|
});
|
|
50410
50612
|
let releaseContentLock;
|
|
50411
50613
|
let contentLockCompromised = false;
|
|
50614
|
+
const lockCompromised = () => contentLockCompromised || isProvisioningLockCompromised();
|
|
50412
50615
|
try {
|
|
50413
50616
|
releaseContentLock = await tryAcquireContentWriteLock(branchPath, (lockErr) => {
|
|
50414
50617
|
contentLockCompromised = true;
|
|
@@ -50446,11 +50649,26 @@ async function rebaseOneBranch(ctx, branchDir, branchPath) {
|
|
|
50446
50649
|
return { kind: "failed", error: reason };
|
|
50447
50650
|
}
|
|
50448
50651
|
}
|
|
50449
|
-
|
|
50450
|
-
if (
|
|
50652
|
+
let dirtyCheck = await branchGit.status();
|
|
50653
|
+
if (await restoreRetiredSchemaCache(branchGit, dirtyCheck)) {
|
|
50654
|
+
workerLog(` ${branchDir}: restored the retired in-tree schema cache`);
|
|
50655
|
+
dirtyCheck = await branchGit.status();
|
|
50656
|
+
}
|
|
50657
|
+
const editorDirt = dirtyCheck.files.filter((f5) => !isCanopyInternalPath(f5.path));
|
|
50658
|
+
if (editorDirt.length > 0) {
|
|
50451
50659
|
workerLog(` Skipping ${branchDir}: has uncommitted changes`);
|
|
50452
50660
|
return { kind: "skippedDirty" };
|
|
50453
50661
|
}
|
|
50662
|
+
const trackedState = trackedCanopyStateChanges(dirtyCheck);
|
|
50663
|
+
if (trackedState.length > 0) {
|
|
50664
|
+
await branchGit.fetch("origin", ctx.baseBranch);
|
|
50665
|
+
const baseTip = (await branchGit.revparse(["FETCH_HEAD"])).trim();
|
|
50666
|
+
const { stillTracked } = await splitByUpstreamTracking(branchGit, trackedState, baseTip);
|
|
50667
|
+
const reason = stillTracked.length > 0 ? `git cannot rebase over modified canopycms state the repo tracks (${trackedState.join(", ")}). To fix, ${TRACKED_CANOPY_STATE_FIX}.` : `git cannot rebase over modified canopycms state this clone still tracks (${trackedState.join(", ")}), though the base branch no longer does; the clone needs manual repair`;
|
|
50668
|
+
workerLogWarn(` Skipping ${branchDir}: ${reason}`);
|
|
50669
|
+
await recordRebaseFailure(ctx, branchPath, branchDir, reason);
|
|
50670
|
+
return { kind: "failed", error: reason };
|
|
50671
|
+
}
|
|
50454
50672
|
const branchRef = (await branchGit.revparse(["--abbrev-ref", "HEAD"])).trim();
|
|
50455
50673
|
const canPublish = branchRef.length > 0 && branchRef !== "HEAD";
|
|
50456
50674
|
if (canPublish && metaFile?.branch.historyRewrittenFrom) {
|
|
@@ -50496,20 +50714,20 @@ async function rebaseOneBranch(ctx, branchDir, branchPath) {
|
|
|
50496
50714
|
branchGit,
|
|
50497
50715
|
branchDir,
|
|
50498
50716
|
fetchedBaseTip,
|
|
50499
|
-
|
|
50717
|
+
lockCompromised
|
|
50500
50718
|
);
|
|
50501
50719
|
if (completed) await ctx.afterRebaseCompletedForTesting();
|
|
50502
|
-
if (
|
|
50720
|
+
if (lockCompromised() && !completed) {
|
|
50503
50721
|
workerLogWarn(
|
|
50504
|
-
` Skipping ${branchDir}:
|
|
50722
|
+
` Skipping ${branchDir}: a lock it held was compromised mid-rebase (retrying next cycle)`
|
|
50505
50723
|
);
|
|
50506
50724
|
await branchGit.rebase(["--abort"]).catch(() => {
|
|
50507
50725
|
});
|
|
50508
50726
|
return { kind: "skippedLocked" };
|
|
50509
50727
|
}
|
|
50510
|
-
if (
|
|
50728
|
+
if (lockCompromised()) {
|
|
50511
50729
|
workerLogWarn(
|
|
50512
|
-
`
|
|
50730
|
+
` A lock held for ${branchDir} was compromised, but its rebase had already completed -- finishing the sync (history is rewritten; skipping now would strand the history-rewrite marker and wedge the branch)`
|
|
50513
50731
|
);
|
|
50514
50732
|
}
|
|
50515
50733
|
if (!completed) {
|
|
@@ -50577,8 +50795,8 @@ async function rebaseOneBranch(ctx, branchDir, branchPath) {
|
|
|
50577
50795
|
}
|
|
50578
50796
|
|
|
50579
50797
|
// ../canopycms/src/worker/git-sync.ts
|
|
50580
|
-
import
|
|
50581
|
-
import
|
|
50798
|
+
import fs14 from "node:fs/promises";
|
|
50799
|
+
import path18 from "node:path";
|
|
50582
50800
|
var TRASH_RETENTION_MS = 30 * 24 * 60 * 6e4;
|
|
50583
50801
|
var TRASH_DIR_STAMP_RE = /-(\d{8}T\d{6}Z)$/;
|
|
50584
50802
|
function parseTrashStamp(stamp) {
|
|
@@ -50742,7 +50960,7 @@ async function syncGit(ctx) {
|
|
|
50742
50960
|
workerLog("Fetched from GitHub");
|
|
50743
50961
|
const { summary: trackedSummary, trackedNames } = await reconcileTrackedBranches(ctx, git);
|
|
50744
50962
|
await pushSettingsBranches(ctx, git, trackedNames);
|
|
50745
|
-
await refreshBaseBranchWorkspace(ctx);
|
|
50963
|
+
const baseRefresh = await refreshBaseBranchWorkspace(ctx);
|
|
50746
50964
|
const rebaseSummary = await runRebaseCycle(ctx);
|
|
50747
50965
|
await cleanupOldTasks(ctx.taskDir, void 0, ctx.log);
|
|
50748
50966
|
const trashRemoved = await cleanupTrashedBranchDirs(ctx);
|
|
@@ -50755,9 +50973,10 @@ async function syncGit(ctx) {
|
|
|
50755
50973
|
report.lastGitSync = {
|
|
50756
50974
|
durationMs: Date.now() - cycleStartedAt,
|
|
50757
50975
|
rebased: rebaseSummary.rebased,
|
|
50758
|
-
skippedDirty: rebaseSummary.skippedDirty,
|
|
50759
|
-
skippedLocked: rebaseSummary.skippedLocked,
|
|
50976
|
+
skippedDirty: baseRefresh.outcome === "skipped-dirty" ? [ctx.sanitizedBaseBranch, ...rebaseSummary.skippedDirty] : rebaseSummary.skippedDirty,
|
|
50977
|
+
skippedLocked: baseRefresh.outcome === "skipped-locked" ? [ctx.sanitizedBaseBranch, ...rebaseSummary.skippedLocked] : rebaseSummary.skippedLocked,
|
|
50760
50978
|
failed: rebaseSummary.failed,
|
|
50979
|
+
baseRefresh,
|
|
50761
50980
|
tracked: trackedSummary
|
|
50762
50981
|
};
|
|
50763
50982
|
await writeWorkerStatus(ctx.taskDir, report).catch(
|
|
@@ -50778,7 +50997,7 @@ async function syncGit(ctx) {
|
|
|
50778
50997
|
async function cleanupTrashedBranchDirs(ctx) {
|
|
50779
50998
|
let entries;
|
|
50780
50999
|
try {
|
|
50781
|
-
entries = await
|
|
51000
|
+
entries = await fs14.readdir(ctx.contentBranchesPath);
|
|
50782
51001
|
} catch (err) {
|
|
50783
51002
|
if (isNodeError(err) && err.code === "ENOENT") return 0;
|
|
50784
51003
|
throw err;
|
|
@@ -50799,7 +51018,7 @@ async function cleanupTrashedBranchDirs(ctx) {
|
|
|
50799
51018
|
}
|
|
50800
51019
|
if (now - stampDate.getTime() < TRASH_RETENTION_MS) continue;
|
|
50801
51020
|
try {
|
|
50802
|
-
await
|
|
51021
|
+
await fs14.rm(path18.join(ctx.contentBranchesPath, name), {
|
|
50803
51022
|
recursive: true,
|
|
50804
51023
|
force: true,
|
|
50805
51024
|
maxRetries: 3,
|
|
@@ -50815,20 +51034,32 @@ async function cleanupTrashedBranchDirs(ctx) {
|
|
|
50815
51034
|
}
|
|
50816
51035
|
return removed;
|
|
50817
51036
|
}
|
|
51037
|
+
var warnedTrackedCanopyState = /* @__PURE__ */ new Set();
|
|
50818
51038
|
async function refreshBaseBranchWorkspace(ctx) {
|
|
50819
|
-
const basePath37 =
|
|
50820
|
-
|
|
51039
|
+
const basePath37 = path18.join(ctx.contentBranchesPath, ctx.sanitizedBaseBranch);
|
|
51040
|
+
let trackedCanopyMeta;
|
|
51041
|
+
let releaseProvisioning;
|
|
50821
51042
|
try {
|
|
50822
|
-
|
|
50823
|
-
|
|
50824
|
-
|
|
50825
|
-
|
|
50826
|
-
|
|
51043
|
+
const hold = await holdProvisionedWorkspace(ctx.contentBranchesPath, ctx.sanitizedBaseBranch);
|
|
51044
|
+
if (hold.kind === "locked") {
|
|
51045
|
+
workerLog(
|
|
51046
|
+
`Base branch workspace (${ctx.baseBranch}): provisioning lock held elsewhere, skipping refresh`
|
|
51047
|
+
);
|
|
51048
|
+
return { outcome: "skipped-locked" };
|
|
50827
51049
|
}
|
|
50828
|
-
if (
|
|
51050
|
+
if (hold.kind === "not-provisioned") {
|
|
50829
51051
|
workerLog(`Base branch workspace (${ctx.baseBranch}): not yet provisioned, skipping refresh`);
|
|
50830
|
-
return;
|
|
51052
|
+
return { outcome: "skipped-not-provisioned" };
|
|
50831
51053
|
}
|
|
51054
|
+
releaseProvisioning = hold.release;
|
|
51055
|
+
const lockLost = () => {
|
|
51056
|
+
if (!hold.isCompromised()) return null;
|
|
51057
|
+
workerLogWarn(
|
|
51058
|
+
`Base branch workspace (${ctx.baseBranch}): provisioning lock lost mid-refresh, stopping`
|
|
51059
|
+
);
|
|
51060
|
+
return { outcome: "skipped-locked", trackedCanopyMeta };
|
|
51061
|
+
};
|
|
51062
|
+
await ensureGitExcludePattern(basePath37, `${CANOPY_META_DIR}/`);
|
|
50832
51063
|
const baseGit = simpleGit({
|
|
50833
51064
|
baseDir: basePath37,
|
|
50834
51065
|
// Keep git non-interactive during the merge so it never blocks on an
|
|
@@ -50842,13 +51073,37 @@ async function refreshBaseBranchWorkspace(ctx) {
|
|
|
50842
51073
|
// Inactivity-based, so a slow-but-flowing transfer is unaffected.
|
|
50843
51074
|
timeout: { block: ctx.taskTimeoutMs }
|
|
50844
51075
|
});
|
|
50845
|
-
const
|
|
50846
|
-
|
|
51076
|
+
const trackedState = await listTrackedCanopyState(baseGit);
|
|
51077
|
+
if (trackedState.length > 0) {
|
|
51078
|
+
trackedCanopyMeta = trackedState.slice(0, MAX_REPORTED_PATHS);
|
|
51079
|
+
const warnKey = `${basePath37}\0${trackedState.join("\0")}`;
|
|
51080
|
+
if (!warnedTrackedCanopyState.has(warnKey)) {
|
|
51081
|
+
warnedTrackedCanopyState.add(warnKey);
|
|
51082
|
+
workerLogWarn(
|
|
51083
|
+
`Base branch (${ctx.baseBranch}) tracks canopycms state that must not be committed: ${trackedState.join(", ")}. To fix, ${TRACKED_CANOPY_STATE_FIX}.`
|
|
51084
|
+
);
|
|
51085
|
+
}
|
|
51086
|
+
}
|
|
51087
|
+
let status = await baseGit.status();
|
|
51088
|
+
const lostBeforeRestore = lockLost();
|
|
51089
|
+
if (lostBeforeRestore) return lostBeforeRestore;
|
|
51090
|
+
if (await restoreRetiredSchemaCache(baseGit, status)) {
|
|
51091
|
+
workerLog(
|
|
51092
|
+
`Base branch workspace (${ctx.baseBranch}): restored the retired in-tree schema cache`
|
|
51093
|
+
);
|
|
51094
|
+
status = await baseGit.status();
|
|
51095
|
+
}
|
|
51096
|
+
const trackedDirty = status.files.filter((f5) => !isUntracked(f5) && !isCanopyInternalPath(f5.path)).map((f5) => f5.path);
|
|
50847
51097
|
if (trackedDirty.length > 0) {
|
|
50848
51098
|
workerLogError(
|
|
50849
|
-
`Base branch workspace (${ctx.baseBranch}) has uncommitted changes -- skipping refresh. Dirty files: ${trackedDirty.
|
|
51099
|
+
`Base branch workspace (${ctx.baseBranch}) has uncommitted changes -- skipping refresh. Dirty files: ${trackedDirty.join(", ")}`
|
|
50850
51100
|
);
|
|
50851
|
-
return
|
|
51101
|
+
return {
|
|
51102
|
+
outcome: "skipped-dirty",
|
|
51103
|
+
dirtyFiles: trackedDirty.slice(0, MAX_REPORTED_PATHS),
|
|
51104
|
+
message: `${trackedDirty.length} uncommitted tracked file(s) in the base branch workspace`,
|
|
51105
|
+
trackedCanopyMeta
|
|
51106
|
+
};
|
|
50852
51107
|
}
|
|
50853
51108
|
await baseGit.fetch("origin", ctx.baseBranch);
|
|
50854
51109
|
const fetchedTip = (await baseGit.revparse(["FETCH_HEAD"])).trim();
|
|
@@ -50857,13 +51112,27 @@ async function refreshBaseBranchWorkspace(ctx) {
|
|
|
50857
51112
|
10
|
|
50858
51113
|
);
|
|
50859
51114
|
if (behindCount > 0) {
|
|
51115
|
+
const lostBeforeMerge = lockLost();
|
|
51116
|
+
if (lostBeforeMerge) return lostBeforeMerge;
|
|
51117
|
+
const { droppedUpstream } = await splitByUpstreamTracking(baseGit, trackedState, fetchedTip);
|
|
51118
|
+
if (droppedUpstream.length > 0) {
|
|
51119
|
+
await untrackInIndex(baseGit, droppedUpstream);
|
|
51120
|
+
workerLog(
|
|
51121
|
+
`Base branch workspace (${ctx.baseBranch}): stopped tracking ${droppedUpstream.join(", ")}, as upstream has`
|
|
51122
|
+
);
|
|
51123
|
+
}
|
|
50860
51124
|
try {
|
|
50861
51125
|
await baseGit.merge(["--ff-only", fetchedTip]);
|
|
50862
51126
|
} catch (err) {
|
|
50863
51127
|
workerLogError(
|
|
50864
51128
|
`Base branch workspace (${ctx.baseBranch}) failed to fast-forward (diverged local history?): ${getErrorMessage2(err)}`
|
|
50865
51129
|
);
|
|
50866
|
-
return
|
|
51130
|
+
return {
|
|
51131
|
+
outcome: "failed",
|
|
51132
|
+
// [REDACT] Served to the browser by the admin panel.
|
|
51133
|
+
message: redactCredentials(`failed to fast-forward: ${getErrorMessage2(err)}`),
|
|
51134
|
+
trackedCanopyMeta
|
|
51135
|
+
};
|
|
50867
51136
|
}
|
|
50868
51137
|
await invalidateBranchContentCaches(basePath37);
|
|
50869
51138
|
}
|
|
@@ -50880,10 +51149,24 @@ async function refreshBaseBranchWorkspace(ctx) {
|
|
|
50880
51149
|
workerLog(
|
|
50881
51150
|
behindCount > 0 ? `Base branch workspace (${ctx.baseBranch}): fast-forwarded ${behindCount} commit(s)` : `Base branch workspace (${ctx.baseBranch}): up to date`
|
|
50882
51151
|
);
|
|
51152
|
+
if (trackedCanopyMeta && behindCount > 0) {
|
|
51153
|
+
const stillTracked = await listTrackedCanopyState(baseGit);
|
|
51154
|
+
trackedCanopyMeta = stillTracked.length > 0 ? stillTracked.slice(0, MAX_REPORTED_PATHS) : void 0;
|
|
51155
|
+
}
|
|
51156
|
+
return { outcome: behindCount > 0 ? "refreshed" : "up-to-date", trackedCanopyMeta };
|
|
50883
51157
|
} catch (err) {
|
|
50884
51158
|
workerLogError(
|
|
50885
51159
|
`Base branch workspace (${ctx.baseBranch}) refresh failed: ${getErrorMessage2(err)}`
|
|
50886
51160
|
);
|
|
51161
|
+
return {
|
|
51162
|
+
outcome: "failed",
|
|
51163
|
+
message: redactCredentials(getErrorMessage2(err)),
|
|
51164
|
+
trackedCanopyMeta
|
|
51165
|
+
};
|
|
51166
|
+
} finally {
|
|
51167
|
+
if (releaseProvisioning) {
|
|
51168
|
+
await releaseProvisionedWorkspace(releaseProvisioning, ctx.sanitizedBaseBranch);
|
|
51169
|
+
}
|
|
50887
51170
|
}
|
|
50888
51171
|
}
|
|
50889
51172
|
|
|
@@ -50899,15 +51182,15 @@ var CmsWorker = class {
|
|
|
50899
51182
|
this.activeOperations = /* @__PURE__ */ new Set();
|
|
50900
51183
|
this.releaseLockFn = null;
|
|
50901
51184
|
this.log = cmsTaskQueueLogger;
|
|
50902
|
-
this.taskDir =
|
|
50903
|
-
this.remoteGitPath =
|
|
50904
|
-
this.contentBranchesPath =
|
|
51185
|
+
this.taskDir = path19.join(config.workspacePath, ".tasks");
|
|
51186
|
+
this.remoteGitPath = path19.join(config.workspacePath, "remote.git");
|
|
51187
|
+
this.contentBranchesPath = path19.join(config.workspacePath, "content-branches");
|
|
50905
51188
|
this.baseBranch = config.baseBranch ?? "main";
|
|
50906
51189
|
this.sanitizedBaseBranch = sanitizeBranchName(this.baseBranch);
|
|
50907
51190
|
this.maxTasksPerCycle = config.maxTasksPerCycle ?? 10;
|
|
50908
51191
|
this.taskTimeoutMs = config.taskTimeoutMs ?? DEFAULT_TASK_TIMEOUT;
|
|
50909
51192
|
this.maxRetries = config.maxRetries ?? DEFAULT_MAX_RETRIES2;
|
|
50910
|
-
this.lockFilePath =
|
|
51193
|
+
this.lockFilePath = path19.join(config.workspacePath, ".tasks", ".worker-lock");
|
|
50911
51194
|
this.lockStaleMs = config.lockStaleMs ?? DEFAULT_LOCK_STALE_MS;
|
|
50912
51195
|
this.contentRoot = config.contentRoot ?? "content";
|
|
50913
51196
|
}
|
|
@@ -51087,7 +51370,7 @@ var CmsWorker = class {
|
|
|
51087
51370
|
* is negligible at the default TTL; a badly wrong clock misjudges liveness.
|
|
51088
51371
|
*/
|
|
51089
51372
|
async acquireLock() {
|
|
51090
|
-
await
|
|
51373
|
+
await fs15.mkdir(this.taskDir, { recursive: true });
|
|
51091
51374
|
try {
|
|
51092
51375
|
this.releaseLockFn = await import_proper_lockfile3.default.lock(this.taskDir, {
|
|
51093
51376
|
lockfilePath: this.lockFilePath,
|
|
@@ -51226,7 +51509,7 @@ var CmsWorker = class {
|
|
|
51226
51509
|
async ensureRemoteGit() {
|
|
51227
51510
|
let exists2;
|
|
51228
51511
|
try {
|
|
51229
|
-
await
|
|
51512
|
+
await fs15.stat(this.remoteGitPath);
|
|
51230
51513
|
exists2 = true;
|
|
51231
51514
|
} catch {
|
|
51232
51515
|
exists2 = false;
|
|
@@ -51246,19 +51529,19 @@ var CmsWorker = class {
|
|
|
51246
51529
|
workerLog("Initializing remote.git from GitHub...");
|
|
51247
51530
|
const git = simpleGit();
|
|
51248
51531
|
const stagingPath = `${this.remoteGitPath}.cloning`;
|
|
51249
|
-
await
|
|
51532
|
+
await fs15.rm(stagingPath, { recursive: true, force: true });
|
|
51250
51533
|
try {
|
|
51251
51534
|
await git.clone(await this.buildGitHubUrl(), stagingPath, ["--bare"]);
|
|
51252
51535
|
await this.scrubPersistedRemote(stagingPath);
|
|
51253
51536
|
await this.verifyBaseBranchExists(stagingPath);
|
|
51254
51537
|
} catch (err) {
|
|
51255
51538
|
workerLogError(`remote.git clone failed: ${redactCredentials(getErrorMessage2(err))}`);
|
|
51256
|
-
await
|
|
51539
|
+
await fs15.rm(stagingPath, { recursive: true, force: true });
|
|
51257
51540
|
throw new Error(
|
|
51258
51541
|
`remote.git clone of ${this.config.githubOwner}/${this.config.githubRepo} failed or has no branch '${this.baseBranch}' - the GitHub repository may be empty, or the base branch may not exist. Push an initial commit to '${this.baseBranch}' and restart the worker (systemd will retry automatically).`
|
|
51259
51542
|
);
|
|
51260
51543
|
}
|
|
51261
|
-
await
|
|
51544
|
+
await fs15.rename(stagingPath, this.remoteGitPath);
|
|
51262
51545
|
workerLog("remote.git initialized");
|
|
51263
51546
|
}
|
|
51264
51547
|
// --- Task-queue cluster (worker/task-runner.ts) ------------------------
|
|
@@ -51407,7 +51690,7 @@ var CmsWorker = class {
|
|
|
51407
51690
|
* sanitized.
|
|
51408
51691
|
*/
|
|
51409
51692
|
branchWorkspacePath(branchRefName) {
|
|
51410
|
-
return
|
|
51693
|
+
return path19.join(this.contentBranchesPath, sanitizeBranchName(branchRefName));
|
|
51411
51694
|
}
|
|
51412
51695
|
/**
|
|
51413
51696
|
* Test-only seam: awaited inside `rebaseActiveBranches()`'s conflict round,
|
|
@@ -51550,7 +51833,7 @@ var CmsWorker = class {
|
|
|
51550
51833
|
};
|
|
51551
51834
|
|
|
51552
51835
|
// worker/index.ts
|
|
51553
|
-
import
|
|
51836
|
+
import path21 from "node:path";
|
|
51554
51837
|
|
|
51555
51838
|
// worker/secrets.ts
|
|
51556
51839
|
function secretsManagerClientConfig(timeouts = {}) {
|
|
@@ -56057,10 +56340,10 @@ var SessionAPI = class extends AbstractAPI {
|
|
|
56057
56340
|
*/
|
|
56058
56341
|
async getToken(sessionId, template, expiresInSeconds) {
|
|
56059
56342
|
this.requireId(sessionId);
|
|
56060
|
-
const
|
|
56343
|
+
const path22 = template ? joinPaths(basePath29, sessionId, "tokens", template) : joinPaths(basePath29, sessionId, "tokens");
|
|
56061
56344
|
const requestOptions = {
|
|
56062
56345
|
method: "POST",
|
|
56063
|
-
path:
|
|
56346
|
+
path: path22
|
|
56064
56347
|
};
|
|
56065
56348
|
if (expiresInSeconds !== void 0) {
|
|
56066
56349
|
requestOptions.bodyParams = { expires_in_seconds: expiresInSeconds };
|
|
@@ -58810,12 +59093,12 @@ function buildRequest(options) {
|
|
|
58810
59093
|
userAgent = USER_AGENT,
|
|
58811
59094
|
skipApiVersionInUrl = false
|
|
58812
59095
|
} = options;
|
|
58813
|
-
const { path:
|
|
59096
|
+
const { path: path22, method, queryParams, headerParams, bodyParams, formData, options: opts } = requestOptions;
|
|
58814
59097
|
const { deepSnakecaseBodyParamKeys = false } = opts || {};
|
|
58815
59098
|
if (requireSecretKey) {
|
|
58816
59099
|
assertValidSecretKey(secretKey);
|
|
58817
59100
|
}
|
|
58818
|
-
const url = skipApiVersionInUrl ? joinPaths(apiUrl,
|
|
59101
|
+
const url = skipApiVersionInUrl ? joinPaths(apiUrl, path22) : joinPaths(apiUrl, apiVersion, path22);
|
|
58819
59102
|
const finalUrl = new URL(url);
|
|
58820
59103
|
if (queryParams) {
|
|
58821
59104
|
const snakecasedQueryParams = snakecase_keys_default({ ...queryParams });
|
|
@@ -60996,38 +61279,38 @@ function createClerkClient(options) {
|
|
|
60996
61279
|
}
|
|
60997
61280
|
|
|
60998
61281
|
// ../canopycms/src/auth/file-based-auth-cache.ts
|
|
60999
|
-
import
|
|
61000
|
-
import
|
|
61001
|
-
var
|
|
61282
|
+
import fs16 from "node:fs/promises";
|
|
61283
|
+
import path20 from "node:path";
|
|
61284
|
+
var log6 = createDebugLogger({ prefix: "FileBasedAuthCache" });
|
|
61002
61285
|
async function writeAuthCacheSnapshot(cachePath, files) {
|
|
61003
|
-
await
|
|
61286
|
+
await fs16.mkdir(cachePath, { recursive: true });
|
|
61004
61287
|
const timestamp2 = Date.now();
|
|
61005
|
-
const snapshotDir =
|
|
61006
|
-
await
|
|
61288
|
+
const snapshotDir = path20.join(cachePath, `snapshot-${timestamp2}`);
|
|
61289
|
+
await fs16.mkdir(snapshotDir, { recursive: true });
|
|
61007
61290
|
for (const [fileName, data2] of Object.entries(files)) {
|
|
61008
|
-
const tmpPath =
|
|
61009
|
-
const finalPath =
|
|
61010
|
-
await
|
|
61011
|
-
await
|
|
61012
|
-
}
|
|
61013
|
-
const currentLink =
|
|
61014
|
-
const tmpLink =
|
|
61015
|
-
await
|
|
61016
|
-
await
|
|
61291
|
+
const tmpPath = path20.join(snapshotDir, `${fileName}.tmp`);
|
|
61292
|
+
const finalPath = path20.join(snapshotDir, fileName);
|
|
61293
|
+
await fs16.writeFile(tmpPath, JSON.stringify(data2, null, 2), "utf-8");
|
|
61294
|
+
await fs16.rename(tmpPath, finalPath);
|
|
61295
|
+
}
|
|
61296
|
+
const currentLink = path20.join(cachePath, "current");
|
|
61297
|
+
const tmpLink = path20.join(cachePath, `current-${timestamp2}`);
|
|
61298
|
+
await fs16.symlink(path20.basename(snapshotDir), tmpLink);
|
|
61299
|
+
await fs16.rename(tmpLink, currentLink);
|
|
61017
61300
|
await cleanupOldSnapshots(cachePath, 2);
|
|
61018
61301
|
return snapshotDir;
|
|
61019
61302
|
}
|
|
61020
61303
|
async function cleanupOldSnapshots(cachePath, keepCount) {
|
|
61021
61304
|
let entries;
|
|
61022
61305
|
try {
|
|
61023
|
-
entries = await
|
|
61306
|
+
entries = await fs16.readdir(cachePath);
|
|
61024
61307
|
} catch {
|
|
61025
61308
|
return;
|
|
61026
61309
|
}
|
|
61027
61310
|
const snapshots = entries.filter((e5) => e5.startsWith("snapshot-")).sort().reverse();
|
|
61028
61311
|
for (const snapshot of snapshots.slice(keepCount)) {
|
|
61029
61312
|
try {
|
|
61030
|
-
await
|
|
61313
|
+
await fs16.rm(path20.join(cachePath, snapshot), {
|
|
61031
61314
|
recursive: true,
|
|
61032
61315
|
force: true
|
|
61033
61316
|
});
|
|
@@ -61037,7 +61320,7 @@ async function cleanupOldSnapshots(cachePath, keepCount) {
|
|
|
61037
61320
|
}
|
|
61038
61321
|
|
|
61039
61322
|
// ../canopycms/src/auth/caching-auth-plugin.ts
|
|
61040
|
-
var
|
|
61323
|
+
var log7 = createDebugLogger({ prefix: "CachingAuthPlugin" });
|
|
61041
61324
|
|
|
61042
61325
|
// ../canopycms-auth-clerk/src/cache-writer.ts
|
|
61043
61326
|
function unwrapClerkResponse(response) {
|
|
@@ -61238,7 +61521,7 @@ async function main() {
|
|
|
61238
61521
|
});
|
|
61239
61522
|
const refreshAuthCache = createClerkAuthCacheRefresher({
|
|
61240
61523
|
secret: clerkSecret,
|
|
61241
|
-
cachePath:
|
|
61524
|
+
cachePath: path21.join(workspacePath, ".cache")
|
|
61242
61525
|
});
|
|
61243
61526
|
const worker = new CmsWorker({
|
|
61244
61527
|
workspacePath,
|