pepr 1.1.5 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/init/templates.d.ts +3 -6
- package/dist/cli/init/templates.d.ts.map +1 -1
- package/dist/cli.js +36 -26
- package/dist/controller.js +6 -9
- package/dist/lib/controller/index.d.ts.map +1 -1
- package/dist/lib/controller/index.util.d.ts +4 -0
- package/dist/lib/controller/index.util.d.ts.map +1 -1
- package/dist/lib.js +20 -2
- package/dist/lib.js.map +2 -2
- package/package.json +6 -9
- package/src/lib/controller/index.ts +28 -3
- package/src/lib/controller/index.util.ts +10 -0
- package/dist/sdk/heredoc.d.ts +0 -2
- package/dist/sdk/heredoc.d.ts.map +0 -1
- package/src/sdk/heredoc.ts +0 -36
|
@@ -4,11 +4,12 @@ import { OnError, RbacMode } from "./enums";
|
|
|
4
4
|
import { V1PolicyRule as PolicyRule } from "@kubernetes/client-node";
|
|
5
5
|
export declare const dependencies: {
|
|
6
6
|
"@types/ramda": string;
|
|
7
|
-
"
|
|
7
|
+
"@typescript-eslint/eslint-plugin": string;
|
|
8
|
+
"@typescript-eslint/parser": string;
|
|
8
9
|
commander: string;
|
|
10
|
+
eslint: string;
|
|
9
11
|
express: string;
|
|
10
12
|
"fast-json-patch": string;
|
|
11
|
-
heredoc: string;
|
|
12
13
|
"http-status-codes": string;
|
|
13
14
|
"json-pointer": string;
|
|
14
15
|
"kubernetes-fluent-client": string;
|
|
@@ -18,9 +19,6 @@ export declare const dependencies: {
|
|
|
18
19
|
"quicktype-core": string;
|
|
19
20
|
ramda: string;
|
|
20
21
|
"ts-morph": string;
|
|
21
|
-
"@typescript-eslint/eslint-plugin": string;
|
|
22
|
-
"@typescript-eslint/parser": string;
|
|
23
|
-
eslint: string;
|
|
24
22
|
}, devDependencies: {
|
|
25
23
|
"@commitlint/cli": string;
|
|
26
24
|
"@commitlint/config-conventional": string;
|
|
@@ -29,7 +27,6 @@ export declare const dependencies: {
|
|
|
29
27
|
"@semantic-release/npm": string;
|
|
30
28
|
"@semantic-release/release-notes-generator": string;
|
|
31
29
|
"@types/command-line-args": string;
|
|
32
|
-
"@types/eslint": string;
|
|
33
30
|
"@types/express": string;
|
|
34
31
|
"@types/json-pointer": string;
|
|
35
32
|
"@types/json-schema": string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../src/cli/init/templates.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,YAAY,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAIrE,eAAO,MAAQ,YAAY
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../src/cli/init/templates.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,YAAY,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAIrE,eAAO,MAAQ,YAAY;;;;;;;;;;;;;;;;;GAAE,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;GAAE,gBAAgB;;;;;;;;GAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAE,OAAO,QAAgB,CAAC;AAEjG,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,OAAO,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC;QAC1B,IAAI,EAAE;YACJ,IAAI,EAAE,MAAM,CAAC;YACb,OAAO,EAAE,OAAO,CAAC;YACjB,cAAc,EAAE,MAAM,CAAC;YACvB,YAAY,EAAE,YAAY,CAAC;YAC3B,YAAY,EAAE;gBAAE,UAAU,EAAE,MAAM,EAAE,CAAA;aAAE,CAAC;YACvC,SAAS,EAAE;gBAAE,YAAY,EAAE;oBAAE,UAAU,EAAE,MAAM,EAAE,CAAA;iBAAE,CAAA;aAAE,CAAC;YACtD,KAAK,EAAE;gBAAE,YAAY,EAAE;oBAAE,UAAU,EAAE,MAAM,EAAE,CAAA;iBAAE,CAAA;aAAE,CAAC;YAClD,aAAa,EAAE,MAAM,EAAE,CAAC;YACxB,GAAG,EAAE,MAAM,CAAC;YACZ,IAAI,CAAC,EAAE,UAAU,EAAE,CAAC;YACpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;SACrB,CAAC;QACF,OAAO,EAAE;YAAE,WAAW,EAAE,MAAM,CAAA;SAAE,CAAC;QACjC,YAAY,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC;QAC/C,eAAe,EAAE;YAAE,UAAU,EAAE,MAAM,CAAA;SAAE,CAAC;KACzC,CAAC;IACF,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,wBAAgB,UAAU,CAAC,IAAI,EAAE,WAAW,GAAG,eAAe,CA4D7D;AAED,eAAO,MAAM,cAAc;;;CAG1B,CAAC;AAEF,eAAO,MAAM,MAAM;;;CAGlB,CAAC;AAEF,eAAO,MAAM,SAAS;;;CAGrB,CAAC;AAEF,eAAO,MAAM,SAAS;;;CAGrB,CAAC;AAEF,eAAO,MAAM,WAAW;;;CAGvB,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;;;;;CAGnB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;CAGxB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;CAGpB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;CAGpB,CAAC;AAEF,eAAO,MAAM,MAAM;;;CAgBlB,CAAC"}
|
package/dist/cli.js
CHANGED
|
@@ -663,7 +663,7 @@ var require_Alias = __commonJS({
|
|
|
663
663
|
toJS.toJS(source, null, ctx);
|
|
664
664
|
data = anchors2.get(source);
|
|
665
665
|
}
|
|
666
|
-
if (
|
|
666
|
+
if (data?.res === void 0) {
|
|
667
667
|
const msg = "This should not happen: Alias anchor was not resolved?";
|
|
668
668
|
throw new ReferenceError(msg);
|
|
669
669
|
}
|
|
@@ -1425,6 +1425,7 @@ var require_stringify = __commonJS({
|
|
|
1425
1425
|
nullStr: "null",
|
|
1426
1426
|
simpleKeys: false,
|
|
1427
1427
|
singleQuote: null,
|
|
1428
|
+
trailingComma: false,
|
|
1428
1429
|
trueStr: "true",
|
|
1429
1430
|
verifyAliasOrder: true
|
|
1430
1431
|
}, doc.schema.toStringOptions, options);
|
|
@@ -1613,7 +1614,7 @@ ${indent}:`;
|
|
|
1613
1614
|
${stringifyComment.indentComment(cs, ctx.indent)}`;
|
|
1614
1615
|
}
|
|
1615
1616
|
if (valueStr === "" && !ctx.inFlow) {
|
|
1616
|
-
if (ws === "\n")
|
|
1617
|
+
if (ws === "\n" && valueComment)
|
|
1617
1618
|
ws = "\n\n";
|
|
1618
1619
|
} else {
|
|
1619
1620
|
ws += `
|
|
@@ -1942,12 +1943,19 @@ ${indent}${line}` : "\n";
|
|
|
1942
1943
|
if (comment)
|
|
1943
1944
|
reqNewline = true;
|
|
1944
1945
|
let str = stringify2.stringify(item, itemCtx, () => comment = null);
|
|
1945
|
-
|
|
1946
|
+
reqNewline || (reqNewline = lines.length > linesAtValue || str.includes("\n"));
|
|
1947
|
+
if (i < items.length - 1) {
|
|
1946
1948
|
str += ",";
|
|
1949
|
+
} else if (ctx.options.trailingComma) {
|
|
1950
|
+
if (ctx.options.lineWidth > 0) {
|
|
1951
|
+
reqNewline || (reqNewline = lines.reduce((sum, line) => sum + line.length + 2, 2) + (str.length + 2) > ctx.options.lineWidth);
|
|
1952
|
+
}
|
|
1953
|
+
if (reqNewline) {
|
|
1954
|
+
str += ",";
|
|
1955
|
+
}
|
|
1956
|
+
}
|
|
1947
1957
|
if (comment)
|
|
1948
1958
|
str += stringifyComment.lineComment(str, itemIndent, commentString(comment));
|
|
1949
|
-
if (!reqNewline && (lines.length > linesAtValue || str.includes("\n")))
|
|
1950
|
-
reqNewline = true;
|
|
1951
1959
|
lines.push(str);
|
|
1952
1960
|
linesAtValue = lines.length;
|
|
1953
1961
|
}
|
|
@@ -2358,7 +2366,7 @@ var require_stringifyNumber = __commonJS({
|
|
|
2358
2366
|
const num = typeof value === "number" ? value : Number(value);
|
|
2359
2367
|
if (!isFinite(num))
|
|
2360
2368
|
return isNaN(num) ? ".nan" : num < 0 ? "-.inf" : ".inf";
|
|
2361
|
-
let n = JSON.stringify(value);
|
|
2369
|
+
let n = Object.is(value, -0) ? "-0" : JSON.stringify(value);
|
|
2362
2370
|
if (!format2 && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^\d/.test(n)) {
|
|
2363
2371
|
let i = n.indexOf(".");
|
|
2364
2372
|
if (i < 0) {
|
|
@@ -3726,7 +3734,7 @@ var require_errors = __commonJS({
|
|
|
3726
3734
|
if (/[^ ]/.test(lineStr)) {
|
|
3727
3735
|
let count = 1;
|
|
3728
3736
|
const end = error.linePos[1];
|
|
3729
|
-
if (end
|
|
3737
|
+
if (end?.line === line && end.col > col) {
|
|
3730
3738
|
count = Math.max(1, Math.min(end.col - col, 80 - ci));
|
|
3731
3739
|
}
|
|
3732
3740
|
const pointer = " ".repeat(ci) + "^".repeat(count);
|
|
@@ -4089,7 +4097,7 @@ var require_resolve_block_seq = __commonJS({
|
|
|
4089
4097
|
});
|
|
4090
4098
|
if (!props.found) {
|
|
4091
4099
|
if (props.anchor || props.tag || value) {
|
|
4092
|
-
if (value
|
|
4100
|
+
if (value?.type === "block-seq")
|
|
4093
4101
|
onError(props.end, "BAD_INDENT", "All sequence items must start at the same column");
|
|
4094
4102
|
else
|
|
4095
4103
|
onError(offset, "MISSING_CHAR", "Sequence item without - indicator");
|
|
@@ -4286,7 +4294,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4286
4294
|
onError(valueProps.found, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit flow sequence key");
|
|
4287
4295
|
}
|
|
4288
4296
|
} else if (value) {
|
|
4289
|
-
if ("source" in value && value.source
|
|
4297
|
+
if ("source" in value && value.source?.[0] === ":")
|
|
4290
4298
|
onError(value, "MISSING_CHAR", `Missing space after : in ${fcName}`);
|
|
4291
4299
|
else
|
|
4292
4300
|
onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
|
|
@@ -4323,7 +4331,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4323
4331
|
const expectedEnd = isMap ? "}" : "]";
|
|
4324
4332
|
const [ce, ...ee] = fc.end;
|
|
4325
4333
|
let cePos = offset;
|
|
4326
|
-
if (ce
|
|
4334
|
+
if (ce?.source === expectedEnd)
|
|
4327
4335
|
cePos = ce.offset + ce.source.length;
|
|
4328
4336
|
else {
|
|
4329
4337
|
const name2 = fcName[0].toUpperCase() + fcName.substring(1);
|
|
@@ -4390,7 +4398,7 @@ var require_compose_collection = __commonJS({
|
|
|
4390
4398
|
let tag = ctx.schema.tags.find((t) => t.tag === tagName && t.collection === expType);
|
|
4391
4399
|
if (!tag) {
|
|
4392
4400
|
const kt = ctx.schema.knownTags[tagName];
|
|
4393
|
-
if (kt
|
|
4401
|
+
if (kt?.collection === expType) {
|
|
4394
4402
|
ctx.schema.tags.push(Object.assign({}, kt, { default: false }));
|
|
4395
4403
|
tag = kt;
|
|
4396
4404
|
} else {
|
|
@@ -4961,17 +4969,22 @@ var require_compose_node = __commonJS({
|
|
|
4961
4969
|
case "block-map":
|
|
4962
4970
|
case "block-seq":
|
|
4963
4971
|
case "flow-collection":
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4972
|
+
try {
|
|
4973
|
+
node = composeCollection.composeCollection(CN, ctx, token, props, onError);
|
|
4974
|
+
if (anchor)
|
|
4975
|
+
node.anchor = anchor.source.substring(1);
|
|
4976
|
+
} catch (error) {
|
|
4977
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
4978
|
+
onError(token, "RESOURCE_EXHAUSTION", message);
|
|
4979
|
+
}
|
|
4967
4980
|
break;
|
|
4968
4981
|
default: {
|
|
4969
4982
|
const message = token.type === "error" ? token.message : `Unsupported token (type: ${token.type})`;
|
|
4970
4983
|
onError(token, "UNEXPECTED_TOKEN", message);
|
|
4971
|
-
node = composeEmptyNode(ctx, token.offset, void 0, null, props, onError);
|
|
4972
4984
|
isSrcToken = false;
|
|
4973
4985
|
}
|
|
4974
4986
|
}
|
|
4987
|
+
node ?? (node = composeEmptyNode(ctx, token.offset, void 0, null, props, onError));
|
|
4975
4988
|
if (anchor && node.anchor === "")
|
|
4976
4989
|
onError(anchor, "BAD_ALIAS", "Anchor cannot be an empty string");
|
|
4977
4990
|
if (atKey && ctx.options.stringKeys && (!identity.isScalar(node) || typeof node.value !== "string" || node.tag && node.tag !== "tag:yaml.org,2002:str")) {
|
|
@@ -6488,7 +6501,7 @@ var require_parser = __commonJS({
|
|
|
6488
6501
|
}
|
|
6489
6502
|
*step() {
|
|
6490
6503
|
const top = this.peek(1);
|
|
6491
|
-
if (this.type === "doc-end" &&
|
|
6504
|
+
if (this.type === "doc-end" && top?.type !== "doc-end") {
|
|
6492
6505
|
while (this.stack.length > 0)
|
|
6493
6506
|
yield* this.pop();
|
|
6494
6507
|
this.stack.push({
|
|
@@ -6966,7 +6979,7 @@ var require_parser = __commonJS({
|
|
|
6966
6979
|
do {
|
|
6967
6980
|
yield* this.pop();
|
|
6968
6981
|
top = this.peek(1);
|
|
6969
|
-
} while (top
|
|
6982
|
+
} while (top?.type === "flow-collection");
|
|
6970
6983
|
} else if (fc.end.length === 0) {
|
|
6971
6984
|
switch (this.type) {
|
|
6972
6985
|
case "comma":
|
|
@@ -9617,7 +9630,7 @@ var packageJSON = {
|
|
|
9617
9630
|
"!src/fixtures/**",
|
|
9618
9631
|
"!dist/**/*.test.d.ts*"
|
|
9619
9632
|
],
|
|
9620
|
-
version: "1.1.
|
|
9633
|
+
version: "1.1.6",
|
|
9621
9634
|
main: "dist/lib.js",
|
|
9622
9635
|
types: "dist/lib.d.ts",
|
|
9623
9636
|
scripts: {
|
|
@@ -9651,11 +9664,12 @@ var packageJSON = {
|
|
|
9651
9664
|
},
|
|
9652
9665
|
dependencies: {
|
|
9653
9666
|
"@types/ramda": "0.31.1",
|
|
9654
|
-
"
|
|
9667
|
+
"@typescript-eslint/eslint-plugin": "8.45.0",
|
|
9668
|
+
"@typescript-eslint/parser": "8.45.0",
|
|
9655
9669
|
commander: "14.0.3",
|
|
9670
|
+
eslint: "9.36.0",
|
|
9656
9671
|
express: "5.2.1",
|
|
9657
9672
|
"fast-json-patch": "3.1.1",
|
|
9658
|
-
heredoc: "^1.3.1",
|
|
9659
9673
|
"http-status-codes": "^2.3.0",
|
|
9660
9674
|
"json-pointer": "^0.6.2",
|
|
9661
9675
|
"kubernetes-fluent-client": "3.11.6",
|
|
@@ -9664,10 +9678,7 @@ var packageJSON = {
|
|
|
9664
9678
|
"prom-client": "15.1.3",
|
|
9665
9679
|
"quicktype-core": "^23.2.6",
|
|
9666
9680
|
ramda: "0.32.0",
|
|
9667
|
-
"ts-morph": "^27.0.0"
|
|
9668
|
-
"@typescript-eslint/eslint-plugin": "8.45.0",
|
|
9669
|
-
"@typescript-eslint/parser": "8.45.0",
|
|
9670
|
-
eslint: "9.36.0"
|
|
9681
|
+
"ts-morph": "^27.0.0"
|
|
9671
9682
|
},
|
|
9672
9683
|
devDependencies: {
|
|
9673
9684
|
"@commitlint/cli": "20.4.3",
|
|
@@ -9677,7 +9688,6 @@ var packageJSON = {
|
|
|
9677
9688
|
"@semantic-release/npm": "^13.0.0",
|
|
9678
9689
|
"@semantic-release/release-notes-generator": "^14.1.0",
|
|
9679
9690
|
"@types/command-line-args": "^5.2.3",
|
|
9680
|
-
"@types/eslint": "9.6.1",
|
|
9681
9691
|
"@types/express": "5.0.6",
|
|
9682
9692
|
"@types/json-pointer": "^1.0.34",
|
|
9683
9693
|
"@types/json-schema": "^7.0.15",
|
|
@@ -9704,7 +9714,7 @@ var packageJSON = {
|
|
|
9704
9714
|
peerDependencies: {
|
|
9705
9715
|
"@types/prompts": "2.4.9",
|
|
9706
9716
|
esbuild: "0.25.10",
|
|
9707
|
-
"node-forge": "1.
|
|
9717
|
+
"node-forge": "1.4.0",
|
|
9708
9718
|
prettier: "3.6.2",
|
|
9709
9719
|
prompts: "2.4.2",
|
|
9710
9720
|
typescript: "5.8.3",
|
package/dist/controller.js
CHANGED
|
@@ -78,7 +78,7 @@ var packageJSON = {
|
|
|
78
78
|
"!src/fixtures/**",
|
|
79
79
|
"!dist/**/*.test.d.ts*"
|
|
80
80
|
],
|
|
81
|
-
version: "1.1.
|
|
81
|
+
version: "1.1.6",
|
|
82
82
|
main: "dist/lib.js",
|
|
83
83
|
types: "dist/lib.d.ts",
|
|
84
84
|
scripts: {
|
|
@@ -112,11 +112,12 @@ var packageJSON = {
|
|
|
112
112
|
},
|
|
113
113
|
dependencies: {
|
|
114
114
|
"@types/ramda": "0.31.1",
|
|
115
|
-
"
|
|
115
|
+
"@typescript-eslint/eslint-plugin": "8.45.0",
|
|
116
|
+
"@typescript-eslint/parser": "8.45.0",
|
|
116
117
|
commander: "14.0.3",
|
|
118
|
+
eslint: "9.36.0",
|
|
117
119
|
express: "5.2.1",
|
|
118
120
|
"fast-json-patch": "3.1.1",
|
|
119
|
-
heredoc: "^1.3.1",
|
|
120
121
|
"http-status-codes": "^2.3.0",
|
|
121
122
|
"json-pointer": "^0.6.2",
|
|
122
123
|
"kubernetes-fluent-client": "3.11.6",
|
|
@@ -125,10 +126,7 @@ var packageJSON = {
|
|
|
125
126
|
"prom-client": "15.1.3",
|
|
126
127
|
"quicktype-core": "^23.2.6",
|
|
127
128
|
ramda: "0.32.0",
|
|
128
|
-
"ts-morph": "^27.0.0"
|
|
129
|
-
"@typescript-eslint/eslint-plugin": "8.45.0",
|
|
130
|
-
"@typescript-eslint/parser": "8.45.0",
|
|
131
|
-
eslint: "9.36.0"
|
|
129
|
+
"ts-morph": "^27.0.0"
|
|
132
130
|
},
|
|
133
131
|
devDependencies: {
|
|
134
132
|
"@commitlint/cli": "20.4.3",
|
|
@@ -138,7 +136,6 @@ var packageJSON = {
|
|
|
138
136
|
"@semantic-release/npm": "^13.0.0",
|
|
139
137
|
"@semantic-release/release-notes-generator": "^14.1.0",
|
|
140
138
|
"@types/command-line-args": "^5.2.3",
|
|
141
|
-
"@types/eslint": "9.6.1",
|
|
142
139
|
"@types/express": "5.0.6",
|
|
143
140
|
"@types/json-pointer": "^1.0.34",
|
|
144
141
|
"@types/json-schema": "^7.0.15",
|
|
@@ -165,7 +162,7 @@ var packageJSON = {
|
|
|
165
162
|
peerDependencies: {
|
|
166
163
|
"@types/prompts": "2.4.9",
|
|
167
164
|
esbuild: "0.25.10",
|
|
168
|
-
"node-forge": "1.
|
|
165
|
+
"node-forge": "1.4.0",
|
|
169
166
|
prettier: "3.6.2",
|
|
170
167
|
prompts: "2.4.2",
|
|
171
168
|
typescript: "5.8.3",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/controller/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAI1D,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/controller/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAI1D,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAUxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAInD,MAAM,WAAW,eAAe;IAC9B,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC7C,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,cAAc,GAAG,gBAAgB,KAAK,IAAI,CAAC;IAC7D,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAMD,qBAAa,UAAU;;gBAmBT,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,EAAE,KAAK,GAAE,eAAoB;IAoCzF,+BAA+B;IAC/B,WAAW,GAAI,MAAM,MAAM,KAAG,IAAI,CAoEhC;CAyLH"}
|
|
@@ -7,5 +7,9 @@ export interface KubeAdmissionReview {
|
|
|
7
7
|
response: ValidateResponse[] | MutateResponse | ResponseItem;
|
|
8
8
|
}
|
|
9
9
|
export declare function karForMutate(mr: MutateResponse): KubeAdmissionReview;
|
|
10
|
+
export declare function parseWebhookTimeouts(): {
|
|
11
|
+
keepAliveTimeoutMs: number;
|
|
12
|
+
headersTimeoutMs: number;
|
|
13
|
+
};
|
|
10
14
|
export declare function karForValidate(ar: AdmissionRequest, vr: ValidateResponse[]): KubeAdmissionReview;
|
|
11
15
|
//# sourceMappingURL=index.util.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.util.d.ts","sourceRoot":"","sources":["../../../src/lib/controller/index.util.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,gBAAgB,EAAE,GAAG,cAAc,GAAG,YAAY,CAAC;CAC9D;AAED,wBAAgB,YAAY,CAAC,EAAE,EAAE,cAAc,GAAG,mBAAmB,CAMpE;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,gBAAgB,EAAE,EAAE,EAAE,gBAAgB,EAAE,GAAG,mBAAmB,CAoChG"}
|
|
1
|
+
{"version":3,"file":"index.util.d.ts","sourceRoot":"","sources":["../../../src/lib/controller/index.util.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,gBAAgB,EAAE,GAAG,cAAc,GAAG,YAAY,CAAC;CAC9D;AAED,wBAAgB,YAAY,CAAC,EAAE,EAAE,cAAc,GAAG,mBAAmB,CAMpE;AAED,wBAAgB,oBAAoB,IAAI;IAAE,kBAAkB,EAAE,MAAM,CAAC;IAAC,gBAAgB,EAAE,MAAM,CAAA;CAAE,CAQ/F;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,gBAAgB,EAAE,EAAE,EAAE,gBAAgB,EAAE,GAAG,mBAAmB,CAoChG"}
|
package/dist/lib.js
CHANGED
|
@@ -1937,6 +1937,11 @@ function karForMutate(mr) {
|
|
|
1937
1937
|
response: mr
|
|
1938
1938
|
};
|
|
1939
1939
|
}
|
|
1940
|
+
function parseWebhookTimeouts() {
|
|
1941
|
+
const keepAliveTimeoutMs = process.env.PEPR_KEEP_ALIVE_TIMEOUT_MS ? parseInt(process.env.PEPR_KEEP_ALIVE_TIMEOUT_MS, 10) : 9e4;
|
|
1942
|
+
const headersTimeoutMs = process.env.PEPR_HEADERS_TIMEOUT_MS ? parseInt(process.env.PEPR_HEADERS_TIMEOUT_MS, 10) : 32e3;
|
|
1943
|
+
return { keepAliveTimeoutMs, headersTimeoutMs };
|
|
1944
|
+
}
|
|
1940
1945
|
function karForValidate(ar, vr) {
|
|
1941
1946
|
const isAllowed = vr.filter((r) => !r.allowed).length === 0;
|
|
1942
1947
|
const warnings = vr.reduce((acc, curr) => {
|
|
@@ -2109,9 +2114,11 @@ var Controller = class _Controller {
|
|
|
2109
2114
|
throw new Error("API path not found");
|
|
2110
2115
|
}
|
|
2111
2116
|
}
|
|
2112
|
-
const server = import_https.default.createServer(options, this.#app)
|
|
2117
|
+
const server = import_https.default.createServer(options, this.#app);
|
|
2118
|
+
const { keepAliveTimeoutMs, headersTimeoutMs } = _Controller.#applyTimeouts(server);
|
|
2119
|
+
server.listen(port);
|
|
2113
2120
|
server.on("listening", () => {
|
|
2114
|
-
logger_default.debug(`Server listening on port ${port}`);
|
|
2121
|
+
logger_default.debug({ port, keepAliveTimeoutMs, headersTimeoutMs }, `Server listening on port ${port}`);
|
|
2115
2122
|
this.#running = true;
|
|
2116
2123
|
});
|
|
2117
2124
|
server.on("error", (e) => {
|
|
@@ -2216,6 +2223,17 @@ var Controller = class _Controller {
|
|
|
2216
2223
|
}
|
|
2217
2224
|
};
|
|
2218
2225
|
};
|
|
2226
|
+
/**
|
|
2227
|
+
* Parse and apply HTTP timeout settings to the server.
|
|
2228
|
+
*
|
|
2229
|
+
* @param server the HTTPS server to configure
|
|
2230
|
+
*/
|
|
2231
|
+
static #applyTimeouts(server) {
|
|
2232
|
+
const { keepAliveTimeoutMs, headersTimeoutMs } = parseWebhookTimeouts();
|
|
2233
|
+
server.keepAliveTimeout = keepAliveTimeoutMs;
|
|
2234
|
+
server.headersTimeout = headersTimeoutMs;
|
|
2235
|
+
return { keepAliveTimeoutMs, headersTimeoutMs };
|
|
2236
|
+
}
|
|
2219
2237
|
/**
|
|
2220
2238
|
* Middleware for logging requests
|
|
2221
2239
|
*
|