@clef-sh/cli 0.1.13 → 0.1.14
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/index.cjs +1080 -1577
- package/dist/index.cjs.map +4 -4
- package/dist/index.mjs +1072 -1570
- package/dist/index.mjs.map +4 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -31,6 +31,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
31
31
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
32
32
|
mod
|
|
33
33
|
));
|
|
34
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
34
35
|
|
|
35
36
|
// ../../node_modules/commander/lib/error.js
|
|
36
37
|
var require_error = __commonJS({
|
|
@@ -965,8 +966,8 @@ var require_command = __commonJS({
|
|
|
965
966
|
"../../node_modules/commander/lib/command.js"(exports2) {
|
|
966
967
|
var EventEmitter = require("node:events").EventEmitter;
|
|
967
968
|
var childProcess = require("node:child_process");
|
|
968
|
-
var
|
|
969
|
-
var
|
|
969
|
+
var path57 = require("node:path");
|
|
970
|
+
var fs38 = require("node:fs");
|
|
970
971
|
var process2 = require("node:process");
|
|
971
972
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
972
973
|
var { CommanderError: CommanderError2 } = require_error();
|
|
@@ -1898,11 +1899,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1898
1899
|
let launchWithNode = false;
|
|
1899
1900
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1900
1901
|
function findFile(baseDir, baseName) {
|
|
1901
|
-
const localBin =
|
|
1902
|
-
if (
|
|
1903
|
-
if (sourceExt.includes(
|
|
1902
|
+
const localBin = path57.resolve(baseDir, baseName);
|
|
1903
|
+
if (fs38.existsSync(localBin)) return localBin;
|
|
1904
|
+
if (sourceExt.includes(path57.extname(baseName))) return void 0;
|
|
1904
1905
|
const foundExt = sourceExt.find(
|
|
1905
|
-
(ext) =>
|
|
1906
|
+
(ext) => fs38.existsSync(`${localBin}${ext}`)
|
|
1906
1907
|
);
|
|
1907
1908
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
1908
1909
|
return void 0;
|
|
@@ -1914,21 +1915,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1914
1915
|
if (this._scriptPath) {
|
|
1915
1916
|
let resolvedScriptPath;
|
|
1916
1917
|
try {
|
|
1917
|
-
resolvedScriptPath =
|
|
1918
|
+
resolvedScriptPath = fs38.realpathSync(this._scriptPath);
|
|
1918
1919
|
} catch (err) {
|
|
1919
1920
|
resolvedScriptPath = this._scriptPath;
|
|
1920
1921
|
}
|
|
1921
|
-
executableDir =
|
|
1922
|
-
|
|
1922
|
+
executableDir = path57.resolve(
|
|
1923
|
+
path57.dirname(resolvedScriptPath),
|
|
1923
1924
|
executableDir
|
|
1924
1925
|
);
|
|
1925
1926
|
}
|
|
1926
1927
|
if (executableDir) {
|
|
1927
1928
|
let localFile = findFile(executableDir, executableFile);
|
|
1928
1929
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
1929
|
-
const legacyName =
|
|
1930
|
+
const legacyName = path57.basename(
|
|
1930
1931
|
this._scriptPath,
|
|
1931
|
-
|
|
1932
|
+
path57.extname(this._scriptPath)
|
|
1932
1933
|
);
|
|
1933
1934
|
if (legacyName !== this._name) {
|
|
1934
1935
|
localFile = findFile(
|
|
@@ -1939,7 +1940,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1939
1940
|
}
|
|
1940
1941
|
executableFile = localFile || executableFile;
|
|
1941
1942
|
}
|
|
1942
|
-
launchWithNode = sourceExt.includes(
|
|
1943
|
+
launchWithNode = sourceExt.includes(path57.extname(executableFile));
|
|
1943
1944
|
let proc;
|
|
1944
1945
|
if (process2.platform !== "win32") {
|
|
1945
1946
|
if (launchWithNode) {
|
|
@@ -2779,7 +2780,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2779
2780
|
* @return {Command}
|
|
2780
2781
|
*/
|
|
2781
2782
|
nameFromFilename(filename) {
|
|
2782
|
-
this._name =
|
|
2783
|
+
this._name = path57.basename(filename, path57.extname(filename));
|
|
2783
2784
|
return this;
|
|
2784
2785
|
}
|
|
2785
2786
|
/**
|
|
@@ -2793,9 +2794,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2793
2794
|
* @param {string} [path]
|
|
2794
2795
|
* @return {(string|null|Command)}
|
|
2795
2796
|
*/
|
|
2796
|
-
executableDir(
|
|
2797
|
-
if (
|
|
2798
|
-
this._executableDir =
|
|
2797
|
+
executableDir(path58) {
|
|
2798
|
+
if (path58 === void 0) return this._executableDir;
|
|
2799
|
+
this._executableDir = path58;
|
|
2799
2800
|
return this;
|
|
2800
2801
|
}
|
|
2801
2802
|
/**
|
|
@@ -3102,17 +3103,17 @@ var require_visit = __commonJS({
|
|
|
3102
3103
|
visit.BREAK = BREAK;
|
|
3103
3104
|
visit.SKIP = SKIP;
|
|
3104
3105
|
visit.REMOVE = REMOVE;
|
|
3105
|
-
function visit_(key, node2, visitor,
|
|
3106
|
-
const ctrl = callVisitor(key, node2, visitor,
|
|
3106
|
+
function visit_(key, node2, visitor, path57) {
|
|
3107
|
+
const ctrl = callVisitor(key, node2, visitor, path57);
|
|
3107
3108
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
3108
|
-
replaceNode(key,
|
|
3109
|
-
return visit_(key, ctrl, visitor,
|
|
3109
|
+
replaceNode(key, path57, ctrl);
|
|
3110
|
+
return visit_(key, ctrl, visitor, path57);
|
|
3110
3111
|
}
|
|
3111
3112
|
if (typeof ctrl !== "symbol") {
|
|
3112
3113
|
if (identity.isCollection(node2)) {
|
|
3113
|
-
|
|
3114
|
+
path57 = Object.freeze(path57.concat(node2));
|
|
3114
3115
|
for (let i = 0; i < node2.items.length; ++i) {
|
|
3115
|
-
const ci = visit_(i, node2.items[i], visitor,
|
|
3116
|
+
const ci = visit_(i, node2.items[i], visitor, path57);
|
|
3116
3117
|
if (typeof ci === "number")
|
|
3117
3118
|
i = ci - 1;
|
|
3118
3119
|
else if (ci === BREAK)
|
|
@@ -3123,13 +3124,13 @@ var require_visit = __commonJS({
|
|
|
3123
3124
|
}
|
|
3124
3125
|
}
|
|
3125
3126
|
} else if (identity.isPair(node2)) {
|
|
3126
|
-
|
|
3127
|
-
const ck = visit_("key", node2.key, visitor,
|
|
3127
|
+
path57 = Object.freeze(path57.concat(node2));
|
|
3128
|
+
const ck = visit_("key", node2.key, visitor, path57);
|
|
3128
3129
|
if (ck === BREAK)
|
|
3129
3130
|
return BREAK;
|
|
3130
3131
|
else if (ck === REMOVE)
|
|
3131
3132
|
node2.key = null;
|
|
3132
|
-
const cv = visit_("value", node2.value, visitor,
|
|
3133
|
+
const cv = visit_("value", node2.value, visitor, path57);
|
|
3133
3134
|
if (cv === BREAK)
|
|
3134
3135
|
return BREAK;
|
|
3135
3136
|
else if (cv === REMOVE)
|
|
@@ -3150,17 +3151,17 @@ var require_visit = __commonJS({
|
|
|
3150
3151
|
visitAsync.BREAK = BREAK;
|
|
3151
3152
|
visitAsync.SKIP = SKIP;
|
|
3152
3153
|
visitAsync.REMOVE = REMOVE;
|
|
3153
|
-
async function visitAsync_(key, node2, visitor,
|
|
3154
|
-
const ctrl = await callVisitor(key, node2, visitor,
|
|
3154
|
+
async function visitAsync_(key, node2, visitor, path57) {
|
|
3155
|
+
const ctrl = await callVisitor(key, node2, visitor, path57);
|
|
3155
3156
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
3156
|
-
replaceNode(key,
|
|
3157
|
-
return visitAsync_(key, ctrl, visitor,
|
|
3157
|
+
replaceNode(key, path57, ctrl);
|
|
3158
|
+
return visitAsync_(key, ctrl, visitor, path57);
|
|
3158
3159
|
}
|
|
3159
3160
|
if (typeof ctrl !== "symbol") {
|
|
3160
3161
|
if (identity.isCollection(node2)) {
|
|
3161
|
-
|
|
3162
|
+
path57 = Object.freeze(path57.concat(node2));
|
|
3162
3163
|
for (let i = 0; i < node2.items.length; ++i) {
|
|
3163
|
-
const ci = await visitAsync_(i, node2.items[i], visitor,
|
|
3164
|
+
const ci = await visitAsync_(i, node2.items[i], visitor, path57);
|
|
3164
3165
|
if (typeof ci === "number")
|
|
3165
3166
|
i = ci - 1;
|
|
3166
3167
|
else if (ci === BREAK)
|
|
@@ -3171,13 +3172,13 @@ var require_visit = __commonJS({
|
|
|
3171
3172
|
}
|
|
3172
3173
|
}
|
|
3173
3174
|
} else if (identity.isPair(node2)) {
|
|
3174
|
-
|
|
3175
|
-
const ck = await visitAsync_("key", node2.key, visitor,
|
|
3175
|
+
path57 = Object.freeze(path57.concat(node2));
|
|
3176
|
+
const ck = await visitAsync_("key", node2.key, visitor, path57);
|
|
3176
3177
|
if (ck === BREAK)
|
|
3177
3178
|
return BREAK;
|
|
3178
3179
|
else if (ck === REMOVE)
|
|
3179
3180
|
node2.key = null;
|
|
3180
|
-
const cv = await visitAsync_("value", node2.value, visitor,
|
|
3181
|
+
const cv = await visitAsync_("value", node2.value, visitor, path57);
|
|
3181
3182
|
if (cv === BREAK)
|
|
3182
3183
|
return BREAK;
|
|
3183
3184
|
else if (cv === REMOVE)
|
|
@@ -3204,23 +3205,23 @@ var require_visit = __commonJS({
|
|
|
3204
3205
|
}
|
|
3205
3206
|
return visitor;
|
|
3206
3207
|
}
|
|
3207
|
-
function callVisitor(key, node2, visitor,
|
|
3208
|
+
function callVisitor(key, node2, visitor, path57) {
|
|
3208
3209
|
if (typeof visitor === "function")
|
|
3209
|
-
return visitor(key, node2,
|
|
3210
|
+
return visitor(key, node2, path57);
|
|
3210
3211
|
if (identity.isMap(node2))
|
|
3211
|
-
return visitor.Map?.(key, node2,
|
|
3212
|
+
return visitor.Map?.(key, node2, path57);
|
|
3212
3213
|
if (identity.isSeq(node2))
|
|
3213
|
-
return visitor.Seq?.(key, node2,
|
|
3214
|
+
return visitor.Seq?.(key, node2, path57);
|
|
3214
3215
|
if (identity.isPair(node2))
|
|
3215
|
-
return visitor.Pair?.(key, node2,
|
|
3216
|
+
return visitor.Pair?.(key, node2, path57);
|
|
3216
3217
|
if (identity.isScalar(node2))
|
|
3217
|
-
return visitor.Scalar?.(key, node2,
|
|
3218
|
+
return visitor.Scalar?.(key, node2, path57);
|
|
3218
3219
|
if (identity.isAlias(node2))
|
|
3219
|
-
return visitor.Alias?.(key, node2,
|
|
3220
|
+
return visitor.Alias?.(key, node2, path57);
|
|
3220
3221
|
return void 0;
|
|
3221
3222
|
}
|
|
3222
|
-
function replaceNode(key,
|
|
3223
|
-
const parent =
|
|
3223
|
+
function replaceNode(key, path57, node2) {
|
|
3224
|
+
const parent = path57[path57.length - 1];
|
|
3224
3225
|
if (identity.isCollection(parent)) {
|
|
3225
3226
|
parent.items[key] = node2;
|
|
3226
3227
|
} else if (identity.isPair(parent)) {
|
|
@@ -3828,10 +3829,10 @@ var require_Collection = __commonJS({
|
|
|
3828
3829
|
var createNode = require_createNode();
|
|
3829
3830
|
var identity = require_identity();
|
|
3830
3831
|
var Node = require_Node();
|
|
3831
|
-
function collectionFromPath(schema,
|
|
3832
|
+
function collectionFromPath(schema, path57, value) {
|
|
3832
3833
|
let v = value;
|
|
3833
|
-
for (let i =
|
|
3834
|
-
const k =
|
|
3834
|
+
for (let i = path57.length - 1; i >= 0; --i) {
|
|
3835
|
+
const k = path57[i];
|
|
3835
3836
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
3836
3837
|
const a = [];
|
|
3837
3838
|
a[k] = v;
|
|
@@ -3850,7 +3851,7 @@ var require_Collection = __commonJS({
|
|
|
3850
3851
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
3851
3852
|
});
|
|
3852
3853
|
}
|
|
3853
|
-
var isEmptyPath = (
|
|
3854
|
+
var isEmptyPath = (path57) => path57 == null || typeof path57 === "object" && !!path57[Symbol.iterator]().next().done;
|
|
3854
3855
|
var Collection = class extends Node.NodeBase {
|
|
3855
3856
|
constructor(type, schema) {
|
|
3856
3857
|
super(type);
|
|
@@ -3880,11 +3881,11 @@ var require_Collection = __commonJS({
|
|
|
3880
3881
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
3881
3882
|
* that already exists in the map.
|
|
3882
3883
|
*/
|
|
3883
|
-
addIn(
|
|
3884
|
-
if (isEmptyPath(
|
|
3884
|
+
addIn(path57, value) {
|
|
3885
|
+
if (isEmptyPath(path57))
|
|
3885
3886
|
this.add(value);
|
|
3886
3887
|
else {
|
|
3887
|
-
const [key, ...rest] =
|
|
3888
|
+
const [key, ...rest] = path57;
|
|
3888
3889
|
const node2 = this.get(key, true);
|
|
3889
3890
|
if (identity.isCollection(node2))
|
|
3890
3891
|
node2.addIn(rest, value);
|
|
@@ -3898,8 +3899,8 @@ var require_Collection = __commonJS({
|
|
|
3898
3899
|
* Removes a value from the collection.
|
|
3899
3900
|
* @returns `true` if the item was found and removed.
|
|
3900
3901
|
*/
|
|
3901
|
-
deleteIn(
|
|
3902
|
-
const [key, ...rest] =
|
|
3902
|
+
deleteIn(path57) {
|
|
3903
|
+
const [key, ...rest] = path57;
|
|
3903
3904
|
if (rest.length === 0)
|
|
3904
3905
|
return this.delete(key);
|
|
3905
3906
|
const node2 = this.get(key, true);
|
|
@@ -3913,8 +3914,8 @@ var require_Collection = __commonJS({
|
|
|
3913
3914
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
3914
3915
|
* `true` (collections are always returned intact).
|
|
3915
3916
|
*/
|
|
3916
|
-
getIn(
|
|
3917
|
-
const [key, ...rest] =
|
|
3917
|
+
getIn(path57, keepScalar) {
|
|
3918
|
+
const [key, ...rest] = path57;
|
|
3918
3919
|
const node2 = this.get(key, true);
|
|
3919
3920
|
if (rest.length === 0)
|
|
3920
3921
|
return !keepScalar && identity.isScalar(node2) ? node2.value : node2;
|
|
@@ -3932,8 +3933,8 @@ var require_Collection = __commonJS({
|
|
|
3932
3933
|
/**
|
|
3933
3934
|
* Checks if the collection includes a value with the key `key`.
|
|
3934
3935
|
*/
|
|
3935
|
-
hasIn(
|
|
3936
|
-
const [key, ...rest] =
|
|
3936
|
+
hasIn(path57) {
|
|
3937
|
+
const [key, ...rest] = path57;
|
|
3937
3938
|
if (rest.length === 0)
|
|
3938
3939
|
return this.has(key);
|
|
3939
3940
|
const node2 = this.get(key, true);
|
|
@@ -3943,8 +3944,8 @@ var require_Collection = __commonJS({
|
|
|
3943
3944
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
3944
3945
|
* boolean to add/remove the item from the set.
|
|
3945
3946
|
*/
|
|
3946
|
-
setIn(
|
|
3947
|
-
const [key, ...rest] =
|
|
3947
|
+
setIn(path57, value) {
|
|
3948
|
+
const [key, ...rest] = path57;
|
|
3948
3949
|
if (rest.length === 0) {
|
|
3949
3950
|
this.set(key, value);
|
|
3950
3951
|
} else {
|
|
@@ -6456,9 +6457,9 @@ var require_Document = __commonJS({
|
|
|
6456
6457
|
this.contents.add(value);
|
|
6457
6458
|
}
|
|
6458
6459
|
/** Adds a value to the document. */
|
|
6459
|
-
addIn(
|
|
6460
|
+
addIn(path57, value) {
|
|
6460
6461
|
if (assertCollection(this.contents))
|
|
6461
|
-
this.contents.addIn(
|
|
6462
|
+
this.contents.addIn(path57, value);
|
|
6462
6463
|
}
|
|
6463
6464
|
/**
|
|
6464
6465
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -6533,14 +6534,14 @@ var require_Document = __commonJS({
|
|
|
6533
6534
|
* Removes a value from the document.
|
|
6534
6535
|
* @returns `true` if the item was found and removed.
|
|
6535
6536
|
*/
|
|
6536
|
-
deleteIn(
|
|
6537
|
-
if (Collection.isEmptyPath(
|
|
6537
|
+
deleteIn(path57) {
|
|
6538
|
+
if (Collection.isEmptyPath(path57)) {
|
|
6538
6539
|
if (this.contents == null)
|
|
6539
6540
|
return false;
|
|
6540
6541
|
this.contents = null;
|
|
6541
6542
|
return true;
|
|
6542
6543
|
}
|
|
6543
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
6544
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path57) : false;
|
|
6544
6545
|
}
|
|
6545
6546
|
/**
|
|
6546
6547
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -6555,10 +6556,10 @@ var require_Document = __commonJS({
|
|
|
6555
6556
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
6556
6557
|
* `true` (collections are always returned intact).
|
|
6557
6558
|
*/
|
|
6558
|
-
getIn(
|
|
6559
|
-
if (Collection.isEmptyPath(
|
|
6559
|
+
getIn(path57, keepScalar) {
|
|
6560
|
+
if (Collection.isEmptyPath(path57))
|
|
6560
6561
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
6561
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
6562
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path57, keepScalar) : void 0;
|
|
6562
6563
|
}
|
|
6563
6564
|
/**
|
|
6564
6565
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -6569,10 +6570,10 @@ var require_Document = __commonJS({
|
|
|
6569
6570
|
/**
|
|
6570
6571
|
* Checks if the document includes a value at `path`.
|
|
6571
6572
|
*/
|
|
6572
|
-
hasIn(
|
|
6573
|
-
if (Collection.isEmptyPath(
|
|
6573
|
+
hasIn(path57) {
|
|
6574
|
+
if (Collection.isEmptyPath(path57))
|
|
6574
6575
|
return this.contents !== void 0;
|
|
6575
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
6576
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path57) : false;
|
|
6576
6577
|
}
|
|
6577
6578
|
/**
|
|
6578
6579
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -6589,13 +6590,13 @@ var require_Document = __commonJS({
|
|
|
6589
6590
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
6590
6591
|
* boolean to add/remove the item from the set.
|
|
6591
6592
|
*/
|
|
6592
|
-
setIn(
|
|
6593
|
-
if (Collection.isEmptyPath(
|
|
6593
|
+
setIn(path57, value) {
|
|
6594
|
+
if (Collection.isEmptyPath(path57)) {
|
|
6594
6595
|
this.contents = value;
|
|
6595
6596
|
} else if (this.contents == null) {
|
|
6596
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
6597
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path57), value);
|
|
6597
6598
|
} else if (assertCollection(this.contents)) {
|
|
6598
|
-
this.contents.setIn(
|
|
6599
|
+
this.contents.setIn(path57, value);
|
|
6599
6600
|
}
|
|
6600
6601
|
}
|
|
6601
6602
|
/**
|
|
@@ -8552,9 +8553,9 @@ var require_cst_visit = __commonJS({
|
|
|
8552
8553
|
visit.BREAK = BREAK;
|
|
8553
8554
|
visit.SKIP = SKIP;
|
|
8554
8555
|
visit.REMOVE = REMOVE;
|
|
8555
|
-
visit.itemAtPath = (cst,
|
|
8556
|
+
visit.itemAtPath = (cst, path57) => {
|
|
8556
8557
|
let item = cst;
|
|
8557
|
-
for (const [field, index] of
|
|
8558
|
+
for (const [field, index] of path57) {
|
|
8558
8559
|
const tok = item?.[field];
|
|
8559
8560
|
if (tok && "items" in tok) {
|
|
8560
8561
|
item = tok.items[index];
|
|
@@ -8563,23 +8564,23 @@ var require_cst_visit = __commonJS({
|
|
|
8563
8564
|
}
|
|
8564
8565
|
return item;
|
|
8565
8566
|
};
|
|
8566
|
-
visit.parentCollection = (cst,
|
|
8567
|
-
const parent = visit.itemAtPath(cst,
|
|
8568
|
-
const field =
|
|
8567
|
+
visit.parentCollection = (cst, path57) => {
|
|
8568
|
+
const parent = visit.itemAtPath(cst, path57.slice(0, -1));
|
|
8569
|
+
const field = path57[path57.length - 1][0];
|
|
8569
8570
|
const coll = parent?.[field];
|
|
8570
8571
|
if (coll && "items" in coll)
|
|
8571
8572
|
return coll;
|
|
8572
8573
|
throw new Error("Parent collection not found");
|
|
8573
8574
|
};
|
|
8574
|
-
function _visit(
|
|
8575
|
-
let ctrl = visitor(item,
|
|
8575
|
+
function _visit(path57, item, visitor) {
|
|
8576
|
+
let ctrl = visitor(item, path57);
|
|
8576
8577
|
if (typeof ctrl === "symbol")
|
|
8577
8578
|
return ctrl;
|
|
8578
8579
|
for (const field of ["key", "value"]) {
|
|
8579
8580
|
const token = item[field];
|
|
8580
8581
|
if (token && "items" in token) {
|
|
8581
8582
|
for (let i = 0; i < token.items.length; ++i) {
|
|
8582
|
-
const ci = _visit(Object.freeze(
|
|
8583
|
+
const ci = _visit(Object.freeze(path57.concat([[field, i]])), token.items[i], visitor);
|
|
8583
8584
|
if (typeof ci === "number")
|
|
8584
8585
|
i = ci - 1;
|
|
8585
8586
|
else if (ci === BREAK)
|
|
@@ -8590,10 +8591,10 @@ var require_cst_visit = __commonJS({
|
|
|
8590
8591
|
}
|
|
8591
8592
|
}
|
|
8592
8593
|
if (typeof ctrl === "function" && field === "key")
|
|
8593
|
-
ctrl = ctrl(item,
|
|
8594
|
+
ctrl = ctrl(item, path57);
|
|
8594
8595
|
}
|
|
8595
8596
|
}
|
|
8596
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
8597
|
+
return typeof ctrl === "function" ? ctrl(item, path57) : ctrl;
|
|
8597
8598
|
}
|
|
8598
8599
|
exports2.visit = visit;
|
|
8599
8600
|
}
|
|
@@ -9878,14 +9879,14 @@ var require_parser = __commonJS({
|
|
|
9878
9879
|
case "scalar":
|
|
9879
9880
|
case "single-quoted-scalar":
|
|
9880
9881
|
case "double-quoted-scalar": {
|
|
9881
|
-
const
|
|
9882
|
+
const fs38 = this.flowScalar(this.type);
|
|
9882
9883
|
if (atNextItem || it.value) {
|
|
9883
|
-
map.items.push({ start, key:
|
|
9884
|
+
map.items.push({ start, key: fs38, sep: [] });
|
|
9884
9885
|
this.onKeyLine = true;
|
|
9885
9886
|
} else if (it.sep) {
|
|
9886
|
-
this.stack.push(
|
|
9887
|
+
this.stack.push(fs38);
|
|
9887
9888
|
} else {
|
|
9888
|
-
Object.assign(it, { key:
|
|
9889
|
+
Object.assign(it, { key: fs38, sep: [] });
|
|
9889
9890
|
this.onKeyLine = true;
|
|
9890
9891
|
}
|
|
9891
9892
|
return;
|
|
@@ -10013,13 +10014,13 @@ var require_parser = __commonJS({
|
|
|
10013
10014
|
case "scalar":
|
|
10014
10015
|
case "single-quoted-scalar":
|
|
10015
10016
|
case "double-quoted-scalar": {
|
|
10016
|
-
const
|
|
10017
|
+
const fs38 = this.flowScalar(this.type);
|
|
10017
10018
|
if (!it || it.value)
|
|
10018
|
-
fc.items.push({ start: [], key:
|
|
10019
|
+
fc.items.push({ start: [], key: fs38, sep: [] });
|
|
10019
10020
|
else if (it.sep)
|
|
10020
|
-
this.stack.push(
|
|
10021
|
+
this.stack.push(fs38);
|
|
10021
10022
|
else
|
|
10022
|
-
Object.assign(it, { key:
|
|
10023
|
+
Object.assign(it, { key: fs38, sep: [] });
|
|
10023
10024
|
return;
|
|
10024
10025
|
}
|
|
10025
10026
|
case "flow-map-end":
|
|
@@ -12490,7 +12491,7 @@ var require_age_encryption = __commonJS({
|
|
|
12490
12491
|
}
|
|
12491
12492
|
return to;
|
|
12492
12493
|
};
|
|
12493
|
-
var
|
|
12494
|
+
var __toCommonJS2 = (mod3) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod3);
|
|
12494
12495
|
var stdin_exports = {};
|
|
12495
12496
|
__export2(stdin_exports, {
|
|
12496
12497
|
Decrypter: () => Decrypter,
|
|
@@ -12503,7 +12504,7 @@ var require_age_encryption = __commonJS({
|
|
|
12503
12504
|
identityToRecipient: () => identityToRecipient,
|
|
12504
12505
|
webauthn: () => webauthn_exports
|
|
12505
12506
|
});
|
|
12506
|
-
module2.exports =
|
|
12507
|
+
module2.exports = __toCommonJS2(stdin_exports);
|
|
12507
12508
|
function isBytes(a) {
|
|
12508
12509
|
return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
|
|
12509
12510
|
}
|
|
@@ -13049,7 +13050,7 @@ var require_age_encryption = __commonJS({
|
|
|
13049
13050
|
};
|
|
13050
13051
|
}
|
|
13051
13052
|
// @__NO_SIDE_EFFECTS__
|
|
13052
|
-
function
|
|
13053
|
+
function join52(separator = "") {
|
|
13053
13054
|
astr("join", separator);
|
|
13054
13055
|
return {
|
|
13055
13056
|
encode: (from) => {
|
|
@@ -13179,9 +13180,9 @@ var require_age_encryption = __commonJS({
|
|
|
13179
13180
|
decode(s) {
|
|
13180
13181
|
return decodeBase64Builtin(s, false);
|
|
13181
13182
|
}
|
|
13182
|
-
} : /* @__PURE__ */ chain(/* @__PURE__ */ radix2(6), /* @__PURE__ */ alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), /* @__PURE__ */ padding(6), /* @__PURE__ */
|
|
13183
|
-
var base64nopad = /* @__PURE__ */ chain(/* @__PURE__ */ radix2(6), /* @__PURE__ */ alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), /* @__PURE__ */
|
|
13184
|
-
var BECH_ALPHABET = /* @__PURE__ */ chain(/* @__PURE__ */ alphabet("qpzry9x8gf2tvdw0s3jn54khce6mua7l"), /* @__PURE__ */
|
|
13183
|
+
} : /* @__PURE__ */ chain(/* @__PURE__ */ radix2(6), /* @__PURE__ */ alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), /* @__PURE__ */ padding(6), /* @__PURE__ */ join52(""));
|
|
13184
|
+
var base64nopad = /* @__PURE__ */ chain(/* @__PURE__ */ radix2(6), /* @__PURE__ */ alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), /* @__PURE__ */ join52(""));
|
|
13185
|
+
var BECH_ALPHABET = /* @__PURE__ */ chain(/* @__PURE__ */ alphabet("qpzry9x8gf2tvdw0s3jn54khce6mua7l"), /* @__PURE__ */ join52(""));
|
|
13185
13186
|
var POLYMOD_GENERATORS = [996825010, 642813549, 513874426, 1027748829, 705979059];
|
|
13186
13187
|
function bech32Polymod(pre) {
|
|
13187
13188
|
const b = pre >> 25;
|
|
@@ -16080,7 +16081,7 @@ var require_age_encryption = __commonJS({
|
|
|
16080
16081
|
const sig = drbg(seed, k2sig);
|
|
16081
16082
|
return sig.toBytes(opts2.format);
|
|
16082
16083
|
}
|
|
16083
|
-
function
|
|
16084
|
+
function verify3(signature, message, publicKey, opts2 = {}) {
|
|
16084
16085
|
const { lowS, prehash, format } = validateSigOpts(opts2, defaultSigOpts);
|
|
16085
16086
|
publicKey = abytes4(publicKey, void 0, "publicKey");
|
|
16086
16087
|
message = validateMsgAndHash(message, prehash);
|
|
@@ -16121,7 +16122,7 @@ var require_age_encryption = __commonJS({
|
|
|
16121
16122
|
lengths,
|
|
16122
16123
|
Point,
|
|
16123
16124
|
sign: sign2,
|
|
16124
|
-
verify:
|
|
16125
|
+
verify: verify3,
|
|
16125
16126
|
recoverPublicKey,
|
|
16126
16127
|
Signature,
|
|
16127
16128
|
hash
|
|
@@ -20710,15 +20711,15 @@ function saveRequests(repoRoot, requests) {
|
|
|
20710
20711
|
function upsertRequest(repoRoot, key, label, environment) {
|
|
20711
20712
|
const requests = loadRequests(repoRoot);
|
|
20712
20713
|
const now = /* @__PURE__ */ new Date();
|
|
20713
|
-
const
|
|
20714
|
+
const request2 = { key, label, requestedAt: now, environment };
|
|
20714
20715
|
const existingIndex = requests.findIndex((r) => r.key === key);
|
|
20715
20716
|
if (existingIndex >= 0) {
|
|
20716
|
-
requests[existingIndex] =
|
|
20717
|
+
requests[existingIndex] = request2;
|
|
20717
20718
|
} else {
|
|
20718
|
-
requests.push(
|
|
20719
|
+
requests.push(request2);
|
|
20719
20720
|
}
|
|
20720
20721
|
saveRequests(repoRoot, requests);
|
|
20721
|
-
return
|
|
20722
|
+
return request2;
|
|
20722
20723
|
}
|
|
20723
20724
|
function removeRequest(repoRoot, identifier) {
|
|
20724
20725
|
const requests = loadRequests(repoRoot);
|
|
@@ -31230,11 +31231,11 @@ var require_mime_types = __commonJS({
|
|
|
31230
31231
|
}
|
|
31231
31232
|
return exts[0];
|
|
31232
31233
|
}
|
|
31233
|
-
function lookup(
|
|
31234
|
-
if (!
|
|
31234
|
+
function lookup(path57) {
|
|
31235
|
+
if (!path57 || typeof path57 !== "string") {
|
|
31235
31236
|
return false;
|
|
31236
31237
|
}
|
|
31237
|
-
var extension2 = extname3("x." +
|
|
31238
|
+
var extension2 = extname3("x." + path57).toLowerCase().substr(1);
|
|
31238
31239
|
if (!extension2) {
|
|
31239
31240
|
return false;
|
|
31240
31241
|
}
|
|
@@ -32339,13 +32340,13 @@ var require_form_data = __commonJS({
|
|
|
32339
32340
|
"use strict";
|
|
32340
32341
|
var CombinedStream = require_combined_stream();
|
|
32341
32342
|
var util = require("util");
|
|
32342
|
-
var
|
|
32343
|
+
var path57 = require("path");
|
|
32343
32344
|
var http = require("http");
|
|
32344
32345
|
var https = require("https");
|
|
32345
32346
|
var parseUrl = require("url").parse;
|
|
32346
|
-
var
|
|
32347
|
+
var fs38 = require("fs");
|
|
32347
32348
|
var Stream = require("stream").Stream;
|
|
32348
|
-
var
|
|
32349
|
+
var crypto10 = require("crypto");
|
|
32349
32350
|
var mime = require_mime_types();
|
|
32350
32351
|
var asynckit = require_asynckit();
|
|
32351
32352
|
var setToStringTag = require_es_set_tostringtag();
|
|
@@ -32410,7 +32411,7 @@ var require_form_data = __commonJS({
|
|
|
32410
32411
|
if (value.end != void 0 && value.end != Infinity && value.start != void 0) {
|
|
32411
32412
|
callback(null, value.end + 1 - (value.start ? value.start : 0));
|
|
32412
32413
|
} else {
|
|
32413
|
-
|
|
32414
|
+
fs38.stat(value.path, function(err, stat) {
|
|
32414
32415
|
if (err) {
|
|
32415
32416
|
callback(err);
|
|
32416
32417
|
return;
|
|
@@ -32467,11 +32468,11 @@ var require_form_data = __commonJS({
|
|
|
32467
32468
|
FormData2.prototype._getContentDisposition = function(value, options) {
|
|
32468
32469
|
var filename;
|
|
32469
32470
|
if (typeof options.filepath === "string") {
|
|
32470
|
-
filename =
|
|
32471
|
+
filename = path57.normalize(options.filepath).replace(/\\/g, "/");
|
|
32471
32472
|
} else if (options.filename || value && (value.name || value.path)) {
|
|
32472
|
-
filename =
|
|
32473
|
+
filename = path57.basename(options.filename || value && (value.name || value.path));
|
|
32473
32474
|
} else if (value && value.readable && hasOwn(value, "httpVersion")) {
|
|
32474
|
-
filename =
|
|
32475
|
+
filename = path57.basename(value.client._httpMessage.path || "");
|
|
32475
32476
|
}
|
|
32476
32477
|
if (filename) {
|
|
32477
32478
|
return 'filename="' + filename + '"';
|
|
@@ -32551,7 +32552,7 @@ var require_form_data = __commonJS({
|
|
|
32551
32552
|
return Buffer.concat([dataBuffer, Buffer.from(this._lastBoundary())]);
|
|
32552
32553
|
};
|
|
32553
32554
|
FormData2.prototype._generateBoundary = function() {
|
|
32554
|
-
this._boundary = "--------------------------" +
|
|
32555
|
+
this._boundary = "--------------------------" + crypto10.randomBytes(12).toString("hex");
|
|
32555
32556
|
};
|
|
32556
32557
|
FormData2.prototype.getLengthSync = function() {
|
|
32557
32558
|
var knownLength = this._overheadLength + this._valueLength;
|
|
@@ -32591,7 +32592,7 @@ var require_form_data = __commonJS({
|
|
|
32591
32592
|
});
|
|
32592
32593
|
};
|
|
32593
32594
|
FormData2.prototype.submit = function(params, cb) {
|
|
32594
|
-
var
|
|
32595
|
+
var request2;
|
|
32595
32596
|
var options;
|
|
32596
32597
|
var defaults = { method: "post" };
|
|
32597
32598
|
if (typeof params === "string") {
|
|
@@ -32610,9 +32611,9 @@ var require_form_data = __commonJS({
|
|
|
32610
32611
|
}
|
|
32611
32612
|
options.headers = this.getHeaders(params.headers);
|
|
32612
32613
|
if (options.protocol === "https:") {
|
|
32613
|
-
|
|
32614
|
+
request2 = https.request(options);
|
|
32614
32615
|
} else {
|
|
32615
|
-
|
|
32616
|
+
request2 = http.request(options);
|
|
32616
32617
|
}
|
|
32617
32618
|
this.getLength(function(err, length) {
|
|
32618
32619
|
if (err && err !== "Unknown stream") {
|
|
@@ -32620,22 +32621,22 @@ var require_form_data = __commonJS({
|
|
|
32620
32621
|
return;
|
|
32621
32622
|
}
|
|
32622
32623
|
if (length) {
|
|
32623
|
-
|
|
32624
|
+
request2.setHeader("Content-Length", length);
|
|
32624
32625
|
}
|
|
32625
|
-
this.pipe(
|
|
32626
|
+
this.pipe(request2);
|
|
32626
32627
|
if (cb) {
|
|
32627
32628
|
var onResponse;
|
|
32628
32629
|
var callback = function(error, responce) {
|
|
32629
|
-
|
|
32630
|
-
|
|
32630
|
+
request2.removeListener("error", callback);
|
|
32631
|
+
request2.removeListener("response", onResponse);
|
|
32631
32632
|
return cb.call(this, error, responce);
|
|
32632
32633
|
};
|
|
32633
32634
|
onResponse = callback.bind(this, null);
|
|
32634
|
-
|
|
32635
|
-
|
|
32635
|
+
request2.on("error", callback);
|
|
32636
|
+
request2.on("response", onResponse);
|
|
32636
32637
|
}
|
|
32637
32638
|
}.bind(this));
|
|
32638
|
-
return
|
|
32639
|
+
return request2;
|
|
32639
32640
|
};
|
|
32640
32641
|
FormData2.prototype._error = function(err) {
|
|
32641
32642
|
if (!this.error) {
|
|
@@ -33235,7 +33236,7 @@ var require_node = __commonJS({
|
|
|
33235
33236
|
"../../node_modules/debug/src/node.js"(exports2, module2) {
|
|
33236
33237
|
var tty = require("tty");
|
|
33237
33238
|
var util = require("util");
|
|
33238
|
-
exports2.init =
|
|
33239
|
+
exports2.init = init2;
|
|
33239
33240
|
exports2.log = log;
|
|
33240
33241
|
exports2.formatArgs = formatArgs;
|
|
33241
33242
|
exports2.save = save;
|
|
@@ -33384,7 +33385,7 @@ var require_node = __commonJS({
|
|
|
33384
33385
|
function load() {
|
|
33385
33386
|
return process.env.DEBUG;
|
|
33386
33387
|
}
|
|
33387
|
-
function
|
|
33388
|
+
function init2(debug) {
|
|
33388
33389
|
debug.inspectOpts = {};
|
|
33389
33390
|
const keys = Object.keys(exports2.inspectOpts);
|
|
33390
33391
|
for (let i = 0; i < keys.length; i++) {
|
|
@@ -33686,10 +33687,10 @@ var require_follow_redirects = __commonJS({
|
|
|
33686
33687
|
var scheme = protocol.slice(0, -1);
|
|
33687
33688
|
this._options.agent = this._options.agents[scheme];
|
|
33688
33689
|
}
|
|
33689
|
-
var
|
|
33690
|
-
|
|
33690
|
+
var request2 = this._currentRequest = nativeProtocol.request(this._options, this._onNativeResponse);
|
|
33691
|
+
request2._redirectable = this;
|
|
33691
33692
|
for (var event of events) {
|
|
33692
|
-
|
|
33693
|
+
request2.on(event, eventHandlers[event]);
|
|
33693
33694
|
}
|
|
33694
33695
|
this._currentUrl = /^\//.test(this._options.path) ? url.format(this._options) : (
|
|
33695
33696
|
// When making a request to a proxy, […]
|
|
@@ -33701,16 +33702,16 @@ var require_follow_redirects = __commonJS({
|
|
|
33701
33702
|
var self2 = this;
|
|
33702
33703
|
var buffers = this._requestBodyBuffers;
|
|
33703
33704
|
(function writeNext(error) {
|
|
33704
|
-
if (
|
|
33705
|
+
if (request2 === self2._currentRequest) {
|
|
33705
33706
|
if (error) {
|
|
33706
33707
|
self2.emit("error", error);
|
|
33707
33708
|
} else if (i < buffers.length) {
|
|
33708
33709
|
var buffer = buffers[i++];
|
|
33709
|
-
if (!
|
|
33710
|
-
|
|
33710
|
+
if (!request2.finished) {
|
|
33711
|
+
request2.write(buffer.data, buffer.encoding, writeNext);
|
|
33711
33712
|
}
|
|
33712
33713
|
} else if (self2._ended) {
|
|
33713
|
-
|
|
33714
|
+
request2.end();
|
|
33714
33715
|
}
|
|
33715
33716
|
}
|
|
33716
33717
|
})();
|
|
@@ -33792,7 +33793,7 @@ var require_follow_redirects = __commonJS({
|
|
|
33792
33793
|
var protocol = scheme + ":";
|
|
33793
33794
|
var nativeProtocol = nativeProtocols[protocol] = protocols[scheme];
|
|
33794
33795
|
var wrappedProtocol = exports3[scheme] = Object.create(nativeProtocol);
|
|
33795
|
-
function
|
|
33796
|
+
function request2(input, options, callback) {
|
|
33796
33797
|
if (isURL(input)) {
|
|
33797
33798
|
input = spreadUrlObject(input);
|
|
33798
33799
|
} else if (isString(input)) {
|
|
@@ -33824,7 +33825,7 @@ var require_follow_redirects = __commonJS({
|
|
|
33824
33825
|
return wrappedRequest;
|
|
33825
33826
|
}
|
|
33826
33827
|
Object.defineProperties(wrappedProtocol, {
|
|
33827
|
-
request: { value:
|
|
33828
|
+
request: { value: request2, configurable: true, enumerable: true, writable: true },
|
|
33828
33829
|
get: { value: get, configurable: true, enumerable: true, writable: true }
|
|
33829
33830
|
});
|
|
33830
33831
|
});
|
|
@@ -33902,12 +33903,12 @@ var require_follow_redirects = __commonJS({
|
|
|
33902
33903
|
});
|
|
33903
33904
|
return CustomError;
|
|
33904
33905
|
}
|
|
33905
|
-
function destroyRequest(
|
|
33906
|
+
function destroyRequest(request2, error) {
|
|
33906
33907
|
for (var event of events) {
|
|
33907
|
-
|
|
33908
|
+
request2.removeListener(event, eventHandlers[event]);
|
|
33908
33909
|
}
|
|
33909
|
-
|
|
33910
|
-
|
|
33910
|
+
request2.on("error", noop);
|
|
33911
|
+
request2.destroy(error);
|
|
33911
33912
|
}
|
|
33912
33913
|
function isSubdomain(subdomain, domain) {
|
|
33913
33914
|
assert2(isString(subdomain) && isString(domain));
|
|
@@ -33936,7 +33937,7 @@ var require_axios = __commonJS({
|
|
|
33936
33937
|
"../../node_modules/axios/dist/node/axios.cjs"(exports2, module2) {
|
|
33937
33938
|
"use strict";
|
|
33938
33939
|
var FormData$1 = require_form_data();
|
|
33939
|
-
var
|
|
33940
|
+
var crypto10 = require("crypto");
|
|
33940
33941
|
var url = require("url");
|
|
33941
33942
|
var http = require("http");
|
|
33942
33943
|
var https = require("https");
|
|
@@ -34387,8 +34388,8 @@ var require_axios = __commonJS({
|
|
|
34387
34388
|
isIterable
|
|
34388
34389
|
};
|
|
34389
34390
|
var AxiosError = class _AxiosError extends Error {
|
|
34390
|
-
static from(error, code, config,
|
|
34391
|
-
const axiosError = new _AxiosError(error.message, code || error.code, config,
|
|
34391
|
+
static from(error, code, config, request2, response, customProps) {
|
|
34392
|
+
const axiosError = new _AxiosError(error.message, code || error.code, config, request2, response);
|
|
34392
34393
|
axiosError.cause = error;
|
|
34393
34394
|
axiosError.name = error.name;
|
|
34394
34395
|
if (error.status != null && axiosError.status == null) {
|
|
@@ -34408,7 +34409,7 @@ var require_axios = __commonJS({
|
|
|
34408
34409
|
*
|
|
34409
34410
|
* @returns {Error} The created error.
|
|
34410
34411
|
*/
|
|
34411
|
-
constructor(message, code, config,
|
|
34412
|
+
constructor(message, code, config, request2, response) {
|
|
34412
34413
|
super(message);
|
|
34413
34414
|
Object.defineProperty(this, "message", {
|
|
34414
34415
|
value: message,
|
|
@@ -34420,7 +34421,7 @@ var require_axios = __commonJS({
|
|
|
34420
34421
|
this.isAxiosError = true;
|
|
34421
34422
|
code && (this.code = code);
|
|
34422
34423
|
config && (this.config = config);
|
|
34423
|
-
|
|
34424
|
+
request2 && (this.request = request2);
|
|
34424
34425
|
if (response) {
|
|
34425
34426
|
this.response = response;
|
|
34426
34427
|
this.status = response.status;
|
|
@@ -34464,9 +34465,9 @@ var require_axios = __commonJS({
|
|
|
34464
34465
|
function removeBrackets(key) {
|
|
34465
34466
|
return utils$1.endsWith(key, "[]") ? key.slice(0, -2) : key;
|
|
34466
34467
|
}
|
|
34467
|
-
function renderKey(
|
|
34468
|
-
if (!
|
|
34469
|
-
return
|
|
34468
|
+
function renderKey(path57, key, dots) {
|
|
34469
|
+
if (!path57) return key;
|
|
34470
|
+
return path57.concat(key).map(function each(token, i) {
|
|
34470
34471
|
token = removeBrackets(token);
|
|
34471
34472
|
return !dots && i ? "[" + token + "]" : token;
|
|
34472
34473
|
}).join(dots ? "." : "");
|
|
@@ -34514,13 +34515,13 @@ var require_axios = __commonJS({
|
|
|
34514
34515
|
}
|
|
34515
34516
|
return value;
|
|
34516
34517
|
}
|
|
34517
|
-
function defaultVisitor(value, key,
|
|
34518
|
+
function defaultVisitor(value, key, path57) {
|
|
34518
34519
|
let arr = value;
|
|
34519
34520
|
if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
|
|
34520
|
-
formData.append(renderKey(
|
|
34521
|
+
formData.append(renderKey(path57, key, dots), convertValue(value));
|
|
34521
34522
|
return false;
|
|
34522
34523
|
}
|
|
34523
|
-
if (value && !
|
|
34524
|
+
if (value && !path57 && typeof value === "object") {
|
|
34524
34525
|
if (utils$1.endsWith(key, "{}")) {
|
|
34525
34526
|
key = metaTokens ? key : key.slice(0, -2);
|
|
34526
34527
|
value = JSON.stringify(value);
|
|
@@ -34539,7 +34540,7 @@ var require_axios = __commonJS({
|
|
|
34539
34540
|
if (isVisitable(value)) {
|
|
34540
34541
|
return true;
|
|
34541
34542
|
}
|
|
34542
|
-
formData.append(renderKey(
|
|
34543
|
+
formData.append(renderKey(path57, key, dots), convertValue(value));
|
|
34543
34544
|
return false;
|
|
34544
34545
|
}
|
|
34545
34546
|
const stack = [];
|
|
@@ -34548,16 +34549,16 @@ var require_axios = __commonJS({
|
|
|
34548
34549
|
convertValue,
|
|
34549
34550
|
isVisitable
|
|
34550
34551
|
});
|
|
34551
|
-
function build(value,
|
|
34552
|
+
function build(value, path57) {
|
|
34552
34553
|
if (utils$1.isUndefined(value)) return;
|
|
34553
34554
|
if (stack.indexOf(value) !== -1) {
|
|
34554
|
-
throw Error("Circular reference detected in " +
|
|
34555
|
+
throw Error("Circular reference detected in " + path57.join("."));
|
|
34555
34556
|
}
|
|
34556
34557
|
stack.push(value);
|
|
34557
34558
|
utils$1.forEach(value, function each(el, key) {
|
|
34558
|
-
const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key,
|
|
34559
|
+
const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path57, exposedHelpers);
|
|
34559
34560
|
if (result === true) {
|
|
34560
|
-
build(el,
|
|
34561
|
+
build(el, path57 ? path57.concat(key) : [key]);
|
|
34561
34562
|
}
|
|
34562
34563
|
});
|
|
34563
34564
|
stack.pop();
|
|
@@ -34707,7 +34708,7 @@ var require_axios = __commonJS({
|
|
|
34707
34708
|
length
|
|
34708
34709
|
} = alphabet;
|
|
34709
34710
|
const randomValues = new Uint32Array(size);
|
|
34710
|
-
|
|
34711
|
+
crypto10.randomFillSync(randomValues);
|
|
34711
34712
|
for (let i = 0; i < size; i++) {
|
|
34712
34713
|
str2 += alphabet[randomValues[i] % length];
|
|
34713
34714
|
}
|
|
@@ -34746,7 +34747,7 @@ var require_axios = __commonJS({
|
|
|
34746
34747
|
};
|
|
34747
34748
|
function toURLEncodedForm(data, options) {
|
|
34748
34749
|
return toFormData(data, new platform.classes.URLSearchParams(), {
|
|
34749
|
-
visitor: function(value, key,
|
|
34750
|
+
visitor: function(value, key, path57, helpers) {
|
|
34750
34751
|
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
34751
34752
|
this.append(key, value.toString("base64"));
|
|
34752
34753
|
return false;
|
|
@@ -34774,11 +34775,11 @@ var require_axios = __commonJS({
|
|
|
34774
34775
|
return obj;
|
|
34775
34776
|
}
|
|
34776
34777
|
function formDataToJSON(formData) {
|
|
34777
|
-
function buildPath(
|
|
34778
|
-
let name =
|
|
34778
|
+
function buildPath(path57, value, target, index) {
|
|
34779
|
+
let name = path57[index++];
|
|
34779
34780
|
if (name === "__proto__") return true;
|
|
34780
34781
|
const isNumericKey = Number.isFinite(+name);
|
|
34781
|
-
const isLast = index >=
|
|
34782
|
+
const isLast = index >= path57.length;
|
|
34782
34783
|
name = !name && utils$1.isArray(target) ? target.length : name;
|
|
34783
34784
|
if (isLast) {
|
|
34784
34785
|
if (utils$1.hasOwnProp(target, name)) {
|
|
@@ -34791,7 +34792,7 @@ var require_axios = __commonJS({
|
|
|
34791
34792
|
if (!target[name] || !utils$1.isObject(target[name])) {
|
|
34792
34793
|
target[name] = [];
|
|
34793
34794
|
}
|
|
34794
|
-
const result = buildPath(
|
|
34795
|
+
const result = buildPath(path57, value, target[name], index);
|
|
34795
34796
|
if (result && utils$1.isArray(target[name])) {
|
|
34796
34797
|
target[name] = arrayToObject(target[name]);
|
|
34797
34798
|
}
|
|
@@ -35187,8 +35188,8 @@ var require_axios = __commonJS({
|
|
|
35187
35188
|
*
|
|
35188
35189
|
* @returns {CanceledError} The created error.
|
|
35189
35190
|
*/
|
|
35190
|
-
constructor(message, config,
|
|
35191
|
-
super(message == null ? "canceled" : message, AxiosError.ERR_CANCELED, config,
|
|
35191
|
+
constructor(message, config, request2) {
|
|
35192
|
+
super(message == null ? "canceled" : message, AxiosError.ERR_CANCELED, config, request2);
|
|
35192
35193
|
this.name = "CanceledError";
|
|
35193
35194
|
this.__CANCEL__ = true;
|
|
35194
35195
|
}
|
|
@@ -36109,9 +36110,9 @@ var require_axios = __commonJS({
|
|
|
36109
36110
|
auth = urlUsername + ":" + urlPassword;
|
|
36110
36111
|
}
|
|
36111
36112
|
auth && headers.delete("authorization");
|
|
36112
|
-
let
|
|
36113
|
+
let path57;
|
|
36113
36114
|
try {
|
|
36114
|
-
|
|
36115
|
+
path57 = buildURL(parsed.pathname + parsed.search, config.params, config.paramsSerializer).replace(/^\?/, "");
|
|
36115
36116
|
} catch (err) {
|
|
36116
36117
|
const customErr = new Error(err.message);
|
|
36117
36118
|
customErr.config = config;
|
|
@@ -36121,7 +36122,7 @@ var require_axios = __commonJS({
|
|
|
36121
36122
|
}
|
|
36122
36123
|
headers.set("Accept-Encoding", "gzip, compress, deflate" + (isBrotliSupported ? ", br" : ""), false);
|
|
36123
36124
|
const options = {
|
|
36124
|
-
path:
|
|
36125
|
+
path: path57,
|
|
36125
36126
|
method,
|
|
36126
36127
|
headers: headers.toJSON(),
|
|
36127
36128
|
agents: {
|
|
@@ -36327,14 +36328,14 @@ var require_axios = __commonJS({
|
|
|
36327
36328
|
var cookies = platform.hasStandardBrowserEnv ? (
|
|
36328
36329
|
// Standard browser envs support document.cookie
|
|
36329
36330
|
{
|
|
36330
|
-
write(name, value, expires,
|
|
36331
|
+
write(name, value, expires, path57, domain, secure, sameSite) {
|
|
36331
36332
|
if (typeof document === "undefined") return;
|
|
36332
36333
|
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
36333
36334
|
if (utils$1.isNumber(expires)) {
|
|
36334
36335
|
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
36335
36336
|
}
|
|
36336
|
-
if (utils$1.isString(
|
|
36337
|
-
cookie.push(`path=${
|
|
36337
|
+
if (utils$1.isString(path57)) {
|
|
36338
|
+
cookie.push(`path=${path57}`);
|
|
36338
36339
|
}
|
|
36339
36340
|
if (utils$1.isString(domain)) {
|
|
36340
36341
|
cookie.push(`domain=${domain}`);
|
|
@@ -36513,22 +36514,22 @@ var require_axios = __commonJS({
|
|
|
36513
36514
|
_config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
|
|
36514
36515
|
_config.signal && _config.signal.removeEventListener("abort", onCanceled);
|
|
36515
36516
|
}
|
|
36516
|
-
let
|
|
36517
|
-
|
|
36518
|
-
|
|
36517
|
+
let request2 = new XMLHttpRequest();
|
|
36518
|
+
request2.open(_config.method.toUpperCase(), _config.url, true);
|
|
36519
|
+
request2.timeout = _config.timeout;
|
|
36519
36520
|
function onloadend() {
|
|
36520
|
-
if (!
|
|
36521
|
+
if (!request2) {
|
|
36521
36522
|
return;
|
|
36522
36523
|
}
|
|
36523
|
-
const responseHeaders = AxiosHeaders.from("getAllResponseHeaders" in
|
|
36524
|
-
const responseData = !responseType || responseType === "text" || responseType === "json" ?
|
|
36524
|
+
const responseHeaders = AxiosHeaders.from("getAllResponseHeaders" in request2 && request2.getAllResponseHeaders());
|
|
36525
|
+
const responseData = !responseType || responseType === "text" || responseType === "json" ? request2.responseText : request2.response;
|
|
36525
36526
|
const response = {
|
|
36526
36527
|
data: responseData,
|
|
36527
|
-
status:
|
|
36528
|
-
statusText:
|
|
36528
|
+
status: request2.status,
|
|
36529
|
+
statusText: request2.statusText,
|
|
36529
36530
|
headers: responseHeaders,
|
|
36530
36531
|
config,
|
|
36531
|
-
request
|
|
36532
|
+
request: request2
|
|
36532
36533
|
};
|
|
36533
36534
|
settle(function _resolve(value) {
|
|
36534
36535
|
resolve7(value);
|
|
@@ -36537,73 +36538,73 @@ var require_axios = __commonJS({
|
|
|
36537
36538
|
reject(err);
|
|
36538
36539
|
done();
|
|
36539
36540
|
}, response);
|
|
36540
|
-
|
|
36541
|
+
request2 = null;
|
|
36541
36542
|
}
|
|
36542
|
-
if ("onloadend" in
|
|
36543
|
-
|
|
36543
|
+
if ("onloadend" in request2) {
|
|
36544
|
+
request2.onloadend = onloadend;
|
|
36544
36545
|
} else {
|
|
36545
|
-
|
|
36546
|
-
if (!
|
|
36546
|
+
request2.onreadystatechange = function handleLoad() {
|
|
36547
|
+
if (!request2 || request2.readyState !== 4) {
|
|
36547
36548
|
return;
|
|
36548
36549
|
}
|
|
36549
|
-
if (
|
|
36550
|
+
if (request2.status === 0 && !(request2.responseURL && request2.responseURL.indexOf("file:") === 0)) {
|
|
36550
36551
|
return;
|
|
36551
36552
|
}
|
|
36552
36553
|
setTimeout(onloadend);
|
|
36553
36554
|
};
|
|
36554
36555
|
}
|
|
36555
|
-
|
|
36556
|
-
if (!
|
|
36556
|
+
request2.onabort = function handleAbort() {
|
|
36557
|
+
if (!request2) {
|
|
36557
36558
|
return;
|
|
36558
36559
|
}
|
|
36559
|
-
reject(new AxiosError("Request aborted", AxiosError.ECONNABORTED, config,
|
|
36560
|
-
|
|
36560
|
+
reject(new AxiosError("Request aborted", AxiosError.ECONNABORTED, config, request2));
|
|
36561
|
+
request2 = null;
|
|
36561
36562
|
};
|
|
36562
|
-
|
|
36563
|
+
request2.onerror = function handleError(event) {
|
|
36563
36564
|
const msg = event && event.message ? event.message : "Network Error";
|
|
36564
|
-
const err = new AxiosError(msg, AxiosError.ERR_NETWORK, config,
|
|
36565
|
+
const err = new AxiosError(msg, AxiosError.ERR_NETWORK, config, request2);
|
|
36565
36566
|
err.event = event || null;
|
|
36566
36567
|
reject(err);
|
|
36567
|
-
|
|
36568
|
+
request2 = null;
|
|
36568
36569
|
};
|
|
36569
|
-
|
|
36570
|
+
request2.ontimeout = function handleTimeout() {
|
|
36570
36571
|
let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
|
|
36571
36572
|
const transitional = _config.transitional || transitionalDefaults;
|
|
36572
36573
|
if (_config.timeoutErrorMessage) {
|
|
36573
36574
|
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
36574
36575
|
}
|
|
36575
|
-
reject(new AxiosError(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, config,
|
|
36576
|
-
|
|
36576
|
+
reject(new AxiosError(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, config, request2));
|
|
36577
|
+
request2 = null;
|
|
36577
36578
|
};
|
|
36578
36579
|
requestData === void 0 && requestHeaders.setContentType(null);
|
|
36579
|
-
if ("setRequestHeader" in
|
|
36580
|
+
if ("setRequestHeader" in request2) {
|
|
36580
36581
|
utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
|
36581
|
-
|
|
36582
|
+
request2.setRequestHeader(key, val);
|
|
36582
36583
|
});
|
|
36583
36584
|
}
|
|
36584
36585
|
if (!utils$1.isUndefined(_config.withCredentials)) {
|
|
36585
|
-
|
|
36586
|
+
request2.withCredentials = !!_config.withCredentials;
|
|
36586
36587
|
}
|
|
36587
36588
|
if (responseType && responseType !== "json") {
|
|
36588
|
-
|
|
36589
|
+
request2.responseType = _config.responseType;
|
|
36589
36590
|
}
|
|
36590
36591
|
if (onDownloadProgress) {
|
|
36591
36592
|
[downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
|
|
36592
|
-
|
|
36593
|
+
request2.addEventListener("progress", downloadThrottled);
|
|
36593
36594
|
}
|
|
36594
|
-
if (onUploadProgress &&
|
|
36595
|
+
if (onUploadProgress && request2.upload) {
|
|
36595
36596
|
[uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
|
|
36596
|
-
|
|
36597
|
-
|
|
36597
|
+
request2.upload.addEventListener("progress", uploadThrottled);
|
|
36598
|
+
request2.upload.addEventListener("loadend", flushUpload);
|
|
36598
36599
|
}
|
|
36599
36600
|
if (_config.cancelToken || _config.signal) {
|
|
36600
36601
|
onCanceled = (cancel) => {
|
|
36601
|
-
if (!
|
|
36602
|
+
if (!request2) {
|
|
36602
36603
|
return;
|
|
36603
36604
|
}
|
|
36604
|
-
reject(!cancel || cancel.type ? new CanceledError(null, config,
|
|
36605
|
-
|
|
36606
|
-
|
|
36605
|
+
reject(!cancel || cancel.type ? new CanceledError(null, config, request2) : cancel);
|
|
36606
|
+
request2.abort();
|
|
36607
|
+
request2 = null;
|
|
36607
36608
|
};
|
|
36608
36609
|
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
|
36609
36610
|
if (_config.signal) {
|
|
@@ -36615,7 +36616,7 @@ var require_axios = __commonJS({
|
|
|
36615
36616
|
reject(new AxiosError("Unsupported protocol " + protocol + ":", AxiosError.ERR_BAD_REQUEST, config));
|
|
36616
36617
|
return;
|
|
36617
36618
|
}
|
|
36618
|
-
|
|
36619
|
+
request2.send(requestData || null);
|
|
36619
36620
|
});
|
|
36620
36621
|
};
|
|
36621
36622
|
var composeSignals = (signals, timeout) => {
|
|
@@ -36850,7 +36851,7 @@ var require_axios = __commonJS({
|
|
|
36850
36851
|
let _fetch2 = envFetch || fetch;
|
|
36851
36852
|
responseType = responseType ? (responseType + "").toLowerCase() : "text";
|
|
36852
36853
|
let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
|
36853
|
-
let
|
|
36854
|
+
let request2 = null;
|
|
36854
36855
|
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
|
36855
36856
|
composedSignal.unsubscribe();
|
|
36856
36857
|
});
|
|
@@ -36884,8 +36885,8 @@ var require_axios = __commonJS({
|
|
|
36884
36885
|
duplex: "half",
|
|
36885
36886
|
credentials: isCredentialsSupported ? withCredentials : void 0
|
|
36886
36887
|
};
|
|
36887
|
-
|
|
36888
|
-
let response = await (isRequestSupported ? _fetch2(
|
|
36888
|
+
request2 = isRequestSupported && new Request3(url2, resolvedOptions);
|
|
36889
|
+
let response = await (isRequestSupported ? _fetch2(request2, fetchOptions) : _fetch2(url2, resolvedOptions));
|
|
36889
36890
|
const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
|
|
36890
36891
|
if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
|
|
36891
36892
|
const options = {};
|
|
@@ -36909,17 +36910,17 @@ var require_axios = __commonJS({
|
|
|
36909
36910
|
status: response.status,
|
|
36910
36911
|
statusText: response.statusText,
|
|
36911
36912
|
config,
|
|
36912
|
-
request
|
|
36913
|
+
request: request2
|
|
36913
36914
|
});
|
|
36914
36915
|
});
|
|
36915
36916
|
} catch (err) {
|
|
36916
36917
|
unsubscribe && unsubscribe();
|
|
36917
36918
|
if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
|
|
36918
|
-
throw Object.assign(new AxiosError("Network Error", AxiosError.ERR_NETWORK, config,
|
|
36919
|
+
throw Object.assign(new AxiosError("Network Error", AxiosError.ERR_NETWORK, config, request2, err && err.response), {
|
|
36919
36920
|
cause: err.cause || err
|
|
36920
36921
|
});
|
|
36921
36922
|
}
|
|
36922
|
-
throw AxiosError.from(err, err && err.code, config,
|
|
36923
|
+
throw AxiosError.from(err, err && err.code, config, request2, err && err.response);
|
|
36923
36924
|
}
|
|
36924
36925
|
};
|
|
36925
36926
|
};
|
|
@@ -37295,11 +37296,11 @@ var require_axios = __commonJS({
|
|
|
37295
37296
|
};
|
|
37296
37297
|
return promise;
|
|
37297
37298
|
};
|
|
37298
|
-
executor(function cancel(message, config,
|
|
37299
|
+
executor(function cancel(message, config, request2) {
|
|
37299
37300
|
if (token.reason) {
|
|
37300
37301
|
return;
|
|
37301
37302
|
}
|
|
37302
|
-
token.reason = new CanceledError(message, config,
|
|
37303
|
+
token.reason = new CanceledError(message, config, request2);
|
|
37303
37304
|
resolvePromise(token.reason);
|
|
37304
37305
|
});
|
|
37305
37306
|
}
|
|
@@ -37852,8 +37853,8 @@ function createGetModuleFromFilename(basePath = process.argv[1] ? (0, import_pat
|
|
|
37852
37853
|
return decodedFile;
|
|
37853
37854
|
};
|
|
37854
37855
|
}
|
|
37855
|
-
function normalizeWindowsPath(
|
|
37856
|
-
return
|
|
37856
|
+
function normalizeWindowsPath(path57) {
|
|
37857
|
+
return path57.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
|
|
37857
37858
|
}
|
|
37858
37859
|
async function addSourceContext(frames) {
|
|
37859
37860
|
const filesToLines = {};
|
|
@@ -37898,9 +37899,9 @@ async function addSourceContext(frames) {
|
|
|
37898
37899
|
LRU_FILE_CONTENTS_CACHE.reduce();
|
|
37899
37900
|
return frames;
|
|
37900
37901
|
}
|
|
37901
|
-
function getContextLinesFromFile(
|
|
37902
|
+
function getContextLinesFromFile(path57, ranges, output) {
|
|
37902
37903
|
return new Promise((resolve7) => {
|
|
37903
|
-
const stream = (0, import_node_fs.createReadStream)(
|
|
37904
|
+
const stream = (0, import_node_fs.createReadStream)(path57);
|
|
37904
37905
|
const lineReaded = (0, import_node_readline.createInterface)({
|
|
37905
37906
|
input: stream
|
|
37906
37907
|
});
|
|
@@ -37918,7 +37919,7 @@ function getContextLinesFromFile(path56, ranges, output) {
|
|
|
37918
37919
|
let rangeStart = range[0];
|
|
37919
37920
|
let rangeEnd = range[1];
|
|
37920
37921
|
function onStreamError() {
|
|
37921
|
-
LRU_FILE_CONTENTS_FS_READ_FAILED.set(
|
|
37922
|
+
LRU_FILE_CONTENTS_FS_READ_FAILED.set(path57, 1);
|
|
37922
37923
|
lineReaded.close();
|
|
37923
37924
|
lineReaded.removeAllListeners();
|
|
37924
37925
|
destroyStreamAndResolve();
|
|
@@ -37995,8 +37996,8 @@ function clearLineContext(frame) {
|
|
|
37995
37996
|
delete frame.context_line;
|
|
37996
37997
|
delete frame.post_context;
|
|
37997
37998
|
}
|
|
37998
|
-
function shouldSkipContextLinesForFile(
|
|
37999
|
-
return
|
|
37999
|
+
function shouldSkipContextLinesForFile(path57) {
|
|
38000
|
+
return path57.startsWith("node:") || path57.endsWith(".min.js") || path57.endsWith(".min.cjs") || path57.endsWith(".min.mjs") || path57.startsWith("data:");
|
|
38000
38001
|
}
|
|
38001
38002
|
function shouldSkipContextLinesForFrame(frame) {
|
|
38002
38003
|
if (frame.lineno !== void 0 && frame.lineno > MAX_CONTEXTLINES_LINENO) {
|
|
@@ -40372,9 +40373,9 @@ var init_node = __esm({
|
|
|
40372
40373
|
return globalThis.crypto.subtle;
|
|
40373
40374
|
}
|
|
40374
40375
|
try {
|
|
40375
|
-
const
|
|
40376
|
-
if (
|
|
40377
|
-
return
|
|
40376
|
+
const crypto10 = await nodeCrypto.getValue();
|
|
40377
|
+
if (crypto10?.webcrypto?.subtle) {
|
|
40378
|
+
return crypto10.webcrypto.subtle;
|
|
40378
40379
|
}
|
|
40379
40380
|
} catch {
|
|
40380
40381
|
}
|
|
@@ -41815,18 +41816,18 @@ var init_report_client = __esm({
|
|
|
41815
41816
|
Authorization: `Bearer ${apiKey}`,
|
|
41816
41817
|
"Content-Type": "application/json"
|
|
41817
41818
|
};
|
|
41818
|
-
const
|
|
41819
|
+
const init2 = {
|
|
41819
41820
|
method,
|
|
41820
41821
|
headers,
|
|
41821
41822
|
...body !== void 0 ? { body: JSON.stringify(body) } : {}
|
|
41822
41823
|
};
|
|
41823
41824
|
let response;
|
|
41824
41825
|
try {
|
|
41825
|
-
response = await fetch(url,
|
|
41826
|
+
response = await fetch(url, init2);
|
|
41826
41827
|
} catch {
|
|
41827
41828
|
await this.delay(this.retryDelayMs);
|
|
41828
41829
|
try {
|
|
41829
|
-
response = await fetch(url,
|
|
41830
|
+
response = await fetch(url, init2);
|
|
41830
41831
|
} catch (retryErr) {
|
|
41831
41832
|
throw new CloudApiError2(
|
|
41832
41833
|
`Network error contacting Clef Cloud: ${retryErr.message}`,
|
|
@@ -41840,7 +41841,7 @@ var init_report_client = __esm({
|
|
|
41840
41841
|
}
|
|
41841
41842
|
if (response.status >= 500 && response.status < 600) {
|
|
41842
41843
|
await this.delay(this.retryDelayMs);
|
|
41843
|
-
const retryResponse = await fetch(url,
|
|
41844
|
+
const retryResponse = await fetch(url, init2);
|
|
41844
41845
|
if (retryResponse.ok) {
|
|
41845
41846
|
return await retryResponse.json();
|
|
41846
41847
|
}
|
|
@@ -56407,11 +56408,11 @@ var require_mime_types2 = __commonJS({
|
|
|
56407
56408
|
}
|
|
56408
56409
|
return exts[0];
|
|
56409
56410
|
}
|
|
56410
|
-
function lookup(
|
|
56411
|
-
if (!
|
|
56411
|
+
function lookup(path57) {
|
|
56412
|
+
if (!path57 || typeof path57 !== "string") {
|
|
56412
56413
|
return false;
|
|
56413
56414
|
}
|
|
56414
|
-
var extension2 = extname3("x." +
|
|
56415
|
+
var extension2 = extname3("x." + path57).toLowerCase().slice(1);
|
|
56415
56416
|
if (!extension2) {
|
|
56416
56417
|
return false;
|
|
56417
56418
|
}
|
|
@@ -56651,16 +56652,16 @@ var require_utils = __commonJS({
|
|
|
56651
56652
|
var inflate = options?.inflate !== false;
|
|
56652
56653
|
var limit = typeof options?.limit !== "number" ? bytes.parse(options?.limit || "100kb") : options?.limit;
|
|
56653
56654
|
var type = options?.type || defaultType;
|
|
56654
|
-
var
|
|
56655
|
+
var verify3 = options?.verify || false;
|
|
56655
56656
|
var defaultCharset = options?.defaultCharset || "utf-8";
|
|
56656
|
-
if (
|
|
56657
|
+
if (verify3 !== false && typeof verify3 !== "function") {
|
|
56657
56658
|
throw new TypeError("option verify must be function");
|
|
56658
56659
|
}
|
|
56659
56660
|
var shouldParse = typeof type !== "function" ? typeChecker(type) : type;
|
|
56660
56661
|
return {
|
|
56661
56662
|
inflate,
|
|
56662
56663
|
limit,
|
|
56663
|
-
verify:
|
|
56664
|
+
verify: verify3,
|
|
56664
56665
|
defaultCharset,
|
|
56665
56666
|
shouldParse
|
|
56666
56667
|
};
|
|
@@ -56718,7 +56719,7 @@ var require_read = __commonJS({
|
|
|
56718
56719
|
var length;
|
|
56719
56720
|
var opts = options;
|
|
56720
56721
|
var stream;
|
|
56721
|
-
var
|
|
56722
|
+
var verify3 = opts.verify;
|
|
56722
56723
|
try {
|
|
56723
56724
|
stream = contentstream(req, debug, opts.inflate);
|
|
56724
56725
|
length = stream.length;
|
|
@@ -56727,7 +56728,7 @@ var require_read = __commonJS({
|
|
|
56727
56728
|
return next(err);
|
|
56728
56729
|
}
|
|
56729
56730
|
opts.length = length;
|
|
56730
|
-
opts.encoding =
|
|
56731
|
+
opts.encoding = verify3 ? null : encoding;
|
|
56731
56732
|
if (opts.encoding === null && encoding !== null && !iconv.encodingExists(encoding)) {
|
|
56732
56733
|
return next(createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', {
|
|
56733
56734
|
charset: encoding.toLowerCase(),
|
|
@@ -56755,10 +56756,10 @@ var require_read = __commonJS({
|
|
|
56755
56756
|
});
|
|
56756
56757
|
return;
|
|
56757
56758
|
}
|
|
56758
|
-
if (
|
|
56759
|
+
if (verify3) {
|
|
56759
56760
|
try {
|
|
56760
56761
|
debug("verify body");
|
|
56761
|
-
|
|
56762
|
+
verify3(req, res, body, encoding);
|
|
56762
56763
|
} catch (err) {
|
|
56763
56764
|
next(createError(403, err, {
|
|
56764
56765
|
body,
|
|
@@ -59076,13 +59077,13 @@ var require_view = __commonJS({
|
|
|
59076
59077
|
"../../node_modules/express/lib/view.js"(exports2, module2) {
|
|
59077
59078
|
"use strict";
|
|
59078
59079
|
var debug = require_src()("express:view");
|
|
59079
|
-
var
|
|
59080
|
-
var
|
|
59081
|
-
var
|
|
59082
|
-
var basename6 =
|
|
59083
|
-
var extname3 =
|
|
59084
|
-
var
|
|
59085
|
-
var resolve7 =
|
|
59080
|
+
var path57 = require("node:path");
|
|
59081
|
+
var fs38 = require("node:fs");
|
|
59082
|
+
var dirname11 = path57.dirname;
|
|
59083
|
+
var basename6 = path57.basename;
|
|
59084
|
+
var extname3 = path57.extname;
|
|
59085
|
+
var join52 = path57.join;
|
|
59086
|
+
var resolve7 = path57.resolve;
|
|
59086
59087
|
module2.exports = View;
|
|
59087
59088
|
function View(name, options) {
|
|
59088
59089
|
var opts = options || {};
|
|
@@ -59111,17 +59112,17 @@ var require_view = __commonJS({
|
|
|
59111
59112
|
this.path = this.lookup(fileName);
|
|
59112
59113
|
}
|
|
59113
59114
|
View.prototype.lookup = function lookup(name) {
|
|
59114
|
-
var
|
|
59115
|
+
var path58;
|
|
59115
59116
|
var roots = [].concat(this.root);
|
|
59116
59117
|
debug('lookup "%s"', name);
|
|
59117
|
-
for (var i = 0; i < roots.length && !
|
|
59118
|
+
for (var i = 0; i < roots.length && !path58; i++) {
|
|
59118
59119
|
var root = roots[i];
|
|
59119
59120
|
var loc = resolve7(root, name);
|
|
59120
|
-
var dir =
|
|
59121
|
+
var dir = dirname11(loc);
|
|
59121
59122
|
var file = basename6(loc);
|
|
59122
|
-
|
|
59123
|
+
path58 = this.resolve(dir, file);
|
|
59123
59124
|
}
|
|
59124
|
-
return
|
|
59125
|
+
return path58;
|
|
59125
59126
|
};
|
|
59126
59127
|
View.prototype.render = function render(options, callback) {
|
|
59127
59128
|
var sync = true;
|
|
@@ -59143,21 +59144,21 @@ var require_view = __commonJS({
|
|
|
59143
59144
|
};
|
|
59144
59145
|
View.prototype.resolve = function resolve8(dir, file) {
|
|
59145
59146
|
var ext = this.ext;
|
|
59146
|
-
var
|
|
59147
|
-
var stat = tryStat(
|
|
59147
|
+
var path58 = join52(dir, file);
|
|
59148
|
+
var stat = tryStat(path58);
|
|
59148
59149
|
if (stat && stat.isFile()) {
|
|
59149
|
-
return
|
|
59150
|
+
return path58;
|
|
59150
59151
|
}
|
|
59151
|
-
|
|
59152
|
-
stat = tryStat(
|
|
59152
|
+
path58 = join52(dir, basename6(file, ext), "index" + ext);
|
|
59153
|
+
stat = tryStat(path58);
|
|
59153
59154
|
if (stat && stat.isFile()) {
|
|
59154
|
-
return
|
|
59155
|
+
return path58;
|
|
59155
59156
|
}
|
|
59156
59157
|
};
|
|
59157
|
-
function tryStat(
|
|
59158
|
-
debug('stat "%s"',
|
|
59158
|
+
function tryStat(path58) {
|
|
59159
|
+
debug('stat "%s"', path58);
|
|
59159
59160
|
try {
|
|
59160
|
-
return
|
|
59161
|
+
return fs38.statSync(path58);
|
|
59161
59162
|
} catch (e) {
|
|
59162
59163
|
return void 0;
|
|
59163
59164
|
}
|
|
@@ -59170,14 +59171,14 @@ var require_etag = __commonJS({
|
|
|
59170
59171
|
"../../node_modules/etag/index.js"(exports2, module2) {
|
|
59171
59172
|
"use strict";
|
|
59172
59173
|
module2.exports = etag;
|
|
59173
|
-
var
|
|
59174
|
+
var crypto10 = require("crypto");
|
|
59174
59175
|
var Stats = require("fs").Stats;
|
|
59175
59176
|
var toString = Object.prototype.toString;
|
|
59176
59177
|
function entitytag(entity) {
|
|
59177
59178
|
if (entity.length === 0) {
|
|
59178
59179
|
return '"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"';
|
|
59179
59180
|
}
|
|
59180
|
-
var hash =
|
|
59181
|
+
var hash = crypto10.createHash("sha1").update(entity, "utf8").digest("base64").substring(0, 27);
|
|
59181
59182
|
var len = typeof entity === "string" ? Buffer.byteLength(entity, "utf8") : entity.length;
|
|
59182
59183
|
return '"' + len.toString(16) + "-" + hash + '"';
|
|
59183
59184
|
}
|
|
@@ -68663,11 +68664,11 @@ var require_mime_types3 = __commonJS({
|
|
|
68663
68664
|
}
|
|
68664
68665
|
return exts[0];
|
|
68665
68666
|
}
|
|
68666
|
-
function lookup(
|
|
68667
|
-
if (!
|
|
68667
|
+
function lookup(path57) {
|
|
68668
|
+
if (!path57 || typeof path57 !== "string") {
|
|
68668
68669
|
return false;
|
|
68669
68670
|
}
|
|
68670
|
-
var extension2 = extname3("x." +
|
|
68671
|
+
var extension2 = extname3("x." + path57).toLowerCase().slice(1);
|
|
68671
68672
|
if (!extension2) {
|
|
68672
68673
|
return false;
|
|
68673
68674
|
}
|
|
@@ -69848,15 +69849,15 @@ var require_dist2 = __commonJS({
|
|
|
69848
69849
|
if (token.type === endType)
|
|
69849
69850
|
break;
|
|
69850
69851
|
if (token.type === "char" || token.type === "escape") {
|
|
69851
|
-
let
|
|
69852
|
+
let path57 = token.value;
|
|
69852
69853
|
let cur = tokens[pos];
|
|
69853
69854
|
while (cur.type === "char" || cur.type === "escape") {
|
|
69854
|
-
|
|
69855
|
+
path57 += cur.value;
|
|
69855
69856
|
cur = tokens[++pos];
|
|
69856
69857
|
}
|
|
69857
69858
|
output.push({
|
|
69858
69859
|
type: "text",
|
|
69859
|
-
value: encodePath(
|
|
69860
|
+
value: encodePath(path57)
|
|
69860
69861
|
});
|
|
69861
69862
|
continue;
|
|
69862
69863
|
}
|
|
@@ -69880,16 +69881,16 @@ var require_dist2 = __commonJS({
|
|
|
69880
69881
|
}
|
|
69881
69882
|
return new TokenData(consumeUntil("end"), str2);
|
|
69882
69883
|
}
|
|
69883
|
-
function compile(
|
|
69884
|
+
function compile(path57, options = {}) {
|
|
69884
69885
|
const { encode = encodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
|
|
69885
|
-
const data = typeof
|
|
69886
|
+
const data = typeof path57 === "object" ? path57 : parse18(path57, options);
|
|
69886
69887
|
const fn = tokensToFunction(data.tokens, delimiter, encode);
|
|
69887
|
-
return function
|
|
69888
|
-
const [
|
|
69888
|
+
return function path58(params = {}) {
|
|
69889
|
+
const [path59, ...missing] = fn(params);
|
|
69889
69890
|
if (missing.length) {
|
|
69890
69891
|
throw new TypeError(`Missing parameters: ${missing.join(", ")}`);
|
|
69891
69892
|
}
|
|
69892
|
-
return
|
|
69893
|
+
return path59;
|
|
69893
69894
|
};
|
|
69894
69895
|
}
|
|
69895
69896
|
function tokensToFunction(tokens, delimiter, encode) {
|
|
@@ -69945,9 +69946,9 @@ var require_dist2 = __commonJS({
|
|
|
69945
69946
|
return [encodeValue(value)];
|
|
69946
69947
|
};
|
|
69947
69948
|
}
|
|
69948
|
-
function match(
|
|
69949
|
+
function match(path57, options = {}) {
|
|
69949
69950
|
const { decode = decodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
|
|
69950
|
-
const { regexp, keys } = pathToRegexp(
|
|
69951
|
+
const { regexp, keys } = pathToRegexp(path57, options);
|
|
69951
69952
|
const decoders = keys.map((key) => {
|
|
69952
69953
|
if (decode === false)
|
|
69953
69954
|
return NOOP_VALUE;
|
|
@@ -69959,7 +69960,7 @@ var require_dist2 = __commonJS({
|
|
|
69959
69960
|
const m = regexp.exec(input);
|
|
69960
69961
|
if (!m)
|
|
69961
69962
|
return false;
|
|
69962
|
-
const
|
|
69963
|
+
const path58 = m[0];
|
|
69963
69964
|
const params = /* @__PURE__ */ Object.create(null);
|
|
69964
69965
|
for (let i = 1; i < m.length; i++) {
|
|
69965
69966
|
if (m[i] === void 0)
|
|
@@ -69968,22 +69969,22 @@ var require_dist2 = __commonJS({
|
|
|
69968
69969
|
const decoder = decoders[i - 1];
|
|
69969
69970
|
params[key.name] = decoder(m[i]);
|
|
69970
69971
|
}
|
|
69971
|
-
return { path:
|
|
69972
|
+
return { path: path58, params };
|
|
69972
69973
|
};
|
|
69973
69974
|
}
|
|
69974
|
-
function pathToRegexp(
|
|
69975
|
+
function pathToRegexp(path57, options = {}) {
|
|
69975
69976
|
const { delimiter = DEFAULT_DELIMITER, end = true, sensitive = false, trailing = true } = options;
|
|
69976
69977
|
const keys = [];
|
|
69977
69978
|
const sources = [];
|
|
69978
|
-
const paths = [
|
|
69979
|
+
const paths = [path57];
|
|
69979
69980
|
let combinations = 0;
|
|
69980
69981
|
while (paths.length) {
|
|
69981
|
-
const
|
|
69982
|
-
if (Array.isArray(
|
|
69983
|
-
paths.push(...
|
|
69982
|
+
const path58 = paths.shift();
|
|
69983
|
+
if (Array.isArray(path58)) {
|
|
69984
|
+
paths.push(...path58);
|
|
69984
69985
|
continue;
|
|
69985
69986
|
}
|
|
69986
|
-
const data = typeof
|
|
69987
|
+
const data = typeof path58 === "object" ? path58 : parse18(path58, options);
|
|
69987
69988
|
flatten(data.tokens, 0, [], (tokens) => {
|
|
69988
69989
|
if (combinations++ >= 256) {
|
|
69989
69990
|
throw new PathError("Too many path combinations", data.originalPath);
|
|
@@ -70128,18 +70129,18 @@ var require_layer = __commonJS({
|
|
|
70128
70129
|
var TRAILING_SLASH_REGEXP = /\/+$/;
|
|
70129
70130
|
var MATCHING_GROUP_REGEXP = /\((?:\?<(.*?)>)?(?!\?)/g;
|
|
70130
70131
|
module2.exports = Layer;
|
|
70131
|
-
function Layer(
|
|
70132
|
+
function Layer(path57, options, fn) {
|
|
70132
70133
|
if (!(this instanceof Layer)) {
|
|
70133
|
-
return new Layer(
|
|
70134
|
+
return new Layer(path57, options, fn);
|
|
70134
70135
|
}
|
|
70135
|
-
debug("new %o",
|
|
70136
|
+
debug("new %o", path57);
|
|
70136
70137
|
const opts = options || {};
|
|
70137
70138
|
this.handle = fn;
|
|
70138
70139
|
this.keys = [];
|
|
70139
70140
|
this.name = fn.name || "<anonymous>";
|
|
70140
70141
|
this.params = void 0;
|
|
70141
70142
|
this.path = void 0;
|
|
70142
|
-
this.slash =
|
|
70143
|
+
this.slash = path57 === "/" && opts.end === false;
|
|
70143
70144
|
function matcher(_path) {
|
|
70144
70145
|
if (_path instanceof RegExp) {
|
|
70145
70146
|
const keys = [];
|
|
@@ -70178,7 +70179,7 @@ var require_layer = __commonJS({
|
|
|
70178
70179
|
decode: decodeParam
|
|
70179
70180
|
});
|
|
70180
70181
|
}
|
|
70181
|
-
this.matchers = Array.isArray(
|
|
70182
|
+
this.matchers = Array.isArray(path57) ? path57.map(matcher) : [matcher(path57)];
|
|
70182
70183
|
}
|
|
70183
70184
|
Layer.prototype.handleError = function handleError(error, req, res, next) {
|
|
70184
70185
|
const fn = this.handle;
|
|
@@ -70218,9 +70219,9 @@ var require_layer = __commonJS({
|
|
|
70218
70219
|
next(err);
|
|
70219
70220
|
}
|
|
70220
70221
|
};
|
|
70221
|
-
Layer.prototype.match = function match(
|
|
70222
|
+
Layer.prototype.match = function match(path57) {
|
|
70222
70223
|
let match2;
|
|
70223
|
-
if (
|
|
70224
|
+
if (path57 != null) {
|
|
70224
70225
|
if (this.slash) {
|
|
70225
70226
|
this.params = {};
|
|
70226
70227
|
this.path = "";
|
|
@@ -70228,7 +70229,7 @@ var require_layer = __commonJS({
|
|
|
70228
70229
|
}
|
|
70229
70230
|
let i = 0;
|
|
70230
70231
|
while (!match2 && i < this.matchers.length) {
|
|
70231
|
-
match2 = this.matchers[i](
|
|
70232
|
+
match2 = this.matchers[i](path57);
|
|
70232
70233
|
i++;
|
|
70233
70234
|
}
|
|
70234
70235
|
}
|
|
@@ -70256,13 +70257,13 @@ var require_layer = __commonJS({
|
|
|
70256
70257
|
throw err;
|
|
70257
70258
|
}
|
|
70258
70259
|
}
|
|
70259
|
-
function loosen(
|
|
70260
|
-
if (
|
|
70261
|
-
return
|
|
70260
|
+
function loosen(path57) {
|
|
70261
|
+
if (path57 instanceof RegExp || path57 === "/") {
|
|
70262
|
+
return path57;
|
|
70262
70263
|
}
|
|
70263
|
-
return Array.isArray(
|
|
70264
|
+
return Array.isArray(path57) ? path57.map(function(p) {
|
|
70264
70265
|
return loosen(p);
|
|
70265
|
-
}) : String(
|
|
70266
|
+
}) : String(path57).replace(TRAILING_SLASH_REGEXP, "");
|
|
70266
70267
|
}
|
|
70267
70268
|
}
|
|
70268
70269
|
});
|
|
@@ -70278,9 +70279,9 @@ var require_route = __commonJS({
|
|
|
70278
70279
|
var flatten = Array.prototype.flat;
|
|
70279
70280
|
var methods = METHODS.map((method) => method.toLowerCase());
|
|
70280
70281
|
module2.exports = Route;
|
|
70281
|
-
function Route(
|
|
70282
|
-
debug("new %o",
|
|
70283
|
-
this.path =
|
|
70282
|
+
function Route(path57) {
|
|
70283
|
+
debug("new %o", path57);
|
|
70284
|
+
this.path = path57;
|
|
70284
70285
|
this.stack = [];
|
|
70285
70286
|
this.methods = /* @__PURE__ */ Object.create(null);
|
|
70286
70287
|
}
|
|
@@ -70488,8 +70489,8 @@ var require_router = __commonJS({
|
|
|
70488
70489
|
if (++sync > 100) {
|
|
70489
70490
|
return setImmediate(next, err);
|
|
70490
70491
|
}
|
|
70491
|
-
const
|
|
70492
|
-
if (
|
|
70492
|
+
const path57 = getPathname(req);
|
|
70493
|
+
if (path57 == null) {
|
|
70493
70494
|
return done(layerError);
|
|
70494
70495
|
}
|
|
70495
70496
|
let layer;
|
|
@@ -70497,7 +70498,7 @@ var require_router = __commonJS({
|
|
|
70497
70498
|
let route;
|
|
70498
70499
|
while (match !== true && idx < stack.length) {
|
|
70499
70500
|
layer = stack[idx++];
|
|
70500
|
-
match = matchLayer(layer,
|
|
70501
|
+
match = matchLayer(layer, path57);
|
|
70501
70502
|
route = layer.route;
|
|
70502
70503
|
if (typeof match !== "boolean") {
|
|
70503
70504
|
layerError = layerError || match;
|
|
@@ -70535,18 +70536,18 @@ var require_router = __commonJS({
|
|
|
70535
70536
|
} else if (route) {
|
|
70536
70537
|
layer.handleRequest(req, res, next);
|
|
70537
70538
|
} else {
|
|
70538
|
-
trimPrefix(layer, layerError, layerPath,
|
|
70539
|
+
trimPrefix(layer, layerError, layerPath, path57);
|
|
70539
70540
|
}
|
|
70540
70541
|
sync = 0;
|
|
70541
70542
|
});
|
|
70542
70543
|
}
|
|
70543
|
-
function trimPrefix(layer, layerError, layerPath,
|
|
70544
|
+
function trimPrefix(layer, layerError, layerPath, path57) {
|
|
70544
70545
|
if (layerPath.length !== 0) {
|
|
70545
|
-
if (layerPath !==
|
|
70546
|
+
if (layerPath !== path57.substring(0, layerPath.length)) {
|
|
70546
70547
|
next(layerError);
|
|
70547
70548
|
return;
|
|
70548
70549
|
}
|
|
70549
|
-
const c =
|
|
70550
|
+
const c = path57[layerPath.length];
|
|
70550
70551
|
if (c && c !== "/") {
|
|
70551
70552
|
next(layerError);
|
|
70552
70553
|
return;
|
|
@@ -70570,7 +70571,7 @@ var require_router = __commonJS({
|
|
|
70570
70571
|
};
|
|
70571
70572
|
Router2.prototype.use = function use(handler) {
|
|
70572
70573
|
let offset = 0;
|
|
70573
|
-
let
|
|
70574
|
+
let path57 = "/";
|
|
70574
70575
|
if (typeof handler !== "function") {
|
|
70575
70576
|
let arg = handler;
|
|
70576
70577
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -70578,7 +70579,7 @@ var require_router = __commonJS({
|
|
|
70578
70579
|
}
|
|
70579
70580
|
if (typeof arg !== "function") {
|
|
70580
70581
|
offset = 1;
|
|
70581
|
-
|
|
70582
|
+
path57 = handler;
|
|
70582
70583
|
}
|
|
70583
70584
|
}
|
|
70584
70585
|
const callbacks = flatten.call(slice.call(arguments, offset), Infinity);
|
|
@@ -70590,8 +70591,8 @@ var require_router = __commonJS({
|
|
|
70590
70591
|
if (typeof fn !== "function") {
|
|
70591
70592
|
throw new TypeError("argument handler must be a function");
|
|
70592
70593
|
}
|
|
70593
|
-
debug("use %o %s",
|
|
70594
|
-
const layer = new Layer(
|
|
70594
|
+
debug("use %o %s", path57, fn.name || "<anonymous>");
|
|
70595
|
+
const layer = new Layer(path57, {
|
|
70595
70596
|
sensitive: this.caseSensitive,
|
|
70596
70597
|
strict: false,
|
|
70597
70598
|
end: false
|
|
@@ -70601,9 +70602,9 @@ var require_router = __commonJS({
|
|
|
70601
70602
|
}
|
|
70602
70603
|
return this;
|
|
70603
70604
|
};
|
|
70604
|
-
Router2.prototype.route = function route(
|
|
70605
|
-
const route2 = new Route(
|
|
70606
|
-
const layer = new Layer(
|
|
70605
|
+
Router2.prototype.route = function route(path57) {
|
|
70606
|
+
const route2 = new Route(path57);
|
|
70607
|
+
const layer = new Layer(path57, {
|
|
70607
70608
|
sensitive: this.caseSensitive,
|
|
70608
70609
|
strict: this.strict,
|
|
70609
70610
|
end: true
|
|
@@ -70616,8 +70617,8 @@ var require_router = __commonJS({
|
|
|
70616
70617
|
return route2;
|
|
70617
70618
|
};
|
|
70618
70619
|
methods.concat("all").forEach(function(method) {
|
|
70619
|
-
Router2.prototype[method] = function(
|
|
70620
|
-
const route = this.route(
|
|
70620
|
+
Router2.prototype[method] = function(path57) {
|
|
70621
|
+
const route = this.route(path57);
|
|
70621
70622
|
route[method].apply(route, slice.call(arguments, 1));
|
|
70622
70623
|
return this;
|
|
70623
70624
|
};
|
|
@@ -70646,9 +70647,9 @@ var require_router = __commonJS({
|
|
|
70646
70647
|
const fqdnIndex = url.substring(0, pathLength).indexOf("://");
|
|
70647
70648
|
return fqdnIndex !== -1 ? url.substring(0, url.indexOf("/", 3 + fqdnIndex)) : void 0;
|
|
70648
70649
|
}
|
|
70649
|
-
function matchLayer(layer,
|
|
70650
|
+
function matchLayer(layer, path57) {
|
|
70650
70651
|
try {
|
|
70651
|
-
return layer.match(
|
|
70652
|
+
return layer.match(path57);
|
|
70652
70653
|
} catch (err) {
|
|
70653
70654
|
return err;
|
|
70654
70655
|
}
|
|
@@ -70804,7 +70805,7 @@ var require_application = __commonJS({
|
|
|
70804
70805
|
var flatten = Array.prototype.flat;
|
|
70805
70806
|
var app = exports2 = module2.exports = {};
|
|
70806
70807
|
var trustProxyDefaultSymbol = "@@symbol:trust_proxy_default";
|
|
70807
|
-
app.init = function
|
|
70808
|
+
app.init = function init2() {
|
|
70808
70809
|
var router = null;
|
|
70809
70810
|
this.cache = /* @__PURE__ */ Object.create(null);
|
|
70810
70811
|
this.engines = /* @__PURE__ */ Object.create(null);
|
|
@@ -70876,7 +70877,7 @@ var require_application = __commonJS({
|
|
|
70876
70877
|
};
|
|
70877
70878
|
app.use = function use(fn) {
|
|
70878
70879
|
var offset = 0;
|
|
70879
|
-
var
|
|
70880
|
+
var path57 = "/";
|
|
70880
70881
|
if (typeof fn !== "function") {
|
|
70881
70882
|
var arg = fn;
|
|
70882
70883
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -70884,7 +70885,7 @@ var require_application = __commonJS({
|
|
|
70884
70885
|
}
|
|
70885
70886
|
if (typeof arg !== "function") {
|
|
70886
70887
|
offset = 1;
|
|
70887
|
-
|
|
70888
|
+
path57 = fn;
|
|
70888
70889
|
}
|
|
70889
70890
|
}
|
|
70890
70891
|
var fns = flatten.call(slice.call(arguments, offset), Infinity);
|
|
@@ -70894,12 +70895,12 @@ var require_application = __commonJS({
|
|
|
70894
70895
|
var router = this.router;
|
|
70895
70896
|
fns.forEach(function(fn2) {
|
|
70896
70897
|
if (!fn2 || !fn2.handle || !fn2.set) {
|
|
70897
|
-
return router.use(
|
|
70898
|
+
return router.use(path57, fn2);
|
|
70898
70899
|
}
|
|
70899
|
-
debug(".use app under %s",
|
|
70900
|
-
fn2.mountpath =
|
|
70900
|
+
debug(".use app under %s", path57);
|
|
70901
|
+
fn2.mountpath = path57;
|
|
70901
70902
|
fn2.parent = this;
|
|
70902
|
-
router.use(
|
|
70903
|
+
router.use(path57, function mounted_app(req, res, next) {
|
|
70903
70904
|
var orig = req.app;
|
|
70904
70905
|
fn2.handle(req, res, function(err) {
|
|
70905
70906
|
Object.setPrototypeOf(req, orig.request);
|
|
@@ -70911,8 +70912,8 @@ var require_application = __commonJS({
|
|
|
70911
70912
|
}, this);
|
|
70912
70913
|
return this;
|
|
70913
70914
|
};
|
|
70914
|
-
app.route = function route(
|
|
70915
|
-
return this.router.route(
|
|
70915
|
+
app.route = function route(path57) {
|
|
70916
|
+
return this.router.route(path57);
|
|
70916
70917
|
};
|
|
70917
70918
|
app.engine = function engine(ext, fn) {
|
|
70918
70919
|
if (typeof fn !== "function") {
|
|
@@ -70955,7 +70956,7 @@ var require_application = __commonJS({
|
|
|
70955
70956
|
}
|
|
70956
70957
|
return this;
|
|
70957
70958
|
};
|
|
70958
|
-
app.path = function
|
|
70959
|
+
app.path = function path57() {
|
|
70959
70960
|
return this.parent ? this.parent.path() + this.mountpath : "";
|
|
70960
70961
|
};
|
|
70961
70962
|
app.enabled = function enabled(setting) {
|
|
@@ -70971,17 +70972,17 @@ var require_application = __commonJS({
|
|
|
70971
70972
|
return this.set(setting, false);
|
|
70972
70973
|
};
|
|
70973
70974
|
methods.forEach(function(method) {
|
|
70974
|
-
app[method] = function(
|
|
70975
|
+
app[method] = function(path57) {
|
|
70975
70976
|
if (method === "get" && arguments.length === 1) {
|
|
70976
|
-
return this.set(
|
|
70977
|
+
return this.set(path57);
|
|
70977
70978
|
}
|
|
70978
|
-
var route = this.route(
|
|
70979
|
+
var route = this.route(path57);
|
|
70979
70980
|
route[method].apply(route, slice.call(arguments, 1));
|
|
70980
70981
|
return this;
|
|
70981
70982
|
};
|
|
70982
70983
|
});
|
|
70983
|
-
app.all = function all(
|
|
70984
|
-
var route = this.route(
|
|
70984
|
+
app.all = function all(path57) {
|
|
70985
|
+
var route = this.route(path57);
|
|
70985
70986
|
var args = slice.call(arguments, 1);
|
|
70986
70987
|
for (var i = 0; i < methods.length; i++) {
|
|
70987
70988
|
route[methods[i]].apply(route, args);
|
|
@@ -71513,11 +71514,11 @@ var require_negotiator = __commonJS({
|
|
|
71513
71514
|
var preferredMediaTypes = require_mediaType();
|
|
71514
71515
|
module2.exports = Negotiator;
|
|
71515
71516
|
module2.exports.Negotiator = Negotiator;
|
|
71516
|
-
function Negotiator(
|
|
71517
|
+
function Negotiator(request2) {
|
|
71517
71518
|
if (!(this instanceof Negotiator)) {
|
|
71518
|
-
return new Negotiator(
|
|
71519
|
+
return new Negotiator(request2);
|
|
71519
71520
|
}
|
|
71520
|
-
this.request =
|
|
71521
|
+
this.request = request2;
|
|
71521
71522
|
}
|
|
71522
71523
|
Negotiator.prototype.charset = function charset(available) {
|
|
71523
71524
|
var set = this.charsets(available);
|
|
@@ -81015,11 +81016,11 @@ var require_mime_types4 = __commonJS({
|
|
|
81015
81016
|
}
|
|
81016
81017
|
return exts[0];
|
|
81017
81018
|
}
|
|
81018
|
-
function lookup(
|
|
81019
|
-
if (!
|
|
81019
|
+
function lookup(path57) {
|
|
81020
|
+
if (!path57 || typeof path57 !== "string") {
|
|
81020
81021
|
return false;
|
|
81021
81022
|
}
|
|
81022
|
-
var extension2 = extname3("x." +
|
|
81023
|
+
var extension2 = extname3("x." + path57).toLowerCase().slice(1);
|
|
81023
81024
|
if (!extension2) {
|
|
81024
81025
|
return false;
|
|
81025
81026
|
}
|
|
@@ -81396,7 +81397,7 @@ var require_request = __commonJS({
|
|
|
81396
81397
|
var subdomains2 = !isIP2(hostname2) ? hostname2.split(".").reverse() : [hostname2];
|
|
81397
81398
|
return subdomains2.slice(offset);
|
|
81398
81399
|
});
|
|
81399
|
-
defineGetter(req, "path", function
|
|
81400
|
+
defineGetter(req, "path", function path57() {
|
|
81400
81401
|
return parse18(this).pathname;
|
|
81401
81402
|
});
|
|
81402
81403
|
defineGetter(req, "host", function host() {
|
|
@@ -81612,17 +81613,17 @@ var require_content_disposition = __commonJS({
|
|
|
81612
81613
|
// ../../node_modules/cookie-signature/index.js
|
|
81613
81614
|
var require_cookie_signature = __commonJS({
|
|
81614
81615
|
"../../node_modules/cookie-signature/index.js"(exports2) {
|
|
81615
|
-
var
|
|
81616
|
+
var crypto10 = require("crypto");
|
|
81616
81617
|
exports2.sign = function(val, secret) {
|
|
81617
81618
|
if ("string" != typeof val) throw new TypeError("Cookie value must be provided as a string.");
|
|
81618
81619
|
if (null == secret) throw new TypeError("Secret key must be provided.");
|
|
81619
|
-
return val + "." +
|
|
81620
|
+
return val + "." + crypto10.createHmac("sha256", secret).update(val).digest("base64").replace(/\=+$/, "");
|
|
81620
81621
|
};
|
|
81621
81622
|
exports2.unsign = function(input, secret) {
|
|
81622
81623
|
if ("string" != typeof input) throw new TypeError("Signed cookie string must be provided.");
|
|
81623
81624
|
if (null == secret) throw new TypeError("Secret key must be provided.");
|
|
81624
81625
|
var tentativeValue = input.slice(0, input.lastIndexOf(".")), expectedInput = exports2.sign(tentativeValue, secret), expectedBuffer = Buffer.from(expectedInput), inputBuffer = Buffer.from(input);
|
|
81625
|
-
return expectedBuffer.length === inputBuffer.length &&
|
|
81626
|
+
return expectedBuffer.length === inputBuffer.length && crypto10.timingSafeEqual(expectedBuffer, inputBuffer) ? tentativeValue : false;
|
|
81626
81627
|
};
|
|
81627
81628
|
}
|
|
81628
81629
|
});
|
|
@@ -91249,11 +91250,11 @@ var require_mime_types5 = __commonJS({
|
|
|
91249
91250
|
}
|
|
91250
91251
|
return exts[0];
|
|
91251
91252
|
}
|
|
91252
|
-
function lookup(
|
|
91253
|
-
if (!
|
|
91253
|
+
function lookup(path57) {
|
|
91254
|
+
if (!path57 || typeof path57 !== "string") {
|
|
91254
91255
|
return false;
|
|
91255
91256
|
}
|
|
91256
|
-
var extension2 = extname3("x." +
|
|
91257
|
+
var extension2 = extname3("x." + path57).toLowerCase().slice(1);
|
|
91257
91258
|
if (!extension2) {
|
|
91258
91259
|
return false;
|
|
91259
91260
|
}
|
|
@@ -91308,32 +91309,32 @@ var require_send = __commonJS({
|
|
|
91308
91309
|
var escapeHtml = require_escape_html();
|
|
91309
91310
|
var etag = require_etag();
|
|
91310
91311
|
var fresh = require_fresh();
|
|
91311
|
-
var
|
|
91312
|
+
var fs38 = require("fs");
|
|
91312
91313
|
var mime = require_mime_types5();
|
|
91313
91314
|
var ms = require_ms();
|
|
91314
91315
|
var onFinished = require_on_finished();
|
|
91315
91316
|
var parseRange = require_range_parser();
|
|
91316
|
-
var
|
|
91317
|
+
var path57 = require("path");
|
|
91317
91318
|
var statuses = require_statuses();
|
|
91318
91319
|
var Stream = require("stream");
|
|
91319
91320
|
var util = require("util");
|
|
91320
|
-
var extname3 =
|
|
91321
|
-
var
|
|
91322
|
-
var normalize =
|
|
91323
|
-
var resolve7 =
|
|
91324
|
-
var sep3 =
|
|
91321
|
+
var extname3 = path57.extname;
|
|
91322
|
+
var join52 = path57.join;
|
|
91323
|
+
var normalize = path57.normalize;
|
|
91324
|
+
var resolve7 = path57.resolve;
|
|
91325
|
+
var sep3 = path57.sep;
|
|
91325
91326
|
var BYTES_RANGE_REGEXP = /^ *bytes=/;
|
|
91326
91327
|
var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
|
|
91327
91328
|
var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
|
|
91328
91329
|
module2.exports = send;
|
|
91329
|
-
function send(req,
|
|
91330
|
-
return new SendStream(req,
|
|
91330
|
+
function send(req, path58, options) {
|
|
91331
|
+
return new SendStream(req, path58, options);
|
|
91331
91332
|
}
|
|
91332
|
-
function SendStream(req,
|
|
91333
|
+
function SendStream(req, path58, options) {
|
|
91333
91334
|
Stream.call(this);
|
|
91334
91335
|
var opts = options || {};
|
|
91335
91336
|
this.options = opts;
|
|
91336
|
-
this.path =
|
|
91337
|
+
this.path = path58;
|
|
91337
91338
|
this.req = req;
|
|
91338
91339
|
this._acceptRanges = opts.acceptRanges !== void 0 ? Boolean(opts.acceptRanges) : true;
|
|
91339
91340
|
this._cacheControl = opts.cacheControl !== void 0 ? Boolean(opts.cacheControl) : true;
|
|
@@ -91447,10 +91448,10 @@ var require_send = __commonJS({
|
|
|
91447
91448
|
var lastModified = this.res.getHeader("Last-Modified");
|
|
91448
91449
|
return parseHttpDate(lastModified) <= parseHttpDate(ifRange);
|
|
91449
91450
|
};
|
|
91450
|
-
SendStream.prototype.redirect = function redirect(
|
|
91451
|
+
SendStream.prototype.redirect = function redirect(path58) {
|
|
91451
91452
|
var res = this.res;
|
|
91452
91453
|
if (hasListeners(this, "directory")) {
|
|
91453
|
-
this.emit("directory", res,
|
|
91454
|
+
this.emit("directory", res, path58);
|
|
91454
91455
|
return;
|
|
91455
91456
|
}
|
|
91456
91457
|
if (this.hasTrailingSlash()) {
|
|
@@ -91470,38 +91471,38 @@ var require_send = __commonJS({
|
|
|
91470
91471
|
SendStream.prototype.pipe = function pipe(res) {
|
|
91471
91472
|
var root = this._root;
|
|
91472
91473
|
this.res = res;
|
|
91473
|
-
var
|
|
91474
|
-
if (
|
|
91474
|
+
var path58 = decode(this.path);
|
|
91475
|
+
if (path58 === -1) {
|
|
91475
91476
|
this.error(400);
|
|
91476
91477
|
return res;
|
|
91477
91478
|
}
|
|
91478
|
-
if (~
|
|
91479
|
+
if (~path58.indexOf("\0")) {
|
|
91479
91480
|
this.error(400);
|
|
91480
91481
|
return res;
|
|
91481
91482
|
}
|
|
91482
91483
|
var parts;
|
|
91483
91484
|
if (root !== null) {
|
|
91484
|
-
if (
|
|
91485
|
-
|
|
91485
|
+
if (path58) {
|
|
91486
|
+
path58 = normalize("." + sep3 + path58);
|
|
91486
91487
|
}
|
|
91487
|
-
if (UP_PATH_REGEXP.test(
|
|
91488
|
-
debug('malicious path "%s"',
|
|
91488
|
+
if (UP_PATH_REGEXP.test(path58)) {
|
|
91489
|
+
debug('malicious path "%s"', path58);
|
|
91489
91490
|
this.error(403);
|
|
91490
91491
|
return res;
|
|
91491
91492
|
}
|
|
91492
|
-
parts =
|
|
91493
|
-
|
|
91493
|
+
parts = path58.split(sep3);
|
|
91494
|
+
path58 = normalize(join52(root, path58));
|
|
91494
91495
|
} else {
|
|
91495
|
-
if (UP_PATH_REGEXP.test(
|
|
91496
|
-
debug('malicious path "%s"',
|
|
91496
|
+
if (UP_PATH_REGEXP.test(path58)) {
|
|
91497
|
+
debug('malicious path "%s"', path58);
|
|
91497
91498
|
this.error(403);
|
|
91498
91499
|
return res;
|
|
91499
91500
|
}
|
|
91500
|
-
parts = normalize(
|
|
91501
|
-
|
|
91501
|
+
parts = normalize(path58).split(sep3);
|
|
91502
|
+
path58 = resolve7(path58);
|
|
91502
91503
|
}
|
|
91503
91504
|
if (containsDotFile(parts)) {
|
|
91504
|
-
debug('%s dotfile "%s"', this._dotfiles,
|
|
91505
|
+
debug('%s dotfile "%s"', this._dotfiles, path58);
|
|
91505
91506
|
switch (this._dotfiles) {
|
|
91506
91507
|
case "allow":
|
|
91507
91508
|
break;
|
|
@@ -91515,13 +91516,13 @@ var require_send = __commonJS({
|
|
|
91515
91516
|
}
|
|
91516
91517
|
}
|
|
91517
91518
|
if (this._index.length && this.hasTrailingSlash()) {
|
|
91518
|
-
this.sendIndex(
|
|
91519
|
+
this.sendIndex(path58);
|
|
91519
91520
|
return res;
|
|
91520
91521
|
}
|
|
91521
|
-
this.sendFile(
|
|
91522
|
+
this.sendFile(path58);
|
|
91522
91523
|
return res;
|
|
91523
91524
|
};
|
|
91524
|
-
SendStream.prototype.send = function send2(
|
|
91525
|
+
SendStream.prototype.send = function send2(path58, stat) {
|
|
91525
91526
|
var len = stat.size;
|
|
91526
91527
|
var options = this.options;
|
|
91527
91528
|
var opts = {};
|
|
@@ -91533,9 +91534,9 @@ var require_send = __commonJS({
|
|
|
91533
91534
|
this.headersAlreadySent();
|
|
91534
91535
|
return;
|
|
91535
91536
|
}
|
|
91536
|
-
debug('pipe "%s"',
|
|
91537
|
-
this.setHeader(
|
|
91538
|
-
this.type(
|
|
91537
|
+
debug('pipe "%s"', path58);
|
|
91538
|
+
this.setHeader(path58, stat);
|
|
91539
|
+
this.type(path58);
|
|
91539
91540
|
if (this.isConditionalGET()) {
|
|
91540
91541
|
if (this.isPreconditionFailure()) {
|
|
91541
91542
|
this.error(412);
|
|
@@ -91584,30 +91585,30 @@ var require_send = __commonJS({
|
|
|
91584
91585
|
res.end();
|
|
91585
91586
|
return;
|
|
91586
91587
|
}
|
|
91587
|
-
this.stream(
|
|
91588
|
+
this.stream(path58, opts);
|
|
91588
91589
|
};
|
|
91589
|
-
SendStream.prototype.sendFile = function sendFile(
|
|
91590
|
+
SendStream.prototype.sendFile = function sendFile(path58) {
|
|
91590
91591
|
var i = 0;
|
|
91591
91592
|
var self2 = this;
|
|
91592
|
-
debug('stat "%s"',
|
|
91593
|
-
|
|
91594
|
-
var pathEndsWithSep =
|
|
91595
|
-
if (err && err.code === "ENOENT" && !extname3(
|
|
91593
|
+
debug('stat "%s"', path58);
|
|
91594
|
+
fs38.stat(path58, function onstat(err, stat) {
|
|
91595
|
+
var pathEndsWithSep = path58[path58.length - 1] === sep3;
|
|
91596
|
+
if (err && err.code === "ENOENT" && !extname3(path58) && !pathEndsWithSep) {
|
|
91596
91597
|
return next(err);
|
|
91597
91598
|
}
|
|
91598
91599
|
if (err) return self2.onStatError(err);
|
|
91599
|
-
if (stat.isDirectory()) return self2.redirect(
|
|
91600
|
+
if (stat.isDirectory()) return self2.redirect(path58);
|
|
91600
91601
|
if (pathEndsWithSep) return self2.error(404);
|
|
91601
|
-
self2.emit("file",
|
|
91602
|
-
self2.send(
|
|
91602
|
+
self2.emit("file", path58, stat);
|
|
91603
|
+
self2.send(path58, stat);
|
|
91603
91604
|
});
|
|
91604
91605
|
function next(err) {
|
|
91605
91606
|
if (self2._extensions.length <= i) {
|
|
91606
91607
|
return err ? self2.onStatError(err) : self2.error(404);
|
|
91607
91608
|
}
|
|
91608
|
-
var p =
|
|
91609
|
+
var p = path58 + "." + self2._extensions[i++];
|
|
91609
91610
|
debug('stat "%s"', p);
|
|
91610
|
-
|
|
91611
|
+
fs38.stat(p, function(err2, stat) {
|
|
91611
91612
|
if (err2) return next(err2);
|
|
91612
91613
|
if (stat.isDirectory()) return next();
|
|
91613
91614
|
self2.emit("file", p, stat);
|
|
@@ -91615,7 +91616,7 @@ var require_send = __commonJS({
|
|
|
91615
91616
|
});
|
|
91616
91617
|
}
|
|
91617
91618
|
};
|
|
91618
|
-
SendStream.prototype.sendIndex = function sendIndex(
|
|
91619
|
+
SendStream.prototype.sendIndex = function sendIndex(path58) {
|
|
91619
91620
|
var i = -1;
|
|
91620
91621
|
var self2 = this;
|
|
91621
91622
|
function next(err) {
|
|
@@ -91623,9 +91624,9 @@ var require_send = __commonJS({
|
|
|
91623
91624
|
if (err) return self2.onStatError(err);
|
|
91624
91625
|
return self2.error(404);
|
|
91625
91626
|
}
|
|
91626
|
-
var p =
|
|
91627
|
+
var p = join52(path58, self2._index[i]);
|
|
91627
91628
|
debug('stat "%s"', p);
|
|
91628
|
-
|
|
91629
|
+
fs38.stat(p, function(err2, stat) {
|
|
91629
91630
|
if (err2) return next(err2);
|
|
91630
91631
|
if (stat.isDirectory()) return next();
|
|
91631
91632
|
self2.emit("file", p, stat);
|
|
@@ -91634,10 +91635,10 @@ var require_send = __commonJS({
|
|
|
91634
91635
|
}
|
|
91635
91636
|
next();
|
|
91636
91637
|
};
|
|
91637
|
-
SendStream.prototype.stream = function stream(
|
|
91638
|
+
SendStream.prototype.stream = function stream(path58, options) {
|
|
91638
91639
|
var self2 = this;
|
|
91639
91640
|
var res = this.res;
|
|
91640
|
-
var stream2 =
|
|
91641
|
+
var stream2 = fs38.createReadStream(path58, options);
|
|
91641
91642
|
this.emit("stream", stream2);
|
|
91642
91643
|
stream2.pipe(res);
|
|
91643
91644
|
function cleanup() {
|
|
@@ -91652,17 +91653,17 @@ var require_send = __commonJS({
|
|
|
91652
91653
|
self2.emit("end");
|
|
91653
91654
|
});
|
|
91654
91655
|
};
|
|
91655
|
-
SendStream.prototype.type = function type(
|
|
91656
|
+
SendStream.prototype.type = function type(path58) {
|
|
91656
91657
|
var res = this.res;
|
|
91657
91658
|
if (res.getHeader("Content-Type")) return;
|
|
91658
|
-
var ext = extname3(
|
|
91659
|
+
var ext = extname3(path58);
|
|
91659
91660
|
var type2 = mime.contentType(ext) || "application/octet-stream";
|
|
91660
91661
|
debug("content-type %s", type2);
|
|
91661
91662
|
res.setHeader("Content-Type", type2);
|
|
91662
91663
|
};
|
|
91663
|
-
SendStream.prototype.setHeader = function setHeader(
|
|
91664
|
+
SendStream.prototype.setHeader = function setHeader(path58, stat) {
|
|
91664
91665
|
var res = this.res;
|
|
91665
|
-
this.emit("headers", res,
|
|
91666
|
+
this.emit("headers", res, path58, stat);
|
|
91666
91667
|
if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
|
|
91667
91668
|
debug("accept ranges");
|
|
91668
91669
|
res.setHeader("Accept-Ranges", "bytes");
|
|
@@ -91720,9 +91721,9 @@ var require_send = __commonJS({
|
|
|
91720
91721
|
}
|
|
91721
91722
|
return err instanceof Error ? createError(status, err, { expose: false }) : createError(status, err);
|
|
91722
91723
|
}
|
|
91723
|
-
function decode(
|
|
91724
|
+
function decode(path58) {
|
|
91724
91725
|
try {
|
|
91725
|
-
return decodeURIComponent(
|
|
91726
|
+
return decodeURIComponent(path58);
|
|
91726
91727
|
} catch (err) {
|
|
91727
91728
|
return -1;
|
|
91728
91729
|
}
|
|
@@ -91866,7 +91867,7 @@ var require_response = __commonJS({
|
|
|
91866
91867
|
var http = require("node:http");
|
|
91867
91868
|
var onFinished = require_on_finished();
|
|
91868
91869
|
var mime = require_mime_types3();
|
|
91869
|
-
var
|
|
91870
|
+
var path57 = require("node:path");
|
|
91870
91871
|
var pathIsAbsolute = require("node:path").isAbsolute;
|
|
91871
91872
|
var statuses = require_statuses();
|
|
91872
91873
|
var sign2 = require_cookie_signature().sign;
|
|
@@ -91875,8 +91876,8 @@ var require_response = __commonJS({
|
|
|
91875
91876
|
var setCharset = require_utils3().setCharset;
|
|
91876
91877
|
var cookie = require_cookie();
|
|
91877
91878
|
var send = require_send();
|
|
91878
|
-
var extname3 =
|
|
91879
|
-
var resolve7 =
|
|
91879
|
+
var extname3 = path57.extname;
|
|
91880
|
+
var resolve7 = path57.resolve;
|
|
91880
91881
|
var vary = require_vary();
|
|
91881
91882
|
var { Buffer: Buffer3 } = require("node:buffer");
|
|
91882
91883
|
var res = Object.create(http.ServerResponse.prototype);
|
|
@@ -92022,26 +92023,26 @@ var require_response = __commonJS({
|
|
|
92022
92023
|
this.type("txt");
|
|
92023
92024
|
return this.send(body);
|
|
92024
92025
|
};
|
|
92025
|
-
res.sendFile = function sendFile(
|
|
92026
|
+
res.sendFile = function sendFile(path58, options, callback) {
|
|
92026
92027
|
var done = callback;
|
|
92027
92028
|
var req = this.req;
|
|
92028
92029
|
var res2 = this;
|
|
92029
92030
|
var next = req.next;
|
|
92030
92031
|
var opts = options || {};
|
|
92031
|
-
if (!
|
|
92032
|
+
if (!path58) {
|
|
92032
92033
|
throw new TypeError("path argument is required to res.sendFile");
|
|
92033
92034
|
}
|
|
92034
|
-
if (typeof
|
|
92035
|
+
if (typeof path58 !== "string") {
|
|
92035
92036
|
throw new TypeError("path must be a string to res.sendFile");
|
|
92036
92037
|
}
|
|
92037
92038
|
if (typeof options === "function") {
|
|
92038
92039
|
done = options;
|
|
92039
92040
|
opts = {};
|
|
92040
92041
|
}
|
|
92041
|
-
if (!opts.root && !pathIsAbsolute(
|
|
92042
|
+
if (!opts.root && !pathIsAbsolute(path58)) {
|
|
92042
92043
|
throw new TypeError("path must be absolute or specify root to res.sendFile");
|
|
92043
92044
|
}
|
|
92044
|
-
var pathname = encodeURI(
|
|
92045
|
+
var pathname = encodeURI(path58);
|
|
92045
92046
|
opts.etag = this.app.enabled("etag");
|
|
92046
92047
|
var file = send(req, pathname, opts);
|
|
92047
92048
|
sendfile(res2, file, opts, function(err) {
|
|
@@ -92052,7 +92053,7 @@ var require_response = __commonJS({
|
|
|
92052
92053
|
}
|
|
92053
92054
|
});
|
|
92054
92055
|
};
|
|
92055
|
-
res.download = function download(
|
|
92056
|
+
res.download = function download(path58, filename, options, callback) {
|
|
92056
92057
|
var done = callback;
|
|
92057
92058
|
var name = filename;
|
|
92058
92059
|
var opts = options || null;
|
|
@@ -92069,7 +92070,7 @@ var require_response = __commonJS({
|
|
|
92069
92070
|
opts = filename;
|
|
92070
92071
|
}
|
|
92071
92072
|
var headers = {
|
|
92072
|
-
"Content-Disposition": contentDisposition(name ||
|
|
92073
|
+
"Content-Disposition": contentDisposition(name || path58)
|
|
92073
92074
|
};
|
|
92074
92075
|
if (opts && opts.headers) {
|
|
92075
92076
|
var keys = Object.keys(opts.headers);
|
|
@@ -92082,7 +92083,7 @@ var require_response = __commonJS({
|
|
|
92082
92083
|
}
|
|
92083
92084
|
opts = Object.create(opts);
|
|
92084
92085
|
opts.headers = headers;
|
|
92085
|
-
var fullPath = !opts.root ? resolve7(
|
|
92086
|
+
var fullPath = !opts.root ? resolve7(path58) : path58;
|
|
92086
92087
|
return this.sendFile(fullPath, opts, done);
|
|
92087
92088
|
};
|
|
92088
92089
|
res.contentType = res.type = function contentType(type) {
|
|
@@ -92365,11 +92366,11 @@ var require_serve_static = __commonJS({
|
|
|
92365
92366
|
}
|
|
92366
92367
|
var forwardError = !fallthrough;
|
|
92367
92368
|
var originalUrl = parseUrl.original(req);
|
|
92368
|
-
var
|
|
92369
|
-
if (
|
|
92370
|
-
|
|
92369
|
+
var path57 = parseUrl(req).pathname;
|
|
92370
|
+
if (path57 === "/" && originalUrl.pathname.substr(-1) !== "/") {
|
|
92371
|
+
path57 = "";
|
|
92371
92372
|
}
|
|
92372
|
-
var stream = send(req,
|
|
92373
|
+
var stream = send(req, path57, opts);
|
|
92373
92374
|
stream.on("directory", onDirectory);
|
|
92374
92375
|
if (setHeaders) {
|
|
92375
92376
|
stream.on("headers", setHeaders);
|
|
@@ -92613,8 +92614,8 @@ var init_dist = __esm({
|
|
|
92613
92614
|
*
|
|
92614
92615
|
* @returns {void}
|
|
92615
92616
|
*/
|
|
92616
|
-
trustProxy(
|
|
92617
|
-
if (
|
|
92617
|
+
trustProxy(request2) {
|
|
92618
|
+
if (request2.app.get("trust proxy") === true) {
|
|
92618
92619
|
throw new ValidationError2(
|
|
92619
92620
|
"ERR_ERL_PERMISSIVE_TRUST_PROXY",
|
|
92620
92621
|
`The Express 'trust proxy' setting is true, which allows anyone to trivially bypass IP-based rate limiting.`
|
|
@@ -92631,8 +92632,8 @@ var init_dist = __esm({
|
|
|
92631
92632
|
*
|
|
92632
92633
|
* @returns {void}
|
|
92633
92634
|
*/
|
|
92634
|
-
xForwardedForHeader(
|
|
92635
|
-
if (
|
|
92635
|
+
xForwardedForHeader(request2) {
|
|
92636
|
+
if (request2.headers["x-forwarded-for"] && request2.app.get("trust proxy") === false) {
|
|
92636
92637
|
throw new ValidationError2(
|
|
92637
92638
|
"ERR_ERL_UNEXPECTED_X_FORWARDED_FOR",
|
|
92638
92639
|
`The 'X-Forwarded-For' header is set but the Express 'trust proxy' setting is false (default). This could indicate a misconfiguration which would prevent express-rate-limit from accurately identifying users.`
|
|
@@ -92674,11 +92675,11 @@ var init_dist = __esm({
|
|
|
92674
92675
|
*
|
|
92675
92676
|
* @returns {void}
|
|
92676
92677
|
*/
|
|
92677
|
-
singleCount(
|
|
92678
|
-
let storeKeys = singleCountKeys.get(
|
|
92678
|
+
singleCount(request2, store, key) {
|
|
92679
|
+
let storeKeys = singleCountKeys.get(request2);
|
|
92679
92680
|
if (!storeKeys) {
|
|
92680
92681
|
storeKeys = /* @__PURE__ */ new Map();
|
|
92681
|
-
singleCountKeys.set(
|
|
92682
|
+
singleCountKeys.set(request2, storeKeys);
|
|
92682
92683
|
}
|
|
92683
92684
|
const storeKey = store.localKeys ? store : store.constructor.name;
|
|
92684
92685
|
let keys = storeKeys.get(storeKey);
|
|
@@ -93066,10 +93067,10 @@ var init_dist = __esm({
|
|
|
93066
93067
|
message: "Too many requests, please try again later.",
|
|
93067
93068
|
statusCode: 429,
|
|
93068
93069
|
legacyHeaders: passedOptions.headers ?? true,
|
|
93069
|
-
identifier(
|
|
93070
|
+
identifier(request2, _response) {
|
|
93070
93071
|
let duration = "";
|
|
93071
93072
|
const property = config.requestPropertyName;
|
|
93072
|
-
const { limit } =
|
|
93073
|
+
const { limit } = request2[property];
|
|
93073
93074
|
const seconds = config.windowMs / 1e3;
|
|
93074
93075
|
const minutes = config.windowMs / (1e3 * 60);
|
|
93075
93076
|
const hours = config.windowMs / (1e3 * 60 * 60);
|
|
@@ -93085,16 +93086,16 @@ var init_dist = __esm({
|
|
|
93085
93086
|
skipSuccessfulRequests: false,
|
|
93086
93087
|
requestWasSuccessful: (_request, response) => response.statusCode < 400,
|
|
93087
93088
|
skip: (_request, _response) => false,
|
|
93088
|
-
keyGenerator(
|
|
93089
|
-
validations2.ip(
|
|
93090
|
-
validations2.trustProxy(
|
|
93091
|
-
validations2.xForwardedForHeader(
|
|
93092
|
-
return
|
|
93089
|
+
keyGenerator(request2, _response) {
|
|
93090
|
+
validations2.ip(request2.ip);
|
|
93091
|
+
validations2.trustProxy(request2);
|
|
93092
|
+
validations2.xForwardedForHeader(request2);
|
|
93093
|
+
return request2.ip;
|
|
93093
93094
|
},
|
|
93094
|
-
async handler(
|
|
93095
|
+
async handler(request2, response, _next, _optionsUsed) {
|
|
93095
93096
|
response.status(config.statusCode);
|
|
93096
93097
|
const message = typeof config.message === "function" ? await config.message(
|
|
93097
|
-
|
|
93098
|
+
request2,
|
|
93098
93099
|
response
|
|
93099
93100
|
) : config.message;
|
|
93100
93101
|
if (!response.writableEnded) {
|
|
@@ -93119,9 +93120,9 @@ var init_dist = __esm({
|
|
|
93119
93120
|
}
|
|
93120
93121
|
return config;
|
|
93121
93122
|
};
|
|
93122
|
-
handleAsyncErrors = (fn) => async (
|
|
93123
|
+
handleAsyncErrors = (fn) => async (request2, response, next) => {
|
|
93123
93124
|
try {
|
|
93124
|
-
await Promise.resolve(fn(
|
|
93125
|
+
await Promise.resolve(fn(request2, response, next)).catch(next);
|
|
93125
93126
|
} catch (error) {
|
|
93126
93127
|
next(error);
|
|
93127
93128
|
}
|
|
@@ -93133,14 +93134,14 @@ var init_dist = __esm({
|
|
|
93133
93134
|
config.validations.unsharedStore(config.store);
|
|
93134
93135
|
if (typeof config.store.init === "function") config.store.init(options);
|
|
93135
93136
|
const middleware = handleAsyncErrors(
|
|
93136
|
-
async (
|
|
93137
|
-
const skip = await config.skip(
|
|
93137
|
+
async (request2, response, next) => {
|
|
93138
|
+
const skip = await config.skip(request2, response);
|
|
93138
93139
|
if (skip) {
|
|
93139
93140
|
next();
|
|
93140
93141
|
return;
|
|
93141
93142
|
}
|
|
93142
|
-
const augmentedRequest =
|
|
93143
|
-
const key = await config.keyGenerator(
|
|
93143
|
+
const augmentedRequest = request2;
|
|
93144
|
+
const key = await config.keyGenerator(request2, response);
|
|
93144
93145
|
let totalHits = 0;
|
|
93145
93146
|
let resetTime;
|
|
93146
93147
|
try {
|
|
@@ -93159,8 +93160,8 @@ var init_dist = __esm({
|
|
|
93159
93160
|
throw error;
|
|
93160
93161
|
}
|
|
93161
93162
|
config.validations.positiveHits(totalHits);
|
|
93162
|
-
config.validations.singleCount(
|
|
93163
|
-
const retrieveLimit = typeof config.limit === "function" ? config.limit(
|
|
93163
|
+
config.validations.singleCount(request2, config.store, key);
|
|
93164
|
+
const retrieveLimit = typeof config.limit === "function" ? config.limit(request2, response) : config.limit;
|
|
93164
93165
|
const limit = await retrieveLimit;
|
|
93165
93166
|
config.validations.limit(limit);
|
|
93166
93167
|
const info = {
|
|
@@ -93190,7 +93191,7 @@ var init_dist = __esm({
|
|
|
93190
93191
|
break;
|
|
93191
93192
|
}
|
|
93192
93193
|
case "draft-8": {
|
|
93193
|
-
const retrieveName = typeof config.identifier === "function" ? config.identifier(
|
|
93194
|
+
const retrieveName = typeof config.identifier === "function" ? config.identifier(request2, response) : config.identifier;
|
|
93194
93195
|
const name = await retrieveName;
|
|
93195
93196
|
config.validations.headersResetTime(info.resetTime);
|
|
93196
93197
|
setDraft8Headers(response, info, config.windowMs, name, key);
|
|
@@ -93212,7 +93213,7 @@ var init_dist = __esm({
|
|
|
93212
93213
|
};
|
|
93213
93214
|
if (config.skipFailedRequests) {
|
|
93214
93215
|
response.on("finish", async () => {
|
|
93215
|
-
if (!await config.requestWasSuccessful(
|
|
93216
|
+
if (!await config.requestWasSuccessful(request2, response))
|
|
93216
93217
|
await decrementKey();
|
|
93217
93218
|
});
|
|
93218
93219
|
response.on("close", async () => {
|
|
@@ -93224,7 +93225,7 @@ var init_dist = __esm({
|
|
|
93224
93225
|
}
|
|
93225
93226
|
if (config.skipSuccessfulRequests) {
|
|
93226
93227
|
response.on("finish", async () => {
|
|
93227
|
-
if (await config.requestWasSuccessful(
|
|
93228
|
+
if (await config.requestWasSuccessful(request2, response))
|
|
93228
93229
|
await decrementKey();
|
|
93229
93230
|
});
|
|
93230
93231
|
}
|
|
@@ -93234,7 +93235,7 @@ var init_dist = __esm({
|
|
|
93234
93235
|
if (config.legacyHeaders || config.standardHeaders) {
|
|
93235
93236
|
setRetryAfterHeader(response, info, config.windowMs);
|
|
93236
93237
|
}
|
|
93237
|
-
config.handler(
|
|
93238
|
+
config.handler(request2, response, next, options);
|
|
93238
93239
|
return;
|
|
93239
93240
|
}
|
|
93240
93241
|
next();
|
|
@@ -94297,13 +94298,12 @@ var init_server = __esm({
|
|
|
94297
94298
|
}
|
|
94298
94299
|
});
|
|
94299
94300
|
|
|
94300
|
-
// ../runtime/
|
|
94301
|
-
var
|
|
94302
|
-
|
|
94301
|
+
// ../runtime/src/secrets-cache.ts
|
|
94302
|
+
var SecretsCache;
|
|
94303
|
+
var init_secrets_cache = __esm({
|
|
94304
|
+
"../runtime/src/secrets-cache.ts"() {
|
|
94303
94305
|
"use strict";
|
|
94304
|
-
|
|
94305
|
-
exports2.SecretsCache = void 0;
|
|
94306
|
-
var SecretsCache = class {
|
|
94306
|
+
SecretsCache = class {
|
|
94307
94307
|
snapshot = null;
|
|
94308
94308
|
/** Replace the cached secrets in a single reference assignment. */
|
|
94309
94309
|
swap(values, keys, revision) {
|
|
@@ -94316,8 +94316,7 @@ var require_secrets_cache = __commonJS({
|
|
|
94316
94316
|
}
|
|
94317
94317
|
/** Whether the cache has exceeded the given TTL (seconds). */
|
|
94318
94318
|
isExpired(ttlSeconds) {
|
|
94319
|
-
if (!this.snapshot)
|
|
94320
|
-
return false;
|
|
94319
|
+
if (!this.snapshot) return false;
|
|
94321
94320
|
return (Date.now() - this.snapshot.swappedAt) / 1e3 > ttlSeconds;
|
|
94322
94321
|
}
|
|
94323
94322
|
/** Clear the cached snapshot, zeroing values first (best-effort). */
|
|
@@ -94340,8 +94339,7 @@ var require_secrets_cache = __commonJS({
|
|
|
94340
94339
|
/** Get all cached secret values. Returns null if not yet loaded. */
|
|
94341
94340
|
getAll() {
|
|
94342
94341
|
const s = this.snapshot;
|
|
94343
|
-
if (!s)
|
|
94344
|
-
return null;
|
|
94342
|
+
if (!s) return null;
|
|
94345
94343
|
return { ...s.values };
|
|
94346
94344
|
}
|
|
94347
94345
|
/** Get the list of available secret key names. */
|
|
@@ -94358,79 +94356,40 @@ var require_secrets_cache = __commonJS({
|
|
|
94358
94356
|
return this.snapshot !== null;
|
|
94359
94357
|
}
|
|
94360
94358
|
};
|
|
94361
|
-
exports2.SecretsCache = SecretsCache;
|
|
94362
94359
|
}
|
|
94363
94360
|
});
|
|
94364
94361
|
|
|
94365
|
-
// ../runtime/
|
|
94366
|
-
var
|
|
94367
|
-
|
|
94362
|
+
// ../runtime/src/disk-cache.ts
|
|
94363
|
+
var fs32, path48, DiskCache;
|
|
94364
|
+
var init_disk_cache = __esm({
|
|
94365
|
+
"../runtime/src/disk-cache.ts"() {
|
|
94368
94366
|
"use strict";
|
|
94369
|
-
|
|
94370
|
-
|
|
94371
|
-
|
|
94372
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
94373
|
-
desc = { enumerable: true, get: function() {
|
|
94374
|
-
return m[k];
|
|
94375
|
-
} };
|
|
94376
|
-
}
|
|
94377
|
-
Object.defineProperty(o, k2, desc);
|
|
94378
|
-
}) : (function(o, m, k, k2) {
|
|
94379
|
-
if (k2 === void 0) k2 = k;
|
|
94380
|
-
o[k2] = m[k];
|
|
94381
|
-
}));
|
|
94382
|
-
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
94383
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
94384
|
-
}) : function(o, v) {
|
|
94385
|
-
o["default"] = v;
|
|
94386
|
-
});
|
|
94387
|
-
var __importStar = exports2 && exports2.__importStar || /* @__PURE__ */ (function() {
|
|
94388
|
-
var ownKeys = function(o) {
|
|
94389
|
-
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
94390
|
-
var ar = [];
|
|
94391
|
-
for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
|
|
94392
|
-
return ar;
|
|
94393
|
-
};
|
|
94394
|
-
return ownKeys(o);
|
|
94395
|
-
};
|
|
94396
|
-
return function(mod) {
|
|
94397
|
-
if (mod && mod.__esModule) return mod;
|
|
94398
|
-
var result = {};
|
|
94399
|
-
if (mod != null) {
|
|
94400
|
-
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
94401
|
-
}
|
|
94402
|
-
__setModuleDefault(result, mod);
|
|
94403
|
-
return result;
|
|
94404
|
-
};
|
|
94405
|
-
})();
|
|
94406
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
94407
|
-
exports2.DiskCache = void 0;
|
|
94408
|
-
var fs35 = __importStar(require("fs"));
|
|
94409
|
-
var path56 = __importStar(require("path"));
|
|
94410
|
-
var DiskCache = class {
|
|
94367
|
+
fs32 = __toESM(require("fs"));
|
|
94368
|
+
path48 = __toESM(require("path"));
|
|
94369
|
+
DiskCache = class {
|
|
94411
94370
|
artifactPath;
|
|
94412
94371
|
metaPath;
|
|
94413
94372
|
constructor(cachePath, identity, environment) {
|
|
94414
|
-
const dir =
|
|
94415
|
-
this.artifactPath =
|
|
94416
|
-
this.metaPath =
|
|
94373
|
+
const dir = path48.join(cachePath, identity);
|
|
94374
|
+
this.artifactPath = path48.join(dir, `${environment}.age.json`);
|
|
94375
|
+
this.metaPath = path48.join(dir, `${environment}.meta`);
|
|
94417
94376
|
}
|
|
94418
94377
|
/** Write an artifact and optional metadata to disk (atomic via tmp+rename). */
|
|
94419
94378
|
write(raw, sha) {
|
|
94420
|
-
const dir =
|
|
94421
|
-
|
|
94379
|
+
const dir = path48.dirname(this.artifactPath);
|
|
94380
|
+
fs32.mkdirSync(dir, { recursive: true });
|
|
94422
94381
|
const tmpArtifact = `${this.artifactPath}.tmp.${process.pid}`;
|
|
94423
|
-
|
|
94424
|
-
|
|
94382
|
+
fs32.writeFileSync(tmpArtifact, raw, "utf-8");
|
|
94383
|
+
fs32.renameSync(tmpArtifact, this.artifactPath);
|
|
94425
94384
|
const meta = { sha, fetchedAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
94426
94385
|
const tmpMeta = `${this.metaPath}.tmp.${process.pid}`;
|
|
94427
|
-
|
|
94428
|
-
|
|
94386
|
+
fs32.writeFileSync(tmpMeta, JSON.stringify(meta), "utf-8");
|
|
94387
|
+
fs32.renameSync(tmpMeta, this.metaPath);
|
|
94429
94388
|
}
|
|
94430
94389
|
/** Read the cached artifact. Returns null if no cache file exists. */
|
|
94431
94390
|
read() {
|
|
94432
94391
|
try {
|
|
94433
|
-
return
|
|
94392
|
+
return fs32.readFileSync(this.artifactPath, "utf-8");
|
|
94434
94393
|
} catch {
|
|
94435
94394
|
return null;
|
|
94436
94395
|
}
|
|
@@ -94445,7 +94404,7 @@ var require_disk_cache = __commonJS({
|
|
|
94445
94404
|
}
|
|
94446
94405
|
readMeta() {
|
|
94447
94406
|
try {
|
|
94448
|
-
const raw =
|
|
94407
|
+
const raw = fs32.readFileSync(this.metaPath, "utf-8");
|
|
94449
94408
|
return JSON.parse(raw);
|
|
94450
94409
|
} catch {
|
|
94451
94410
|
return void 0;
|
|
@@ -94454,64 +94413,25 @@ var require_disk_cache = __commonJS({
|
|
|
94454
94413
|
/** Remove cached artifact and metadata files. */
|
|
94455
94414
|
purge() {
|
|
94456
94415
|
try {
|
|
94457
|
-
|
|
94416
|
+
fs32.unlinkSync(this.artifactPath);
|
|
94458
94417
|
} catch {
|
|
94459
94418
|
}
|
|
94460
94419
|
try {
|
|
94461
|
-
|
|
94420
|
+
fs32.unlinkSync(this.metaPath);
|
|
94462
94421
|
} catch {
|
|
94463
94422
|
}
|
|
94464
94423
|
}
|
|
94465
94424
|
};
|
|
94466
|
-
exports2.DiskCache = DiskCache;
|
|
94467
94425
|
}
|
|
94468
94426
|
});
|
|
94469
94427
|
|
|
94470
|
-
// ../runtime/
|
|
94471
|
-
var
|
|
94472
|
-
|
|
94428
|
+
// ../runtime/src/decrypt.ts
|
|
94429
|
+
var fs33, AgeDecryptor;
|
|
94430
|
+
var init_decrypt = __esm({
|
|
94431
|
+
"../runtime/src/decrypt.ts"() {
|
|
94473
94432
|
"use strict";
|
|
94474
|
-
|
|
94475
|
-
|
|
94476
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
94477
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
94478
|
-
desc = { enumerable: true, get: function() {
|
|
94479
|
-
return m[k];
|
|
94480
|
-
} };
|
|
94481
|
-
}
|
|
94482
|
-
Object.defineProperty(o, k2, desc);
|
|
94483
|
-
}) : (function(o, m, k, k2) {
|
|
94484
|
-
if (k2 === void 0) k2 = k;
|
|
94485
|
-
o[k2] = m[k];
|
|
94486
|
-
}));
|
|
94487
|
-
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
94488
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
94489
|
-
}) : function(o, v) {
|
|
94490
|
-
o["default"] = v;
|
|
94491
|
-
});
|
|
94492
|
-
var __importStar = exports2 && exports2.__importStar || /* @__PURE__ */ (function() {
|
|
94493
|
-
var ownKeys = function(o) {
|
|
94494
|
-
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
94495
|
-
var ar = [];
|
|
94496
|
-
for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
|
|
94497
|
-
return ar;
|
|
94498
|
-
};
|
|
94499
|
-
return ownKeys(o);
|
|
94500
|
-
};
|
|
94501
|
-
return function(mod) {
|
|
94502
|
-
if (mod && mod.__esModule) return mod;
|
|
94503
|
-
var result = {};
|
|
94504
|
-
if (mod != null) {
|
|
94505
|
-
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
94506
|
-
}
|
|
94507
|
-
__setModuleDefault(result, mod);
|
|
94508
|
-
return result;
|
|
94509
|
-
};
|
|
94510
|
-
})();
|
|
94511
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
94512
|
-
exports2.AgeDecryptor = void 0;
|
|
94513
|
-
var fs35 = __importStar(require("fs"));
|
|
94514
|
-
var AgeDecryptor = class {
|
|
94433
|
+
fs33 = __toESM(require("fs"));
|
|
94434
|
+
AgeDecryptor = class {
|
|
94515
94435
|
/**
|
|
94516
94436
|
* Decrypt an age-encrypted PEM-armored ciphertext string.
|
|
94517
94437
|
*
|
|
@@ -94520,7 +94440,7 @@ var require_decrypt = __commonJS({
|
|
|
94520
94440
|
* @returns The decrypted plaintext string.
|
|
94521
94441
|
*/
|
|
94522
94442
|
async decrypt(ciphertext, privateKey) {
|
|
94523
|
-
const { Decrypter } = await Promise.resolve(
|
|
94443
|
+
const { Decrypter } = await Promise.resolve().then(() => __toESM(require_age_encryption()));
|
|
94524
94444
|
const d = new Decrypter();
|
|
94525
94445
|
d.addIdentity(privateKey);
|
|
94526
94446
|
return d.decrypt(Buffer.from(ciphertext, "base64"), "text");
|
|
@@ -94533,10 +94453,9 @@ var require_decrypt = __commonJS({
|
|
|
94533
94453
|
* @returns The age private key string.
|
|
94534
94454
|
*/
|
|
94535
94455
|
resolveKey(ageKey, ageKeyFile) {
|
|
94536
|
-
if (ageKey)
|
|
94537
|
-
return ageKey.trim();
|
|
94456
|
+
if (ageKey) return ageKey.trim();
|
|
94538
94457
|
if (ageKeyFile) {
|
|
94539
|
-
const content =
|
|
94458
|
+
const content = fs33.readFileSync(ageKeyFile, "utf-8").trim();
|
|
94540
94459
|
const lines = content.split("\n").filter((l) => l.startsWith("AGE-SECRET-KEY-"));
|
|
94541
94460
|
if (lines.length === 0) {
|
|
94542
94461
|
throw new Error(`No age secret key found in file: ${ageKeyFile}`);
|
|
@@ -94546,54 +94465,15 @@ var require_decrypt = __commonJS({
|
|
|
94546
94465
|
throw new Error("No age key available. Set CLEF_AGE_KEY or CLEF_AGE_KEY_FILE.");
|
|
94547
94466
|
}
|
|
94548
94467
|
};
|
|
94549
|
-
exports2.AgeDecryptor = AgeDecryptor;
|
|
94550
94468
|
}
|
|
94551
94469
|
});
|
|
94552
94470
|
|
|
94553
|
-
// ../runtime/
|
|
94554
|
-
var
|
|
94555
|
-
|
|
94471
|
+
// ../runtime/src/kms/aws.ts
|
|
94472
|
+
var AwsKmsProvider;
|
|
94473
|
+
var init_aws = __esm({
|
|
94474
|
+
"../runtime/src/kms/aws.ts"() {
|
|
94556
94475
|
"use strict";
|
|
94557
|
-
|
|
94558
|
-
if (k2 === void 0) k2 = k;
|
|
94559
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
94560
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
94561
|
-
desc = { enumerable: true, get: function() {
|
|
94562
|
-
return m[k];
|
|
94563
|
-
} };
|
|
94564
|
-
}
|
|
94565
|
-
Object.defineProperty(o, k2, desc);
|
|
94566
|
-
}) : (function(o, m, k, k2) {
|
|
94567
|
-
if (k2 === void 0) k2 = k;
|
|
94568
|
-
o[k2] = m[k];
|
|
94569
|
-
}));
|
|
94570
|
-
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
94571
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
94572
|
-
}) : function(o, v) {
|
|
94573
|
-
o["default"] = v;
|
|
94574
|
-
});
|
|
94575
|
-
var __importStar = exports2 && exports2.__importStar || /* @__PURE__ */ (function() {
|
|
94576
|
-
var ownKeys = function(o) {
|
|
94577
|
-
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
94578
|
-
var ar = [];
|
|
94579
|
-
for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
|
|
94580
|
-
return ar;
|
|
94581
|
-
};
|
|
94582
|
-
return ownKeys(o);
|
|
94583
|
-
};
|
|
94584
|
-
return function(mod) {
|
|
94585
|
-
if (mod && mod.__esModule) return mod;
|
|
94586
|
-
var result = {};
|
|
94587
|
-
if (mod != null) {
|
|
94588
|
-
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
94589
|
-
}
|
|
94590
|
-
__setModuleDefault(result, mod);
|
|
94591
|
-
return result;
|
|
94592
|
-
};
|
|
94593
|
-
})();
|
|
94594
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
94595
|
-
exports2.AwsKmsProvider = void 0;
|
|
94596
|
-
var AwsKmsProvider = class {
|
|
94476
|
+
AwsKmsProvider = class {
|
|
94597
94477
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- lazy-loaded SDK client
|
|
94598
94478
|
client;
|
|
94599
94479
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- lazy-loaded SDK module
|
|
@@ -94603,13 +94483,14 @@ var require_aws = __commonJS({
|
|
|
94603
94483
|
this.region = region;
|
|
94604
94484
|
}
|
|
94605
94485
|
async ensureClient() {
|
|
94606
|
-
if (this.client)
|
|
94607
|
-
return;
|
|
94486
|
+
if (this.client) return;
|
|
94608
94487
|
try {
|
|
94609
|
-
this.sdk = await
|
|
94488
|
+
this.sdk = await import("@aws-sdk/client-kms");
|
|
94610
94489
|
this.client = new this.sdk.KMSClient({ region: this.region });
|
|
94611
94490
|
} catch {
|
|
94612
|
-
throw new Error(
|
|
94491
|
+
throw new Error(
|
|
94492
|
+
"AWS KMS requires @aws-sdk/client-kms. Install it with: npm install @aws-sdk/client-kms"
|
|
94493
|
+
);
|
|
94613
94494
|
}
|
|
94614
94495
|
}
|
|
94615
94496
|
async wrap(keyId, plaintext) {
|
|
@@ -94656,64 +94537,26 @@ var require_aws = __commonJS({
|
|
|
94656
94537
|
return Buffer.from(response.Signature);
|
|
94657
94538
|
}
|
|
94658
94539
|
};
|
|
94659
|
-
exports2.AwsKmsProvider = AwsKmsProvider;
|
|
94660
94540
|
}
|
|
94661
94541
|
});
|
|
94662
94542
|
|
|
94663
|
-
// ../runtime/
|
|
94664
|
-
var
|
|
94665
|
-
|
|
94543
|
+
// ../runtime/src/kms/gcp.ts
|
|
94544
|
+
var GcpKmsProvider;
|
|
94545
|
+
var init_gcp = __esm({
|
|
94546
|
+
"../runtime/src/kms/gcp.ts"() {
|
|
94666
94547
|
"use strict";
|
|
94667
|
-
|
|
94668
|
-
if (k2 === void 0) k2 = k;
|
|
94669
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
94670
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
94671
|
-
desc = { enumerable: true, get: function() {
|
|
94672
|
-
return m[k];
|
|
94673
|
-
} };
|
|
94674
|
-
}
|
|
94675
|
-
Object.defineProperty(o, k2, desc);
|
|
94676
|
-
}) : (function(o, m, k, k2) {
|
|
94677
|
-
if (k2 === void 0) k2 = k;
|
|
94678
|
-
o[k2] = m[k];
|
|
94679
|
-
}));
|
|
94680
|
-
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
94681
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
94682
|
-
}) : function(o, v) {
|
|
94683
|
-
o["default"] = v;
|
|
94684
|
-
});
|
|
94685
|
-
var __importStar = exports2 && exports2.__importStar || /* @__PURE__ */ (function() {
|
|
94686
|
-
var ownKeys = function(o) {
|
|
94687
|
-
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
94688
|
-
var ar = [];
|
|
94689
|
-
for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
|
|
94690
|
-
return ar;
|
|
94691
|
-
};
|
|
94692
|
-
return ownKeys(o);
|
|
94693
|
-
};
|
|
94694
|
-
return function(mod) {
|
|
94695
|
-
if (mod && mod.__esModule) return mod;
|
|
94696
|
-
var result = {};
|
|
94697
|
-
if (mod != null) {
|
|
94698
|
-
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
94699
|
-
}
|
|
94700
|
-
__setModuleDefault(result, mod);
|
|
94701
|
-
return result;
|
|
94702
|
-
};
|
|
94703
|
-
})();
|
|
94704
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
94705
|
-
exports2.GcpKmsProvider = void 0;
|
|
94706
|
-
var GcpKmsProvider = class {
|
|
94548
|
+
GcpKmsProvider = class {
|
|
94707
94549
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- lazy-loaded SDK client
|
|
94708
94550
|
client;
|
|
94709
94551
|
async ensureClient() {
|
|
94710
|
-
if (this.client)
|
|
94711
|
-
return;
|
|
94552
|
+
if (this.client) return;
|
|
94712
94553
|
try {
|
|
94713
|
-
const kms = await
|
|
94554
|
+
const kms = await import("@google-cloud/kms");
|
|
94714
94555
|
this.client = new kms.KeyManagementServiceClient();
|
|
94715
94556
|
} catch {
|
|
94716
|
-
throw new Error(
|
|
94557
|
+
throw new Error(
|
|
94558
|
+
"GCP KMS requires @google-cloud/kms. Install it with: npm install @google-cloud/kms"
|
|
94559
|
+
);
|
|
94717
94560
|
}
|
|
94718
94561
|
}
|
|
94719
94562
|
async wrap(keyId, plaintext) {
|
|
@@ -94742,67 +94585,29 @@ var require_gcp = __commonJS({
|
|
|
94742
94585
|
return Buffer.from(response.plaintext);
|
|
94743
94586
|
}
|
|
94744
94587
|
};
|
|
94745
|
-
exports2.GcpKmsProvider = GcpKmsProvider;
|
|
94746
94588
|
}
|
|
94747
94589
|
});
|
|
94748
94590
|
|
|
94749
|
-
// ../runtime/
|
|
94750
|
-
var
|
|
94751
|
-
|
|
94591
|
+
// ../runtime/src/kms/azure.ts
|
|
94592
|
+
var AzureKmsProvider;
|
|
94593
|
+
var init_azure = __esm({
|
|
94594
|
+
"../runtime/src/kms/azure.ts"() {
|
|
94752
94595
|
"use strict";
|
|
94753
|
-
|
|
94754
|
-
if (k2 === void 0) k2 = k;
|
|
94755
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
94756
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
94757
|
-
desc = { enumerable: true, get: function() {
|
|
94758
|
-
return m[k];
|
|
94759
|
-
} };
|
|
94760
|
-
}
|
|
94761
|
-
Object.defineProperty(o, k2, desc);
|
|
94762
|
-
}) : (function(o, m, k, k2) {
|
|
94763
|
-
if (k2 === void 0) k2 = k;
|
|
94764
|
-
o[k2] = m[k];
|
|
94765
|
-
}));
|
|
94766
|
-
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
94767
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
94768
|
-
}) : function(o, v) {
|
|
94769
|
-
o["default"] = v;
|
|
94770
|
-
});
|
|
94771
|
-
var __importStar = exports2 && exports2.__importStar || /* @__PURE__ */ (function() {
|
|
94772
|
-
var ownKeys = function(o) {
|
|
94773
|
-
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
94774
|
-
var ar = [];
|
|
94775
|
-
for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
|
|
94776
|
-
return ar;
|
|
94777
|
-
};
|
|
94778
|
-
return ownKeys(o);
|
|
94779
|
-
};
|
|
94780
|
-
return function(mod) {
|
|
94781
|
-
if (mod && mod.__esModule) return mod;
|
|
94782
|
-
var result = {};
|
|
94783
|
-
if (mod != null) {
|
|
94784
|
-
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
94785
|
-
}
|
|
94786
|
-
__setModuleDefault(result, mod);
|
|
94787
|
-
return result;
|
|
94788
|
-
};
|
|
94789
|
-
})();
|
|
94790
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
94791
|
-
exports2.AzureKmsProvider = void 0;
|
|
94792
|
-
var AzureKmsProvider = class {
|
|
94596
|
+
AzureKmsProvider = class {
|
|
94793
94597
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- lazy-loaded SDK credential
|
|
94794
94598
|
credential;
|
|
94795
94599
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- lazy-loaded SDK module
|
|
94796
94600
|
keysModule;
|
|
94797
94601
|
async ensureLoaded() {
|
|
94798
|
-
if (this.credential)
|
|
94799
|
-
return;
|
|
94602
|
+
if (this.credential) return;
|
|
94800
94603
|
try {
|
|
94801
|
-
const identity = await
|
|
94802
|
-
this.keysModule = await
|
|
94604
|
+
const identity = await import("@azure/identity");
|
|
94605
|
+
this.keysModule = await import("@azure/keyvault-keys");
|
|
94803
94606
|
this.credential = new identity.DefaultAzureCredential();
|
|
94804
94607
|
} catch {
|
|
94805
|
-
throw new Error(
|
|
94608
|
+
throw new Error(
|
|
94609
|
+
"Azure Key Vault requires @azure/identity and @azure/keyvault-keys. Install them with: npm install @azure/identity @azure/keyvault-keys"
|
|
94610
|
+
);
|
|
94806
94611
|
}
|
|
94807
94612
|
}
|
|
94808
94613
|
async wrap(keyId, plaintext) {
|
|
@@ -94827,38 +94632,84 @@ var require_azure = __commonJS({
|
|
|
94827
94632
|
return Buffer.from(result.result);
|
|
94828
94633
|
}
|
|
94829
94634
|
};
|
|
94830
|
-
exports2.AzureKmsProvider = AzureKmsProvider;
|
|
94831
94635
|
}
|
|
94832
94636
|
});
|
|
94833
94637
|
|
|
94834
|
-
// ../client/dist/kms.
|
|
94835
|
-
var
|
|
94836
|
-
|
|
94638
|
+
// ../client/dist/kms.mjs
|
|
94639
|
+
var kms_exports = {};
|
|
94640
|
+
__export(kms_exports, {
|
|
94641
|
+
ClefClientError: () => ClefClientError,
|
|
94642
|
+
CloudKmsProvider: () => CloudKmsProvider
|
|
94643
|
+
});
|
|
94644
|
+
function resolveToken(explicit) {
|
|
94645
|
+
if (explicit) return explicit;
|
|
94646
|
+
if (typeof process !== "undefined" && process.env?.CLEF_SERVICE_TOKEN) {
|
|
94647
|
+
return process.env.CLEF_SERVICE_TOKEN;
|
|
94648
|
+
}
|
|
94649
|
+
throw new ClefClientError(
|
|
94650
|
+
"No service token configured",
|
|
94651
|
+
void 0,
|
|
94652
|
+
"Set CLEF_SERVICE_TOKEN or pass token in options."
|
|
94653
|
+
);
|
|
94654
|
+
}
|
|
94655
|
+
async function request(baseUrl, opts) {
|
|
94656
|
+
const url = `${baseUrl}${opts.path}`;
|
|
94657
|
+
const headers = {
|
|
94658
|
+
Authorization: `Bearer ${opts.token}`,
|
|
94659
|
+
Accept: "application/json"
|
|
94660
|
+
};
|
|
94661
|
+
if (opts.body !== void 0) {
|
|
94662
|
+
headers["Content-Type"] = "application/json";
|
|
94663
|
+
}
|
|
94664
|
+
const init2 = {
|
|
94665
|
+
method: opts.method,
|
|
94666
|
+
headers,
|
|
94667
|
+
body: opts.body !== void 0 ? JSON.stringify(opts.body) : void 0
|
|
94668
|
+
};
|
|
94669
|
+
let response;
|
|
94670
|
+
try {
|
|
94671
|
+
response = await opts.fetchFn(url, init2);
|
|
94672
|
+
} catch (err) {
|
|
94673
|
+
try {
|
|
94674
|
+
response = await opts.fetchFn(url, init2);
|
|
94675
|
+
} catch {
|
|
94676
|
+
throw new ClefClientError(
|
|
94677
|
+
`Connection failed: ${err.message}`,
|
|
94678
|
+
void 0,
|
|
94679
|
+
"Is the endpoint reachable? Check your CLEF_ENDPOINT setting."
|
|
94680
|
+
);
|
|
94681
|
+
}
|
|
94682
|
+
}
|
|
94683
|
+
if (response.status >= 500) {
|
|
94684
|
+
response = await opts.fetchFn(url, init2);
|
|
94685
|
+
}
|
|
94686
|
+
if (response.status === 401) {
|
|
94687
|
+
throw new ClefClientError("Authentication failed", 401, "Check your CLEF_SERVICE_TOKEN.");
|
|
94688
|
+
}
|
|
94689
|
+
if (response.status === 503) {
|
|
94690
|
+
throw new ClefClientError("Secrets expired or not loaded", 503, "Check the agent logs.");
|
|
94691
|
+
}
|
|
94692
|
+
if (!response.ok) {
|
|
94693
|
+
const text = await response.text().catch(() => "");
|
|
94694
|
+
throw new ClefClientError(
|
|
94695
|
+
`HTTP ${response.status}: ${text || response.statusText}`,
|
|
94696
|
+
response.status
|
|
94697
|
+
);
|
|
94698
|
+
}
|
|
94699
|
+
const json = await response.json();
|
|
94700
|
+
if (json && typeof json === "object" && "success" in json) {
|
|
94701
|
+
if (!json.success) {
|
|
94702
|
+
throw new ClefClientError(json.message || "Request failed", response.status);
|
|
94703
|
+
}
|
|
94704
|
+
return json.data;
|
|
94705
|
+
}
|
|
94706
|
+
return json;
|
|
94707
|
+
}
|
|
94708
|
+
var ClefClientError, CloudKmsProvider;
|
|
94709
|
+
var init_kms2 = __esm({
|
|
94710
|
+
"../client/dist/kms.mjs"() {
|
|
94837
94711
|
"use strict";
|
|
94838
|
-
|
|
94839
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
94840
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
94841
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
94842
|
-
var __export2 = (target, all) => {
|
|
94843
|
-
for (var name in all)
|
|
94844
|
-
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
94845
|
-
};
|
|
94846
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
94847
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
94848
|
-
for (let key of __getOwnPropNames2(from))
|
|
94849
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
94850
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
94851
|
-
}
|
|
94852
|
-
return to;
|
|
94853
|
-
};
|
|
94854
|
-
var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
94855
|
-
var kms_exports = {};
|
|
94856
|
-
__export2(kms_exports, {
|
|
94857
|
-
ClefClientError: () => ClefClientError,
|
|
94858
|
-
CloudKmsProvider: () => CloudKmsProvider
|
|
94859
|
-
});
|
|
94860
|
-
module2.exports = __toCommonJS(kms_exports);
|
|
94861
|
-
var ClefClientError = class extends Error {
|
|
94712
|
+
ClefClientError = class extends Error {
|
|
94862
94713
|
constructor(message, statusCode, fix) {
|
|
94863
94714
|
super(message);
|
|
94864
94715
|
this.statusCode = statusCode;
|
|
@@ -94868,71 +94719,7 @@ var require_kms = __commonJS({
|
|
|
94868
94719
|
statusCode;
|
|
94869
94720
|
fix;
|
|
94870
94721
|
};
|
|
94871
|
-
|
|
94872
|
-
if (explicit) return explicit;
|
|
94873
|
-
if (typeof process !== "undefined" && process.env?.CLEF_SERVICE_TOKEN) {
|
|
94874
|
-
return process.env.CLEF_SERVICE_TOKEN;
|
|
94875
|
-
}
|
|
94876
|
-
throw new ClefClientError(
|
|
94877
|
-
"No service token configured",
|
|
94878
|
-
void 0,
|
|
94879
|
-
"Set CLEF_SERVICE_TOKEN or pass token in options."
|
|
94880
|
-
);
|
|
94881
|
-
}
|
|
94882
|
-
async function request(baseUrl, opts) {
|
|
94883
|
-
const url = `${baseUrl}${opts.path}`;
|
|
94884
|
-
const headers = {
|
|
94885
|
-
Authorization: `Bearer ${opts.token}`,
|
|
94886
|
-
Accept: "application/json"
|
|
94887
|
-
};
|
|
94888
|
-
if (opts.body !== void 0) {
|
|
94889
|
-
headers["Content-Type"] = "application/json";
|
|
94890
|
-
}
|
|
94891
|
-
const init = {
|
|
94892
|
-
method: opts.method,
|
|
94893
|
-
headers,
|
|
94894
|
-
body: opts.body !== void 0 ? JSON.stringify(opts.body) : void 0
|
|
94895
|
-
};
|
|
94896
|
-
let response;
|
|
94897
|
-
try {
|
|
94898
|
-
response = await opts.fetchFn(url, init);
|
|
94899
|
-
} catch (err) {
|
|
94900
|
-
try {
|
|
94901
|
-
response = await opts.fetchFn(url, init);
|
|
94902
|
-
} catch {
|
|
94903
|
-
throw new ClefClientError(
|
|
94904
|
-
`Connection failed: ${err.message}`,
|
|
94905
|
-
void 0,
|
|
94906
|
-
"Is the endpoint reachable? Check your CLEF_ENDPOINT setting."
|
|
94907
|
-
);
|
|
94908
|
-
}
|
|
94909
|
-
}
|
|
94910
|
-
if (response.status >= 500) {
|
|
94911
|
-
response = await opts.fetchFn(url, init);
|
|
94912
|
-
}
|
|
94913
|
-
if (response.status === 401) {
|
|
94914
|
-
throw new ClefClientError("Authentication failed", 401, "Check your CLEF_SERVICE_TOKEN.");
|
|
94915
|
-
}
|
|
94916
|
-
if (response.status === 503) {
|
|
94917
|
-
throw new ClefClientError("Secrets expired or not loaded", 503, "Check the agent logs.");
|
|
94918
|
-
}
|
|
94919
|
-
if (!response.ok) {
|
|
94920
|
-
const text = await response.text().catch(() => "");
|
|
94921
|
-
throw new ClefClientError(
|
|
94922
|
-
`HTTP ${response.status}: ${text || response.statusText}`,
|
|
94923
|
-
response.status
|
|
94924
|
-
);
|
|
94925
|
-
}
|
|
94926
|
-
const json = await response.json();
|
|
94927
|
-
if (json && typeof json === "object" && "success" in json) {
|
|
94928
|
-
if (!json.success) {
|
|
94929
|
-
throw new ClefClientError(json.message || "Request failed", response.status);
|
|
94930
|
-
}
|
|
94931
|
-
return json.data;
|
|
94932
|
-
}
|
|
94933
|
-
return json;
|
|
94934
|
-
}
|
|
94935
|
-
var CloudKmsProvider = class {
|
|
94722
|
+
CloudKmsProvider = class {
|
|
94936
94723
|
endpoint;
|
|
94937
94724
|
token;
|
|
94938
94725
|
constructor(options) {
|
|
@@ -94961,139 +94748,54 @@ var require_kms = __commonJS({
|
|
|
94961
94748
|
}
|
|
94962
94749
|
});
|
|
94963
94750
|
|
|
94964
|
-
// ../runtime/
|
|
94965
|
-
|
|
94966
|
-
|
|
94967
|
-
|
|
94968
|
-
|
|
94969
|
-
|
|
94970
|
-
|
|
94971
|
-
|
|
94972
|
-
|
|
94973
|
-
|
|
94974
|
-
|
|
94975
|
-
|
|
94976
|
-
|
|
94977
|
-
|
|
94978
|
-
|
|
94979
|
-
|
|
94980
|
-
|
|
94981
|
-
|
|
94982
|
-
|
|
94983
|
-
|
|
94984
|
-
o["default"] = v;
|
|
94985
|
-
});
|
|
94986
|
-
var __importStar = exports2 && exports2.__importStar || /* @__PURE__ */ (function() {
|
|
94987
|
-
var ownKeys = function(o) {
|
|
94988
|
-
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
94989
|
-
var ar = [];
|
|
94990
|
-
for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
|
|
94991
|
-
return ar;
|
|
94992
|
-
};
|
|
94993
|
-
return ownKeys(o);
|
|
94994
|
-
};
|
|
94995
|
-
return function(mod) {
|
|
94996
|
-
if (mod && mod.__esModule) return mod;
|
|
94997
|
-
var result = {};
|
|
94998
|
-
if (mod != null) {
|
|
94999
|
-
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
95000
|
-
}
|
|
95001
|
-
__setModuleDefault(result, mod);
|
|
95002
|
-
return result;
|
|
95003
|
-
};
|
|
95004
|
-
})();
|
|
95005
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
95006
|
-
exports2.AzureKmsProvider = exports2.GcpKmsProvider = exports2.AwsKmsProvider = void 0;
|
|
95007
|
-
exports2.createKmsProvider = createKmsProvider;
|
|
95008
|
-
var aws_1 = require_aws();
|
|
95009
|
-
var gcp_1 = require_gcp();
|
|
95010
|
-
var azure_1 = require_azure();
|
|
95011
|
-
var aws_2 = require_aws();
|
|
95012
|
-
Object.defineProperty(exports2, "AwsKmsProvider", { enumerable: true, get: function() {
|
|
95013
|
-
return aws_2.AwsKmsProvider;
|
|
95014
|
-
} });
|
|
95015
|
-
var gcp_2 = require_gcp();
|
|
95016
|
-
Object.defineProperty(exports2, "GcpKmsProvider", { enumerable: true, get: function() {
|
|
95017
|
-
return gcp_2.GcpKmsProvider;
|
|
95018
|
-
} });
|
|
95019
|
-
var azure_2 = require_azure();
|
|
95020
|
-
Object.defineProperty(exports2, "AzureKmsProvider", { enumerable: true, get: function() {
|
|
95021
|
-
return azure_2.AzureKmsProvider;
|
|
95022
|
-
} });
|
|
95023
|
-
async function createKmsProvider(provider, options) {
|
|
95024
|
-
switch (provider) {
|
|
95025
|
-
case "aws":
|
|
95026
|
-
return new aws_1.AwsKmsProvider(options?.region);
|
|
95027
|
-
case "gcp":
|
|
95028
|
-
return new gcp_1.GcpKmsProvider();
|
|
95029
|
-
case "azure":
|
|
95030
|
-
return new azure_1.AzureKmsProvider();
|
|
95031
|
-
case "cloud": {
|
|
95032
|
-
try {
|
|
95033
|
-
const { CloudKmsProvider } = await Promise.resolve().then(() => __importStar(require_kms()));
|
|
95034
|
-
return new CloudKmsProvider({
|
|
95035
|
-
endpoint: options?.endpoint ?? "",
|
|
95036
|
-
token: options?.token
|
|
95037
|
-
});
|
|
95038
|
-
} catch {
|
|
95039
|
-
throw new Error("Clef Cloud KMS requires @clef-sh/client. Install it with: npm install @clef-sh/client");
|
|
95040
|
-
}
|
|
95041
|
-
}
|
|
95042
|
-
default:
|
|
95043
|
-
throw new Error(`Unknown KMS provider: ${provider}`);
|
|
94751
|
+
// ../runtime/src/kms/index.ts
|
|
94752
|
+
async function createKmsProvider(provider, options) {
|
|
94753
|
+
switch (provider) {
|
|
94754
|
+
case "aws":
|
|
94755
|
+
return new AwsKmsProvider(options?.region);
|
|
94756
|
+
case "gcp":
|
|
94757
|
+
return new GcpKmsProvider();
|
|
94758
|
+
case "azure":
|
|
94759
|
+
return new AzureKmsProvider();
|
|
94760
|
+
case "cloud": {
|
|
94761
|
+
try {
|
|
94762
|
+
const { CloudKmsProvider: CloudKmsProvider2 } = await Promise.resolve().then(() => (init_kms2(), kms_exports));
|
|
94763
|
+
return new CloudKmsProvider2({
|
|
94764
|
+
endpoint: options?.endpoint ?? "",
|
|
94765
|
+
token: options?.token
|
|
94766
|
+
});
|
|
94767
|
+
} catch {
|
|
94768
|
+
throw new Error(
|
|
94769
|
+
"Clef Cloud KMS requires @clef-sh/client. Install it with: npm install @clef-sh/client"
|
|
94770
|
+
);
|
|
95044
94771
|
}
|
|
95045
94772
|
}
|
|
94773
|
+
default:
|
|
94774
|
+
throw new Error(`Unknown KMS provider: ${provider}`);
|
|
94775
|
+
}
|
|
94776
|
+
}
|
|
94777
|
+
var init_kms3 = __esm({
|
|
94778
|
+
"../runtime/src/kms/index.ts"() {
|
|
94779
|
+
"use strict";
|
|
94780
|
+
init_aws();
|
|
94781
|
+
init_gcp();
|
|
94782
|
+
init_azure();
|
|
94783
|
+
init_aws();
|
|
94784
|
+
init_gcp();
|
|
94785
|
+
init_azure();
|
|
95046
94786
|
}
|
|
95047
94787
|
});
|
|
95048
94788
|
|
|
95049
|
-
// ../runtime/
|
|
95050
|
-
var
|
|
95051
|
-
|
|
94789
|
+
// ../runtime/src/artifact-decryptor.ts
|
|
94790
|
+
var crypto6, ArtifactDecryptor;
|
|
94791
|
+
var init_artifact_decryptor = __esm({
|
|
94792
|
+
"../runtime/src/artifact-decryptor.ts"() {
|
|
95052
94793
|
"use strict";
|
|
95053
|
-
|
|
95054
|
-
|
|
95055
|
-
|
|
95056
|
-
|
|
95057
|
-
|
|
95058
|
-
return m[k];
|
|
95059
|
-
} };
|
|
95060
|
-
}
|
|
95061
|
-
Object.defineProperty(o, k2, desc);
|
|
95062
|
-
}) : (function(o, m, k, k2) {
|
|
95063
|
-
if (k2 === void 0) k2 = k;
|
|
95064
|
-
o[k2] = m[k];
|
|
95065
|
-
}));
|
|
95066
|
-
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
95067
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
95068
|
-
}) : function(o, v) {
|
|
95069
|
-
o["default"] = v;
|
|
95070
|
-
});
|
|
95071
|
-
var __importStar = exports2 && exports2.__importStar || /* @__PURE__ */ (function() {
|
|
95072
|
-
var ownKeys = function(o) {
|
|
95073
|
-
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
95074
|
-
var ar = [];
|
|
95075
|
-
for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
|
|
95076
|
-
return ar;
|
|
95077
|
-
};
|
|
95078
|
-
return ownKeys(o);
|
|
95079
|
-
};
|
|
95080
|
-
return function(mod) {
|
|
95081
|
-
if (mod && mod.__esModule) return mod;
|
|
95082
|
-
var result = {};
|
|
95083
|
-
if (mod != null) {
|
|
95084
|
-
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
95085
|
-
}
|
|
95086
|
-
__setModuleDefault(result, mod);
|
|
95087
|
-
return result;
|
|
95088
|
-
};
|
|
95089
|
-
})();
|
|
95090
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
95091
|
-
exports2.ArtifactDecryptor = void 0;
|
|
95092
|
-
var crypto6 = __importStar(require("crypto"));
|
|
95093
|
-
var decrypt_1 = require_decrypt();
|
|
95094
|
-
var kms_1 = require_kms2();
|
|
95095
|
-
var ArtifactDecryptor = class {
|
|
95096
|
-
ageDecryptor = new decrypt_1.AgeDecryptor();
|
|
94794
|
+
crypto6 = __toESM(require("crypto"));
|
|
94795
|
+
init_decrypt();
|
|
94796
|
+
init_kms3();
|
|
94797
|
+
ArtifactDecryptor = class {
|
|
94798
|
+
ageDecryptor = new AgeDecryptor();
|
|
95097
94799
|
privateKey;
|
|
95098
94800
|
telemetryOverride;
|
|
95099
94801
|
initialTelemetry;
|
|
@@ -95140,7 +94842,7 @@ var require_artifact_decryptor = __commonJS({
|
|
|
95140
94842
|
const envelope = artifact.envelope;
|
|
95141
94843
|
let dek;
|
|
95142
94844
|
try {
|
|
95143
|
-
const kms = await
|
|
94845
|
+
const kms = await createKmsProvider(envelope.provider);
|
|
95144
94846
|
const wrappedKey = Buffer.from(envelope.wrappedKey, "base64");
|
|
95145
94847
|
dek = await kms.unwrap(envelope.keyId, wrappedKey, envelope.algorithm);
|
|
95146
94848
|
} catch (err) {
|
|
@@ -95170,7 +94872,9 @@ var require_artifact_decryptor = __commonJS({
|
|
|
95170
94872
|
/** Age-only: decrypt with the static private key. */
|
|
95171
94873
|
async decryptAge(artifact) {
|
|
95172
94874
|
if (!this.privateKey) {
|
|
95173
|
-
throw new Error(
|
|
94875
|
+
throw new Error(
|
|
94876
|
+
"Artifact requires an age private key. Set CLEF_AGENT_AGE_KEY or use KMS envelope encryption."
|
|
94877
|
+
);
|
|
95174
94878
|
}
|
|
95175
94879
|
try {
|
|
95176
94880
|
return await this.ageDecryptor.decrypt(artifact.ciphertext, this.privateKey);
|
|
@@ -95183,141 +94887,72 @@ var require_artifact_decryptor = __commonJS({
|
|
|
95183
94887
|
}
|
|
95184
94888
|
}
|
|
95185
94889
|
};
|
|
95186
|
-
exports2.ArtifactDecryptor = ArtifactDecryptor;
|
|
95187
94890
|
}
|
|
95188
94891
|
});
|
|
95189
94892
|
|
|
95190
|
-
// ../runtime/
|
|
95191
|
-
|
|
95192
|
-
|
|
94893
|
+
// ../runtime/src/signature.ts
|
|
94894
|
+
function buildSigningPayload2(artifact) {
|
|
94895
|
+
const fields = [
|
|
94896
|
+
"clef-sig-v3",
|
|
94897
|
+
String(artifact.version),
|
|
94898
|
+
artifact.identity,
|
|
94899
|
+
artifact.environment,
|
|
94900
|
+
artifact.revision,
|
|
94901
|
+
artifact.packedAt,
|
|
94902
|
+
artifact.ciphertextHash,
|
|
94903
|
+
artifact.expiresAt ?? "",
|
|
94904
|
+
artifact.envelope?.provider ?? "",
|
|
94905
|
+
artifact.envelope?.keyId ?? "",
|
|
94906
|
+
artifact.envelope?.wrappedKey ?? "",
|
|
94907
|
+
artifact.envelope?.algorithm ?? "",
|
|
94908
|
+
artifact.envelope?.iv ?? "",
|
|
94909
|
+
artifact.envelope?.authTag ?? ""
|
|
94910
|
+
];
|
|
94911
|
+
return Buffer.from(fields.join("\n"), "utf-8");
|
|
94912
|
+
}
|
|
94913
|
+
function verifySignature2(payload, signatureBase64, publicKeyBase64) {
|
|
94914
|
+
const keyObj = crypto7.createPublicKey({
|
|
94915
|
+
key: Buffer.from(publicKeyBase64, "base64"),
|
|
94916
|
+
format: "der",
|
|
94917
|
+
type: "spki"
|
|
94918
|
+
});
|
|
94919
|
+
const signature = Buffer.from(signatureBase64, "base64");
|
|
94920
|
+
const keyType = keyObj.asymmetricKeyType;
|
|
94921
|
+
if (keyType === "ed25519") {
|
|
94922
|
+
return crypto7.verify(null, payload, keyObj, signature);
|
|
94923
|
+
}
|
|
94924
|
+
if (keyType === "ec") {
|
|
94925
|
+
return crypto7.verify("sha256", payload, keyObj, signature);
|
|
94926
|
+
}
|
|
94927
|
+
throw new Error(`Unsupported key type for signature verification: ${keyType}`);
|
|
94928
|
+
}
|
|
94929
|
+
var crypto7;
|
|
94930
|
+
var init_signature = __esm({
|
|
94931
|
+
"../runtime/src/signature.ts"() {
|
|
95193
94932
|
"use strict";
|
|
95194
|
-
|
|
95195
|
-
if (k2 === void 0) k2 = k;
|
|
95196
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
95197
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
95198
|
-
desc = { enumerable: true, get: function() {
|
|
95199
|
-
return m[k];
|
|
95200
|
-
} };
|
|
95201
|
-
}
|
|
95202
|
-
Object.defineProperty(o, k2, desc);
|
|
95203
|
-
}) : (function(o, m, k, k2) {
|
|
95204
|
-
if (k2 === void 0) k2 = k;
|
|
95205
|
-
o[k2] = m[k];
|
|
95206
|
-
}));
|
|
95207
|
-
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
95208
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
95209
|
-
}) : function(o, v) {
|
|
95210
|
-
o["default"] = v;
|
|
95211
|
-
});
|
|
95212
|
-
var __importStar = exports2 && exports2.__importStar || /* @__PURE__ */ (function() {
|
|
95213
|
-
var ownKeys = function(o) {
|
|
95214
|
-
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
95215
|
-
var ar = [];
|
|
95216
|
-
for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
|
|
95217
|
-
return ar;
|
|
95218
|
-
};
|
|
95219
|
-
return ownKeys(o);
|
|
95220
|
-
};
|
|
95221
|
-
return function(mod) {
|
|
95222
|
-
if (mod && mod.__esModule) return mod;
|
|
95223
|
-
var result = {};
|
|
95224
|
-
if (mod != null) {
|
|
95225
|
-
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
95226
|
-
}
|
|
95227
|
-
__setModuleDefault(result, mod);
|
|
95228
|
-
return result;
|
|
95229
|
-
};
|
|
95230
|
-
})();
|
|
95231
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
95232
|
-
exports2.buildSigningPayload = buildSigningPayload2;
|
|
95233
|
-
exports2.verifySignature = verifySignature2;
|
|
95234
|
-
var crypto6 = __importStar(require("crypto"));
|
|
95235
|
-
function buildSigningPayload2(artifact) {
|
|
95236
|
-
const fields = [
|
|
95237
|
-
"clef-sig-v3",
|
|
95238
|
-
String(artifact.version),
|
|
95239
|
-
artifact.identity,
|
|
95240
|
-
artifact.environment,
|
|
95241
|
-
artifact.revision,
|
|
95242
|
-
artifact.packedAt,
|
|
95243
|
-
artifact.ciphertextHash,
|
|
95244
|
-
artifact.expiresAt ?? "",
|
|
95245
|
-
artifact.envelope?.provider ?? "",
|
|
95246
|
-
artifact.envelope?.keyId ?? "",
|
|
95247
|
-
artifact.envelope?.wrappedKey ?? "",
|
|
95248
|
-
artifact.envelope?.algorithm ?? "",
|
|
95249
|
-
artifact.envelope?.iv ?? "",
|
|
95250
|
-
artifact.envelope?.authTag ?? ""
|
|
95251
|
-
];
|
|
95252
|
-
return Buffer.from(fields.join("\n"), "utf-8");
|
|
95253
|
-
}
|
|
95254
|
-
function verifySignature2(payload, signatureBase64, publicKeyBase64) {
|
|
95255
|
-
const keyObj = crypto6.createPublicKey({
|
|
95256
|
-
key: Buffer.from(publicKeyBase64, "base64"),
|
|
95257
|
-
format: "der",
|
|
95258
|
-
type: "spki"
|
|
95259
|
-
});
|
|
95260
|
-
const signature = Buffer.from(signatureBase64, "base64");
|
|
95261
|
-
const keyType = keyObj.asymmetricKeyType;
|
|
95262
|
-
if (keyType === "ed25519") {
|
|
95263
|
-
return crypto6.verify(null, payload, keyObj, signature);
|
|
95264
|
-
}
|
|
95265
|
-
if (keyType === "ec") {
|
|
95266
|
-
return crypto6.verify("sha256", payload, keyObj, signature);
|
|
95267
|
-
}
|
|
95268
|
-
throw new Error(`Unsupported key type for signature verification: ${keyType}`);
|
|
95269
|
-
}
|
|
94933
|
+
crypto7 = __toESM(require("crypto"));
|
|
95270
94934
|
}
|
|
95271
94935
|
});
|
|
95272
94936
|
|
|
95273
|
-
// ../runtime/
|
|
95274
|
-
|
|
95275
|
-
|
|
94937
|
+
// ../runtime/src/poller.ts
|
|
94938
|
+
function classifyValidationError(err) {
|
|
94939
|
+
if (err instanceof SyntaxError) return "json_parse";
|
|
94940
|
+
const msg = err instanceof Error ? err.message : "";
|
|
94941
|
+
if (msg.includes("Unsupported artifact version")) return "unsupported_version";
|
|
94942
|
+
if (msg.includes("missing required fields")) return "missing_fields";
|
|
94943
|
+
if (msg.includes("incomplete envelope")) return "incomplete_envelope";
|
|
94944
|
+
if (msg.includes("signature")) return "signature";
|
|
94945
|
+
return "unknown";
|
|
94946
|
+
}
|
|
94947
|
+
var crypto8, MIN_POLL_MS, ArtifactPoller;
|
|
94948
|
+
var init_poller = __esm({
|
|
94949
|
+
"../runtime/src/poller.ts"() {
|
|
95276
94950
|
"use strict";
|
|
95277
|
-
|
|
95278
|
-
|
|
95279
|
-
|
|
95280
|
-
|
|
95281
|
-
|
|
95282
|
-
return m[k];
|
|
95283
|
-
} };
|
|
95284
|
-
}
|
|
95285
|
-
Object.defineProperty(o, k2, desc);
|
|
95286
|
-
}) : (function(o, m, k, k2) {
|
|
95287
|
-
if (k2 === void 0) k2 = k;
|
|
95288
|
-
o[k2] = m[k];
|
|
95289
|
-
}));
|
|
95290
|
-
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
95291
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
95292
|
-
}) : function(o, v) {
|
|
95293
|
-
o["default"] = v;
|
|
95294
|
-
});
|
|
95295
|
-
var __importStar = exports2 && exports2.__importStar || /* @__PURE__ */ (function() {
|
|
95296
|
-
var ownKeys = function(o) {
|
|
95297
|
-
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
95298
|
-
var ar = [];
|
|
95299
|
-
for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
|
|
95300
|
-
return ar;
|
|
95301
|
-
};
|
|
95302
|
-
return ownKeys(o);
|
|
95303
|
-
};
|
|
95304
|
-
return function(mod) {
|
|
95305
|
-
if (mod && mod.__esModule) return mod;
|
|
95306
|
-
var result = {};
|
|
95307
|
-
if (mod != null) {
|
|
95308
|
-
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
95309
|
-
}
|
|
95310
|
-
__setModuleDefault(result, mod);
|
|
95311
|
-
return result;
|
|
95312
|
-
};
|
|
95313
|
-
})();
|
|
95314
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
95315
|
-
exports2.ArtifactPoller = void 0;
|
|
95316
|
-
var crypto6 = __importStar(require("crypto"));
|
|
95317
|
-
var artifact_decryptor_1 = require_artifact_decryptor();
|
|
95318
|
-
var signature_1 = require_signature();
|
|
95319
|
-
var MIN_POLL_MS = 5e3;
|
|
95320
|
-
var ArtifactPoller = class {
|
|
94951
|
+
crypto8 = __toESM(require("crypto"));
|
|
94952
|
+
init_artifact_decryptor();
|
|
94953
|
+
init_signature();
|
|
94954
|
+
MIN_POLL_MS = 5e3;
|
|
94955
|
+
ArtifactPoller = class {
|
|
95321
94956
|
timer = null;
|
|
95322
94957
|
lastContentHash = null;
|
|
95323
94958
|
lastRevision = null;
|
|
@@ -95329,7 +94964,7 @@ var require_poller = __commonJS({
|
|
|
95329
94964
|
constructor(options) {
|
|
95330
94965
|
this.options = options;
|
|
95331
94966
|
this.jitMode = !!options.encryptedStore;
|
|
95332
|
-
this.decryptor = new
|
|
94967
|
+
this.decryptor = new ArtifactDecryptor({
|
|
95333
94968
|
privateKey: options.privateKey,
|
|
95334
94969
|
telemetry: options.telemetry
|
|
95335
94970
|
});
|
|
@@ -95352,8 +94987,7 @@ var require_poller = __commonJS({
|
|
|
95352
94987
|
*/
|
|
95353
94988
|
async fetchAndDecrypt() {
|
|
95354
94989
|
const result = await this.fetchRaw();
|
|
95355
|
-
if (!result)
|
|
95356
|
-
return;
|
|
94990
|
+
if (!result) return;
|
|
95357
94991
|
await this.validateDecryptAndCache(result.artifact, result.contentHash);
|
|
95358
94992
|
}
|
|
95359
94993
|
/**
|
|
@@ -95363,8 +94997,7 @@ var require_poller = __commonJS({
|
|
|
95363
94997
|
*/
|
|
95364
94998
|
async fetchAndValidate() {
|
|
95365
94999
|
const result = await this.fetchRaw();
|
|
95366
|
-
if (!result)
|
|
95367
|
-
return;
|
|
95000
|
+
if (!result) return;
|
|
95368
95001
|
const artifact = this.validateArtifact(result.artifact);
|
|
95369
95002
|
this.options.encryptedStore.swap(artifact);
|
|
95370
95003
|
this.lastRevision = artifact.revision;
|
|
@@ -95389,8 +95022,7 @@ var require_poller = __commonJS({
|
|
|
95389
95022
|
const result = await this.options.source.fetch();
|
|
95390
95023
|
raw = result.raw;
|
|
95391
95024
|
contentHash = result.contentHash;
|
|
95392
|
-
if (contentHash && contentHash === this.lastContentHash)
|
|
95393
|
-
return null;
|
|
95025
|
+
if (contentHash && contentHash === this.lastContentHash) return null;
|
|
95394
95026
|
this.options.diskCache?.write(raw, contentHash);
|
|
95395
95027
|
} catch (err) {
|
|
95396
95028
|
this.telemetry?.fetchFailed({
|
|
@@ -95415,8 +95047,7 @@ var require_poller = __commonJS({
|
|
|
95415
95047
|
}
|
|
95416
95048
|
raw = cached3;
|
|
95417
95049
|
contentHash = this.options.diskCache.getCachedSha();
|
|
95418
|
-
if (contentHash && contentHash === this.lastContentHash)
|
|
95419
|
-
return null;
|
|
95050
|
+
if (contentHash && contentHash === this.lastContentHash) return null;
|
|
95420
95051
|
} else {
|
|
95421
95052
|
if (ttl !== void 0 && ttl > 0 && this.options.cache.isExpired(ttl)) {
|
|
95422
95053
|
this.options.cache.wipe();
|
|
@@ -95450,7 +95081,9 @@ var require_poller = __commonJS({
|
|
|
95450
95081
|
this.telemetry?.artifactRevoked({
|
|
95451
95082
|
revokedAt: String(parsed.revokedAt)
|
|
95452
95083
|
});
|
|
95453
|
-
throw new Error(
|
|
95084
|
+
throw new Error(
|
|
95085
|
+
`Artifact revoked: ${parsed.identity}/${parsed.environment} at ${parsed.revokedAt}`
|
|
95086
|
+
);
|
|
95454
95087
|
}
|
|
95455
95088
|
return { artifact: parsed, contentHash };
|
|
95456
95089
|
}
|
|
@@ -95478,11 +95111,12 @@ var require_poller = __commonJS({
|
|
|
95478
95111
|
this.telemetry?.artifactExpired({ expiresAt: artifact.expiresAt });
|
|
95479
95112
|
throw new Error(`Artifact expired at ${artifact.expiresAt}`);
|
|
95480
95113
|
}
|
|
95481
|
-
if (artifact.revision === this.lastRevision)
|
|
95482
|
-
|
|
95483
|
-
const hash = crypto6.createHash("sha256").update(artifact.ciphertext).digest("hex");
|
|
95114
|
+
if (artifact.revision === this.lastRevision) return artifact;
|
|
95115
|
+
const hash = crypto8.createHash("sha256").update(artifact.ciphertext).digest("hex");
|
|
95484
95116
|
if (hash !== artifact.ciphertextHash) {
|
|
95485
|
-
const err = new Error(
|
|
95117
|
+
const err = new Error(
|
|
95118
|
+
`Artifact integrity check failed: expected hash ${artifact.ciphertextHash}, got ${hash}`
|
|
95119
|
+
);
|
|
95486
95120
|
this.telemetry?.artifactInvalid({
|
|
95487
95121
|
reason: "integrity",
|
|
95488
95122
|
error: err.message
|
|
@@ -95491,19 +95125,23 @@ var require_poller = __commonJS({
|
|
|
95491
95125
|
}
|
|
95492
95126
|
if (this.options.verifyKey) {
|
|
95493
95127
|
if (!artifact.signature) {
|
|
95494
|
-
const err = new Error(
|
|
95128
|
+
const err = new Error(
|
|
95129
|
+
"Artifact signature verification failed: artifact is unsigned but a verify key is configured. Only signed artifacts are accepted when signature verification is enabled."
|
|
95130
|
+
);
|
|
95495
95131
|
this.telemetry?.artifactInvalid({
|
|
95496
95132
|
reason: "signature_missing",
|
|
95497
95133
|
error: err.message
|
|
95498
95134
|
});
|
|
95499
95135
|
throw err;
|
|
95500
95136
|
}
|
|
95501
|
-
const payload = (
|
|
95137
|
+
const payload = buildSigningPayload2(artifact);
|
|
95502
95138
|
let valid;
|
|
95503
95139
|
try {
|
|
95504
|
-
valid = (
|
|
95140
|
+
valid = verifySignature2(payload, artifact.signature, this.options.verifyKey);
|
|
95505
95141
|
} catch (sigErr) {
|
|
95506
|
-
const err = new Error(
|
|
95142
|
+
const err = new Error(
|
|
95143
|
+
`Artifact signature verification error: ${sigErr instanceof Error ? sigErr.message : String(sigErr)}`
|
|
95144
|
+
);
|
|
95507
95145
|
this.telemetry?.artifactInvalid({
|
|
95508
95146
|
reason: "signature_error",
|
|
95509
95147
|
error: err.message
|
|
@@ -95511,7 +95149,9 @@ var require_poller = __commonJS({
|
|
|
95511
95149
|
throw err;
|
|
95512
95150
|
}
|
|
95513
95151
|
if (!valid) {
|
|
95514
|
-
const err = new Error(
|
|
95152
|
+
const err = new Error(
|
|
95153
|
+
"Artifact signature verification failed: signature does not match the verify key. The artifact may have been tampered with or signed by a different key."
|
|
95154
|
+
);
|
|
95515
95155
|
this.telemetry?.artifactInvalid({
|
|
95516
95156
|
reason: "signature_invalid",
|
|
95517
95157
|
error: err.message
|
|
@@ -95526,8 +95166,7 @@ var require_poller = __commonJS({
|
|
|
95526
95166
|
*/
|
|
95527
95167
|
async validateDecryptAndCache(parsed, contentHash) {
|
|
95528
95168
|
const artifact = this.validateArtifact(parsed);
|
|
95529
|
-
if (artifact.revision === this.lastRevision)
|
|
95530
|
-
return;
|
|
95169
|
+
if (artifact.revision === this.lastRevision) return;
|
|
95531
95170
|
const { values } = await this.decryptor.decrypt(artifact);
|
|
95532
95171
|
const keys = Object.keys(values);
|
|
95533
95172
|
this.options.cache.swap(values, keys, artifact.revision);
|
|
@@ -95552,8 +95191,7 @@ var require_poller = __commonJS({
|
|
|
95552
95191
|
}
|
|
95553
95192
|
/** Start only the polling schedule (no initial fetch). */
|
|
95554
95193
|
startPolling() {
|
|
95555
|
-
if (this.timer)
|
|
95556
|
-
return;
|
|
95194
|
+
if (this.timer) return;
|
|
95557
95195
|
this.scheduleNext();
|
|
95558
95196
|
}
|
|
95559
95197
|
/** Stop the polling loop. */
|
|
@@ -95593,8 +95231,7 @@ var require_poller = __commonJS({
|
|
|
95593
95231
|
}
|
|
95594
95232
|
return MIN_POLL_MS;
|
|
95595
95233
|
}
|
|
95596
|
-
if (this.jitMode)
|
|
95597
|
-
return MIN_POLL_MS;
|
|
95234
|
+
if (this.jitMode) return MIN_POLL_MS;
|
|
95598
95235
|
const ttl = this.options.cacheTtl;
|
|
95599
95236
|
if (ttl !== void 0) {
|
|
95600
95237
|
return Math.max(ttl / 10 * 1e3, MIN_POLL_MS);
|
|
@@ -95616,31 +95253,15 @@ var require_poller = __commonJS({
|
|
|
95616
95253
|
return artifact;
|
|
95617
95254
|
}
|
|
95618
95255
|
};
|
|
95619
|
-
exports2.ArtifactPoller = ArtifactPoller;
|
|
95620
|
-
function classifyValidationError(err) {
|
|
95621
|
-
if (err instanceof SyntaxError)
|
|
95622
|
-
return "json_parse";
|
|
95623
|
-
const msg = err instanceof Error ? err.message : "";
|
|
95624
|
-
if (msg.includes("Unsupported artifact version"))
|
|
95625
|
-
return "unsupported_version";
|
|
95626
|
-
if (msg.includes("missing required fields"))
|
|
95627
|
-
return "missing_fields";
|
|
95628
|
-
if (msg.includes("incomplete envelope"))
|
|
95629
|
-
return "incomplete_envelope";
|
|
95630
|
-
if (msg.includes("signature"))
|
|
95631
|
-
return "signature";
|
|
95632
|
-
return "unknown";
|
|
95633
|
-
}
|
|
95634
95256
|
}
|
|
95635
95257
|
});
|
|
95636
95258
|
|
|
95637
|
-
// ../runtime/
|
|
95638
|
-
var
|
|
95639
|
-
|
|
95259
|
+
// ../runtime/src/encrypted-artifact-store.ts
|
|
95260
|
+
var EncryptedArtifactStore;
|
|
95261
|
+
var init_encrypted_artifact_store = __esm({
|
|
95262
|
+
"../runtime/src/encrypted-artifact-store.ts"() {
|
|
95640
95263
|
"use strict";
|
|
95641
|
-
|
|
95642
|
-
exports2.EncryptedArtifactStore = void 0;
|
|
95643
|
-
var EncryptedArtifactStore = class {
|
|
95264
|
+
EncryptedArtifactStore = class {
|
|
95644
95265
|
artifact = null;
|
|
95645
95266
|
_storedAt = null;
|
|
95646
95267
|
/** Atomically replace the stored artifact. */
|
|
@@ -95670,17 +95291,23 @@ var require_encrypted_artifact_store = __commonJS({
|
|
|
95670
95291
|
this._storedAt = null;
|
|
95671
95292
|
}
|
|
95672
95293
|
};
|
|
95673
|
-
exports2.EncryptedArtifactStore = EncryptedArtifactStore;
|
|
95674
95294
|
}
|
|
95675
95295
|
});
|
|
95676
95296
|
|
|
95677
|
-
// ../runtime/
|
|
95678
|
-
|
|
95679
|
-
"
|
|
95297
|
+
// ../runtime/src/telemetry.ts
|
|
95298
|
+
function otlpValue(v) {
|
|
95299
|
+
if (typeof v === "boolean") return { boolValue: v };
|
|
95300
|
+
if (typeof v === "number") return { intValue: String(v) };
|
|
95301
|
+
return { stringValue: String(v) };
|
|
95302
|
+
}
|
|
95303
|
+
function isoToUnixNano(iso) {
|
|
95304
|
+
return String(new Date(iso).getTime() * 1e6);
|
|
95305
|
+
}
|
|
95306
|
+
var SEVERITY, BASE_FIELDS, TelemetryEmitter;
|
|
95307
|
+
var init_telemetry = __esm({
|
|
95308
|
+
"../runtime/src/telemetry.ts"() {
|
|
95680
95309
|
"use strict";
|
|
95681
|
-
|
|
95682
|
-
exports2.TelemetryEmitter = void 0;
|
|
95683
|
-
var SEVERITY = {
|
|
95310
|
+
SEVERITY = {
|
|
95684
95311
|
"agent.started": { number: 9, text: "INFO" },
|
|
95685
95312
|
"agent.stopped": { number: 9, text: "INFO" },
|
|
95686
95313
|
"artifact.refreshed": { number: 9, text: "INFO" },
|
|
@@ -95690,7 +95317,7 @@ var require_telemetry = __commonJS({
|
|
|
95690
95317
|
"cache.expired": { number: 17, text: "ERROR" },
|
|
95691
95318
|
"artifact.invalid": { number: 17, text: "ERROR" }
|
|
95692
95319
|
};
|
|
95693
|
-
|
|
95320
|
+
BASE_FIELDS = /* @__PURE__ */ new Set([
|
|
95694
95321
|
"type",
|
|
95695
95322
|
"timestamp",
|
|
95696
95323
|
"agentId",
|
|
@@ -95698,17 +95325,7 @@ var require_telemetry = __commonJS({
|
|
|
95698
95325
|
"environment",
|
|
95699
95326
|
"sourceType"
|
|
95700
95327
|
]);
|
|
95701
|
-
|
|
95702
|
-
if (typeof v === "boolean")
|
|
95703
|
-
return { boolValue: v };
|
|
95704
|
-
if (typeof v === "number")
|
|
95705
|
-
return { intValue: String(v) };
|
|
95706
|
-
return { stringValue: String(v) };
|
|
95707
|
-
}
|
|
95708
|
-
function isoToUnixNano(iso) {
|
|
95709
|
-
return String(new Date(iso).getTime() * 1e6);
|
|
95710
|
-
}
|
|
95711
|
-
var TelemetryEmitter = class {
|
|
95328
|
+
TelemetryEmitter = class {
|
|
95712
95329
|
buffer = [];
|
|
95713
95330
|
timer = null;
|
|
95714
95331
|
opts;
|
|
@@ -95746,8 +95363,7 @@ var require_telemetry = __commonJS({
|
|
|
95746
95363
|
}
|
|
95747
95364
|
/** Fire-and-forget flush of the current buffer. */
|
|
95748
95365
|
flush() {
|
|
95749
|
-
if (this.buffer.length === 0)
|
|
95750
|
-
return;
|
|
95366
|
+
if (this.buffer.length === 0) return;
|
|
95751
95367
|
const batch = this.buffer;
|
|
95752
95368
|
this.buffer = [];
|
|
95753
95369
|
fetch(this.opts.url, {
|
|
@@ -95759,8 +95375,7 @@ var require_telemetry = __commonJS({
|
|
|
95759
95375
|
}
|
|
95760
95376
|
/** Awaitable flush for graceful shutdown. */
|
|
95761
95377
|
async flushAsync() {
|
|
95762
|
-
if (this.buffer.length === 0)
|
|
95763
|
-
return;
|
|
95378
|
+
if (this.buffer.length === 0) return;
|
|
95764
95379
|
const batch = this.buffer;
|
|
95765
95380
|
this.buffer = [];
|
|
95766
95381
|
try {
|
|
@@ -95822,8 +95437,7 @@ var require_telemetry = __commonJS({
|
|
|
95822
95437
|
{ key: "event.name", value: { stringValue: `clef.${event.type}` } }
|
|
95823
95438
|
];
|
|
95824
95439
|
for (const [key, val] of Object.entries(event)) {
|
|
95825
|
-
if (BASE_FIELDS.has(key))
|
|
95826
|
-
continue;
|
|
95440
|
+
if (BASE_FIELDS.has(key)) continue;
|
|
95827
95441
|
attributes.push({ key: `clef.${key}`, value: otlpValue(val) });
|
|
95828
95442
|
}
|
|
95829
95443
|
return {
|
|
@@ -95849,17 +95463,15 @@ var require_telemetry = __commonJS({
|
|
|
95849
95463
|
});
|
|
95850
95464
|
}
|
|
95851
95465
|
};
|
|
95852
|
-
exports2.TelemetryEmitter = TelemetryEmitter;
|
|
95853
95466
|
}
|
|
95854
95467
|
});
|
|
95855
95468
|
|
|
95856
|
-
// ../runtime/
|
|
95857
|
-
var
|
|
95858
|
-
|
|
95469
|
+
// ../runtime/src/vcs/github.ts
|
|
95470
|
+
var GitHubProvider;
|
|
95471
|
+
var init_github = __esm({
|
|
95472
|
+
"../runtime/src/vcs/github.ts"() {
|
|
95859
95473
|
"use strict";
|
|
95860
|
-
|
|
95861
|
-
exports2.GitHubProvider = void 0;
|
|
95862
|
-
var GitHubProvider = class {
|
|
95474
|
+
GitHubProvider = class {
|
|
95863
95475
|
repo;
|
|
95864
95476
|
token;
|
|
95865
95477
|
ref;
|
|
@@ -95870,10 +95482,9 @@ var require_github = __commonJS({
|
|
|
95870
95482
|
this.ref = config.ref;
|
|
95871
95483
|
this.apiUrl = config.apiUrl ?? "https://api.github.com";
|
|
95872
95484
|
}
|
|
95873
|
-
async fetchFile(
|
|
95874
|
-
const url = new URL(`/repos/${this.repo}/contents/${
|
|
95875
|
-
if (this.ref)
|
|
95876
|
-
url.searchParams.set("ref", this.ref);
|
|
95485
|
+
async fetchFile(path57) {
|
|
95486
|
+
const url = new URL(`/repos/${this.repo}/contents/${path57}`, this.apiUrl);
|
|
95487
|
+
if (this.ref) url.searchParams.set("ref", this.ref);
|
|
95877
95488
|
const res = await fetch(url.toString(), {
|
|
95878
95489
|
headers: {
|
|
95879
95490
|
Authorization: `Bearer ${this.token}`,
|
|
@@ -95881,24 +95492,22 @@ var require_github = __commonJS({
|
|
|
95881
95492
|
}
|
|
95882
95493
|
});
|
|
95883
95494
|
if (!res.ok) {
|
|
95884
|
-
throw new Error(`GitHub API error: ${res.status} fetching ${
|
|
95495
|
+
throw new Error(`GitHub API error: ${res.status} fetching ${path57} from ${this.repo}`);
|
|
95885
95496
|
}
|
|
95886
95497
|
const data = await res.json();
|
|
95887
95498
|
const content = Buffer.from(data.content, "base64").toString("utf-8");
|
|
95888
95499
|
return { content, sha: data.sha };
|
|
95889
95500
|
}
|
|
95890
95501
|
};
|
|
95891
|
-
exports2.GitHubProvider = GitHubProvider;
|
|
95892
95502
|
}
|
|
95893
95503
|
});
|
|
95894
95504
|
|
|
95895
|
-
// ../runtime/
|
|
95896
|
-
var
|
|
95897
|
-
|
|
95505
|
+
// ../runtime/src/vcs/gitlab.ts
|
|
95506
|
+
var GitLabProvider;
|
|
95507
|
+
var init_gitlab = __esm({
|
|
95508
|
+
"../runtime/src/vcs/gitlab.ts"() {
|
|
95898
95509
|
"use strict";
|
|
95899
|
-
|
|
95900
|
-
exports2.GitLabProvider = void 0;
|
|
95901
|
-
var GitLabProvider = class {
|
|
95510
|
+
GitLabProvider = class {
|
|
95902
95511
|
repo;
|
|
95903
95512
|
token;
|
|
95904
95513
|
ref;
|
|
@@ -95909,36 +95518,36 @@ var require_gitlab = __commonJS({
|
|
|
95909
95518
|
this.ref = config.ref;
|
|
95910
95519
|
this.apiUrl = config.apiUrl ?? "https://gitlab.com";
|
|
95911
95520
|
}
|
|
95912
|
-
async fetchFile(
|
|
95521
|
+
async fetchFile(path57) {
|
|
95913
95522
|
const encodedRepo = encodeURIComponent(this.repo);
|
|
95914
|
-
const encodedPath = encodeURIComponent(
|
|
95915
|
-
const url = new URL(
|
|
95916
|
-
|
|
95917
|
-
|
|
95523
|
+
const encodedPath = encodeURIComponent(path57);
|
|
95524
|
+
const url = new URL(
|
|
95525
|
+
`/api/v4/projects/${encodedRepo}/repository/files/${encodedPath}`,
|
|
95526
|
+
this.apiUrl
|
|
95527
|
+
);
|
|
95528
|
+
if (this.ref) url.searchParams.set("ref", this.ref);
|
|
95918
95529
|
const res = await fetch(url.toString(), {
|
|
95919
95530
|
headers: {
|
|
95920
95531
|
"PRIVATE-TOKEN": this.token
|
|
95921
95532
|
}
|
|
95922
95533
|
});
|
|
95923
95534
|
if (!res.ok) {
|
|
95924
|
-
throw new Error(`GitLab API error: ${res.status} fetching ${
|
|
95535
|
+
throw new Error(`GitLab API error: ${res.status} fetching ${path57} from ${this.repo}`);
|
|
95925
95536
|
}
|
|
95926
95537
|
const data = await res.json();
|
|
95927
95538
|
const content = Buffer.from(data.content, "base64").toString("utf-8");
|
|
95928
95539
|
return { content, sha: data.blob_id };
|
|
95929
95540
|
}
|
|
95930
95541
|
};
|
|
95931
|
-
exports2.GitLabProvider = GitLabProvider;
|
|
95932
95542
|
}
|
|
95933
95543
|
});
|
|
95934
95544
|
|
|
95935
|
-
// ../runtime/
|
|
95936
|
-
var
|
|
95937
|
-
|
|
95545
|
+
// ../runtime/src/vcs/bitbucket.ts
|
|
95546
|
+
var BitbucketProvider;
|
|
95547
|
+
var init_bitbucket = __esm({
|
|
95548
|
+
"../runtime/src/vcs/bitbucket.ts"() {
|
|
95938
95549
|
"use strict";
|
|
95939
|
-
|
|
95940
|
-
exports2.BitbucketProvider = void 0;
|
|
95941
|
-
var BitbucketProvider = class {
|
|
95550
|
+
BitbucketProvider = class {
|
|
95942
95551
|
repo;
|
|
95943
95552
|
token;
|
|
95944
95553
|
ref;
|
|
@@ -95949,8 +95558,8 @@ var require_bitbucket = __commonJS({
|
|
|
95949
95558
|
this.ref = config.ref ?? "main";
|
|
95950
95559
|
this.apiUrl = config.apiUrl ?? "https://api.bitbucket.org";
|
|
95951
95560
|
}
|
|
95952
|
-
async fetchFile(
|
|
95953
|
-
const baseUrl = `${this.apiUrl}/2.0/repositories/${this.repo}/src/${this.ref}/${
|
|
95561
|
+
async fetchFile(path57) {
|
|
95562
|
+
const baseUrl = `${this.apiUrl}/2.0/repositories/${this.repo}/src/${this.ref}/${path57}`;
|
|
95954
95563
|
const metaRes = await fetch(baseUrl, {
|
|
95955
95564
|
headers: {
|
|
95956
95565
|
Authorization: `Bearer ${this.token}`,
|
|
@@ -95958,7 +95567,7 @@ var require_bitbucket = __commonJS({
|
|
|
95958
95567
|
}
|
|
95959
95568
|
});
|
|
95960
95569
|
if (!metaRes.ok) {
|
|
95961
|
-
throw new Error(`Bitbucket API error: ${metaRes.status} fetching ${
|
|
95570
|
+
throw new Error(`Bitbucket API error: ${metaRes.status} fetching ${path57} from ${this.repo}`);
|
|
95962
95571
|
}
|
|
95963
95572
|
const meta = await metaRes.json();
|
|
95964
95573
|
const rawRes = await fetch(baseUrl, {
|
|
@@ -95967,60 +95576,48 @@ var require_bitbucket = __commonJS({
|
|
|
95967
95576
|
}
|
|
95968
95577
|
});
|
|
95969
95578
|
if (!rawRes.ok) {
|
|
95970
|
-
throw new Error(
|
|
95579
|
+
throw new Error(
|
|
95580
|
+
`Bitbucket API error: ${rawRes.status} fetching raw content of ${path57} from ${this.repo}`
|
|
95581
|
+
);
|
|
95971
95582
|
}
|
|
95972
95583
|
const content = await rawRes.text();
|
|
95973
95584
|
return { content, sha: meta.commit.hash };
|
|
95974
95585
|
}
|
|
95975
95586
|
};
|
|
95976
|
-
exports2.BitbucketProvider = BitbucketProvider;
|
|
95977
95587
|
}
|
|
95978
95588
|
});
|
|
95979
95589
|
|
|
95980
|
-
// ../runtime/
|
|
95981
|
-
|
|
95982
|
-
|
|
95590
|
+
// ../runtime/src/vcs/index.ts
|
|
95591
|
+
function createVcsProvider(config) {
|
|
95592
|
+
switch (config.provider) {
|
|
95593
|
+
case "github":
|
|
95594
|
+
return new GitHubProvider(config);
|
|
95595
|
+
case "gitlab":
|
|
95596
|
+
return new GitLabProvider(config);
|
|
95597
|
+
case "bitbucket":
|
|
95598
|
+
return new BitbucketProvider(config);
|
|
95599
|
+
default:
|
|
95600
|
+
throw new Error(`Unsupported VCS provider: ${config.provider}`);
|
|
95601
|
+
}
|
|
95602
|
+
}
|
|
95603
|
+
var init_vcs = __esm({
|
|
95604
|
+
"../runtime/src/vcs/index.ts"() {
|
|
95983
95605
|
"use strict";
|
|
95984
|
-
|
|
95985
|
-
|
|
95986
|
-
|
|
95987
|
-
|
|
95988
|
-
|
|
95989
|
-
|
|
95990
|
-
} });
|
|
95991
|
-
var gitlab_1 = require_gitlab();
|
|
95992
|
-
Object.defineProperty(exports2, "GitLabProvider", { enumerable: true, get: function() {
|
|
95993
|
-
return gitlab_1.GitLabProvider;
|
|
95994
|
-
} });
|
|
95995
|
-
var bitbucket_1 = require_bitbucket();
|
|
95996
|
-
Object.defineProperty(exports2, "BitbucketProvider", { enumerable: true, get: function() {
|
|
95997
|
-
return bitbucket_1.BitbucketProvider;
|
|
95998
|
-
} });
|
|
95999
|
-
var github_2 = require_github();
|
|
96000
|
-
var gitlab_2 = require_gitlab();
|
|
96001
|
-
var bitbucket_2 = require_bitbucket();
|
|
96002
|
-
function createVcsProvider(config) {
|
|
96003
|
-
switch (config.provider) {
|
|
96004
|
-
case "github":
|
|
96005
|
-
return new github_2.GitHubProvider(config);
|
|
96006
|
-
case "gitlab":
|
|
96007
|
-
return new gitlab_2.GitLabProvider(config);
|
|
96008
|
-
case "bitbucket":
|
|
96009
|
-
return new bitbucket_2.BitbucketProvider(config);
|
|
96010
|
-
default:
|
|
96011
|
-
throw new Error(`Unsupported VCS provider: ${config.provider}`);
|
|
96012
|
-
}
|
|
96013
|
-
}
|
|
95606
|
+
init_github();
|
|
95607
|
+
init_gitlab();
|
|
95608
|
+
init_bitbucket();
|
|
95609
|
+
init_github();
|
|
95610
|
+
init_gitlab();
|
|
95611
|
+
init_bitbucket();
|
|
96014
95612
|
}
|
|
96015
95613
|
});
|
|
96016
95614
|
|
|
96017
|
-
// ../runtime/
|
|
96018
|
-
var
|
|
96019
|
-
|
|
95615
|
+
// ../runtime/src/sources/http.ts
|
|
95616
|
+
var HttpArtifactSource;
|
|
95617
|
+
var init_http = __esm({
|
|
95618
|
+
"../runtime/src/sources/http.ts"() {
|
|
96020
95619
|
"use strict";
|
|
96021
|
-
|
|
96022
|
-
exports2.HttpArtifactSource = void 0;
|
|
96023
|
-
var HttpArtifactSource = class {
|
|
95620
|
+
HttpArtifactSource = class {
|
|
96024
95621
|
url;
|
|
96025
95622
|
constructor(url) {
|
|
96026
95623
|
this.url = url;
|
|
@@ -96028,7 +95625,9 @@ var require_http = __commonJS({
|
|
|
96028
95625
|
async fetch() {
|
|
96029
95626
|
const res = await fetch(this.url);
|
|
96030
95627
|
if (!res.ok) {
|
|
96031
|
-
throw new Error(
|
|
95628
|
+
throw new Error(
|
|
95629
|
+
`Failed to fetch artifact from ${this.describe()}: ${res.status} ${res.statusText}`
|
|
95630
|
+
);
|
|
96032
95631
|
}
|
|
96033
95632
|
const raw = await res.text();
|
|
96034
95633
|
const etag = res.headers.get("etag") ?? void 0;
|
|
@@ -96047,78 +95646,37 @@ var require_http = __commonJS({
|
|
|
96047
95646
|
}
|
|
96048
95647
|
}
|
|
96049
95648
|
};
|
|
96050
|
-
exports2.HttpArtifactSource = HttpArtifactSource;
|
|
96051
95649
|
}
|
|
96052
95650
|
});
|
|
96053
95651
|
|
|
96054
|
-
// ../runtime/
|
|
96055
|
-
var
|
|
96056
|
-
|
|
95652
|
+
// ../runtime/src/sources/file.ts
|
|
95653
|
+
var fs34, FileArtifactSource;
|
|
95654
|
+
var init_file = __esm({
|
|
95655
|
+
"../runtime/src/sources/file.ts"() {
|
|
96057
95656
|
"use strict";
|
|
96058
|
-
|
|
96059
|
-
|
|
96060
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
96061
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
96062
|
-
desc = { enumerable: true, get: function() {
|
|
96063
|
-
return m[k];
|
|
96064
|
-
} };
|
|
96065
|
-
}
|
|
96066
|
-
Object.defineProperty(o, k2, desc);
|
|
96067
|
-
}) : (function(o, m, k, k2) {
|
|
96068
|
-
if (k2 === void 0) k2 = k;
|
|
96069
|
-
o[k2] = m[k];
|
|
96070
|
-
}));
|
|
96071
|
-
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
96072
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
96073
|
-
}) : function(o, v) {
|
|
96074
|
-
o["default"] = v;
|
|
96075
|
-
});
|
|
96076
|
-
var __importStar = exports2 && exports2.__importStar || /* @__PURE__ */ (function() {
|
|
96077
|
-
var ownKeys = function(o) {
|
|
96078
|
-
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
96079
|
-
var ar = [];
|
|
96080
|
-
for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
|
|
96081
|
-
return ar;
|
|
96082
|
-
};
|
|
96083
|
-
return ownKeys(o);
|
|
96084
|
-
};
|
|
96085
|
-
return function(mod) {
|
|
96086
|
-
if (mod && mod.__esModule) return mod;
|
|
96087
|
-
var result = {};
|
|
96088
|
-
if (mod != null) {
|
|
96089
|
-
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
96090
|
-
}
|
|
96091
|
-
__setModuleDefault(result, mod);
|
|
96092
|
-
return result;
|
|
96093
|
-
};
|
|
96094
|
-
})();
|
|
96095
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
96096
|
-
exports2.FileArtifactSource = void 0;
|
|
96097
|
-
var fs35 = __importStar(require("fs"));
|
|
96098
|
-
var FileArtifactSource = class {
|
|
95657
|
+
fs34 = __toESM(require("fs"));
|
|
95658
|
+
FileArtifactSource = class {
|
|
96099
95659
|
path;
|
|
96100
95660
|
constructor(filePath) {
|
|
96101
95661
|
this.path = filePath;
|
|
96102
95662
|
}
|
|
96103
95663
|
async fetch() {
|
|
96104
|
-
const raw =
|
|
95664
|
+
const raw = fs34.readFileSync(this.path, "utf-8");
|
|
96105
95665
|
return { raw };
|
|
96106
95666
|
}
|
|
96107
95667
|
describe() {
|
|
96108
95668
|
return `file ${this.path}`;
|
|
96109
95669
|
}
|
|
96110
95670
|
};
|
|
96111
|
-
exports2.FileArtifactSource = FileArtifactSource;
|
|
96112
95671
|
}
|
|
96113
95672
|
});
|
|
96114
95673
|
|
|
96115
|
-
// ../runtime/
|
|
96116
|
-
var
|
|
96117
|
-
|
|
95674
|
+
// ../runtime/src/sources/vcs.ts
|
|
95675
|
+
var VcsArtifactSource;
|
|
95676
|
+
var init_vcs2 = __esm({
|
|
95677
|
+
"../runtime/src/sources/vcs.ts"() {
|
|
96118
95678
|
"use strict";
|
|
96119
|
-
|
|
96120
|
-
exports2.VcsArtifactSource = void 0;
|
|
96121
|
-
var VcsArtifactSource = class {
|
|
95679
|
+
VcsArtifactSource = class {
|
|
96122
95680
|
provider;
|
|
96123
95681
|
path;
|
|
96124
95682
|
identity;
|
|
@@ -96137,95 +95695,104 @@ var require_vcs2 = __commonJS({
|
|
|
96137
95695
|
return `VCS .clef/packed/${this.identity}/${this.environment}.age.json`;
|
|
96138
95696
|
}
|
|
96139
95697
|
};
|
|
96140
|
-
exports2.VcsArtifactSource = VcsArtifactSource;
|
|
96141
95698
|
}
|
|
96142
95699
|
});
|
|
96143
95700
|
|
|
96144
|
-
// ../runtime/
|
|
96145
|
-
|
|
96146
|
-
|
|
95701
|
+
// ../runtime/src/sources/s3.ts
|
|
95702
|
+
function isS3Url(url) {
|
|
95703
|
+
return parseS3UrlSafe(url) !== null;
|
|
95704
|
+
}
|
|
95705
|
+
function parseS3Url(url) {
|
|
95706
|
+
const loc = parseS3UrlSafe(url);
|
|
95707
|
+
if (!loc) throw new Error(`Not a valid S3 URL: ${url}`);
|
|
95708
|
+
return loc;
|
|
95709
|
+
}
|
|
95710
|
+
function parseS3UrlSafe(url) {
|
|
95711
|
+
let u;
|
|
95712
|
+
try {
|
|
95713
|
+
u = new URL(url);
|
|
95714
|
+
} catch {
|
|
95715
|
+
return null;
|
|
95716
|
+
}
|
|
95717
|
+
if (u.protocol !== "https:") return null;
|
|
95718
|
+
const host = u.hostname;
|
|
95719
|
+
const key = u.pathname.slice(1);
|
|
95720
|
+
if (!key) return null;
|
|
95721
|
+
const vhMatch = host.match(/^(.+)\.s3\.([a-z0-9-]+)\.amazonaws\.com$/) ?? host.match(/^(.+)\.s3\.amazonaws\.com$/);
|
|
95722
|
+
if (vhMatch) {
|
|
95723
|
+
return { bucket: vhMatch[1], key, region: vhMatch[2] || "us-east-1" };
|
|
95724
|
+
}
|
|
95725
|
+
const psMatch = host.match(/^s3\.([a-z0-9-]+)\.amazonaws\.com$/) ?? host.match(/^s3\.amazonaws\.com$/);
|
|
95726
|
+
if (psMatch) {
|
|
95727
|
+
const slashIdx = key.indexOf("/");
|
|
95728
|
+
if (slashIdx < 0) return null;
|
|
95729
|
+
return {
|
|
95730
|
+
bucket: key.slice(0, slashIdx),
|
|
95731
|
+
key: key.slice(slashIdx + 1),
|
|
95732
|
+
region: psMatch[1] || "us-east-1"
|
|
95733
|
+
};
|
|
95734
|
+
}
|
|
95735
|
+
return null;
|
|
95736
|
+
}
|
|
95737
|
+
function hmacSha256(key, data) {
|
|
95738
|
+
return crypto9.createHmac("sha256", key).update(data, "utf-8").digest();
|
|
95739
|
+
}
|
|
95740
|
+
function sha256Hex(data) {
|
|
95741
|
+
return crypto9.createHash("sha256").update(data, "utf-8").digest("hex");
|
|
95742
|
+
}
|
|
95743
|
+
function toAmzDate(date) {
|
|
95744
|
+
return date.toISOString().replace(/[-:]/g, "").replace(/\.\d{3}/, "");
|
|
95745
|
+
}
|
|
95746
|
+
function toDateStamp(date) {
|
|
95747
|
+
return toAmzDate(date).slice(0, 8);
|
|
95748
|
+
}
|
|
95749
|
+
function encodeS3Key(key) {
|
|
95750
|
+
return key.split("/").map((s) => encodeURIComponent(s)).join("/");
|
|
95751
|
+
}
|
|
95752
|
+
function signS3GetRequest(host, path57, region, creds, now) {
|
|
95753
|
+
const amzDate = toAmzDate(now);
|
|
95754
|
+
const dateStamp = toDateStamp(now);
|
|
95755
|
+
const service = "s3";
|
|
95756
|
+
const scope = `${dateStamp}/${region}/${service}/aws4_request`;
|
|
95757
|
+
const headers = {
|
|
95758
|
+
host,
|
|
95759
|
+
"x-amz-date": amzDate,
|
|
95760
|
+
"x-amz-content-sha256": "UNSIGNED-PAYLOAD"
|
|
95761
|
+
};
|
|
95762
|
+
if (creds.sessionToken) {
|
|
95763
|
+
headers["x-amz-security-token"] = creds.sessionToken;
|
|
95764
|
+
}
|
|
95765
|
+
const signedHeaderKeys = Object.keys(headers).sort();
|
|
95766
|
+
const signedHeaders = signedHeaderKeys.join(";");
|
|
95767
|
+
const canonicalHeaders = signedHeaderKeys.map((k) => `${k}:${headers[k]}
|
|
95768
|
+
`).join("");
|
|
95769
|
+
const canonicalRequest = [
|
|
95770
|
+
"GET",
|
|
95771
|
+
path57,
|
|
95772
|
+
"",
|
|
95773
|
+
// no query string
|
|
95774
|
+
canonicalHeaders,
|
|
95775
|
+
signedHeaders,
|
|
95776
|
+
"UNSIGNED-PAYLOAD"
|
|
95777
|
+
].join("\n");
|
|
95778
|
+
const stringToSign = ["AWS4-HMAC-SHA256", amzDate, scope, sha256Hex(canonicalRequest)].join("\n");
|
|
95779
|
+
const kDate = hmacSha256(`AWS4${creds.secretAccessKey}`, dateStamp);
|
|
95780
|
+
const kRegion = hmacSha256(kDate, region);
|
|
95781
|
+
const kService = hmacSha256(kRegion, service);
|
|
95782
|
+
const kSigning = hmacSha256(kService, "aws4_request");
|
|
95783
|
+
const signature = hmacSha256(kSigning, stringToSign).toString("hex");
|
|
95784
|
+
const authorization = `AWS4-HMAC-SHA256 Credential=${creds.accessKeyId}/${scope}, SignedHeaders=${signedHeaders}, Signature=${signature}`;
|
|
95785
|
+
return {
|
|
95786
|
+
...headers,
|
|
95787
|
+
Authorization: authorization
|
|
95788
|
+
};
|
|
95789
|
+
}
|
|
95790
|
+
var crypto9, S3ArtifactSource;
|
|
95791
|
+
var init_s3 = __esm({
|
|
95792
|
+
"../runtime/src/sources/s3.ts"() {
|
|
96147
95793
|
"use strict";
|
|
96148
|
-
|
|
96149
|
-
|
|
96150
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
96151
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
96152
|
-
desc = { enumerable: true, get: function() {
|
|
96153
|
-
return m[k];
|
|
96154
|
-
} };
|
|
96155
|
-
}
|
|
96156
|
-
Object.defineProperty(o, k2, desc);
|
|
96157
|
-
}) : (function(o, m, k, k2) {
|
|
96158
|
-
if (k2 === void 0) k2 = k;
|
|
96159
|
-
o[k2] = m[k];
|
|
96160
|
-
}));
|
|
96161
|
-
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
96162
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
96163
|
-
}) : function(o, v) {
|
|
96164
|
-
o["default"] = v;
|
|
96165
|
-
});
|
|
96166
|
-
var __importStar = exports2 && exports2.__importStar || /* @__PURE__ */ (function() {
|
|
96167
|
-
var ownKeys = function(o) {
|
|
96168
|
-
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
96169
|
-
var ar = [];
|
|
96170
|
-
for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
|
|
96171
|
-
return ar;
|
|
96172
|
-
};
|
|
96173
|
-
return ownKeys(o);
|
|
96174
|
-
};
|
|
96175
|
-
return function(mod) {
|
|
96176
|
-
if (mod && mod.__esModule) return mod;
|
|
96177
|
-
var result = {};
|
|
96178
|
-
if (mod != null) {
|
|
96179
|
-
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
96180
|
-
}
|
|
96181
|
-
__setModuleDefault(result, mod);
|
|
96182
|
-
return result;
|
|
96183
|
-
};
|
|
96184
|
-
})();
|
|
96185
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
96186
|
-
exports2.S3ArtifactSource = void 0;
|
|
96187
|
-
exports2.isS3Url = isS3Url;
|
|
96188
|
-
var crypto6 = __importStar(require("crypto"));
|
|
96189
|
-
function isS3Url(url) {
|
|
96190
|
-
return parseS3UrlSafe(url) !== null;
|
|
96191
|
-
}
|
|
96192
|
-
function parseS3Url(url) {
|
|
96193
|
-
const loc = parseS3UrlSafe(url);
|
|
96194
|
-
if (!loc)
|
|
96195
|
-
throw new Error(`Not a valid S3 URL: ${url}`);
|
|
96196
|
-
return loc;
|
|
96197
|
-
}
|
|
96198
|
-
function parseS3UrlSafe(url) {
|
|
96199
|
-
let u;
|
|
96200
|
-
try {
|
|
96201
|
-
u = new URL(url);
|
|
96202
|
-
} catch {
|
|
96203
|
-
return null;
|
|
96204
|
-
}
|
|
96205
|
-
if (u.protocol !== "https:")
|
|
96206
|
-
return null;
|
|
96207
|
-
const host = u.hostname;
|
|
96208
|
-
const key = u.pathname.slice(1);
|
|
96209
|
-
if (!key)
|
|
96210
|
-
return null;
|
|
96211
|
-
const vhMatch = host.match(/^(.+)\.s3\.([a-z0-9-]+)\.amazonaws\.com$/) ?? host.match(/^(.+)\.s3\.amazonaws\.com$/);
|
|
96212
|
-
if (vhMatch) {
|
|
96213
|
-
return { bucket: vhMatch[1], key, region: vhMatch[2] || "us-east-1" };
|
|
96214
|
-
}
|
|
96215
|
-
const psMatch = host.match(/^s3\.([a-z0-9-]+)\.amazonaws\.com$/) ?? host.match(/^s3\.amazonaws\.com$/);
|
|
96216
|
-
if (psMatch) {
|
|
96217
|
-
const slashIdx = key.indexOf("/");
|
|
96218
|
-
if (slashIdx < 0)
|
|
96219
|
-
return null;
|
|
96220
|
-
return {
|
|
96221
|
-
bucket: key.slice(0, slashIdx),
|
|
96222
|
-
key: key.slice(slashIdx + 1),
|
|
96223
|
-
region: psMatch[1] || "us-east-1"
|
|
96224
|
-
};
|
|
96225
|
-
}
|
|
96226
|
-
return null;
|
|
96227
|
-
}
|
|
96228
|
-
var S3ArtifactSource = class {
|
|
95794
|
+
crypto9 = __toESM(require("crypto"));
|
|
95795
|
+
S3ArtifactSource = class {
|
|
96229
95796
|
url;
|
|
96230
95797
|
location;
|
|
96231
95798
|
cachedCredentials = null;
|
|
@@ -96237,12 +95804,14 @@ var require_s3 = __commonJS({
|
|
|
96237
95804
|
const creds = await this.resolveCredentials();
|
|
96238
95805
|
const { bucket, key, region } = this.location;
|
|
96239
95806
|
const host = `${bucket}.s3.${region}.amazonaws.com`;
|
|
96240
|
-
const
|
|
95807
|
+
const path57 = `/${encodeS3Key(key)}`;
|
|
96241
95808
|
const now = /* @__PURE__ */ new Date();
|
|
96242
|
-
const headers = signS3GetRequest(host,
|
|
96243
|
-
const res = await globalThis.fetch(`https://${host}${
|
|
95809
|
+
const headers = signS3GetRequest(host, path57, region, creds, now);
|
|
95810
|
+
const res = await globalThis.fetch(`https://${host}${path57}`, { headers });
|
|
96244
95811
|
if (!res.ok) {
|
|
96245
|
-
throw new Error(
|
|
95812
|
+
throw new Error(
|
|
95813
|
+
`Failed to fetch artifact from ${this.describe()}: ${res.status} ${res.statusText}`
|
|
95814
|
+
);
|
|
96246
95815
|
}
|
|
96247
95816
|
const raw = await res.text();
|
|
96248
95817
|
const etag = res.headers.get("etag") ?? void 0;
|
|
@@ -96273,7 +95842,9 @@ var require_s3 = __commonJS({
|
|
|
96273
95842
|
sessionToken: process.env.AWS_SESSION_TOKEN
|
|
96274
95843
|
};
|
|
96275
95844
|
}
|
|
96276
|
-
throw new Error(
|
|
95845
|
+
throw new Error(
|
|
95846
|
+
"No AWS credentials found. Set AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY, or run in ECS/Fargate with a task role."
|
|
95847
|
+
);
|
|
96277
95848
|
}
|
|
96278
95849
|
async fetchEcsCredentials(endpoint) {
|
|
96279
95850
|
const headers = {};
|
|
@@ -96300,172 +95871,90 @@ var require_s3 = __commonJS({
|
|
|
96300
95871
|
return creds;
|
|
96301
95872
|
}
|
|
96302
95873
|
};
|
|
96303
|
-
exports2.S3ArtifactSource = S3ArtifactSource;
|
|
96304
|
-
function hmacSha256(key, data) {
|
|
96305
|
-
return crypto6.createHmac("sha256", key).update(data, "utf-8").digest();
|
|
96306
|
-
}
|
|
96307
|
-
function sha256Hex(data) {
|
|
96308
|
-
return crypto6.createHash("sha256").update(data, "utf-8").digest("hex");
|
|
96309
|
-
}
|
|
96310
|
-
function toAmzDate(date) {
|
|
96311
|
-
return date.toISOString().replace(/[-:]/g, "").replace(/\.\d{3}/, "");
|
|
96312
|
-
}
|
|
96313
|
-
function toDateStamp(date) {
|
|
96314
|
-
return toAmzDate(date).slice(0, 8);
|
|
96315
|
-
}
|
|
96316
|
-
function encodeS3Key(key) {
|
|
96317
|
-
return key.split("/").map((s) => encodeURIComponent(s)).join("/");
|
|
96318
|
-
}
|
|
96319
|
-
function signS3GetRequest(host, path56, region, creds, now) {
|
|
96320
|
-
const amzDate = toAmzDate(now);
|
|
96321
|
-
const dateStamp = toDateStamp(now);
|
|
96322
|
-
const service = "s3";
|
|
96323
|
-
const scope = `${dateStamp}/${region}/${service}/aws4_request`;
|
|
96324
|
-
const headers = {
|
|
96325
|
-
host,
|
|
96326
|
-
"x-amz-date": amzDate,
|
|
96327
|
-
"x-amz-content-sha256": "UNSIGNED-PAYLOAD"
|
|
96328
|
-
};
|
|
96329
|
-
if (creds.sessionToken) {
|
|
96330
|
-
headers["x-amz-security-token"] = creds.sessionToken;
|
|
96331
|
-
}
|
|
96332
|
-
const signedHeaderKeys = Object.keys(headers).sort();
|
|
96333
|
-
const signedHeaders = signedHeaderKeys.join(";");
|
|
96334
|
-
const canonicalHeaders = signedHeaderKeys.map((k) => `${k}:${headers[k]}
|
|
96335
|
-
`).join("");
|
|
96336
|
-
const canonicalRequest = [
|
|
96337
|
-
"GET",
|
|
96338
|
-
path56,
|
|
96339
|
-
"",
|
|
96340
|
-
// no query string
|
|
96341
|
-
canonicalHeaders,
|
|
96342
|
-
signedHeaders,
|
|
96343
|
-
"UNSIGNED-PAYLOAD"
|
|
96344
|
-
].join("\n");
|
|
96345
|
-
const stringToSign = ["AWS4-HMAC-SHA256", amzDate, scope, sha256Hex(canonicalRequest)].join("\n");
|
|
96346
|
-
const kDate = hmacSha256(`AWS4${creds.secretAccessKey}`, dateStamp);
|
|
96347
|
-
const kRegion = hmacSha256(kDate, region);
|
|
96348
|
-
const kService = hmacSha256(kRegion, service);
|
|
96349
|
-
const kSigning = hmacSha256(kService, "aws4_request");
|
|
96350
|
-
const signature = hmacSha256(kSigning, stringToSign).toString("hex");
|
|
96351
|
-
const authorization = `AWS4-HMAC-SHA256 Credential=${creds.accessKeyId}/${scope}, SignedHeaders=${signedHeaders}, Signature=${signature}`;
|
|
96352
|
-
return {
|
|
96353
|
-
...headers,
|
|
96354
|
-
Authorization: authorization
|
|
96355
|
-
};
|
|
96356
|
-
}
|
|
96357
95874
|
}
|
|
96358
95875
|
});
|
|
96359
95876
|
|
|
96360
|
-
// ../runtime/
|
|
96361
|
-
var
|
|
96362
|
-
|
|
95877
|
+
// ../runtime/src/index.ts
|
|
95878
|
+
var src_exports3 = {};
|
|
95879
|
+
__export(src_exports3, {
|
|
95880
|
+
AgeDecryptor: () => AgeDecryptor,
|
|
95881
|
+
ArtifactDecryptor: () => ArtifactDecryptor,
|
|
95882
|
+
ArtifactPoller: () => ArtifactPoller,
|
|
95883
|
+
AwsKmsProvider: () => AwsKmsProvider,
|
|
95884
|
+
BitbucketProvider: () => BitbucketProvider,
|
|
95885
|
+
ClefRuntime: () => ClefRuntime,
|
|
95886
|
+
DiskCache: () => DiskCache,
|
|
95887
|
+
EncryptedArtifactStore: () => EncryptedArtifactStore,
|
|
95888
|
+
FileArtifactSource: () => FileArtifactSource,
|
|
95889
|
+
GitHubProvider: () => GitHubProvider,
|
|
95890
|
+
GitLabProvider: () => GitLabProvider,
|
|
95891
|
+
HttpArtifactSource: () => HttpArtifactSource,
|
|
95892
|
+
S3ArtifactSource: () => S3ArtifactSource,
|
|
95893
|
+
SecretsCache: () => SecretsCache,
|
|
95894
|
+
TelemetryEmitter: () => TelemetryEmitter,
|
|
95895
|
+
VcsArtifactSource: () => VcsArtifactSource,
|
|
95896
|
+
buildSigningPayload: () => buildSigningPayload2,
|
|
95897
|
+
createKmsProvider: () => createKmsProvider,
|
|
95898
|
+
createVcsProvider: () => createVcsProvider,
|
|
95899
|
+
init: () => init,
|
|
95900
|
+
isS3Url: () => isS3Url,
|
|
95901
|
+
verifySignature: () => verifySignature2
|
|
95902
|
+
});
|
|
95903
|
+
async function init(config) {
|
|
95904
|
+
const runtime = new ClefRuntime(config);
|
|
95905
|
+
await runtime.start();
|
|
95906
|
+
return runtime;
|
|
95907
|
+
}
|
|
95908
|
+
var ClefRuntime;
|
|
95909
|
+
var init_src4 = __esm({
|
|
95910
|
+
"../runtime/src/index.ts"() {
|
|
96363
95911
|
"use strict";
|
|
96364
|
-
|
|
96365
|
-
|
|
96366
|
-
|
|
96367
|
-
|
|
96368
|
-
|
|
96369
|
-
|
|
96370
|
-
|
|
96371
|
-
|
|
96372
|
-
|
|
96373
|
-
|
|
96374
|
-
|
|
96375
|
-
|
|
96376
|
-
|
|
96377
|
-
|
|
96378
|
-
|
|
96379
|
-
|
|
96380
|
-
|
|
96381
|
-
|
|
96382
|
-
|
|
96383
|
-
|
|
96384
|
-
|
|
96385
|
-
|
|
96386
|
-
|
|
96387
|
-
|
|
96388
|
-
|
|
96389
|
-
|
|
96390
|
-
|
|
96391
|
-
|
|
96392
|
-
|
|
96393
|
-
return telemetry_1.TelemetryEmitter;
|
|
96394
|
-
} });
|
|
96395
|
-
var github_1 = require_github();
|
|
96396
|
-
Object.defineProperty(exports2, "GitHubProvider", { enumerable: true, get: function() {
|
|
96397
|
-
return github_1.GitHubProvider;
|
|
96398
|
-
} });
|
|
96399
|
-
var gitlab_1 = require_gitlab();
|
|
96400
|
-
Object.defineProperty(exports2, "GitLabProvider", { enumerable: true, get: function() {
|
|
96401
|
-
return gitlab_1.GitLabProvider;
|
|
96402
|
-
} });
|
|
96403
|
-
var bitbucket_1 = require_bitbucket();
|
|
96404
|
-
Object.defineProperty(exports2, "BitbucketProvider", { enumerable: true, get: function() {
|
|
96405
|
-
return bitbucket_1.BitbucketProvider;
|
|
96406
|
-
} });
|
|
96407
|
-
var index_1 = require_vcs();
|
|
96408
|
-
Object.defineProperty(exports2, "createVcsProvider", { enumerable: true, get: function() {
|
|
96409
|
-
return index_1.createVcsProvider;
|
|
96410
|
-
} });
|
|
96411
|
-
var kms_1 = require_kms2();
|
|
96412
|
-
Object.defineProperty(exports2, "AwsKmsProvider", { enumerable: true, get: function() {
|
|
96413
|
-
return kms_1.AwsKmsProvider;
|
|
96414
|
-
} });
|
|
96415
|
-
var kms_2 = require_kms2();
|
|
96416
|
-
Object.defineProperty(exports2, "createKmsProvider", { enumerable: true, get: function() {
|
|
96417
|
-
return kms_2.createKmsProvider;
|
|
96418
|
-
} });
|
|
96419
|
-
var http_1 = require_http();
|
|
96420
|
-
Object.defineProperty(exports2, "HttpArtifactSource", { enumerable: true, get: function() {
|
|
96421
|
-
return http_1.HttpArtifactSource;
|
|
96422
|
-
} });
|
|
96423
|
-
var file_1 = require_file();
|
|
96424
|
-
Object.defineProperty(exports2, "FileArtifactSource", { enumerable: true, get: function() {
|
|
96425
|
-
return file_1.FileArtifactSource;
|
|
96426
|
-
} });
|
|
96427
|
-
var vcs_1 = require_vcs2();
|
|
96428
|
-
Object.defineProperty(exports2, "VcsArtifactSource", { enumerable: true, get: function() {
|
|
96429
|
-
return vcs_1.VcsArtifactSource;
|
|
96430
|
-
} });
|
|
96431
|
-
var s3_1 = require_s3();
|
|
96432
|
-
Object.defineProperty(exports2, "S3ArtifactSource", { enumerable: true, get: function() {
|
|
96433
|
-
return s3_1.S3ArtifactSource;
|
|
96434
|
-
} });
|
|
96435
|
-
Object.defineProperty(exports2, "isS3Url", { enumerable: true, get: function() {
|
|
96436
|
-
return s3_1.isS3Url;
|
|
96437
|
-
} });
|
|
96438
|
-
var signature_1 = require_signature();
|
|
96439
|
-
Object.defineProperty(exports2, "buildSigningPayload", { enumerable: true, get: function() {
|
|
96440
|
-
return signature_1.buildSigningPayload;
|
|
96441
|
-
} });
|
|
96442
|
-
Object.defineProperty(exports2, "verifySignature", { enumerable: true, get: function() {
|
|
96443
|
-
return signature_1.verifySignature;
|
|
96444
|
-
} });
|
|
96445
|
-
var secrets_cache_2 = require_secrets_cache();
|
|
96446
|
-
var disk_cache_2 = require_disk_cache();
|
|
96447
|
-
var decrypt_2 = require_decrypt();
|
|
96448
|
-
var poller_2 = require_poller();
|
|
96449
|
-
var index_2 = require_vcs();
|
|
96450
|
-
var vcs_2 = require_vcs2();
|
|
96451
|
-
var http_2 = require_http();
|
|
96452
|
-
var file_2 = require_file();
|
|
96453
|
-
var s3_2 = require_s3();
|
|
96454
|
-
var ClefRuntime = class {
|
|
96455
|
-
cache = new secrets_cache_2.SecretsCache();
|
|
95912
|
+
init_secrets_cache();
|
|
95913
|
+
init_disk_cache();
|
|
95914
|
+
init_decrypt();
|
|
95915
|
+
init_poller();
|
|
95916
|
+
init_artifact_decryptor();
|
|
95917
|
+
init_encrypted_artifact_store();
|
|
95918
|
+
init_telemetry();
|
|
95919
|
+
init_github();
|
|
95920
|
+
init_gitlab();
|
|
95921
|
+
init_bitbucket();
|
|
95922
|
+
init_vcs();
|
|
95923
|
+
init_kms3();
|
|
95924
|
+
init_kms3();
|
|
95925
|
+
init_http();
|
|
95926
|
+
init_file();
|
|
95927
|
+
init_vcs2();
|
|
95928
|
+
init_s3();
|
|
95929
|
+
init_signature();
|
|
95930
|
+
init_secrets_cache();
|
|
95931
|
+
init_disk_cache();
|
|
95932
|
+
init_decrypt();
|
|
95933
|
+
init_poller();
|
|
95934
|
+
init_vcs();
|
|
95935
|
+
init_vcs2();
|
|
95936
|
+
init_http();
|
|
95937
|
+
init_file();
|
|
95938
|
+
init_s3();
|
|
95939
|
+
ClefRuntime = class {
|
|
95940
|
+
cache = new SecretsCache();
|
|
96456
95941
|
poller;
|
|
96457
95942
|
config;
|
|
96458
95943
|
constructor(config) {
|
|
96459
95944
|
this.config = config;
|
|
96460
95945
|
let privateKey;
|
|
96461
95946
|
try {
|
|
96462
|
-
const decryptor = new
|
|
95947
|
+
const decryptor = new AgeDecryptor();
|
|
96463
95948
|
privateKey = decryptor.resolveKey(config.ageKey, config.ageKeyFile);
|
|
96464
95949
|
} catch {
|
|
96465
95950
|
}
|
|
96466
95951
|
const source = this.resolveSource(config);
|
|
96467
|
-
const diskCache = config.cachePath ? new
|
|
96468
|
-
|
|
95952
|
+
const diskCache = config.cachePath ? new DiskCache(
|
|
95953
|
+
config.cachePath,
|
|
95954
|
+
config.identity ?? "default",
|
|
95955
|
+
config.environment ?? "default"
|
|
95956
|
+
) : void 0;
|
|
95957
|
+
this.poller = new ArtifactPoller({
|
|
96469
95958
|
source,
|
|
96470
95959
|
privateKey,
|
|
96471
95960
|
cache: this.cache,
|
|
@@ -96531,36 +96020,34 @@ var require_dist3 = __commonJS({
|
|
|
96531
96020
|
const missingVcs = Object.entries(vcsFields).filter(([, v]) => !v);
|
|
96532
96021
|
if (presentVcs.length > 0 && missingVcs.length > 0) {
|
|
96533
96022
|
const missing = missingVcs.map(([k]) => k).join(", ");
|
|
96534
|
-
throw new Error(
|
|
96023
|
+
throw new Error(
|
|
96024
|
+
`Partial VCS config detected. Missing: ${missing}. Provide all VCS fields (provider, repo, token, identity, environment) or use a source URL/path instead.`
|
|
96025
|
+
);
|
|
96535
96026
|
}
|
|
96536
96027
|
if (presentVcs.length === Object.keys(vcsFields).length) {
|
|
96537
|
-
const provider =
|
|
96028
|
+
const provider = createVcsProvider({
|
|
96538
96029
|
provider: config.provider,
|
|
96539
96030
|
repo: config.repo,
|
|
96540
96031
|
token: config.token,
|
|
96541
96032
|
ref: config.ref,
|
|
96542
96033
|
apiUrl: config.apiUrl
|
|
96543
96034
|
});
|
|
96544
|
-
return new
|
|
96035
|
+
return new VcsArtifactSource(provider, config.identity, config.environment);
|
|
96545
96036
|
}
|
|
96546
96037
|
if (config.source) {
|
|
96547
|
-
if (
|
|
96548
|
-
return new
|
|
96038
|
+
if (isS3Url(config.source)) {
|
|
96039
|
+
return new S3ArtifactSource(config.source);
|
|
96549
96040
|
}
|
|
96550
96041
|
if (config.source.startsWith("http://") || config.source.startsWith("https://")) {
|
|
96551
|
-
return new
|
|
96042
|
+
return new HttpArtifactSource(config.source);
|
|
96552
96043
|
}
|
|
96553
|
-
return new
|
|
96044
|
+
return new FileArtifactSource(config.source);
|
|
96554
96045
|
}
|
|
96555
|
-
throw new Error(
|
|
96046
|
+
throw new Error(
|
|
96047
|
+
"No artifact source configured. Provide VCS config (provider, repo, token, identity, environment) or a source URL/path."
|
|
96048
|
+
);
|
|
96556
96049
|
}
|
|
96557
96050
|
};
|
|
96558
|
-
exports2.ClefRuntime = ClefRuntime;
|
|
96559
|
-
async function init(config) {
|
|
96560
|
-
const runtime = new ClefRuntime(config);
|
|
96561
|
-
await runtime.start();
|
|
96562
|
-
return runtime;
|
|
96563
|
-
}
|
|
96564
96051
|
}
|
|
96565
96052
|
});
|
|
96566
96053
|
|
|
@@ -96996,12 +96483,12 @@ var require_lambda_extension = __commonJS({
|
|
|
96996
96483
|
});
|
|
96997
96484
|
|
|
96998
96485
|
// ../agent/dist/index.js
|
|
96999
|
-
var
|
|
96486
|
+
var require_dist3 = __commonJS({
|
|
97000
96487
|
"../agent/dist/index.js"(exports2) {
|
|
97001
96488
|
"use strict";
|
|
97002
96489
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
97003
96490
|
exports2.LambdaExtension = exports2.Daemon = exports2.readyHandler = exports2.healthHandler = exports2.ConfigError = exports2.resolveConfig = exports2.startAgentServer = exports2.TelemetryEmitter = exports2.init = exports2.ClefRuntime = exports2.ArtifactPoller = exports2.AgeDecryptor = exports2.SecretsCache = void 0;
|
|
97004
|
-
var runtime_1 =
|
|
96491
|
+
var runtime_1 = (init_src4(), __toCommonJS(src_exports3));
|
|
97005
96492
|
Object.defineProperty(exports2, "SecretsCache", { enumerable: true, get: function() {
|
|
97006
96493
|
return runtime_1.SecretsCache;
|
|
97007
96494
|
} });
|
|
@@ -97017,7 +96504,7 @@ var require_dist4 = __commonJS({
|
|
|
97017
96504
|
Object.defineProperty(exports2, "init", { enumerable: true, get: function() {
|
|
97018
96505
|
return runtime_1.init;
|
|
97019
96506
|
} });
|
|
97020
|
-
var runtime_2 =
|
|
96507
|
+
var runtime_2 = (init_src4(), __toCommonJS(src_exports3));
|
|
97021
96508
|
Object.defineProperty(exports2, "TelemetryEmitter", { enumerable: true, get: function() {
|
|
97022
96509
|
return runtime_2.TelemetryEmitter;
|
|
97023
96510
|
} });
|
|
@@ -97060,7 +96547,7 @@ function registerCloudCommands(program3, deps2) {
|
|
|
97060
96547
|
const parser = new ManifestParser();
|
|
97061
96548
|
let manifest;
|
|
97062
96549
|
try {
|
|
97063
|
-
manifest = parser.parse(
|
|
96550
|
+
manifest = parser.parse(path56.join(repoRoot, "clef.yaml"));
|
|
97064
96551
|
} catch {
|
|
97065
96552
|
formatter2.print(`${sym2("info")} No clef.yaml found in ${repoRoot}`);
|
|
97066
96553
|
return;
|
|
@@ -97108,7 +96595,7 @@ function registerCloudCommands(program3, deps2) {
|
|
|
97108
96595
|
try {
|
|
97109
96596
|
const repoRoot = program3.opts().dir || process.cwd();
|
|
97110
96597
|
const parser = new ManifestParser();
|
|
97111
|
-
const manifest = parser.parse(
|
|
96598
|
+
const manifest = parser.parse(path56.join(repoRoot, "clef.yaml"));
|
|
97112
96599
|
const targetEnv = manifest.environments.find((e) => e.name === opts.env);
|
|
97113
96600
|
if (!targetEnv) {
|
|
97114
96601
|
formatter2.error(
|
|
@@ -97151,7 +96638,7 @@ function registerCloudCommands(program3, deps2) {
|
|
|
97151
96638
|
} else {
|
|
97152
96639
|
formatter2.print(` Opening browser to set up Cloud for ${opts.env}...`);
|
|
97153
96640
|
const session = await initiateDeviceFlow2(cloudEndpoint, {
|
|
97154
|
-
repoName:
|
|
96641
|
+
repoName: path56.basename(repoRoot),
|
|
97155
96642
|
environment: opts.env,
|
|
97156
96643
|
clientVersion: deps2.cliVersion,
|
|
97157
96644
|
flow: "setup"
|
|
@@ -97218,14 +96705,14 @@ function registerCloudCommands(program3, deps2) {
|
|
|
97218
96705
|
cloudManifest,
|
|
97219
96706
|
cell.environment
|
|
97220
96707
|
);
|
|
97221
|
-
const relPath =
|
|
96708
|
+
const relPath = path56.relative(repoRoot, cell.filePath);
|
|
97222
96709
|
formatter2.print(` ${sym2("success")} ${relPath}`);
|
|
97223
96710
|
}
|
|
97224
96711
|
formatter2.print(`
|
|
97225
96712
|
Verifying encrypted files...`);
|
|
97226
96713
|
for (const cell of cells) {
|
|
97227
96714
|
await cloudSopsClient.decrypt(cell.filePath);
|
|
97228
|
-
const relPath =
|
|
96715
|
+
const relPath = path56.relative(repoRoot, cell.filePath);
|
|
97229
96716
|
formatter2.print(` ${sym2("success")} ${relPath}`);
|
|
97230
96717
|
}
|
|
97231
96718
|
} finally {
|
|
@@ -97260,7 +96747,7 @@ function registerCloudCommands(program3, deps2) {
|
|
|
97260
96747
|
const existingCreds = readCloudCredentials2();
|
|
97261
96748
|
const endpoint = existingCreds?.endpoint;
|
|
97262
96749
|
const session = await initiateDeviceFlow2(endpoint, {
|
|
97263
|
-
repoName:
|
|
96750
|
+
repoName: path56.basename(process.cwd()),
|
|
97264
96751
|
clientVersion: deps2.cliVersion,
|
|
97265
96752
|
flow: "login"
|
|
97266
96753
|
});
|
|
@@ -97313,11 +96800,11 @@ async function pollUntilComplete(pollUrl) {
|
|
|
97313
96800
|
await new Promise((resolve7) => setTimeout(resolve7, POLL_INTERVAL_MS));
|
|
97314
96801
|
}
|
|
97315
96802
|
}
|
|
97316
|
-
var
|
|
96803
|
+
var path56, POLL_INTERVAL_MS;
|
|
97317
96804
|
var init_cloud2 = __esm({
|
|
97318
96805
|
"../cloud/src/commands/cloud.ts"() {
|
|
97319
96806
|
"use strict";
|
|
97320
|
-
|
|
96807
|
+
path56 = __toESM(require("path"));
|
|
97321
96808
|
init_src();
|
|
97322
96809
|
init_src3();
|
|
97323
96810
|
POLL_INTERVAL_MS = 2e3;
|
|
@@ -99462,7 +98949,7 @@ async function fetchCheckpoint(config) {
|
|
|
99462
98949
|
}
|
|
99463
98950
|
|
|
99464
98951
|
// package.json
|
|
99465
|
-
var version2 = "0.1.
|
|
98952
|
+
var version2 = "0.1.14";
|
|
99466
98953
|
var package_default = {
|
|
99467
98954
|
name: "@clef-sh/cli",
|
|
99468
98955
|
version: version2,
|
|
@@ -100979,13 +100466,13 @@ ${sym("failure")} Re-encryption failed on ${path45.basename(failedFile)}`
|
|
|
100979
100466
|
).option("-e, --environment <env>", "Environment to grant access to (overrides request)").action(async (identifier, opts) => {
|
|
100980
100467
|
try {
|
|
100981
100468
|
const repoRoot = program3.opts().dir || process.cwd();
|
|
100982
|
-
const
|
|
100983
|
-
if (!
|
|
100469
|
+
const request2 = findRequest(repoRoot, identifier);
|
|
100470
|
+
if (!request2) {
|
|
100984
100471
|
formatter.error(`No pending request matching '${identifier}'.`);
|
|
100985
100472
|
process.exit(2);
|
|
100986
100473
|
return;
|
|
100987
100474
|
}
|
|
100988
|
-
const environment = opts.environment ??
|
|
100475
|
+
const environment = opts.environment ?? request2.environment;
|
|
100989
100476
|
if (!environment) {
|
|
100990
100477
|
formatter.error(
|
|
100991
100478
|
"An environment is required. The request did not specify one.\n Use -e to specify: clef recipients approve " + identifier + " -e <environment>"
|
|
@@ -100997,8 +100484,8 @@ ${sym("failure")} Re-encryption failed on ${path45.basename(failedFile)}`
|
|
|
100997
100484
|
repoRoot,
|
|
100998
100485
|
program3,
|
|
100999
100486
|
deps2,
|
|
101000
|
-
|
|
101001
|
-
|
|
100487
|
+
request2.key,
|
|
100488
|
+
request2.label,
|
|
101002
100489
|
environment
|
|
101003
100490
|
);
|
|
101004
100491
|
if (result) {
|
|
@@ -101007,13 +100494,13 @@ ${sym("failure")} Re-encryption failed on ${path45.basename(failedFile)}`
|
|
|
101007
100494
|
formatter.json({
|
|
101008
100495
|
action: "approved",
|
|
101009
100496
|
identifier,
|
|
101010
|
-
label:
|
|
100497
|
+
label: request2.label,
|
|
101011
100498
|
environment,
|
|
101012
100499
|
reEncryptedFiles: result.reEncryptedFiles.length
|
|
101013
100500
|
});
|
|
101014
100501
|
} else {
|
|
101015
100502
|
formatter.hint(
|
|
101016
|
-
`git add clef.yaml ${REQUESTS_FILENAME} && git add -A && git commit -m "approve recipient: ${
|
|
100503
|
+
`git add clef.yaml ${REQUESTS_FILENAME} && git add -A && git commit -m "approve recipient: ${request2.label} [${environment}]"`
|
|
101017
100504
|
);
|
|
101018
100505
|
}
|
|
101019
100506
|
}
|
|
@@ -101613,7 +101100,7 @@ function parseKmsEnvMappings(mappings) {
|
|
|
101613
101100
|
}
|
|
101614
101101
|
|
|
101615
101102
|
// src/commands/pack.ts
|
|
101616
|
-
var
|
|
101103
|
+
var path49 = __toESM(require("path"));
|
|
101617
101104
|
init_src();
|
|
101618
101105
|
function registerPackCommand(program3, deps2) {
|
|
101619
101106
|
program3.command("pack <identity> <environment>").description(
|
|
@@ -101641,7 +101128,7 @@ function registerPackCommand(program3, deps2) {
|
|
|
101641
101128
|
}
|
|
101642
101129
|
const repoRoot = program3.opts().dir || process.cwd();
|
|
101643
101130
|
const parser = new ManifestParser();
|
|
101644
|
-
const manifest = parser.parse(
|
|
101131
|
+
const manifest = parser.parse(path49.join(repoRoot, "clef.yaml"));
|
|
101645
101132
|
if (opts.remote) {
|
|
101646
101133
|
const { resolveAccessToken: resolveAccessToken2, CloudPackClient: CloudPackClient3 } = await Promise.resolve().then(() => (init_src3(), src_exports2));
|
|
101647
101134
|
const { accessToken: token, endpoint } = await resolveAccessToken2();
|
|
@@ -101664,13 +101151,13 @@ function registerPackCommand(program3, deps2) {
|
|
|
101664
101151
|
const si = manifest.service_identities?.find((s) => s.name === identity);
|
|
101665
101152
|
const envConfig = si?.environments[environment];
|
|
101666
101153
|
if (envConfig && isKmsEnvelope(envConfig)) {
|
|
101667
|
-
const { createKmsProvider } = await Promise.resolve().then(() =>
|
|
101668
|
-
kmsProvider = await
|
|
101154
|
+
const { createKmsProvider: createKmsProvider2 } = await Promise.resolve().then(() => (init_src4(), src_exports3));
|
|
101155
|
+
kmsProvider = await createKmsProvider2(envConfig.kms.provider, {
|
|
101669
101156
|
region: envConfig.kms.region
|
|
101670
101157
|
});
|
|
101671
101158
|
}
|
|
101672
101159
|
const packer = new ArtifactPacker(sopsClient, matrixManager, kmsProvider);
|
|
101673
|
-
const outputPath = opts.output ?
|
|
101160
|
+
const outputPath = opts.output ? path49.resolve(opts.output) : void 0;
|
|
101674
101161
|
const ttl = opts.ttl ? parseInt(opts.ttl, 10) : void 0;
|
|
101675
101162
|
if (ttl !== void 0 && (isNaN(ttl) || ttl < 1)) {
|
|
101676
101163
|
formatter.error("--ttl must be a positive integer (seconds).");
|
|
@@ -101752,8 +101239,8 @@ function registerPackCommand(program3, deps2) {
|
|
|
101752
101239
|
}
|
|
101753
101240
|
|
|
101754
101241
|
// src/commands/revoke.ts
|
|
101755
|
-
var
|
|
101756
|
-
var
|
|
101242
|
+
var fs35 = __toESM(require("fs"));
|
|
101243
|
+
var path50 = __toESM(require("path"));
|
|
101757
101244
|
init_src();
|
|
101758
101245
|
function registerRevokeCommand(program3, _deps) {
|
|
101759
101246
|
program3.command("revoke <identity> <environment>").description(
|
|
@@ -101762,7 +101249,7 @@ function registerRevokeCommand(program3, _deps) {
|
|
|
101762
101249
|
try {
|
|
101763
101250
|
const repoRoot = program3.opts().dir || process.cwd();
|
|
101764
101251
|
const parser = new ManifestParser();
|
|
101765
|
-
const manifest = parser.parse(
|
|
101252
|
+
const manifest = parser.parse(path50.join(repoRoot, "clef.yaml"));
|
|
101766
101253
|
const si = manifest.service_identities?.find((s) => s.name === identity);
|
|
101767
101254
|
if (!si) {
|
|
101768
101255
|
formatter.error(
|
|
@@ -101778,17 +101265,17 @@ function registerRevokeCommand(program3, _deps) {
|
|
|
101778
101265
|
process.exit(1);
|
|
101779
101266
|
return;
|
|
101780
101267
|
}
|
|
101781
|
-
const artifactDir =
|
|
101782
|
-
const artifactPath =
|
|
101268
|
+
const artifactDir = path50.join(repoRoot, ".clef", "packed", identity);
|
|
101269
|
+
const artifactPath = path50.join(artifactDir, `${environment}.age.json`);
|
|
101783
101270
|
const revoked = {
|
|
101784
101271
|
version: 1,
|
|
101785
101272
|
identity,
|
|
101786
101273
|
environment,
|
|
101787
101274
|
revokedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
101788
101275
|
};
|
|
101789
|
-
|
|
101790
|
-
|
|
101791
|
-
const relPath =
|
|
101276
|
+
fs35.mkdirSync(artifactDir, { recursive: true });
|
|
101277
|
+
fs35.writeFileSync(artifactPath, JSON.stringify(revoked, null, 2) + "\n", "utf-8");
|
|
101278
|
+
const relPath = path50.relative(repoRoot, artifactPath);
|
|
101792
101279
|
if (isJsonMode()) {
|
|
101793
101280
|
formatter.json({
|
|
101794
101281
|
identity,
|
|
@@ -101820,7 +101307,7 @@ function registerRevokeCommand(program3, _deps) {
|
|
|
101820
101307
|
}
|
|
101821
101308
|
|
|
101822
101309
|
// src/commands/drift.ts
|
|
101823
|
-
var
|
|
101310
|
+
var path51 = __toESM(require("path"));
|
|
101824
101311
|
var import_picocolors5 = __toESM(require_picocolors());
|
|
101825
101312
|
init_src();
|
|
101826
101313
|
function registerDriftCommand(program3, _deps) {
|
|
@@ -101829,7 +101316,7 @@ function registerDriftCommand(program3, _deps) {
|
|
|
101829
101316
|
).option("--push", "Push results as OTLP to CLEF_TELEMETRY_URL").option("--namespace <name...>", "Scope to specific namespace(s)").action(async (remotePath, options) => {
|
|
101830
101317
|
try {
|
|
101831
101318
|
const localRoot = program3.opts().dir || process.cwd();
|
|
101832
|
-
const remoteRoot =
|
|
101319
|
+
const remoteRoot = path51.resolve(localRoot, remotePath);
|
|
101833
101320
|
const detector = new DriftDetector();
|
|
101834
101321
|
const result = detector.detect(localRoot, remoteRoot, options.namespace);
|
|
101835
101322
|
if (options.push) {
|
|
@@ -101897,11 +101384,11 @@ init_src();
|
|
|
101897
101384
|
|
|
101898
101385
|
// src/report/historical.ts
|
|
101899
101386
|
var os7 = __toESM(require("os"));
|
|
101900
|
-
var
|
|
101901
|
-
var
|
|
101387
|
+
var path52 = __toESM(require("path"));
|
|
101388
|
+
var fs36 = __toESM(require("fs"));
|
|
101902
101389
|
init_src();
|
|
101903
101390
|
async function generateReportAtCommit(repoRoot, commitSha, clefVersion, runner2) {
|
|
101904
|
-
const tmpDir =
|
|
101391
|
+
const tmpDir = path52.join(os7.tmpdir(), `clef-report-${commitSha.slice(0, 8)}-${Date.now()}`);
|
|
101905
101392
|
try {
|
|
101906
101393
|
const addResult = await runner2.run("git", ["worktree", "add", tmpDir, commitSha, "--detach"], {
|
|
101907
101394
|
cwd: repoRoot
|
|
@@ -101919,7 +101406,7 @@ async function generateReportAtCommit(repoRoot, commitSha, clefVersion, runner2)
|
|
|
101919
101406
|
await runner2.run("git", ["worktree", "remove", tmpDir, "--force"], { cwd: repoRoot });
|
|
101920
101407
|
} catch {
|
|
101921
101408
|
try {
|
|
101922
|
-
|
|
101409
|
+
fs36.rmSync(tmpDir, { recursive: true, force: true });
|
|
101923
101410
|
await runner2.run("git", ["worktree", "prune"], { cwd: repoRoot });
|
|
101924
101411
|
} catch {
|
|
101925
101412
|
}
|
|
@@ -102140,8 +101627,8 @@ function formatReportOutput(report) {
|
|
|
102140
101627
|
}
|
|
102141
101628
|
|
|
102142
101629
|
// src/commands/install.ts
|
|
102143
|
-
var
|
|
102144
|
-
var
|
|
101630
|
+
var fs37 = __toESM(require("fs"));
|
|
101631
|
+
var path53 = __toESM(require("path"));
|
|
102145
101632
|
var import_yaml = __toESM(require_dist());
|
|
102146
101633
|
|
|
102147
101634
|
// src/registry/client.ts
|
|
@@ -102189,8 +101676,8 @@ function registerInstallCommand(program3, _deps) {
|
|
|
102189
101676
|
process.exit(1);
|
|
102190
101677
|
return;
|
|
102191
101678
|
}
|
|
102192
|
-
const brokerDir =
|
|
102193
|
-
if (
|
|
101679
|
+
const brokerDir = path53.join(repoRoot, "brokers", entry.name);
|
|
101680
|
+
if (fs37.existsSync(brokerDir) && !options.force) {
|
|
102194
101681
|
const overwrite = await formatter.confirm(
|
|
102195
101682
|
`brokers/${entry.name}/ already exists. Overwrite?`
|
|
102196
101683
|
);
|
|
@@ -102221,11 +101708,11 @@ function registerInstallCommand(program3, _deps) {
|
|
|
102221
101708
|
process.exit(1);
|
|
102222
101709
|
return;
|
|
102223
101710
|
}
|
|
102224
|
-
if (!
|
|
102225
|
-
|
|
101711
|
+
if (!fs37.existsSync(brokerDir)) {
|
|
101712
|
+
fs37.mkdirSync(brokerDir, { recursive: true });
|
|
102226
101713
|
}
|
|
102227
101714
|
for (const file of files) {
|
|
102228
|
-
|
|
101715
|
+
fs37.writeFileSync(path53.join(brokerDir, file.name), file.content, "utf-8");
|
|
102229
101716
|
}
|
|
102230
101717
|
const manifestFile = files.find((f2) => f2.name === "broker.yaml");
|
|
102231
101718
|
const manifest = manifestFile ? (0, import_yaml.parse)(manifestFile.content) : {};
|
|
@@ -102338,7 +101825,7 @@ function printBrokerTable(brokers) {
|
|
|
102338
101825
|
}
|
|
102339
101826
|
|
|
102340
101827
|
// src/commands/migrate-backend.ts
|
|
102341
|
-
var
|
|
101828
|
+
var path54 = __toESM(require("path"));
|
|
102342
101829
|
init_src();
|
|
102343
101830
|
function resolveTarget(opts) {
|
|
102344
101831
|
const provided = [];
|
|
@@ -102369,7 +101856,7 @@ function registerMigrateBackendCommand(program3, deps2) {
|
|
|
102369
101856
|
const repoRoot = program3.opts().dir || process.cwd();
|
|
102370
101857
|
const target = resolveTarget(opts);
|
|
102371
101858
|
const parser = new ManifestParser();
|
|
102372
|
-
const manifest = parser.parse(
|
|
101859
|
+
const manifest = parser.parse(path54.join(repoRoot, "clef.yaml"));
|
|
102373
101860
|
const matrixManager = new MatrixManager();
|
|
102374
101861
|
const impactedEnvs = opts.environment ? manifest.environments.filter((e) => e.name === opts.environment) : manifest.environments;
|
|
102375
101862
|
if (impactedEnvs.length === 0) {
|
|
@@ -102492,9 +101979,23 @@ ${sym("working")} Backend migration summary:`);
|
|
|
102492
101979
|
}
|
|
102493
101980
|
|
|
102494
101981
|
// src/commands/serve.ts
|
|
102495
|
-
var
|
|
101982
|
+
var path55 = __toESM(require("path"));
|
|
102496
101983
|
var import_crypto5 = require("crypto");
|
|
102497
101984
|
init_src();
|
|
101985
|
+
function synthesizeDevManifest(manifest, identityName, envName, ephemeralPublicKey) {
|
|
101986
|
+
return {
|
|
101987
|
+
...manifest,
|
|
101988
|
+
service_identities: manifest.service_identities?.map(
|
|
101989
|
+
(si) => si.name === identityName ? {
|
|
101990
|
+
...si,
|
|
101991
|
+
environments: {
|
|
101992
|
+
...si.environments,
|
|
101993
|
+
[envName]: { recipient: ephemeralPublicKey }
|
|
101994
|
+
}
|
|
101995
|
+
} : si
|
|
101996
|
+
)
|
|
101997
|
+
};
|
|
101998
|
+
}
|
|
102498
101999
|
function registerServeCommand(program3, deps2) {
|
|
102499
102000
|
program3.command("serve").description(
|
|
102500
102001
|
"Start a local secrets server for development.\n\n Packs and decrypts the specified service identity, then serves secrets\n at GET /v1/secrets \u2014 the same contract as the Clef agent and Cloud serve\n endpoint. Your app code works identically in local dev and production.\n\nUsage:\n clef serve --identity api-gateway --env dev\n clef serve --identity api-gateway --env dev --port 7779"
|
|
@@ -102502,7 +102003,7 @@ function registerServeCommand(program3, deps2) {
|
|
|
102502
102003
|
try {
|
|
102503
102004
|
const repoRoot = program3.opts().dir || process.cwd();
|
|
102504
102005
|
const parser = new ManifestParser();
|
|
102505
|
-
const manifest = parser.parse(
|
|
102006
|
+
const manifest = parser.parse(path55.join(repoRoot, "clef.yaml"));
|
|
102506
102007
|
const env = manifest.environments.find((e) => e.name === opts.env);
|
|
102507
102008
|
if (!env) {
|
|
102508
102009
|
formatter.error(`Environment '${opts.env}' not found in manifest.`);
|
|
@@ -102533,21 +102034,20 @@ function registerServeCommand(program3, deps2) {
|
|
|
102533
102034
|
return;
|
|
102534
102035
|
}
|
|
102535
102036
|
formatter.print(`${sym("working")} Packing '${opts.identity}/${opts.env}'...`);
|
|
102037
|
+
const ephemeral = await generateAgeIdentity();
|
|
102038
|
+
const devManifest = synthesizeDevManifest(
|
|
102039
|
+
manifest,
|
|
102040
|
+
opts.identity,
|
|
102041
|
+
opts.env,
|
|
102042
|
+
ephemeral.publicKey
|
|
102043
|
+
);
|
|
102536
102044
|
const sopsClient = await createSopsClient(repoRoot, deps2.runner);
|
|
102537
102045
|
const matrixManager = new MatrixManager();
|
|
102538
|
-
let kmsProvider;
|
|
102539
|
-
const envConfig = si.environments[opts.env];
|
|
102540
|
-
if (envConfig && isKmsEnvelope(envConfig)) {
|
|
102541
|
-
const { createKmsProvider } = await Promise.resolve().then(() => __toESM(require_dist3()));
|
|
102542
|
-
kmsProvider = await createKmsProvider(envConfig.kms.provider, {
|
|
102543
|
-
region: envConfig.kms.region
|
|
102544
|
-
});
|
|
102545
|
-
}
|
|
102546
102046
|
const memOutput = new MemoryPackOutput();
|
|
102547
|
-
const packer = new ArtifactPacker(sopsClient, matrixManager
|
|
102047
|
+
const packer = new ArtifactPacker(sopsClient, matrixManager);
|
|
102548
102048
|
const result = await packer.pack(
|
|
102549
102049
|
{ identity: opts.identity, environment: opts.env, output: memOutput },
|
|
102550
|
-
|
|
102050
|
+
devManifest,
|
|
102551
102051
|
repoRoot
|
|
102552
102052
|
);
|
|
102553
102053
|
if (!memOutput.artifact) {
|
|
@@ -102555,16 +102055,18 @@ function registerServeCommand(program3, deps2) {
|
|
|
102555
102055
|
process.exit(1);
|
|
102556
102056
|
return;
|
|
102557
102057
|
}
|
|
102558
|
-
const { ArtifactDecryptor } = await Promise.resolve().then(() =>
|
|
102559
|
-
const
|
|
102560
|
-
const decryptor = new ArtifactDecryptor({ privateKey: privateKey ?? void 0 });
|
|
102058
|
+
const { ArtifactDecryptor: ArtifactDecryptor2 } = await Promise.resolve().then(() => (init_src4(), src_exports3));
|
|
102059
|
+
const decryptor = new ArtifactDecryptor2({ privateKey: ephemeral.privateKey });
|
|
102561
102060
|
const decrypted = await decryptor.decrypt(memOutput.artifact);
|
|
102562
|
-
const { SecretsCache } = await Promise.resolve().then(() =>
|
|
102563
|
-
const cache = new
|
|
102061
|
+
const { SecretsCache: SecretsCache2 } = await Promise.resolve().then(() => (init_src4(), src_exports3));
|
|
102062
|
+
const cache = new SecretsCache2();
|
|
102564
102063
|
cache.swap(decrypted.values, decrypted.keys, decrypted.revision);
|
|
102565
102064
|
const token = (0, import_crypto5.randomBytes)(32).toString("hex");
|
|
102566
|
-
const { startAgentServer } = await Promise.resolve().then(() => __toESM(
|
|
102065
|
+
const { startAgentServer } = await Promise.resolve().then(() => __toESM(require_dist3()));
|
|
102567
102066
|
const server = await startAgentServer({ port, token, cache });
|
|
102067
|
+
formatter.warn(
|
|
102068
|
+
"DEVELOPMENT ONLY\n This server packs secrets locally with an ephemeral age key.\n Do NOT use this in production. For production, deploy the Clef\n agent with the service identity's actual private key or KMS access."
|
|
102069
|
+
);
|
|
102568
102070
|
formatter.success(`Serving ${result.keyCount} secrets for '${opts.identity}/${opts.env}'`);
|
|
102569
102071
|
formatter.print(`
|
|
102570
102072
|
URL: ${server.url}/v1/secrets`);
|
|
@@ -102584,6 +102086,7 @@ function registerServeCommand(program3, deps2) {
|
|
|
102584
102086
|
formatter.print(`
|
|
102585
102087
|
${sym("working")} Stopping server...`);
|
|
102586
102088
|
cache.wipe();
|
|
102089
|
+
ephemeral.privateKey = "";
|
|
102587
102090
|
await server.stop();
|
|
102588
102091
|
resolve7();
|
|
102589
102092
|
};
|