canopycms-cdk 0.0.67 → 0.0.68-int.94
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/README.md +3 -1
- package/dist/constructs/cms-distribution.d.ts +5 -4
- package/dist/constructs/cms-distribution.js +14 -61
- package/dist/constructs/cms-service.d.ts +23 -3
- package/dist/constructs/cms-service.js +24 -2
- package/dist/constructs/editor-routing.d.ts +131 -0
- package/dist/constructs/editor-routing.js +313 -0
- package/dist/index.d.ts +1 -0
- package/lambda/asset-transform/dist/handler.js +59 -29
- package/package.json +4 -4
- package/worker/dist/index.js +793 -442
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(fs18) {
|
|
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(fs18);
|
|
933
|
+
}
|
|
934
|
+
if (!fs18.lutimes) {
|
|
935
|
+
patchLutimes(fs18);
|
|
936
|
+
}
|
|
937
|
+
fs18.chown = chownFix(fs18.chown);
|
|
938
|
+
fs18.fchown = chownFix(fs18.fchown);
|
|
939
|
+
fs18.lchown = chownFix(fs18.lchown);
|
|
940
|
+
fs18.chmod = chmodFix(fs18.chmod);
|
|
941
|
+
fs18.fchmod = chmodFix(fs18.fchmod);
|
|
942
|
+
fs18.lchmod = chmodFix(fs18.lchmod);
|
|
943
|
+
fs18.chownSync = chownFixSync(fs18.chownSync);
|
|
944
|
+
fs18.fchownSync = chownFixSync(fs18.fchownSync);
|
|
945
|
+
fs18.lchownSync = chownFixSync(fs18.lchownSync);
|
|
946
|
+
fs18.chmodSync = chmodFixSync(fs18.chmodSync);
|
|
947
|
+
fs18.fchmodSync = chmodFixSync(fs18.fchmodSync);
|
|
948
|
+
fs18.lchmodSync = chmodFixSync(fs18.lchmodSync);
|
|
949
|
+
fs18.stat = statFix(fs18.stat);
|
|
950
|
+
fs18.fstat = statFix(fs18.fstat);
|
|
951
|
+
fs18.lstat = statFix(fs18.lstat);
|
|
952
|
+
fs18.statSync = statFixSync(fs18.statSync);
|
|
953
|
+
fs18.fstatSync = statFixSync(fs18.fstatSync);
|
|
954
|
+
fs18.lstatSync = statFixSync(fs18.lstatSync);
|
|
955
|
+
if (fs18.chmod && !fs18.lchmod) {
|
|
956
|
+
fs18.lchmod = function(path22, mode, cb) {
|
|
957
957
|
if (cb) process.nextTick(cb);
|
|
958
958
|
};
|
|
959
|
-
|
|
959
|
+
fs18.lchmodSync = function() {
|
|
960
960
|
};
|
|
961
961
|
}
|
|
962
|
-
if (
|
|
963
|
-
|
|
962
|
+
if (fs18.chown && !fs18.lchown) {
|
|
963
|
+
fs18.lchown = function(path22, uid, gid, cb) {
|
|
964
964
|
if (cb) process.nextTick(cb);
|
|
965
965
|
};
|
|
966
|
-
|
|
966
|
+
fs18.lchownSync = function() {
|
|
967
967
|
};
|
|
968
968
|
}
|
|
969
969
|
if (platform === "win32") {
|
|
970
|
-
|
|
970
|
+
fs18.rename = typeof fs18.rename !== "function" ? fs18.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
|
+
fs18.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
|
+
})(fs18.rename);
|
|
994
994
|
}
|
|
995
|
-
|
|
995
|
+
fs18.read = typeof fs18.read !== "function" ? fs18.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(fs18, 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(fs18, 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
|
+
})(fs18.read);
|
|
1013
|
+
fs18.readSync = typeof fs18.readSync !== "function" ? fs18.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(fs18, 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
|
+
})(fs18.readSync);
|
|
1029
|
+
function patchLchmod(fs19) {
|
|
1030
|
+
fs19.lchmod = function(path22, mode, callback) {
|
|
1031
|
+
fs19.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
|
+
fs19.fchmod(fd, mode, function(err2) {
|
|
1041
|
+
fs19.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
|
+
fs19.lchmodSync = function(path22, mode) {
|
|
1049
|
+
var fd = fs19.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 = fs19.fchmodSync(fd, mode);
|
|
1054
1054
|
threw = false;
|
|
1055
1055
|
} finally {
|
|
1056
1056
|
if (threw) {
|
|
1057
1057
|
try {
|
|
1058
|
-
|
|
1058
|
+
fs19.closeSync(fd);
|
|
1059
1059
|
} catch (er) {
|
|
1060
1060
|
}
|
|
1061
1061
|
} else {
|
|
1062
|
-
|
|
1062
|
+
fs19.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(fs19) {
|
|
1069
|
+
if (constants2.hasOwnProperty("O_SYMLINK") && fs19.futimes) {
|
|
1070
|
+
fs19.lutimes = function(path22, at, mt, cb) {
|
|
1071
|
+
fs19.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
|
+
fs19.futimes(fd, at, mt, function(er2) {
|
|
1077
|
+
fs19.close(fd, function(er22) {
|
|
1078
1078
|
if (cb) cb(er2 || er22);
|
|
1079
1079
|
});
|
|
1080
1080
|
});
|
|
1081
1081
|
});
|
|
1082
1082
|
};
|
|
1083
|
-
|
|
1084
|
-
var fd =
|
|
1083
|
+
fs19.lutimesSync = function(path22, at, mt) {
|
|
1084
|
+
var fd = fs19.openSync(path22, constants2.O_SYMLINK);
|
|
1085
1085
|
var ret;
|
|
1086
1086
|
var threw = true;
|
|
1087
1087
|
try {
|
|
1088
|
-
ret =
|
|
1088
|
+
ret = fs19.futimesSync(fd, at, mt);
|
|
1089
1089
|
threw = false;
|
|
1090
1090
|
} finally {
|
|
1091
1091
|
if (threw) {
|
|
1092
1092
|
try {
|
|
1093
|
-
|
|
1093
|
+
fs19.closeSync(fd);
|
|
1094
1094
|
} catch (er) {
|
|
1095
1095
|
}
|
|
1096
1096
|
} else {
|
|
1097
|
-
|
|
1097
|
+
fs19.closeSync(fd);
|
|
1098
1098
|
}
|
|
1099
1099
|
}
|
|
1100
1100
|
return ret;
|
|
1101
1101
|
};
|
|
1102
|
-
} else if (
|
|
1103
|
-
|
|
1102
|
+
} else if (fs19.futimes) {
|
|
1103
|
+
fs19.lutimes = function(_a3, _b, _c5, cb) {
|
|
1104
1104
|
if (cb) process.nextTick(cb);
|
|
1105
1105
|
};
|
|
1106
|
-
|
|
1106
|
+
fs19.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(fs18, 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(fs18, 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(fs18, 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(fs18, 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(fs18, target, options, callback) : orig.call(fs18, 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(fs18, target, options) : orig.call(fs18, 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(fs18) {
|
|
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
|
+
fs18.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 = fs18.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 fs18 = __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 (!fs18[gracefulQueue]) {
|
|
1347
1347
|
queue = global[gracefulQueue] || [];
|
|
1348
|
-
publishQueue(
|
|
1349
|
-
|
|
1348
|
+
publishQueue(fs18, queue);
|
|
1349
|
+
fs18.close = (function(fs$close) {
|
|
1350
1350
|
function close(fd, cb) {
|
|
1351
|
-
return fs$close.call(
|
|
1351
|
+
return fs$close.call(fs18, 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
|
+
})(fs18.close);
|
|
1364
|
+
fs18.closeSync = (function(fs$closeSync) {
|
|
1365
1365
|
function closeSync(fd) {
|
|
1366
|
-
fs$closeSync.apply(
|
|
1366
|
+
fs$closeSync.apply(fs18, 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
|
+
})(fs18.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(fs18[gracefulQueue]);
|
|
1377
|
+
__require("assert").equal(fs18[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, fs18[gracefulQueue]);
|
|
1384
|
+
}
|
|
1385
|
+
module.exports = patch(clone(fs18));
|
|
1386
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs18.__patched) {
|
|
1387
|
+
module.exports = patch(fs18);
|
|
1388
|
+
fs18.__patched = true;
|
|
1389
|
+
}
|
|
1390
|
+
function patch(fs19) {
|
|
1391
|
+
polyfills(fs19);
|
|
1392
|
+
fs19.gracefulify = patch;
|
|
1393
|
+
fs19.createReadStream = createReadStream;
|
|
1394
|
+
fs19.createWriteStream = createWriteStream;
|
|
1395
|
+
var fs$readFile = fs19.readFile;
|
|
1396
|
+
fs19.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 = fs19.writeFile;
|
|
1413
|
+
fs19.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 = fs19.appendFile;
|
|
1430
1430
|
if (fs$appendFile)
|
|
1431
|
-
|
|
1432
|
-
function appendFile(
|
|
1431
|
+
fs19.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 = fs19.copyFile;
|
|
1448
1448
|
if (fs$copyFile)
|
|
1449
|
-
|
|
1449
|
+
fs19.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 = fs19.readdir;
|
|
1468
|
+
fs19.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(fs19);
|
|
1510
1510
|
ReadStream = legStreams.ReadStream;
|
|
1511
1511
|
WriteStream = legStreams.WriteStream;
|
|
1512
1512
|
}
|
|
1513
|
-
var fs$ReadStream =
|
|
1513
|
+
var fs$ReadStream = fs19.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 = fs19.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(fs19, "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(fs19, "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(fs19, "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(fs19, "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 fs19.ReadStream(path22, options);
|
|
1605
1605
|
}
|
|
1606
|
-
function createWriteStream(
|
|
1607
|
-
return new
|
|
1606
|
+
function createWriteStream(path22, options) {
|
|
1607
|
+
return new fs19.WriteStream(path22, options);
|
|
1608
1608
|
}
|
|
1609
|
-
var fs$open =
|
|
1610
|
-
|
|
1611
|
-
function open(
|
|
1609
|
+
var fs$open = fs19.open;
|
|
1610
|
+
fs19.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 fs19;
|
|
1627
1627
|
}
|
|
1628
1628
|
function enqueue(elem) {
|
|
1629
1629
|
debug2("ENQUEUE", elem[0].name, elem[1]);
|
|
1630
|
-
|
|
1630
|
+
fs18[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 < fs18[gracefulQueue].length; ++i6) {
|
|
1637
|
+
if (fs18[gracefulQueue][i6].length > 2) {
|
|
1638
|
+
fs18[gracefulQueue][i6][3] = now;
|
|
1639
|
+
fs18[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 (fs18[gracefulQueue].length === 0)
|
|
1648
1648
|
return;
|
|
1649
|
-
var elem =
|
|
1649
|
+
var elem = fs18[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
|
+
fs18[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, fs18, callback) {
|
|
2107
|
+
const cachedPrecision = fs18[cacheSymbol];
|
|
2108
2108
|
if (cachedPrecision) {
|
|
2109
|
-
return
|
|
2109
|
+
return fs18.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
|
+
fs18.utimes(file, mtime, mtime, (err) => {
|
|
2118
2118
|
if (err) {
|
|
2119
2119
|
return callback(err);
|
|
2120
2120
|
}
|
|
2121
|
-
|
|
2121
|
+
fs18.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(fs18, 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 fs18 = 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: fs18,
|
|
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: fs18,
|
|
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: fs18,
|
|
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 fs18 = require_graceful_fs();
|
|
2385
|
+
function createSyncFs(fs19) {
|
|
2386
2386
|
const methods = ["mkdir", "realpath", "stat", "rmdir", "utimes"];
|
|
2387
|
-
const newFs = { ...
|
|
2387
|
+
const newFs = { ...fs19 };
|
|
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 = fs19[`${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 || fs18);
|
|
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"),
|
|
@@ -12411,7 +12412,7 @@ var init_sanitize_href = __esm({
|
|
|
12411
12412
|
});
|
|
12412
12413
|
|
|
12413
12414
|
// ../canopycms/src/config/schemas/url.ts
|
|
12414
|
-
var uploadTargetUrlSchema, assetMountUrlSchema;
|
|
12415
|
+
var uploadTargetUrlSchema, assetMountUrlSchema, previewPrefixSchema;
|
|
12415
12416
|
var init_url = __esm({
|
|
12416
12417
|
"../canopycms/src/config/schemas/url.ts"() {
|
|
12417
12418
|
"use strict";
|
|
@@ -12423,6 +12424,9 @@ var init_url = __esm({
|
|
|
12423
12424
|
assetMountUrlSchema = external_exports.string().trim().refine((value) => isHttpUrlOrSameOriginPath(value, { allowProtocolRelative: true }), {
|
|
12424
12425
|
message: 'must be an absolute http(s) URL, a protocol-relative "//host" URL, or a site-relative path beginning with a single "/", with no query or fragment'
|
|
12425
12426
|
});
|
|
12427
|
+
previewPrefixSchema = external_exports.string().trim().refine((value) => isHttpUrlOrSameOriginPath(value), {
|
|
12428
|
+
message: 'editor.previewPrefix must be an absolute http(s) URL or a site-relative path beginning with a single "/", with no query or fragment'
|
|
12429
|
+
});
|
|
12426
12430
|
}
|
|
12427
12431
|
});
|
|
12428
12432
|
|
|
@@ -12480,6 +12484,7 @@ var init_config2 = __esm({
|
|
|
12480
12484
|
init_zod();
|
|
12481
12485
|
init_collection();
|
|
12482
12486
|
init_media();
|
|
12487
|
+
init_url();
|
|
12483
12488
|
defaultBranchAccessSchema = external_exports.enum(["allow", "deny"]).default("deny");
|
|
12484
12489
|
defaultPathAccessLevelSchema = external_exports.enum(["allow", "deny"]);
|
|
12485
12490
|
defaultPathAccessLevelsSchema = external_exports.object({
|
|
@@ -12511,6 +12516,7 @@ var init_config2 = __esm({
|
|
|
12511
12516
|
subtitle: external_exports.string().optional(),
|
|
12512
12517
|
theme: external_exports.unknown().optional(),
|
|
12513
12518
|
previewBase: external_exports.record(external_exports.string()).optional(),
|
|
12519
|
+
previewPrefix: previewPrefixSchema.optional(),
|
|
12514
12520
|
// UI handler functions (runtime only, don't serialize)
|
|
12515
12521
|
onAccountClick: external_exports.function().returns(external_exports.void()).optional(),
|
|
12516
12522
|
onLogoutClick: external_exports.function().returns(external_exports.void()).optional(),
|
|
@@ -12538,6 +12544,9 @@ var init_config2 = __esm({
|
|
|
12538
12544
|
defaultRemoteUrl: defaultRemoteUrlSchema.optional(),
|
|
12539
12545
|
gitBotAuthorName: gitBotAuthorNameSchema,
|
|
12540
12546
|
gitBotAuthorEmail: gitBotAuthorEmailSchema,
|
|
12547
|
+
// Unset reads as on for Edited-by and off for Co-authored-by (services.ts submitBranch).
|
|
12548
|
+
gitEditedByTrailers: external_exports.boolean().optional(),
|
|
12549
|
+
gitCoAuthoredByTrailers: external_exports.boolean().optional(),
|
|
12541
12550
|
githubTokenEnvVar: githubTokenEnvVarSchema.optional(),
|
|
12542
12551
|
// Required by design (follow-up to SEC-C1): a prod deploy that omits `mode` must fail
|
|
12543
12552
|
// validation loudly rather than silently running header-trusting dev auth semantics.
|
|
@@ -12549,7 +12558,6 @@ var init_config2 = __esm({
|
|
|
12549
12558
|
// Default false/unset — the standard AWS Lambda+worker topology must leave this unset.
|
|
12550
12559
|
allowNetworkRemoteInProd: external_exports.boolean().optional(),
|
|
12551
12560
|
settingsBranch: external_exports.string().optional(),
|
|
12552
|
-
autoCreateSettingsPR: external_exports.boolean().optional(),
|
|
12553
12561
|
// `.optional()`, NOT bare `deploymentNameSchema`: its own `.default('prod')` would make
|
|
12554
12562
|
// `parse(undefined)` resolve to 'prod' instead of staying `undefined`, collapsing the
|
|
12555
12563
|
// env > config > modeDefault precedence chain `resolveDeploymentName`
|
|
@@ -12588,8 +12596,8 @@ var init_permissions = __esm({
|
|
|
12588
12596
|
});
|
|
12589
12597
|
|
|
12590
12598
|
// ../canopycms/src/paths/normalize.ts
|
|
12591
|
-
function normalizeFilesystemPath(
|
|
12592
|
-
return
|
|
12599
|
+
function normalizeFilesystemPath(path22) {
|
|
12600
|
+
return path22.split(/[\\/]+/).filter(Boolean).join("/");
|
|
12593
12601
|
}
|
|
12594
12602
|
var init_normalize = __esm({
|
|
12595
12603
|
"../canopycms/src/paths/normalize.ts"() {
|
|
@@ -13739,9 +13747,9 @@ var init_createPaginator = __esm({
|
|
|
13739
13747
|
command = withCommand(command) ?? command;
|
|
13740
13748
|
return await client.send(command, ...args);
|
|
13741
13749
|
};
|
|
13742
|
-
get = (fromObject,
|
|
13750
|
+
get = (fromObject, path22) => {
|
|
13743
13751
|
let cursor2 = fromObject;
|
|
13744
|
-
const pathComponents =
|
|
13752
|
+
const pathComponents = path22.split(".");
|
|
13745
13753
|
for (const step of pathComponents) {
|
|
13746
13754
|
if (!cursor2 || typeof cursor2 !== "object") {
|
|
13747
13755
|
return void 0;
|
|
@@ -14759,12 +14767,12 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
14759
14767
|
const password = request.password ?? "";
|
|
14760
14768
|
auth = `${username}:${password}`;
|
|
14761
14769
|
}
|
|
14762
|
-
let
|
|
14770
|
+
let path22 = request.path;
|
|
14763
14771
|
if (queryString) {
|
|
14764
|
-
|
|
14772
|
+
path22 += `?${queryString}`;
|
|
14765
14773
|
}
|
|
14766
14774
|
if (request.fragment) {
|
|
14767
|
-
|
|
14775
|
+
path22 += `#${request.fragment}`;
|
|
14768
14776
|
}
|
|
14769
14777
|
let hostname = request.hostname ?? "";
|
|
14770
14778
|
if (hostname[0] === "[" && hostname.endsWith("]")) {
|
|
@@ -14776,7 +14784,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
14776
14784
|
headers: request.headers,
|
|
14777
14785
|
host: hostname,
|
|
14778
14786
|
method: request.method,
|
|
14779
|
-
path:
|
|
14787
|
+
path: path22,
|
|
14780
14788
|
port: request.port,
|
|
14781
14789
|
agent,
|
|
14782
14790
|
auth
|
|
@@ -15059,16 +15067,16 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
15059
15067
|
reject(err);
|
|
15060
15068
|
};
|
|
15061
15069
|
const queryString = querystringBuilder.buildQueryString(query || {});
|
|
15062
|
-
let
|
|
15070
|
+
let path22 = request.path;
|
|
15063
15071
|
if (queryString) {
|
|
15064
|
-
|
|
15072
|
+
path22 += `?${queryString}`;
|
|
15065
15073
|
}
|
|
15066
15074
|
if (request.fragment) {
|
|
15067
|
-
|
|
15075
|
+
path22 += `#${request.fragment}`;
|
|
15068
15076
|
}
|
|
15069
15077
|
const req = session.request({
|
|
15070
15078
|
...request.headers,
|
|
15071
|
-
[http2.constants.HTTP2_HEADER_PATH]:
|
|
15079
|
+
[http2.constants.HTTP2_HEADER_PATH]: path22,
|
|
15072
15080
|
[http2.constants.HTTP2_HEADER_METHOD]: method
|
|
15073
15081
|
});
|
|
15074
15082
|
session.ref();
|
|
@@ -15255,13 +15263,13 @@ var require_dist_cjs14 = __commonJS({
|
|
|
15255
15263
|
const abortError = buildAbortError(abortSignal);
|
|
15256
15264
|
return Promise.reject(abortError);
|
|
15257
15265
|
}
|
|
15258
|
-
let
|
|
15266
|
+
let path22 = request.path;
|
|
15259
15267
|
const queryString = querystringBuilder.buildQueryString(request.query || {});
|
|
15260
15268
|
if (queryString) {
|
|
15261
|
-
|
|
15269
|
+
path22 += `?${queryString}`;
|
|
15262
15270
|
}
|
|
15263
15271
|
if (request.fragment) {
|
|
15264
|
-
|
|
15272
|
+
path22 += `#${request.fragment}`;
|
|
15265
15273
|
}
|
|
15266
15274
|
let auth = "";
|
|
15267
15275
|
if (request.username != null || request.password != null) {
|
|
@@ -15270,7 +15278,7 @@ var require_dist_cjs14 = __commonJS({
|
|
|
15270
15278
|
auth = `${username}:${password}@`;
|
|
15271
15279
|
}
|
|
15272
15280
|
const { port, method } = request;
|
|
15273
|
-
const url = `${request.protocol}//${auth}${request.hostname}${port ? `:${port}` : ""}${
|
|
15281
|
+
const url = `${request.protocol}//${auth}${request.hostname}${port ? `:${port}` : ""}${path22}`;
|
|
15274
15282
|
const body = method === "GET" || method === "HEAD" ? void 0 : request.body;
|
|
15275
15283
|
const requestOptions = {
|
|
15276
15284
|
body,
|
|
@@ -17502,13 +17510,13 @@ function __disposeResources(env) {
|
|
|
17502
17510
|
}
|
|
17503
17511
|
return next();
|
|
17504
17512
|
}
|
|
17505
|
-
function __rewriteRelativeImportExtension(
|
|
17506
|
-
if (typeof
|
|
17507
|
-
return
|
|
17513
|
+
function __rewriteRelativeImportExtension(path22, preserveJsx) {
|
|
17514
|
+
if (typeof path22 === "string" && /^\.\.?\//.test(path22)) {
|
|
17515
|
+
return path22.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m5, tsx, d5, ext, cm) {
|
|
17508
17516
|
return tsx ? preserveJsx ? ".jsx" : ".js" : d5 && (!ext || !cm) ? m5 : d5 + ext + "." + cm.toLowerCase() + "js";
|
|
17509
17517
|
});
|
|
17510
17518
|
}
|
|
17511
|
-
return
|
|
17519
|
+
return path22;
|
|
17512
17520
|
}
|
|
17513
17521
|
var extendStatics, __assign, __createBinding, __setModuleDefault, ownKeys, _SuppressedError, tslib_es6_default;
|
|
17514
17522
|
var init_tslib_es6 = __esm({
|
|
@@ -18406,11 +18414,11 @@ var init_HttpBindingProtocol = __esm({
|
|
|
18406
18414
|
const opTraits = translateTraits(operationSchema.traits);
|
|
18407
18415
|
if (opTraits.http) {
|
|
18408
18416
|
request.method = opTraits.http[0];
|
|
18409
|
-
const [
|
|
18417
|
+
const [path22, search] = opTraits.http[1].split("?");
|
|
18410
18418
|
if (request.path == "/") {
|
|
18411
|
-
request.path =
|
|
18419
|
+
request.path = path22;
|
|
18412
18420
|
} else {
|
|
18413
|
-
request.path +=
|
|
18421
|
+
request.path += path22;
|
|
18414
18422
|
}
|
|
18415
18423
|
const traitSearchParams = new URLSearchParams(search ?? "");
|
|
18416
18424
|
Object.assign(query, Object.fromEntries(traitSearchParams));
|
|
@@ -18813,8 +18821,8 @@ var init_requestBuilder = __esm({
|
|
|
18813
18821
|
return this;
|
|
18814
18822
|
}
|
|
18815
18823
|
p(memberName, labelValueProvider, uriLabel, isGreedyLabel) {
|
|
18816
|
-
this.resolvePathStack.push((
|
|
18817
|
-
this.path = resolvedPath(
|
|
18824
|
+
this.resolvePathStack.push((path22) => {
|
|
18825
|
+
this.path = resolvedPath(path22, this.input, memberName, labelValueProvider, uriLabel, isGreedyLabel);
|
|
18818
18826
|
});
|
|
18819
18827
|
return this;
|
|
18820
18828
|
}
|
|
@@ -19464,18 +19472,18 @@ var require_dist_cjs20 = __commonJS({
|
|
|
19464
19472
|
}
|
|
19465
19473
|
};
|
|
19466
19474
|
var booleanEquals = (value1, value2) => value1 === value2;
|
|
19467
|
-
var getAttrPathList = (
|
|
19468
|
-
const parts =
|
|
19475
|
+
var getAttrPathList = (path22) => {
|
|
19476
|
+
const parts = path22.split(".");
|
|
19469
19477
|
const pathList = [];
|
|
19470
19478
|
for (const part of parts) {
|
|
19471
19479
|
const squareBracketIndex = part.indexOf("[");
|
|
19472
19480
|
if (squareBracketIndex !== -1) {
|
|
19473
19481
|
if (part.indexOf("]") !== part.length - 1) {
|
|
19474
|
-
throw new EndpointError(`Path: '${
|
|
19482
|
+
throw new EndpointError(`Path: '${path22}' does not end with ']'`);
|
|
19475
19483
|
}
|
|
19476
19484
|
const arrayIndex = part.slice(squareBracketIndex + 1, -1);
|
|
19477
19485
|
if (Number.isNaN(parseInt(arrayIndex))) {
|
|
19478
|
-
throw new EndpointError(`Invalid array index: '${arrayIndex}' in path: '${
|
|
19486
|
+
throw new EndpointError(`Invalid array index: '${arrayIndex}' in path: '${path22}'`);
|
|
19479
19487
|
}
|
|
19480
19488
|
if (squareBracketIndex !== 0) {
|
|
19481
19489
|
pathList.push(part.slice(0, squareBracketIndex));
|
|
@@ -19487,9 +19495,9 @@ var require_dist_cjs20 = __commonJS({
|
|
|
19487
19495
|
}
|
|
19488
19496
|
return pathList;
|
|
19489
19497
|
};
|
|
19490
|
-
var getAttr = (value,
|
|
19498
|
+
var getAttr = (value, path22) => getAttrPathList(path22).reduce((acc, index) => {
|
|
19491
19499
|
if (typeof acc !== "object") {
|
|
19492
|
-
throw new EndpointError(`Index '${index}' in '${
|
|
19500
|
+
throw new EndpointError(`Index '${index}' in '${path22}' not found in '${JSON.stringify(value)}'`);
|
|
19493
19501
|
} else if (Array.isArray(acc)) {
|
|
19494
19502
|
return acc[parseInt(index)];
|
|
19495
19503
|
}
|
|
@@ -19508,8 +19516,8 @@ var require_dist_cjs20 = __commonJS({
|
|
|
19508
19516
|
return value;
|
|
19509
19517
|
}
|
|
19510
19518
|
if (typeof value === "object" && "hostname" in value) {
|
|
19511
|
-
const { hostname: hostname2, port, protocol: protocol2 = "", path:
|
|
19512
|
-
const url = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${
|
|
19519
|
+
const { hostname: hostname2, port, protocol: protocol2 = "", path: path22 = "", query = {} } = value;
|
|
19520
|
+
const url = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${path22}`);
|
|
19513
19521
|
url.search = Object.entries(query).map(([k6, v5]) => `${k6}=${v5}`).join("&");
|
|
19514
19522
|
return url;
|
|
19515
19523
|
}
|
|
@@ -20954,10 +20962,10 @@ ${longDate}
|
|
|
20954
20962
|
${credentialScope}
|
|
20955
20963
|
${utilHexEncoding.toHex(hashedRequest)}`;
|
|
20956
20964
|
}
|
|
20957
|
-
getCanonicalPath({ path:
|
|
20965
|
+
getCanonicalPath({ path: path22 }) {
|
|
20958
20966
|
if (this.uriEscapePath) {
|
|
20959
20967
|
const normalizedPathSegments = [];
|
|
20960
|
-
for (const pathSegment of
|
|
20968
|
+
for (const pathSegment of path22.split("/")) {
|
|
20961
20969
|
if (pathSegment?.length === 0)
|
|
20962
20970
|
continue;
|
|
20963
20971
|
if (pathSegment === ".")
|
|
@@ -20968,11 +20976,11 @@ ${utilHexEncoding.toHex(hashedRequest)}`;
|
|
|
20968
20976
|
normalizedPathSegments.push(pathSegment);
|
|
20969
20977
|
}
|
|
20970
20978
|
}
|
|
20971
|
-
const normalizedPath = `${
|
|
20979
|
+
const normalizedPath = `${path22?.startsWith("/") ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && path22?.endsWith("/") ? "/" : ""}`;
|
|
20972
20980
|
const doubleEncoded = utilUriEscape.escapeUri(normalizedPath);
|
|
20973
20981
|
return doubleEncoded.replace(/%2F/g, "/");
|
|
20974
20982
|
}
|
|
20975
|
-
return
|
|
20983
|
+
return path22;
|
|
20976
20984
|
}
|
|
20977
20985
|
validateResolvedCredentials(credentials) {
|
|
20978
20986
|
if (typeof credentials !== "object" || typeof credentials.accessKeyId !== "string" || typeof credentials.secretAccessKey !== "string") {
|
|
@@ -22276,11 +22284,11 @@ var init_SmithyRpcV2CborProtocol = __esm({
|
|
|
22276
22284
|
}
|
|
22277
22285
|
}
|
|
22278
22286
|
const { service, operation: operation2 } = (0, import_util_middleware5.getSmithyContext)(context);
|
|
22279
|
-
const
|
|
22287
|
+
const path22 = `/service/${service}/operation/${operation2}`;
|
|
22280
22288
|
if (request.path.endsWith("/")) {
|
|
22281
|
-
request.path +=
|
|
22289
|
+
request.path += path22.slice(1);
|
|
22282
22290
|
} else {
|
|
22283
|
-
request.path +=
|
|
22291
|
+
request.path += path22;
|
|
22284
22292
|
}
|
|
22285
22293
|
return request;
|
|
22286
22294
|
}
|
|
@@ -27925,14 +27933,14 @@ var require_readFile = __commonJS({
|
|
|
27925
27933
|
var promises_1 = __require("node:fs/promises");
|
|
27926
27934
|
exports.filePromises = {};
|
|
27927
27935
|
exports.fileIntercept = {};
|
|
27928
|
-
var readFile = (
|
|
27929
|
-
if (exports.fileIntercept[
|
|
27930
|
-
return exports.fileIntercept[
|
|
27936
|
+
var readFile = (path22, options) => {
|
|
27937
|
+
if (exports.fileIntercept[path22] !== void 0) {
|
|
27938
|
+
return exports.fileIntercept[path22];
|
|
27931
27939
|
}
|
|
27932
|
-
if (!exports.filePromises[
|
|
27933
|
-
exports.filePromises[
|
|
27940
|
+
if (!exports.filePromises[path22] || options?.ignoreCache) {
|
|
27941
|
+
exports.filePromises[path22] = (0, promises_1.readFile)(path22, "utf8");
|
|
27934
27942
|
}
|
|
27935
|
-
return exports.filePromises[
|
|
27943
|
+
return exports.filePromises[path22];
|
|
27936
27944
|
};
|
|
27937
27945
|
exports.readFile = readFile;
|
|
27938
27946
|
}
|
|
@@ -27945,7 +27953,7 @@ var require_dist_cjs33 = __commonJS({
|
|
|
27945
27953
|
var getHomeDir = require_getHomeDir();
|
|
27946
27954
|
var getSSOTokenFilepath = require_getSSOTokenFilepath();
|
|
27947
27955
|
var getSSOTokenFromFile = require_getSSOTokenFromFile();
|
|
27948
|
-
var
|
|
27956
|
+
var path22 = __require("path");
|
|
27949
27957
|
var types = require_dist_cjs();
|
|
27950
27958
|
var readFile = require_readFile();
|
|
27951
27959
|
var ENV_PROFILE = "AWS_PROFILE";
|
|
@@ -27967,9 +27975,9 @@ var require_dist_cjs33 = __commonJS({
|
|
|
27967
27975
|
...data2.default && { default: data2.default }
|
|
27968
27976
|
});
|
|
27969
27977
|
var ENV_CONFIG_PATH = "AWS_CONFIG_FILE";
|
|
27970
|
-
var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] ||
|
|
27978
|
+
var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || path22.join(getHomeDir.getHomeDir(), ".aws", "config");
|
|
27971
27979
|
var ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE";
|
|
27972
|
-
var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] ||
|
|
27980
|
+
var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || path22.join(getHomeDir.getHomeDir(), ".aws", "credentials");
|
|
27973
27981
|
var prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/;
|
|
27974
27982
|
var profileNameBlockList = ["__proto__", "profile __proto__"];
|
|
27975
27983
|
var parseIni = (iniData) => {
|
|
@@ -28024,11 +28032,11 @@ var require_dist_cjs33 = __commonJS({
|
|
|
28024
28032
|
const relativeHomeDirPrefix = "~/";
|
|
28025
28033
|
let resolvedFilepath = filepath;
|
|
28026
28034
|
if (filepath.startsWith(relativeHomeDirPrefix)) {
|
|
28027
|
-
resolvedFilepath =
|
|
28035
|
+
resolvedFilepath = path22.join(homeDir, filepath.slice(2));
|
|
28028
28036
|
}
|
|
28029
28037
|
let resolvedConfigFilepath = configFilepath;
|
|
28030
28038
|
if (configFilepath.startsWith(relativeHomeDirPrefix)) {
|
|
28031
|
-
resolvedConfigFilepath =
|
|
28039
|
+
resolvedConfigFilepath = path22.join(homeDir, configFilepath.slice(2));
|
|
28032
28040
|
}
|
|
28033
28041
|
const parsedFiles = await Promise.all([
|
|
28034
28042
|
readFile.readFile(resolvedConfigFilepath, {
|
|
@@ -28067,8 +28075,8 @@ var require_dist_cjs33 = __commonJS({
|
|
|
28067
28075
|
getFileRecord() {
|
|
28068
28076
|
return readFile.fileIntercept;
|
|
28069
28077
|
},
|
|
28070
|
-
interceptFile(
|
|
28071
|
-
readFile.fileIntercept[
|
|
28078
|
+
interceptFile(path23, contents) {
|
|
28079
|
+
readFile.fileIntercept[path23] = Promise.resolve(contents);
|
|
28072
28080
|
},
|
|
28073
28081
|
getTokenRecord() {
|
|
28074
28082
|
return getSSOTokenFromFile.tokenIntercept;
|
|
@@ -28393,8 +28401,8 @@ var require_dist_cjs36 = __commonJS({
|
|
|
28393
28401
|
return endpoint.url.href;
|
|
28394
28402
|
}
|
|
28395
28403
|
if ("hostname" in endpoint) {
|
|
28396
|
-
const { protocol, hostname, port, path:
|
|
28397
|
-
return `${protocol}//${hostname}${port ? ":" + port : ""}${
|
|
28404
|
+
const { protocol, hostname, port, path: path22 } = endpoint;
|
|
28405
|
+
return `${protocol}//${hostname}${port ? ":" + port : ""}${path22}`;
|
|
28398
28406
|
}
|
|
28399
28407
|
}
|
|
28400
28408
|
return endpoint;
|
|
@@ -43186,9 +43194,9 @@ var require_dist_node20 = __commonJS({
|
|
|
43186
43194
|
"[@octokit/auth-app] installationId is set to a falsy value"
|
|
43187
43195
|
);
|
|
43188
43196
|
}
|
|
43189
|
-
const
|
|
43190
|
-
if (typeof
|
|
43191
|
-
|
|
43197
|
+
const log8 = options.log || {};
|
|
43198
|
+
if (typeof log8.warn !== "function") {
|
|
43199
|
+
log8.warn = console.warn.bind(console);
|
|
43192
43200
|
}
|
|
43193
43201
|
const request = options.request || import_request.request.defaults({
|
|
43194
43202
|
headers: {
|
|
@@ -43203,7 +43211,7 @@ var require_dist_node20 = __commonJS({
|
|
|
43203
43211
|
options,
|
|
43204
43212
|
options.installationId ? { installationId: Number(options.installationId) } : {},
|
|
43205
43213
|
{
|
|
43206
|
-
log:
|
|
43214
|
+
log: log8,
|
|
43207
43215
|
oauthApp: (0, import_auth_oauth_app.createOAuthAppAuth)({
|
|
43208
43216
|
clientType: "github-app",
|
|
43209
43217
|
clientId: options.clientId || "",
|
|
@@ -43220,8 +43228,8 @@ var require_dist_node20 = __commonJS({
|
|
|
43220
43228
|
});
|
|
43221
43229
|
|
|
43222
43230
|
// ../canopycms/src/worker/cms-worker.ts
|
|
43223
|
-
import
|
|
43224
|
-
import
|
|
43231
|
+
import fs16 from "node:fs/promises";
|
|
43232
|
+
import path19 from "node:path";
|
|
43225
43233
|
|
|
43226
43234
|
// ../../node_modules/.pnpm/simple-git@3.36.0/node_modules/simple-git/dist/esm/index.js
|
|
43227
43235
|
var import_file_exists = __toESM(require_dist(), 1);
|
|
@@ -43812,8 +43820,8 @@ function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
|
|
|
43812
43820
|
function forEachLineWithContent(input, callback) {
|
|
43813
43821
|
return toLinesWithContent(input, true).map((line) => callback(line));
|
|
43814
43822
|
}
|
|
43815
|
-
function folderExists(
|
|
43816
|
-
return (0, import_file_exists.exists)(
|
|
43823
|
+
function folderExists(path22) {
|
|
43824
|
+
return (0, import_file_exists.exists)(path22, import_file_exists.FOLDER);
|
|
43817
43825
|
}
|
|
43818
43826
|
function append(target, item) {
|
|
43819
43827
|
if (Array.isArray(target)) {
|
|
@@ -44215,8 +44223,8 @@ function checkIsRepoRootTask() {
|
|
|
44215
44223
|
commands: commands5,
|
|
44216
44224
|
format: "utf-8",
|
|
44217
44225
|
onError,
|
|
44218
|
-
parser(
|
|
44219
|
-
return /^\.(git)?$/.test(
|
|
44226
|
+
parser(path22) {
|
|
44227
|
+
return /^\.(git)?$/.test(path22.trim());
|
|
44220
44228
|
}
|
|
44221
44229
|
};
|
|
44222
44230
|
}
|
|
@@ -44650,11 +44658,11 @@ function parseGrep(grep) {
|
|
|
44650
44658
|
const paths = /* @__PURE__ */ new Set();
|
|
44651
44659
|
const results = {};
|
|
44652
44660
|
forEachLineWithContent(grep, (input) => {
|
|
44653
|
-
const [
|
|
44654
|
-
paths.add(
|
|
44655
|
-
(results[
|
|
44661
|
+
const [path22, line, preview] = input.split(NULL);
|
|
44662
|
+
paths.add(path22);
|
|
44663
|
+
(results[path22] = results[path22] || []).push({
|
|
44656
44664
|
line: asNumber(line),
|
|
44657
|
-
path:
|
|
44665
|
+
path: path22,
|
|
44658
44666
|
preview
|
|
44659
44667
|
});
|
|
44660
44668
|
});
|
|
@@ -45164,11 +45172,11 @@ function taskCallback(task, response, callback = NOOP) {
|
|
|
45164
45172
|
response.then(onSuccess, onError2);
|
|
45165
45173
|
}
|
|
45166
45174
|
function addDeprecationNoticeToError(err) {
|
|
45167
|
-
let
|
|
45175
|
+
let log8 = (name) => {
|
|
45168
45176
|
console.warn(
|
|
45169
45177
|
`simple-git deprecation notice: accessing GitResponseError.${name} should be GitResponseError.git.${name}, this will no longer be available in version 3`
|
|
45170
45178
|
);
|
|
45171
|
-
|
|
45179
|
+
log8 = NOOP;
|
|
45172
45180
|
};
|
|
45173
45181
|
return Object.create(err, Object.getOwnPropertyNames(err.git).reduce(descriptorReducer, {}));
|
|
45174
45182
|
function descriptorReducer(all, name) {
|
|
@@ -45179,7 +45187,7 @@ function addDeprecationNoticeToError(err) {
|
|
|
45179
45187
|
enumerable: false,
|
|
45180
45188
|
configurable: false,
|
|
45181
45189
|
get() {
|
|
45182
|
-
|
|
45190
|
+
log8(name);
|
|
45183
45191
|
return err.git[name];
|
|
45184
45192
|
}
|
|
45185
45193
|
};
|
|
@@ -45418,14 +45426,14 @@ var init_hash_object = __esm2({
|
|
|
45418
45426
|
init_task();
|
|
45419
45427
|
}
|
|
45420
45428
|
});
|
|
45421
|
-
function parseInit(bare,
|
|
45429
|
+
function parseInit(bare, path22, text) {
|
|
45422
45430
|
const response = String(text).trim();
|
|
45423
45431
|
let result;
|
|
45424
45432
|
if (result = initResponseRegex.exec(response)) {
|
|
45425
|
-
return new InitSummary(bare,
|
|
45433
|
+
return new InitSummary(bare, path22, false, result[1]);
|
|
45426
45434
|
}
|
|
45427
45435
|
if (result = reInitResponseRegex.exec(response)) {
|
|
45428
|
-
return new InitSummary(bare,
|
|
45436
|
+
return new InitSummary(bare, path22, true, result[1]);
|
|
45429
45437
|
}
|
|
45430
45438
|
let gitDir = "";
|
|
45431
45439
|
const tokens = response.split(" ");
|
|
@@ -45436,7 +45444,7 @@ function parseInit(bare, path20, text) {
|
|
|
45436
45444
|
break;
|
|
45437
45445
|
}
|
|
45438
45446
|
}
|
|
45439
|
-
return new InitSummary(bare,
|
|
45447
|
+
return new InitSummary(bare, path22, /^re/i.test(response), gitDir);
|
|
45440
45448
|
}
|
|
45441
45449
|
var InitSummary;
|
|
45442
45450
|
var initResponseRegex;
|
|
@@ -45445,9 +45453,9 @@ var init_InitSummary = __esm2({
|
|
|
45445
45453
|
"src/lib/responses/InitSummary.ts"() {
|
|
45446
45454
|
"use strict";
|
|
45447
45455
|
InitSummary = class {
|
|
45448
|
-
constructor(bare,
|
|
45456
|
+
constructor(bare, path22, existing, gitDir) {
|
|
45449
45457
|
this.bare = bare;
|
|
45450
|
-
this.path =
|
|
45458
|
+
this.path = path22;
|
|
45451
45459
|
this.existing = existing;
|
|
45452
45460
|
this.gitDir = gitDir;
|
|
45453
45461
|
}
|
|
@@ -45459,7 +45467,7 @@ var init_InitSummary = __esm2({
|
|
|
45459
45467
|
function hasBareCommand(command) {
|
|
45460
45468
|
return command.includes(bareCommand);
|
|
45461
45469
|
}
|
|
45462
|
-
function initTask(bare = false,
|
|
45470
|
+
function initTask(bare = false, path22, customArgs) {
|
|
45463
45471
|
const commands5 = ["init", ...customArgs];
|
|
45464
45472
|
if (bare && !hasBareCommand(commands5)) {
|
|
45465
45473
|
commands5.splice(1, 0, bareCommand);
|
|
@@ -45468,7 +45476,7 @@ function initTask(bare = false, path20, customArgs) {
|
|
|
45468
45476
|
commands: commands5,
|
|
45469
45477
|
format: "utf-8",
|
|
45470
45478
|
parser(text) {
|
|
45471
|
-
return parseInit(commands5.includes("--bare"),
|
|
45479
|
+
return parseInit(commands5.includes("--bare"), path22, text);
|
|
45472
45480
|
}
|
|
45473
45481
|
};
|
|
45474
45482
|
}
|
|
@@ -46283,12 +46291,12 @@ var init_FileStatusSummary = __esm2({
|
|
|
46283
46291
|
"use strict";
|
|
46284
46292
|
fromPathRegex = /^(.+)\0(.+)$/;
|
|
46285
46293
|
FileStatusSummary = class {
|
|
46286
|
-
constructor(
|
|
46287
|
-
this.path =
|
|
46294
|
+
constructor(path22, index, working_dir) {
|
|
46295
|
+
this.path = path22;
|
|
46288
46296
|
this.index = index;
|
|
46289
46297
|
this.working_dir = working_dir;
|
|
46290
46298
|
if (index === "R" || working_dir === "R") {
|
|
46291
|
-
const detail = fromPathRegex.exec(
|
|
46299
|
+
const detail = fromPathRegex.exec(path22) || [null, path22, path22];
|
|
46292
46300
|
this.from = detail[2] || "";
|
|
46293
46301
|
this.path = detail[1] || "";
|
|
46294
46302
|
}
|
|
@@ -46319,14 +46327,14 @@ function splitLine(result, lineStr) {
|
|
|
46319
46327
|
default:
|
|
46320
46328
|
return;
|
|
46321
46329
|
}
|
|
46322
|
-
function data2(index, workingDir,
|
|
46330
|
+
function data2(index, workingDir, path22) {
|
|
46323
46331
|
const raw = `${index}${workingDir}`;
|
|
46324
46332
|
const handler = parsers6.get(raw);
|
|
46325
46333
|
if (handler) {
|
|
46326
|
-
handler(result,
|
|
46334
|
+
handler(result, path22);
|
|
46327
46335
|
}
|
|
46328
46336
|
if (raw !== "##" && raw !== "!!") {
|
|
46329
|
-
result.files.push(new FileStatusSummary(
|
|
46337
|
+
result.files.push(new FileStatusSummary(path22, index, workingDir));
|
|
46330
46338
|
}
|
|
46331
46339
|
}
|
|
46332
46340
|
}
|
|
@@ -46677,9 +46685,9 @@ var init_simple_git_api = __esm2({
|
|
|
46677
46685
|
next
|
|
46678
46686
|
);
|
|
46679
46687
|
}
|
|
46680
|
-
hashObject(
|
|
46688
|
+
hashObject(path22, write) {
|
|
46681
46689
|
return this._runTask(
|
|
46682
|
-
hashObjectTask(
|
|
46690
|
+
hashObjectTask(path22, write === true),
|
|
46683
46691
|
trailingFunctionArgument(arguments)
|
|
46684
46692
|
);
|
|
46685
46693
|
}
|
|
@@ -47033,8 +47041,8 @@ var init_branch = __esm2({
|
|
|
47033
47041
|
}
|
|
47034
47042
|
});
|
|
47035
47043
|
function toPath(input) {
|
|
47036
|
-
const
|
|
47037
|
-
return
|
|
47044
|
+
const path22 = input.trim().replace(/^["']|["']$/g, "");
|
|
47045
|
+
return path22 && normalize(path22);
|
|
47038
47046
|
}
|
|
47039
47047
|
var parseCheckIgnore;
|
|
47040
47048
|
var init_CheckIgnore = __esm2({
|
|
@@ -47319,8 +47327,8 @@ __export2(sub_module_exports, {
|
|
|
47319
47327
|
subModuleTask: () => subModuleTask,
|
|
47320
47328
|
updateSubModuleTask: () => updateSubModuleTask
|
|
47321
47329
|
});
|
|
47322
|
-
function addSubModuleTask(repo,
|
|
47323
|
-
return subModuleTask(["add", repo,
|
|
47330
|
+
function addSubModuleTask(repo, path22) {
|
|
47331
|
+
return subModuleTask(["add", repo, path22]);
|
|
47324
47332
|
}
|
|
47325
47333
|
function initSubModuleTask(customArgs) {
|
|
47326
47334
|
return subModuleTask(["init", ...customArgs]);
|
|
@@ -47634,8 +47642,8 @@ var require_git = __commonJS2({
|
|
|
47634
47642
|
}
|
|
47635
47643
|
return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
|
|
47636
47644
|
};
|
|
47637
|
-
Git2.prototype.submoduleAdd = function(repo,
|
|
47638
|
-
return this._runTask(addSubModuleTask2(repo,
|
|
47645
|
+
Git2.prototype.submoduleAdd = function(repo, path22, then) {
|
|
47646
|
+
return this._runTask(addSubModuleTask2(repo, path22), trailingFunctionArgument2(arguments));
|
|
47639
47647
|
};
|
|
47640
47648
|
Git2.prototype.submoduleUpdate = function(args, then) {
|
|
47641
47649
|
return this._runTask(
|
|
@@ -48243,6 +48251,10 @@ var DebugLogger = class {
|
|
|
48243
48251
|
throw new Error(errorMsg);
|
|
48244
48252
|
}
|
|
48245
48253
|
}
|
|
48254
|
+
/**
|
|
48255
|
+
* Keyed by label alone, so two overlapping timers with one label overwrite each other;
|
|
48256
|
+
* anything that can run concurrently uses {@link timed}.
|
|
48257
|
+
*/
|
|
48246
48258
|
time(label) {
|
|
48247
48259
|
this.timers.set(label, Date.now());
|
|
48248
48260
|
}
|
|
@@ -48257,12 +48269,16 @@ var DebugLogger = class {
|
|
|
48257
48269
|
this.debug(category, `${label} completed`, { durationMs: duration });
|
|
48258
48270
|
return duration;
|
|
48259
48271
|
}
|
|
48272
|
+
/**
|
|
48273
|
+
* Log `<label> completed {durationMs}` once `fn` settles. The start time is local to the
|
|
48274
|
+
* call, so concurrent spans with the same label on one logger never overwrite each other.
|
|
48275
|
+
*/
|
|
48260
48276
|
async timed(category, label, fn) {
|
|
48261
|
-
|
|
48277
|
+
const start = Date.now();
|
|
48262
48278
|
try {
|
|
48263
48279
|
return await fn();
|
|
48264
48280
|
} finally {
|
|
48265
|
-
this.
|
|
48281
|
+
this.debug(category, `${label} completed`, { durationMs: Date.now() - start });
|
|
48266
48282
|
}
|
|
48267
48283
|
}
|
|
48268
48284
|
};
|
|
@@ -48643,6 +48659,27 @@ function isFileExistsError(err) {
|
|
|
48643
48659
|
|
|
48644
48660
|
// ../canopycms/src/github-service.ts
|
|
48645
48661
|
init_logger();
|
|
48662
|
+
|
|
48663
|
+
// ../canopycms/src/submission-attribution.ts
|
|
48664
|
+
init_logger();
|
|
48665
|
+
var PR_SECTION_START = "<!-- canopycms:submission:start -->";
|
|
48666
|
+
var PR_SECTION_END = "<!-- canopycms:submission:end -->";
|
|
48667
|
+
function mergePrSection(existing, section) {
|
|
48668
|
+
const body = existing ?? "";
|
|
48669
|
+
for (let end = body.indexOf(PR_SECTION_END); end >= 0; ) {
|
|
48670
|
+
const start = body.lastIndexOf(PR_SECTION_START, end - PR_SECTION_START.length);
|
|
48671
|
+
if (start >= 0) {
|
|
48672
|
+
return body.slice(0, start) + section + body.slice(end + PR_SECTION_END.length);
|
|
48673
|
+
}
|
|
48674
|
+
end = body.indexOf(PR_SECTION_END, end + PR_SECTION_END.length);
|
|
48675
|
+
}
|
|
48676
|
+
const human = body.split(PR_SECTION_START).join("").split(PR_SECTION_END).join("").trimEnd();
|
|
48677
|
+
return human ? `${human}
|
|
48678
|
+
|
|
48679
|
+
${section}` : section;
|
|
48680
|
+
}
|
|
48681
|
+
|
|
48682
|
+
// ../canopycms/src/github-service.ts
|
|
48646
48683
|
var ThrottledOctokit = import_rest.Octokit.plugin(import_plugin_throttling.throttling);
|
|
48647
48684
|
var shouldRetryRateLimit = (retryAfter, retryCount) => retryCount < 2 && retryAfter <= 60;
|
|
48648
48685
|
var shouldRetrySecondaryRateLimit = (retryAfter, retryCount) => retryCount < 1 && retryAfter <= 60;
|
|
@@ -48668,6 +48705,7 @@ function createCanopyOctokit(options) {
|
|
|
48668
48705
|
}
|
|
48669
48706
|
async function createOrUpdatePullRequest(params) {
|
|
48670
48707
|
const { octokit, owner, repo, head, base, title, body, markReadyIfDraft, signal } = params;
|
|
48708
|
+
const mergeSection = params.mergeSectionIntoBody === true;
|
|
48671
48709
|
const requestOption = signal ? { request: { signal } } : {};
|
|
48672
48710
|
const existingPRs = await octokit.pulls.list({
|
|
48673
48711
|
owner,
|
|
@@ -48692,7 +48730,7 @@ async function createOrUpdatePullRequest(params) {
|
|
|
48692
48730
|
repo,
|
|
48693
48731
|
pull_number: existing.number,
|
|
48694
48732
|
title,
|
|
48695
|
-
body,
|
|
48733
|
+
body: mergeSection ? mergePrSection(existing.body, body) : body,
|
|
48696
48734
|
...requestOption
|
|
48697
48735
|
});
|
|
48698
48736
|
if (markReadyIfDraft && existing.draft) {
|
|
@@ -48893,19 +48931,35 @@ function sanitizeBranchName(branchName) {
|
|
|
48893
48931
|
return trimmedDots || "branch";
|
|
48894
48932
|
}
|
|
48895
48933
|
var RESERVED_SETTINGS_BRANCH_PREFIX = "canopycms-settings-";
|
|
48934
|
+
function isSettingsBranchName(branchName, settingsBranchName) {
|
|
48935
|
+
const sanitized = sanitizeBranchName(branchName);
|
|
48936
|
+
return sanitized.startsWith(RESERVED_SETTINGS_BRANCH_PREFIX) || settingsBranchName !== void 0 && sanitized === sanitizeBranchName(settingsBranchName);
|
|
48937
|
+
}
|
|
48896
48938
|
|
|
48897
48939
|
// ../canopycms/src/worker/cms-worker.ts
|
|
48898
48940
|
init_deployment_name();
|
|
48899
48941
|
|
|
48900
48942
|
// ../canopycms/src/task-queue/worker-status.ts
|
|
48943
|
+
import fs3 from "node:fs/promises";
|
|
48901
48944
|
import path4 from "node:path";
|
|
48902
48945
|
var WORKER_STATUS_FILE = "worker-status.json";
|
|
48946
|
+
async function readLastFatalError(taskDir) {
|
|
48947
|
+
try {
|
|
48948
|
+
const content = await fs3.readFile(path4.join(taskDir, WORKER_STATUS_FILE), "utf-8");
|
|
48949
|
+
return JSON.parse(content).lastFatalError;
|
|
48950
|
+
} catch {
|
|
48951
|
+
return void 0;
|
|
48952
|
+
}
|
|
48953
|
+
}
|
|
48903
48954
|
async function writeWorkerStatus(taskDir, report) {
|
|
48904
48955
|
const filePath = path4.join(taskDir, WORKER_STATUS_FILE);
|
|
48905
48956
|
const stamped = { ...report, updatedAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
48906
48957
|
await atomicWriteFile(filePath, JSON.stringify(stamped, null, 2));
|
|
48907
48958
|
}
|
|
48908
48959
|
|
|
48960
|
+
// ../canopycms/src/version.ts
|
|
48961
|
+
var CANOPYCMS_VERSION = "0.0.68-int.94";
|
|
48962
|
+
|
|
48909
48963
|
// ../canopycms/src/worker/log.ts
|
|
48910
48964
|
init_logger();
|
|
48911
48965
|
function timestamp() {
|
|
@@ -48925,18 +48979,18 @@ function installWorkerLogger() {
|
|
|
48925
48979
|
}
|
|
48926
48980
|
|
|
48927
48981
|
// ../canopycms/src/worker/task-runner.ts
|
|
48928
|
-
import
|
|
48982
|
+
import fs12 from "node:fs/promises";
|
|
48929
48983
|
|
|
48930
48984
|
// ../canopycms/src/branch-metadata.ts
|
|
48931
|
-
import
|
|
48985
|
+
import fs8 from "node:fs/promises";
|
|
48932
48986
|
import path9 from "node:path";
|
|
48933
48987
|
|
|
48934
48988
|
// ../canopycms/src/branch-registry.ts
|
|
48935
|
-
import
|
|
48989
|
+
import fs6 from "node:fs/promises";
|
|
48936
48990
|
import path7 from "node:path";
|
|
48937
48991
|
|
|
48938
48992
|
// ../canopycms/src/branch-metadata-file.ts
|
|
48939
|
-
import
|
|
48993
|
+
import fs4 from "node:fs/promises";
|
|
48940
48994
|
import path5 from "node:path";
|
|
48941
48995
|
var BRANCH_META_DIR = ".canopy-meta";
|
|
48942
48996
|
var BRANCH_META_FILE = "branch.json";
|
|
@@ -48952,7 +49006,7 @@ var branchMetadataFilePath = (branchRoot) => path5.join(path5.resolve(branchRoot
|
|
|
48952
49006
|
async function readBranchMetadataFile(branchRoot) {
|
|
48953
49007
|
const resolvedRoot = path5.resolve(branchRoot);
|
|
48954
49008
|
try {
|
|
48955
|
-
const raw = await
|
|
49009
|
+
const raw = await fs4.readFile(branchMetadataFilePath(resolvedRoot), "utf8");
|
|
48956
49010
|
return JSON.parse(raw);
|
|
48957
49011
|
} catch (err) {
|
|
48958
49012
|
if (isNotFoundError2(err)) {
|
|
@@ -48969,7 +49023,7 @@ async function readBranchMetadataFile(branchRoot) {
|
|
|
48969
49023
|
init_logger();
|
|
48970
49024
|
|
|
48971
49025
|
// ../canopycms/src/resource-generation.ts
|
|
48972
|
-
import
|
|
49026
|
+
import fs5 from "node:fs/promises";
|
|
48973
49027
|
import path6 from "node:path";
|
|
48974
49028
|
import { randomUUID } from "node:crypto";
|
|
48975
49029
|
var log = createDebugLogger({ prefix: "ResourceGeneration" });
|
|
@@ -48992,7 +49046,7 @@ async function bumpResourceGeneration(root, resource, options) {
|
|
|
48992
49046
|
}
|
|
48993
49047
|
async function readResourceGeneration(root, resource) {
|
|
48994
49048
|
try {
|
|
48995
|
-
const token = await
|
|
49049
|
+
const token = await fs5.readFile(resourceGenerationPath(root, resource), "utf-8");
|
|
48996
49050
|
return { ok: true, token };
|
|
48997
49051
|
} catch (err) {
|
|
48998
49052
|
if (isNodeError(err) && err.code === "ENOENT") return { ok: true, token: null };
|
|
@@ -49032,7 +49086,7 @@ var BranchRegistry = class {
|
|
|
49032
49086
|
async list() {
|
|
49033
49087
|
let parsed;
|
|
49034
49088
|
try {
|
|
49035
|
-
const raw = await
|
|
49089
|
+
const raw = await fs6.readFile(this.registryPath, "utf8");
|
|
49036
49090
|
parsed = JSON.parse(raw);
|
|
49037
49091
|
} catch (err) {
|
|
49038
49092
|
if (isNotFoundError2(err)) {
|
|
@@ -49109,7 +49163,7 @@ var BranchRegistry = class {
|
|
|
49109
49163
|
async performRegenerate() {
|
|
49110
49164
|
const read = await readResourceGeneration(this.root, RESOURCE);
|
|
49111
49165
|
const branches = await this.scanBranchDirectories();
|
|
49112
|
-
await
|
|
49166
|
+
await fs6.unlink(this.stalePath).catch(() => {
|
|
49113
49167
|
});
|
|
49114
49168
|
if (!read.ok) {
|
|
49115
49169
|
return branches;
|
|
@@ -49120,12 +49174,12 @@ var BranchRegistry = class {
|
|
|
49120
49174
|
generation: read.token
|
|
49121
49175
|
};
|
|
49122
49176
|
const uniqueTempPath = `${this.tempPath}.${Date.now()}.${Math.random().toString(36).slice(2)}`;
|
|
49123
|
-
await
|
|
49124
|
-
await
|
|
49177
|
+
await fs6.mkdir(this.root, { recursive: true });
|
|
49178
|
+
await fs6.writeFile(uniqueTempPath, JSON.stringify(snapshot, null, 2) + "\n", "utf8");
|
|
49125
49179
|
try {
|
|
49126
|
-
await
|
|
49180
|
+
await fs6.rename(uniqueTempPath, this.registryPath);
|
|
49127
49181
|
} catch (err) {
|
|
49128
|
-
await
|
|
49182
|
+
await fs6.unlink(uniqueTempPath).catch(() => {
|
|
49129
49183
|
});
|
|
49130
49184
|
throw err;
|
|
49131
49185
|
}
|
|
@@ -49139,7 +49193,7 @@ var BranchRegistry = class {
|
|
|
49139
49193
|
async scanBranchDirectories() {
|
|
49140
49194
|
const branches = [];
|
|
49141
49195
|
try {
|
|
49142
|
-
const entries = await
|
|
49196
|
+
const entries = await fs6.readdir(this.root, { withFileTypes: true });
|
|
49143
49197
|
for (const entry of entries) {
|
|
49144
49198
|
if (!entry.isDirectory() || entry.name.startsWith(".")) {
|
|
49145
49199
|
continue;
|
|
@@ -49207,7 +49261,7 @@ async function withLock(key, fn) {
|
|
|
49207
49261
|
|
|
49208
49262
|
// ../canopycms/src/utils/occ-json-write.ts
|
|
49209
49263
|
var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
|
|
49210
|
-
import
|
|
49264
|
+
import fs7 from "node:fs/promises";
|
|
49211
49265
|
import path8 from "node:path";
|
|
49212
49266
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
49213
49267
|
var log3 = createDebugLogger({ prefix: "OccJsonWrite" });
|
|
@@ -49224,28 +49278,28 @@ async function writeOccJsonFile(filePath, payload2, options) {
|
|
|
49224
49278
|
const data2 = { ...payload2, version: newVersion, writeId };
|
|
49225
49279
|
const content = JSON.stringify(data2, null, 2) + (trailingNewline ? "\n" : "");
|
|
49226
49280
|
const dir = path8.dirname(filePath);
|
|
49227
|
-
await
|
|
49281
|
+
await fs7.mkdir(dir, { recursive: true });
|
|
49228
49282
|
const tempPath = `${filePath}.${Date.now()}.${Math.random().toString(36).slice(2)}.tmp`;
|
|
49229
|
-
await
|
|
49283
|
+
await fs7.writeFile(tempPath, content, "utf-8");
|
|
49230
49284
|
if (expectedVersion === null) {
|
|
49231
49285
|
try {
|
|
49232
|
-
await
|
|
49286
|
+
await fs7.link(tempPath, filePath);
|
|
49233
49287
|
} catch (err) {
|
|
49234
|
-
await
|
|
49288
|
+
await fs7.unlink(tempPath).catch(() => {
|
|
49235
49289
|
});
|
|
49236
49290
|
if (isFileExistsError(err)) {
|
|
49237
49291
|
throw new OccWriteConflictError();
|
|
49238
49292
|
}
|
|
49239
49293
|
throw err;
|
|
49240
49294
|
}
|
|
49241
|
-
await
|
|
49295
|
+
await fs7.unlink(tempPath).catch(() => {
|
|
49242
49296
|
});
|
|
49243
49297
|
return { version: newVersion, writeId };
|
|
49244
49298
|
}
|
|
49245
49299
|
try {
|
|
49246
49300
|
let currentVersion = null;
|
|
49247
49301
|
try {
|
|
49248
|
-
const current = JSON.parse(await
|
|
49302
|
+
const current = JSON.parse(await fs7.readFile(filePath, "utf-8"));
|
|
49249
49303
|
currentVersion = current.version ?? 0;
|
|
49250
49304
|
} catch {
|
|
49251
49305
|
currentVersion = null;
|
|
@@ -49253,16 +49307,16 @@ async function writeOccJsonFile(filePath, payload2, options) {
|
|
|
49253
49307
|
if (currentVersion !== expectedVersion) {
|
|
49254
49308
|
throw new OccWriteConflictError();
|
|
49255
49309
|
}
|
|
49256
|
-
await
|
|
49310
|
+
await fs7.rename(tempPath, filePath);
|
|
49257
49311
|
if (settleMs > 0) {
|
|
49258
49312
|
await new Promise((resolve2) => setTimeout(resolve2, settleMs));
|
|
49259
49313
|
}
|
|
49260
|
-
const afterWrite = JSON.parse(await
|
|
49314
|
+
const afterWrite = JSON.parse(await fs7.readFile(filePath, "utf-8"));
|
|
49261
49315
|
if (afterWrite.writeId !== writeId) {
|
|
49262
49316
|
throw new OccWriteConflictError();
|
|
49263
49317
|
}
|
|
49264
49318
|
} catch (err) {
|
|
49265
|
-
await
|
|
49319
|
+
await fs7.unlink(tempPath).catch(() => {
|
|
49266
49320
|
});
|
|
49267
49321
|
throw err;
|
|
49268
49322
|
}
|
|
@@ -49289,7 +49343,7 @@ async function withOccRetry(operation2, options) {
|
|
|
49289
49343
|
}
|
|
49290
49344
|
async function withOccFileLock(filePath, fn) {
|
|
49291
49345
|
const dir = path8.dirname(filePath);
|
|
49292
|
-
await
|
|
49346
|
+
await fs7.mkdir(dir, { recursive: true });
|
|
49293
49347
|
const MAX_ATTEMPTS = 14;
|
|
49294
49348
|
let release = null;
|
|
49295
49349
|
for (let attempt = 1; release === null; attempt++) {
|
|
@@ -49359,7 +49413,7 @@ var BranchMetadataFileManager = class _BranchMetadataFileManager {
|
|
|
49359
49413
|
}
|
|
49360
49414
|
async load() {
|
|
49361
49415
|
try {
|
|
49362
|
-
const raw = await
|
|
49416
|
+
const raw = await fs8.readFile(this.filePath, "utf8");
|
|
49363
49417
|
const parsed = JSON.parse(raw);
|
|
49364
49418
|
const version = parsed.version ?? 0;
|
|
49365
49419
|
return { meta: parsed, version };
|
|
@@ -49413,7 +49467,7 @@ var BranchMetadataFileManager = class _BranchMetadataFileManager {
|
|
|
49413
49467
|
*/
|
|
49414
49468
|
async save(incoming) {
|
|
49415
49469
|
try {
|
|
49416
|
-
await
|
|
49470
|
+
await fs8.stat(this.branchRoot);
|
|
49417
49471
|
} catch (err) {
|
|
49418
49472
|
if (isNotFoundError2(err)) {
|
|
49419
49473
|
throw new BranchMetadataConflictError("Branch no longer exists");
|
|
@@ -49493,6 +49547,10 @@ var getBranchMetadataFileManager = (branchRoot, baseRoot, options) => {
|
|
|
49493
49547
|
return BranchMetadataFileManager.get(branchRoot, baseRoot, options);
|
|
49494
49548
|
};
|
|
49495
49549
|
|
|
49550
|
+
// ../canopycms/src/git-manager.ts
|
|
49551
|
+
import fs11 from "node:fs/promises";
|
|
49552
|
+
import path13 from "node:path";
|
|
49553
|
+
|
|
49496
49554
|
// ../canopycms/src/content-index-registry.ts
|
|
49497
49555
|
import path10 from "node:path";
|
|
49498
49556
|
var registry = /* @__PURE__ */ new Map();
|
|
@@ -49588,22 +49646,13 @@ var STATIC_DEPLOY_USER = Object.freeze({
|
|
|
49588
49646
|
name: "Static Deploy"
|
|
49589
49647
|
});
|
|
49590
49648
|
|
|
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
|
-
}
|
|
49649
|
+
// ../canopycms/src/utils/request-timing.ts
|
|
49650
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
49651
|
+
var storage = new AsyncLocalStorage();
|
|
49652
|
+
var log4 = createDebugLogger({ prefix: "CanopyCMS" });
|
|
49604
49653
|
|
|
49605
49654
|
// ../canopycms/src/utils/git.ts
|
|
49606
|
-
import
|
|
49655
|
+
import fs9 from "node:fs/promises";
|
|
49607
49656
|
import path11 from "node:path";
|
|
49608
49657
|
var REJECTED_MARKER = "[rejected]";
|
|
49609
49658
|
var NON_FAST_FORWARD_REASONS = ["non-fast-forward", "fetch first"];
|
|
@@ -49616,17 +49665,21 @@ var STALE_LEASE_REASON = "stale info";
|
|
|
49616
49665
|
function isStaleLeaseRejection(message) {
|
|
49617
49666
|
return message.includes(REJECTED_MARKER) && message.includes(STALE_LEASE_REASON);
|
|
49618
49667
|
}
|
|
49668
|
+
var WORKFLOW_REFUSAL_PATTERN = /refusing to allow an? [^`\n]+? to create or update workflow `([^`\n]+)`/;
|
|
49669
|
+
function workflowPushRefusalFile(message) {
|
|
49670
|
+
return WORKFLOW_REFUSAL_PATTERN.exec(message)?.[1] ?? null;
|
|
49671
|
+
}
|
|
49619
49672
|
async function resolveGitDir(repoPath) {
|
|
49620
49673
|
const dotGit = path11.join(repoPath, ".git");
|
|
49621
49674
|
let stat;
|
|
49622
49675
|
try {
|
|
49623
|
-
stat = await
|
|
49676
|
+
stat = await fs9.stat(dotGit);
|
|
49624
49677
|
} catch {
|
|
49625
49678
|
return null;
|
|
49626
49679
|
}
|
|
49627
49680
|
if (stat.isDirectory()) return dotGit;
|
|
49628
49681
|
try {
|
|
49629
|
-
const pointer = await
|
|
49682
|
+
const pointer = await fs9.readFile(dotGit, "utf-8");
|
|
49630
49683
|
const match2 = /^gitdir:\s*(.+)$/m.exec(pointer);
|
|
49631
49684
|
if (!match2) return null;
|
|
49632
49685
|
const target = match2[1].trim();
|
|
@@ -49635,28 +49688,50 @@ async function resolveGitDir(repoPath) {
|
|
|
49635
49688
|
return null;
|
|
49636
49689
|
}
|
|
49637
49690
|
}
|
|
49691
|
+
var CANOPY_META_DIR = ".canopy-meta";
|
|
49692
|
+
function isCanopyInternalPath(repoRelativePath) {
|
|
49693
|
+
return repoRelativePath === CANOPY_META_DIR || repoRelativePath.startsWith(`${CANOPY_META_DIR}/`);
|
|
49694
|
+
}
|
|
49638
49695
|
async function isRebaseInProgress(repoPath) {
|
|
49639
49696
|
const gitDir = await resolveGitDir(repoPath);
|
|
49640
49697
|
if (!gitDir) return false;
|
|
49641
49698
|
const results = await Promise.all(
|
|
49642
49699
|
["rebase-merge", "rebase-apply"].map(
|
|
49643
|
-
(dir) =>
|
|
49700
|
+
(dir) => fs9.stat(path11.join(gitDir, dir)).then(() => true).catch(() => false)
|
|
49644
49701
|
)
|
|
49645
49702
|
);
|
|
49646
49703
|
return results.some(Boolean);
|
|
49647
49704
|
}
|
|
49648
49705
|
|
|
49706
|
+
// ../canopycms/src/branch-schema-cache.ts
|
|
49707
|
+
var SCHEMA_CACHE_FILE = "schema-cache.json";
|
|
49708
|
+
var SCHEMA_GENERATION_RESOURCE = "schema";
|
|
49709
|
+
|
|
49710
|
+
// ../canopycms/src/content-index-generation.ts
|
|
49711
|
+
var RESOURCE2 = "content-index";
|
|
49712
|
+
async function bumpContentIndexGeneration(root) {
|
|
49713
|
+
return bumpResourceGeneration(root, RESOURCE2);
|
|
49714
|
+
}
|
|
49715
|
+
async function invalidateBranchContentCaches(root) {
|
|
49716
|
+
await bumpContentIndexGeneration(root);
|
|
49717
|
+
await bumpResourceGeneration(root, SCHEMA_GENERATION_RESOURCE);
|
|
49718
|
+
invalidateContentIndexesForRoot(root);
|
|
49719
|
+
}
|
|
49720
|
+
|
|
49649
49721
|
// ../canopycms/src/utils/provisioning-lock.ts
|
|
49650
49722
|
var import_proper_lockfile2 = __toESM(require_proper_lockfile(), 1);
|
|
49651
|
-
import
|
|
49723
|
+
import fs10 from "node:fs/promises";
|
|
49652
49724
|
import path12 from "node:path";
|
|
49653
49725
|
init_logger();
|
|
49654
|
-
|
|
49726
|
+
var PROVISIONING_LOCK_STALE_MS = 9e4;
|
|
49727
|
+
function provisioningLockOptions(lockPath, retries, onCompromised, staleMs) {
|
|
49655
49728
|
return {
|
|
49656
49729
|
lockfilePath: lockPath,
|
|
49657
49730
|
realpath: false,
|
|
49658
49731
|
retries,
|
|
49659
|
-
stale:
|
|
49732
|
+
stale: staleMs,
|
|
49733
|
+
// Fixed, not stale/2: every holder refreshes at 15s whatever threshold it judges others by.
|
|
49734
|
+
update: 15e3,
|
|
49660
49735
|
// proper-lockfile invokes this from inside its refresh timer, so ANY throw escaping here is
|
|
49661
49736
|
// an uncaught exception that kills the process. Call sites are told not to throw (see
|
|
49662
49737
|
// OnLockCompromised); this makes it structural rather than a convention, and also covers the
|
|
@@ -49699,15 +49774,21 @@ function releaseIgnoringAlreadyReleased(release, lockPath) {
|
|
|
49699
49774
|
}
|
|
49700
49775
|
};
|
|
49701
49776
|
}
|
|
49702
|
-
|
|
49703
|
-
|
|
49777
|
+
function branchProvisioningLockName(dirName) {
|
|
49778
|
+
return `.${dirName}.init.lock`;
|
|
49779
|
+
}
|
|
49780
|
+
async function tryAcquireProvisioningLock(lockTargetDir2, lockName, onCompromised, staleMs = PROVISIONING_LOCK_STALE_MS) {
|
|
49781
|
+
await fs10.mkdir(lockTargetDir2, { recursive: true });
|
|
49704
49782
|
const lockPath = path12.join(lockTargetDir2, lockName);
|
|
49705
|
-
const release = await import_proper_lockfile2.default.lock(
|
|
49783
|
+
const release = await import_proper_lockfile2.default.lock(
|
|
49784
|
+
lockPath,
|
|
49785
|
+
provisioningLockOptions(lockPath, 0, onCompromised, staleMs)
|
|
49786
|
+
);
|
|
49706
49787
|
return releaseIgnoringAlreadyReleased(release, lockPath);
|
|
49707
49788
|
}
|
|
49708
49789
|
|
|
49709
49790
|
// ../canopycms/src/git-manager.ts
|
|
49710
|
-
var
|
|
49791
|
+
var log5 = createDebugLogger({ prefix: "GitManager" });
|
|
49711
49792
|
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
49793
|
var FORCE_C_LOCALE = { LC_ALL: "C", LANG: "C" };
|
|
49713
49794
|
function gitChildEnv(overrides) {
|
|
@@ -49727,9 +49808,28 @@ function gitNetworkChildEnv() {
|
|
|
49727
49808
|
return { ...env, ...FORCE_C_LOCALE };
|
|
49728
49809
|
}
|
|
49729
49810
|
var GITHUB_TRACKING_REF_PREFIX = "refs/remotes/github/";
|
|
49811
|
+
async function ensureGitExcludePattern(repoPath, pattern) {
|
|
49812
|
+
const excludePath = path13.join(repoPath, ".git", "info", "exclude");
|
|
49813
|
+
await fs11.mkdir(path13.dirname(excludePath), { recursive: true });
|
|
49814
|
+
let content = "";
|
|
49815
|
+
try {
|
|
49816
|
+
content = await fs11.readFile(excludePath, "utf-8");
|
|
49817
|
+
} catch (err) {
|
|
49818
|
+
if (!isNotFoundError2(err)) throw err;
|
|
49819
|
+
}
|
|
49820
|
+
const lines = content.split("\n");
|
|
49821
|
+
if (lines.some((line) => line.trim() === pattern)) {
|
|
49822
|
+
log5.debug("git", "Pattern already in .git/info/exclude", { pattern });
|
|
49823
|
+
return;
|
|
49824
|
+
}
|
|
49825
|
+
const needsLeadingNewline = content.length > 0 && !content.endsWith("\n");
|
|
49826
|
+
const newContent = content + (needsLeadingNewline ? "\n" : "") + pattern + "\n";
|
|
49827
|
+
await fs11.writeFile(excludePath, newContent, "utf-8");
|
|
49828
|
+
log5.debug("git", "Added pattern to .git/info/exclude", { pattern });
|
|
49829
|
+
}
|
|
49730
49830
|
|
|
49731
49831
|
// ../canopycms/src/worker/history-rewrite.ts
|
|
49732
|
-
import
|
|
49832
|
+
import path14 from "node:path";
|
|
49733
49833
|
async function readPublishedSha(ctx, branchRef) {
|
|
49734
49834
|
try {
|
|
49735
49835
|
const out = await simpleGit().raw([
|
|
@@ -49823,7 +49923,7 @@ async function reconcilePendingRewrite(ctx, options) {
|
|
|
49823
49923
|
}
|
|
49824
49924
|
async function hasPendingHistoryRewrite(ctx, branchName) {
|
|
49825
49925
|
try {
|
|
49826
|
-
const branchPath =
|
|
49926
|
+
const branchPath = path14.join(ctx.contentBranchesPath, sanitizeBranchName(branchName));
|
|
49827
49927
|
const metaFile = await BranchMetadataFileManager.loadOnly(branchPath);
|
|
49828
49928
|
return typeof metaFile?.branch.historyRewrittenFrom === "string";
|
|
49829
49929
|
} catch {
|
|
@@ -49866,6 +49966,9 @@ function isRateLimitSignal403(err) {
|
|
|
49866
49966
|
if (err instanceof Error && /rate limit/i.test(err.message)) return true;
|
|
49867
49967
|
return false;
|
|
49868
49968
|
}
|
|
49969
|
+
function isSettingsBranch(branch) {
|
|
49970
|
+
return branch.startsWith(RESERVED_SETTINGS_BRANCH_PREFIX);
|
|
49971
|
+
}
|
|
49869
49972
|
function requireString(payload2, key) {
|
|
49870
49973
|
const val = payload2[key];
|
|
49871
49974
|
if (typeof val !== "string")
|
|
@@ -49992,6 +50095,11 @@ async function executeTask(ctx, task, signal) {
|
|
|
49992
50095
|
`Refusing to push-and-create-or-update-pr for "${branch}": it is the base branch -- submitting the base branch is never valid`
|
|
49993
50096
|
);
|
|
49994
50097
|
}
|
|
50098
|
+
if (isSettingsBranch(branch)) {
|
|
50099
|
+
await ctx.pushBranchToGitHub(branch);
|
|
50100
|
+
workerLog(`Pushed settings branch ${branch}; settings branches never get a PR`);
|
|
50101
|
+
return { pushed: true };
|
|
50102
|
+
}
|
|
49995
50103
|
await ctx.pushBranchToGitHub(branch);
|
|
49996
50104
|
const result = await createOrUpdatePullRequest({
|
|
49997
50105
|
octokit: ctx.octokit(),
|
|
@@ -50001,9 +50109,9 @@ async function executeTask(ctx, task, signal) {
|
|
|
50001
50109
|
base,
|
|
50002
50110
|
title: optionalString(payload2, "title", `Submit ${branch}`),
|
|
50003
50111
|
body: optionalString(payload2, "body", ""),
|
|
50004
|
-
// Content submits (api/github-sync.ts) set
|
|
50005
|
-
// syncs (services.ts) deliberately don't.
|
|
50112
|
+
// Content submits (api/github-sync.ts) set both.
|
|
50006
50113
|
markReadyIfDraft: payload2.markReadyIfDraft === true,
|
|
50114
|
+
mergeSectionIntoBody: payload2.mergeSectionIntoBody === true,
|
|
50007
50115
|
signal
|
|
50008
50116
|
});
|
|
50009
50117
|
workerLog(
|
|
@@ -50056,7 +50164,7 @@ async function updateBranchMetadata(ctx, task, result) {
|
|
|
50056
50164
|
if (!branch) return;
|
|
50057
50165
|
const branchPath = ctx.branchWorkspacePath(branch);
|
|
50058
50166
|
try {
|
|
50059
|
-
await
|
|
50167
|
+
await fs12.stat(branchPath);
|
|
50060
50168
|
} catch {
|
|
50061
50169
|
return;
|
|
50062
50170
|
}
|
|
@@ -50092,7 +50200,7 @@ async function updateBranchMetadataOnFailure(ctx, task, error2) {
|
|
|
50092
50200
|
if (!branch) return;
|
|
50093
50201
|
const branchPath = ctx.branchWorkspacePath(branch);
|
|
50094
50202
|
try {
|
|
50095
|
-
await
|
|
50203
|
+
await fs12.stat(branchPath);
|
|
50096
50204
|
} catch {
|
|
50097
50205
|
return;
|
|
50098
50206
|
}
|
|
@@ -50108,6 +50216,13 @@ async function updateBranchMetadataOnFailure(ctx, task, error2) {
|
|
|
50108
50216
|
);
|
|
50109
50217
|
}
|
|
50110
50218
|
}
|
|
50219
|
+
function throwIfWorkflowRefusal(branch, message) {
|
|
50220
|
+
const file = workflowPushRefusalFile(message);
|
|
50221
|
+
if (file === null) return;
|
|
50222
|
+
throw new PermanentTaskError(
|
|
50223
|
+
`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.`
|
|
50224
|
+
);
|
|
50225
|
+
}
|
|
50111
50226
|
async function pushBranchToGitHub(ctx, branch) {
|
|
50112
50227
|
const git = simpleGit({
|
|
50113
50228
|
baseDir: ctx.remoteGitPath,
|
|
@@ -50136,11 +50251,13 @@ async function pushBranchToGitHub(ctx, branch) {
|
|
|
50136
50251
|
}
|
|
50137
50252
|
} catch (err) {
|
|
50138
50253
|
const message = getErrorMessage2(err);
|
|
50254
|
+
throwIfWorkflowRefusal(branch, message);
|
|
50139
50255
|
if (marker && isStaleLeaseRejection(message)) {
|
|
50140
50256
|
try {
|
|
50141
50257
|
await git.push(githubUrl, branch);
|
|
50142
50258
|
} catch (retryErr) {
|
|
50143
50259
|
const retryMessage = getErrorMessage2(retryErr);
|
|
50260
|
+
throwIfWorkflowRefusal(branch, retryMessage);
|
|
50144
50261
|
if (isNonFastForwardRejection(retryMessage)) {
|
|
50145
50262
|
throw new PermanentTaskError(
|
|
50146
50263
|
`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,25 +50283,108 @@ async function pushBranchToGitHub(ctx, branch) {
|
|
|
50166
50283
|
}
|
|
50167
50284
|
|
|
50168
50285
|
// ../canopycms/src/worker/rebase.ts
|
|
50169
|
-
import
|
|
50170
|
-
import
|
|
50286
|
+
import fs14 from "node:fs/promises";
|
|
50287
|
+
import path17 from "node:path";
|
|
50171
50288
|
init_normalize();
|
|
50172
50289
|
init_types3();
|
|
50173
50290
|
|
|
50174
50291
|
// ../canopycms/src/utils/content-write-lock.ts
|
|
50175
|
-
import
|
|
50292
|
+
import path15 from "node:path";
|
|
50176
50293
|
init_logger();
|
|
50177
50294
|
var META_DIR2 = ".canopy-meta";
|
|
50178
50295
|
var CONTENT_WRITE_LOCK_NAME = "content-write.lock";
|
|
50179
50296
|
function lockTargetDir(branchRoot) {
|
|
50180
|
-
return
|
|
50297
|
+
return path15.join(path15.resolve(branchRoot), META_DIR2);
|
|
50181
50298
|
}
|
|
50299
|
+
var CONTENT_WRITE_LOCK_STALE_MS = 3e4;
|
|
50182
50300
|
function tryAcquireContentWriteLock(branchRoot, onCompromised) {
|
|
50183
50301
|
return tryAcquireProvisioningLock(
|
|
50184
50302
|
lockTargetDir(branchRoot),
|
|
50185
50303
|
CONTENT_WRITE_LOCK_NAME,
|
|
50186
|
-
onCompromised
|
|
50304
|
+
onCompromised,
|
|
50305
|
+
CONTENT_WRITE_LOCK_STALE_MS
|
|
50306
|
+
);
|
|
50307
|
+
}
|
|
50308
|
+
|
|
50309
|
+
// ../canopycms/src/worker/provisioned-workspace.ts
|
|
50310
|
+
import fs13 from "node:fs/promises";
|
|
50311
|
+
import path16 from "node:path";
|
|
50312
|
+
async function holdProvisionedWorkspace(contentBranchesPath, dirName) {
|
|
50313
|
+
let release;
|
|
50314
|
+
let compromised = false;
|
|
50315
|
+
try {
|
|
50316
|
+
release = await tryAcquireProvisioningLock(
|
|
50317
|
+
contentBranchesPath,
|
|
50318
|
+
branchProvisioningLockName(dirName),
|
|
50319
|
+
(err) => {
|
|
50320
|
+
compromised = true;
|
|
50321
|
+
workerLogWarn(
|
|
50322
|
+
` Provisioning lock for ${dirName} was compromised mid-hold: ${getErrorMessage2(err)}`
|
|
50323
|
+
);
|
|
50324
|
+
}
|
|
50325
|
+
);
|
|
50326
|
+
} catch (err) {
|
|
50327
|
+
if (isNodeError(err) && err.code === "ELOCKED") return { kind: "locked" };
|
|
50328
|
+
throw err;
|
|
50329
|
+
}
|
|
50330
|
+
const root = path16.join(contentBranchesPath, dirName);
|
|
50331
|
+
const [gitIsDir, hasMetadata] = await Promise.all([
|
|
50332
|
+
fs13.stat(path16.join(root, ".git")).then(
|
|
50333
|
+
(stat) => stat.isDirectory(),
|
|
50334
|
+
() => false
|
|
50335
|
+
),
|
|
50336
|
+
fs13.stat(path16.join(root, BRANCH_META_DIR, BRANCH_META_FILE)).then(
|
|
50337
|
+
() => true,
|
|
50338
|
+
() => false
|
|
50339
|
+
)
|
|
50340
|
+
]);
|
|
50341
|
+
if (gitIsDir && hasMetadata) return { kind: "held", release, isCompromised: () => compromised };
|
|
50342
|
+
await releaseProvisionedWorkspace(release, dirName);
|
|
50343
|
+
return { kind: "not-provisioned" };
|
|
50344
|
+
}
|
|
50345
|
+
async function releaseProvisionedWorkspace(release, dirName) {
|
|
50346
|
+
await release().catch((err) => {
|
|
50347
|
+
workerLogWarn(
|
|
50348
|
+
` Failed to release the provisioning lock for ${dirName}: ${getErrorMessage2(err)}`
|
|
50349
|
+
);
|
|
50350
|
+
});
|
|
50351
|
+
}
|
|
50352
|
+
|
|
50353
|
+
// ../canopycms/src/worker/canopy-state.ts
|
|
50354
|
+
var TRACKED_CANOPY_STATE_FIX = "run `git rm -r --cached .canopy-meta` in the site repo, add `.canopy-meta/` to its .gitignore, and commit";
|
|
50355
|
+
var MAX_REPORTED_PATHS = 10;
|
|
50356
|
+
var RETIRED_SCHEMA_CACHE_PATH = `${CANOPY_META_DIR}/${SCHEMA_CACHE_FILE}`;
|
|
50357
|
+
function isUntracked(file) {
|
|
50358
|
+
return file.index === "?" && file.working_dir === "?";
|
|
50359
|
+
}
|
|
50360
|
+
function splitNul(out) {
|
|
50361
|
+
return out.split("\0").filter((entry) => entry.length > 0);
|
|
50362
|
+
}
|
|
50363
|
+
async function listTrackedCanopyState(git) {
|
|
50364
|
+
return splitNul(await git.raw(["ls-files", "-z", "--", CANOPY_META_DIR]));
|
|
50365
|
+
}
|
|
50366
|
+
async function restoreRetiredSchemaCache(git, status) {
|
|
50367
|
+
const entry = status.files.find((f5) => f5.path === RETIRED_SCHEMA_CACHE_PATH);
|
|
50368
|
+
if (!entry || entry.index === "?" || entry.index === "A") return false;
|
|
50369
|
+
await git.raw(["checkout", "HEAD", "--", RETIRED_SCHEMA_CACHE_PATH]);
|
|
50370
|
+
return true;
|
|
50371
|
+
}
|
|
50372
|
+
function trackedCanopyStateChanges(status) {
|
|
50373
|
+
return status.files.filter((f5) => isCanopyInternalPath(f5.path) && !isUntracked(f5)).map((f5) => f5.path);
|
|
50374
|
+
}
|
|
50375
|
+
async function splitByUpstreamTracking(git, paths, tip) {
|
|
50376
|
+
if (paths.length === 0) return { droppedUpstream: [], stillTracked: [] };
|
|
50377
|
+
const tracked = new Set(
|
|
50378
|
+
splitNul(await git.raw(["ls-tree", "-r", "-z", "--name-only", tip, "--", CANOPY_META_DIR]))
|
|
50187
50379
|
);
|
|
50380
|
+
return {
|
|
50381
|
+
droppedUpstream: paths.filter((p6) => !tracked.has(p6)),
|
|
50382
|
+
stillTracked: paths.filter((p6) => tracked.has(p6))
|
|
50383
|
+
};
|
|
50384
|
+
}
|
|
50385
|
+
async function untrackInIndex(git, paths) {
|
|
50386
|
+
if (paths.length === 0) return;
|
|
50387
|
+
await git.raw(["rm", "--cached", "--ignore-unmatch", "-q", "--", ...paths]);
|
|
50188
50388
|
}
|
|
50189
50389
|
|
|
50190
50390
|
// ../canopycms/src/worker/rebase.ts
|
|
@@ -50314,13 +50514,13 @@ async function runRebaseRounds(ctx, branchGit, branchDir, fetchedBaseTip, isLock
|
|
|
50314
50514
|
function conflictFilesToContentIds(conflictedFiles, contentRoot) {
|
|
50315
50515
|
const normalizedContentRoot = normalizeFilesystemPath(contentRoot);
|
|
50316
50516
|
const conflictIds = [...new Set(conflictedFiles)].map((f5) => {
|
|
50317
|
-
const fileId = extractIdFromFilename(
|
|
50517
|
+
const fileId = extractIdFromFilename(path17.basename(f5));
|
|
50318
50518
|
if (fileId) return fileId;
|
|
50319
|
-
const parentDir =
|
|
50519
|
+
const parentDir = path17.basename(path17.dirname(f5));
|
|
50320
50520
|
const dirId = extractIdFromFilename(parentDir);
|
|
50321
50521
|
if (dirId) return dirId;
|
|
50322
|
-
const parentPath = normalizeFilesystemPath(
|
|
50323
|
-
if (
|
|
50522
|
+
const parentPath = normalizeFilesystemPath(path17.dirname(f5));
|
|
50523
|
+
if (path17.basename(f5) === ".collection.json" && parentPath === normalizedContentRoot) {
|
|
50324
50524
|
return ROOT_COLLECTION_ID;
|
|
50325
50525
|
}
|
|
50326
50526
|
return null;
|
|
@@ -50349,7 +50549,7 @@ async function runRebaseCycle(ctx) {
|
|
|
50349
50549
|
const failed = [];
|
|
50350
50550
|
let branchDirs;
|
|
50351
50551
|
try {
|
|
50352
|
-
branchDirs = await
|
|
50552
|
+
branchDirs = await fs14.readdir(ctx.contentBranchesPath);
|
|
50353
50553
|
} catch {
|
|
50354
50554
|
return { rebased, skippedDirty, skippedLocked, failed };
|
|
50355
50555
|
}
|
|
@@ -50357,10 +50557,10 @@ async function runRebaseCycle(ctx) {
|
|
|
50357
50557
|
if (branchDir.startsWith(".") || branchDir === "branches.json") {
|
|
50358
50558
|
continue;
|
|
50359
50559
|
}
|
|
50360
|
-
const branchPath =
|
|
50361
|
-
const gitDir =
|
|
50560
|
+
const branchPath = path17.join(ctx.contentBranchesPath, branchDir);
|
|
50561
|
+
const gitDir = path17.join(branchPath, ".git");
|
|
50362
50562
|
try {
|
|
50363
|
-
const stat = await
|
|
50563
|
+
const stat = await fs14.stat(gitDir);
|
|
50364
50564
|
if (!stat.isDirectory()) {
|
|
50365
50565
|
workerLog(` Skipping ${branchDir}: .git is not a directory`);
|
|
50366
50566
|
continue;
|
|
@@ -50373,7 +50573,11 @@ async function runRebaseCycle(ctx) {
|
|
|
50373
50573
|
workerLog(` Skipping ${branchDir}: base branch (refreshed separately)`);
|
|
50374
50574
|
continue;
|
|
50375
50575
|
}
|
|
50376
|
-
|
|
50576
|
+
if (isSettingsBranchName(branchDir, ctx.ensureSettingsBranch())) {
|
|
50577
|
+
workerLogWarn(` Skipping ${branchDir}: settings branch, never a content workspace`);
|
|
50578
|
+
continue;
|
|
50579
|
+
}
|
|
50580
|
+
const outcome = await holdAndRebaseOneBranch(ctx, branchDir, branchPath);
|
|
50377
50581
|
if (outcome.kind === "rebased") rebased.push(branchDir);
|
|
50378
50582
|
else if (outcome.kind === "skippedDirty") skippedDirty.push(branchDir);
|
|
50379
50583
|
else if (outcome.kind === "skippedLocked") skippedLocked.push(branchDir);
|
|
@@ -50384,7 +50588,30 @@ async function runRebaseCycle(ctx) {
|
|
|
50384
50588
|
}
|
|
50385
50589
|
return { rebased, skippedDirty, skippedLocked, failed };
|
|
50386
50590
|
}
|
|
50387
|
-
async function
|
|
50591
|
+
async function holdAndRebaseOneBranch(ctx, branchDir, branchPath) {
|
|
50592
|
+
let hold;
|
|
50593
|
+
try {
|
|
50594
|
+
hold = await holdProvisionedWorkspace(ctx.contentBranchesPath, branchDir);
|
|
50595
|
+
} catch (err) {
|
|
50596
|
+
const error2 = redactCredentials(`could not take the provisioning lock: ${getErrorMessage2(err)}`);
|
|
50597
|
+
workerLogWarn(` Skipping ${branchDir}: ${error2}`);
|
|
50598
|
+
return { kind: "failed", error: error2 };
|
|
50599
|
+
}
|
|
50600
|
+
if (hold.kind === "locked") {
|
|
50601
|
+
workerLog(` Skipping ${branchDir}: provisioning lock held elsewhere (retrying next cycle)`);
|
|
50602
|
+
return { kind: "skippedLocked" };
|
|
50603
|
+
}
|
|
50604
|
+
if (hold.kind === "not-provisioned") {
|
|
50605
|
+
workerLog(` Skipping ${branchDir}: not yet provisioned (no branch.json)`);
|
|
50606
|
+
return { kind: "none" };
|
|
50607
|
+
}
|
|
50608
|
+
try {
|
|
50609
|
+
return await rebaseOneBranch(ctx, branchDir, branchPath, hold.isCompromised);
|
|
50610
|
+
} finally {
|
|
50611
|
+
await releaseProvisionedWorkspace(hold.release, branchDir);
|
|
50612
|
+
}
|
|
50613
|
+
}
|
|
50614
|
+
async function rebaseOneBranch(ctx, branchDir, branchPath, isProvisioningLockCompromised) {
|
|
50388
50615
|
let didRebase = false;
|
|
50389
50616
|
try {
|
|
50390
50617
|
const metaFile = await BranchMetadataFileManager.loadOnly(branchPath);
|
|
@@ -50409,6 +50636,7 @@ async function rebaseOneBranch(ctx, branchDir, branchPath) {
|
|
|
50409
50636
|
});
|
|
50410
50637
|
let releaseContentLock;
|
|
50411
50638
|
let contentLockCompromised = false;
|
|
50639
|
+
const lockCompromised = () => contentLockCompromised || isProvisioningLockCompromised();
|
|
50412
50640
|
try {
|
|
50413
50641
|
releaseContentLock = await tryAcquireContentWriteLock(branchPath, (lockErr) => {
|
|
50414
50642
|
contentLockCompromised = true;
|
|
@@ -50446,11 +50674,26 @@ async function rebaseOneBranch(ctx, branchDir, branchPath) {
|
|
|
50446
50674
|
return { kind: "failed", error: reason };
|
|
50447
50675
|
}
|
|
50448
50676
|
}
|
|
50449
|
-
|
|
50450
|
-
if (
|
|
50677
|
+
let dirtyCheck = await branchGit.status();
|
|
50678
|
+
if (await restoreRetiredSchemaCache(branchGit, dirtyCheck)) {
|
|
50679
|
+
workerLog(` ${branchDir}: restored the retired in-tree schema cache`);
|
|
50680
|
+
dirtyCheck = await branchGit.status();
|
|
50681
|
+
}
|
|
50682
|
+
const editorDirt = dirtyCheck.files.filter((f5) => !isCanopyInternalPath(f5.path));
|
|
50683
|
+
if (editorDirt.length > 0) {
|
|
50451
50684
|
workerLog(` Skipping ${branchDir}: has uncommitted changes`);
|
|
50452
50685
|
return { kind: "skippedDirty" };
|
|
50453
50686
|
}
|
|
50687
|
+
const trackedState = trackedCanopyStateChanges(dirtyCheck);
|
|
50688
|
+
if (trackedState.length > 0) {
|
|
50689
|
+
await branchGit.fetch("origin", ctx.baseBranch);
|
|
50690
|
+
const baseTip = (await branchGit.revparse(["FETCH_HEAD"])).trim();
|
|
50691
|
+
const { stillTracked } = await splitByUpstreamTracking(branchGit, trackedState, baseTip);
|
|
50692
|
+
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`;
|
|
50693
|
+
workerLogWarn(` Skipping ${branchDir}: ${reason}`);
|
|
50694
|
+
await recordRebaseFailure(ctx, branchPath, branchDir, reason);
|
|
50695
|
+
return { kind: "failed", error: reason };
|
|
50696
|
+
}
|
|
50454
50697
|
const branchRef = (await branchGit.revparse(["--abbrev-ref", "HEAD"])).trim();
|
|
50455
50698
|
const canPublish = branchRef.length > 0 && branchRef !== "HEAD";
|
|
50456
50699
|
if (canPublish && metaFile?.branch.historyRewrittenFrom) {
|
|
@@ -50496,20 +50739,20 @@ async function rebaseOneBranch(ctx, branchDir, branchPath) {
|
|
|
50496
50739
|
branchGit,
|
|
50497
50740
|
branchDir,
|
|
50498
50741
|
fetchedBaseTip,
|
|
50499
|
-
|
|
50742
|
+
lockCompromised
|
|
50500
50743
|
);
|
|
50501
50744
|
if (completed) await ctx.afterRebaseCompletedForTesting();
|
|
50502
|
-
if (
|
|
50745
|
+
if (lockCompromised() && !completed) {
|
|
50503
50746
|
workerLogWarn(
|
|
50504
|
-
` Skipping ${branchDir}:
|
|
50747
|
+
` Skipping ${branchDir}: a lock it held was compromised mid-rebase (retrying next cycle)`
|
|
50505
50748
|
);
|
|
50506
50749
|
await branchGit.rebase(["--abort"]).catch(() => {
|
|
50507
50750
|
});
|
|
50508
50751
|
return { kind: "skippedLocked" };
|
|
50509
50752
|
}
|
|
50510
|
-
if (
|
|
50753
|
+
if (lockCompromised()) {
|
|
50511
50754
|
workerLogWarn(
|
|
50512
|
-
`
|
|
50755
|
+
` 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
50756
|
);
|
|
50514
50757
|
}
|
|
50515
50758
|
if (!completed) {
|
|
@@ -50577,8 +50820,8 @@ async function rebaseOneBranch(ctx, branchDir, branchPath) {
|
|
|
50577
50820
|
}
|
|
50578
50821
|
|
|
50579
50822
|
// ../canopycms/src/worker/git-sync.ts
|
|
50580
|
-
import
|
|
50581
|
-
import
|
|
50823
|
+
import fs15 from "node:fs/promises";
|
|
50824
|
+
import path18 from "node:path";
|
|
50582
50825
|
var TRASH_RETENTION_MS = 30 * 24 * 60 * 6e4;
|
|
50583
50826
|
var TRASH_DIR_STAMP_RE = /-(\d{8}T\d{6}Z)$/;
|
|
50584
50827
|
function parseTrashStamp(stamp) {
|
|
@@ -50742,7 +50985,7 @@ async function syncGit(ctx) {
|
|
|
50742
50985
|
workerLog("Fetched from GitHub");
|
|
50743
50986
|
const { summary: trackedSummary, trackedNames } = await reconcileTrackedBranches(ctx, git);
|
|
50744
50987
|
await pushSettingsBranches(ctx, git, trackedNames);
|
|
50745
|
-
await refreshBaseBranchWorkspace(ctx);
|
|
50988
|
+
const baseRefresh = await refreshBaseBranchWorkspace(ctx);
|
|
50746
50989
|
const rebaseSummary = await runRebaseCycle(ctx);
|
|
50747
50990
|
await cleanupOldTasks(ctx.taskDir, void 0, ctx.log);
|
|
50748
50991
|
const trashRemoved = await cleanupTrashedBranchDirs(ctx);
|
|
@@ -50755,9 +50998,10 @@ async function syncGit(ctx) {
|
|
|
50755
50998
|
report.lastGitSync = {
|
|
50756
50999
|
durationMs: Date.now() - cycleStartedAt,
|
|
50757
51000
|
rebased: rebaseSummary.rebased,
|
|
50758
|
-
skippedDirty: rebaseSummary.skippedDirty,
|
|
50759
|
-
skippedLocked: rebaseSummary.skippedLocked,
|
|
51001
|
+
skippedDirty: baseRefresh.outcome === "skipped-dirty" ? [ctx.sanitizedBaseBranch, ...rebaseSummary.skippedDirty] : rebaseSummary.skippedDirty,
|
|
51002
|
+
skippedLocked: baseRefresh.outcome === "skipped-locked" ? [ctx.sanitizedBaseBranch, ...rebaseSummary.skippedLocked] : rebaseSummary.skippedLocked,
|
|
50760
51003
|
failed: rebaseSummary.failed,
|
|
51004
|
+
baseRefresh,
|
|
50761
51005
|
tracked: trackedSummary
|
|
50762
51006
|
};
|
|
50763
51007
|
await writeWorkerStatus(ctx.taskDir, report).catch(
|
|
@@ -50778,7 +51022,7 @@ async function syncGit(ctx) {
|
|
|
50778
51022
|
async function cleanupTrashedBranchDirs(ctx) {
|
|
50779
51023
|
let entries;
|
|
50780
51024
|
try {
|
|
50781
|
-
entries = await
|
|
51025
|
+
entries = await fs15.readdir(ctx.contentBranchesPath);
|
|
50782
51026
|
} catch (err) {
|
|
50783
51027
|
if (isNodeError(err) && err.code === "ENOENT") return 0;
|
|
50784
51028
|
throw err;
|
|
@@ -50799,7 +51043,7 @@ async function cleanupTrashedBranchDirs(ctx) {
|
|
|
50799
51043
|
}
|
|
50800
51044
|
if (now - stampDate.getTime() < TRASH_RETENTION_MS) continue;
|
|
50801
51045
|
try {
|
|
50802
|
-
await
|
|
51046
|
+
await fs15.rm(path18.join(ctx.contentBranchesPath, name), {
|
|
50803
51047
|
recursive: true,
|
|
50804
51048
|
force: true,
|
|
50805
51049
|
maxRetries: 3,
|
|
@@ -50815,20 +51059,51 @@ async function cleanupTrashedBranchDirs(ctx) {
|
|
|
50815
51059
|
}
|
|
50816
51060
|
return removed;
|
|
50817
51061
|
}
|
|
51062
|
+
var warnedTrackedCanopyState = /* @__PURE__ */ new Set();
|
|
50818
51063
|
async function refreshBaseBranchWorkspace(ctx) {
|
|
50819
|
-
const basePath37 =
|
|
50820
|
-
|
|
51064
|
+
const basePath37 = path18.join(ctx.contentBranchesPath, ctx.sanitizedBaseBranch);
|
|
51065
|
+
let trackedCanopyMeta;
|
|
51066
|
+
let releaseProvisioning;
|
|
51067
|
+
let releaseContentLock;
|
|
50821
51068
|
try {
|
|
50822
|
-
|
|
50823
|
-
|
|
50824
|
-
|
|
50825
|
-
|
|
50826
|
-
|
|
51069
|
+
const hold = await holdProvisionedWorkspace(ctx.contentBranchesPath, ctx.sanitizedBaseBranch);
|
|
51070
|
+
if (hold.kind === "locked") {
|
|
51071
|
+
workerLog(
|
|
51072
|
+
`Base branch workspace (${ctx.baseBranch}): provisioning lock held elsewhere, skipping refresh`
|
|
51073
|
+
);
|
|
51074
|
+
return { outcome: "skipped-locked" };
|
|
50827
51075
|
}
|
|
50828
|
-
if (
|
|
51076
|
+
if (hold.kind === "not-provisioned") {
|
|
50829
51077
|
workerLog(`Base branch workspace (${ctx.baseBranch}): not yet provisioned, skipping refresh`);
|
|
50830
|
-
return;
|
|
51078
|
+
return { outcome: "skipped-not-provisioned" };
|
|
50831
51079
|
}
|
|
51080
|
+
releaseProvisioning = hold.release;
|
|
51081
|
+
let contentLockCompromised = false;
|
|
51082
|
+
try {
|
|
51083
|
+
releaseContentLock = await tryAcquireContentWriteLock(basePath37, (lockErr) => {
|
|
51084
|
+
contentLockCompromised = true;
|
|
51085
|
+
workerLogWarn(
|
|
51086
|
+
`Base branch workspace (${ctx.baseBranch}): content-write lock compromised mid-refresh: ${getErrorMessage2(lockErr)}`
|
|
51087
|
+
);
|
|
51088
|
+
});
|
|
51089
|
+
} catch (lockErr) {
|
|
51090
|
+
if (isNodeError(lockErr) && lockErr.code === "ELOCKED") {
|
|
51091
|
+
workerLog(
|
|
51092
|
+
`Base branch workspace (${ctx.baseBranch}): content write in progress, skipping refresh`
|
|
51093
|
+
);
|
|
51094
|
+
return { outcome: "skipped-locked" };
|
|
51095
|
+
}
|
|
51096
|
+
throw lockErr;
|
|
51097
|
+
}
|
|
51098
|
+
const lockLost = () => {
|
|
51099
|
+
if (!hold.isCompromised() && !contentLockCompromised) return null;
|
|
51100
|
+
const lost = hold.isCompromised() ? "provisioning" : "content-write";
|
|
51101
|
+
workerLogWarn(
|
|
51102
|
+
`Base branch workspace (${ctx.baseBranch}): ${lost} lock lost mid-refresh, stopping`
|
|
51103
|
+
);
|
|
51104
|
+
return { outcome: "skipped-locked", trackedCanopyMeta };
|
|
51105
|
+
};
|
|
51106
|
+
await ensureGitExcludePattern(basePath37, `${CANOPY_META_DIR}/`);
|
|
50832
51107
|
const baseGit = simpleGit({
|
|
50833
51108
|
baseDir: basePath37,
|
|
50834
51109
|
// Keep git non-interactive during the merge so it never blocks on an
|
|
@@ -50842,13 +51117,37 @@ async function refreshBaseBranchWorkspace(ctx) {
|
|
|
50842
51117
|
// Inactivity-based, so a slow-but-flowing transfer is unaffected.
|
|
50843
51118
|
timeout: { block: ctx.taskTimeoutMs }
|
|
50844
51119
|
});
|
|
50845
|
-
const
|
|
50846
|
-
|
|
51120
|
+
const trackedState = await listTrackedCanopyState(baseGit);
|
|
51121
|
+
if (trackedState.length > 0) {
|
|
51122
|
+
trackedCanopyMeta = trackedState.slice(0, MAX_REPORTED_PATHS);
|
|
51123
|
+
const warnKey = `${basePath37}\0${trackedState.join("\0")}`;
|
|
51124
|
+
if (!warnedTrackedCanopyState.has(warnKey)) {
|
|
51125
|
+
warnedTrackedCanopyState.add(warnKey);
|
|
51126
|
+
workerLogWarn(
|
|
51127
|
+
`Base branch (${ctx.baseBranch}) tracks canopycms state that must not be committed: ${trackedState.join(", ")}. To fix, ${TRACKED_CANOPY_STATE_FIX}.`
|
|
51128
|
+
);
|
|
51129
|
+
}
|
|
51130
|
+
}
|
|
51131
|
+
let status = await baseGit.status();
|
|
51132
|
+
const lostBeforeRestore = lockLost();
|
|
51133
|
+
if (lostBeforeRestore) return lostBeforeRestore;
|
|
51134
|
+
if (await restoreRetiredSchemaCache(baseGit, status)) {
|
|
51135
|
+
workerLog(
|
|
51136
|
+
`Base branch workspace (${ctx.baseBranch}): restored the retired in-tree schema cache`
|
|
51137
|
+
);
|
|
51138
|
+
status = await baseGit.status();
|
|
51139
|
+
}
|
|
51140
|
+
const trackedDirty = status.files.filter((f5) => !isUntracked(f5) && !isCanopyInternalPath(f5.path)).map((f5) => f5.path);
|
|
50847
51141
|
if (trackedDirty.length > 0) {
|
|
50848
51142
|
workerLogError(
|
|
50849
|
-
`Base branch workspace (${ctx.baseBranch}) has uncommitted changes -- skipping refresh. Dirty files: ${trackedDirty.
|
|
51143
|
+
`Base branch workspace (${ctx.baseBranch}) has uncommitted changes -- skipping refresh. Dirty files: ${trackedDirty.join(", ")}`
|
|
50850
51144
|
);
|
|
50851
|
-
return
|
|
51145
|
+
return {
|
|
51146
|
+
outcome: "skipped-dirty",
|
|
51147
|
+
dirtyFiles: trackedDirty.slice(0, MAX_REPORTED_PATHS),
|
|
51148
|
+
message: `${trackedDirty.length} uncommitted tracked file(s) in the base branch workspace`,
|
|
51149
|
+
trackedCanopyMeta
|
|
51150
|
+
};
|
|
50852
51151
|
}
|
|
50853
51152
|
await baseGit.fetch("origin", ctx.baseBranch);
|
|
50854
51153
|
const fetchedTip = (await baseGit.revparse(["FETCH_HEAD"])).trim();
|
|
@@ -50857,13 +51156,27 @@ async function refreshBaseBranchWorkspace(ctx) {
|
|
|
50857
51156
|
10
|
|
50858
51157
|
);
|
|
50859
51158
|
if (behindCount > 0) {
|
|
51159
|
+
const lostBeforeMerge = lockLost();
|
|
51160
|
+
if (lostBeforeMerge) return lostBeforeMerge;
|
|
51161
|
+
const { droppedUpstream } = await splitByUpstreamTracking(baseGit, trackedState, fetchedTip);
|
|
51162
|
+
if (droppedUpstream.length > 0) {
|
|
51163
|
+
await untrackInIndex(baseGit, droppedUpstream);
|
|
51164
|
+
workerLog(
|
|
51165
|
+
`Base branch workspace (${ctx.baseBranch}): stopped tracking ${droppedUpstream.join(", ")}, as upstream has`
|
|
51166
|
+
);
|
|
51167
|
+
}
|
|
50860
51168
|
try {
|
|
50861
51169
|
await baseGit.merge(["--ff-only", fetchedTip]);
|
|
50862
51170
|
} catch (err) {
|
|
50863
51171
|
workerLogError(
|
|
50864
51172
|
`Base branch workspace (${ctx.baseBranch}) failed to fast-forward (diverged local history?): ${getErrorMessage2(err)}`
|
|
50865
51173
|
);
|
|
50866
|
-
return
|
|
51174
|
+
return {
|
|
51175
|
+
outcome: "failed",
|
|
51176
|
+
// [REDACT] Served to the browser by the admin panel.
|
|
51177
|
+
message: redactCredentials(`failed to fast-forward: ${getErrorMessage2(err)}`),
|
|
51178
|
+
trackedCanopyMeta
|
|
51179
|
+
};
|
|
50867
51180
|
}
|
|
50868
51181
|
await invalidateBranchContentCaches(basePath37);
|
|
50869
51182
|
}
|
|
@@ -50880,10 +51193,31 @@ async function refreshBaseBranchWorkspace(ctx) {
|
|
|
50880
51193
|
workerLog(
|
|
50881
51194
|
behindCount > 0 ? `Base branch workspace (${ctx.baseBranch}): fast-forwarded ${behindCount} commit(s)` : `Base branch workspace (${ctx.baseBranch}): up to date`
|
|
50882
51195
|
);
|
|
51196
|
+
if (trackedCanopyMeta && behindCount > 0) {
|
|
51197
|
+
const stillTracked = await listTrackedCanopyState(baseGit);
|
|
51198
|
+
trackedCanopyMeta = stillTracked.length > 0 ? stillTracked.slice(0, MAX_REPORTED_PATHS) : void 0;
|
|
51199
|
+
}
|
|
51200
|
+
return { outcome: behindCount > 0 ? "refreshed" : "up-to-date", trackedCanopyMeta };
|
|
50883
51201
|
} catch (err) {
|
|
50884
51202
|
workerLogError(
|
|
50885
51203
|
`Base branch workspace (${ctx.baseBranch}) refresh failed: ${getErrorMessage2(err)}`
|
|
50886
51204
|
);
|
|
51205
|
+
return {
|
|
51206
|
+
outcome: "failed",
|
|
51207
|
+
message: redactCredentials(getErrorMessage2(err)),
|
|
51208
|
+
trackedCanopyMeta
|
|
51209
|
+
};
|
|
51210
|
+
} finally {
|
|
51211
|
+
if (releaseContentLock) {
|
|
51212
|
+
await releaseContentLock().catch((err) => {
|
|
51213
|
+
workerLogWarn(
|
|
51214
|
+
`Base branch workspace (${ctx.baseBranch}): failed to release content-write lock: ${getErrorMessage2(err)}`
|
|
51215
|
+
);
|
|
51216
|
+
});
|
|
51217
|
+
}
|
|
51218
|
+
if (releaseProvisioning) {
|
|
51219
|
+
await releaseProvisionedWorkspace(releaseProvisioning, ctx.sanitizedBaseBranch);
|
|
51220
|
+
}
|
|
50887
51221
|
}
|
|
50888
51222
|
}
|
|
50889
51223
|
|
|
@@ -50899,15 +51233,15 @@ var CmsWorker = class {
|
|
|
50899
51233
|
this.activeOperations = /* @__PURE__ */ new Set();
|
|
50900
51234
|
this.releaseLockFn = null;
|
|
50901
51235
|
this.log = cmsTaskQueueLogger;
|
|
50902
|
-
this.taskDir =
|
|
50903
|
-
this.remoteGitPath =
|
|
50904
|
-
this.contentBranchesPath =
|
|
51236
|
+
this.taskDir = path19.join(config.workspacePath, ".tasks");
|
|
51237
|
+
this.remoteGitPath = path19.join(config.workspacePath, "remote.git");
|
|
51238
|
+
this.contentBranchesPath = path19.join(config.workspacePath, "content-branches");
|
|
50905
51239
|
this.baseBranch = config.baseBranch ?? "main";
|
|
50906
51240
|
this.sanitizedBaseBranch = sanitizeBranchName(this.baseBranch);
|
|
50907
51241
|
this.maxTasksPerCycle = config.maxTasksPerCycle ?? 10;
|
|
50908
51242
|
this.taskTimeoutMs = config.taskTimeoutMs ?? DEFAULT_TASK_TIMEOUT;
|
|
50909
51243
|
this.maxRetries = config.maxRetries ?? DEFAULT_MAX_RETRIES2;
|
|
50910
|
-
this.lockFilePath =
|
|
51244
|
+
this.lockFilePath = path19.join(config.workspacePath, ".tasks", ".worker-lock");
|
|
50911
51245
|
this.lockStaleMs = config.lockStaleMs ?? DEFAULT_LOCK_STALE_MS;
|
|
50912
51246
|
this.contentRoot = config.contentRoot ?? "content";
|
|
50913
51247
|
}
|
|
@@ -50920,7 +51254,12 @@ var CmsWorker = class {
|
|
|
50920
51254
|
ensureStatusReport() {
|
|
50921
51255
|
if (!this.statusReport) {
|
|
50922
51256
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
50923
|
-
this.statusReport = {
|
|
51257
|
+
this.statusReport = {
|
|
51258
|
+
version: 1,
|
|
51259
|
+
workerVersion: CANOPYCMS_VERSION,
|
|
51260
|
+
startedAt: now,
|
|
51261
|
+
updatedAt: now
|
|
51262
|
+
};
|
|
50924
51263
|
}
|
|
50925
51264
|
return this.statusReport;
|
|
50926
51265
|
}
|
|
@@ -50995,6 +51334,18 @@ var CmsWorker = class {
|
|
|
50995
51334
|
workerLog("CMS Worker starting...");
|
|
50996
51335
|
this.ensureStatusReport();
|
|
50997
51336
|
await this.acquireLock();
|
|
51337
|
+
try {
|
|
51338
|
+
const lastFatalError = await readLastFatalError(this.taskDir);
|
|
51339
|
+
await writeWorkerStatus(this.taskDir, {
|
|
51340
|
+
...this.ensureStatusReport(),
|
|
51341
|
+
...lastFatalError ? { lastFatalError } : {}
|
|
51342
|
+
});
|
|
51343
|
+
} catch (err) {
|
|
51344
|
+
workerLogError(
|
|
51345
|
+
"Failed to write worker status after acquiring the lock:",
|
|
51346
|
+
getErrorMessage2(err)
|
|
51347
|
+
);
|
|
51348
|
+
}
|
|
50998
51349
|
try {
|
|
50999
51350
|
this.ensureSettingsBranch();
|
|
51000
51351
|
this.ensureGitHubAuth();
|
|
@@ -51087,7 +51438,7 @@ var CmsWorker = class {
|
|
|
51087
51438
|
* is negligible at the default TTL; a badly wrong clock misjudges liveness.
|
|
51088
51439
|
*/
|
|
51089
51440
|
async acquireLock() {
|
|
51090
|
-
await
|
|
51441
|
+
await fs16.mkdir(this.taskDir, { recursive: true });
|
|
51091
51442
|
try {
|
|
51092
51443
|
this.releaseLockFn = await import_proper_lockfile3.default.lock(this.taskDir, {
|
|
51093
51444
|
lockfilePath: this.lockFilePath,
|
|
@@ -51226,7 +51577,7 @@ var CmsWorker = class {
|
|
|
51226
51577
|
async ensureRemoteGit() {
|
|
51227
51578
|
let exists2;
|
|
51228
51579
|
try {
|
|
51229
|
-
await
|
|
51580
|
+
await fs16.stat(this.remoteGitPath);
|
|
51230
51581
|
exists2 = true;
|
|
51231
51582
|
} catch {
|
|
51232
51583
|
exists2 = false;
|
|
@@ -51246,19 +51597,19 @@ var CmsWorker = class {
|
|
|
51246
51597
|
workerLog("Initializing remote.git from GitHub...");
|
|
51247
51598
|
const git = simpleGit();
|
|
51248
51599
|
const stagingPath = `${this.remoteGitPath}.cloning`;
|
|
51249
|
-
await
|
|
51600
|
+
await fs16.rm(stagingPath, { recursive: true, force: true });
|
|
51250
51601
|
try {
|
|
51251
51602
|
await git.clone(await this.buildGitHubUrl(), stagingPath, ["--bare"]);
|
|
51252
51603
|
await this.scrubPersistedRemote(stagingPath);
|
|
51253
51604
|
await this.verifyBaseBranchExists(stagingPath);
|
|
51254
51605
|
} catch (err) {
|
|
51255
51606
|
workerLogError(`remote.git clone failed: ${redactCredentials(getErrorMessage2(err))}`);
|
|
51256
|
-
await
|
|
51607
|
+
await fs16.rm(stagingPath, { recursive: true, force: true });
|
|
51257
51608
|
throw new Error(
|
|
51258
51609
|
`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
51610
|
);
|
|
51260
51611
|
}
|
|
51261
|
-
await
|
|
51612
|
+
await fs16.rename(stagingPath, this.remoteGitPath);
|
|
51262
51613
|
workerLog("remote.git initialized");
|
|
51263
51614
|
}
|
|
51264
51615
|
// --- Task-queue cluster (worker/task-runner.ts) ------------------------
|
|
@@ -51407,7 +51758,7 @@ var CmsWorker = class {
|
|
|
51407
51758
|
* sanitized.
|
|
51408
51759
|
*/
|
|
51409
51760
|
branchWorkspacePath(branchRefName) {
|
|
51410
|
-
return
|
|
51761
|
+
return path19.join(this.contentBranchesPath, sanitizeBranchName(branchRefName));
|
|
51411
51762
|
}
|
|
51412
51763
|
/**
|
|
51413
51764
|
* Test-only seam: awaited inside `rebaseActiveBranches()`'s conflict round,
|
|
@@ -51550,7 +51901,7 @@ var CmsWorker = class {
|
|
|
51550
51901
|
};
|
|
51551
51902
|
|
|
51552
51903
|
// worker/index.ts
|
|
51553
|
-
import
|
|
51904
|
+
import path21 from "node:path";
|
|
51554
51905
|
|
|
51555
51906
|
// worker/secrets.ts
|
|
51556
51907
|
function secretsManagerClientConfig(timeouts = {}) {
|
|
@@ -56057,10 +56408,10 @@ var SessionAPI = class extends AbstractAPI {
|
|
|
56057
56408
|
*/
|
|
56058
56409
|
async getToken(sessionId, template, expiresInSeconds) {
|
|
56059
56410
|
this.requireId(sessionId);
|
|
56060
|
-
const
|
|
56411
|
+
const path22 = template ? joinPaths(basePath29, sessionId, "tokens", template) : joinPaths(basePath29, sessionId, "tokens");
|
|
56061
56412
|
const requestOptions = {
|
|
56062
56413
|
method: "POST",
|
|
56063
|
-
path:
|
|
56414
|
+
path: path22
|
|
56064
56415
|
};
|
|
56065
56416
|
if (expiresInSeconds !== void 0) {
|
|
56066
56417
|
requestOptions.bodyParams = { expires_in_seconds: expiresInSeconds };
|
|
@@ -58810,12 +59161,12 @@ function buildRequest(options) {
|
|
|
58810
59161
|
userAgent = USER_AGENT,
|
|
58811
59162
|
skipApiVersionInUrl = false
|
|
58812
59163
|
} = options;
|
|
58813
|
-
const { path:
|
|
59164
|
+
const { path: path22, method, queryParams, headerParams, bodyParams, formData, options: opts } = requestOptions;
|
|
58814
59165
|
const { deepSnakecaseBodyParamKeys = false } = opts || {};
|
|
58815
59166
|
if (requireSecretKey) {
|
|
58816
59167
|
assertValidSecretKey(secretKey);
|
|
58817
59168
|
}
|
|
58818
|
-
const url = skipApiVersionInUrl ? joinPaths(apiUrl,
|
|
59169
|
+
const url = skipApiVersionInUrl ? joinPaths(apiUrl, path22) : joinPaths(apiUrl, apiVersion, path22);
|
|
58819
59170
|
const finalUrl = new URL(url);
|
|
58820
59171
|
if (queryParams) {
|
|
58821
59172
|
const snakecasedQueryParams = snakecase_keys_default({ ...queryParams });
|
|
@@ -60996,38 +61347,38 @@ function createClerkClient(options) {
|
|
|
60996
61347
|
}
|
|
60997
61348
|
|
|
60998
61349
|
// ../canopycms/src/auth/file-based-auth-cache.ts
|
|
60999
|
-
import
|
|
61000
|
-
import
|
|
61001
|
-
var
|
|
61350
|
+
import fs17 from "node:fs/promises";
|
|
61351
|
+
import path20 from "node:path";
|
|
61352
|
+
var log6 = createDebugLogger({ prefix: "FileBasedAuthCache" });
|
|
61002
61353
|
async function writeAuthCacheSnapshot(cachePath, files) {
|
|
61003
|
-
await
|
|
61354
|
+
await fs17.mkdir(cachePath, { recursive: true });
|
|
61004
61355
|
const timestamp2 = Date.now();
|
|
61005
|
-
const snapshotDir =
|
|
61006
|
-
await
|
|
61356
|
+
const snapshotDir = path20.join(cachePath, `snapshot-${timestamp2}`);
|
|
61357
|
+
await fs17.mkdir(snapshotDir, { recursive: true });
|
|
61007
61358
|
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
|
|
61359
|
+
const tmpPath = path20.join(snapshotDir, `${fileName}.tmp`);
|
|
61360
|
+
const finalPath = path20.join(snapshotDir, fileName);
|
|
61361
|
+
await fs17.writeFile(tmpPath, JSON.stringify(data2, null, 2), "utf-8");
|
|
61362
|
+
await fs17.rename(tmpPath, finalPath);
|
|
61363
|
+
}
|
|
61364
|
+
const currentLink = path20.join(cachePath, "current");
|
|
61365
|
+
const tmpLink = path20.join(cachePath, `current-${timestamp2}`);
|
|
61366
|
+
await fs17.symlink(path20.basename(snapshotDir), tmpLink);
|
|
61367
|
+
await fs17.rename(tmpLink, currentLink);
|
|
61017
61368
|
await cleanupOldSnapshots(cachePath, 2);
|
|
61018
61369
|
return snapshotDir;
|
|
61019
61370
|
}
|
|
61020
61371
|
async function cleanupOldSnapshots(cachePath, keepCount) {
|
|
61021
61372
|
let entries;
|
|
61022
61373
|
try {
|
|
61023
|
-
entries = await
|
|
61374
|
+
entries = await fs17.readdir(cachePath);
|
|
61024
61375
|
} catch {
|
|
61025
61376
|
return;
|
|
61026
61377
|
}
|
|
61027
61378
|
const snapshots = entries.filter((e5) => e5.startsWith("snapshot-")).sort().reverse();
|
|
61028
61379
|
for (const snapshot of snapshots.slice(keepCount)) {
|
|
61029
61380
|
try {
|
|
61030
|
-
await
|
|
61381
|
+
await fs17.rm(path20.join(cachePath, snapshot), {
|
|
61031
61382
|
recursive: true,
|
|
61032
61383
|
force: true
|
|
61033
61384
|
});
|
|
@@ -61037,7 +61388,7 @@ async function cleanupOldSnapshots(cachePath, keepCount) {
|
|
|
61037
61388
|
}
|
|
61038
61389
|
|
|
61039
61390
|
// ../canopycms/src/auth/caching-auth-plugin.ts
|
|
61040
|
-
var
|
|
61391
|
+
var log7 = createDebugLogger({ prefix: "CachingAuthPlugin" });
|
|
61041
61392
|
|
|
61042
61393
|
// ../canopycms-auth-clerk/src/cache-writer.ts
|
|
61043
61394
|
function unwrapClerkResponse(response) {
|
|
@@ -61238,7 +61589,7 @@ async function main() {
|
|
|
61238
61589
|
});
|
|
61239
61590
|
const refreshAuthCache = createClerkAuthCacheRefresher({
|
|
61240
61591
|
secret: clerkSecret,
|
|
61241
|
-
cachePath:
|
|
61592
|
+
cachePath: path21.join(workspacePath, ".cache")
|
|
61242
61593
|
});
|
|
61243
61594
|
const worker = new CmsWorker({
|
|
61244
61595
|
workspacePath,
|