canopycms-cdk 0.0.64 → 0.0.66-int.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constructs/asset-support.d.ts +21 -1
- package/dist/constructs/asset-support.js +62 -3
- package/dist/constructs/cms-distribution.d.ts +41 -1
- package/dist/constructs/cms-distribution.js +60 -4
- package/dist/constructs/cms-service.d.ts +40 -1
- package/dist/constructs/cms-service.js +49 -5
- package/lambda/asset-transform/dist/handler.js +3 -0
- package/package.json +4 -4
- package/worker/dist/index.js +488 -350
package/worker/dist/index.js
CHANGED
|
@@ -814,10 +814,10 @@ var require_src2 = __commonJS({
|
|
|
814
814
|
var fs_1 = __require("fs");
|
|
815
815
|
var debug_1 = __importDefault2(require_src());
|
|
816
816
|
var log7 = debug_1.default("@kwsites/file-exists");
|
|
817
|
-
function check(
|
|
818
|
-
log7(`checking %s`,
|
|
817
|
+
function check(path16, isFile, isDirectory) {
|
|
818
|
+
log7(`checking %s`, path16);
|
|
819
819
|
try {
|
|
820
|
-
const stat = fs_1.statSync(
|
|
820
|
+
const stat = fs_1.statSync(path16);
|
|
821
821
|
if (stat.isFile() && isFile) {
|
|
822
822
|
log7(`[OK] path represents a file`);
|
|
823
823
|
return true;
|
|
@@ -837,8 +837,8 @@ var require_src2 = __commonJS({
|
|
|
837
837
|
throw e5;
|
|
838
838
|
}
|
|
839
839
|
}
|
|
840
|
-
function exists2(
|
|
841
|
-
return check(
|
|
840
|
+
function exists2(path16, type = exports.READABLE) {
|
|
841
|
+
return check(path16, (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(fs11) {
|
|
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(fs11);
|
|
933
|
+
}
|
|
934
|
+
if (!fs11.lutimes) {
|
|
935
|
+
patchLutimes(fs11);
|
|
936
|
+
}
|
|
937
|
+
fs11.chown = chownFix(fs11.chown);
|
|
938
|
+
fs11.fchown = chownFix(fs11.fchown);
|
|
939
|
+
fs11.lchown = chownFix(fs11.lchown);
|
|
940
|
+
fs11.chmod = chmodFix(fs11.chmod);
|
|
941
|
+
fs11.fchmod = chmodFix(fs11.fchmod);
|
|
942
|
+
fs11.lchmod = chmodFix(fs11.lchmod);
|
|
943
|
+
fs11.chownSync = chownFixSync(fs11.chownSync);
|
|
944
|
+
fs11.fchownSync = chownFixSync(fs11.fchownSync);
|
|
945
|
+
fs11.lchownSync = chownFixSync(fs11.lchownSync);
|
|
946
|
+
fs11.chmodSync = chmodFixSync(fs11.chmodSync);
|
|
947
|
+
fs11.fchmodSync = chmodFixSync(fs11.fchmodSync);
|
|
948
|
+
fs11.lchmodSync = chmodFixSync(fs11.lchmodSync);
|
|
949
|
+
fs11.stat = statFix(fs11.stat);
|
|
950
|
+
fs11.fstat = statFix(fs11.fstat);
|
|
951
|
+
fs11.lstat = statFix(fs11.lstat);
|
|
952
|
+
fs11.statSync = statFixSync(fs11.statSync);
|
|
953
|
+
fs11.fstatSync = statFixSync(fs11.fstatSync);
|
|
954
|
+
fs11.lstatSync = statFixSync(fs11.lstatSync);
|
|
955
|
+
if (fs11.chmod && !fs11.lchmod) {
|
|
956
|
+
fs11.lchmod = function(path16, mode, cb) {
|
|
957
957
|
if (cb) process.nextTick(cb);
|
|
958
958
|
};
|
|
959
|
-
|
|
959
|
+
fs11.lchmodSync = function() {
|
|
960
960
|
};
|
|
961
961
|
}
|
|
962
|
-
if (
|
|
963
|
-
|
|
962
|
+
if (fs11.chown && !fs11.lchown) {
|
|
963
|
+
fs11.lchown = function(path16, uid, gid, cb) {
|
|
964
964
|
if (cb) process.nextTick(cb);
|
|
965
965
|
};
|
|
966
|
-
|
|
966
|
+
fs11.lchownSync = function() {
|
|
967
967
|
};
|
|
968
968
|
}
|
|
969
969
|
if (platform === "win32") {
|
|
970
|
-
|
|
970
|
+
fs11.rename = typeof fs11.rename !== "function" ? fs11.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
|
+
fs11.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
|
+
})(fs11.rename);
|
|
994
994
|
}
|
|
995
|
-
|
|
995
|
+
fs11.read = typeof fs11.read !== "function" ? fs11.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(fs11, 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(fs11, 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
|
+
})(fs11.read);
|
|
1013
|
+
fs11.readSync = typeof fs11.readSync !== "function" ? fs11.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(fs11, 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
|
+
})(fs11.readSync);
|
|
1029
|
+
function patchLchmod(fs12) {
|
|
1030
|
+
fs12.lchmod = function(path16, mode, callback) {
|
|
1031
|
+
fs12.open(
|
|
1032
|
+
path16,
|
|
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
|
+
fs12.fchmod(fd, mode, function(err2) {
|
|
1041
|
+
fs12.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
|
+
fs12.lchmodSync = function(path16, mode) {
|
|
1049
|
+
var fd = fs12.openSync(path16, constants2.O_WRONLY | constants2.O_SYMLINK, mode);
|
|
1050
1050
|
var threw = true;
|
|
1051
1051
|
var ret;
|
|
1052
1052
|
try {
|
|
1053
|
-
ret =
|
|
1053
|
+
ret = fs12.fchmodSync(fd, mode);
|
|
1054
1054
|
threw = false;
|
|
1055
1055
|
} finally {
|
|
1056
1056
|
if (threw) {
|
|
1057
1057
|
try {
|
|
1058
|
-
|
|
1058
|
+
fs12.closeSync(fd);
|
|
1059
1059
|
} catch (er) {
|
|
1060
1060
|
}
|
|
1061
1061
|
} else {
|
|
1062
|
-
|
|
1062
|
+
fs12.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(fs12) {
|
|
1069
|
+
if (constants2.hasOwnProperty("O_SYMLINK") && fs12.futimes) {
|
|
1070
|
+
fs12.lutimes = function(path16, at, mt, cb) {
|
|
1071
|
+
fs12.open(path16, constants2.O_SYMLINK, function(er, fd) {
|
|
1072
1072
|
if (er) {
|
|
1073
1073
|
if (cb) cb(er);
|
|
1074
1074
|
return;
|
|
1075
1075
|
}
|
|
1076
|
-
|
|
1077
|
-
|
|
1076
|
+
fs12.futimes(fd, at, mt, function(er2) {
|
|
1077
|
+
fs12.close(fd, function(er22) {
|
|
1078
1078
|
if (cb) cb(er2 || er22);
|
|
1079
1079
|
});
|
|
1080
1080
|
});
|
|
1081
1081
|
});
|
|
1082
1082
|
};
|
|
1083
|
-
|
|
1084
|
-
var fd =
|
|
1083
|
+
fs12.lutimesSync = function(path16, at, mt) {
|
|
1084
|
+
var fd = fs12.openSync(path16, constants2.O_SYMLINK);
|
|
1085
1085
|
var ret;
|
|
1086
1086
|
var threw = true;
|
|
1087
1087
|
try {
|
|
1088
|
-
ret =
|
|
1088
|
+
ret = fs12.futimesSync(fd, at, mt);
|
|
1089
1089
|
threw = false;
|
|
1090
1090
|
} finally {
|
|
1091
1091
|
if (threw) {
|
|
1092
1092
|
try {
|
|
1093
|
-
|
|
1093
|
+
fs12.closeSync(fd);
|
|
1094
1094
|
} catch (er) {
|
|
1095
1095
|
}
|
|
1096
1096
|
} else {
|
|
1097
|
-
|
|
1097
|
+
fs12.closeSync(fd);
|
|
1098
1098
|
}
|
|
1099
1099
|
}
|
|
1100
1100
|
return ret;
|
|
1101
1101
|
};
|
|
1102
|
-
} else if (
|
|
1103
|
-
|
|
1102
|
+
} else if (fs12.futimes) {
|
|
1103
|
+
fs12.lutimes = function(_a3, _b, _c5, cb) {
|
|
1104
1104
|
if (cb) process.nextTick(cb);
|
|
1105
1105
|
};
|
|
1106
|
-
|
|
1106
|
+
fs12.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(fs11, 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(fs11, 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(fs11, 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(fs11, 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(fs11, target, options, callback) : orig.call(fs11, 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(fs11, target, options) : orig.call(fs11, 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(fs11) {
|
|
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(path16, options) {
|
|
1203
|
+
if (!(this instanceof ReadStream)) return new ReadStream(path16, options);
|
|
1204
1204
|
Stream.call(this);
|
|
1205
1205
|
var self2 = this;
|
|
1206
|
-
this.path =
|
|
1206
|
+
this.path = path16;
|
|
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
|
+
fs11.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(path16, options) {
|
|
1252
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path16, options);
|
|
1253
1253
|
Stream.call(this);
|
|
1254
|
-
this.path =
|
|
1254
|
+
this.path = path16;
|
|
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 = fs11.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 fs11 = __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 (!fs11[gracefulQueue]) {
|
|
1347
1347
|
queue = global[gracefulQueue] || [];
|
|
1348
|
-
publishQueue(
|
|
1349
|
-
|
|
1348
|
+
publishQueue(fs11, queue);
|
|
1349
|
+
fs11.close = (function(fs$close) {
|
|
1350
1350
|
function close(fd, cb) {
|
|
1351
|
-
return fs$close.call(
|
|
1351
|
+
return fs$close.call(fs11, 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
|
+
})(fs11.close);
|
|
1364
|
+
fs11.closeSync = (function(fs$closeSync) {
|
|
1365
1365
|
function closeSync(fd) {
|
|
1366
|
-
fs$closeSync.apply(
|
|
1366
|
+
fs$closeSync.apply(fs11, 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
|
+
})(fs11.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(fs11[gracefulQueue]);
|
|
1377
|
+
__require("assert").equal(fs11[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, fs11[gracefulQueue]);
|
|
1384
|
+
}
|
|
1385
|
+
module.exports = patch(clone(fs11));
|
|
1386
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs11.__patched) {
|
|
1387
|
+
module.exports = patch(fs11);
|
|
1388
|
+
fs11.__patched = true;
|
|
1389
|
+
}
|
|
1390
|
+
function patch(fs12) {
|
|
1391
|
+
polyfills(fs12);
|
|
1392
|
+
fs12.gracefulify = patch;
|
|
1393
|
+
fs12.createReadStream = createReadStream;
|
|
1394
|
+
fs12.createWriteStream = createWriteStream;
|
|
1395
|
+
var fs$readFile = fs12.readFile;
|
|
1396
|
+
fs12.readFile = readFile;
|
|
1397
|
+
function readFile(path16, 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(path16, options, cb);
|
|
1401
|
+
function go$readFile(path17, options2, cb2, startTime) {
|
|
1402
|
+
return fs$readFile(path17, options2, function(err) {
|
|
1403
1403
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
1404
|
-
enqueue([go$readFile, [
|
|
1404
|
+
enqueue([go$readFile, [path17, 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 = fs12.writeFile;
|
|
1413
|
+
fs12.writeFile = writeFile;
|
|
1414
|
+
function writeFile(path16, 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(path16, data2, options, cb);
|
|
1418
|
+
function go$writeFile(path17, data3, options2, cb2, startTime) {
|
|
1419
|
+
return fs$writeFile(path17, data3, options2, function(err) {
|
|
1420
1420
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
1421
|
-
enqueue([go$writeFile, [
|
|
1421
|
+
enqueue([go$writeFile, [path17, 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 = fs12.appendFile;
|
|
1430
1430
|
if (fs$appendFile)
|
|
1431
|
-
|
|
1432
|
-
function appendFile(
|
|
1431
|
+
fs12.appendFile = appendFile;
|
|
1432
|
+
function appendFile(path16, 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(path16, data2, options, cb);
|
|
1436
|
+
function go$appendFile(path17, data3, options2, cb2, startTime) {
|
|
1437
|
+
return fs$appendFile(path17, data3, options2, function(err) {
|
|
1438
1438
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
1439
|
-
enqueue([go$appendFile, [
|
|
1439
|
+
enqueue([go$appendFile, [path17, 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 = fs12.copyFile;
|
|
1448
1448
|
if (fs$copyFile)
|
|
1449
|
-
|
|
1449
|
+
fs12.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 = fs12.readdir;
|
|
1468
|
+
fs12.readdir = readdir;
|
|
1469
1469
|
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
1470
|
-
function readdir(
|
|
1470
|
+
function readdir(path16, 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(path17, options2, cb2, startTime) {
|
|
1474
|
+
return fs$readdir(path17, fs$readdirCallback(
|
|
1475
|
+
path17,
|
|
1476
1476
|
options2,
|
|
1477
1477
|
cb2,
|
|
1478
1478
|
startTime
|
|
1479
1479
|
));
|
|
1480
|
-
} : function go$readdir2(
|
|
1481
|
-
return fs$readdir(
|
|
1482
|
-
|
|
1480
|
+
} : function go$readdir2(path17, options2, cb2, startTime) {
|
|
1481
|
+
return fs$readdir(path17, options2, fs$readdirCallback(
|
|
1482
|
+
path17,
|
|
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(path16, options, cb);
|
|
1489
|
+
function fs$readdirCallback(path17, 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
|
+
[path17, 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(fs12);
|
|
1510
1510
|
ReadStream = legStreams.ReadStream;
|
|
1511
1511
|
WriteStream = legStreams.WriteStream;
|
|
1512
1512
|
}
|
|
1513
|
-
var fs$ReadStream =
|
|
1513
|
+
var fs$ReadStream = fs12.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 = fs12.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(fs12, "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(fs12, "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(fs12, "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(fs12, "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(path16, 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(path16, 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(path16, options) {
|
|
1604
|
+
return new fs12.ReadStream(path16, options);
|
|
1605
1605
|
}
|
|
1606
|
-
function createWriteStream(
|
|
1607
|
-
return new
|
|
1606
|
+
function createWriteStream(path16, options) {
|
|
1607
|
+
return new fs12.WriteStream(path16, options);
|
|
1608
1608
|
}
|
|
1609
|
-
var fs$open =
|
|
1610
|
-
|
|
1611
|
-
function open(
|
|
1609
|
+
var fs$open = fs12.open;
|
|
1610
|
+
fs12.open = open;
|
|
1611
|
+
function open(path16, 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(path16, flags, mode, cb);
|
|
1615
|
+
function go$open(path17, flags2, mode2, cb2, startTime) {
|
|
1616
|
+
return fs$open(path17, flags2, mode2, function(err, fd) {
|
|
1617
1617
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
1618
|
-
enqueue([go$open, [
|
|
1618
|
+
enqueue([go$open, [path17, 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 fs12;
|
|
1627
1627
|
}
|
|
1628
1628
|
function enqueue(elem) {
|
|
1629
1629
|
debug2("ENQUEUE", elem[0].name, elem[1]);
|
|
1630
|
-
|
|
1630
|
+
fs11[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 < fs11[gracefulQueue].length; ++i6) {
|
|
1637
|
+
if (fs11[gracefulQueue][i6].length > 2) {
|
|
1638
|
+
fs11[gracefulQueue][i6][3] = now;
|
|
1639
|
+
fs11[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 (fs11[gracefulQueue].length === 0)
|
|
1648
1648
|
return;
|
|
1649
|
-
var elem =
|
|
1649
|
+
var elem = fs11[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
|
+
fs11[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, fs11, callback) {
|
|
2107
|
+
const cachedPrecision = fs11[cacheSymbol];
|
|
2108
2108
|
if (cachedPrecision) {
|
|
2109
|
-
return
|
|
2109
|
+
return fs11.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
|
+
fs11.utimes(file, mtime, mtime, (err) => {
|
|
2118
2118
|
if (err) {
|
|
2119
2119
|
return callback(err);
|
|
2120
2120
|
}
|
|
2121
|
-
|
|
2121
|
+
fs11.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(fs11, 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 path16 = __require("path");
|
|
2148
|
+
var fs11 = 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, path16.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: fs11,
|
|
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: fs11,
|
|
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: fs11,
|
|
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 fs11 = require_graceful_fs();
|
|
2385
|
+
function createSyncFs(fs12) {
|
|
2386
2386
|
const methods = ["mkdir", "realpath", "stat", "rmdir", "utimes"];
|
|
2387
|
-
const newFs = { ...
|
|
2387
|
+
const newFs = { ...fs12 };
|
|
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 = fs12[`${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 || fs11);
|
|
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
|
}
|
|
@@ -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 path16 = requestOptions.url.replace(options.baseUrl, "");
|
|
3789
3789
|
return request(options).then((response) => {
|
|
3790
3790
|
octokit.log.info(
|
|
3791
|
-
`${requestOptions.method} ${
|
|
3791
|
+
`${requestOptions.method} ${path16} - ${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} ${path16} - ${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
|
+
(path16) => path16.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: path16, errorMaps, issueData } = params;
|
|
8521
|
+
const fullPath = [...path16, ...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, path16, key) {
|
|
8830
8830
|
this._cachedPath = [];
|
|
8831
8831
|
this.parent = parent;
|
|
8832
8832
|
this.data = value;
|
|
8833
|
-
this._path =
|
|
8833
|
+
this._path = path16;
|
|
8834
8834
|
this._key = key;
|
|
8835
8835
|
}
|
|
8836
8836
|
get path() {
|
|
@@ -12517,8 +12517,8 @@ var init_permissions = __esm({
|
|
|
12517
12517
|
});
|
|
12518
12518
|
|
|
12519
12519
|
// ../canopycms/src/paths/normalize.ts
|
|
12520
|
-
function normalizeFilesystemPath(
|
|
12521
|
-
return
|
|
12520
|
+
function normalizeFilesystemPath(path16) {
|
|
12521
|
+
return path16.split(/[\\/]+/).filter(Boolean).join("/");
|
|
12522
12522
|
}
|
|
12523
12523
|
var init_normalize = __esm({
|
|
12524
12524
|
"../canopycms/src/paths/normalize.ts"() {
|
|
@@ -13668,9 +13668,9 @@ var init_createPaginator = __esm({
|
|
|
13668
13668
|
command = withCommand(command) ?? command;
|
|
13669
13669
|
return await client.send(command, ...args);
|
|
13670
13670
|
};
|
|
13671
|
-
get = (fromObject,
|
|
13671
|
+
get = (fromObject, path16) => {
|
|
13672
13672
|
let cursor2 = fromObject;
|
|
13673
|
-
const pathComponents =
|
|
13673
|
+
const pathComponents = path16.split(".");
|
|
13674
13674
|
for (const step of pathComponents) {
|
|
13675
13675
|
if (!cursor2 || typeof cursor2 !== "object") {
|
|
13676
13676
|
return void 0;
|
|
@@ -14688,12 +14688,12 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
14688
14688
|
const password = request.password ?? "";
|
|
14689
14689
|
auth = `${username}:${password}`;
|
|
14690
14690
|
}
|
|
14691
|
-
let
|
|
14691
|
+
let path16 = request.path;
|
|
14692
14692
|
if (queryString) {
|
|
14693
|
-
|
|
14693
|
+
path16 += `?${queryString}`;
|
|
14694
14694
|
}
|
|
14695
14695
|
if (request.fragment) {
|
|
14696
|
-
|
|
14696
|
+
path16 += `#${request.fragment}`;
|
|
14697
14697
|
}
|
|
14698
14698
|
let hostname = request.hostname ?? "";
|
|
14699
14699
|
if (hostname[0] === "[" && hostname.endsWith("]")) {
|
|
@@ -14705,7 +14705,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
14705
14705
|
headers: request.headers,
|
|
14706
14706
|
host: hostname,
|
|
14707
14707
|
method: request.method,
|
|
14708
|
-
path:
|
|
14708
|
+
path: path16,
|
|
14709
14709
|
port: request.port,
|
|
14710
14710
|
agent,
|
|
14711
14711
|
auth
|
|
@@ -14988,16 +14988,16 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
14988
14988
|
reject(err);
|
|
14989
14989
|
};
|
|
14990
14990
|
const queryString = querystringBuilder.buildQueryString(query || {});
|
|
14991
|
-
let
|
|
14991
|
+
let path16 = request.path;
|
|
14992
14992
|
if (queryString) {
|
|
14993
|
-
|
|
14993
|
+
path16 += `?${queryString}`;
|
|
14994
14994
|
}
|
|
14995
14995
|
if (request.fragment) {
|
|
14996
|
-
|
|
14996
|
+
path16 += `#${request.fragment}`;
|
|
14997
14997
|
}
|
|
14998
14998
|
const req = session.request({
|
|
14999
14999
|
...request.headers,
|
|
15000
|
-
[http2.constants.HTTP2_HEADER_PATH]:
|
|
15000
|
+
[http2.constants.HTTP2_HEADER_PATH]: path16,
|
|
15001
15001
|
[http2.constants.HTTP2_HEADER_METHOD]: method
|
|
15002
15002
|
});
|
|
15003
15003
|
session.ref();
|
|
@@ -15184,13 +15184,13 @@ var require_dist_cjs14 = __commonJS({
|
|
|
15184
15184
|
const abortError = buildAbortError(abortSignal);
|
|
15185
15185
|
return Promise.reject(abortError);
|
|
15186
15186
|
}
|
|
15187
|
-
let
|
|
15187
|
+
let path16 = request.path;
|
|
15188
15188
|
const queryString = querystringBuilder.buildQueryString(request.query || {});
|
|
15189
15189
|
if (queryString) {
|
|
15190
|
-
|
|
15190
|
+
path16 += `?${queryString}`;
|
|
15191
15191
|
}
|
|
15192
15192
|
if (request.fragment) {
|
|
15193
|
-
|
|
15193
|
+
path16 += `#${request.fragment}`;
|
|
15194
15194
|
}
|
|
15195
15195
|
let auth = "";
|
|
15196
15196
|
if (request.username != null || request.password != null) {
|
|
@@ -15199,7 +15199,7 @@ var require_dist_cjs14 = __commonJS({
|
|
|
15199
15199
|
auth = `${username}:${password}@`;
|
|
15200
15200
|
}
|
|
15201
15201
|
const { port, method } = request;
|
|
15202
|
-
const url = `${request.protocol}//${auth}${request.hostname}${port ? `:${port}` : ""}${
|
|
15202
|
+
const url = `${request.protocol}//${auth}${request.hostname}${port ? `:${port}` : ""}${path16}`;
|
|
15203
15203
|
const body = method === "GET" || method === "HEAD" ? void 0 : request.body;
|
|
15204
15204
|
const requestOptions = {
|
|
15205
15205
|
body,
|
|
@@ -17431,13 +17431,13 @@ function __disposeResources(env) {
|
|
|
17431
17431
|
}
|
|
17432
17432
|
return next();
|
|
17433
17433
|
}
|
|
17434
|
-
function __rewriteRelativeImportExtension(
|
|
17435
|
-
if (typeof
|
|
17436
|
-
return
|
|
17434
|
+
function __rewriteRelativeImportExtension(path16, preserveJsx) {
|
|
17435
|
+
if (typeof path16 === "string" && /^\.\.?\//.test(path16)) {
|
|
17436
|
+
return path16.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m5, tsx, d5, ext, cm) {
|
|
17437
17437
|
return tsx ? preserveJsx ? ".jsx" : ".js" : d5 && (!ext || !cm) ? m5 : d5 + ext + "." + cm.toLowerCase() + "js";
|
|
17438
17438
|
});
|
|
17439
17439
|
}
|
|
17440
|
-
return
|
|
17440
|
+
return path16;
|
|
17441
17441
|
}
|
|
17442
17442
|
var extendStatics, __assign, __createBinding, __setModuleDefault, ownKeys, _SuppressedError, tslib_es6_default;
|
|
17443
17443
|
var init_tslib_es6 = __esm({
|
|
@@ -18335,11 +18335,11 @@ var init_HttpBindingProtocol = __esm({
|
|
|
18335
18335
|
const opTraits = translateTraits(operationSchema.traits);
|
|
18336
18336
|
if (opTraits.http) {
|
|
18337
18337
|
request.method = opTraits.http[0];
|
|
18338
|
-
const [
|
|
18338
|
+
const [path16, search] = opTraits.http[1].split("?");
|
|
18339
18339
|
if (request.path == "/") {
|
|
18340
|
-
request.path =
|
|
18340
|
+
request.path = path16;
|
|
18341
18341
|
} else {
|
|
18342
|
-
request.path +=
|
|
18342
|
+
request.path += path16;
|
|
18343
18343
|
}
|
|
18344
18344
|
const traitSearchParams = new URLSearchParams(search ?? "");
|
|
18345
18345
|
Object.assign(query, Object.fromEntries(traitSearchParams));
|
|
@@ -18742,8 +18742,8 @@ var init_requestBuilder = __esm({
|
|
|
18742
18742
|
return this;
|
|
18743
18743
|
}
|
|
18744
18744
|
p(memberName, labelValueProvider, uriLabel, isGreedyLabel) {
|
|
18745
|
-
this.resolvePathStack.push((
|
|
18746
|
-
this.path = resolvedPath(
|
|
18745
|
+
this.resolvePathStack.push((path16) => {
|
|
18746
|
+
this.path = resolvedPath(path16, this.input, memberName, labelValueProvider, uriLabel, isGreedyLabel);
|
|
18747
18747
|
});
|
|
18748
18748
|
return this;
|
|
18749
18749
|
}
|
|
@@ -19393,18 +19393,18 @@ var require_dist_cjs20 = __commonJS({
|
|
|
19393
19393
|
}
|
|
19394
19394
|
};
|
|
19395
19395
|
var booleanEquals = (value1, value2) => value1 === value2;
|
|
19396
|
-
var getAttrPathList = (
|
|
19397
|
-
const parts =
|
|
19396
|
+
var getAttrPathList = (path16) => {
|
|
19397
|
+
const parts = path16.split(".");
|
|
19398
19398
|
const pathList = [];
|
|
19399
19399
|
for (const part of parts) {
|
|
19400
19400
|
const squareBracketIndex = part.indexOf("[");
|
|
19401
19401
|
if (squareBracketIndex !== -1) {
|
|
19402
19402
|
if (part.indexOf("]") !== part.length - 1) {
|
|
19403
|
-
throw new EndpointError(`Path: '${
|
|
19403
|
+
throw new EndpointError(`Path: '${path16}' does not end with ']'`);
|
|
19404
19404
|
}
|
|
19405
19405
|
const arrayIndex = part.slice(squareBracketIndex + 1, -1);
|
|
19406
19406
|
if (Number.isNaN(parseInt(arrayIndex))) {
|
|
19407
|
-
throw new EndpointError(`Invalid array index: '${arrayIndex}' in path: '${
|
|
19407
|
+
throw new EndpointError(`Invalid array index: '${arrayIndex}' in path: '${path16}'`);
|
|
19408
19408
|
}
|
|
19409
19409
|
if (squareBracketIndex !== 0) {
|
|
19410
19410
|
pathList.push(part.slice(0, squareBracketIndex));
|
|
@@ -19416,9 +19416,9 @@ var require_dist_cjs20 = __commonJS({
|
|
|
19416
19416
|
}
|
|
19417
19417
|
return pathList;
|
|
19418
19418
|
};
|
|
19419
|
-
var getAttr = (value,
|
|
19419
|
+
var getAttr = (value, path16) => getAttrPathList(path16).reduce((acc, index) => {
|
|
19420
19420
|
if (typeof acc !== "object") {
|
|
19421
|
-
throw new EndpointError(`Index '${index}' in '${
|
|
19421
|
+
throw new EndpointError(`Index '${index}' in '${path16}' not found in '${JSON.stringify(value)}'`);
|
|
19422
19422
|
} else if (Array.isArray(acc)) {
|
|
19423
19423
|
return acc[parseInt(index)];
|
|
19424
19424
|
}
|
|
@@ -19437,8 +19437,8 @@ var require_dist_cjs20 = __commonJS({
|
|
|
19437
19437
|
return value;
|
|
19438
19438
|
}
|
|
19439
19439
|
if (typeof value === "object" && "hostname" in value) {
|
|
19440
|
-
const { hostname: hostname2, port, protocol: protocol2 = "", path:
|
|
19441
|
-
const url = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${
|
|
19440
|
+
const { hostname: hostname2, port, protocol: protocol2 = "", path: path16 = "", query = {} } = value;
|
|
19441
|
+
const url = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${path16}`);
|
|
19442
19442
|
url.search = Object.entries(query).map(([k6, v5]) => `${k6}=${v5}`).join("&");
|
|
19443
19443
|
return url;
|
|
19444
19444
|
}
|
|
@@ -20883,10 +20883,10 @@ ${longDate}
|
|
|
20883
20883
|
${credentialScope}
|
|
20884
20884
|
${utilHexEncoding.toHex(hashedRequest)}`;
|
|
20885
20885
|
}
|
|
20886
|
-
getCanonicalPath({ path:
|
|
20886
|
+
getCanonicalPath({ path: path16 }) {
|
|
20887
20887
|
if (this.uriEscapePath) {
|
|
20888
20888
|
const normalizedPathSegments = [];
|
|
20889
|
-
for (const pathSegment of
|
|
20889
|
+
for (const pathSegment of path16.split("/")) {
|
|
20890
20890
|
if (pathSegment?.length === 0)
|
|
20891
20891
|
continue;
|
|
20892
20892
|
if (pathSegment === ".")
|
|
@@ -20897,11 +20897,11 @@ ${utilHexEncoding.toHex(hashedRequest)}`;
|
|
|
20897
20897
|
normalizedPathSegments.push(pathSegment);
|
|
20898
20898
|
}
|
|
20899
20899
|
}
|
|
20900
|
-
const normalizedPath = `${
|
|
20900
|
+
const normalizedPath = `${path16?.startsWith("/") ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && path16?.endsWith("/") ? "/" : ""}`;
|
|
20901
20901
|
const doubleEncoded = utilUriEscape.escapeUri(normalizedPath);
|
|
20902
20902
|
return doubleEncoded.replace(/%2F/g, "/");
|
|
20903
20903
|
}
|
|
20904
|
-
return
|
|
20904
|
+
return path16;
|
|
20905
20905
|
}
|
|
20906
20906
|
validateResolvedCredentials(credentials) {
|
|
20907
20907
|
if (typeof credentials !== "object" || typeof credentials.accessKeyId !== "string" || typeof credentials.secretAccessKey !== "string") {
|
|
@@ -22205,11 +22205,11 @@ var init_SmithyRpcV2CborProtocol = __esm({
|
|
|
22205
22205
|
}
|
|
22206
22206
|
}
|
|
22207
22207
|
const { service, operation: operation2 } = (0, import_util_middleware5.getSmithyContext)(context);
|
|
22208
|
-
const
|
|
22208
|
+
const path16 = `/service/${service}/operation/${operation2}`;
|
|
22209
22209
|
if (request.path.endsWith("/")) {
|
|
22210
|
-
request.path +=
|
|
22210
|
+
request.path += path16.slice(1);
|
|
22211
22211
|
} else {
|
|
22212
|
-
request.path +=
|
|
22212
|
+
request.path += path16;
|
|
22213
22213
|
}
|
|
22214
22214
|
return request;
|
|
22215
22215
|
}
|
|
@@ -27854,14 +27854,14 @@ var require_readFile = __commonJS({
|
|
|
27854
27854
|
var promises_1 = __require("node:fs/promises");
|
|
27855
27855
|
exports.filePromises = {};
|
|
27856
27856
|
exports.fileIntercept = {};
|
|
27857
|
-
var readFile = (
|
|
27858
|
-
if (exports.fileIntercept[
|
|
27859
|
-
return exports.fileIntercept[
|
|
27857
|
+
var readFile = (path16, options) => {
|
|
27858
|
+
if (exports.fileIntercept[path16] !== void 0) {
|
|
27859
|
+
return exports.fileIntercept[path16];
|
|
27860
27860
|
}
|
|
27861
|
-
if (!exports.filePromises[
|
|
27862
|
-
exports.filePromises[
|
|
27861
|
+
if (!exports.filePromises[path16] || options?.ignoreCache) {
|
|
27862
|
+
exports.filePromises[path16] = (0, promises_1.readFile)(path16, "utf8");
|
|
27863
27863
|
}
|
|
27864
|
-
return exports.filePromises[
|
|
27864
|
+
return exports.filePromises[path16];
|
|
27865
27865
|
};
|
|
27866
27866
|
exports.readFile = readFile;
|
|
27867
27867
|
}
|
|
@@ -27874,7 +27874,7 @@ var require_dist_cjs33 = __commonJS({
|
|
|
27874
27874
|
var getHomeDir = require_getHomeDir();
|
|
27875
27875
|
var getSSOTokenFilepath = require_getSSOTokenFilepath();
|
|
27876
27876
|
var getSSOTokenFromFile = require_getSSOTokenFromFile();
|
|
27877
|
-
var
|
|
27877
|
+
var path16 = __require("path");
|
|
27878
27878
|
var types = require_dist_cjs();
|
|
27879
27879
|
var readFile = require_readFile();
|
|
27880
27880
|
var ENV_PROFILE = "AWS_PROFILE";
|
|
@@ -27896,9 +27896,9 @@ var require_dist_cjs33 = __commonJS({
|
|
|
27896
27896
|
...data2.default && { default: data2.default }
|
|
27897
27897
|
});
|
|
27898
27898
|
var ENV_CONFIG_PATH = "AWS_CONFIG_FILE";
|
|
27899
|
-
var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] ||
|
|
27899
|
+
var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || path16.join(getHomeDir.getHomeDir(), ".aws", "config");
|
|
27900
27900
|
var ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE";
|
|
27901
|
-
var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] ||
|
|
27901
|
+
var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || path16.join(getHomeDir.getHomeDir(), ".aws", "credentials");
|
|
27902
27902
|
var prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/;
|
|
27903
27903
|
var profileNameBlockList = ["__proto__", "profile __proto__"];
|
|
27904
27904
|
var parseIni = (iniData) => {
|
|
@@ -27953,11 +27953,11 @@ var require_dist_cjs33 = __commonJS({
|
|
|
27953
27953
|
const relativeHomeDirPrefix = "~/";
|
|
27954
27954
|
let resolvedFilepath = filepath;
|
|
27955
27955
|
if (filepath.startsWith(relativeHomeDirPrefix)) {
|
|
27956
|
-
resolvedFilepath =
|
|
27956
|
+
resolvedFilepath = path16.join(homeDir, filepath.slice(2));
|
|
27957
27957
|
}
|
|
27958
27958
|
let resolvedConfigFilepath = configFilepath;
|
|
27959
27959
|
if (configFilepath.startsWith(relativeHomeDirPrefix)) {
|
|
27960
|
-
resolvedConfigFilepath =
|
|
27960
|
+
resolvedConfigFilepath = path16.join(homeDir, configFilepath.slice(2));
|
|
27961
27961
|
}
|
|
27962
27962
|
const parsedFiles = await Promise.all([
|
|
27963
27963
|
readFile.readFile(resolvedConfigFilepath, {
|
|
@@ -27996,8 +27996,8 @@ var require_dist_cjs33 = __commonJS({
|
|
|
27996
27996
|
getFileRecord() {
|
|
27997
27997
|
return readFile.fileIntercept;
|
|
27998
27998
|
},
|
|
27999
|
-
interceptFile(
|
|
28000
|
-
readFile.fileIntercept[
|
|
27999
|
+
interceptFile(path17, contents) {
|
|
28000
|
+
readFile.fileIntercept[path17] = Promise.resolve(contents);
|
|
28001
28001
|
},
|
|
28002
28002
|
getTokenRecord() {
|
|
28003
28003
|
return getSSOTokenFromFile.tokenIntercept;
|
|
@@ -28322,8 +28322,8 @@ var require_dist_cjs36 = __commonJS({
|
|
|
28322
28322
|
return endpoint.url.href;
|
|
28323
28323
|
}
|
|
28324
28324
|
if ("hostname" in endpoint) {
|
|
28325
|
-
const { protocol, hostname, port, path:
|
|
28326
|
-
return `${protocol}//${hostname}${port ? ":" + port : ""}${
|
|
28325
|
+
const { protocol, hostname, port, path: path16 } = endpoint;
|
|
28326
|
+
return `${protocol}//${hostname}${port ? ":" + port : ""}${path16}`;
|
|
28327
28327
|
}
|
|
28328
28328
|
}
|
|
28329
28329
|
return endpoint;
|
|
@@ -36520,8 +36520,8 @@ var require_dist_cjs53 = __commonJS({
|
|
|
36520
36520
|
});
|
|
36521
36521
|
|
|
36522
36522
|
// ../canopycms/src/worker/cms-worker.ts
|
|
36523
|
-
import
|
|
36524
|
-
import
|
|
36523
|
+
import fs9 from "node:fs/promises";
|
|
36524
|
+
import path13 from "node:path";
|
|
36525
36525
|
|
|
36526
36526
|
// ../../node_modules/.pnpm/simple-git@3.36.0/node_modules/simple-git/dist/esm/index.js
|
|
36527
36527
|
var import_file_exists = __toESM(require_dist(), 1);
|
|
@@ -37112,8 +37112,8 @@ function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
|
|
|
37112
37112
|
function forEachLineWithContent(input, callback) {
|
|
37113
37113
|
return toLinesWithContent(input, true).map((line) => callback(line));
|
|
37114
37114
|
}
|
|
37115
|
-
function folderExists(
|
|
37116
|
-
return (0, import_file_exists.exists)(
|
|
37115
|
+
function folderExists(path16) {
|
|
37116
|
+
return (0, import_file_exists.exists)(path16, import_file_exists.FOLDER);
|
|
37117
37117
|
}
|
|
37118
37118
|
function append(target, item) {
|
|
37119
37119
|
if (Array.isArray(target)) {
|
|
@@ -37515,8 +37515,8 @@ function checkIsRepoRootTask() {
|
|
|
37515
37515
|
commands: commands5,
|
|
37516
37516
|
format: "utf-8",
|
|
37517
37517
|
onError,
|
|
37518
|
-
parser(
|
|
37519
|
-
return /^\.(git)?$/.test(
|
|
37518
|
+
parser(path16) {
|
|
37519
|
+
return /^\.(git)?$/.test(path16.trim());
|
|
37520
37520
|
}
|
|
37521
37521
|
};
|
|
37522
37522
|
}
|
|
@@ -37950,11 +37950,11 @@ function parseGrep(grep) {
|
|
|
37950
37950
|
const paths = /* @__PURE__ */ new Set();
|
|
37951
37951
|
const results = {};
|
|
37952
37952
|
forEachLineWithContent(grep, (input) => {
|
|
37953
|
-
const [
|
|
37954
|
-
paths.add(
|
|
37955
|
-
(results[
|
|
37953
|
+
const [path16, line, preview] = input.split(NULL);
|
|
37954
|
+
paths.add(path16);
|
|
37955
|
+
(results[path16] = results[path16] || []).push({
|
|
37956
37956
|
line: asNumber(line),
|
|
37957
|
-
path:
|
|
37957
|
+
path: path16,
|
|
37958
37958
|
preview
|
|
37959
37959
|
});
|
|
37960
37960
|
});
|
|
@@ -38718,14 +38718,14 @@ var init_hash_object = __esm2({
|
|
|
38718
38718
|
init_task();
|
|
38719
38719
|
}
|
|
38720
38720
|
});
|
|
38721
|
-
function parseInit(bare,
|
|
38721
|
+
function parseInit(bare, path16, text) {
|
|
38722
38722
|
const response = String(text).trim();
|
|
38723
38723
|
let result;
|
|
38724
38724
|
if (result = initResponseRegex.exec(response)) {
|
|
38725
|
-
return new InitSummary(bare,
|
|
38725
|
+
return new InitSummary(bare, path16, false, result[1]);
|
|
38726
38726
|
}
|
|
38727
38727
|
if (result = reInitResponseRegex.exec(response)) {
|
|
38728
|
-
return new InitSummary(bare,
|
|
38728
|
+
return new InitSummary(bare, path16, true, result[1]);
|
|
38729
38729
|
}
|
|
38730
38730
|
let gitDir = "";
|
|
38731
38731
|
const tokens = response.split(" ");
|
|
@@ -38736,7 +38736,7 @@ function parseInit(bare, path15, text) {
|
|
|
38736
38736
|
break;
|
|
38737
38737
|
}
|
|
38738
38738
|
}
|
|
38739
|
-
return new InitSummary(bare,
|
|
38739
|
+
return new InitSummary(bare, path16, /^re/i.test(response), gitDir);
|
|
38740
38740
|
}
|
|
38741
38741
|
var InitSummary;
|
|
38742
38742
|
var initResponseRegex;
|
|
@@ -38745,9 +38745,9 @@ var init_InitSummary = __esm2({
|
|
|
38745
38745
|
"src/lib/responses/InitSummary.ts"() {
|
|
38746
38746
|
"use strict";
|
|
38747
38747
|
InitSummary = class {
|
|
38748
|
-
constructor(bare,
|
|
38748
|
+
constructor(bare, path16, existing, gitDir) {
|
|
38749
38749
|
this.bare = bare;
|
|
38750
|
-
this.path =
|
|
38750
|
+
this.path = path16;
|
|
38751
38751
|
this.existing = existing;
|
|
38752
38752
|
this.gitDir = gitDir;
|
|
38753
38753
|
}
|
|
@@ -38759,7 +38759,7 @@ var init_InitSummary = __esm2({
|
|
|
38759
38759
|
function hasBareCommand(command) {
|
|
38760
38760
|
return command.includes(bareCommand);
|
|
38761
38761
|
}
|
|
38762
|
-
function initTask(bare = false,
|
|
38762
|
+
function initTask(bare = false, path16, customArgs) {
|
|
38763
38763
|
const commands5 = ["init", ...customArgs];
|
|
38764
38764
|
if (bare && !hasBareCommand(commands5)) {
|
|
38765
38765
|
commands5.splice(1, 0, bareCommand);
|
|
@@ -38768,7 +38768,7 @@ function initTask(bare = false, path15, customArgs) {
|
|
|
38768
38768
|
commands: commands5,
|
|
38769
38769
|
format: "utf-8",
|
|
38770
38770
|
parser(text) {
|
|
38771
|
-
return parseInit(commands5.includes("--bare"),
|
|
38771
|
+
return parseInit(commands5.includes("--bare"), path16, text);
|
|
38772
38772
|
}
|
|
38773
38773
|
};
|
|
38774
38774
|
}
|
|
@@ -39583,12 +39583,12 @@ var init_FileStatusSummary = __esm2({
|
|
|
39583
39583
|
"use strict";
|
|
39584
39584
|
fromPathRegex = /^(.+)\0(.+)$/;
|
|
39585
39585
|
FileStatusSummary = class {
|
|
39586
|
-
constructor(
|
|
39587
|
-
this.path =
|
|
39586
|
+
constructor(path16, index, working_dir) {
|
|
39587
|
+
this.path = path16;
|
|
39588
39588
|
this.index = index;
|
|
39589
39589
|
this.working_dir = working_dir;
|
|
39590
39590
|
if (index === "R" || working_dir === "R") {
|
|
39591
|
-
const detail = fromPathRegex.exec(
|
|
39591
|
+
const detail = fromPathRegex.exec(path16) || [null, path16, path16];
|
|
39592
39592
|
this.from = detail[2] || "";
|
|
39593
39593
|
this.path = detail[1] || "";
|
|
39594
39594
|
}
|
|
@@ -39619,14 +39619,14 @@ function splitLine(result, lineStr) {
|
|
|
39619
39619
|
default:
|
|
39620
39620
|
return;
|
|
39621
39621
|
}
|
|
39622
|
-
function data2(index, workingDir,
|
|
39622
|
+
function data2(index, workingDir, path16) {
|
|
39623
39623
|
const raw = `${index}${workingDir}`;
|
|
39624
39624
|
const handler = parsers6.get(raw);
|
|
39625
39625
|
if (handler) {
|
|
39626
|
-
handler(result,
|
|
39626
|
+
handler(result, path16);
|
|
39627
39627
|
}
|
|
39628
39628
|
if (raw !== "##" && raw !== "!!") {
|
|
39629
|
-
result.files.push(new FileStatusSummary(
|
|
39629
|
+
result.files.push(new FileStatusSummary(path16, index, workingDir));
|
|
39630
39630
|
}
|
|
39631
39631
|
}
|
|
39632
39632
|
}
|
|
@@ -39977,9 +39977,9 @@ var init_simple_git_api = __esm2({
|
|
|
39977
39977
|
next
|
|
39978
39978
|
);
|
|
39979
39979
|
}
|
|
39980
|
-
hashObject(
|
|
39980
|
+
hashObject(path16, write) {
|
|
39981
39981
|
return this._runTask(
|
|
39982
|
-
hashObjectTask(
|
|
39982
|
+
hashObjectTask(path16, write === true),
|
|
39983
39983
|
trailingFunctionArgument(arguments)
|
|
39984
39984
|
);
|
|
39985
39985
|
}
|
|
@@ -40333,8 +40333,8 @@ var init_branch = __esm2({
|
|
|
40333
40333
|
}
|
|
40334
40334
|
});
|
|
40335
40335
|
function toPath(input) {
|
|
40336
|
-
const
|
|
40337
|
-
return
|
|
40336
|
+
const path16 = input.trim().replace(/^["']|["']$/g, "");
|
|
40337
|
+
return path16 && normalize(path16);
|
|
40338
40338
|
}
|
|
40339
40339
|
var parseCheckIgnore;
|
|
40340
40340
|
var init_CheckIgnore = __esm2({
|
|
@@ -40619,8 +40619,8 @@ __export2(sub_module_exports, {
|
|
|
40619
40619
|
subModuleTask: () => subModuleTask,
|
|
40620
40620
|
updateSubModuleTask: () => updateSubModuleTask
|
|
40621
40621
|
});
|
|
40622
|
-
function addSubModuleTask(repo,
|
|
40623
|
-
return subModuleTask(["add", repo,
|
|
40622
|
+
function addSubModuleTask(repo, path16) {
|
|
40623
|
+
return subModuleTask(["add", repo, path16]);
|
|
40624
40624
|
}
|
|
40625
40625
|
function initSubModuleTask(customArgs) {
|
|
40626
40626
|
return subModuleTask(["init", ...customArgs]);
|
|
@@ -40934,8 +40934,8 @@ var require_git = __commonJS2({
|
|
|
40934
40934
|
}
|
|
40935
40935
|
return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
|
|
40936
40936
|
};
|
|
40937
|
-
Git2.prototype.submoduleAdd = function(repo,
|
|
40938
|
-
return this._runTask(addSubModuleTask2(repo,
|
|
40937
|
+
Git2.prototype.submoduleAdd = function(repo, path16, then) {
|
|
40938
|
+
return this._runTask(addSubModuleTask2(repo, path16), trailingFunctionArgument2(arguments));
|
|
40939
40939
|
};
|
|
40940
40940
|
Git2.prototype.submoduleUpdate = function(args, then) {
|
|
40941
40941
|
return this._runTask(
|
|
@@ -41829,7 +41829,7 @@ async function recoverOrphanedTasks(taskDir, maxAgeMs = 5 * 6e4, logger2 = nullL
|
|
|
41829
41829
|
async function cleanupOldTasks(taskDir, maxAgeMs = 30 * 24 * 60 * 6e4, logger2 = nullLogger) {
|
|
41830
41830
|
const now = Date.now();
|
|
41831
41831
|
let cleaned = 0;
|
|
41832
|
-
for (const subdir of ["completed", "failed"]) {
|
|
41832
|
+
for (const subdir of ["completed", "failed", "corrupt"]) {
|
|
41833
41833
|
const dir = path2.join(taskDir, subdir);
|
|
41834
41834
|
let files;
|
|
41835
41835
|
try {
|
|
@@ -42738,6 +42738,8 @@ init_types3();
|
|
|
42738
42738
|
init_normalize();
|
|
42739
42739
|
|
|
42740
42740
|
// ../canopycms/src/utils/git.ts
|
|
42741
|
+
import fs7 from "node:fs/promises";
|
|
42742
|
+
import path9 from "node:path";
|
|
42741
42743
|
var REJECTED_MARKER = "[rejected]";
|
|
42742
42744
|
var NON_FAST_FORWARD_REASONS = ["non-fast-forward", "fetch first"];
|
|
42743
42745
|
var REJECTION_HINT = "Updates were rejected because";
|
|
@@ -42749,11 +42751,40 @@ var STALE_LEASE_REASON = "stale info";
|
|
|
42749
42751
|
function isStaleLeaseRejection(message) {
|
|
42750
42752
|
return message.includes(REJECTED_MARKER) && message.includes(STALE_LEASE_REASON);
|
|
42751
42753
|
}
|
|
42754
|
+
async function resolveGitDir(repoPath) {
|
|
42755
|
+
const dotGit = path9.join(repoPath, ".git");
|
|
42756
|
+
let stat;
|
|
42757
|
+
try {
|
|
42758
|
+
stat = await fs7.stat(dotGit);
|
|
42759
|
+
} catch {
|
|
42760
|
+
return null;
|
|
42761
|
+
}
|
|
42762
|
+
if (stat.isDirectory()) return dotGit;
|
|
42763
|
+
try {
|
|
42764
|
+
const pointer = await fs7.readFile(dotGit, "utf-8");
|
|
42765
|
+
const match2 = /^gitdir:\s*(.+)$/m.exec(pointer);
|
|
42766
|
+
if (!match2) return null;
|
|
42767
|
+
const target = match2[1].trim();
|
|
42768
|
+
return path9.isAbsolute(target) ? target : path9.resolve(repoPath, target);
|
|
42769
|
+
} catch {
|
|
42770
|
+
return null;
|
|
42771
|
+
}
|
|
42772
|
+
}
|
|
42773
|
+
async function isRebaseInProgress(repoPath) {
|
|
42774
|
+
const gitDir = await resolveGitDir(repoPath);
|
|
42775
|
+
if (!gitDir) return false;
|
|
42776
|
+
const results = await Promise.all(
|
|
42777
|
+
["rebase-merge", "rebase-apply"].map(
|
|
42778
|
+
(dir) => fs7.stat(path9.join(gitDir, dir)).then(() => true).catch(() => false)
|
|
42779
|
+
)
|
|
42780
|
+
);
|
|
42781
|
+
return results.some(Boolean);
|
|
42782
|
+
}
|
|
42752
42783
|
|
|
42753
42784
|
// ../canopycms/src/utils/provisioning-lock.ts
|
|
42754
42785
|
var import_proper_lockfile2 = __toESM(require_proper_lockfile(), 1);
|
|
42755
|
-
import
|
|
42756
|
-
import
|
|
42786
|
+
import fs8 from "node:fs/promises";
|
|
42787
|
+
import path10 from "node:path";
|
|
42757
42788
|
init_logger();
|
|
42758
42789
|
function provisioningLockOptions(lockPath, retries, onCompromised) {
|
|
42759
42790
|
return {
|
|
@@ -42805,8 +42836,8 @@ function releaseIgnoringAlreadyReleased(release, lockPath) {
|
|
|
42805
42836
|
};
|
|
42806
42837
|
}
|
|
42807
42838
|
async function tryAcquireProvisioningLock(lockTargetDir2, lockName, onCompromised) {
|
|
42808
|
-
await
|
|
42809
|
-
const lockPath =
|
|
42839
|
+
await fs8.mkdir(lockTargetDir2, { recursive: true });
|
|
42840
|
+
const lockPath = path10.join(lockTargetDir2, lockName);
|
|
42810
42841
|
const release = await import_proper_lockfile2.default.lock(lockPath, provisioningLockOptions(lockPath, 0, onCompromised));
|
|
42811
42842
|
return releaseIgnoringAlreadyReleased(release, lockPath);
|
|
42812
42843
|
}
|
|
@@ -42837,12 +42868,12 @@ var GITHUB_TRACKING_REF_PREFIX = "refs/remotes/github/";
|
|
|
42837
42868
|
init_deployment_name();
|
|
42838
42869
|
|
|
42839
42870
|
// ../canopycms/src/utils/content-write-lock.ts
|
|
42840
|
-
import
|
|
42871
|
+
import path11 from "node:path";
|
|
42841
42872
|
init_logger();
|
|
42842
42873
|
var META_DIR2 = ".canopy-meta";
|
|
42843
42874
|
var CONTENT_WRITE_LOCK_NAME = "content-write.lock";
|
|
42844
42875
|
function lockTargetDir(branchRoot) {
|
|
42845
|
-
return
|
|
42876
|
+
return path11.join(path11.resolve(branchRoot), META_DIR2);
|
|
42846
42877
|
}
|
|
42847
42878
|
function tryAcquireContentWriteLock(branchRoot, onCompromised) {
|
|
42848
42879
|
return tryAcquireProvisioningLock(
|
|
@@ -42853,10 +42884,10 @@ function tryAcquireContentWriteLock(branchRoot, onCompromised) {
|
|
|
42853
42884
|
}
|
|
42854
42885
|
|
|
42855
42886
|
// ../canopycms/src/worker/worker-status.ts
|
|
42856
|
-
import
|
|
42887
|
+
import path12 from "node:path";
|
|
42857
42888
|
var WORKER_STATUS_FILE = "worker-status.json";
|
|
42858
42889
|
async function writeWorkerStatus(taskDir, report) {
|
|
42859
|
-
const filePath =
|
|
42890
|
+
const filePath = path12.join(taskDir, WORKER_STATUS_FILE);
|
|
42860
42891
|
const stamped = { ...report, updatedAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
42861
42892
|
await atomicWriteFile(filePath, JSON.stringify(stamped, null, 2));
|
|
42862
42893
|
}
|
|
@@ -42951,15 +42982,15 @@ var CmsWorker = class {
|
|
|
42951
42982
|
this.releaseLockFn = null;
|
|
42952
42983
|
this.log = cmsTaskQueueLogger;
|
|
42953
42984
|
this.octokit = createCanopyOctokit({ auth: config.githubToken });
|
|
42954
|
-
this.taskDir =
|
|
42955
|
-
this.remoteGitPath =
|
|
42956
|
-
this.contentBranchesPath =
|
|
42985
|
+
this.taskDir = path13.join(config.workspacePath, ".tasks");
|
|
42986
|
+
this.remoteGitPath = path13.join(config.workspacePath, "remote.git");
|
|
42987
|
+
this.contentBranchesPath = path13.join(config.workspacePath, "content-branches");
|
|
42957
42988
|
this.baseBranch = config.baseBranch ?? "main";
|
|
42958
42989
|
this.sanitizedBaseBranch = sanitizeBranchName(this.baseBranch);
|
|
42959
42990
|
this.maxTasksPerCycle = config.maxTasksPerCycle ?? 10;
|
|
42960
42991
|
this.taskTimeoutMs = config.taskTimeoutMs ?? DEFAULT_TASK_TIMEOUT;
|
|
42961
42992
|
this.maxRetries = config.maxRetries ?? DEFAULT_MAX_RETRIES2;
|
|
42962
|
-
this.lockFilePath =
|
|
42993
|
+
this.lockFilePath = path13.join(config.workspacePath, ".tasks", ".worker-lock");
|
|
42963
42994
|
this.lockStaleMs = config.lockStaleMs ?? DEFAULT_LOCK_STALE_MS;
|
|
42964
42995
|
this.contentRoot = config.contentRoot ?? "content";
|
|
42965
42996
|
}
|
|
@@ -43110,7 +43141,7 @@ var CmsWorker = class {
|
|
|
43110
43141
|
* negligible, but a host with a badly wrong clock could misjudge liveness.
|
|
43111
43142
|
*/
|
|
43112
43143
|
async acquireLock() {
|
|
43113
|
-
await
|
|
43144
|
+
await fs9.mkdir(this.taskDir, { recursive: true });
|
|
43114
43145
|
try {
|
|
43115
43146
|
this.releaseLockFn = await import_proper_lockfile3.default.lock(this.taskDir, {
|
|
43116
43147
|
lockfilePath: this.lockFilePath,
|
|
@@ -43186,6 +43217,58 @@ var CmsWorker = class {
|
|
|
43186
43217
|
`refs/heads/${this.baseBranch}`
|
|
43187
43218
|
]);
|
|
43188
43219
|
}
|
|
43220
|
+
/**
|
|
43221
|
+
* Guarantee a bare repo's config carries NO `remote.origin.url`, and so no
|
|
43222
|
+
* embedded bot token.
|
|
43223
|
+
*
|
|
43224
|
+
* `git clone https://x-access-token:<token>@github.com/...` records that URL
|
|
43225
|
+
* verbatim as `remote.origin.url`, and for `remote.git` that config lives on
|
|
43226
|
+
* shared EFS. The security model in docs/deploying-to-aws.md -- "If Lambda is
|
|
43227
|
+
* compromised, an attacker can read/write content on EFS but cannot push to
|
|
43228
|
+
* GitHub", "Secrets stay on the worker" -- is false while that string is
|
|
43229
|
+
* there: a compromised Lambda could read the token off EFS and, despite
|
|
43230
|
+
* having no egress of its own, exfiltrate it by writing it into branch
|
|
43231
|
+
* content the worker then pushes to GitHub.
|
|
43232
|
+
*
|
|
43233
|
+
* Nothing needs the remote: every push passes the URL explicitly as an
|
|
43234
|
+
* argument (see the `git.push(this.buildGitHubUrl(), ...)` call sites), and
|
|
43235
|
+
* `verifyBaseBranchExists` reads local refs.
|
|
43236
|
+
*
|
|
43237
|
+
* VERIFIES rather than assuming: it re-reads the config and throws if the URL
|
|
43238
|
+
* survives, because the previous code's `.catch(() => {})` meant a failed
|
|
43239
|
+
* scrub was indistinguishable from a successful one.
|
|
43240
|
+
*/
|
|
43241
|
+
async scrubPersistedRemote(gitDir) {
|
|
43242
|
+
const git = simpleGit({ baseDir: gitDir });
|
|
43243
|
+
const readOriginUrl = async () => {
|
|
43244
|
+
try {
|
|
43245
|
+
const url = (await git.raw(["config", "--get", "remote.origin.url"])).trim();
|
|
43246
|
+
return url === "" ? null : url;
|
|
43247
|
+
} catch {
|
|
43248
|
+
return "unreadable";
|
|
43249
|
+
}
|
|
43250
|
+
};
|
|
43251
|
+
const before = await readOriginUrl();
|
|
43252
|
+
if (before === null) return;
|
|
43253
|
+
if (before === "unreadable") {
|
|
43254
|
+
workerLogWarn(
|
|
43255
|
+
` Could not read remote.origin.url in ${gitDir}; attempting the scrub anyway rather than assuming it is absent`
|
|
43256
|
+
);
|
|
43257
|
+
}
|
|
43258
|
+
try {
|
|
43259
|
+
await git.removeRemote("origin");
|
|
43260
|
+
} catch (err) {
|
|
43261
|
+
workerLogWarn(
|
|
43262
|
+
` removeRemote('origin') failed in ${gitDir}: ${getErrorMessage2(err)} -- verifying directly`
|
|
43263
|
+
);
|
|
43264
|
+
}
|
|
43265
|
+
const remaining = await readOriginUrl();
|
|
43266
|
+
if (remaining !== null) {
|
|
43267
|
+
throw new Error(
|
|
43268
|
+
`Could not confirm the 'origin' remote is gone from ${gitDir} (${remaining === "unreadable" ? "its config was unreadable" : "its config still records a URL"}). For a token-bearing clone URL that means the GitHub bot token may be persisted on shared storage. Refusing to continue.`
|
|
43269
|
+
);
|
|
43270
|
+
}
|
|
43271
|
+
}
|
|
43189
43272
|
/**
|
|
43190
43273
|
* Ensure remote.git bare repo exists.
|
|
43191
43274
|
* On first run, clone from GitHub as a bare repo.
|
|
@@ -43204,12 +43287,13 @@ var CmsWorker = class {
|
|
|
43204
43287
|
async ensureRemoteGit() {
|
|
43205
43288
|
let exists2;
|
|
43206
43289
|
try {
|
|
43207
|
-
await
|
|
43290
|
+
await fs9.stat(this.remoteGitPath);
|
|
43208
43291
|
exists2 = true;
|
|
43209
43292
|
} catch {
|
|
43210
43293
|
exists2 = false;
|
|
43211
43294
|
}
|
|
43212
43295
|
if (exists2) {
|
|
43296
|
+
await this.scrubPersistedRemote(this.remoteGitPath);
|
|
43213
43297
|
try {
|
|
43214
43298
|
await this.verifyBaseBranchExists(this.remoteGitPath);
|
|
43215
43299
|
} catch (err) {
|
|
@@ -43222,21 +43306,20 @@ var CmsWorker = class {
|
|
|
43222
43306
|
}
|
|
43223
43307
|
workerLog("Initializing remote.git from GitHub...");
|
|
43224
43308
|
const git = simpleGit();
|
|
43225
|
-
|
|
43309
|
+
const stagingPath = `${this.remoteGitPath}.cloning`;
|
|
43310
|
+
await fs9.rm(stagingPath, { recursive: true, force: true });
|
|
43226
43311
|
try {
|
|
43227
|
-
await
|
|
43312
|
+
await git.clone(this.buildGitHubUrl(), stagingPath, ["--bare"]);
|
|
43313
|
+
await this.scrubPersistedRemote(stagingPath);
|
|
43314
|
+
await this.verifyBaseBranchExists(stagingPath);
|
|
43228
43315
|
} catch (err) {
|
|
43229
|
-
workerLogError(
|
|
43230
|
-
|
|
43231
|
-
);
|
|
43232
|
-
await fs8.rm(this.remoteGitPath, { recursive: true, force: true });
|
|
43316
|
+
workerLogError(`remote.git clone failed: ${redactCredentials(getErrorMessage2(err))}`);
|
|
43317
|
+
await fs9.rm(stagingPath, { recursive: true, force: true });
|
|
43233
43318
|
throw new Error(
|
|
43234
|
-
`remote.git clone of ${this.config.githubOwner}/${this.config.githubRepo} has no branch '${this.baseBranch}' - the GitHub repository
|
|
43319
|
+
`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).`
|
|
43235
43320
|
);
|
|
43236
43321
|
}
|
|
43237
|
-
|
|
43238
|
-
await bareGit.removeRemote("origin").catch(() => {
|
|
43239
|
-
});
|
|
43322
|
+
await fs9.rename(stagingPath, this.remoteGitPath);
|
|
43240
43323
|
workerLog("remote.git initialized");
|
|
43241
43324
|
}
|
|
43242
43325
|
/**
|
|
@@ -43445,7 +43528,7 @@ var CmsWorker = class {
|
|
|
43445
43528
|
if (!branch) return;
|
|
43446
43529
|
const branchPath = this.branchWorkspacePath(branch);
|
|
43447
43530
|
try {
|
|
43448
|
-
await
|
|
43531
|
+
await fs9.stat(branchPath);
|
|
43449
43532
|
} catch {
|
|
43450
43533
|
return;
|
|
43451
43534
|
}
|
|
@@ -43489,7 +43572,7 @@ var CmsWorker = class {
|
|
|
43489
43572
|
if (!branch) return;
|
|
43490
43573
|
const branchPath = this.branchWorkspacePath(branch);
|
|
43491
43574
|
try {
|
|
43492
|
-
await
|
|
43575
|
+
await fs9.stat(branchPath);
|
|
43493
43576
|
} catch {
|
|
43494
43577
|
return;
|
|
43495
43578
|
}
|
|
@@ -43525,7 +43608,7 @@ var CmsWorker = class {
|
|
|
43525
43608
|
* is sanitized.
|
|
43526
43609
|
*/
|
|
43527
43610
|
branchWorkspacePath(branchRefName) {
|
|
43528
|
-
return
|
|
43611
|
+
return path13.join(this.contentBranchesPath, sanitizeBranchName(branchRefName));
|
|
43529
43612
|
}
|
|
43530
43613
|
/**
|
|
43531
43614
|
* What `remote.git` currently holds for `branchRef`, or null when this
|
|
@@ -43952,7 +44035,7 @@ var CmsWorker = class {
|
|
|
43952
44035
|
*/
|
|
43953
44036
|
async hasPendingHistoryRewrite(branchName) {
|
|
43954
44037
|
try {
|
|
43955
|
-
const branchPath =
|
|
44038
|
+
const branchPath = path13.join(this.contentBranchesPath, sanitizeBranchName(branchName));
|
|
43956
44039
|
const metaFile = await BranchMetadataFileManager.loadOnly(branchPath);
|
|
43957
44040
|
return typeof metaFile?.branch.historyRewrittenFrom === "string";
|
|
43958
44041
|
} catch {
|
|
@@ -44027,7 +44110,7 @@ var CmsWorker = class {
|
|
|
44027
44110
|
async cleanupTrashedBranchDirs() {
|
|
44028
44111
|
let entries;
|
|
44029
44112
|
try {
|
|
44030
|
-
entries = await
|
|
44113
|
+
entries = await fs9.readdir(this.contentBranchesPath);
|
|
44031
44114
|
} catch (err) {
|
|
44032
44115
|
if (isNodeError(err) && err.code === "ENOENT") return 0;
|
|
44033
44116
|
throw err;
|
|
@@ -44048,7 +44131,7 @@ var CmsWorker = class {
|
|
|
44048
44131
|
}
|
|
44049
44132
|
if (now - stampDate.getTime() < TRASH_RETENTION_MS) continue;
|
|
44050
44133
|
try {
|
|
44051
|
-
await
|
|
44134
|
+
await fs9.rm(path13.join(this.contentBranchesPath, name), {
|
|
44052
44135
|
recursive: true,
|
|
44053
44136
|
force: true,
|
|
44054
44137
|
maxRetries: 3,
|
|
@@ -44086,12 +44169,12 @@ var CmsWorker = class {
|
|
|
44086
44169
|
* untouched rather than force-resolved.
|
|
44087
44170
|
*/
|
|
44088
44171
|
async refreshBaseBranchWorkspace() {
|
|
44089
|
-
const basePath32 =
|
|
44090
|
-
const gitDir =
|
|
44172
|
+
const basePath32 = path13.join(this.contentBranchesPath, this.sanitizedBaseBranch);
|
|
44173
|
+
const gitDir = path13.join(basePath32, ".git");
|
|
44091
44174
|
try {
|
|
44092
44175
|
let gitDirStat;
|
|
44093
44176
|
try {
|
|
44094
|
-
gitDirStat = await
|
|
44177
|
+
gitDirStat = await fs9.stat(gitDir);
|
|
44095
44178
|
} catch {
|
|
44096
44179
|
gitDirStat = null;
|
|
44097
44180
|
}
|
|
@@ -44282,7 +44365,7 @@ var CmsWorker = class {
|
|
|
44282
44365
|
const failed = [];
|
|
44283
44366
|
let branchDirs;
|
|
44284
44367
|
try {
|
|
44285
|
-
branchDirs = await
|
|
44368
|
+
branchDirs = await fs9.readdir(this.contentBranchesPath);
|
|
44286
44369
|
} catch {
|
|
44287
44370
|
return { rebased, skippedDirty, skippedLocked, failed };
|
|
44288
44371
|
}
|
|
@@ -44290,10 +44373,10 @@ var CmsWorker = class {
|
|
|
44290
44373
|
if (branchDir.startsWith(".") || branchDir === "branches.json") {
|
|
44291
44374
|
continue;
|
|
44292
44375
|
}
|
|
44293
|
-
const branchPath =
|
|
44294
|
-
const gitDir =
|
|
44376
|
+
const branchPath = path13.join(this.contentBranchesPath, branchDir);
|
|
44377
|
+
const gitDir = path13.join(branchPath, ".git");
|
|
44295
44378
|
try {
|
|
44296
|
-
const stat = await
|
|
44379
|
+
const stat = await fs9.stat(gitDir);
|
|
44297
44380
|
if (!stat.isDirectory()) {
|
|
44298
44381
|
workerLog(` Skipping ${branchDir}: .git is not a directory`);
|
|
44299
44382
|
continue;
|
|
@@ -44345,6 +44428,29 @@ var CmsWorker = class {
|
|
|
44345
44428
|
throw lockErr;
|
|
44346
44429
|
}
|
|
44347
44430
|
try {
|
|
44431
|
+
if (await isRebaseInProgress(branchPath)) {
|
|
44432
|
+
const preAbort = await branchGit.status().catch(() => null);
|
|
44433
|
+
const collateral = (preAbort?.files ?? []).filter((f5) => !preAbort?.conflicted.includes(f5.path)).filter((f5) => f5.working_dir !== " " && f5.working_dir !== "?").map((f5) => f5.path);
|
|
44434
|
+
if (collateral.length > 0) {
|
|
44435
|
+
workerLogWarn(
|
|
44436
|
+
` ${branchDir}: aborting the interrupted rebase will DISCARD working-tree changes to ${collateral.length} file(s) saved while the worker was down: ${collateral.join(", ")}`
|
|
44437
|
+
);
|
|
44438
|
+
}
|
|
44439
|
+
workerLogWarn(
|
|
44440
|
+
` ${branchDir}: found an interrupted rebase (this worker's own abandoned work) -- aborting it to recover the branch`
|
|
44441
|
+
);
|
|
44442
|
+
try {
|
|
44443
|
+
await branchGit.rebase(["--abort"]);
|
|
44444
|
+
} catch (abortErr) {
|
|
44445
|
+
const reason = redactCredentials(
|
|
44446
|
+
`could not abort interrupted rebase: ${getErrorMessage2(abortErr)}`
|
|
44447
|
+
);
|
|
44448
|
+
workerLogWarn(` Skipping ${branchDir}: ${reason}`);
|
|
44449
|
+
failed.push({ branch: branchDir, error: reason });
|
|
44450
|
+
await this.recordRebaseFailure(branchPath, branchDir, reason);
|
|
44451
|
+
continue;
|
|
44452
|
+
}
|
|
44453
|
+
}
|
|
44348
44454
|
const dirtyCheck = await branchGit.status();
|
|
44349
44455
|
if (dirtyCheck.files.length > 0) {
|
|
44350
44456
|
workerLog(` Skipping ${branchDir}: has uncommitted changes`);
|
|
@@ -44412,11 +44518,31 @@ var CmsWorker = class {
|
|
|
44412
44518
|
const st = await branchGit.status();
|
|
44413
44519
|
if (st.conflicted.length > 0) {
|
|
44414
44520
|
await this.afterConflictDetectedForTesting();
|
|
44521
|
+
const conflictKind = new Map(
|
|
44522
|
+
st.files.map((f5) => [f5.path, `${f5.index}${f5.working_dir}`])
|
|
44523
|
+
);
|
|
44524
|
+
let resolutionFailure;
|
|
44415
44525
|
for (const file of st.conflicted) {
|
|
44416
|
-
|
|
44417
|
-
|
|
44526
|
+
const kind = conflictKind.get(file);
|
|
44527
|
+
try {
|
|
44528
|
+
if (kind === "UD") {
|
|
44529
|
+
await branchGit.raw(["rm", "-f", "--", file]);
|
|
44530
|
+
} else if (kind === "DU") {
|
|
44531
|
+
await branchGit.add(file);
|
|
44532
|
+
} else {
|
|
44533
|
+
await branchGit.raw(["checkout", "--theirs", file]);
|
|
44534
|
+
await branchGit.add(file);
|
|
44535
|
+
}
|
|
44536
|
+
} catch (resolveErr) {
|
|
44537
|
+
resolutionFailure = `failed to resolve conflicted file '${file}' (status ${kind ?? "??"}): ` + getErrorMessage2(resolveErr);
|
|
44538
|
+
break;
|
|
44539
|
+
}
|
|
44418
44540
|
conflictedFiles.push(file);
|
|
44419
44541
|
}
|
|
44542
|
+
if (resolutionFailure !== void 0) {
|
|
44543
|
+
failureReason = resolutionFailure;
|
|
44544
|
+
break;
|
|
44545
|
+
}
|
|
44420
44546
|
} else {
|
|
44421
44547
|
const msg = rebaseErr instanceof Error ? rebaseErr.message : "";
|
|
44422
44548
|
if (msg.toLowerCase().includes("nothing to commit") || msg.toLowerCase().includes("apply --skip")) {
|
|
@@ -44466,13 +44592,13 @@ var CmsWorker = class {
|
|
|
44466
44592
|
await invalidateBranchContentCaches(branchPath);
|
|
44467
44593
|
const normalizedContentRoot = normalizeFilesystemPath(this.contentRoot);
|
|
44468
44594
|
const conflictIds = [...new Set(conflictedFiles)].map((f5) => {
|
|
44469
|
-
const fileId = extractIdFromFilename(
|
|
44595
|
+
const fileId = extractIdFromFilename(path13.basename(f5));
|
|
44470
44596
|
if (fileId) return fileId;
|
|
44471
|
-
const parentDir =
|
|
44597
|
+
const parentDir = path13.basename(path13.dirname(f5));
|
|
44472
44598
|
const dirId = extractIdFromFilename(parentDir);
|
|
44473
44599
|
if (dirId) return dirId;
|
|
44474
|
-
const parentPath = normalizeFilesystemPath(
|
|
44475
|
-
if (
|
|
44600
|
+
const parentPath = normalizeFilesystemPath(path13.dirname(f5));
|
|
44601
|
+
if (path13.basename(f5) === ".collection.json" && parentPath === normalizedContentRoot) {
|
|
44476
44602
|
return ROOT_COLLECTION_ID;
|
|
44477
44603
|
}
|
|
44478
44604
|
return null;
|
|
@@ -44506,6 +44632,18 @@ var CmsWorker = class {
|
|
|
44506
44632
|
}
|
|
44507
44633
|
}
|
|
44508
44634
|
} finally {
|
|
44635
|
+
try {
|
|
44636
|
+
if (await isRebaseInProgress(branchPath)) {
|
|
44637
|
+
workerLogWarn(
|
|
44638
|
+
` ${branchDir}: rebase still in progress on exit -- aborting so the clone is not left wedged`
|
|
44639
|
+
);
|
|
44640
|
+
await branchGit.rebase(["--abort"]);
|
|
44641
|
+
}
|
|
44642
|
+
} catch (abortErr) {
|
|
44643
|
+
workerLogWarn(
|
|
44644
|
+
` Failed to abort in-progress rebase for ${branchDir}: ${getErrorMessage2(abortErr)}`
|
|
44645
|
+
);
|
|
44646
|
+
}
|
|
44509
44647
|
await releaseContentLock?.().catch((releaseErr) => {
|
|
44510
44648
|
workerLogWarn(
|
|
44511
44649
|
` Failed to release content-write lock for ${branchDir}: ${getErrorMessage2(releaseErr)}`
|
|
@@ -47715,10 +47853,10 @@ var SessionAPI = class extends AbstractAPI {
|
|
|
47715
47853
|
*/
|
|
47716
47854
|
async getToken(sessionId, template, expiresInSeconds) {
|
|
47717
47855
|
this.requireId(sessionId);
|
|
47718
|
-
const
|
|
47856
|
+
const path16 = template ? joinPaths(basePath24, sessionId, "tokens", template) : joinPaths(basePath24, sessionId, "tokens");
|
|
47719
47857
|
const requestOptions = {
|
|
47720
47858
|
method: "POST",
|
|
47721
|
-
path:
|
|
47859
|
+
path: path16
|
|
47722
47860
|
};
|
|
47723
47861
|
if (expiresInSeconds !== void 0) {
|
|
47724
47862
|
requestOptions.bodyParams = { expires_in_seconds: expiresInSeconds };
|
|
@@ -49840,12 +49978,12 @@ function buildRequest(options) {
|
|
|
49840
49978
|
userAgent = USER_AGENT,
|
|
49841
49979
|
skipApiVersionInUrl = false
|
|
49842
49980
|
} = options;
|
|
49843
|
-
const { path:
|
|
49981
|
+
const { path: path16, method, queryParams, headerParams, bodyParams, formData, options: opts } = requestOptions;
|
|
49844
49982
|
const { deepSnakecaseBodyParamKeys = false } = opts || {};
|
|
49845
49983
|
if (requireSecretKey) {
|
|
49846
49984
|
assertValidSecretKey(secretKey);
|
|
49847
49985
|
}
|
|
49848
|
-
const url = skipApiVersionInUrl ? joinPaths(apiUrl,
|
|
49986
|
+
const url = skipApiVersionInUrl ? joinPaths(apiUrl, path16) : joinPaths(apiUrl, apiVersion, path16);
|
|
49849
49987
|
const finalUrl = new URL(url);
|
|
49850
49988
|
if (queryParams) {
|
|
49851
49989
|
const snakecasedQueryParams = snakecase_keys_default({ ...queryParams });
|
|
@@ -51907,38 +52045,38 @@ function createClerkClient(options) {
|
|
|
51907
52045
|
}
|
|
51908
52046
|
|
|
51909
52047
|
// ../canopycms/src/auth/file-based-auth-cache.ts
|
|
51910
|
-
import
|
|
51911
|
-
import
|
|
52048
|
+
import fs10 from "node:fs/promises";
|
|
52049
|
+
import path14 from "node:path";
|
|
51912
52050
|
var log5 = createDebugLogger({ prefix: "FileBasedAuthCache" });
|
|
51913
52051
|
async function writeAuthCacheSnapshot(cachePath, files) {
|
|
51914
|
-
await
|
|
52052
|
+
await fs10.mkdir(cachePath, { recursive: true });
|
|
51915
52053
|
const timestamp2 = Date.now();
|
|
51916
|
-
const snapshotDir =
|
|
51917
|
-
await
|
|
52054
|
+
const snapshotDir = path14.join(cachePath, `snapshot-${timestamp2}`);
|
|
52055
|
+
await fs10.mkdir(snapshotDir, { recursive: true });
|
|
51918
52056
|
for (const [fileName, data2] of Object.entries(files)) {
|
|
51919
|
-
const tmpPath =
|
|
51920
|
-
const finalPath =
|
|
51921
|
-
await
|
|
51922
|
-
await
|
|
51923
|
-
}
|
|
51924
|
-
const currentLink =
|
|
51925
|
-
const tmpLink =
|
|
51926
|
-
await
|
|
51927
|
-
await
|
|
52057
|
+
const tmpPath = path14.join(snapshotDir, `${fileName}.tmp`);
|
|
52058
|
+
const finalPath = path14.join(snapshotDir, fileName);
|
|
52059
|
+
await fs10.writeFile(tmpPath, JSON.stringify(data2, null, 2), "utf-8");
|
|
52060
|
+
await fs10.rename(tmpPath, finalPath);
|
|
52061
|
+
}
|
|
52062
|
+
const currentLink = path14.join(cachePath, "current");
|
|
52063
|
+
const tmpLink = path14.join(cachePath, `current-${timestamp2}`);
|
|
52064
|
+
await fs10.symlink(path14.basename(snapshotDir), tmpLink);
|
|
52065
|
+
await fs10.rename(tmpLink, currentLink);
|
|
51928
52066
|
await cleanupOldSnapshots(cachePath, 2);
|
|
51929
52067
|
return snapshotDir;
|
|
51930
52068
|
}
|
|
51931
52069
|
async function cleanupOldSnapshots(cachePath, keepCount) {
|
|
51932
52070
|
let entries;
|
|
51933
52071
|
try {
|
|
51934
|
-
entries = await
|
|
52072
|
+
entries = await fs10.readdir(cachePath);
|
|
51935
52073
|
} catch {
|
|
51936
52074
|
return;
|
|
51937
52075
|
}
|
|
51938
52076
|
const snapshots = entries.filter((e5) => e5.startsWith("snapshot-")).sort().reverse();
|
|
51939
52077
|
for (const snapshot of snapshots.slice(keepCount)) {
|
|
51940
52078
|
try {
|
|
51941
|
-
await
|
|
52079
|
+
await fs10.rm(path14.join(cachePath, snapshot), {
|
|
51942
52080
|
recursive: true,
|
|
51943
52081
|
force: true
|
|
51944
52082
|
});
|
|
@@ -52032,7 +52170,7 @@ async function refreshClerkCache(options) {
|
|
|
52032
52170
|
}
|
|
52033
52171
|
|
|
52034
52172
|
// worker/index.ts
|
|
52035
|
-
import
|
|
52173
|
+
import path15 from "node:path";
|
|
52036
52174
|
async function getSecret(secretArn, retries = 3) {
|
|
52037
52175
|
const { SecretsManagerClient, GetSecretValueCommand } = await Promise.resolve().then(() => __toESM(require_dist_cjs53(), 1));
|
|
52038
52176
|
const client = new SecretsManagerClient({});
|
|
@@ -52071,7 +52209,7 @@ async function main() {
|
|
|
52071
52209
|
if (!clerkSecretKey && process.env.CLERK_SECRET_KEY_SECRET_ARN) {
|
|
52072
52210
|
clerkSecretKey = await getSecret(process.env.CLERK_SECRET_KEY_SECRET_ARN);
|
|
52073
52211
|
}
|
|
52074
|
-
const cachePath =
|
|
52212
|
+
const cachePath = path15.join(workspacePath, ".cache");
|
|
52075
52213
|
const refreshAuthCache = clerkSecretKey ? async () => {
|
|
52076
52214
|
const result = await refreshClerkCache({
|
|
52077
52215
|
secretKey: clerkSecretKey,
|