kubernetes-fluent-client 3.5.6 → 3.6.1
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.js +11 -16
- package/dist/fetch.js +5 -8
- package/dist/fluent/index.d.ts +3 -2
- package/dist/fluent/index.d.ts.map +1 -1
- package/dist/fluent/index.js +27 -29
- package/dist/fluent/shared-types.d.ts +49 -0
- package/dist/fluent/shared-types.d.ts.map +1 -0
- package/dist/fluent/shared-types.js +23 -0
- package/dist/fluent/types.d.ts +3 -38
- package/dist/fluent/types.d.ts.map +1 -1
- package/dist/fluent/types.js +1 -14
- package/dist/fluent/utils.d.ts +2 -2
- package/dist/fluent/utils.d.ts.map +1 -1
- package/dist/fluent/utils.js +25 -35
- package/dist/fluent/watch.d.ts +2 -9
- package/dist/fluent/watch.d.ts.map +1 -1
- package/dist/fluent/watch.js +23 -43
- package/dist/generate.d.ts +2 -2
- package/dist/generate.d.ts.map +1 -1
- package/dist/generate.js +22 -65
- package/dist/helpers.js +5 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -60
- package/dist/kinds.d.ts +1 -1
- package/dist/kinds.d.ts.map +1 -1
- package/dist/kinds.js +2 -7
- package/dist/normalization.d.ts +97 -0
- package/dist/normalization.d.ts.map +1 -0
- package/dist/normalization.js +152 -0
- package/dist/patch.js +1 -2
- package/dist/postProcessing.d.ts +8 -129
- package/dist/postProcessing.d.ts.map +1 -1
- package/dist/postProcessing.js +29 -280
- package/dist/types.d.ts +3 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -5
- package/dist/upstream.d.ts +1 -1
- package/dist/upstream.d.ts.map +1 -1
- package/dist/upstream.js +2 -53
- package/package.json +15 -14
- package/src/cli.ts +6 -6
- package/src/fluent/index.ts +19 -18
- package/src/fluent/shared-types.ts +55 -0
- package/src/fluent/types.ts +4 -55
- package/src/fluent/utils.ts +5 -5
- package/src/fluent/watch.ts +11 -24
- package/src/generate.ts +4 -4
- package/src/index.ts +10 -10
- package/src/kinds.ts +1 -1
- package/src/normalization.ts +181 -0
- package/src/postProcessing.ts +27 -244
- package/src/types.ts +3 -4
- package/src/upstream.ts +1 -1
- package/dist/fileSystem.d.ts +0 -11
- package/dist/fileSystem.d.ts.map +0 -1
- package/dist/fileSystem.js +0 -52
- package/src/fileSystem.ts +0 -25
package/dist/postProcessing.js
CHANGED
|
@@ -1,89 +1,25 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
2
|
// SPDX-FileCopyrightText: 2023-Present The Kubernetes Fluent Client Authors
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
9
|
-
}
|
|
10
|
-
Object.defineProperty(o, k2, desc);
|
|
11
|
-
}) : (function(o, m, k, k2) {
|
|
12
|
-
if (k2 === undefined) k2 = k;
|
|
13
|
-
o[k2] = m[k];
|
|
14
|
-
}));
|
|
15
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
16
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
17
|
-
}) : function(o, v) {
|
|
18
|
-
o["default"] = v;
|
|
19
|
-
});
|
|
20
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
21
|
-
var ownKeys = function(o) {
|
|
22
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
23
|
-
var ar = [];
|
|
24
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
25
|
-
return ar;
|
|
26
|
-
};
|
|
27
|
-
return ownKeys(o);
|
|
28
|
-
};
|
|
29
|
-
return function (mod) {
|
|
30
|
-
if (mod && mod.__esModule) return mod;
|
|
31
|
-
var result = {};
|
|
32
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
33
|
-
__setModuleDefault(result, mod);
|
|
34
|
-
return result;
|
|
35
|
-
};
|
|
36
|
-
})();
|
|
37
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.postProcessing = postProcessing;
|
|
39
|
-
exports.mapFilesToCRD = mapFilesToCRD;
|
|
40
|
-
exports.processFiles = processFiles;
|
|
41
|
-
exports.processAndModifySingleFile = processAndModifySingleFile;
|
|
42
|
-
exports.applyCRDPostProcessing = applyCRDPostProcessing;
|
|
43
|
-
exports.readFile = readFile;
|
|
44
|
-
exports.writeFile = writeFile;
|
|
45
|
-
exports.getGenericKindProperties = getGenericKindProperties;
|
|
46
|
-
exports.collectInterfaceNames = collectInterfaceNames;
|
|
47
|
-
exports.isClassExtendingGenericKind = isClassExtendingGenericKind;
|
|
48
|
-
exports.updateBraceBalance = updateBraceBalance;
|
|
49
|
-
exports.getPropertyPattern = getPropertyPattern;
|
|
50
|
-
exports.modifyPropertiesAndAddEslintDirective = modifyPropertiesAndAddEslintDirective;
|
|
51
|
-
exports.addDeclareAndOptionalModifiersToProperties = addDeclareAndOptionalModifiersToProperties;
|
|
52
|
-
exports.addDeclareToGenericKindProperties = addDeclareToGenericKindProperties;
|
|
53
|
-
exports.makePropertiesOptional = makePropertiesOptional;
|
|
54
|
-
exports.processEslintDisable = processEslintDisable;
|
|
55
|
-
exports.wrapWithFluentClient = wrapWithFluentClient;
|
|
56
|
-
exports.normalizeIndentation = normalizeIndentation;
|
|
57
|
-
exports.normalizeLineIndentation = normalizeLineIndentation;
|
|
58
|
-
exports.normalizePropertySpacing = normalizePropertySpacing;
|
|
59
|
-
exports.removePropertyStringAny = removePropertyStringAny;
|
|
60
|
-
exports.shouldWrapWithFluentClient = shouldWrapWithFluentClient;
|
|
61
|
-
exports.processLines = processLines;
|
|
62
|
-
exports.processClassContext = processClassContext;
|
|
63
|
-
exports.modifyAndNormalizeClassProperties = modifyAndNormalizeClassProperties;
|
|
64
|
-
exports.normalizeIndentationAndSpacing = normalizeIndentationAndSpacing;
|
|
65
|
-
exports.logError = logError;
|
|
66
|
-
const fs = __importStar(require("fs"));
|
|
67
|
-
const path = __importStar(require("path"));
|
|
68
|
-
const types_1 = require("./types");
|
|
69
|
-
const fileSystem_1 = require("./fileSystem");
|
|
3
|
+
import * as fs from "fs";
|
|
4
|
+
import * as path from "path";
|
|
5
|
+
import { GenericKind } from "./types.js";
|
|
6
|
+
import { modifyAndNormalizeClassProperties, normalizeIndentationAndSpacing, } from "./normalization.js";
|
|
70
7
|
const genericKindProperties = getGenericKindProperties();
|
|
71
8
|
/**
|
|
72
9
|
* Performs post-processing on generated TypeScript files.
|
|
73
10
|
*
|
|
74
11
|
* @param allResults The array of CRD results.
|
|
75
12
|
* @param opts The options for post-processing.
|
|
76
|
-
* @param fileSystem The file system interface for reading and writing files.
|
|
77
13
|
*/
|
|
78
|
-
async function postProcessing(allResults, opts
|
|
14
|
+
export async function postProcessing(allResults, opts) {
|
|
79
15
|
if (!opts.directory) {
|
|
80
16
|
opts.logFn("⚠️ Error: Directory is not defined.");
|
|
81
17
|
return;
|
|
82
18
|
}
|
|
83
|
-
const files =
|
|
19
|
+
const files = fs.readdirSync(opts.directory);
|
|
84
20
|
opts.logFn("\n🔧 Post-processing started...");
|
|
85
21
|
const fileResultMap = mapFilesToCRD(allResults);
|
|
86
|
-
await processFiles(files, fileResultMap, opts
|
|
22
|
+
await processFiles(files, fileResultMap, opts);
|
|
87
23
|
opts.logFn("🔧 Post-processing completed.\n");
|
|
88
24
|
}
|
|
89
25
|
/**
|
|
@@ -92,7 +28,7 @@ async function postProcessing(allResults, opts, fileSystem = new fileSystem_1.No
|
|
|
92
28
|
* @param allResults - The array of CRD results.
|
|
93
29
|
* @returns A map linking file names to their corresponding CRD results.
|
|
94
30
|
*/
|
|
95
|
-
function mapFilesToCRD(allResults) {
|
|
31
|
+
export function mapFilesToCRD(allResults) {
|
|
96
32
|
const fileResultMap = {};
|
|
97
33
|
for (const { name, crd, version } of allResults) {
|
|
98
34
|
const expectedFileName = `${name.toLowerCase()}-${version.toLowerCase()}.ts`;
|
|
@@ -109,9 +45,8 @@ function mapFilesToCRD(allResults) {
|
|
|
109
45
|
* @param files - The list of file names to process.
|
|
110
46
|
* @param fileResultMap - A map linking file names to their corresponding CRD results.
|
|
111
47
|
* @param opts - Options for the generation process.
|
|
112
|
-
* @param fileSystem - The file system interface for reading and writing files.
|
|
113
48
|
*/
|
|
114
|
-
async function processFiles(files, fileResultMap, opts
|
|
49
|
+
export async function processFiles(files, fileResultMap, opts) {
|
|
115
50
|
for (const file of files) {
|
|
116
51
|
if (!opts.directory) {
|
|
117
52
|
throw new Error("Directory is not defined.");
|
|
@@ -123,7 +58,7 @@ async function processFiles(files, fileResultMap, opts, fileSystem) {
|
|
|
123
58
|
continue;
|
|
124
59
|
}
|
|
125
60
|
try {
|
|
126
|
-
processAndModifySingleFile(filePath, fileResult, opts
|
|
61
|
+
processAndModifySingleFile(filePath, fileResult, opts);
|
|
127
62
|
}
|
|
128
63
|
catch (error) {
|
|
129
64
|
logError(error, filePath, opts.logFn);
|
|
@@ -139,14 +74,13 @@ async function processFiles(files, fileResultMap, opts, fileSystem) {
|
|
|
139
74
|
* @param fileResult.crd - The CustomResourceDefinition object.
|
|
140
75
|
* @param fileResult.version - The version of the CRD.
|
|
141
76
|
* @param opts - Options for the generation process.
|
|
142
|
-
* @param fileSystem - The file system interface for reading and writing files.
|
|
143
77
|
*/
|
|
144
|
-
function processAndModifySingleFile(filePath, fileResult, opts
|
|
78
|
+
export function processAndModifySingleFile(filePath, fileResult, opts) {
|
|
145
79
|
opts.logFn(`🔍 Processing file: ${filePath}`);
|
|
146
80
|
const { name, crd, version } = fileResult;
|
|
147
81
|
let fileContent;
|
|
148
82
|
try {
|
|
149
|
-
fileContent =
|
|
83
|
+
fileContent = fs.readFileSync(filePath, "utf8");
|
|
150
84
|
}
|
|
151
85
|
catch (error) {
|
|
152
86
|
logError(error, filePath, opts.logFn);
|
|
@@ -161,7 +95,7 @@ function processAndModifySingleFile(filePath, fileResult, opts, fileSystem) {
|
|
|
161
95
|
return;
|
|
162
96
|
}
|
|
163
97
|
try {
|
|
164
|
-
|
|
98
|
+
fs.writeFileSync(filePath, modifiedContent);
|
|
165
99
|
opts.logFn(`✅ Successfully processed and wrote file: ${filePath}`);
|
|
166
100
|
}
|
|
167
101
|
catch (error) {
|
|
@@ -178,11 +112,11 @@ function processAndModifySingleFile(filePath, fileResult, opts, fileSystem) {
|
|
|
178
112
|
* @param opts The options for processing.
|
|
179
113
|
* @returns The processed TypeScript file content.
|
|
180
114
|
*/
|
|
181
|
-
function applyCRDPostProcessing(content, name, crd, version, opts) {
|
|
115
|
+
export function applyCRDPostProcessing(content, name, crd, version, opts) {
|
|
182
116
|
try {
|
|
183
117
|
let lines = content.split("\n");
|
|
184
118
|
// Wraps with the fluent client if needed
|
|
185
|
-
if (
|
|
119
|
+
if (opts.language === "ts" && !opts.plain) {
|
|
186
120
|
lines = wrapWithFluentClient(lines, name, crd, version, opts.npmPackage);
|
|
187
121
|
}
|
|
188
122
|
const foundInterfaces = collectInterfaceNames(lines);
|
|
@@ -196,42 +130,18 @@ function applyCRDPostProcessing(content, name, crd, version, opts) {
|
|
|
196
130
|
throw new Error(`Error while applying post-processing for ${name}: ${error.message}`);
|
|
197
131
|
}
|
|
198
132
|
}
|
|
199
|
-
/**
|
|
200
|
-
* Reads the content of a file from disk.
|
|
201
|
-
*
|
|
202
|
-
* @param filePath The path to the file.
|
|
203
|
-
* @returns The file contents as a string.
|
|
204
|
-
*/
|
|
205
|
-
function readFile(filePath) {
|
|
206
|
-
try {
|
|
207
|
-
return fs.readFileSync(filePath, "utf8");
|
|
208
|
-
}
|
|
209
|
-
catch (error) {
|
|
210
|
-
throw new Error(`Failed to read file at ${filePath}: ${error.message}`);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Writes the modified content back to the file.
|
|
215
|
-
*
|
|
216
|
-
* @param filePath The path to the file.
|
|
217
|
-
* @param content The modified content to write.
|
|
218
|
-
*/
|
|
219
|
-
function writeFile(filePath, content) {
|
|
220
|
-
try {
|
|
221
|
-
fs.writeFileSync(filePath, content, "utf8");
|
|
222
|
-
}
|
|
223
|
-
catch (error) {
|
|
224
|
-
throw new Error(`Failed to write file at ${filePath}: ${error.message}`);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
133
|
/**
|
|
228
134
|
* Retrieves the properties of the `GenericKind` class, excluding dynamic properties like `[key: string]: any`.
|
|
229
135
|
*
|
|
230
136
|
* @returns An array of property names that belong to `GenericKind`.
|
|
231
137
|
*/
|
|
232
|
-
function getGenericKindProperties() {
|
|
233
|
-
|
|
234
|
-
|
|
138
|
+
export function getGenericKindProperties() {
|
|
139
|
+
// Ensure we always include standard Kubernetes resource properties
|
|
140
|
+
const standardProperties = ["kind", "apiVersion", "metadata"];
|
|
141
|
+
// Get actual properties from GenericKind
|
|
142
|
+
const instanceProperties = Object.getOwnPropertyNames(new GenericKind()).filter(prop => prop !== "[key: string]");
|
|
143
|
+
// Combine both sets of properties, removing duplicates
|
|
144
|
+
return Array.from(new Set([...standardProperties, ...instanceProperties]));
|
|
235
145
|
}
|
|
236
146
|
/**
|
|
237
147
|
* Collects interface names from TypeScript file lines.
|
|
@@ -239,7 +149,7 @@ function getGenericKindProperties() {
|
|
|
239
149
|
* @param lines The lines of the file content.
|
|
240
150
|
* @returns A set of found interface names.
|
|
241
151
|
*/
|
|
242
|
-
function collectInterfaceNames(lines) {
|
|
152
|
+
export function collectInterfaceNames(lines) {
|
|
243
153
|
// https://regex101.com/r/S6w8pW/1
|
|
244
154
|
const interfacePattern = /export interface (?<interfaceName>\w+)/;
|
|
245
155
|
const foundInterfaces = new Set();
|
|
@@ -257,7 +167,7 @@ function collectInterfaceNames(lines) {
|
|
|
257
167
|
* @param line The current line of code.
|
|
258
168
|
* @returns True if the line defines a class that extends `GenericKind`, false otherwise.
|
|
259
169
|
*/
|
|
260
|
-
function isClassExtendingGenericKind(line) {
|
|
170
|
+
export function isClassExtendingGenericKind(line) {
|
|
261
171
|
return line.includes("class") && line.includes("extends GenericKind");
|
|
262
172
|
}
|
|
263
173
|
/**
|
|
@@ -267,95 +177,9 @@ function isClassExtendingGenericKind(line) {
|
|
|
267
177
|
* @param braceBalance The current balance of curly braces.
|
|
268
178
|
* @returns The updated brace balance.
|
|
269
179
|
*/
|
|
270
|
-
function updateBraceBalance(line, braceBalance) {
|
|
180
|
+
export function updateBraceBalance(line, braceBalance) {
|
|
271
181
|
return braceBalance + (line.includes("{") ? 1 : 0) - (line.includes("}") ? 1 : 0);
|
|
272
182
|
}
|
|
273
|
-
/**
|
|
274
|
-
* Generates a regular expression to match a property pattern in TypeScript.
|
|
275
|
-
*
|
|
276
|
-
* @param prop The property name to match.
|
|
277
|
-
* @returns A regular expression to match the property pattern.
|
|
278
|
-
*/
|
|
279
|
-
function getPropertyPattern(prop) {
|
|
280
|
-
// For prop="kind", the pattern will match "kind ? :" or "kind :"
|
|
281
|
-
// https://regex101.com/r/mF8kXn/1
|
|
282
|
-
return new RegExp(`\\b${prop}\\b\\s*\\?\\s*:|\\b${prop}\\b\\s*:`);
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* Applies ESLint and property modifiers to a line of code.
|
|
286
|
-
*
|
|
287
|
-
* @param line - The current line of code.
|
|
288
|
-
* @param genericKindProperties - The list of properties from `GenericKind`.
|
|
289
|
-
* @param foundInterfaces - The set of found interfaces in the file.
|
|
290
|
-
* @returns The modified line.
|
|
291
|
-
*/
|
|
292
|
-
function modifyPropertiesAndAddEslintDirective(line, genericKindProperties, foundInterfaces) {
|
|
293
|
-
line = addDeclareAndOptionalModifiersToProperties(line, genericKindProperties, foundInterfaces);
|
|
294
|
-
line = processEslintDisable(line, genericKindProperties);
|
|
295
|
-
return line;
|
|
296
|
-
}
|
|
297
|
-
/**
|
|
298
|
-
* Applies property modifiers to a line of code.
|
|
299
|
-
*
|
|
300
|
-
* @param line The current line of code.
|
|
301
|
-
* @param genericKindProperties The list of properties from `GenericKind`.
|
|
302
|
-
* @param foundInterfaces The set of found interfaces in the file.
|
|
303
|
-
* @returns The modified line.
|
|
304
|
-
*/
|
|
305
|
-
function addDeclareAndOptionalModifiersToProperties(line, genericKindProperties, foundInterfaces) {
|
|
306
|
-
line = addDeclareToGenericKindProperties(line, genericKindProperties);
|
|
307
|
-
line = makePropertiesOptional(line, foundInterfaces);
|
|
308
|
-
line = normalizeLineIndentation(line);
|
|
309
|
-
return line;
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* Adds the `declare` keyword to `GenericKind` properties.
|
|
313
|
-
*
|
|
314
|
-
* @param line The current line of code.
|
|
315
|
-
* @param genericKindProperties The list of properties from `GenericKind`.
|
|
316
|
-
* @returns The modified line with the `declare` keyword, if applicable.
|
|
317
|
-
*/
|
|
318
|
-
function addDeclareToGenericKindProperties(line, genericKindProperties) {
|
|
319
|
-
for (const prop of genericKindProperties) {
|
|
320
|
-
const propertyPattern = getPropertyPattern(prop);
|
|
321
|
-
if (propertyPattern.test(line)) {
|
|
322
|
-
return line.replace(prop, `declare ${prop}`);
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
return line;
|
|
326
|
-
}
|
|
327
|
-
/**
|
|
328
|
-
* Makes a property optional if its type matches one of the found interfaces and it is not already optional.
|
|
329
|
-
*
|
|
330
|
-
* @param line The current line of code.
|
|
331
|
-
* @param foundInterfaces The set of found interfaces in the file.
|
|
332
|
-
* @returns The modified line with the optional `?` symbol.
|
|
333
|
-
*/
|
|
334
|
-
function makePropertiesOptional(line, foundInterfaces) {
|
|
335
|
-
// https://regex101.com/r/kX8TCj/1
|
|
336
|
-
const propertyTypePattern = /:\s*(?<propertyType>\w+)\s*;/;
|
|
337
|
-
const match = line.match(propertyTypePattern);
|
|
338
|
-
if (match?.groups?.propertyType) {
|
|
339
|
-
const { propertyType } = match.groups;
|
|
340
|
-
if (foundInterfaces.has(propertyType) && !line.includes("?")) {
|
|
341
|
-
return line.replace(":", "?:");
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
return line;
|
|
345
|
-
}
|
|
346
|
-
/**
|
|
347
|
-
* Adds an ESLint disable comment for `[key: string]: any` if it's not part of `GenericKind`.
|
|
348
|
-
*
|
|
349
|
-
* @param line The current line of code.
|
|
350
|
-
* @param genericKindProperties The list of properties from `GenericKind`.
|
|
351
|
-
* @returns The modified line with the ESLint disable comment.
|
|
352
|
-
*/
|
|
353
|
-
function processEslintDisable(line, genericKindProperties) {
|
|
354
|
-
if (line.includes("[key: string]: any") && !genericKindProperties.includes("[key: string]")) {
|
|
355
|
-
return ` // eslint-disable-next-line @typescript-eslint/no-explicit-any\n${line}`;
|
|
356
|
-
}
|
|
357
|
-
return line;
|
|
358
|
-
}
|
|
359
183
|
/**
|
|
360
184
|
* Wraps the generated TypeScript file with fluent client elements (`GenericKind` and `RegisterKind`).
|
|
361
185
|
*
|
|
@@ -366,7 +190,7 @@ function processEslintDisable(line, genericKindProperties) {
|
|
|
366
190
|
* @param npmPackage The NPM package name for the fluent client.
|
|
367
191
|
* @returns The processed TypeScript lines.
|
|
368
192
|
*/
|
|
369
|
-
function wrapWithFluentClient(lines, name, crd, version, npmPackage = "kubernetes-fluent-client") {
|
|
193
|
+
export function wrapWithFluentClient(lines, name, crd, version, npmPackage = "kubernetes-fluent-client") {
|
|
370
194
|
const autoGenNotice = `// This file is auto-generated by ${npmPackage}, do not edit manually`;
|
|
371
195
|
const imports = `import { GenericKind, RegisterKind } from "${npmPackage}";`;
|
|
372
196
|
const classIndex = lines.findIndex(line => line.includes(`export interface ${name} {`));
|
|
@@ -377,56 +201,6 @@ function wrapWithFluentClient(lines, name, crd, version, npmPackage = "kubernete
|
|
|
377
201
|
lines.push(`RegisterKind(${name}, {`, ` group: "${crd.spec.group}",`, ` version: "${version}",`, ` kind: "${name}",`, ` plural: "${crd.spec.names.plural}",`, `});`);
|
|
378
202
|
return lines;
|
|
379
203
|
}
|
|
380
|
-
/**
|
|
381
|
-
* Normalizes indentation for TypeScript lines to a consistent format.
|
|
382
|
-
*
|
|
383
|
-
* @param lines The generated TypeScript lines.
|
|
384
|
-
* @returns The lines with normalized indentation.
|
|
385
|
-
*/
|
|
386
|
-
function normalizeIndentation(lines) {
|
|
387
|
-
return lines.map(line => line.replace(/^ {4}/, " "));
|
|
388
|
-
}
|
|
389
|
-
/**
|
|
390
|
-
* Normalizes the indentation of a single line to use two spaces instead of four.
|
|
391
|
-
*
|
|
392
|
-
* @param line The line of code to normalize.
|
|
393
|
-
* @returns The line with normalized indentation.
|
|
394
|
-
*/
|
|
395
|
-
function normalizeLineIndentation(line) {
|
|
396
|
-
return line.replace(/^ {4}/, " ");
|
|
397
|
-
}
|
|
398
|
-
/**
|
|
399
|
-
* Normalizes spacing between property names and types in TypeScript lines.
|
|
400
|
-
*
|
|
401
|
-
* @param lines The generated TypeScript lines.
|
|
402
|
-
* @returns The lines with normalized property spacing.
|
|
403
|
-
*/
|
|
404
|
-
function normalizePropertySpacing(lines) {
|
|
405
|
-
// https://regex101.com/r/XEv3pL/1
|
|
406
|
-
return lines.map(line => line.replace(/\s*\?\s*:\s*/, "?: "));
|
|
407
|
-
}
|
|
408
|
-
/**
|
|
409
|
-
* Removes lines containing `[property: string]: any;` from TypeScript files.
|
|
410
|
-
*
|
|
411
|
-
* @param lines The generated TypeScript lines.
|
|
412
|
-
* @param opts The options for processing.
|
|
413
|
-
* @returns The lines with `[property: string]: any;` removed.
|
|
414
|
-
*/
|
|
415
|
-
function removePropertyStringAny(lines, opts) {
|
|
416
|
-
if (opts.language === "ts" || opts.language === "typescript") {
|
|
417
|
-
return lines.filter(line => !line.includes("[property: string]: any;"));
|
|
418
|
-
}
|
|
419
|
-
return lines;
|
|
420
|
-
}
|
|
421
|
-
/**
|
|
422
|
-
* Determines if the content should be wrapped with the fluent client.
|
|
423
|
-
*
|
|
424
|
-
* @param opts The options for generating the content.
|
|
425
|
-
* @returns True if the content should be wrapped with the fluent client, false otherwise.
|
|
426
|
-
*/
|
|
427
|
-
function shouldWrapWithFluentClient(opts) {
|
|
428
|
-
return opts.language === "ts" && !opts.plain;
|
|
429
|
-
}
|
|
430
204
|
/**
|
|
431
205
|
* Processes the lines of the TypeScript file, focusing on classes extending `GenericKind`.
|
|
432
206
|
*
|
|
@@ -435,7 +209,7 @@ function shouldWrapWithFluentClient(opts) {
|
|
|
435
209
|
* @param foundInterfaces The set of found interfaces in the file.
|
|
436
210
|
* @returns The processed lines.
|
|
437
211
|
*/
|
|
438
|
-
function processLines(lines, genericKindProperties, foundInterfaces) {
|
|
212
|
+
export function processLines(lines, genericKindProperties, foundInterfaces) {
|
|
439
213
|
let insideClass = false;
|
|
440
214
|
let braceBalance = 0;
|
|
441
215
|
return lines.map(line => {
|
|
@@ -455,7 +229,7 @@ function processLines(lines, genericKindProperties, foundInterfaces) {
|
|
|
455
229
|
* @param foundInterfaces The set of found interfaces in the file.
|
|
456
230
|
* @returns An object containing the updated line, updated insideClass flag, and braceBalance.
|
|
457
231
|
*/
|
|
458
|
-
function processClassContext(line, insideClass, braceBalance, genericKindProperties, foundInterfaces) {
|
|
232
|
+
export function processClassContext(line, insideClass, braceBalance, genericKindProperties, foundInterfaces) {
|
|
459
233
|
if (isClassExtendingGenericKind(line)) {
|
|
460
234
|
insideClass = true;
|
|
461
235
|
braceBalance = 0;
|
|
@@ -469,31 +243,6 @@ function processClassContext(line, insideClass, braceBalance, genericKindPropert
|
|
|
469
243
|
}
|
|
470
244
|
return { line, insideClass, braceBalance };
|
|
471
245
|
}
|
|
472
|
-
/**
|
|
473
|
-
* Processes a single line inside a class extending `GenericKind`.
|
|
474
|
-
*
|
|
475
|
-
* @param line The current line of code.
|
|
476
|
-
* @param genericKindProperties The list of properties from `GenericKind`.
|
|
477
|
-
* @param foundInterfaces The set of found interfaces in the file.
|
|
478
|
-
* @returns The modified line.
|
|
479
|
-
*/
|
|
480
|
-
function modifyAndNormalizeClassProperties(line, genericKindProperties, foundInterfaces) {
|
|
481
|
-
line = modifyPropertiesAndAddEslintDirective(line, genericKindProperties, foundInterfaces);
|
|
482
|
-
line = normalizeLineIndentation(line);
|
|
483
|
-
return line;
|
|
484
|
-
}
|
|
485
|
-
/**
|
|
486
|
-
* Normalizes lines after processing, including indentation, spacing, and removing unnecessary lines.
|
|
487
|
-
*
|
|
488
|
-
* @param lines The lines of the file content.
|
|
489
|
-
* @param opts The options for processing.
|
|
490
|
-
* @returns The normalized lines.
|
|
491
|
-
*/
|
|
492
|
-
function normalizeIndentationAndSpacing(lines, opts) {
|
|
493
|
-
let normalizedLines = normalizeIndentation(lines);
|
|
494
|
-
normalizedLines = normalizePropertySpacing(normalizedLines);
|
|
495
|
-
return removePropertyStringAny(normalizedLines, opts);
|
|
496
|
-
}
|
|
497
246
|
/**
|
|
498
247
|
* Handles logging for errors with stack trace.
|
|
499
248
|
*
|
|
@@ -501,7 +250,7 @@ function normalizeIndentationAndSpacing(lines, opts) {
|
|
|
501
250
|
* @param filePath The path of the file being processed.
|
|
502
251
|
* @param logFn The logging function.
|
|
503
252
|
*/
|
|
504
|
-
function logError(error, filePath, logFn) {
|
|
253
|
+
export function logError(error, filePath, logFn) {
|
|
505
254
|
logFn(`❌ Error processing file: ${filePath} - ${error.message}`);
|
|
506
255
|
logFn(`Stack trace: ${error.stack}`);
|
|
507
256
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { V1ObjectMeta } from "@kubernetes/client-node";
|
|
2
|
+
import type { KubernetesListObject, KubernetesObject } from "@kubernetes/client-node";
|
|
3
|
+
export type { KubernetesListObject, KubernetesObject };
|
|
3
4
|
export type GenericClass = abstract new () => any;
|
|
4
5
|
/**
|
|
5
6
|
* GenericKind is a generic Kubernetes object that can be used to represent any Kubernetes object
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AACtF,YAAY,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,CAAC;AAEvD,MAAM,MAAM,YAAY,GAAG,QAAQ,WAAW,GAAG,CAAC;AAElD;;;;GAIG;AACH,qBAAa,WAAY,YAAW,gBAAgB;IAClD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,YAAY,CAAC;IAExB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,yCAAyC;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,KAAK;IAEpB,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IACjE,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IACrD,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;CACvC"}
|
package/dist/types.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
2
|
// SPDX-FileCopyrightText: 2023-Present The Kubernetes Fluent Client Authors
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.GenericKind = void 0;
|
|
6
3
|
/**
|
|
7
4
|
* GenericKind is a generic Kubernetes object that can be used to represent any Kubernetes object
|
|
8
5
|
* that is not explicitly supported. This can be used on its own or as a base class for
|
|
9
6
|
* other types.
|
|
10
7
|
*/
|
|
11
|
-
class GenericKind {
|
|
8
|
+
export class GenericKind {
|
|
12
9
|
apiVersion;
|
|
13
10
|
kind;
|
|
14
11
|
metadata;
|
|
15
12
|
}
|
|
16
|
-
exports.GenericKind = GenericKind;
|
package/dist/upstream.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/** a is a collection of K8s types to be used within an action: `When(a.Configmap)` */
|
|
2
2
|
export { CoreV1Event as CoreEvent, EventsV1Event as Event, V1APIService as APIService, V1CSIDriver as CSIDriver, V1CertificateSigningRequest as CertificateSigningRequest, V1ClusterRole as ClusterRole, V1ClusterRoleBinding as ClusterRoleBinding, V1ConfigMap as ConfigMap, V1ControllerRevision as ControllerRevision, V1CronJob as CronJob, V1CustomResourceDefinition as CustomResourceDefinition, V1DaemonSet as DaemonSet, V1Deployment as Deployment, V1EndpointSlice as EndpointSlice, V1Endpoints as Endpoints, V1HorizontalPodAutoscaler as HorizontalPodAutoscaler, V1Ingress as Ingress, V1IngressClass as IngressClass, V1Job as Job, V1LimitRange as LimitRange, V1LocalSubjectAccessReview as LocalSubjectAccessReview, V1MutatingWebhookConfiguration as MutatingWebhookConfiguration, V1Namespace as Namespace, V1NetworkPolicy as NetworkPolicy, V1Node as Node, V1PersistentVolume as PersistentVolume, V1PersistentVolumeClaim as PersistentVolumeClaim, V1Pod as Pod, V1PodDisruptionBudget as PodDisruptionBudget, V1PodTemplate as PodTemplate, V1ReplicaSet as ReplicaSet, V1ReplicationController as ReplicationController, V1ResourceQuota as ResourceQuota, V1Role as Role, V1RoleBinding as RoleBinding, V1RuntimeClass as RuntimeClass, V1Secret as Secret, V1SelfSubjectAccessReview as SelfSubjectAccessReview, V1SelfSubjectRulesReview as SelfSubjectRulesReview, V1Service as Service, V1ServiceAccount as ServiceAccount, V1StatefulSet as StatefulSet, V1StorageClass as StorageClass, V1SubjectAccessReview as SubjectAccessReview, V1TokenReview as TokenReview, V1ValidatingWebhookConfiguration as ValidatingWebhookConfiguration, V1VolumeAttachment as VolumeAttachment, } from "@kubernetes/client-node";
|
|
3
|
-
export { GenericKind } from "./types";
|
|
3
|
+
export { GenericKind } from "./types.js";
|
|
4
4
|
//# sourceMappingURL=upstream.d.ts.map
|
package/dist/upstream.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upstream.d.ts","sourceRoot":"","sources":["../src/upstream.ts"],"names":[],"mappings":"AAGA,sFAAsF;AACtF,OAAO,EACL,WAAW,IAAI,SAAS,EACxB,aAAa,IAAI,KAAK,EACtB,YAAY,IAAI,UAAU,EAC1B,WAAW,IAAI,SAAS,EACxB,2BAA2B,IAAI,yBAAyB,EACxD,aAAa,IAAI,WAAW,EAC5B,oBAAoB,IAAI,kBAAkB,EAC1C,WAAW,IAAI,SAAS,EACxB,oBAAoB,IAAI,kBAAkB,EAC1C,SAAS,IAAI,OAAO,EACpB,0BAA0B,IAAI,wBAAwB,EACtD,WAAW,IAAI,SAAS,EACxB,YAAY,IAAI,UAAU,EAC1B,eAAe,IAAI,aAAa,EAChC,WAAW,IAAI,SAAS,EACxB,yBAAyB,IAAI,uBAAuB,EACpD,SAAS,IAAI,OAAO,EACpB,cAAc,IAAI,YAAY,EAC9B,KAAK,IAAI,GAAG,EACZ,YAAY,IAAI,UAAU,EAC1B,0BAA0B,IAAI,wBAAwB,EACtD,8BAA8B,IAAI,4BAA4B,EAC9D,WAAW,IAAI,SAAS,EACxB,eAAe,IAAI,aAAa,EAChC,MAAM,IAAI,IAAI,EACd,kBAAkB,IAAI,gBAAgB,EACtC,uBAAuB,IAAI,qBAAqB,EAChD,KAAK,IAAI,GAAG,EACZ,qBAAqB,IAAI,mBAAmB,EAC5C,aAAa,IAAI,WAAW,EAC5B,YAAY,IAAI,UAAU,EAC1B,uBAAuB,IAAI,qBAAqB,EAChD,eAAe,IAAI,aAAa,EAChC,MAAM,IAAI,IAAI,EACd,aAAa,IAAI,WAAW,EAC5B,cAAc,IAAI,YAAY,EAC9B,QAAQ,IAAI,MAAM,EAClB,yBAAyB,IAAI,uBAAuB,EACpD,wBAAwB,IAAI,sBAAsB,EAClD,SAAS,IAAI,OAAO,EACpB,gBAAgB,IAAI,cAAc,EAClC,aAAa,IAAI,WAAW,EAC5B,cAAc,IAAI,YAAY,EAC9B,qBAAqB,IAAI,mBAAmB,EAC5C,aAAa,IAAI,WAAW,EAC5B,gCAAgC,IAAI,8BAA8B,EAClE,kBAAkB,IAAI,gBAAgB,GACvC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"upstream.d.ts","sourceRoot":"","sources":["../src/upstream.ts"],"names":[],"mappings":"AAGA,sFAAsF;AACtF,OAAO,EACL,WAAW,IAAI,SAAS,EACxB,aAAa,IAAI,KAAK,EACtB,YAAY,IAAI,UAAU,EAC1B,WAAW,IAAI,SAAS,EACxB,2BAA2B,IAAI,yBAAyB,EACxD,aAAa,IAAI,WAAW,EAC5B,oBAAoB,IAAI,kBAAkB,EAC1C,WAAW,IAAI,SAAS,EACxB,oBAAoB,IAAI,kBAAkB,EAC1C,SAAS,IAAI,OAAO,EACpB,0BAA0B,IAAI,wBAAwB,EACtD,WAAW,IAAI,SAAS,EACxB,YAAY,IAAI,UAAU,EAC1B,eAAe,IAAI,aAAa,EAChC,WAAW,IAAI,SAAS,EACxB,yBAAyB,IAAI,uBAAuB,EACpD,SAAS,IAAI,OAAO,EACpB,cAAc,IAAI,YAAY,EAC9B,KAAK,IAAI,GAAG,EACZ,YAAY,IAAI,UAAU,EAC1B,0BAA0B,IAAI,wBAAwB,EACtD,8BAA8B,IAAI,4BAA4B,EAC9D,WAAW,IAAI,SAAS,EACxB,eAAe,IAAI,aAAa,EAChC,MAAM,IAAI,IAAI,EACd,kBAAkB,IAAI,gBAAgB,EACtC,uBAAuB,IAAI,qBAAqB,EAChD,KAAK,IAAI,GAAG,EACZ,qBAAqB,IAAI,mBAAmB,EAC5C,aAAa,IAAI,WAAW,EAC5B,YAAY,IAAI,UAAU,EAC1B,uBAAuB,IAAI,qBAAqB,EAChD,eAAe,IAAI,aAAa,EAChC,MAAM,IAAI,IAAI,EACd,aAAa,IAAI,WAAW,EAC5B,cAAc,IAAI,YAAY,EAC9B,QAAQ,IAAI,MAAM,EAClB,yBAAyB,IAAI,uBAAuB,EACpD,wBAAwB,IAAI,sBAAsB,EAClD,SAAS,IAAI,OAAO,EACpB,gBAAgB,IAAI,cAAc,EAClC,aAAa,IAAI,WAAW,EAC5B,cAAc,IAAI,YAAY,EAC9B,qBAAqB,IAAI,mBAAmB,EAC5C,aAAa,IAAI,WAAW,EAC5B,gCAAgC,IAAI,8BAA8B,EAClE,kBAAkB,IAAI,gBAAgB,GACvC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/upstream.js
CHANGED
|
@@ -1,56 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
2
|
// SPDX-FileCopyrightText: 2023-Present The Kubernetes Fluent Client Authors
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.GenericKind = exports.VolumeAttachment = exports.ValidatingWebhookConfiguration = exports.TokenReview = exports.SubjectAccessReview = exports.StorageClass = exports.StatefulSet = exports.ServiceAccount = exports.Service = exports.SelfSubjectRulesReview = exports.SelfSubjectAccessReview = exports.Secret = exports.RuntimeClass = exports.RoleBinding = exports.Role = exports.ResourceQuota = exports.ReplicationController = exports.ReplicaSet = exports.PodTemplate = exports.PodDisruptionBudget = exports.Pod = exports.PersistentVolumeClaim = exports.PersistentVolume = exports.Node = exports.NetworkPolicy = exports.Namespace = exports.MutatingWebhookConfiguration = exports.LocalSubjectAccessReview = exports.LimitRange = exports.Job = exports.IngressClass = exports.Ingress = exports.HorizontalPodAutoscaler = exports.Endpoints = exports.EndpointSlice = exports.Deployment = exports.DaemonSet = exports.CustomResourceDefinition = exports.CronJob = exports.ControllerRevision = exports.ConfigMap = exports.ClusterRoleBinding = exports.ClusterRole = exports.CertificateSigningRequest = exports.CSIDriver = exports.APIService = exports.Event = exports.CoreEvent = void 0;
|
|
6
3
|
/** a is a collection of K8s types to be used within an action: `When(a.Configmap)` */
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Object.defineProperty(exports, "Event", { enumerable: true, get: function () { return client_node_1.EventsV1Event; } });
|
|
10
|
-
Object.defineProperty(exports, "APIService", { enumerable: true, get: function () { return client_node_1.V1APIService; } });
|
|
11
|
-
Object.defineProperty(exports, "CSIDriver", { enumerable: true, get: function () { return client_node_1.V1CSIDriver; } });
|
|
12
|
-
Object.defineProperty(exports, "CertificateSigningRequest", { enumerable: true, get: function () { return client_node_1.V1CertificateSigningRequest; } });
|
|
13
|
-
Object.defineProperty(exports, "ClusterRole", { enumerable: true, get: function () { return client_node_1.V1ClusterRole; } });
|
|
14
|
-
Object.defineProperty(exports, "ClusterRoleBinding", { enumerable: true, get: function () { return client_node_1.V1ClusterRoleBinding; } });
|
|
15
|
-
Object.defineProperty(exports, "ConfigMap", { enumerable: true, get: function () { return client_node_1.V1ConfigMap; } });
|
|
16
|
-
Object.defineProperty(exports, "ControllerRevision", { enumerable: true, get: function () { return client_node_1.V1ControllerRevision; } });
|
|
17
|
-
Object.defineProperty(exports, "CronJob", { enumerable: true, get: function () { return client_node_1.V1CronJob; } });
|
|
18
|
-
Object.defineProperty(exports, "CustomResourceDefinition", { enumerable: true, get: function () { return client_node_1.V1CustomResourceDefinition; } });
|
|
19
|
-
Object.defineProperty(exports, "DaemonSet", { enumerable: true, get: function () { return client_node_1.V1DaemonSet; } });
|
|
20
|
-
Object.defineProperty(exports, "Deployment", { enumerable: true, get: function () { return client_node_1.V1Deployment; } });
|
|
21
|
-
Object.defineProperty(exports, "EndpointSlice", { enumerable: true, get: function () { return client_node_1.V1EndpointSlice; } });
|
|
22
|
-
Object.defineProperty(exports, "Endpoints", { enumerable: true, get: function () { return client_node_1.V1Endpoints; } });
|
|
23
|
-
Object.defineProperty(exports, "HorizontalPodAutoscaler", { enumerable: true, get: function () { return client_node_1.V1HorizontalPodAutoscaler; } });
|
|
24
|
-
Object.defineProperty(exports, "Ingress", { enumerable: true, get: function () { return client_node_1.V1Ingress; } });
|
|
25
|
-
Object.defineProperty(exports, "IngressClass", { enumerable: true, get: function () { return client_node_1.V1IngressClass; } });
|
|
26
|
-
Object.defineProperty(exports, "Job", { enumerable: true, get: function () { return client_node_1.V1Job; } });
|
|
27
|
-
Object.defineProperty(exports, "LimitRange", { enumerable: true, get: function () { return client_node_1.V1LimitRange; } });
|
|
28
|
-
Object.defineProperty(exports, "LocalSubjectAccessReview", { enumerable: true, get: function () { return client_node_1.V1LocalSubjectAccessReview; } });
|
|
29
|
-
Object.defineProperty(exports, "MutatingWebhookConfiguration", { enumerable: true, get: function () { return client_node_1.V1MutatingWebhookConfiguration; } });
|
|
30
|
-
Object.defineProperty(exports, "Namespace", { enumerable: true, get: function () { return client_node_1.V1Namespace; } });
|
|
31
|
-
Object.defineProperty(exports, "NetworkPolicy", { enumerable: true, get: function () { return client_node_1.V1NetworkPolicy; } });
|
|
32
|
-
Object.defineProperty(exports, "Node", { enumerable: true, get: function () { return client_node_1.V1Node; } });
|
|
33
|
-
Object.defineProperty(exports, "PersistentVolume", { enumerable: true, get: function () { return client_node_1.V1PersistentVolume; } });
|
|
34
|
-
Object.defineProperty(exports, "PersistentVolumeClaim", { enumerable: true, get: function () { return client_node_1.V1PersistentVolumeClaim; } });
|
|
35
|
-
Object.defineProperty(exports, "Pod", { enumerable: true, get: function () { return client_node_1.V1Pod; } });
|
|
36
|
-
Object.defineProperty(exports, "PodDisruptionBudget", { enumerable: true, get: function () { return client_node_1.V1PodDisruptionBudget; } });
|
|
37
|
-
Object.defineProperty(exports, "PodTemplate", { enumerable: true, get: function () { return client_node_1.V1PodTemplate; } });
|
|
38
|
-
Object.defineProperty(exports, "ReplicaSet", { enumerable: true, get: function () { return client_node_1.V1ReplicaSet; } });
|
|
39
|
-
Object.defineProperty(exports, "ReplicationController", { enumerable: true, get: function () { return client_node_1.V1ReplicationController; } });
|
|
40
|
-
Object.defineProperty(exports, "ResourceQuota", { enumerable: true, get: function () { return client_node_1.V1ResourceQuota; } });
|
|
41
|
-
Object.defineProperty(exports, "Role", { enumerable: true, get: function () { return client_node_1.V1Role; } });
|
|
42
|
-
Object.defineProperty(exports, "RoleBinding", { enumerable: true, get: function () { return client_node_1.V1RoleBinding; } });
|
|
43
|
-
Object.defineProperty(exports, "RuntimeClass", { enumerable: true, get: function () { return client_node_1.V1RuntimeClass; } });
|
|
44
|
-
Object.defineProperty(exports, "Secret", { enumerable: true, get: function () { return client_node_1.V1Secret; } });
|
|
45
|
-
Object.defineProperty(exports, "SelfSubjectAccessReview", { enumerable: true, get: function () { return client_node_1.V1SelfSubjectAccessReview; } });
|
|
46
|
-
Object.defineProperty(exports, "SelfSubjectRulesReview", { enumerable: true, get: function () { return client_node_1.V1SelfSubjectRulesReview; } });
|
|
47
|
-
Object.defineProperty(exports, "Service", { enumerable: true, get: function () { return client_node_1.V1Service; } });
|
|
48
|
-
Object.defineProperty(exports, "ServiceAccount", { enumerable: true, get: function () { return client_node_1.V1ServiceAccount; } });
|
|
49
|
-
Object.defineProperty(exports, "StatefulSet", { enumerable: true, get: function () { return client_node_1.V1StatefulSet; } });
|
|
50
|
-
Object.defineProperty(exports, "StorageClass", { enumerable: true, get: function () { return client_node_1.V1StorageClass; } });
|
|
51
|
-
Object.defineProperty(exports, "SubjectAccessReview", { enumerable: true, get: function () { return client_node_1.V1SubjectAccessReview; } });
|
|
52
|
-
Object.defineProperty(exports, "TokenReview", { enumerable: true, get: function () { return client_node_1.V1TokenReview; } });
|
|
53
|
-
Object.defineProperty(exports, "ValidatingWebhookConfiguration", { enumerable: true, get: function () { return client_node_1.V1ValidatingWebhookConfiguration; } });
|
|
54
|
-
Object.defineProperty(exports, "VolumeAttachment", { enumerable: true, get: function () { return client_node_1.V1VolumeAttachment; } });
|
|
55
|
-
var types_1 = require("./types");
|
|
56
|
-
Object.defineProperty(exports, "GenericKind", { enumerable: true, get: function () { return types_1.GenericKind; } });
|
|
4
|
+
export { CoreV1Event as CoreEvent, EventsV1Event as Event, V1APIService as APIService, V1CSIDriver as CSIDriver, V1CertificateSigningRequest as CertificateSigningRequest, V1ClusterRole as ClusterRole, V1ClusterRoleBinding as ClusterRoleBinding, V1ConfigMap as ConfigMap, V1ControllerRevision as ControllerRevision, V1CronJob as CronJob, V1CustomResourceDefinition as CustomResourceDefinition, V1DaemonSet as DaemonSet, V1Deployment as Deployment, V1EndpointSlice as EndpointSlice, V1Endpoints as Endpoints, V1HorizontalPodAutoscaler as HorizontalPodAutoscaler, V1Ingress as Ingress, V1IngressClass as IngressClass, V1Job as Job, V1LimitRange as LimitRange, V1LocalSubjectAccessReview as LocalSubjectAccessReview, V1MutatingWebhookConfiguration as MutatingWebhookConfiguration, V1Namespace as Namespace, V1NetworkPolicy as NetworkPolicy, V1Node as Node, V1PersistentVolume as PersistentVolume, V1PersistentVolumeClaim as PersistentVolumeClaim, V1Pod as Pod, V1PodDisruptionBudget as PodDisruptionBudget, V1PodTemplate as PodTemplate, V1ReplicaSet as ReplicaSet, V1ReplicationController as ReplicationController, V1ResourceQuota as ResourceQuota, V1Role as Role, V1RoleBinding as RoleBinding, V1RuntimeClass as RuntimeClass, V1Secret as Secret, V1SelfSubjectAccessReview as SelfSubjectAccessReview, V1SelfSubjectRulesReview as SelfSubjectRulesReview, V1Service as Service, V1ServiceAccount as ServiceAccount, V1StatefulSet as StatefulSet, V1StorageClass as StorageClass, V1SubjectAccessReview as SubjectAccessReview, V1TokenReview as TokenReview, V1ValidatingWebhookConfiguration as ValidatingWebhookConfiguration, V1VolumeAttachment as VolumeAttachment, } from "@kubernetes/client-node";
|
|
5
|
+
export { GenericKind } from "./types.js";
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kubernetes-fluent-client",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.1",
|
|
4
4
|
"description": "A @kubernetes/client-node fluent API wrapper that leverages K8s Server Side Apply.",
|
|
5
5
|
"bin": "./dist/cli.js",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
|
+
"type": "module",
|
|
8
9
|
"engines": {
|
|
9
10
|
"node": ">=20.0.0"
|
|
10
11
|
},
|
|
@@ -37,19 +38,19 @@
|
|
|
37
38
|
"prebuild": "rm -rf dist",
|
|
38
39
|
"build": "tsc",
|
|
39
40
|
"semantic-release": "semantic-release",
|
|
40
|
-
"test": "
|
|
41
|
-
"test:e2e": "
|
|
42
|
-
"test:e2e:prep-crds": "kubectl apply -f test/ && npx
|
|
41
|
+
"test": "vitest src run --coverage",
|
|
42
|
+
"test:e2e": "vitest run e2e/",
|
|
43
|
+
"test:e2e:prep-crds": "kubectl apply -f test/ && npx tsx src/cli.ts crd ./test/datastore.crd.yaml e2e && npx tsx src/cli.ts crd https://raw.githubusercontent.com/defenseunicorns/kubernetes-fluent-client/refs/heads/main/test/webapp.crd.yaml e2e",
|
|
43
44
|
"test:e2e:prep-cluster": "k3d cluster create kfc-dev --k3s-arg '--debug@server:0' --wait && kubectl rollout status deployment -n kube-system",
|
|
44
45
|
"test:e2e:prep-image": "npm run build && npm pack && npm i kubernetes-fluent-client-0.0.0-development.tgz --no-save",
|
|
45
|
-
"test:e2e:run": "npm run test:e2e:prep-cluster && npm run test:e2e:prep-crds && npm run test:e2e:prep-image &&
|
|
46
|
+
"test:e2e:run": "npm run test:e2e:prep-cluster && npm run test:e2e:prep-crds && npm run test:e2e:prep-image && npm run test:e2e && npm run test:e2e:cleanup",
|
|
46
47
|
"test:e2e:cleanup": "k3d cluster delete kfc-dev",
|
|
47
48
|
"format:check": "eslint src e2e && prettier . --check",
|
|
48
49
|
"format:fix": "eslint --fix src e2e && prettier . --write",
|
|
49
50
|
"prepare": "if [ \"$NODE_ENV\" != 'production' ]; then husky; fi"
|
|
50
51
|
},
|
|
51
52
|
"dependencies": {
|
|
52
|
-
"@kubernetes/client-node": "1.
|
|
53
|
+
"@kubernetes/client-node": "1.3.0",
|
|
53
54
|
"fast-json-patch": "3.1.1",
|
|
54
55
|
"http-status-codes": "2.3.0",
|
|
55
56
|
"node-fetch": "2.7.0",
|
|
@@ -63,22 +64,22 @@
|
|
|
63
64
|
"@commitlint/config-conventional": "19.8.1",
|
|
64
65
|
"@eslint/eslintrc": "^3.1.0",
|
|
65
66
|
"@eslint/js": "^9.14.0",
|
|
66
|
-
"@jest/globals": "29.7.0",
|
|
67
67
|
"@types/byline": "4.2.36",
|
|
68
|
-
"@types/readable-stream": "4.0.
|
|
68
|
+
"@types/readable-stream": "4.0.21",
|
|
69
69
|
"@types/urijs": "^1.19.25",
|
|
70
|
+
"@types/ws": "^8.18.1",
|
|
70
71
|
"@types/yargs": "17.0.33",
|
|
71
|
-
"@typescript-eslint/eslint-plugin": "8.33.
|
|
72
|
-
"@typescript-eslint/parser": "8.33.
|
|
73
|
-
"
|
|
72
|
+
"@typescript-eslint/eslint-plugin": "8.33.1",
|
|
73
|
+
"@typescript-eslint/parser": "8.33.1",
|
|
74
|
+
"@vitest/coverage-v8": "^3.2.1",
|
|
75
|
+
"eslint-plugin-jsdoc": "50.7.1",
|
|
74
76
|
"globals": "^16.0.0",
|
|
75
77
|
"husky": "^9.1.6",
|
|
76
|
-
"jest": "29.7.0",
|
|
77
78
|
"lint-staged": "^16.0.0",
|
|
78
79
|
"prettier": "3.5.3",
|
|
79
80
|
"semantic-release": "24.2.5",
|
|
80
|
-
"
|
|
81
|
-
"
|
|
81
|
+
"typescript": "5.8.3",
|
|
82
|
+
"vitest": "^3.2.1"
|
|
82
83
|
},
|
|
83
84
|
"overrides": {
|
|
84
85
|
"semantic-release@24.2.0": {
|