@clef-sh/cli 0.1.7-beta.43 → 0.1.7-beta.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -21
- package/dist/client/assets/{index-DDSYn57I.js → index-BzdNUhUA.js} +22 -10
- package/dist/client/index.html +1 -1
- package/dist/index.cjs +730 -443
- package/dist/index.cjs.map +4 -4
- package/dist/index.mjs +726 -439
- package/dist/index.mjs.map +4 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -966,8 +966,8 @@ var require_command = __commonJS({
|
|
|
966
966
|
"../../node_modules/commander/lib/command.js"(exports2) {
|
|
967
967
|
var EventEmitter = require("node:events").EventEmitter;
|
|
968
968
|
var childProcess = require("node:child_process");
|
|
969
|
-
var
|
|
970
|
-
var
|
|
969
|
+
var path44 = require("node:path");
|
|
970
|
+
var fs27 = require("node:fs");
|
|
971
971
|
var process2 = require("node:process");
|
|
972
972
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
973
973
|
var { CommanderError: CommanderError2 } = require_error();
|
|
@@ -1899,11 +1899,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1899
1899
|
let launchWithNode = false;
|
|
1900
1900
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1901
1901
|
function findFile(baseDir, baseName) {
|
|
1902
|
-
const localBin =
|
|
1903
|
-
if (
|
|
1904
|
-
if (sourceExt.includes(
|
|
1902
|
+
const localBin = path44.resolve(baseDir, baseName);
|
|
1903
|
+
if (fs27.existsSync(localBin)) return localBin;
|
|
1904
|
+
if (sourceExt.includes(path44.extname(baseName))) return void 0;
|
|
1905
1905
|
const foundExt = sourceExt.find(
|
|
1906
|
-
(ext) =>
|
|
1906
|
+
(ext) => fs27.existsSync(`${localBin}${ext}`)
|
|
1907
1907
|
);
|
|
1908
1908
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
1909
1909
|
return void 0;
|
|
@@ -1915,21 +1915,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1915
1915
|
if (this._scriptPath) {
|
|
1916
1916
|
let resolvedScriptPath;
|
|
1917
1917
|
try {
|
|
1918
|
-
resolvedScriptPath =
|
|
1918
|
+
resolvedScriptPath = fs27.realpathSync(this._scriptPath);
|
|
1919
1919
|
} catch (err) {
|
|
1920
1920
|
resolvedScriptPath = this._scriptPath;
|
|
1921
1921
|
}
|
|
1922
|
-
executableDir =
|
|
1923
|
-
|
|
1922
|
+
executableDir = path44.resolve(
|
|
1923
|
+
path44.dirname(resolvedScriptPath),
|
|
1924
1924
|
executableDir
|
|
1925
1925
|
);
|
|
1926
1926
|
}
|
|
1927
1927
|
if (executableDir) {
|
|
1928
1928
|
let localFile = findFile(executableDir, executableFile);
|
|
1929
1929
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
1930
|
-
const legacyName =
|
|
1930
|
+
const legacyName = path44.basename(
|
|
1931
1931
|
this._scriptPath,
|
|
1932
|
-
|
|
1932
|
+
path44.extname(this._scriptPath)
|
|
1933
1933
|
);
|
|
1934
1934
|
if (legacyName !== this._name) {
|
|
1935
1935
|
localFile = findFile(
|
|
@@ -1940,7 +1940,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1940
1940
|
}
|
|
1941
1941
|
executableFile = localFile || executableFile;
|
|
1942
1942
|
}
|
|
1943
|
-
launchWithNode = sourceExt.includes(
|
|
1943
|
+
launchWithNode = sourceExt.includes(path44.extname(executableFile));
|
|
1944
1944
|
let proc;
|
|
1945
1945
|
if (process2.platform !== "win32") {
|
|
1946
1946
|
if (launchWithNode) {
|
|
@@ -2780,7 +2780,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2780
2780
|
* @return {Command}
|
|
2781
2781
|
*/
|
|
2782
2782
|
nameFromFilename(filename) {
|
|
2783
|
-
this._name =
|
|
2783
|
+
this._name = path44.basename(filename, path44.extname(filename));
|
|
2784
2784
|
return this;
|
|
2785
2785
|
}
|
|
2786
2786
|
/**
|
|
@@ -2794,9 +2794,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2794
2794
|
* @param {string} [path]
|
|
2795
2795
|
* @return {(string|null|Command)}
|
|
2796
2796
|
*/
|
|
2797
|
-
executableDir(
|
|
2798
|
-
if (
|
|
2799
|
-
this._executableDir =
|
|
2797
|
+
executableDir(path45) {
|
|
2798
|
+
if (path45 === void 0) return this._executableDir;
|
|
2799
|
+
this._executableDir = path45;
|
|
2800
2800
|
return this;
|
|
2801
2801
|
}
|
|
2802
2802
|
/**
|
|
@@ -3103,17 +3103,17 @@ var require_visit = __commonJS({
|
|
|
3103
3103
|
visit.BREAK = BREAK;
|
|
3104
3104
|
visit.SKIP = SKIP;
|
|
3105
3105
|
visit.REMOVE = REMOVE;
|
|
3106
|
-
function visit_(key, node, visitor,
|
|
3107
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
3106
|
+
function visit_(key, node, visitor, path44) {
|
|
3107
|
+
const ctrl = callVisitor(key, node, visitor, path44);
|
|
3108
3108
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
3109
|
-
replaceNode(key,
|
|
3110
|
-
return visit_(key, ctrl, visitor,
|
|
3109
|
+
replaceNode(key, path44, ctrl);
|
|
3110
|
+
return visit_(key, ctrl, visitor, path44);
|
|
3111
3111
|
}
|
|
3112
3112
|
if (typeof ctrl !== "symbol") {
|
|
3113
3113
|
if (identity.isCollection(node)) {
|
|
3114
|
-
|
|
3114
|
+
path44 = Object.freeze(path44.concat(node));
|
|
3115
3115
|
for (let i = 0; i < node.items.length; ++i) {
|
|
3116
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
3116
|
+
const ci = visit_(i, node.items[i], visitor, path44);
|
|
3117
3117
|
if (typeof ci === "number")
|
|
3118
3118
|
i = ci - 1;
|
|
3119
3119
|
else if (ci === BREAK)
|
|
@@ -3124,13 +3124,13 @@ var require_visit = __commonJS({
|
|
|
3124
3124
|
}
|
|
3125
3125
|
}
|
|
3126
3126
|
} else if (identity.isPair(node)) {
|
|
3127
|
-
|
|
3128
|
-
const ck = visit_("key", node.key, visitor,
|
|
3127
|
+
path44 = Object.freeze(path44.concat(node));
|
|
3128
|
+
const ck = visit_("key", node.key, visitor, path44);
|
|
3129
3129
|
if (ck === BREAK)
|
|
3130
3130
|
return BREAK;
|
|
3131
3131
|
else if (ck === REMOVE)
|
|
3132
3132
|
node.key = null;
|
|
3133
|
-
const cv = visit_("value", node.value, visitor,
|
|
3133
|
+
const cv = visit_("value", node.value, visitor, path44);
|
|
3134
3134
|
if (cv === BREAK)
|
|
3135
3135
|
return BREAK;
|
|
3136
3136
|
else if (cv === REMOVE)
|
|
@@ -3151,17 +3151,17 @@ var require_visit = __commonJS({
|
|
|
3151
3151
|
visitAsync.BREAK = BREAK;
|
|
3152
3152
|
visitAsync.SKIP = SKIP;
|
|
3153
3153
|
visitAsync.REMOVE = REMOVE;
|
|
3154
|
-
async function visitAsync_(key, node, visitor,
|
|
3155
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
3154
|
+
async function visitAsync_(key, node, visitor, path44) {
|
|
3155
|
+
const ctrl = await callVisitor(key, node, visitor, path44);
|
|
3156
3156
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
3157
|
-
replaceNode(key,
|
|
3158
|
-
return visitAsync_(key, ctrl, visitor,
|
|
3157
|
+
replaceNode(key, path44, ctrl);
|
|
3158
|
+
return visitAsync_(key, ctrl, visitor, path44);
|
|
3159
3159
|
}
|
|
3160
3160
|
if (typeof ctrl !== "symbol") {
|
|
3161
3161
|
if (identity.isCollection(node)) {
|
|
3162
|
-
|
|
3162
|
+
path44 = Object.freeze(path44.concat(node));
|
|
3163
3163
|
for (let i = 0; i < node.items.length; ++i) {
|
|
3164
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
3164
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path44);
|
|
3165
3165
|
if (typeof ci === "number")
|
|
3166
3166
|
i = ci - 1;
|
|
3167
3167
|
else if (ci === BREAK)
|
|
@@ -3172,13 +3172,13 @@ var require_visit = __commonJS({
|
|
|
3172
3172
|
}
|
|
3173
3173
|
}
|
|
3174
3174
|
} else if (identity.isPair(node)) {
|
|
3175
|
-
|
|
3176
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
3175
|
+
path44 = Object.freeze(path44.concat(node));
|
|
3176
|
+
const ck = await visitAsync_("key", node.key, visitor, path44);
|
|
3177
3177
|
if (ck === BREAK)
|
|
3178
3178
|
return BREAK;
|
|
3179
3179
|
else if (ck === REMOVE)
|
|
3180
3180
|
node.key = null;
|
|
3181
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
3181
|
+
const cv = await visitAsync_("value", node.value, visitor, path44);
|
|
3182
3182
|
if (cv === BREAK)
|
|
3183
3183
|
return BREAK;
|
|
3184
3184
|
else if (cv === REMOVE)
|
|
@@ -3205,23 +3205,23 @@ var require_visit = __commonJS({
|
|
|
3205
3205
|
}
|
|
3206
3206
|
return visitor;
|
|
3207
3207
|
}
|
|
3208
|
-
function callVisitor(key, node, visitor,
|
|
3208
|
+
function callVisitor(key, node, visitor, path44) {
|
|
3209
3209
|
if (typeof visitor === "function")
|
|
3210
|
-
return visitor(key, node,
|
|
3210
|
+
return visitor(key, node, path44);
|
|
3211
3211
|
if (identity.isMap(node))
|
|
3212
|
-
return visitor.Map?.(key, node,
|
|
3212
|
+
return visitor.Map?.(key, node, path44);
|
|
3213
3213
|
if (identity.isSeq(node))
|
|
3214
|
-
return visitor.Seq?.(key, node,
|
|
3214
|
+
return visitor.Seq?.(key, node, path44);
|
|
3215
3215
|
if (identity.isPair(node))
|
|
3216
|
-
return visitor.Pair?.(key, node,
|
|
3216
|
+
return visitor.Pair?.(key, node, path44);
|
|
3217
3217
|
if (identity.isScalar(node))
|
|
3218
|
-
return visitor.Scalar?.(key, node,
|
|
3218
|
+
return visitor.Scalar?.(key, node, path44);
|
|
3219
3219
|
if (identity.isAlias(node))
|
|
3220
|
-
return visitor.Alias?.(key, node,
|
|
3220
|
+
return visitor.Alias?.(key, node, path44);
|
|
3221
3221
|
return void 0;
|
|
3222
3222
|
}
|
|
3223
|
-
function replaceNode(key,
|
|
3224
|
-
const parent =
|
|
3223
|
+
function replaceNode(key, path44, node) {
|
|
3224
|
+
const parent = path44[path44.length - 1];
|
|
3225
3225
|
if (identity.isCollection(parent)) {
|
|
3226
3226
|
parent.items[key] = node;
|
|
3227
3227
|
} else if (identity.isPair(parent)) {
|
|
@@ -3829,10 +3829,10 @@ var require_Collection = __commonJS({
|
|
|
3829
3829
|
var createNode = require_createNode();
|
|
3830
3830
|
var identity = require_identity();
|
|
3831
3831
|
var Node = require_Node();
|
|
3832
|
-
function collectionFromPath(schema,
|
|
3832
|
+
function collectionFromPath(schema, path44, value) {
|
|
3833
3833
|
let v = value;
|
|
3834
|
-
for (let i =
|
|
3835
|
-
const k =
|
|
3834
|
+
for (let i = path44.length - 1; i >= 0; --i) {
|
|
3835
|
+
const k = path44[i];
|
|
3836
3836
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
3837
3837
|
const a = [];
|
|
3838
3838
|
a[k] = v;
|
|
@@ -3851,7 +3851,7 @@ var require_Collection = __commonJS({
|
|
|
3851
3851
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
3852
3852
|
});
|
|
3853
3853
|
}
|
|
3854
|
-
var isEmptyPath = (
|
|
3854
|
+
var isEmptyPath = (path44) => path44 == null || typeof path44 === "object" && !!path44[Symbol.iterator]().next().done;
|
|
3855
3855
|
var Collection = class extends Node.NodeBase {
|
|
3856
3856
|
constructor(type, schema) {
|
|
3857
3857
|
super(type);
|
|
@@ -3881,11 +3881,11 @@ var require_Collection = __commonJS({
|
|
|
3881
3881
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
3882
3882
|
* that already exists in the map.
|
|
3883
3883
|
*/
|
|
3884
|
-
addIn(
|
|
3885
|
-
if (isEmptyPath(
|
|
3884
|
+
addIn(path44, value) {
|
|
3885
|
+
if (isEmptyPath(path44))
|
|
3886
3886
|
this.add(value);
|
|
3887
3887
|
else {
|
|
3888
|
-
const [key, ...rest] =
|
|
3888
|
+
const [key, ...rest] = path44;
|
|
3889
3889
|
const node = this.get(key, true);
|
|
3890
3890
|
if (identity.isCollection(node))
|
|
3891
3891
|
node.addIn(rest, value);
|
|
@@ -3899,8 +3899,8 @@ var require_Collection = __commonJS({
|
|
|
3899
3899
|
* Removes a value from the collection.
|
|
3900
3900
|
* @returns `true` if the item was found and removed.
|
|
3901
3901
|
*/
|
|
3902
|
-
deleteIn(
|
|
3903
|
-
const [key, ...rest] =
|
|
3902
|
+
deleteIn(path44) {
|
|
3903
|
+
const [key, ...rest] = path44;
|
|
3904
3904
|
if (rest.length === 0)
|
|
3905
3905
|
return this.delete(key);
|
|
3906
3906
|
const node = this.get(key, true);
|
|
@@ -3914,8 +3914,8 @@ var require_Collection = __commonJS({
|
|
|
3914
3914
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
3915
3915
|
* `true` (collections are always returned intact).
|
|
3916
3916
|
*/
|
|
3917
|
-
getIn(
|
|
3918
|
-
const [key, ...rest] =
|
|
3917
|
+
getIn(path44, keepScalar) {
|
|
3918
|
+
const [key, ...rest] = path44;
|
|
3919
3919
|
const node = this.get(key, true);
|
|
3920
3920
|
if (rest.length === 0)
|
|
3921
3921
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -3933,8 +3933,8 @@ var require_Collection = __commonJS({
|
|
|
3933
3933
|
/**
|
|
3934
3934
|
* Checks if the collection includes a value with the key `key`.
|
|
3935
3935
|
*/
|
|
3936
|
-
hasIn(
|
|
3937
|
-
const [key, ...rest] =
|
|
3936
|
+
hasIn(path44) {
|
|
3937
|
+
const [key, ...rest] = path44;
|
|
3938
3938
|
if (rest.length === 0)
|
|
3939
3939
|
return this.has(key);
|
|
3940
3940
|
const node = this.get(key, true);
|
|
@@ -3944,8 +3944,8 @@ var require_Collection = __commonJS({
|
|
|
3944
3944
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
3945
3945
|
* boolean to add/remove the item from the set.
|
|
3946
3946
|
*/
|
|
3947
|
-
setIn(
|
|
3948
|
-
const [key, ...rest] =
|
|
3947
|
+
setIn(path44, value) {
|
|
3948
|
+
const [key, ...rest] = path44;
|
|
3949
3949
|
if (rest.length === 0) {
|
|
3950
3950
|
this.set(key, value);
|
|
3951
3951
|
} else {
|
|
@@ -6449,9 +6449,9 @@ var require_Document = __commonJS({
|
|
|
6449
6449
|
this.contents.add(value);
|
|
6450
6450
|
}
|
|
6451
6451
|
/** Adds a value to the document. */
|
|
6452
|
-
addIn(
|
|
6452
|
+
addIn(path44, value) {
|
|
6453
6453
|
if (assertCollection(this.contents))
|
|
6454
|
-
this.contents.addIn(
|
|
6454
|
+
this.contents.addIn(path44, value);
|
|
6455
6455
|
}
|
|
6456
6456
|
/**
|
|
6457
6457
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -6526,14 +6526,14 @@ var require_Document = __commonJS({
|
|
|
6526
6526
|
* Removes a value from the document.
|
|
6527
6527
|
* @returns `true` if the item was found and removed.
|
|
6528
6528
|
*/
|
|
6529
|
-
deleteIn(
|
|
6530
|
-
if (Collection.isEmptyPath(
|
|
6529
|
+
deleteIn(path44) {
|
|
6530
|
+
if (Collection.isEmptyPath(path44)) {
|
|
6531
6531
|
if (this.contents == null)
|
|
6532
6532
|
return false;
|
|
6533
6533
|
this.contents = null;
|
|
6534
6534
|
return true;
|
|
6535
6535
|
}
|
|
6536
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
6536
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path44) : false;
|
|
6537
6537
|
}
|
|
6538
6538
|
/**
|
|
6539
6539
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -6548,10 +6548,10 @@ var require_Document = __commonJS({
|
|
|
6548
6548
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
6549
6549
|
* `true` (collections are always returned intact).
|
|
6550
6550
|
*/
|
|
6551
|
-
getIn(
|
|
6552
|
-
if (Collection.isEmptyPath(
|
|
6551
|
+
getIn(path44, keepScalar) {
|
|
6552
|
+
if (Collection.isEmptyPath(path44))
|
|
6553
6553
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
6554
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
6554
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path44, keepScalar) : void 0;
|
|
6555
6555
|
}
|
|
6556
6556
|
/**
|
|
6557
6557
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -6562,10 +6562,10 @@ var require_Document = __commonJS({
|
|
|
6562
6562
|
/**
|
|
6563
6563
|
* Checks if the document includes a value at `path`.
|
|
6564
6564
|
*/
|
|
6565
|
-
hasIn(
|
|
6566
|
-
if (Collection.isEmptyPath(
|
|
6565
|
+
hasIn(path44) {
|
|
6566
|
+
if (Collection.isEmptyPath(path44))
|
|
6567
6567
|
return this.contents !== void 0;
|
|
6568
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
6568
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path44) : false;
|
|
6569
6569
|
}
|
|
6570
6570
|
/**
|
|
6571
6571
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -6582,13 +6582,13 @@ var require_Document = __commonJS({
|
|
|
6582
6582
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
6583
6583
|
* boolean to add/remove the item from the set.
|
|
6584
6584
|
*/
|
|
6585
|
-
setIn(
|
|
6586
|
-
if (Collection.isEmptyPath(
|
|
6585
|
+
setIn(path44, value) {
|
|
6586
|
+
if (Collection.isEmptyPath(path44)) {
|
|
6587
6587
|
this.contents = value;
|
|
6588
6588
|
} else if (this.contents == null) {
|
|
6589
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
6589
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path44), value);
|
|
6590
6590
|
} else if (assertCollection(this.contents)) {
|
|
6591
|
-
this.contents.setIn(
|
|
6591
|
+
this.contents.setIn(path44, value);
|
|
6592
6592
|
}
|
|
6593
6593
|
}
|
|
6594
6594
|
/**
|
|
@@ -8540,9 +8540,9 @@ var require_cst_visit = __commonJS({
|
|
|
8540
8540
|
visit.BREAK = BREAK;
|
|
8541
8541
|
visit.SKIP = SKIP;
|
|
8542
8542
|
visit.REMOVE = REMOVE;
|
|
8543
|
-
visit.itemAtPath = (cst,
|
|
8543
|
+
visit.itemAtPath = (cst, path44) => {
|
|
8544
8544
|
let item = cst;
|
|
8545
|
-
for (const [field, index] of
|
|
8545
|
+
for (const [field, index] of path44) {
|
|
8546
8546
|
const tok = item?.[field];
|
|
8547
8547
|
if (tok && "items" in tok) {
|
|
8548
8548
|
item = tok.items[index];
|
|
@@ -8551,23 +8551,23 @@ var require_cst_visit = __commonJS({
|
|
|
8551
8551
|
}
|
|
8552
8552
|
return item;
|
|
8553
8553
|
};
|
|
8554
|
-
visit.parentCollection = (cst,
|
|
8555
|
-
const parent = visit.itemAtPath(cst,
|
|
8556
|
-
const field =
|
|
8554
|
+
visit.parentCollection = (cst, path44) => {
|
|
8555
|
+
const parent = visit.itemAtPath(cst, path44.slice(0, -1));
|
|
8556
|
+
const field = path44[path44.length - 1][0];
|
|
8557
8557
|
const coll = parent?.[field];
|
|
8558
8558
|
if (coll && "items" in coll)
|
|
8559
8559
|
return coll;
|
|
8560
8560
|
throw new Error("Parent collection not found");
|
|
8561
8561
|
};
|
|
8562
|
-
function _visit(
|
|
8563
|
-
let ctrl = visitor(item,
|
|
8562
|
+
function _visit(path44, item, visitor) {
|
|
8563
|
+
let ctrl = visitor(item, path44);
|
|
8564
8564
|
if (typeof ctrl === "symbol")
|
|
8565
8565
|
return ctrl;
|
|
8566
8566
|
for (const field of ["key", "value"]) {
|
|
8567
8567
|
const token = item[field];
|
|
8568
8568
|
if (token && "items" in token) {
|
|
8569
8569
|
for (let i = 0; i < token.items.length; ++i) {
|
|
8570
|
-
const ci = _visit(Object.freeze(
|
|
8570
|
+
const ci = _visit(Object.freeze(path44.concat([[field, i]])), token.items[i], visitor);
|
|
8571
8571
|
if (typeof ci === "number")
|
|
8572
8572
|
i = ci - 1;
|
|
8573
8573
|
else if (ci === BREAK)
|
|
@@ -8578,10 +8578,10 @@ var require_cst_visit = __commonJS({
|
|
|
8578
8578
|
}
|
|
8579
8579
|
}
|
|
8580
8580
|
if (typeof ctrl === "function" && field === "key")
|
|
8581
|
-
ctrl = ctrl(item,
|
|
8581
|
+
ctrl = ctrl(item, path44);
|
|
8582
8582
|
}
|
|
8583
8583
|
}
|
|
8584
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
8584
|
+
return typeof ctrl === "function" ? ctrl(item, path44) : ctrl;
|
|
8585
8585
|
}
|
|
8586
8586
|
exports2.visit = visit;
|
|
8587
8587
|
}
|
|
@@ -9866,14 +9866,14 @@ var require_parser = __commonJS({
|
|
|
9866
9866
|
case "scalar":
|
|
9867
9867
|
case "single-quoted-scalar":
|
|
9868
9868
|
case "double-quoted-scalar": {
|
|
9869
|
-
const
|
|
9869
|
+
const fs27 = this.flowScalar(this.type);
|
|
9870
9870
|
if (atNextItem || it.value) {
|
|
9871
|
-
map.items.push({ start, key:
|
|
9871
|
+
map.items.push({ start, key: fs27, sep: [] });
|
|
9872
9872
|
this.onKeyLine = true;
|
|
9873
9873
|
} else if (it.sep) {
|
|
9874
|
-
this.stack.push(
|
|
9874
|
+
this.stack.push(fs27);
|
|
9875
9875
|
} else {
|
|
9876
|
-
Object.assign(it, { key:
|
|
9876
|
+
Object.assign(it, { key: fs27, sep: [] });
|
|
9877
9877
|
this.onKeyLine = true;
|
|
9878
9878
|
}
|
|
9879
9879
|
return;
|
|
@@ -10001,13 +10001,13 @@ var require_parser = __commonJS({
|
|
|
10001
10001
|
case "scalar":
|
|
10002
10002
|
case "single-quoted-scalar":
|
|
10003
10003
|
case "double-quoted-scalar": {
|
|
10004
|
-
const
|
|
10004
|
+
const fs27 = this.flowScalar(this.type);
|
|
10005
10005
|
if (!it || it.value)
|
|
10006
|
-
fc.items.push({ start: [], key:
|
|
10006
|
+
fc.items.push({ start: [], key: fs27, sep: [] });
|
|
10007
10007
|
else if (it.sep)
|
|
10008
|
-
this.stack.push(
|
|
10008
|
+
this.stack.push(fs27);
|
|
10009
10009
|
else
|
|
10010
|
-
Object.assign(it, { key:
|
|
10010
|
+
Object.assign(it, { key: fs27, sep: [] });
|
|
10011
10011
|
return;
|
|
10012
10012
|
}
|
|
10013
10013
|
case "flow-map-end":
|
|
@@ -10215,7 +10215,7 @@ var require_public_api = __commonJS({
|
|
|
10215
10215
|
}
|
|
10216
10216
|
return doc;
|
|
10217
10217
|
}
|
|
10218
|
-
function
|
|
10218
|
+
function parse16(src, reviver, options) {
|
|
10219
10219
|
let _reviver = void 0;
|
|
10220
10220
|
if (typeof reviver === "function") {
|
|
10221
10221
|
_reviver = reviver;
|
|
@@ -10256,7 +10256,7 @@ var require_public_api = __commonJS({
|
|
|
10256
10256
|
return value.toString(options);
|
|
10257
10257
|
return new Document.Document(value, _replacer, options).toString(options);
|
|
10258
10258
|
}
|
|
10259
|
-
exports2.parse =
|
|
10259
|
+
exports2.parse = parse16;
|
|
10260
10260
|
exports2.parseAllDocuments = parseAllDocuments;
|
|
10261
10261
|
exports2.parseDocument = parseDocument;
|
|
10262
10262
|
exports2.stringify = stringify7;
|
|
@@ -11452,12 +11452,13 @@ var init_metadata = __esm({
|
|
|
11452
11452
|
});
|
|
11453
11453
|
|
|
11454
11454
|
// ../core/src/matrix/manager.ts
|
|
11455
|
-
var fs5, path4, MatrixManager;
|
|
11455
|
+
var fs5, path4, YAML3, MatrixManager;
|
|
11456
11456
|
var init_manager = __esm({
|
|
11457
11457
|
"../core/src/matrix/manager.ts"() {
|
|
11458
11458
|
"use strict";
|
|
11459
11459
|
fs5 = __toESM(require("fs"));
|
|
11460
11460
|
path4 = __toESM(require("path"));
|
|
11461
|
+
YAML3 = __toESM(require_dist());
|
|
11461
11462
|
init_metadata();
|
|
11462
11463
|
MatrixManager = class {
|
|
11463
11464
|
/**
|
|
@@ -11513,9 +11514,15 @@ var init_manager = __esm({
|
|
|
11513
11514
|
* @param repoRoot - Absolute path to the repository root.
|
|
11514
11515
|
* @param sopsClient - SOPS client used to decrypt each cell.
|
|
11515
11516
|
*/
|
|
11516
|
-
async getMatrixStatus(manifest, repoRoot,
|
|
11517
|
+
async getMatrixStatus(manifest, repoRoot, _sopsClient) {
|
|
11517
11518
|
const cells = this.resolveMatrix(manifest, repoRoot);
|
|
11518
11519
|
const statuses = [];
|
|
11520
|
+
const cellKeys = /* @__PURE__ */ new Map();
|
|
11521
|
+
for (const cell of cells) {
|
|
11522
|
+
if (cell.exists) {
|
|
11523
|
+
cellKeys.set(cell.filePath, this.readKeyNames(cell.filePath));
|
|
11524
|
+
}
|
|
11525
|
+
}
|
|
11519
11526
|
for (const cell of cells) {
|
|
11520
11527
|
if (!cell.exists) {
|
|
11521
11528
|
statuses.push({
|
|
@@ -11538,48 +11545,56 @@ var init_manager = __esm({
|
|
|
11538
11545
|
pendingCount = pending.length;
|
|
11539
11546
|
} catch {
|
|
11540
11547
|
}
|
|
11541
|
-
|
|
11542
|
-
|
|
11543
|
-
|
|
11544
|
-
|
|
11545
|
-
|
|
11546
|
-
|
|
11547
|
-
|
|
11548
|
-
|
|
11549
|
-
|
|
11550
|
-
|
|
11551
|
-
|
|
11552
|
-
|
|
11553
|
-
|
|
11554
|
-
|
|
11555
|
-
|
|
11556
|
-
|
|
11557
|
-
type: "missing_keys",
|
|
11558
|
-
message: `Key '${mk}' exists in ${sibling.environment} but is missing here.`,
|
|
11559
|
-
key: mk
|
|
11560
|
-
});
|
|
11561
|
-
}
|
|
11562
|
-
} catch {
|
|
11563
|
-
}
|
|
11548
|
+
const keys = cellKeys.get(cell.filePath) ?? [];
|
|
11549
|
+
const keyCount = keys.length;
|
|
11550
|
+
const lastModified = this.readLastModified(cell.filePath);
|
|
11551
|
+
const issues = [];
|
|
11552
|
+
const siblingCells = cells.filter(
|
|
11553
|
+
(c) => c.namespace === cell.namespace && c.environment !== cell.environment && c.exists
|
|
11554
|
+
);
|
|
11555
|
+
for (const sibling of siblingCells) {
|
|
11556
|
+
const siblingKeys = cellKeys.get(sibling.filePath) ?? [];
|
|
11557
|
+
const missingKeys = siblingKeys.filter((k) => !keys.includes(k));
|
|
11558
|
+
for (const mk of missingKeys) {
|
|
11559
|
+
issues.push({
|
|
11560
|
+
type: "missing_keys",
|
|
11561
|
+
message: `Key '${mk}' exists in ${sibling.environment} but is missing here.`,
|
|
11562
|
+
key: mk
|
|
11563
|
+
});
|
|
11564
11564
|
}
|
|
11565
|
-
statuses.push({ cell, keyCount, pendingCount, lastModified, issues });
|
|
11566
|
-
} catch {
|
|
11567
|
-
statuses.push({
|
|
11568
|
-
cell,
|
|
11569
|
-
keyCount: 0,
|
|
11570
|
-
pendingCount: 0,
|
|
11571
|
-
lastModified: null,
|
|
11572
|
-
issues: [
|
|
11573
|
-
{
|
|
11574
|
-
type: "sops_error",
|
|
11575
|
-
message: `Could not decrypt '${cell.filePath}'. Check your key configuration.`
|
|
11576
|
-
}
|
|
11577
|
-
]
|
|
11578
|
-
});
|
|
11579
11565
|
}
|
|
11566
|
+
statuses.push({ cell, keyCount, pendingCount, lastModified, issues });
|
|
11580
11567
|
}
|
|
11581
11568
|
return statuses;
|
|
11582
11569
|
}
|
|
11570
|
+
/**
|
|
11571
|
+
* Read top-level key names from a SOPS file without decryption.
|
|
11572
|
+
* SOPS stores key names in plaintext — only values are encrypted.
|
|
11573
|
+
*/
|
|
11574
|
+
readKeyNames(filePath) {
|
|
11575
|
+
try {
|
|
11576
|
+
const raw = fs5.readFileSync(filePath, "utf-8");
|
|
11577
|
+
const parsed = YAML3.parse(raw);
|
|
11578
|
+
if (!parsed || typeof parsed !== "object") return [];
|
|
11579
|
+
return Object.keys(parsed).filter((k) => k !== "sops");
|
|
11580
|
+
} catch {
|
|
11581
|
+
return [];
|
|
11582
|
+
}
|
|
11583
|
+
}
|
|
11584
|
+
/**
|
|
11585
|
+
* Read the lastModified timestamp from SOPS metadata without decryption.
|
|
11586
|
+
*/
|
|
11587
|
+
readLastModified(filePath) {
|
|
11588
|
+
try {
|
|
11589
|
+
const raw = fs5.readFileSync(filePath, "utf-8");
|
|
11590
|
+
const parsed = YAML3.parse(raw);
|
|
11591
|
+
const sops = parsed?.sops;
|
|
11592
|
+
if (sops?.lastmodified) return new Date(String(sops.lastmodified));
|
|
11593
|
+
return null;
|
|
11594
|
+
} catch {
|
|
11595
|
+
return null;
|
|
11596
|
+
}
|
|
11597
|
+
}
|
|
11583
11598
|
/**
|
|
11584
11599
|
* Check whether an environment has the `protected` flag set in the manifest.
|
|
11585
11600
|
*
|
|
@@ -11595,12 +11610,12 @@ var init_manager = __esm({
|
|
|
11595
11610
|
});
|
|
11596
11611
|
|
|
11597
11612
|
// ../core/src/schema/validator.ts
|
|
11598
|
-
var fs6,
|
|
11613
|
+
var fs6, YAML4, SchemaValidator;
|
|
11599
11614
|
var init_validator2 = __esm({
|
|
11600
11615
|
"../core/src/schema/validator.ts"() {
|
|
11601
11616
|
"use strict";
|
|
11602
11617
|
fs6 = __toESM(require("fs"));
|
|
11603
|
-
|
|
11618
|
+
YAML4 = __toESM(require_dist());
|
|
11604
11619
|
init_types();
|
|
11605
11620
|
SchemaValidator = class {
|
|
11606
11621
|
/**
|
|
@@ -11619,7 +11634,7 @@ var init_validator2 = __esm({
|
|
|
11619
11634
|
}
|
|
11620
11635
|
let parsed;
|
|
11621
11636
|
try {
|
|
11622
|
-
parsed =
|
|
11637
|
+
parsed = YAML4.parse(raw);
|
|
11623
11638
|
} catch {
|
|
11624
11639
|
throw new SchemaLoadError(`Schema file '${filePath}' contains invalid YAML.`, filePath);
|
|
11625
11640
|
}
|
|
@@ -12951,7 +12966,7 @@ var require_age_encryption = __commonJS({
|
|
|
12951
12966
|
};
|
|
12952
12967
|
}
|
|
12953
12968
|
// @__NO_SIDE_EFFECTS__
|
|
12954
|
-
function
|
|
12969
|
+
function join39(separator = "") {
|
|
12955
12970
|
astr("join", separator);
|
|
12956
12971
|
return {
|
|
12957
12972
|
encode: (from) => {
|
|
@@ -13081,9 +13096,9 @@ var require_age_encryption = __commonJS({
|
|
|
13081
13096
|
decode(s) {
|
|
13082
13097
|
return decodeBase64Builtin(s, false);
|
|
13083
13098
|
}
|
|
13084
|
-
} : /* @__PURE__ */ chain(/* @__PURE__ */ radix2(6), /* @__PURE__ */ alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), /* @__PURE__ */ padding(6), /* @__PURE__ */
|
|
13085
|
-
var base64nopad = /* @__PURE__ */ chain(/* @__PURE__ */ radix2(6), /* @__PURE__ */ alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), /* @__PURE__ */
|
|
13086
|
-
var BECH_ALPHABET = /* @__PURE__ */ chain(/* @__PURE__ */ alphabet("qpzry9x8gf2tvdw0s3jn54khce6mua7l"), /* @__PURE__ */
|
|
13099
|
+
} : /* @__PURE__ */ chain(/* @__PURE__ */ radix2(6), /* @__PURE__ */ alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), /* @__PURE__ */ padding(6), /* @__PURE__ */ join39(""));
|
|
13100
|
+
var base64nopad = /* @__PURE__ */ chain(/* @__PURE__ */ radix2(6), /* @__PURE__ */ alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), /* @__PURE__ */ join39(""));
|
|
13101
|
+
var BECH_ALPHABET = /* @__PURE__ */ chain(/* @__PURE__ */ alphabet("qpzry9x8gf2tvdw0s3jn54khce6mua7l"), /* @__PURE__ */ join39(""));
|
|
13087
13102
|
var POLYMOD_GENERATORS = [996825010, 642813549, 513874426, 1027748829, 705979059];
|
|
13088
13103
|
function bech32Polymod(pre) {
|
|
13089
13104
|
const b = pre >> 25;
|
|
@@ -19299,14 +19314,14 @@ function openWindowsInputPipe(content) {
|
|
|
19299
19314
|
});
|
|
19300
19315
|
});
|
|
19301
19316
|
}
|
|
19302
|
-
var fs10, net, import_crypto,
|
|
19317
|
+
var fs10, net, import_crypto, YAML5, SopsClient;
|
|
19303
19318
|
var init_client = __esm({
|
|
19304
19319
|
"../core/src/sops/client.ts"() {
|
|
19305
19320
|
"use strict";
|
|
19306
19321
|
fs10 = __toESM(require("fs"));
|
|
19307
19322
|
net = __toESM(require("net"));
|
|
19308
19323
|
import_crypto = require("crypto");
|
|
19309
|
-
|
|
19324
|
+
YAML5 = __toESM(require_dist());
|
|
19310
19325
|
init_types();
|
|
19311
19326
|
init_checker();
|
|
19312
19327
|
init_keygen();
|
|
@@ -19371,7 +19386,7 @@ var init_client = __esm({
|
|
|
19371
19386
|
}
|
|
19372
19387
|
let parsed;
|
|
19373
19388
|
try {
|
|
19374
|
-
parsed =
|
|
19389
|
+
parsed = YAML5.parse(result.stdout) ?? {};
|
|
19375
19390
|
} catch {
|
|
19376
19391
|
throw new SopsDecryptionError(
|
|
19377
19392
|
`Decrypted content of '${filePath}' is not valid YAML.`,
|
|
@@ -19398,7 +19413,7 @@ var init_client = __esm({
|
|
|
19398
19413
|
async encrypt(filePath, values, manifest, environment) {
|
|
19399
19414
|
await assertSops(this.runner, this.sopsCommand);
|
|
19400
19415
|
const fmt = formatFromPath(filePath);
|
|
19401
|
-
const content = fmt === "json" ? JSON.stringify(values, null, 2) :
|
|
19416
|
+
const content = fmt === "json" ? JSON.stringify(values, null, 2) : YAML5.stringify(values);
|
|
19402
19417
|
const args = this.buildEncryptArgs(filePath, manifest, environment);
|
|
19403
19418
|
const env = this.buildSopsEnv();
|
|
19404
19419
|
let inputArg;
|
|
@@ -19598,7 +19613,7 @@ var init_client = __esm({
|
|
|
19598
19613
|
}
|
|
19599
19614
|
let parsed;
|
|
19600
19615
|
try {
|
|
19601
|
-
parsed =
|
|
19616
|
+
parsed = YAML5.parse(content);
|
|
19602
19617
|
} catch {
|
|
19603
19618
|
throw new SopsDecryptionError(
|
|
19604
19619
|
`File '${filePath}' is not valid YAML. Cannot extract SOPS metadata.`,
|
|
@@ -20065,7 +20080,7 @@ function detectFormat(filePath, content) {
|
|
|
20065
20080
|
} catch {
|
|
20066
20081
|
}
|
|
20067
20082
|
try {
|
|
20068
|
-
const parsed =
|
|
20083
|
+
const parsed = YAML6.parse(content);
|
|
20069
20084
|
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
20070
20085
|
return "yaml";
|
|
20071
20086
|
}
|
|
@@ -20146,7 +20161,7 @@ function parseJson(content) {
|
|
|
20146
20161
|
function parseYaml(content) {
|
|
20147
20162
|
let parsed;
|
|
20148
20163
|
try {
|
|
20149
|
-
parsed =
|
|
20164
|
+
parsed = YAML6.parse(content);
|
|
20150
20165
|
} catch (err) {
|
|
20151
20166
|
throw new Error(`Invalid YAML: ${err.message}`);
|
|
20152
20167
|
}
|
|
@@ -20180,7 +20195,7 @@ function parseYaml(content) {
|
|
|
20180
20195
|
}
|
|
20181
20196
|
return { pairs, format: "yaml", skipped, warnings };
|
|
20182
20197
|
}
|
|
20183
|
-
function
|
|
20198
|
+
function parse7(content, format, filePath) {
|
|
20184
20199
|
const resolved = format === "auto" ? detectFormat(filePath ?? "", content) : format;
|
|
20185
20200
|
switch (resolved) {
|
|
20186
20201
|
case "dotenv":
|
|
@@ -20191,12 +20206,12 @@ function parse6(content, format, filePath) {
|
|
|
20191
20206
|
return parseYaml(content);
|
|
20192
20207
|
}
|
|
20193
20208
|
}
|
|
20194
|
-
var path11,
|
|
20209
|
+
var path11, YAML6;
|
|
20195
20210
|
var init_parsers = __esm({
|
|
20196
20211
|
"../core/src/import/parsers.ts"() {
|
|
20197
20212
|
"use strict";
|
|
20198
20213
|
path11 = __toESM(require("path"));
|
|
20199
|
-
|
|
20214
|
+
YAML6 = __toESM(require_dist());
|
|
20200
20215
|
}
|
|
20201
20216
|
});
|
|
20202
20217
|
|
|
@@ -20227,7 +20242,7 @@ var init_import = __esm({
|
|
|
20227
20242
|
repoRoot,
|
|
20228
20243
|
manifest.file_pattern.replace("{namespace}", ns).replace("{environment}", env)
|
|
20229
20244
|
);
|
|
20230
|
-
const parsed =
|
|
20245
|
+
const parsed = parse7(content, options.format ?? "auto", sourcePath ?? "");
|
|
20231
20246
|
let candidates = Object.entries(parsed.pairs);
|
|
20232
20247
|
if (options.prefix) {
|
|
20233
20248
|
const prefix = options.prefix;
|
|
@@ -20306,11 +20321,11 @@ function toRecipient(entry) {
|
|
|
20306
20321
|
function readManifestYaml(repoRoot) {
|
|
20307
20322
|
const manifestPath = path13.join(repoRoot, CLEF_MANIFEST_FILENAME);
|
|
20308
20323
|
const raw = fs11.readFileSync(manifestPath, "utf-8");
|
|
20309
|
-
return
|
|
20324
|
+
return YAML7.parse(raw);
|
|
20310
20325
|
}
|
|
20311
20326
|
function writeManifestYaml(repoRoot, doc) {
|
|
20312
20327
|
const manifestPath = path13.join(repoRoot, CLEF_MANIFEST_FILENAME);
|
|
20313
|
-
fs11.writeFileSync(manifestPath,
|
|
20328
|
+
fs11.writeFileSync(manifestPath, YAML7.stringify(doc), "utf-8");
|
|
20314
20329
|
}
|
|
20315
20330
|
function getRecipientsArray(doc) {
|
|
20316
20331
|
const sops = doc.sops;
|
|
@@ -20358,13 +20373,13 @@ function ensureEnvironmentRecipientsArray(doc, envName) {
|
|
|
20358
20373
|
}
|
|
20359
20374
|
return env.recipients;
|
|
20360
20375
|
}
|
|
20361
|
-
var fs11, path13,
|
|
20376
|
+
var fs11, path13, YAML7, RecipientManager;
|
|
20362
20377
|
var init_recipients = __esm({
|
|
20363
20378
|
"../core/src/recipients/index.ts"() {
|
|
20364
20379
|
"use strict";
|
|
20365
20380
|
fs11 = __toESM(require("fs"));
|
|
20366
20381
|
path13 = __toESM(require("path"));
|
|
20367
|
-
|
|
20382
|
+
YAML7 = __toESM(require_dist());
|
|
20368
20383
|
init_validator();
|
|
20369
20384
|
init_parser();
|
|
20370
20385
|
RecipientManager = class {
|
|
@@ -20562,7 +20577,7 @@ function loadRequests(repoRoot) {
|
|
|
20562
20577
|
try {
|
|
20563
20578
|
if (!fs12.existsSync(filePath)) return [];
|
|
20564
20579
|
const content = fs12.readFileSync(filePath, "utf-8");
|
|
20565
|
-
const parsed =
|
|
20580
|
+
const parsed = YAML8.parse(content);
|
|
20566
20581
|
if (!parsed || !Array.isArray(parsed.requests)) return [];
|
|
20567
20582
|
return parsed.requests.map((r) => ({
|
|
20568
20583
|
key: r.key,
|
|
@@ -20594,7 +20609,7 @@ function saveRequests(repoRoot, requests) {
|
|
|
20594
20609
|
return raw;
|
|
20595
20610
|
})
|
|
20596
20611
|
};
|
|
20597
|
-
fs12.writeFileSync(filePath, HEADER_COMMENT2 +
|
|
20612
|
+
fs12.writeFileSync(filePath, HEADER_COMMENT2 + YAML8.stringify(data), "utf-8");
|
|
20598
20613
|
}
|
|
20599
20614
|
function upsertRequest(repoRoot, key, label, environment) {
|
|
20600
20615
|
const requests = loadRequests(repoRoot);
|
|
@@ -20628,26 +20643,26 @@ function findInList(requests, identifier) {
|
|
|
20628
20643
|
const byKey = requests.find((r) => r.key === identifier);
|
|
20629
20644
|
return byKey ?? null;
|
|
20630
20645
|
}
|
|
20631
|
-
var fs12, path14,
|
|
20646
|
+
var fs12, path14, YAML8, REQUESTS_FILENAME, HEADER_COMMENT2;
|
|
20632
20647
|
var init_requests = __esm({
|
|
20633
20648
|
"../core/src/recipients/requests.ts"() {
|
|
20634
20649
|
"use strict";
|
|
20635
20650
|
fs12 = __toESM(require("fs"));
|
|
20636
20651
|
path14 = __toESM(require("path"));
|
|
20637
|
-
|
|
20652
|
+
YAML8 = __toESM(require_dist());
|
|
20638
20653
|
REQUESTS_FILENAME = ".clef-requests.yaml";
|
|
20639
20654
|
HEADER_COMMENT2 = "# Pending recipient access requests. Approve with: clef recipients approve <label>\n";
|
|
20640
20655
|
}
|
|
20641
20656
|
});
|
|
20642
20657
|
|
|
20643
20658
|
// ../core/src/drift/detector.ts
|
|
20644
|
-
var fs13, path15,
|
|
20659
|
+
var fs13, path15, YAML9, DriftDetector;
|
|
20645
20660
|
var init_detector = __esm({
|
|
20646
20661
|
"../core/src/drift/detector.ts"() {
|
|
20647
20662
|
"use strict";
|
|
20648
20663
|
fs13 = __toESM(require("fs"));
|
|
20649
20664
|
path15 = __toESM(require("path"));
|
|
20650
|
-
|
|
20665
|
+
YAML9 = __toESM(require_dist());
|
|
20651
20666
|
init_parser();
|
|
20652
20667
|
init_manager();
|
|
20653
20668
|
DriftDetector = class {
|
|
@@ -20736,7 +20751,7 @@ var init_detector = __esm({
|
|
|
20736
20751
|
try {
|
|
20737
20752
|
if (!fs13.existsSync(filePath)) return null;
|
|
20738
20753
|
const raw = fs13.readFileSync(filePath, "utf-8");
|
|
20739
|
-
const parsed =
|
|
20754
|
+
const parsed = YAML9.parse(raw);
|
|
20740
20755
|
if (parsed === null || parsed === void 0 || typeof parsed !== "object") return null;
|
|
20741
20756
|
return Object.keys(parsed).filter((k) => k !== "sops");
|
|
20742
20757
|
} catch {
|
|
@@ -20887,13 +20902,13 @@ var init_sanitizer = __esm({
|
|
|
20887
20902
|
});
|
|
20888
20903
|
|
|
20889
20904
|
// ../core/src/report/generator.ts
|
|
20890
|
-
var fs14, path16,
|
|
20905
|
+
var fs14, path16, YAML10, ReportGenerator;
|
|
20891
20906
|
var init_generator = __esm({
|
|
20892
20907
|
"../core/src/report/generator.ts"() {
|
|
20893
20908
|
"use strict";
|
|
20894
20909
|
fs14 = __toESM(require("fs"));
|
|
20895
20910
|
path16 = __toESM(require("path"));
|
|
20896
|
-
|
|
20911
|
+
YAML10 = __toESM(require_dist());
|
|
20897
20912
|
init_types();
|
|
20898
20913
|
init_parser();
|
|
20899
20914
|
init_runner();
|
|
@@ -21072,7 +21087,7 @@ var init_generator = __esm({
|
|
|
21072
21087
|
try {
|
|
21073
21088
|
if (!fs14.existsSync(filePath)) return 0;
|
|
21074
21089
|
const raw = fs14.readFileSync(filePath, "utf-8");
|
|
21075
|
-
const parsed =
|
|
21090
|
+
const parsed = YAML10.parse(raw);
|
|
21076
21091
|
if (parsed === null || parsed === void 0 || typeof parsed !== "object") return 0;
|
|
21077
21092
|
return Object.keys(parsed).filter((k) => k !== "sops").length;
|
|
21078
21093
|
} catch {
|
|
@@ -21444,14 +21459,14 @@ var init_driver = __esm({
|
|
|
21444
21459
|
});
|
|
21445
21460
|
|
|
21446
21461
|
// ../core/src/service-identity/manager.ts
|
|
21447
|
-
var fs15, os, path17,
|
|
21462
|
+
var fs15, os, path17, YAML11, PartialRotationError, ServiceIdentityManager;
|
|
21448
21463
|
var init_manager2 = __esm({
|
|
21449
21464
|
"../core/src/service-identity/manager.ts"() {
|
|
21450
21465
|
"use strict";
|
|
21451
21466
|
fs15 = __toESM(require("fs"));
|
|
21452
21467
|
os = __toESM(require("os"));
|
|
21453
21468
|
path17 = __toESM(require("path"));
|
|
21454
|
-
|
|
21469
|
+
YAML11 = __toESM(require_dist());
|
|
21455
21470
|
init_types();
|
|
21456
21471
|
init_keygen();
|
|
21457
21472
|
init_parser();
|
|
@@ -21507,7 +21522,7 @@ var init_manager2 = __esm({
|
|
|
21507
21522
|
await this.registerRecipients(definition, manifest, repoRoot);
|
|
21508
21523
|
const manifestPath = path17.join(repoRoot, CLEF_MANIFEST_FILENAME);
|
|
21509
21524
|
const raw = fs15.readFileSync(manifestPath, "utf-8");
|
|
21510
|
-
const doc =
|
|
21525
|
+
const doc = YAML11.parse(raw);
|
|
21511
21526
|
if (!Array.isArray(doc.service_identities)) {
|
|
21512
21527
|
doc.service_identities = [];
|
|
21513
21528
|
}
|
|
@@ -21519,7 +21534,7 @@ var init_manager2 = __esm({
|
|
|
21519
21534
|
});
|
|
21520
21535
|
const tmpCreate = path17.join(os.tmpdir(), `clef-manifest-${process.pid}-${Date.now()}.tmp`);
|
|
21521
21536
|
try {
|
|
21522
|
-
fs15.writeFileSync(tmpCreate,
|
|
21537
|
+
fs15.writeFileSync(tmpCreate, YAML11.stringify(doc), "utf-8");
|
|
21523
21538
|
fs15.renameSync(tmpCreate, manifestPath);
|
|
21524
21539
|
} finally {
|
|
21525
21540
|
try {
|
|
@@ -21541,6 +21556,46 @@ var init_manager2 = __esm({
|
|
|
21541
21556
|
get(manifest, name) {
|
|
21542
21557
|
return manifest.service_identities?.find((si) => si.name === name);
|
|
21543
21558
|
}
|
|
21559
|
+
/**
|
|
21560
|
+
* Delete a service identity: remove its recipients from scoped SOPS files
|
|
21561
|
+
* and remove it from the manifest.
|
|
21562
|
+
*/
|
|
21563
|
+
async delete(name, manifest, repoRoot) {
|
|
21564
|
+
const identity = this.get(manifest, name);
|
|
21565
|
+
if (!identity) {
|
|
21566
|
+
throw new Error(`Service identity '${name}' not found.`);
|
|
21567
|
+
}
|
|
21568
|
+
const cells = this.matrixManager.resolveMatrix(manifest, repoRoot).filter((c) => c.exists);
|
|
21569
|
+
for (const cell of cells) {
|
|
21570
|
+
if (!identity.namespaces.includes(cell.namespace)) continue;
|
|
21571
|
+
const envConfig = identity.environments[cell.environment];
|
|
21572
|
+
if (!envConfig?.recipient) continue;
|
|
21573
|
+
if (isKmsEnvelope(envConfig)) continue;
|
|
21574
|
+
try {
|
|
21575
|
+
await this.encryption.removeRecipient(cell.filePath, envConfig.recipient);
|
|
21576
|
+
} catch {
|
|
21577
|
+
}
|
|
21578
|
+
}
|
|
21579
|
+
const manifestPath = path17.join(repoRoot, CLEF_MANIFEST_FILENAME);
|
|
21580
|
+
const raw = fs15.readFileSync(manifestPath, "utf-8");
|
|
21581
|
+
const doc = YAML11.parse(raw);
|
|
21582
|
+
const identities = doc.service_identities;
|
|
21583
|
+
if (Array.isArray(identities)) {
|
|
21584
|
+
doc.service_identities = identities.filter(
|
|
21585
|
+
(si) => si.name !== name
|
|
21586
|
+
);
|
|
21587
|
+
}
|
|
21588
|
+
const tmp = path17.join(os.tmpdir(), `clef-manifest-${process.pid}-${Date.now()}.tmp`);
|
|
21589
|
+
try {
|
|
21590
|
+
fs15.writeFileSync(tmp, YAML11.stringify(doc), "utf-8");
|
|
21591
|
+
fs15.renameSync(tmp, manifestPath);
|
|
21592
|
+
} finally {
|
|
21593
|
+
try {
|
|
21594
|
+
fs15.unlinkSync(tmp);
|
|
21595
|
+
} catch {
|
|
21596
|
+
}
|
|
21597
|
+
}
|
|
21598
|
+
}
|
|
21544
21599
|
/**
|
|
21545
21600
|
* Update environment backends on an existing service identity.
|
|
21546
21601
|
* Switches age → KMS (removes old recipient) or updates KMS config.
|
|
@@ -21553,7 +21608,7 @@ var init_manager2 = __esm({
|
|
|
21553
21608
|
}
|
|
21554
21609
|
const manifestPath = path17.join(repoRoot, CLEF_MANIFEST_FILENAME);
|
|
21555
21610
|
const raw = fs15.readFileSync(manifestPath, "utf-8");
|
|
21556
|
-
const doc =
|
|
21611
|
+
const doc = YAML11.parse(raw);
|
|
21557
21612
|
const identities = doc.service_identities;
|
|
21558
21613
|
const siDoc = identities.find((si) => si.name === name);
|
|
21559
21614
|
const envs = siDoc.environments;
|
|
@@ -21580,7 +21635,7 @@ var init_manager2 = __esm({
|
|
|
21580
21635
|
}
|
|
21581
21636
|
const tmp = path17.join(os.tmpdir(), `clef-manifest-${process.pid}-${Date.now()}.tmp`);
|
|
21582
21637
|
try {
|
|
21583
|
-
fs15.writeFileSync(tmp,
|
|
21638
|
+
fs15.writeFileSync(tmp, YAML11.stringify(doc), "utf-8");
|
|
21584
21639
|
fs15.renameSync(tmp, manifestPath);
|
|
21585
21640
|
} finally {
|
|
21586
21641
|
try {
|
|
@@ -21622,7 +21677,7 @@ var init_manager2 = __esm({
|
|
|
21622
21677
|
}
|
|
21623
21678
|
const manifestPath = path17.join(repoRoot, CLEF_MANIFEST_FILENAME);
|
|
21624
21679
|
const raw = fs15.readFileSync(manifestPath, "utf-8");
|
|
21625
|
-
const doc =
|
|
21680
|
+
const doc = YAML11.parse(raw);
|
|
21626
21681
|
const identities = doc.service_identities;
|
|
21627
21682
|
const siDoc = identities.find((si) => si.name === name);
|
|
21628
21683
|
const envs = siDoc.environments;
|
|
@@ -21677,7 +21732,7 @@ var init_manager2 = __esm({
|
|
|
21677
21732
|
}
|
|
21678
21733
|
const tmpRotate = path17.join(os.tmpdir(), `clef-manifest-${process.pid}-${Date.now()}.tmp`);
|
|
21679
21734
|
try {
|
|
21680
|
-
fs15.writeFileSync(tmpRotate,
|
|
21735
|
+
fs15.writeFileSync(tmpRotate, YAML11.stringify(doc), "utf-8");
|
|
21681
21736
|
fs15.renameSync(tmpRotate, manifestPath);
|
|
21682
21737
|
} finally {
|
|
21683
21738
|
try {
|
|
@@ -21851,7 +21906,7 @@ var init_packer = __esm({
|
|
|
21851
21906
|
const e = new Encrypter();
|
|
21852
21907
|
e.addRecipient(ephemeralPublicKey);
|
|
21853
21908
|
const encrypted = await e.encrypt(plaintext);
|
|
21854
|
-
ciphertext =
|
|
21909
|
+
ciphertext = Buffer.from(encrypted).toString("base64");
|
|
21855
21910
|
} catch {
|
|
21856
21911
|
throw new Error("Failed to age-encrypt artifact with ephemeral key.");
|
|
21857
21912
|
}
|
|
@@ -21881,7 +21936,7 @@ var init_packer = __esm({
|
|
|
21881
21936
|
const e = new Encrypter();
|
|
21882
21937
|
e.addRecipient(resolved.recipient);
|
|
21883
21938
|
const encrypted = await e.encrypt(plaintext);
|
|
21884
|
-
ciphertext =
|
|
21939
|
+
ciphertext = Buffer.from(encrypted).toString("base64");
|
|
21885
21940
|
} catch {
|
|
21886
21941
|
throw new Error("Failed to age-encrypt artifact. Check recipient key.");
|
|
21887
21942
|
}
|
|
@@ -21983,7 +22038,7 @@ __export(src_exports, {
|
|
|
21983
22038
|
markResolved: () => markResolved,
|
|
21984
22039
|
matchPatterns: () => matchPatterns,
|
|
21985
22040
|
metadataPath: () => metadataPath,
|
|
21986
|
-
parse: () =>
|
|
22041
|
+
parse: () => parse7,
|
|
21987
22042
|
parseDotenv: () => parseDotenv,
|
|
21988
22043
|
parseIgnoreContent: () => parseIgnoreContent,
|
|
21989
22044
|
parseJson: () => parseJson,
|
|
@@ -22121,7 +22176,7 @@ var require_ms = __commonJS({
|
|
|
22121
22176
|
options = options || {};
|
|
22122
22177
|
var type = typeof val;
|
|
22123
22178
|
if (type === "string" && val.length > 0) {
|
|
22124
|
-
return
|
|
22179
|
+
return parse16(val);
|
|
22125
22180
|
} else if (type === "number" && isFinite(val)) {
|
|
22126
22181
|
return options.long ? fmtLong(val) : fmtShort(val);
|
|
22127
22182
|
}
|
|
@@ -22129,7 +22184,7 @@ var require_ms = __commonJS({
|
|
|
22129
22184
|
"val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
|
|
22130
22185
|
);
|
|
22131
22186
|
};
|
|
22132
|
-
function
|
|
22187
|
+
function parse16(str2) {
|
|
22133
22188
|
str2 = String(str2);
|
|
22134
22189
|
if (str2.length > 100) {
|
|
22135
22190
|
return;
|
|
@@ -23568,7 +23623,7 @@ var require_bytes = __commonJS({
|
|
|
23568
23623
|
"use strict";
|
|
23569
23624
|
module2.exports = bytes;
|
|
23570
23625
|
module2.exports.format = format;
|
|
23571
|
-
module2.exports.parse =
|
|
23626
|
+
module2.exports.parse = parse16;
|
|
23572
23627
|
var formatThousandsRegExp = /\B(?=(\d{3})+(?!\d))/g;
|
|
23573
23628
|
var formatDecimalsRegExp = /(?:\.0*|(\.[^0]+)0+)$/;
|
|
23574
23629
|
var map = {
|
|
@@ -23582,7 +23637,7 @@ var require_bytes = __commonJS({
|
|
|
23582
23637
|
var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;
|
|
23583
23638
|
function bytes(value, options) {
|
|
23584
23639
|
if (typeof value === "string") {
|
|
23585
|
-
return
|
|
23640
|
+
return parse16(value);
|
|
23586
23641
|
}
|
|
23587
23642
|
if (typeof value === "number") {
|
|
23588
23643
|
return format(value, options);
|
|
@@ -23626,7 +23681,7 @@ var require_bytes = __commonJS({
|
|
|
23626
23681
|
}
|
|
23627
23682
|
return str2 + unitSeparator + unit;
|
|
23628
23683
|
}
|
|
23629
|
-
function
|
|
23684
|
+
function parse16(val) {
|
|
23630
23685
|
if (typeof val === "number" && !isNaN(val)) {
|
|
23631
23686
|
return val;
|
|
23632
23687
|
}
|
|
@@ -27831,7 +27886,7 @@ var require_content_type = __commonJS({
|
|
|
27831
27886
|
var QUOTE_REGEXP = /([\\"])/g;
|
|
27832
27887
|
var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
27833
27888
|
exports2.format = format;
|
|
27834
|
-
exports2.parse =
|
|
27889
|
+
exports2.parse = parse16;
|
|
27835
27890
|
function format(obj) {
|
|
27836
27891
|
if (!obj || typeof obj !== "object") {
|
|
27837
27892
|
throw new TypeError("argument obj is required");
|
|
@@ -27855,7 +27910,7 @@ var require_content_type = __commonJS({
|
|
|
27855
27910
|
}
|
|
27856
27911
|
return string;
|
|
27857
27912
|
}
|
|
27858
|
-
function
|
|
27913
|
+
function parse16(string) {
|
|
27859
27914
|
if (!string) {
|
|
27860
27915
|
throw new TypeError("argument string is required");
|
|
27861
27916
|
}
|
|
@@ -37380,11 +37435,11 @@ var require_mime_types = __commonJS({
|
|
|
37380
37435
|
}
|
|
37381
37436
|
return exts[0];
|
|
37382
37437
|
}
|
|
37383
|
-
function lookup(
|
|
37384
|
-
if (!
|
|
37438
|
+
function lookup(path44) {
|
|
37439
|
+
if (!path44 || typeof path44 !== "string") {
|
|
37385
37440
|
return false;
|
|
37386
37441
|
}
|
|
37387
|
-
var extension2 = extname2("x." +
|
|
37442
|
+
var extension2 = extname2("x." + path44).toLowerCase().slice(1);
|
|
37388
37443
|
if (!extension2) {
|
|
37389
37444
|
return false;
|
|
37390
37445
|
}
|
|
@@ -37437,7 +37492,7 @@ var require_media_typer = __commonJS({
|
|
|
37437
37492
|
var TYPE_NAME_REGEXP = /^[A-Za-z0-9][A-Za-z0-9!#$&^_-]{0,126}$/;
|
|
37438
37493
|
var TYPE_REGEXP = /^ *([A-Za-z0-9][A-Za-z0-9!#$&^_-]{0,126})\/([A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}) *$/;
|
|
37439
37494
|
exports2.format = format;
|
|
37440
|
-
exports2.parse =
|
|
37495
|
+
exports2.parse = parse16;
|
|
37441
37496
|
exports2.test = test;
|
|
37442
37497
|
function format(obj) {
|
|
37443
37498
|
if (!obj || typeof obj !== "object") {
|
|
@@ -37470,7 +37525,7 @@ var require_media_typer = __commonJS({
|
|
|
37470
37525
|
}
|
|
37471
37526
|
return TYPE_REGEXP.test(string.toLowerCase());
|
|
37472
37527
|
}
|
|
37473
|
-
function
|
|
37528
|
+
function parse16(string) {
|
|
37474
37529
|
if (!string) {
|
|
37475
37530
|
throw new TypeError("argument string is required");
|
|
37476
37531
|
}
|
|
@@ -37656,7 +37711,7 @@ var require_read = __commonJS({
|
|
|
37656
37711
|
var hasBody = require_type_is().hasBody;
|
|
37657
37712
|
var { getCharset } = require_utils();
|
|
37658
37713
|
module2.exports = read;
|
|
37659
|
-
function read(req, res, next,
|
|
37714
|
+
function read(req, res, next, parse16, debug, options) {
|
|
37660
37715
|
if (onFinished.isFinished(req)) {
|
|
37661
37716
|
debug("body already parsed");
|
|
37662
37717
|
next();
|
|
@@ -37744,7 +37799,7 @@ var require_read = __commonJS({
|
|
|
37744
37799
|
try {
|
|
37745
37800
|
debug("parse body");
|
|
37746
37801
|
str2 = typeof body !== "string" && encoding !== null ? iconv.decode(body, encoding) : body;
|
|
37747
|
-
req.body =
|
|
37802
|
+
req.body = parse16(str2, encoding);
|
|
37748
37803
|
} catch (err) {
|
|
37749
37804
|
next(createError(400, err, {
|
|
37750
37805
|
body: str2,
|
|
@@ -37817,7 +37872,7 @@ var require_json = __commonJS({
|
|
|
37817
37872
|
const normalizedOptions = normalizeOptions(options, "application/json");
|
|
37818
37873
|
var reviver = options?.reviver;
|
|
37819
37874
|
var strict = options?.strict !== false;
|
|
37820
|
-
function
|
|
37875
|
+
function parse16(body) {
|
|
37821
37876
|
if (body.length === 0) {
|
|
37822
37877
|
return {};
|
|
37823
37878
|
}
|
|
@@ -37844,7 +37899,7 @@ var require_json = __commonJS({
|
|
|
37844
37899
|
isValidCharset: (charset) => charset.slice(0, 4) === "utf-"
|
|
37845
37900
|
};
|
|
37846
37901
|
return function jsonParser(req, res, next) {
|
|
37847
|
-
read(req, res, next,
|
|
37902
|
+
read(req, res, next, parse16, debug, readOptions);
|
|
37848
37903
|
};
|
|
37849
37904
|
}
|
|
37850
37905
|
function createStrictSyntaxError(str2, char) {
|
|
@@ -40422,11 +40477,11 @@ var require_lib2 = __commonJS({
|
|
|
40422
40477
|
"../../node_modules/qs/lib/index.js"(exports2, module2) {
|
|
40423
40478
|
"use strict";
|
|
40424
40479
|
var stringify7 = require_stringify2();
|
|
40425
|
-
var
|
|
40480
|
+
var parse16 = require_parse();
|
|
40426
40481
|
var formats = require_formats();
|
|
40427
40482
|
module2.exports = {
|
|
40428
40483
|
formats,
|
|
40429
|
-
parse:
|
|
40484
|
+
parse: parse16,
|
|
40430
40485
|
stringify: stringify7
|
|
40431
40486
|
};
|
|
40432
40487
|
}
|
|
@@ -40448,7 +40503,7 @@ var require_urlencoded = __commonJS({
|
|
|
40448
40503
|
throw new TypeError("option defaultCharset must be either utf-8 or iso-8859-1");
|
|
40449
40504
|
}
|
|
40450
40505
|
var queryparse = createQueryParser(options);
|
|
40451
|
-
function
|
|
40506
|
+
function parse16(body, encoding) {
|
|
40452
40507
|
return body.length ? queryparse(body, encoding) : {};
|
|
40453
40508
|
}
|
|
40454
40509
|
const readOptions = {
|
|
@@ -40457,7 +40512,7 @@ var require_urlencoded = __commonJS({
|
|
|
40457
40512
|
isValidCharset: (charset) => charset === "utf-8" || charset === "iso-8859-1"
|
|
40458
40513
|
};
|
|
40459
40514
|
return function urlencodedParser(req, res, next) {
|
|
40460
|
-
read(req, res, next,
|
|
40515
|
+
read(req, res, next, parse16, debug, readOptions);
|
|
40461
40516
|
};
|
|
40462
40517
|
}
|
|
40463
40518
|
function createQueryParser(options) {
|
|
@@ -40641,7 +40696,7 @@ var require_parseurl = __commonJS({
|
|
|
40641
40696
|
"../../node_modules/parseurl/index.js"(exports2, module2) {
|
|
40642
40697
|
"use strict";
|
|
40643
40698
|
var url = require("url");
|
|
40644
|
-
var
|
|
40699
|
+
var parse16 = url.parse;
|
|
40645
40700
|
var Url = url.Url;
|
|
40646
40701
|
module2.exports = parseurl;
|
|
40647
40702
|
module2.exports.original = originalurl;
|
|
@@ -40673,7 +40728,7 @@ var require_parseurl = __commonJS({
|
|
|
40673
40728
|
}
|
|
40674
40729
|
function fastparse(str2) {
|
|
40675
40730
|
if (typeof str2 !== "string" || str2.charCodeAt(0) !== 47) {
|
|
40676
|
-
return
|
|
40731
|
+
return parse16(str2);
|
|
40677
40732
|
}
|
|
40678
40733
|
var pathname = str2;
|
|
40679
40734
|
var query = null;
|
|
@@ -40701,7 +40756,7 @@ var require_parseurl = __commonJS({
|
|
|
40701
40756
|
/* # */
|
|
40702
40757
|
case 160:
|
|
40703
40758
|
case 65279:
|
|
40704
|
-
return
|
|
40759
|
+
return parse16(str2);
|
|
40705
40760
|
}
|
|
40706
40761
|
}
|
|
40707
40762
|
var url2 = Url !== void 0 ? new Url() : {};
|
|
@@ -40852,13 +40907,13 @@ var require_view = __commonJS({
|
|
|
40852
40907
|
"../../node_modules/express/lib/view.js"(exports2, module2) {
|
|
40853
40908
|
"use strict";
|
|
40854
40909
|
var debug = require_src()("express:view");
|
|
40855
|
-
var
|
|
40856
|
-
var
|
|
40857
|
-
var dirname7 =
|
|
40858
|
-
var basename5 =
|
|
40859
|
-
var extname2 =
|
|
40860
|
-
var
|
|
40861
|
-
var resolve6 =
|
|
40910
|
+
var path44 = require("node:path");
|
|
40911
|
+
var fs27 = require("node:fs");
|
|
40912
|
+
var dirname7 = path44.dirname;
|
|
40913
|
+
var basename5 = path44.basename;
|
|
40914
|
+
var extname2 = path44.extname;
|
|
40915
|
+
var join39 = path44.join;
|
|
40916
|
+
var resolve6 = path44.resolve;
|
|
40862
40917
|
module2.exports = View;
|
|
40863
40918
|
function View(name, options) {
|
|
40864
40919
|
var opts = options || {};
|
|
@@ -40887,17 +40942,17 @@ var require_view = __commonJS({
|
|
|
40887
40942
|
this.path = this.lookup(fileName);
|
|
40888
40943
|
}
|
|
40889
40944
|
View.prototype.lookup = function lookup(name) {
|
|
40890
|
-
var
|
|
40945
|
+
var path45;
|
|
40891
40946
|
var roots = [].concat(this.root);
|
|
40892
40947
|
debug('lookup "%s"', name);
|
|
40893
|
-
for (var i = 0; i < roots.length && !
|
|
40948
|
+
for (var i = 0; i < roots.length && !path45; i++) {
|
|
40894
40949
|
var root = roots[i];
|
|
40895
40950
|
var loc = resolve6(root, name);
|
|
40896
40951
|
var dir = dirname7(loc);
|
|
40897
40952
|
var file = basename5(loc);
|
|
40898
|
-
|
|
40953
|
+
path45 = this.resolve(dir, file);
|
|
40899
40954
|
}
|
|
40900
|
-
return
|
|
40955
|
+
return path45;
|
|
40901
40956
|
};
|
|
40902
40957
|
View.prototype.render = function render(options, callback) {
|
|
40903
40958
|
var sync = true;
|
|
@@ -40919,21 +40974,21 @@ var require_view = __commonJS({
|
|
|
40919
40974
|
};
|
|
40920
40975
|
View.prototype.resolve = function resolve7(dir, file) {
|
|
40921
40976
|
var ext = this.ext;
|
|
40922
|
-
var
|
|
40923
|
-
var stat = tryStat(
|
|
40977
|
+
var path45 = join39(dir, file);
|
|
40978
|
+
var stat = tryStat(path45);
|
|
40924
40979
|
if (stat && stat.isFile()) {
|
|
40925
|
-
return
|
|
40980
|
+
return path45;
|
|
40926
40981
|
}
|
|
40927
|
-
|
|
40928
|
-
stat = tryStat(
|
|
40982
|
+
path45 = join39(dir, basename5(file, ext), "index" + ext);
|
|
40983
|
+
stat = tryStat(path45);
|
|
40929
40984
|
if (stat && stat.isFile()) {
|
|
40930
|
-
return
|
|
40985
|
+
return path45;
|
|
40931
40986
|
}
|
|
40932
40987
|
};
|
|
40933
|
-
function tryStat(
|
|
40934
|
-
debug('stat "%s"',
|
|
40988
|
+
function tryStat(path45) {
|
|
40989
|
+
debug('stat "%s"', path45);
|
|
40935
40990
|
try {
|
|
40936
|
-
return
|
|
40991
|
+
return fs27.statSync(path45);
|
|
40937
40992
|
} catch (e) {
|
|
40938
40993
|
return void 0;
|
|
40939
40994
|
}
|
|
@@ -50439,11 +50494,11 @@ var require_mime_types2 = __commonJS({
|
|
|
50439
50494
|
}
|
|
50440
50495
|
return exts[0];
|
|
50441
50496
|
}
|
|
50442
|
-
function lookup(
|
|
50443
|
-
if (!
|
|
50497
|
+
function lookup(path44) {
|
|
50498
|
+
if (!path44 || typeof path44 !== "string") {
|
|
50444
50499
|
return false;
|
|
50445
50500
|
}
|
|
50446
|
-
var extension2 = extname2("x." +
|
|
50501
|
+
var extension2 = extname2("x." + path44).toLowerCase().slice(1);
|
|
50447
50502
|
if (!extension2) {
|
|
50448
50503
|
return false;
|
|
50449
50504
|
}
|
|
@@ -50497,7 +50552,7 @@ var require_forwarded = __commonJS({
|
|
|
50497
50552
|
if (!req) {
|
|
50498
50553
|
throw new TypeError("argument req is required");
|
|
50499
50554
|
}
|
|
50500
|
-
var proxyAddrs =
|
|
50555
|
+
var proxyAddrs = parse16(req.headers["x-forwarded-for"] || "");
|
|
50501
50556
|
var socketAddr = getSocketAddr(req);
|
|
50502
50557
|
var addrs = [socketAddr].concat(proxyAddrs);
|
|
50503
50558
|
return addrs;
|
|
@@ -50505,7 +50560,7 @@ var require_forwarded = __commonJS({
|
|
|
50505
50560
|
function getSocketAddr(req) {
|
|
50506
50561
|
return req.socket ? req.socket.remoteAddress : req.connection.remoteAddress;
|
|
50507
50562
|
}
|
|
50508
|
-
function
|
|
50563
|
+
function parse16(header) {
|
|
50509
50564
|
var end = header.length;
|
|
50510
50565
|
var list = [];
|
|
50511
50566
|
var start = header.length;
|
|
@@ -51534,7 +51589,7 @@ var require_dist2 = __commonJS({
|
|
|
51534
51589
|
"use strict";
|
|
51535
51590
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
51536
51591
|
exports2.PathError = exports2.TokenData = void 0;
|
|
51537
|
-
exports2.parse =
|
|
51592
|
+
exports2.parse = parse16;
|
|
51538
51593
|
exports2.compile = compile;
|
|
51539
51594
|
exports2.match = match;
|
|
51540
51595
|
exports2.pathToRegexp = pathToRegexp;
|
|
@@ -51580,7 +51635,7 @@ var require_dist2 = __commonJS({
|
|
|
51580
51635
|
}
|
|
51581
51636
|
};
|
|
51582
51637
|
exports2.PathError = PathError;
|
|
51583
|
-
function
|
|
51638
|
+
function parse16(str2, options = {}) {
|
|
51584
51639
|
const { encodePath = NOOP_VALUE } = options;
|
|
51585
51640
|
const chars = [...str2];
|
|
51586
51641
|
const tokens = [];
|
|
@@ -51636,15 +51691,15 @@ var require_dist2 = __commonJS({
|
|
|
51636
51691
|
if (token.type === endType)
|
|
51637
51692
|
break;
|
|
51638
51693
|
if (token.type === "char" || token.type === "escape") {
|
|
51639
|
-
let
|
|
51694
|
+
let path44 = token.value;
|
|
51640
51695
|
let cur = tokens[pos];
|
|
51641
51696
|
while (cur.type === "char" || cur.type === "escape") {
|
|
51642
|
-
|
|
51697
|
+
path44 += cur.value;
|
|
51643
51698
|
cur = tokens[++pos];
|
|
51644
51699
|
}
|
|
51645
51700
|
output.push({
|
|
51646
51701
|
type: "text",
|
|
51647
|
-
value: encodePath(
|
|
51702
|
+
value: encodePath(path44)
|
|
51648
51703
|
});
|
|
51649
51704
|
continue;
|
|
51650
51705
|
}
|
|
@@ -51668,16 +51723,16 @@ var require_dist2 = __commonJS({
|
|
|
51668
51723
|
}
|
|
51669
51724
|
return new TokenData(consumeUntil("end"), str2);
|
|
51670
51725
|
}
|
|
51671
|
-
function compile(
|
|
51726
|
+
function compile(path44, options = {}) {
|
|
51672
51727
|
const { encode = encodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
|
|
51673
|
-
const data = typeof
|
|
51728
|
+
const data = typeof path44 === "object" ? path44 : parse16(path44, options);
|
|
51674
51729
|
const fn = tokensToFunction(data.tokens, delimiter, encode);
|
|
51675
|
-
return function
|
|
51676
|
-
const [
|
|
51730
|
+
return function path45(params = {}) {
|
|
51731
|
+
const [path46, ...missing] = fn(params);
|
|
51677
51732
|
if (missing.length) {
|
|
51678
51733
|
throw new TypeError(`Missing parameters: ${missing.join(", ")}`);
|
|
51679
51734
|
}
|
|
51680
|
-
return
|
|
51735
|
+
return path46;
|
|
51681
51736
|
};
|
|
51682
51737
|
}
|
|
51683
51738
|
function tokensToFunction(tokens, delimiter, encode) {
|
|
@@ -51733,9 +51788,9 @@ var require_dist2 = __commonJS({
|
|
|
51733
51788
|
return [encodeValue(value)];
|
|
51734
51789
|
};
|
|
51735
51790
|
}
|
|
51736
|
-
function match(
|
|
51791
|
+
function match(path44, options = {}) {
|
|
51737
51792
|
const { decode = decodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
|
|
51738
|
-
const { regexp, keys } = pathToRegexp(
|
|
51793
|
+
const { regexp, keys } = pathToRegexp(path44, options);
|
|
51739
51794
|
const decoders = keys.map((key) => {
|
|
51740
51795
|
if (decode === false)
|
|
51741
51796
|
return NOOP_VALUE;
|
|
@@ -51747,7 +51802,7 @@ var require_dist2 = __commonJS({
|
|
|
51747
51802
|
const m = regexp.exec(input);
|
|
51748
51803
|
if (!m)
|
|
51749
51804
|
return false;
|
|
51750
|
-
const
|
|
51805
|
+
const path45 = m[0];
|
|
51751
51806
|
const params = /* @__PURE__ */ Object.create(null);
|
|
51752
51807
|
for (let i = 1; i < m.length; i++) {
|
|
51753
51808
|
if (m[i] === void 0)
|
|
@@ -51756,16 +51811,16 @@ var require_dist2 = __commonJS({
|
|
|
51756
51811
|
const decoder = decoders[i - 1];
|
|
51757
51812
|
params[key.name] = decoder(m[i]);
|
|
51758
51813
|
}
|
|
51759
|
-
return { path:
|
|
51814
|
+
return { path: path45, params };
|
|
51760
51815
|
};
|
|
51761
51816
|
}
|
|
51762
|
-
function pathToRegexp(
|
|
51817
|
+
function pathToRegexp(path44, options = {}) {
|
|
51763
51818
|
const { delimiter = DEFAULT_DELIMITER, end = true, sensitive = false, trailing = true } = options;
|
|
51764
51819
|
const keys = [];
|
|
51765
51820
|
const flags = sensitive ? "" : "i";
|
|
51766
51821
|
const sources = [];
|
|
51767
|
-
for (const input of pathsToArray(
|
|
51768
|
-
const data = typeof input === "object" ? input :
|
|
51822
|
+
for (const input of pathsToArray(path44, [])) {
|
|
51823
|
+
const data = typeof input === "object" ? input : parse16(input, options);
|
|
51769
51824
|
for (const tokens of flatten(data.tokens, 0, [])) {
|
|
51770
51825
|
sources.push(toRegExpSource(tokens, delimiter, keys, data.originalPath));
|
|
51771
51826
|
}
|
|
@@ -51894,18 +51949,18 @@ var require_layer = __commonJS({
|
|
|
51894
51949
|
var TRAILING_SLASH_REGEXP = /\/+$/;
|
|
51895
51950
|
var MATCHING_GROUP_REGEXP = /\((?:\?<(.*?)>)?(?!\?)/g;
|
|
51896
51951
|
module2.exports = Layer;
|
|
51897
|
-
function Layer(
|
|
51952
|
+
function Layer(path44, options, fn) {
|
|
51898
51953
|
if (!(this instanceof Layer)) {
|
|
51899
|
-
return new Layer(
|
|
51954
|
+
return new Layer(path44, options, fn);
|
|
51900
51955
|
}
|
|
51901
|
-
debug("new %o",
|
|
51956
|
+
debug("new %o", path44);
|
|
51902
51957
|
const opts = options || {};
|
|
51903
51958
|
this.handle = fn;
|
|
51904
51959
|
this.keys = [];
|
|
51905
51960
|
this.name = fn.name || "<anonymous>";
|
|
51906
51961
|
this.params = void 0;
|
|
51907
51962
|
this.path = void 0;
|
|
51908
|
-
this.slash =
|
|
51963
|
+
this.slash = path44 === "/" && opts.end === false;
|
|
51909
51964
|
function matcher(_path) {
|
|
51910
51965
|
if (_path instanceof RegExp) {
|
|
51911
51966
|
const keys = [];
|
|
@@ -51944,7 +51999,7 @@ var require_layer = __commonJS({
|
|
|
51944
51999
|
decode: decodeParam
|
|
51945
52000
|
});
|
|
51946
52001
|
}
|
|
51947
|
-
this.matchers = Array.isArray(
|
|
52002
|
+
this.matchers = Array.isArray(path44) ? path44.map(matcher) : [matcher(path44)];
|
|
51948
52003
|
}
|
|
51949
52004
|
Layer.prototype.handleError = function handleError(error, req, res, next) {
|
|
51950
52005
|
const fn = this.handle;
|
|
@@ -51984,9 +52039,9 @@ var require_layer = __commonJS({
|
|
|
51984
52039
|
next(err);
|
|
51985
52040
|
}
|
|
51986
52041
|
};
|
|
51987
|
-
Layer.prototype.match = function match(
|
|
52042
|
+
Layer.prototype.match = function match(path44) {
|
|
51988
52043
|
let match2;
|
|
51989
|
-
if (
|
|
52044
|
+
if (path44 != null) {
|
|
51990
52045
|
if (this.slash) {
|
|
51991
52046
|
this.params = {};
|
|
51992
52047
|
this.path = "";
|
|
@@ -51994,7 +52049,7 @@ var require_layer = __commonJS({
|
|
|
51994
52049
|
}
|
|
51995
52050
|
let i = 0;
|
|
51996
52051
|
while (!match2 && i < this.matchers.length) {
|
|
51997
|
-
match2 = this.matchers[i](
|
|
52052
|
+
match2 = this.matchers[i](path44);
|
|
51998
52053
|
i++;
|
|
51999
52054
|
}
|
|
52000
52055
|
}
|
|
@@ -52022,13 +52077,13 @@ var require_layer = __commonJS({
|
|
|
52022
52077
|
throw err;
|
|
52023
52078
|
}
|
|
52024
52079
|
}
|
|
52025
|
-
function loosen(
|
|
52026
|
-
if (
|
|
52027
|
-
return
|
|
52080
|
+
function loosen(path44) {
|
|
52081
|
+
if (path44 instanceof RegExp || path44 === "/") {
|
|
52082
|
+
return path44;
|
|
52028
52083
|
}
|
|
52029
|
-
return Array.isArray(
|
|
52084
|
+
return Array.isArray(path44) ? path44.map(function(p) {
|
|
52030
52085
|
return loosen(p);
|
|
52031
|
-
}) : String(
|
|
52086
|
+
}) : String(path44).replace(TRAILING_SLASH_REGEXP, "");
|
|
52032
52087
|
}
|
|
52033
52088
|
}
|
|
52034
52089
|
});
|
|
@@ -52044,9 +52099,9 @@ var require_route = __commonJS({
|
|
|
52044
52099
|
var flatten = Array.prototype.flat;
|
|
52045
52100
|
var methods = METHODS.map((method) => method.toLowerCase());
|
|
52046
52101
|
module2.exports = Route;
|
|
52047
|
-
function Route(
|
|
52048
|
-
debug("new %o",
|
|
52049
|
-
this.path =
|
|
52102
|
+
function Route(path44) {
|
|
52103
|
+
debug("new %o", path44);
|
|
52104
|
+
this.path = path44;
|
|
52050
52105
|
this.stack = [];
|
|
52051
52106
|
this.methods = /* @__PURE__ */ Object.create(null);
|
|
52052
52107
|
}
|
|
@@ -52254,8 +52309,8 @@ var require_router = __commonJS({
|
|
|
52254
52309
|
if (++sync > 100) {
|
|
52255
52310
|
return setImmediate(next, err);
|
|
52256
52311
|
}
|
|
52257
|
-
const
|
|
52258
|
-
if (
|
|
52312
|
+
const path44 = getPathname(req);
|
|
52313
|
+
if (path44 == null) {
|
|
52259
52314
|
return done(layerError);
|
|
52260
52315
|
}
|
|
52261
52316
|
let layer;
|
|
@@ -52263,7 +52318,7 @@ var require_router = __commonJS({
|
|
|
52263
52318
|
let route;
|
|
52264
52319
|
while (match !== true && idx < stack.length) {
|
|
52265
52320
|
layer = stack[idx++];
|
|
52266
|
-
match = matchLayer(layer,
|
|
52321
|
+
match = matchLayer(layer, path44);
|
|
52267
52322
|
route = layer.route;
|
|
52268
52323
|
if (typeof match !== "boolean") {
|
|
52269
52324
|
layerError = layerError || match;
|
|
@@ -52301,18 +52356,18 @@ var require_router = __commonJS({
|
|
|
52301
52356
|
} else if (route) {
|
|
52302
52357
|
layer.handleRequest(req, res, next);
|
|
52303
52358
|
} else {
|
|
52304
|
-
trimPrefix(layer, layerError, layerPath,
|
|
52359
|
+
trimPrefix(layer, layerError, layerPath, path44);
|
|
52305
52360
|
}
|
|
52306
52361
|
sync = 0;
|
|
52307
52362
|
});
|
|
52308
52363
|
}
|
|
52309
|
-
function trimPrefix(layer, layerError, layerPath,
|
|
52364
|
+
function trimPrefix(layer, layerError, layerPath, path44) {
|
|
52310
52365
|
if (layerPath.length !== 0) {
|
|
52311
|
-
if (layerPath !==
|
|
52366
|
+
if (layerPath !== path44.substring(0, layerPath.length)) {
|
|
52312
52367
|
next(layerError);
|
|
52313
52368
|
return;
|
|
52314
52369
|
}
|
|
52315
|
-
const c =
|
|
52370
|
+
const c = path44[layerPath.length];
|
|
52316
52371
|
if (c && c !== "/") {
|
|
52317
52372
|
next(layerError);
|
|
52318
52373
|
return;
|
|
@@ -52336,7 +52391,7 @@ var require_router = __commonJS({
|
|
|
52336
52391
|
};
|
|
52337
52392
|
Router.prototype.use = function use(handler) {
|
|
52338
52393
|
let offset = 0;
|
|
52339
|
-
let
|
|
52394
|
+
let path44 = "/";
|
|
52340
52395
|
if (typeof handler !== "function") {
|
|
52341
52396
|
let arg = handler;
|
|
52342
52397
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -52344,7 +52399,7 @@ var require_router = __commonJS({
|
|
|
52344
52399
|
}
|
|
52345
52400
|
if (typeof arg !== "function") {
|
|
52346
52401
|
offset = 1;
|
|
52347
|
-
|
|
52402
|
+
path44 = handler;
|
|
52348
52403
|
}
|
|
52349
52404
|
}
|
|
52350
52405
|
const callbacks = flatten.call(slice.call(arguments, offset), Infinity);
|
|
@@ -52356,8 +52411,8 @@ var require_router = __commonJS({
|
|
|
52356
52411
|
if (typeof fn !== "function") {
|
|
52357
52412
|
throw new TypeError("argument handler must be a function");
|
|
52358
52413
|
}
|
|
52359
|
-
debug("use %o %s",
|
|
52360
|
-
const layer = new Layer(
|
|
52414
|
+
debug("use %o %s", path44, fn.name || "<anonymous>");
|
|
52415
|
+
const layer = new Layer(path44, {
|
|
52361
52416
|
sensitive: this.caseSensitive,
|
|
52362
52417
|
strict: false,
|
|
52363
52418
|
end: false
|
|
@@ -52367,9 +52422,9 @@ var require_router = __commonJS({
|
|
|
52367
52422
|
}
|
|
52368
52423
|
return this;
|
|
52369
52424
|
};
|
|
52370
|
-
Router.prototype.route = function route(
|
|
52371
|
-
const route2 = new Route(
|
|
52372
|
-
const layer = new Layer(
|
|
52425
|
+
Router.prototype.route = function route(path44) {
|
|
52426
|
+
const route2 = new Route(path44);
|
|
52427
|
+
const layer = new Layer(path44, {
|
|
52373
52428
|
sensitive: this.caseSensitive,
|
|
52374
52429
|
strict: this.strict,
|
|
52375
52430
|
end: true
|
|
@@ -52382,8 +52437,8 @@ var require_router = __commonJS({
|
|
|
52382
52437
|
return route2;
|
|
52383
52438
|
};
|
|
52384
52439
|
methods.concat("all").forEach(function(method) {
|
|
52385
|
-
Router.prototype[method] = function(
|
|
52386
|
-
const route = this.route(
|
|
52440
|
+
Router.prototype[method] = function(path44) {
|
|
52441
|
+
const route = this.route(path44);
|
|
52387
52442
|
route[method].apply(route, slice.call(arguments, 1));
|
|
52388
52443
|
return this;
|
|
52389
52444
|
};
|
|
@@ -52412,9 +52467,9 @@ var require_router = __commonJS({
|
|
|
52412
52467
|
const fqdnIndex = url.substring(0, pathLength).indexOf("://");
|
|
52413
52468
|
return fqdnIndex !== -1 ? url.substring(0, url.indexOf("/", 3 + fqdnIndex)) : void 0;
|
|
52414
52469
|
}
|
|
52415
|
-
function matchLayer(layer,
|
|
52470
|
+
function matchLayer(layer, path44) {
|
|
52416
52471
|
try {
|
|
52417
|
-
return layer.match(
|
|
52472
|
+
return layer.match(path44);
|
|
52418
52473
|
} catch (err) {
|
|
52419
52474
|
return err;
|
|
52420
52475
|
}
|
|
@@ -52642,7 +52697,7 @@ var require_application = __commonJS({
|
|
|
52642
52697
|
};
|
|
52643
52698
|
app.use = function use(fn) {
|
|
52644
52699
|
var offset = 0;
|
|
52645
|
-
var
|
|
52700
|
+
var path44 = "/";
|
|
52646
52701
|
if (typeof fn !== "function") {
|
|
52647
52702
|
var arg = fn;
|
|
52648
52703
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -52650,7 +52705,7 @@ var require_application = __commonJS({
|
|
|
52650
52705
|
}
|
|
52651
52706
|
if (typeof arg !== "function") {
|
|
52652
52707
|
offset = 1;
|
|
52653
|
-
|
|
52708
|
+
path44 = fn;
|
|
52654
52709
|
}
|
|
52655
52710
|
}
|
|
52656
52711
|
var fns = flatten.call(slice.call(arguments, offset), Infinity);
|
|
@@ -52660,12 +52715,12 @@ var require_application = __commonJS({
|
|
|
52660
52715
|
var router = this.router;
|
|
52661
52716
|
fns.forEach(function(fn2) {
|
|
52662
52717
|
if (!fn2 || !fn2.handle || !fn2.set) {
|
|
52663
|
-
return router.use(
|
|
52718
|
+
return router.use(path44, fn2);
|
|
52664
52719
|
}
|
|
52665
|
-
debug(".use app under %s",
|
|
52666
|
-
fn2.mountpath =
|
|
52720
|
+
debug(".use app under %s", path44);
|
|
52721
|
+
fn2.mountpath = path44;
|
|
52667
52722
|
fn2.parent = this;
|
|
52668
|
-
router.use(
|
|
52723
|
+
router.use(path44, function mounted_app(req, res, next) {
|
|
52669
52724
|
var orig = req.app;
|
|
52670
52725
|
fn2.handle(req, res, function(err) {
|
|
52671
52726
|
Object.setPrototypeOf(req, orig.request);
|
|
@@ -52677,8 +52732,8 @@ var require_application = __commonJS({
|
|
|
52677
52732
|
}, this);
|
|
52678
52733
|
return this;
|
|
52679
52734
|
};
|
|
52680
|
-
app.route = function route(
|
|
52681
|
-
return this.router.route(
|
|
52735
|
+
app.route = function route(path44) {
|
|
52736
|
+
return this.router.route(path44);
|
|
52682
52737
|
};
|
|
52683
52738
|
app.engine = function engine(ext, fn) {
|
|
52684
52739
|
if (typeof fn !== "function") {
|
|
@@ -52721,7 +52776,7 @@ var require_application = __commonJS({
|
|
|
52721
52776
|
}
|
|
52722
52777
|
return this;
|
|
52723
52778
|
};
|
|
52724
|
-
app.path = function
|
|
52779
|
+
app.path = function path44() {
|
|
52725
52780
|
return this.parent ? this.parent.path() + this.mountpath : "";
|
|
52726
52781
|
};
|
|
52727
52782
|
app.enabled = function enabled(setting) {
|
|
@@ -52737,17 +52792,17 @@ var require_application = __commonJS({
|
|
|
52737
52792
|
return this.set(setting, false);
|
|
52738
52793
|
};
|
|
52739
52794
|
methods.forEach(function(method) {
|
|
52740
|
-
app[method] = function(
|
|
52795
|
+
app[method] = function(path44) {
|
|
52741
52796
|
if (method === "get" && arguments.length === 1) {
|
|
52742
|
-
return this.set(
|
|
52797
|
+
return this.set(path44);
|
|
52743
52798
|
}
|
|
52744
|
-
var route = this.route(
|
|
52799
|
+
var route = this.route(path44);
|
|
52745
52800
|
route[method].apply(route, slice.call(arguments, 1));
|
|
52746
52801
|
return this;
|
|
52747
52802
|
};
|
|
52748
52803
|
});
|
|
52749
|
-
app.all = function all(
|
|
52750
|
-
var route = this.route(
|
|
52804
|
+
app.all = function all(path44) {
|
|
52805
|
+
var route = this.route(path44);
|
|
52751
52806
|
var args = slice.call(arguments, 1);
|
|
52752
52807
|
for (var i = 0; i < methods.length; i++) {
|
|
52753
52808
|
route[methods[i]].apply(route, args);
|
|
@@ -62781,11 +62836,11 @@ var require_mime_types3 = __commonJS({
|
|
|
62781
62836
|
}
|
|
62782
62837
|
return exts[0];
|
|
62783
62838
|
}
|
|
62784
|
-
function lookup(
|
|
62785
|
-
if (!
|
|
62839
|
+
function lookup(path44) {
|
|
62840
|
+
if (!path44 || typeof path44 !== "string") {
|
|
62786
62841
|
return false;
|
|
62787
62842
|
}
|
|
62788
|
-
var extension2 = extname2("x." +
|
|
62843
|
+
var extension2 = extname2("x." + path44).toLowerCase().slice(1);
|
|
62789
62844
|
if (!extension2) {
|
|
62790
62845
|
return false;
|
|
62791
62846
|
}
|
|
@@ -63074,7 +63129,7 @@ var require_request = __commonJS({
|
|
|
63074
63129
|
var http = require("node:http");
|
|
63075
63130
|
var fresh = require_fresh();
|
|
63076
63131
|
var parseRange = require_range_parser();
|
|
63077
|
-
var
|
|
63132
|
+
var parse16 = require_parseurl();
|
|
63078
63133
|
var proxyaddr = require_proxy_addr();
|
|
63079
63134
|
var req = Object.create(http.IncomingMessage.prototype);
|
|
63080
63135
|
module2.exports = req;
|
|
@@ -63119,7 +63174,7 @@ var require_request = __commonJS({
|
|
|
63119
63174
|
if (!queryparse) {
|
|
63120
63175
|
return /* @__PURE__ */ Object.create(null);
|
|
63121
63176
|
}
|
|
63122
|
-
var querystring =
|
|
63177
|
+
var querystring = parse16(this).query;
|
|
63123
63178
|
return queryparse(querystring);
|
|
63124
63179
|
});
|
|
63125
63180
|
req.is = function is(types) {
|
|
@@ -63162,8 +63217,8 @@ var require_request = __commonJS({
|
|
|
63162
63217
|
var subdomains2 = !isIP(hostname) ? hostname.split(".").reverse() : [hostname];
|
|
63163
63218
|
return subdomains2.slice(offset);
|
|
63164
63219
|
});
|
|
63165
|
-
defineGetter(req, "path", function
|
|
63166
|
-
return
|
|
63220
|
+
defineGetter(req, "path", function path44() {
|
|
63221
|
+
return parse16(this).pathname;
|
|
63167
63222
|
});
|
|
63168
63223
|
defineGetter(req, "host", function host() {
|
|
63169
63224
|
var trust = this.app.get("trust proxy fn");
|
|
@@ -63217,7 +63272,7 @@ var require_content_disposition = __commonJS({
|
|
|
63217
63272
|
"../../node_modules/content-disposition/index.js"(exports2, module2) {
|
|
63218
63273
|
"use strict";
|
|
63219
63274
|
module2.exports = contentDisposition;
|
|
63220
|
-
module2.exports.parse =
|
|
63275
|
+
module2.exports.parse = parse16;
|
|
63221
63276
|
var basename5 = require("path").basename;
|
|
63222
63277
|
var ENCODE_URL_ATTR_CHAR_REGEXP = /[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g;
|
|
63223
63278
|
var HEX_ESCAPE_REGEXP = /%[0-9A-Fa-f]{2}/;
|
|
@@ -63308,7 +63363,7 @@ var require_content_disposition = __commonJS({
|
|
|
63308
63363
|
function getlatin1(val) {
|
|
63309
63364
|
return String(val).replace(NON_LATIN1_REGEXP, "?");
|
|
63310
63365
|
}
|
|
63311
|
-
function
|
|
63366
|
+
function parse16(string) {
|
|
63312
63367
|
if (!string || typeof string !== "string") {
|
|
63313
63368
|
throw new TypeError("argument string is required");
|
|
63314
63369
|
}
|
|
@@ -63397,7 +63452,7 @@ var require_cookie_signature = __commonJS({
|
|
|
63397
63452
|
var require_cookie = __commonJS({
|
|
63398
63453
|
"../../node_modules/cookie/index.js"(exports2) {
|
|
63399
63454
|
"use strict";
|
|
63400
|
-
exports2.parse =
|
|
63455
|
+
exports2.parse = parse16;
|
|
63401
63456
|
exports2.serialize = serialize;
|
|
63402
63457
|
var __toString = Object.prototype.toString;
|
|
63403
63458
|
var __hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
@@ -63405,7 +63460,7 @@ var require_cookie = __commonJS({
|
|
|
63405
63460
|
var cookieValueRegExp = /^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/;
|
|
63406
63461
|
var domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
|
|
63407
63462
|
var pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
|
|
63408
|
-
function
|
|
63463
|
+
function parse16(str2, opt) {
|
|
63409
63464
|
if (typeof str2 !== "string") {
|
|
63410
63465
|
throw new TypeError("argument str must be a string");
|
|
63411
63466
|
}
|
|
@@ -73015,11 +73070,11 @@ var require_mime_types4 = __commonJS({
|
|
|
73015
73070
|
}
|
|
73016
73071
|
return exts[0];
|
|
73017
73072
|
}
|
|
73018
|
-
function lookup(
|
|
73019
|
-
if (!
|
|
73073
|
+
function lookup(path44) {
|
|
73074
|
+
if (!path44 || typeof path44 !== "string") {
|
|
73020
73075
|
return false;
|
|
73021
73076
|
}
|
|
73022
|
-
var extension2 = extname2("x." +
|
|
73077
|
+
var extension2 = extname2("x." + path44).toLowerCase().slice(1);
|
|
73023
73078
|
if (!extension2) {
|
|
73024
73079
|
return false;
|
|
73025
73080
|
}
|
|
@@ -73074,32 +73129,32 @@ var require_send = __commonJS({
|
|
|
73074
73129
|
var escapeHtml = require_escape_html();
|
|
73075
73130
|
var etag = require_etag();
|
|
73076
73131
|
var fresh = require_fresh();
|
|
73077
|
-
var
|
|
73132
|
+
var fs27 = require("fs");
|
|
73078
73133
|
var mime = require_mime_types4();
|
|
73079
73134
|
var ms = require_ms();
|
|
73080
73135
|
var onFinished = require_on_finished();
|
|
73081
73136
|
var parseRange = require_range_parser();
|
|
73082
|
-
var
|
|
73137
|
+
var path44 = require("path");
|
|
73083
73138
|
var statuses = require_statuses();
|
|
73084
73139
|
var Stream = require("stream");
|
|
73085
73140
|
var util = require("util");
|
|
73086
|
-
var extname2 =
|
|
73087
|
-
var
|
|
73088
|
-
var normalize =
|
|
73089
|
-
var resolve6 =
|
|
73090
|
-
var sep =
|
|
73141
|
+
var extname2 = path44.extname;
|
|
73142
|
+
var join39 = path44.join;
|
|
73143
|
+
var normalize = path44.normalize;
|
|
73144
|
+
var resolve6 = path44.resolve;
|
|
73145
|
+
var sep = path44.sep;
|
|
73091
73146
|
var BYTES_RANGE_REGEXP = /^ *bytes=/;
|
|
73092
73147
|
var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
|
|
73093
73148
|
var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
|
|
73094
73149
|
module2.exports = send;
|
|
73095
|
-
function send(req,
|
|
73096
|
-
return new SendStream(req,
|
|
73150
|
+
function send(req, path45, options) {
|
|
73151
|
+
return new SendStream(req, path45, options);
|
|
73097
73152
|
}
|
|
73098
|
-
function SendStream(req,
|
|
73153
|
+
function SendStream(req, path45, options) {
|
|
73099
73154
|
Stream.call(this);
|
|
73100
73155
|
var opts = options || {};
|
|
73101
73156
|
this.options = opts;
|
|
73102
|
-
this.path =
|
|
73157
|
+
this.path = path45;
|
|
73103
73158
|
this.req = req;
|
|
73104
73159
|
this._acceptRanges = opts.acceptRanges !== void 0 ? Boolean(opts.acceptRanges) : true;
|
|
73105
73160
|
this._cacheControl = opts.cacheControl !== void 0 ? Boolean(opts.cacheControl) : true;
|
|
@@ -73213,10 +73268,10 @@ var require_send = __commonJS({
|
|
|
73213
73268
|
var lastModified = this.res.getHeader("Last-Modified");
|
|
73214
73269
|
return parseHttpDate(lastModified) <= parseHttpDate(ifRange);
|
|
73215
73270
|
};
|
|
73216
|
-
SendStream.prototype.redirect = function redirect(
|
|
73271
|
+
SendStream.prototype.redirect = function redirect(path45) {
|
|
73217
73272
|
var res = this.res;
|
|
73218
73273
|
if (hasListeners(this, "directory")) {
|
|
73219
|
-
this.emit("directory", res,
|
|
73274
|
+
this.emit("directory", res, path45);
|
|
73220
73275
|
return;
|
|
73221
73276
|
}
|
|
73222
73277
|
if (this.hasTrailingSlash()) {
|
|
@@ -73236,38 +73291,38 @@ var require_send = __commonJS({
|
|
|
73236
73291
|
SendStream.prototype.pipe = function pipe(res) {
|
|
73237
73292
|
var root = this._root;
|
|
73238
73293
|
this.res = res;
|
|
73239
|
-
var
|
|
73240
|
-
if (
|
|
73294
|
+
var path45 = decode(this.path);
|
|
73295
|
+
if (path45 === -1) {
|
|
73241
73296
|
this.error(400);
|
|
73242
73297
|
return res;
|
|
73243
73298
|
}
|
|
73244
|
-
if (~
|
|
73299
|
+
if (~path45.indexOf("\0")) {
|
|
73245
73300
|
this.error(400);
|
|
73246
73301
|
return res;
|
|
73247
73302
|
}
|
|
73248
73303
|
var parts;
|
|
73249
73304
|
if (root !== null) {
|
|
73250
|
-
if (
|
|
73251
|
-
|
|
73305
|
+
if (path45) {
|
|
73306
|
+
path45 = normalize("." + sep + path45);
|
|
73252
73307
|
}
|
|
73253
|
-
if (UP_PATH_REGEXP.test(
|
|
73254
|
-
debug('malicious path "%s"',
|
|
73308
|
+
if (UP_PATH_REGEXP.test(path45)) {
|
|
73309
|
+
debug('malicious path "%s"', path45);
|
|
73255
73310
|
this.error(403);
|
|
73256
73311
|
return res;
|
|
73257
73312
|
}
|
|
73258
|
-
parts =
|
|
73259
|
-
|
|
73313
|
+
parts = path45.split(sep);
|
|
73314
|
+
path45 = normalize(join39(root, path45));
|
|
73260
73315
|
} else {
|
|
73261
|
-
if (UP_PATH_REGEXP.test(
|
|
73262
|
-
debug('malicious path "%s"',
|
|
73316
|
+
if (UP_PATH_REGEXP.test(path45)) {
|
|
73317
|
+
debug('malicious path "%s"', path45);
|
|
73263
73318
|
this.error(403);
|
|
73264
73319
|
return res;
|
|
73265
73320
|
}
|
|
73266
|
-
parts = normalize(
|
|
73267
|
-
|
|
73321
|
+
parts = normalize(path45).split(sep);
|
|
73322
|
+
path45 = resolve6(path45);
|
|
73268
73323
|
}
|
|
73269
73324
|
if (containsDotFile(parts)) {
|
|
73270
|
-
debug('%s dotfile "%s"', this._dotfiles,
|
|
73325
|
+
debug('%s dotfile "%s"', this._dotfiles, path45);
|
|
73271
73326
|
switch (this._dotfiles) {
|
|
73272
73327
|
case "allow":
|
|
73273
73328
|
break;
|
|
@@ -73281,13 +73336,13 @@ var require_send = __commonJS({
|
|
|
73281
73336
|
}
|
|
73282
73337
|
}
|
|
73283
73338
|
if (this._index.length && this.hasTrailingSlash()) {
|
|
73284
|
-
this.sendIndex(
|
|
73339
|
+
this.sendIndex(path45);
|
|
73285
73340
|
return res;
|
|
73286
73341
|
}
|
|
73287
|
-
this.sendFile(
|
|
73342
|
+
this.sendFile(path45);
|
|
73288
73343
|
return res;
|
|
73289
73344
|
};
|
|
73290
|
-
SendStream.prototype.send = function send2(
|
|
73345
|
+
SendStream.prototype.send = function send2(path45, stat) {
|
|
73291
73346
|
var len = stat.size;
|
|
73292
73347
|
var options = this.options;
|
|
73293
73348
|
var opts = {};
|
|
@@ -73299,9 +73354,9 @@ var require_send = __commonJS({
|
|
|
73299
73354
|
this.headersAlreadySent();
|
|
73300
73355
|
return;
|
|
73301
73356
|
}
|
|
73302
|
-
debug('pipe "%s"',
|
|
73303
|
-
this.setHeader(
|
|
73304
|
-
this.type(
|
|
73357
|
+
debug('pipe "%s"', path45);
|
|
73358
|
+
this.setHeader(path45, stat);
|
|
73359
|
+
this.type(path45);
|
|
73305
73360
|
if (this.isConditionalGET()) {
|
|
73306
73361
|
if (this.isPreconditionFailure()) {
|
|
73307
73362
|
this.error(412);
|
|
@@ -73350,30 +73405,30 @@ var require_send = __commonJS({
|
|
|
73350
73405
|
res.end();
|
|
73351
73406
|
return;
|
|
73352
73407
|
}
|
|
73353
|
-
this.stream(
|
|
73408
|
+
this.stream(path45, opts);
|
|
73354
73409
|
};
|
|
73355
|
-
SendStream.prototype.sendFile = function sendFile(
|
|
73410
|
+
SendStream.prototype.sendFile = function sendFile(path45) {
|
|
73356
73411
|
var i = 0;
|
|
73357
73412
|
var self = this;
|
|
73358
|
-
debug('stat "%s"',
|
|
73359
|
-
|
|
73360
|
-
var pathEndsWithSep =
|
|
73361
|
-
if (err && err.code === "ENOENT" && !extname2(
|
|
73413
|
+
debug('stat "%s"', path45);
|
|
73414
|
+
fs27.stat(path45, function onstat(err, stat) {
|
|
73415
|
+
var pathEndsWithSep = path45[path45.length - 1] === sep;
|
|
73416
|
+
if (err && err.code === "ENOENT" && !extname2(path45) && !pathEndsWithSep) {
|
|
73362
73417
|
return next(err);
|
|
73363
73418
|
}
|
|
73364
73419
|
if (err) return self.onStatError(err);
|
|
73365
|
-
if (stat.isDirectory()) return self.redirect(
|
|
73420
|
+
if (stat.isDirectory()) return self.redirect(path45);
|
|
73366
73421
|
if (pathEndsWithSep) return self.error(404);
|
|
73367
|
-
self.emit("file",
|
|
73368
|
-
self.send(
|
|
73422
|
+
self.emit("file", path45, stat);
|
|
73423
|
+
self.send(path45, stat);
|
|
73369
73424
|
});
|
|
73370
73425
|
function next(err) {
|
|
73371
73426
|
if (self._extensions.length <= i) {
|
|
73372
73427
|
return err ? self.onStatError(err) : self.error(404);
|
|
73373
73428
|
}
|
|
73374
|
-
var p =
|
|
73429
|
+
var p = path45 + "." + self._extensions[i++];
|
|
73375
73430
|
debug('stat "%s"', p);
|
|
73376
|
-
|
|
73431
|
+
fs27.stat(p, function(err2, stat) {
|
|
73377
73432
|
if (err2) return next(err2);
|
|
73378
73433
|
if (stat.isDirectory()) return next();
|
|
73379
73434
|
self.emit("file", p, stat);
|
|
@@ -73381,7 +73436,7 @@ var require_send = __commonJS({
|
|
|
73381
73436
|
});
|
|
73382
73437
|
}
|
|
73383
73438
|
};
|
|
73384
|
-
SendStream.prototype.sendIndex = function sendIndex(
|
|
73439
|
+
SendStream.prototype.sendIndex = function sendIndex(path45) {
|
|
73385
73440
|
var i = -1;
|
|
73386
73441
|
var self = this;
|
|
73387
73442
|
function next(err) {
|
|
@@ -73389,9 +73444,9 @@ var require_send = __commonJS({
|
|
|
73389
73444
|
if (err) return self.onStatError(err);
|
|
73390
73445
|
return self.error(404);
|
|
73391
73446
|
}
|
|
73392
|
-
var p =
|
|
73447
|
+
var p = join39(path45, self._index[i]);
|
|
73393
73448
|
debug('stat "%s"', p);
|
|
73394
|
-
|
|
73449
|
+
fs27.stat(p, function(err2, stat) {
|
|
73395
73450
|
if (err2) return next(err2);
|
|
73396
73451
|
if (stat.isDirectory()) return next();
|
|
73397
73452
|
self.emit("file", p, stat);
|
|
@@ -73400,10 +73455,10 @@ var require_send = __commonJS({
|
|
|
73400
73455
|
}
|
|
73401
73456
|
next();
|
|
73402
73457
|
};
|
|
73403
|
-
SendStream.prototype.stream = function stream(
|
|
73458
|
+
SendStream.prototype.stream = function stream(path45, options) {
|
|
73404
73459
|
var self = this;
|
|
73405
73460
|
var res = this.res;
|
|
73406
|
-
var stream2 =
|
|
73461
|
+
var stream2 = fs27.createReadStream(path45, options);
|
|
73407
73462
|
this.emit("stream", stream2);
|
|
73408
73463
|
stream2.pipe(res);
|
|
73409
73464
|
function cleanup() {
|
|
@@ -73418,17 +73473,17 @@ var require_send = __commonJS({
|
|
|
73418
73473
|
self.emit("end");
|
|
73419
73474
|
});
|
|
73420
73475
|
};
|
|
73421
|
-
SendStream.prototype.type = function type(
|
|
73476
|
+
SendStream.prototype.type = function type(path45) {
|
|
73422
73477
|
var res = this.res;
|
|
73423
73478
|
if (res.getHeader("Content-Type")) return;
|
|
73424
|
-
var ext = extname2(
|
|
73479
|
+
var ext = extname2(path45);
|
|
73425
73480
|
var type2 = mime.contentType(ext) || "application/octet-stream";
|
|
73426
73481
|
debug("content-type %s", type2);
|
|
73427
73482
|
res.setHeader("Content-Type", type2);
|
|
73428
73483
|
};
|
|
73429
|
-
SendStream.prototype.setHeader = function setHeader(
|
|
73484
|
+
SendStream.prototype.setHeader = function setHeader(path45, stat) {
|
|
73430
73485
|
var res = this.res;
|
|
73431
|
-
this.emit("headers", res,
|
|
73486
|
+
this.emit("headers", res, path45, stat);
|
|
73432
73487
|
if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
|
|
73433
73488
|
debug("accept ranges");
|
|
73434
73489
|
res.setHeader("Accept-Ranges", "bytes");
|
|
@@ -73486,9 +73541,9 @@ var require_send = __commonJS({
|
|
|
73486
73541
|
}
|
|
73487
73542
|
return err instanceof Error ? createError(status, err, { expose: false }) : createError(status, err);
|
|
73488
73543
|
}
|
|
73489
|
-
function decode(
|
|
73544
|
+
function decode(path45) {
|
|
73490
73545
|
try {
|
|
73491
|
-
return decodeURIComponent(
|
|
73546
|
+
return decodeURIComponent(path45);
|
|
73492
73547
|
} catch (err) {
|
|
73493
73548
|
return -1;
|
|
73494
73549
|
}
|
|
@@ -73561,7 +73616,7 @@ var require_vary = __commonJS({
|
|
|
73561
73616
|
if (!field) {
|
|
73562
73617
|
throw new TypeError("field argument is required");
|
|
73563
73618
|
}
|
|
73564
|
-
var fields = !Array.isArray(field) ?
|
|
73619
|
+
var fields = !Array.isArray(field) ? parse16(String(field)) : field;
|
|
73565
73620
|
for (var j = 0; j < fields.length; j++) {
|
|
73566
73621
|
if (!FIELD_NAME_REGEXP.test(fields[j])) {
|
|
73567
73622
|
throw new TypeError("field argument contains an invalid header name");
|
|
@@ -73571,7 +73626,7 @@ var require_vary = __commonJS({
|
|
|
73571
73626
|
return header;
|
|
73572
73627
|
}
|
|
73573
73628
|
var val = header;
|
|
73574
|
-
var vals =
|
|
73629
|
+
var vals = parse16(header.toLowerCase());
|
|
73575
73630
|
if (fields.indexOf("*") !== -1 || vals.indexOf("*") !== -1) {
|
|
73576
73631
|
return "*";
|
|
73577
73632
|
}
|
|
@@ -73584,7 +73639,7 @@ var require_vary = __commonJS({
|
|
|
73584
73639
|
}
|
|
73585
73640
|
return val;
|
|
73586
73641
|
}
|
|
73587
|
-
function
|
|
73642
|
+
function parse16(header) {
|
|
73588
73643
|
var end = 0;
|
|
73589
73644
|
var list = [];
|
|
73590
73645
|
var start = 0;
|
|
@@ -73632,7 +73687,7 @@ var require_response = __commonJS({
|
|
|
73632
73687
|
var http = require("node:http");
|
|
73633
73688
|
var onFinished = require_on_finished();
|
|
73634
73689
|
var mime = require_mime_types2();
|
|
73635
|
-
var
|
|
73690
|
+
var path44 = require("node:path");
|
|
73636
73691
|
var pathIsAbsolute = require("node:path").isAbsolute;
|
|
73637
73692
|
var statuses = require_statuses();
|
|
73638
73693
|
var sign = require_cookie_signature().sign;
|
|
@@ -73641,8 +73696,8 @@ var require_response = __commonJS({
|
|
|
73641
73696
|
var setCharset = require_utils3().setCharset;
|
|
73642
73697
|
var cookie = require_cookie();
|
|
73643
73698
|
var send = require_send();
|
|
73644
|
-
var extname2 =
|
|
73645
|
-
var resolve6 =
|
|
73699
|
+
var extname2 = path44.extname;
|
|
73700
|
+
var resolve6 = path44.resolve;
|
|
73646
73701
|
var vary = require_vary();
|
|
73647
73702
|
var { Buffer: Buffer2 } = require("node:buffer");
|
|
73648
73703
|
var res = Object.create(http.ServerResponse.prototype);
|
|
@@ -73788,26 +73843,26 @@ var require_response = __commonJS({
|
|
|
73788
73843
|
this.type("txt");
|
|
73789
73844
|
return this.send(body);
|
|
73790
73845
|
};
|
|
73791
|
-
res.sendFile = function sendFile(
|
|
73846
|
+
res.sendFile = function sendFile(path45, options, callback) {
|
|
73792
73847
|
var done = callback;
|
|
73793
73848
|
var req = this.req;
|
|
73794
73849
|
var res2 = this;
|
|
73795
73850
|
var next = req.next;
|
|
73796
73851
|
var opts = options || {};
|
|
73797
|
-
if (!
|
|
73852
|
+
if (!path45) {
|
|
73798
73853
|
throw new TypeError("path argument is required to res.sendFile");
|
|
73799
73854
|
}
|
|
73800
|
-
if (typeof
|
|
73855
|
+
if (typeof path45 !== "string") {
|
|
73801
73856
|
throw new TypeError("path must be a string to res.sendFile");
|
|
73802
73857
|
}
|
|
73803
73858
|
if (typeof options === "function") {
|
|
73804
73859
|
done = options;
|
|
73805
73860
|
opts = {};
|
|
73806
73861
|
}
|
|
73807
|
-
if (!opts.root && !pathIsAbsolute(
|
|
73862
|
+
if (!opts.root && !pathIsAbsolute(path45)) {
|
|
73808
73863
|
throw new TypeError("path must be absolute or specify root to res.sendFile");
|
|
73809
73864
|
}
|
|
73810
|
-
var pathname = encodeURI(
|
|
73865
|
+
var pathname = encodeURI(path45);
|
|
73811
73866
|
opts.etag = this.app.enabled("etag");
|
|
73812
73867
|
var file = send(req, pathname, opts);
|
|
73813
73868
|
sendfile(res2, file, opts, function(err) {
|
|
@@ -73818,7 +73873,7 @@ var require_response = __commonJS({
|
|
|
73818
73873
|
}
|
|
73819
73874
|
});
|
|
73820
73875
|
};
|
|
73821
|
-
res.download = function download(
|
|
73876
|
+
res.download = function download(path45, filename, options, callback) {
|
|
73822
73877
|
var done = callback;
|
|
73823
73878
|
var name = filename;
|
|
73824
73879
|
var opts = options || null;
|
|
@@ -73835,7 +73890,7 @@ var require_response = __commonJS({
|
|
|
73835
73890
|
opts = filename;
|
|
73836
73891
|
}
|
|
73837
73892
|
var headers = {
|
|
73838
|
-
"Content-Disposition": contentDisposition(name ||
|
|
73893
|
+
"Content-Disposition": contentDisposition(name || path45)
|
|
73839
73894
|
};
|
|
73840
73895
|
if (opts && opts.headers) {
|
|
73841
73896
|
var keys = Object.keys(opts.headers);
|
|
@@ -73848,7 +73903,7 @@ var require_response = __commonJS({
|
|
|
73848
73903
|
}
|
|
73849
73904
|
opts = Object.create(opts);
|
|
73850
73905
|
opts.headers = headers;
|
|
73851
|
-
var fullPath = !opts.root ? resolve6(
|
|
73906
|
+
var fullPath = !opts.root ? resolve6(path45) : path45;
|
|
73852
73907
|
return this.sendFile(fullPath, opts, done);
|
|
73853
73908
|
};
|
|
73854
73909
|
res.contentType = res.type = function contentType(type) {
|
|
@@ -74131,11 +74186,11 @@ var require_serve_static = __commonJS({
|
|
|
74131
74186
|
}
|
|
74132
74187
|
var forwardError = !fallthrough;
|
|
74133
74188
|
var originalUrl = parseUrl.original(req);
|
|
74134
|
-
var
|
|
74135
|
-
if (
|
|
74136
|
-
|
|
74189
|
+
var path44 = parseUrl(req).pathname;
|
|
74190
|
+
if (path44 === "/" && originalUrl.pathname.substr(-1) !== "/") {
|
|
74191
|
+
path44 = "";
|
|
74137
74192
|
}
|
|
74138
|
-
var stream = send(req,
|
|
74193
|
+
var stream = send(req, path44, opts);
|
|
74139
74194
|
stream.on("directory", onDirectory);
|
|
74140
74195
|
if (setHeaders) {
|
|
74141
74196
|
stream.on("headers", setHeaders);
|
|
@@ -75088,7 +75143,7 @@ var require_api = __commonJS({
|
|
|
75088
75143
|
})();
|
|
75089
75144
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
75090
75145
|
exports2.createApiRouter = createApiRouter;
|
|
75091
|
-
var
|
|
75146
|
+
var path44 = __importStar(require("path"));
|
|
75092
75147
|
var os3 = __importStar(require("os"));
|
|
75093
75148
|
var child_process_1 = require("child_process");
|
|
75094
75149
|
var express_1 = require_express2();
|
|
@@ -75106,11 +75161,11 @@ var require_api = __commonJS({
|
|
|
75106
75161
|
return deps2.runner.run(cmd, args, {
|
|
75107
75162
|
...opts,
|
|
75108
75163
|
cwd: opts?.cwd ?? deps2.repoRoot,
|
|
75109
|
-
env: { SOPS_CONFIG:
|
|
75164
|
+
env: { SOPS_CONFIG: path44.join(deps2.repoRoot, ".sops.yaml"), ...opts?.env }
|
|
75110
75165
|
});
|
|
75111
75166
|
}
|
|
75112
|
-
const fifoDir = (0, child_process_1.execFileSync)("mktemp", ["-d",
|
|
75113
|
-
const fifoPath =
|
|
75167
|
+
const fifoDir = (0, child_process_1.execFileSync)("mktemp", ["-d", path44.join(os3.tmpdir(), "clef-fifo-XXXXXX")]).toString().trim();
|
|
75168
|
+
const fifoPath = path44.join(fifoDir, "input");
|
|
75114
75169
|
(0, child_process_1.execFileSync)("mkfifo", [fifoPath]);
|
|
75115
75170
|
const writer = (0, child_process_1.spawn)("dd", [`of=${fifoPath}`, "status=none"], {
|
|
75116
75171
|
stdio: ["pipe", "ignore", "ignore"]
|
|
@@ -75123,7 +75178,7 @@ var require_api = __commonJS({
|
|
|
75123
75178
|
return deps2.runner.run(cmd, patchedArgs, {
|
|
75124
75179
|
...restOpts,
|
|
75125
75180
|
cwd: restOpts?.cwd ?? deps2.repoRoot,
|
|
75126
|
-
env: { SOPS_CONFIG:
|
|
75181
|
+
env: { SOPS_CONFIG: path44.join(deps2.repoRoot, ".sops.yaml"), ...restOpts?.env }
|
|
75127
75182
|
}).finally(() => {
|
|
75128
75183
|
try {
|
|
75129
75184
|
writer.kill();
|
|
@@ -75269,7 +75324,7 @@ var require_api = __commonJS({
|
|
|
75269
75324
|
const nsDef = manifest.namespaces.find((n) => n.name === ns);
|
|
75270
75325
|
if (nsDef?.schema) {
|
|
75271
75326
|
try {
|
|
75272
|
-
const schema = schemaValidator.loadSchema(
|
|
75327
|
+
const schema = schemaValidator.loadSchema(path44.join(deps2.repoRoot, nsDef.schema));
|
|
75273
75328
|
const result = schemaValidator.validate({ [key]: String(value) }, schema);
|
|
75274
75329
|
const violations = [...result.errors, ...result.warnings];
|
|
75275
75330
|
if (violations.length > 0) {
|
|
@@ -75533,8 +75588,8 @@ var require_api = __commonJS({
|
|
|
75533
75588
|
res.status(400).json({ error: "Request body must include a 'file' string.", code: "BAD_REQUEST" });
|
|
75534
75589
|
return;
|
|
75535
75590
|
}
|
|
75536
|
-
const resolved =
|
|
75537
|
-
if (!resolved.startsWith(deps2.repoRoot +
|
|
75591
|
+
const resolved = path44.resolve(deps2.repoRoot, file);
|
|
75592
|
+
if (!resolved.startsWith(deps2.repoRoot + path44.sep) && resolved !== deps2.repoRoot) {
|
|
75538
75593
|
res.status(400).json({
|
|
75539
75594
|
error: "File path must be within the repository.",
|
|
75540
75595
|
code: "BAD_REQUEST"
|
|
@@ -75776,7 +75831,7 @@ var require_server = __commonJS({
|
|
|
75776
75831
|
};
|
|
75777
75832
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
75778
75833
|
exports2.startServer = startServer;
|
|
75779
|
-
var
|
|
75834
|
+
var path44 = __importStar(require("path"));
|
|
75780
75835
|
var path_1 = require("path");
|
|
75781
75836
|
var crypto_1 = require("crypto");
|
|
75782
75837
|
var express_1 = __importDefault(require_express2());
|
|
@@ -75872,10 +75927,10 @@ var require_server = __commonJS({
|
|
|
75872
75927
|
mountSeaStaticRoutes(app, sea, staticLimiter);
|
|
75873
75928
|
}
|
|
75874
75929
|
if (!isSeaBinary) {
|
|
75875
|
-
const resolvedClientDir = clientDir ??
|
|
75930
|
+
const resolvedClientDir = clientDir ?? path44.resolve(__dirname, "../client");
|
|
75876
75931
|
app.use(staticLimiter, express_1.default.static(resolvedClientDir));
|
|
75877
75932
|
app.get("/{*splat}", staticLimiter, (_req, res) => {
|
|
75878
|
-
res.sendFile(
|
|
75933
|
+
res.sendFile(path44.join(resolvedClientDir, "index.html"));
|
|
75879
75934
|
});
|
|
75880
75935
|
}
|
|
75881
75936
|
const url = `http://127.0.0.1:${port}`;
|
|
@@ -76017,32 +76072,32 @@ var require_disk_cache = __commonJS({
|
|
|
76017
76072
|
})();
|
|
76018
76073
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
76019
76074
|
exports2.DiskCache = void 0;
|
|
76020
|
-
var
|
|
76021
|
-
var
|
|
76075
|
+
var fs27 = __importStar(require("fs"));
|
|
76076
|
+
var path44 = __importStar(require("path"));
|
|
76022
76077
|
var DiskCache = class {
|
|
76023
76078
|
artifactPath;
|
|
76024
76079
|
metaPath;
|
|
76025
76080
|
constructor(cachePath, identity, environment) {
|
|
76026
|
-
const dir =
|
|
76027
|
-
this.artifactPath =
|
|
76028
|
-
this.metaPath =
|
|
76081
|
+
const dir = path44.join(cachePath, identity);
|
|
76082
|
+
this.artifactPath = path44.join(dir, `${environment}.age.json`);
|
|
76083
|
+
this.metaPath = path44.join(dir, `${environment}.meta`);
|
|
76029
76084
|
}
|
|
76030
76085
|
/** Write an artifact and optional metadata to disk (atomic via tmp+rename). */
|
|
76031
76086
|
write(raw, sha) {
|
|
76032
|
-
const dir =
|
|
76033
|
-
|
|
76087
|
+
const dir = path44.dirname(this.artifactPath);
|
|
76088
|
+
fs27.mkdirSync(dir, { recursive: true });
|
|
76034
76089
|
const tmpArtifact = `${this.artifactPath}.tmp.${process.pid}`;
|
|
76035
|
-
|
|
76036
|
-
|
|
76090
|
+
fs27.writeFileSync(tmpArtifact, raw, "utf-8");
|
|
76091
|
+
fs27.renameSync(tmpArtifact, this.artifactPath);
|
|
76037
76092
|
const meta = { sha, fetchedAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
76038
76093
|
const tmpMeta = `${this.metaPath}.tmp.${process.pid}`;
|
|
76039
|
-
|
|
76040
|
-
|
|
76094
|
+
fs27.writeFileSync(tmpMeta, JSON.stringify(meta), "utf-8");
|
|
76095
|
+
fs27.renameSync(tmpMeta, this.metaPath);
|
|
76041
76096
|
}
|
|
76042
76097
|
/** Read the cached artifact. Returns null if no cache file exists. */
|
|
76043
76098
|
read() {
|
|
76044
76099
|
try {
|
|
76045
|
-
return
|
|
76100
|
+
return fs27.readFileSync(this.artifactPath, "utf-8");
|
|
76046
76101
|
} catch {
|
|
76047
76102
|
return null;
|
|
76048
76103
|
}
|
|
@@ -76050,7 +76105,7 @@ var require_disk_cache = __commonJS({
|
|
|
76050
76105
|
/** Get the SHA from the cached metadata, if available. */
|
|
76051
76106
|
getCachedSha() {
|
|
76052
76107
|
try {
|
|
76053
|
-
const raw =
|
|
76108
|
+
const raw = fs27.readFileSync(this.metaPath, "utf-8");
|
|
76054
76109
|
const meta = JSON.parse(raw);
|
|
76055
76110
|
return meta.sha;
|
|
76056
76111
|
} catch {
|
|
@@ -76060,7 +76115,7 @@ var require_disk_cache = __commonJS({
|
|
|
76060
76115
|
/** Get the fetchedAt timestamp from metadata, if available. */
|
|
76061
76116
|
getFetchedAt() {
|
|
76062
76117
|
try {
|
|
76063
|
-
const raw =
|
|
76118
|
+
const raw = fs27.readFileSync(this.metaPath, "utf-8");
|
|
76064
76119
|
const meta = JSON.parse(raw);
|
|
76065
76120
|
return meta.fetchedAt;
|
|
76066
76121
|
} catch {
|
|
@@ -76070,11 +76125,11 @@ var require_disk_cache = __commonJS({
|
|
|
76070
76125
|
/** Remove cached artifact and metadata files. */
|
|
76071
76126
|
purge() {
|
|
76072
76127
|
try {
|
|
76073
|
-
|
|
76128
|
+
fs27.unlinkSync(this.artifactPath);
|
|
76074
76129
|
} catch {
|
|
76075
76130
|
}
|
|
76076
76131
|
try {
|
|
76077
|
-
|
|
76132
|
+
fs27.unlinkSync(this.metaPath);
|
|
76078
76133
|
} catch {
|
|
76079
76134
|
}
|
|
76080
76135
|
}
|
|
@@ -76126,7 +76181,7 @@ var require_decrypt = __commonJS({
|
|
|
76126
76181
|
})();
|
|
76127
76182
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
76128
76183
|
exports2.AgeDecryptor = void 0;
|
|
76129
|
-
var
|
|
76184
|
+
var fs27 = __importStar(require("fs"));
|
|
76130
76185
|
var AgeDecryptor = class {
|
|
76131
76186
|
/**
|
|
76132
76187
|
* Decrypt an age-encrypted PEM-armored ciphertext string.
|
|
@@ -76139,9 +76194,7 @@ var require_decrypt = __commonJS({
|
|
|
76139
76194
|
const { Decrypter } = await Promise.resolve(`${"age-encryption"}`).then((s) => __importStar(require(s)));
|
|
76140
76195
|
const d = new Decrypter();
|
|
76141
76196
|
d.addIdentity(privateKey);
|
|
76142
|
-
|
|
76143
|
-
const input = isAgePem ? ciphertext : Buffer.from(ciphertext, "base64");
|
|
76144
|
-
return d.decrypt(input, "text");
|
|
76197
|
+
return d.decrypt(Buffer.from(ciphertext, "base64"), "text");
|
|
76145
76198
|
}
|
|
76146
76199
|
/**
|
|
76147
76200
|
* Resolve the age private key from either an inline value or a file path.
|
|
@@ -76154,7 +76207,7 @@ var require_decrypt = __commonJS({
|
|
|
76154
76207
|
if (ageKey)
|
|
76155
76208
|
return ageKey.trim();
|
|
76156
76209
|
if (ageKeyFile) {
|
|
76157
|
-
const content =
|
|
76210
|
+
const content = fs27.readFileSync(ageKeyFile, "utf-8").trim();
|
|
76158
76211
|
const lines = content.split("\n").filter((l) => l.startsWith("AGE-SECRET-KEY-"));
|
|
76159
76212
|
if (lines.length === 0) {
|
|
76160
76213
|
throw new Error(`No age secret key found in file: ${ageKeyFile}`);
|
|
@@ -76964,8 +77017,8 @@ var require_github = __commonJS({
|
|
|
76964
77017
|
this.ref = config.ref;
|
|
76965
77018
|
this.apiUrl = config.apiUrl ?? "https://api.github.com";
|
|
76966
77019
|
}
|
|
76967
|
-
async fetchFile(
|
|
76968
|
-
const url = new URL(`/repos/${this.repo}/contents/${
|
|
77020
|
+
async fetchFile(path44) {
|
|
77021
|
+
const url = new URL(`/repos/${this.repo}/contents/${path44}`, this.apiUrl);
|
|
76969
77022
|
if (this.ref)
|
|
76970
77023
|
url.searchParams.set("ref", this.ref);
|
|
76971
77024
|
const res = await fetch(url.toString(), {
|
|
@@ -76975,7 +77028,7 @@ var require_github = __commonJS({
|
|
|
76975
77028
|
}
|
|
76976
77029
|
});
|
|
76977
77030
|
if (!res.ok) {
|
|
76978
|
-
throw new Error(`GitHub API error: ${res.status} fetching ${
|
|
77031
|
+
throw new Error(`GitHub API error: ${res.status} fetching ${path44} from ${this.repo}`);
|
|
76979
77032
|
}
|
|
76980
77033
|
const data = await res.json();
|
|
76981
77034
|
const content = Buffer.from(data.content, "base64").toString("utf-8");
|
|
@@ -77003,9 +77056,9 @@ var require_gitlab = __commonJS({
|
|
|
77003
77056
|
this.ref = config.ref;
|
|
77004
77057
|
this.apiUrl = config.apiUrl ?? "https://gitlab.com";
|
|
77005
77058
|
}
|
|
77006
|
-
async fetchFile(
|
|
77059
|
+
async fetchFile(path44) {
|
|
77007
77060
|
const encodedRepo = encodeURIComponent(this.repo);
|
|
77008
|
-
const encodedPath = encodeURIComponent(
|
|
77061
|
+
const encodedPath = encodeURIComponent(path44);
|
|
77009
77062
|
const url = new URL(`/api/v4/projects/${encodedRepo}/repository/files/${encodedPath}`, this.apiUrl);
|
|
77010
77063
|
if (this.ref)
|
|
77011
77064
|
url.searchParams.set("ref", this.ref);
|
|
@@ -77015,7 +77068,7 @@ var require_gitlab = __commonJS({
|
|
|
77015
77068
|
}
|
|
77016
77069
|
});
|
|
77017
77070
|
if (!res.ok) {
|
|
77018
|
-
throw new Error(`GitLab API error: ${res.status} fetching ${
|
|
77071
|
+
throw new Error(`GitLab API error: ${res.status} fetching ${path44} from ${this.repo}`);
|
|
77019
77072
|
}
|
|
77020
77073
|
const data = await res.json();
|
|
77021
77074
|
const content = Buffer.from(data.content, "base64").toString("utf-8");
|
|
@@ -77043,8 +77096,8 @@ var require_bitbucket = __commonJS({
|
|
|
77043
77096
|
this.ref = config.ref ?? "main";
|
|
77044
77097
|
this.apiUrl = config.apiUrl ?? "https://api.bitbucket.org";
|
|
77045
77098
|
}
|
|
77046
|
-
async fetchFile(
|
|
77047
|
-
const baseUrl = `${this.apiUrl}/2.0/repositories/${this.repo}/src/${this.ref}/${
|
|
77099
|
+
async fetchFile(path44) {
|
|
77100
|
+
const baseUrl = `${this.apiUrl}/2.0/repositories/${this.repo}/src/${this.ref}/${path44}`;
|
|
77048
77101
|
const metaRes = await fetch(baseUrl, {
|
|
77049
77102
|
headers: {
|
|
77050
77103
|
Authorization: `Bearer ${this.token}`,
|
|
@@ -77052,7 +77105,7 @@ var require_bitbucket = __commonJS({
|
|
|
77052
77105
|
}
|
|
77053
77106
|
});
|
|
77054
77107
|
if (!metaRes.ok) {
|
|
77055
|
-
throw new Error(`Bitbucket API error: ${metaRes.status} fetching ${
|
|
77108
|
+
throw new Error(`Bitbucket API error: ${metaRes.status} fetching ${path44} from ${this.repo}`);
|
|
77056
77109
|
}
|
|
77057
77110
|
const meta = await metaRes.json();
|
|
77058
77111
|
const rawRes = await fetch(baseUrl, {
|
|
@@ -77061,7 +77114,7 @@ var require_bitbucket = __commonJS({
|
|
|
77061
77114
|
}
|
|
77062
77115
|
});
|
|
77063
77116
|
if (!rawRes.ok) {
|
|
77064
|
-
throw new Error(`Bitbucket API error: ${rawRes.status} fetching raw content of ${
|
|
77117
|
+
throw new Error(`Bitbucket API error: ${rawRes.status} fetching raw content of ${path44} from ${this.repo}`);
|
|
77065
77118
|
}
|
|
77066
77119
|
const content = await rawRes.text();
|
|
77067
77120
|
return { content, sha: meta.commit.hash };
|
|
@@ -77179,14 +77232,14 @@ var require_file = __commonJS({
|
|
|
77179
77232
|
})();
|
|
77180
77233
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
77181
77234
|
exports2.FileArtifactSource = void 0;
|
|
77182
|
-
var
|
|
77235
|
+
var fs27 = __importStar(require("fs"));
|
|
77183
77236
|
var FileArtifactSource = class {
|
|
77184
77237
|
path;
|
|
77185
77238
|
constructor(filePath) {
|
|
77186
77239
|
this.path = filePath;
|
|
77187
77240
|
}
|
|
77188
77241
|
async fetch() {
|
|
77189
|
-
const raw =
|
|
77242
|
+
const raw = fs27.readFileSync(this.path, "utf-8");
|
|
77190
77243
|
return { raw };
|
|
77191
77244
|
}
|
|
77192
77245
|
describe() {
|
|
@@ -77456,7 +77509,7 @@ var NodeSubprocessRunner = class {
|
|
|
77456
77509
|
var fs17 = __toESM(require("fs"));
|
|
77457
77510
|
var path19 = __toESM(require("path"));
|
|
77458
77511
|
var readline2 = __toESM(require("readline"));
|
|
77459
|
-
var
|
|
77512
|
+
var YAML12 = __toESM(require_dist());
|
|
77460
77513
|
init_src();
|
|
77461
77514
|
|
|
77462
77515
|
// src/output/formatter.ts
|
|
@@ -77803,11 +77856,15 @@ async function setDarwin(runner2, privateKey, account) {
|
|
|
77803
77856
|
await runner2.run("security", ["delete-generic-password", "-a", account, "-s", SERVICE]).catch(() => {
|
|
77804
77857
|
});
|
|
77805
77858
|
try {
|
|
77806
|
-
const result = await runner2.run(
|
|
77807
|
-
"
|
|
77808
|
-
|
|
77809
|
-
|
|
77810
|
-
|
|
77859
|
+
const result = await runner2.run("security", [
|
|
77860
|
+
"add-generic-password",
|
|
77861
|
+
"-a",
|
|
77862
|
+
account,
|
|
77863
|
+
"-s",
|
|
77864
|
+
SERVICE,
|
|
77865
|
+
"-w",
|
|
77866
|
+
privateKey
|
|
77867
|
+
]);
|
|
77811
77868
|
if (result.exitCode !== 0) return false;
|
|
77812
77869
|
const stored = await readDarwinRaw(runner2, account);
|
|
77813
77870
|
if (stored === privateKey) return true;
|
|
@@ -78181,7 +78238,7 @@ async function handleSecondDevOnboarding(repoRoot, clefConfigPath, deps2, option
|
|
|
78181
78238
|
if (!fs17.existsSync(clefDir)) {
|
|
78182
78239
|
fs17.mkdirSync(clefDir, { recursive: true });
|
|
78183
78240
|
}
|
|
78184
|
-
fs17.writeFileSync(clefConfigPath,
|
|
78241
|
+
fs17.writeFileSync(clefConfigPath, YAML12.stringify(config), "utf-8");
|
|
78185
78242
|
formatter.success("Created .clef/config.yaml");
|
|
78186
78243
|
const gitignorePath = path19.join(clefDir, ".gitignore");
|
|
78187
78244
|
if (!fs17.existsSync(gitignorePath)) {
|
|
@@ -78238,15 +78295,14 @@ async function handleFullSetup(repoRoot, manifestPath, clefConfigPath, deps2, op
|
|
|
78238
78295
|
};
|
|
78239
78296
|
const initParser = new ManifestParser();
|
|
78240
78297
|
initParser.validate(manifest);
|
|
78241
|
-
fs17.writeFileSync(manifestPath, YAML11.stringify(manifest), "utf-8");
|
|
78242
|
-
formatter.success("Created clef.yaml");
|
|
78243
78298
|
let ageKeyFile;
|
|
78244
78299
|
let ageKey;
|
|
78300
|
+
let publicKey;
|
|
78245
78301
|
if (backend === "age") {
|
|
78246
78302
|
const label = generateKeyLabel();
|
|
78247
78303
|
const identity = await generateAgeIdentity();
|
|
78248
78304
|
const privateKey = identity.privateKey;
|
|
78249
|
-
|
|
78305
|
+
publicKey = identity.publicKey;
|
|
78250
78306
|
const storedInKeychain = await setKeychainKey(deps2.runner, privateKey, label);
|
|
78251
78307
|
if (storedInKeychain) {
|
|
78252
78308
|
formatter.success("Stored age key in OS keychain");
|
|
@@ -78290,7 +78346,7 @@ async function handleFullSetup(repoRoot, manifestPath, clefConfigPath, deps2, op
|
|
|
78290
78346
|
fs17.mkdirSync(clefDir, { recursive: true });
|
|
78291
78347
|
}
|
|
78292
78348
|
const config = ageKeyFile ? { age_key_file: ageKeyFile, age_key_storage: "file", age_keychain_label: label } : { age_key_storage: "keychain", age_keychain_label: label };
|
|
78293
|
-
fs17.writeFileSync(clefConfigPath,
|
|
78349
|
+
fs17.writeFileSync(clefConfigPath, YAML12.stringify(config), "utf-8");
|
|
78294
78350
|
formatter.success("Created .clef/config.yaml");
|
|
78295
78351
|
const gitignorePath = path19.join(clefDir, ".gitignore");
|
|
78296
78352
|
if (!fs17.existsSync(gitignorePath)) {
|
|
@@ -78298,14 +78354,18 @@ async function handleFullSetup(repoRoot, manifestPath, clefConfigPath, deps2, op
|
|
|
78298
78354
|
formatter.success("Created .clef/.gitignore");
|
|
78299
78355
|
}
|
|
78300
78356
|
formatter.success(`Key label: ${label}`);
|
|
78357
|
+
}
|
|
78358
|
+
const manifestDoc = YAML12.parse(YAML12.stringify(manifest));
|
|
78359
|
+
if (backend === "age" && publicKey) {
|
|
78360
|
+
const sopsDoc = manifestDoc.sops;
|
|
78361
|
+
sopsDoc.age = { recipients: [publicKey] };
|
|
78362
|
+
}
|
|
78363
|
+
fs17.writeFileSync(manifestPath, YAML12.stringify(manifestDoc), "utf-8");
|
|
78364
|
+
formatter.success("Created clef.yaml");
|
|
78365
|
+
{
|
|
78301
78366
|
const sopsYamlPath = path19.join(repoRoot, ".sops.yaml");
|
|
78302
78367
|
const sopsConfig = buildSopsYaml(manifest, repoRoot, publicKey);
|
|
78303
|
-
fs17.writeFileSync(sopsYamlPath,
|
|
78304
|
-
formatter.success("Created .sops.yaml");
|
|
78305
|
-
} else {
|
|
78306
|
-
const sopsYamlPath = path19.join(repoRoot, ".sops.yaml");
|
|
78307
|
-
const sopsConfig = buildSopsYaml(manifest, repoRoot, void 0);
|
|
78308
|
-
fs17.writeFileSync(sopsYamlPath, YAML11.stringify(sopsConfig), "utf-8");
|
|
78368
|
+
fs17.writeFileSync(sopsYamlPath, YAML12.stringify(sopsConfig), "utf-8");
|
|
78309
78369
|
formatter.success("Created .sops.yaml");
|
|
78310
78370
|
}
|
|
78311
78371
|
const sopsClient = new SopsClient(deps2.runner, ageKeyFile, ageKey);
|
|
@@ -78395,7 +78455,7 @@ function scaffoldSopsConfig(repoRoot) {
|
|
|
78395
78455
|
agePublicKey = resolveAgePublicKeyFromEnvOrFile(repoRoot);
|
|
78396
78456
|
}
|
|
78397
78457
|
const sopsConfig = buildSopsYaml(manifest, repoRoot, agePublicKey);
|
|
78398
|
-
fs17.writeFileSync(sopsYamlPath,
|
|
78458
|
+
fs17.writeFileSync(sopsYamlPath, YAML12.stringify(sopsConfig), "utf-8");
|
|
78399
78459
|
}
|
|
78400
78460
|
function buildSopsYaml(manifest, _repoRoot, agePublicKey) {
|
|
78401
78461
|
const creationRules = [];
|
|
@@ -78461,7 +78521,7 @@ function resolveAgePublicKeyFromEnvOrFile(repoRoot) {
|
|
|
78461
78521
|
const clefConfigPath = path19.join(repoRoot, CLEF_DIR, CLEF_CONFIG_FILENAME);
|
|
78462
78522
|
if (fs17.existsSync(clefConfigPath)) {
|
|
78463
78523
|
try {
|
|
78464
|
-
const config =
|
|
78524
|
+
const config = YAML12.parse(fs17.readFileSync(clefConfigPath, "utf-8"));
|
|
78465
78525
|
if (config?.age_key_file) {
|
|
78466
78526
|
const pubKey = extractAgePublicKey(config.age_key_file);
|
|
78467
78527
|
if (pubKey) return pubKey;
|
|
@@ -78543,7 +78603,7 @@ init_src();
|
|
|
78543
78603
|
// src/age-credential.ts
|
|
78544
78604
|
var fs18 = __toESM(require("fs"));
|
|
78545
78605
|
var path20 = __toESM(require("path"));
|
|
78546
|
-
var
|
|
78606
|
+
var YAML13 = __toESM(require_dist());
|
|
78547
78607
|
init_src();
|
|
78548
78608
|
var CLEF_DIR2 = ".clef";
|
|
78549
78609
|
var CLEF_CONFIG_FILENAME2 = "config.yaml";
|
|
@@ -78636,7 +78696,7 @@ function readLocalConfig(repoRoot) {
|
|
|
78636
78696
|
const clefConfigPath = path20.join(repoRoot, CLEF_DIR2, CLEF_CONFIG_FILENAME2);
|
|
78637
78697
|
try {
|
|
78638
78698
|
if (!fs18.existsSync(clefConfigPath)) return null;
|
|
78639
|
-
return
|
|
78699
|
+
return YAML13.parse(fs18.readFileSync(clefConfigPath, "utf-8"));
|
|
78640
78700
|
} catch (err) {
|
|
78641
78701
|
formatter.warn(
|
|
78642
78702
|
`Failed to parse ${clefConfigPath}: ${err instanceof Error ? err.message : String(err)}
|
|
@@ -79423,7 +79483,7 @@ async function fetchCheckpoint(config) {
|
|
|
79423
79483
|
}
|
|
79424
79484
|
|
|
79425
79485
|
// package.json
|
|
79426
|
-
var version = "0.1.7-beta.
|
|
79486
|
+
var version = "0.1.7-beta.48";
|
|
79427
79487
|
var package_default = {
|
|
79428
79488
|
name: "@clef-sh/cli",
|
|
79429
79489
|
version,
|
|
@@ -79497,6 +79557,10 @@ function registerLintCommand(program3, deps2) {
|
|
|
79497
79557
|
const matrixManager = new MatrixManager();
|
|
79498
79558
|
const schemaValidator = new SchemaValidator();
|
|
79499
79559
|
const lintRunner = new LintRunner(matrixManager, schemaValidator, sopsClient);
|
|
79560
|
+
const cellCount = manifest.namespaces.length * manifest.environments.length;
|
|
79561
|
+
formatter.print(
|
|
79562
|
+
`${sym("working")} Linting ${cellCount} file(s) across ${manifest.namespaces.length} namespace(s)...`
|
|
79563
|
+
);
|
|
79500
79564
|
let result;
|
|
79501
79565
|
if (options.fix) {
|
|
79502
79566
|
result = await lintRunner.fix(manifest, repoRoot);
|
|
@@ -80023,7 +80087,7 @@ function parseTarget7(target) {
|
|
|
80023
80087
|
// src/commands/doctor.ts
|
|
80024
80088
|
var fs20 = __toESM(require("fs"));
|
|
80025
80089
|
var path32 = __toESM(require("path"));
|
|
80026
|
-
var
|
|
80090
|
+
var YAML14 = __toESM(require_dist());
|
|
80027
80091
|
init_src();
|
|
80028
80092
|
function registerDoctorCommand(program3, deps2) {
|
|
80029
80093
|
program3.command("doctor").description(
|
|
@@ -80272,7 +80336,7 @@ function countAgeRecipients(sopsYamlPath) {
|
|
|
80272
80336
|
try {
|
|
80273
80337
|
if (!fs20.existsSync(sopsYamlPath)) return 0;
|
|
80274
80338
|
const content = fs20.readFileSync(sopsYamlPath, "utf-8");
|
|
80275
|
-
const config =
|
|
80339
|
+
const config = YAML14.parse(content);
|
|
80276
80340
|
if (!config?.creation_rules || !Array.isArray(config.creation_rules)) {
|
|
80277
80341
|
return 0;
|
|
80278
80342
|
}
|
|
@@ -81467,6 +81531,44 @@ Service Identity: ${identity.name}`);
|
|
|
81467
81531
|
process.exit(1);
|
|
81468
81532
|
}
|
|
81469
81533
|
});
|
|
81534
|
+
serviceCmd.command("delete <name>").description("Delete a service identity and remove its recipients from scoped files.").action(async (name) => {
|
|
81535
|
+
try {
|
|
81536
|
+
const repoRoot = program3.opts().dir || process.cwd();
|
|
81537
|
+
const parser = new ManifestParser();
|
|
81538
|
+
const manifest = parser.parse(path38.join(repoRoot, "clef.yaml"));
|
|
81539
|
+
const identity = manifest.service_identities?.find((si) => si.name === name);
|
|
81540
|
+
if (!identity) {
|
|
81541
|
+
formatter.error(`Service identity '${name}' not found.`);
|
|
81542
|
+
process.exit(1);
|
|
81543
|
+
return;
|
|
81544
|
+
}
|
|
81545
|
+
const confirmed = await formatter.confirm(
|
|
81546
|
+
`Delete service identity '${name}'? This will remove its recipients from all scoped files.`
|
|
81547
|
+
);
|
|
81548
|
+
if (!confirmed) {
|
|
81549
|
+
formatter.error("Aborted.");
|
|
81550
|
+
process.exit(1);
|
|
81551
|
+
return;
|
|
81552
|
+
}
|
|
81553
|
+
const matrixManager = new MatrixManager();
|
|
81554
|
+
const sopsClient = await createSopsClient(repoRoot, deps2.runner);
|
|
81555
|
+
const manager = new ServiceIdentityManager(sopsClient, matrixManager);
|
|
81556
|
+
formatter.print(`${sym("working")} Deleting service identity '${name}'...`);
|
|
81557
|
+
await manager.delete(name, manifest, repoRoot);
|
|
81558
|
+
formatter.success(`Service identity '${name}' deleted.`);
|
|
81559
|
+
formatter.hint(
|
|
81560
|
+
`git add clef.yaml && git commit -m "chore: delete service identity '${name}'"`
|
|
81561
|
+
);
|
|
81562
|
+
} catch (err) {
|
|
81563
|
+
if (err instanceof SopsMissingError || err instanceof SopsVersionError) {
|
|
81564
|
+
formatter.formatDependencyError(err);
|
|
81565
|
+
process.exit(1);
|
|
81566
|
+
return;
|
|
81567
|
+
}
|
|
81568
|
+
formatter.error(err.message);
|
|
81569
|
+
process.exit(1);
|
|
81570
|
+
}
|
|
81571
|
+
});
|
|
81470
81572
|
serviceCmd.command("rotate <name>").description("Rotate the age key for a service identity.").option("-e, --environment <env>", "Rotate only a specific environment").action(async (name, opts) => {
|
|
81471
81573
|
try {
|
|
81472
81574
|
const repoRoot = program3.opts().dir || process.cwd();
|
|
@@ -82011,6 +82113,189 @@ function formatReportOutput(report) {
|
|
|
82011
82113
|
formatter.hint("Run clef lint or clef drift locally for details.");
|
|
82012
82114
|
}
|
|
82013
82115
|
|
|
82116
|
+
// src/commands/install.ts
|
|
82117
|
+
var fs26 = __toESM(require("fs"));
|
|
82118
|
+
var path43 = __toESM(require("path"));
|
|
82119
|
+
var import_yaml = __toESM(require_dist());
|
|
82120
|
+
|
|
82121
|
+
// src/registry/client.ts
|
|
82122
|
+
var DEFAULT_REGISTRY = "https://raw.githubusercontent.com/clef-sh/clef/main/brokers";
|
|
82123
|
+
async function fetchIndex(registryUrl = DEFAULT_REGISTRY) {
|
|
82124
|
+
const url = `${registryUrl}/index.json`;
|
|
82125
|
+
const res = await fetch(url);
|
|
82126
|
+
if (!res.ok) {
|
|
82127
|
+
throw new Error(`Failed to fetch registry index from ${url} (${res.status})`);
|
|
82128
|
+
}
|
|
82129
|
+
return await res.json();
|
|
82130
|
+
}
|
|
82131
|
+
async function fetchBrokerFile(registryUrl, brokerPath, filename) {
|
|
82132
|
+
const url = `${registryUrl}/${brokerPath}/${filename}`;
|
|
82133
|
+
const res = await fetch(url);
|
|
82134
|
+
if (!res.ok) {
|
|
82135
|
+
throw new Error(`Failed to fetch ${filename} from ${url} (${res.status})`);
|
|
82136
|
+
}
|
|
82137
|
+
return res.text();
|
|
82138
|
+
}
|
|
82139
|
+
function findBroker(index, name) {
|
|
82140
|
+
return index.brokers.find((b) => b.name === name);
|
|
82141
|
+
}
|
|
82142
|
+
|
|
82143
|
+
// src/commands/install.ts
|
|
82144
|
+
var TIER_LABELS = {
|
|
82145
|
+
1: "self-expiring",
|
|
82146
|
+
2: "stateful",
|
|
82147
|
+
3: "complex"
|
|
82148
|
+
};
|
|
82149
|
+
function registerInstallCommand(program3, _deps) {
|
|
82150
|
+
program3.command("install <broker>").description(
|
|
82151
|
+
"Install a broker template from the Clef registry.\n\nDownloads broker.yaml, handler.ts, and README.md\ninto brokers/<name>/ in your project.\n\nExit codes:\n 0 Broker installed successfully\n 1 Error (broker not found, network failure, etc.)"
|
|
82152
|
+
).option("--registry <url>", "Custom registry base URL", DEFAULT_REGISTRY).option("--force", "Overwrite existing broker directory without prompting").action(async (brokerName, options) => {
|
|
82153
|
+
try {
|
|
82154
|
+
const repoRoot = program3.opts().dir || process.cwd();
|
|
82155
|
+
const registryUrl = options.registry;
|
|
82156
|
+
formatter.info(`Fetching ${brokerName} from registry...`);
|
|
82157
|
+
const index = await fetchIndex(registryUrl);
|
|
82158
|
+
const entry = findBroker(index, brokerName);
|
|
82159
|
+
if (!entry) {
|
|
82160
|
+
formatter.error(
|
|
82161
|
+
`Broker "${brokerName}" not found in the registry. Run 'clef search' to list available brokers.`
|
|
82162
|
+
);
|
|
82163
|
+
process.exit(1);
|
|
82164
|
+
return;
|
|
82165
|
+
}
|
|
82166
|
+
const brokerDir = path43.join(repoRoot, "brokers", entry.name);
|
|
82167
|
+
if (fs26.existsSync(brokerDir) && !options.force) {
|
|
82168
|
+
const overwrite = await formatter.confirm(
|
|
82169
|
+
`brokers/${entry.name}/ already exists. Overwrite?`
|
|
82170
|
+
);
|
|
82171
|
+
if (!overwrite) {
|
|
82172
|
+
formatter.info("Installation cancelled.");
|
|
82173
|
+
process.exit(0);
|
|
82174
|
+
return;
|
|
82175
|
+
}
|
|
82176
|
+
}
|
|
82177
|
+
const files = [];
|
|
82178
|
+
for (const filename of ["broker.yaml", "handler.ts", "README.md"]) {
|
|
82179
|
+
try {
|
|
82180
|
+
const content = await fetchBrokerFile(registryUrl, entry.path, filename);
|
|
82181
|
+
files.push({ name: filename, content });
|
|
82182
|
+
} catch {
|
|
82183
|
+
if (filename === "handler.ts") {
|
|
82184
|
+
try {
|
|
82185
|
+
const content = await fetchBrokerFile(registryUrl, entry.path, "handler.js");
|
|
82186
|
+
files.push({ name: "handler.js", content });
|
|
82187
|
+
} catch {
|
|
82188
|
+
formatter.warn(`Could not download handler file for ${brokerName}`);
|
|
82189
|
+
}
|
|
82190
|
+
}
|
|
82191
|
+
}
|
|
82192
|
+
}
|
|
82193
|
+
if (files.length === 0) {
|
|
82194
|
+
formatter.error(`Could not download any files for ${brokerName}`);
|
|
82195
|
+
process.exit(1);
|
|
82196
|
+
return;
|
|
82197
|
+
}
|
|
82198
|
+
if (!fs26.existsSync(brokerDir)) {
|
|
82199
|
+
fs26.mkdirSync(brokerDir, { recursive: true });
|
|
82200
|
+
}
|
|
82201
|
+
for (const file of files) {
|
|
82202
|
+
fs26.writeFileSync(path43.join(brokerDir, file.name), file.content, "utf-8");
|
|
82203
|
+
}
|
|
82204
|
+
const manifestFile = files.find((f) => f.name === "broker.yaml");
|
|
82205
|
+
const manifest = manifestFile ? (0, import_yaml.parse)(manifestFile.content) : {};
|
|
82206
|
+
formatter.print("");
|
|
82207
|
+
formatter.print(` ${sym("success")} ${entry.name}`);
|
|
82208
|
+
formatter.print("");
|
|
82209
|
+
formatter.keyValue(" Name", entry.name);
|
|
82210
|
+
formatter.keyValue(" Provider", entry.provider);
|
|
82211
|
+
formatter.keyValue(" Tier", `${entry.tier} (${TIER_LABELS[entry.tier] ?? "unknown"})`);
|
|
82212
|
+
formatter.keyValue(" Description", entry.description);
|
|
82213
|
+
formatter.print("");
|
|
82214
|
+
formatter.section(" Created");
|
|
82215
|
+
for (const file of files) {
|
|
82216
|
+
formatter.print(` brokers/${entry.name}/${file.name}`);
|
|
82217
|
+
}
|
|
82218
|
+
if (manifest.inputs && manifest.inputs.length > 0) {
|
|
82219
|
+
formatter.section(" Inputs");
|
|
82220
|
+
for (const input of manifest.inputs) {
|
|
82221
|
+
const suffix = input.default !== void 0 ? ` (default: ${input.default})` : " (required)";
|
|
82222
|
+
formatter.print(` ${input.name}${suffix}`);
|
|
82223
|
+
}
|
|
82224
|
+
}
|
|
82225
|
+
if (manifest.output?.keys) {
|
|
82226
|
+
formatter.section(" Output");
|
|
82227
|
+
formatter.keyValue(" Keys", manifest.output.keys.join(", "));
|
|
82228
|
+
if (manifest.output.ttl) {
|
|
82229
|
+
formatter.keyValue(" TTL", `${manifest.output.ttl}s`);
|
|
82230
|
+
}
|
|
82231
|
+
}
|
|
82232
|
+
if (manifest.runtime?.permissions?.length > 0) {
|
|
82233
|
+
formatter.section(" Permissions");
|
|
82234
|
+
for (const perm of manifest.runtime.permissions) {
|
|
82235
|
+
formatter.print(` ${perm}`);
|
|
82236
|
+
}
|
|
82237
|
+
}
|
|
82238
|
+
formatter.print("");
|
|
82239
|
+
formatter.hint(`https://registry.clef.sh/brokers/${entry.name}`);
|
|
82240
|
+
process.exit(0);
|
|
82241
|
+
} catch (err) {
|
|
82242
|
+
formatter.error(err.message);
|
|
82243
|
+
process.exit(1);
|
|
82244
|
+
}
|
|
82245
|
+
});
|
|
82246
|
+
}
|
|
82247
|
+
|
|
82248
|
+
// src/commands/search.ts
|
|
82249
|
+
function registerSearchCommand(program3, _deps) {
|
|
82250
|
+
program3.command("search [query]").description(
|
|
82251
|
+
"Search the Clef broker registry.\n\nWithout arguments, lists all available brokers.\n\nExit codes:\n 0 Results found or listing complete\n 1 Error fetching registry"
|
|
82252
|
+
).option("--provider <name>", "Filter by cloud provider (aws, gcp, azure, agnostic)").option("--tier <n>", "Filter by tier (1, 2, 3)").option("--registry <url>", "Custom registry base URL", DEFAULT_REGISTRY).action(
|
|
82253
|
+
async (query, options) => {
|
|
82254
|
+
try {
|
|
82255
|
+
const index = await fetchIndex(options.registry);
|
|
82256
|
+
let results = index.brokers;
|
|
82257
|
+
if (query) {
|
|
82258
|
+
const q = query.toLowerCase();
|
|
82259
|
+
results = results.filter(
|
|
82260
|
+
(b) => b.name.toLowerCase().includes(q) || b.description.toLowerCase().includes(q) || b.provider.toLowerCase().includes(q)
|
|
82261
|
+
);
|
|
82262
|
+
}
|
|
82263
|
+
if (options.provider) {
|
|
82264
|
+
results = results.filter((b) => b.provider === options.provider);
|
|
82265
|
+
}
|
|
82266
|
+
if (options.tier) {
|
|
82267
|
+
results = results.filter((b) => b.tier === Number(options.tier));
|
|
82268
|
+
}
|
|
82269
|
+
if (results.length === 0) {
|
|
82270
|
+
formatter.info("No brokers found matching your query.");
|
|
82271
|
+
process.exit(0);
|
|
82272
|
+
return;
|
|
82273
|
+
}
|
|
82274
|
+
const label = query || options.provider || options.tier ? `${results.length} broker${results.length === 1 ? "" : "s"} found` : `${results.length} broker${results.length === 1 ? "" : "s"} available`;
|
|
82275
|
+
formatter.print(`
|
|
82276
|
+
${label}
|
|
82277
|
+
`);
|
|
82278
|
+
printBrokerTable(results);
|
|
82279
|
+
formatter.print("");
|
|
82280
|
+
process.exit(0);
|
|
82281
|
+
} catch (err) {
|
|
82282
|
+
formatter.error(err.message);
|
|
82283
|
+
process.exit(1);
|
|
82284
|
+
}
|
|
82285
|
+
}
|
|
82286
|
+
);
|
|
82287
|
+
}
|
|
82288
|
+
function printBrokerTable(brokers) {
|
|
82289
|
+
const nameWidth = Math.max(...brokers.map((b) => b.name.length));
|
|
82290
|
+
const providerWidth = Math.max(...brokers.map((b) => b.provider.length));
|
|
82291
|
+
for (const b of brokers) {
|
|
82292
|
+
const name = b.name.padEnd(nameWidth);
|
|
82293
|
+
const provider = b.provider.padEnd(providerWidth);
|
|
82294
|
+
const tier = `Tier ${b.tier}`;
|
|
82295
|
+
formatter.print(` ${name} ${provider} ${tier} ${b.description}`);
|
|
82296
|
+
}
|
|
82297
|
+
}
|
|
82298
|
+
|
|
82014
82299
|
// src/index.ts
|
|
82015
82300
|
var VERSION = package_default.version;
|
|
82016
82301
|
var program2 = new Command();
|
|
@@ -82066,6 +82351,8 @@ registerPackCommand(program2, deps);
|
|
|
82066
82351
|
registerRevokeCommand(program2, deps);
|
|
82067
82352
|
registerDriftCommand(program2, deps);
|
|
82068
82353
|
registerReportCommand(program2, deps);
|
|
82354
|
+
registerInstallCommand(program2, deps);
|
|
82355
|
+
registerSearchCommand(program2, deps);
|
|
82069
82356
|
program2.parseAsync(process.argv).catch((err) => {
|
|
82070
82357
|
formatter.error(err.message);
|
|
82071
82358
|
process.exit(1);
|