kubernetes-fluent-client 3.7.0-nightly.1 → 3.7.0

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 CHANGED
@@ -20,10 +20,6 @@ void yargs(hideBin(process.argv))
20
20
  .positional("directory", {
21
21
  describe: "the directory to output the generated types to",
22
22
  type: "string",
23
- })
24
- .option("overrideClassName", {
25
- type: "string",
26
- description: "override the class name for the generated types, useful for generating types when multiple CRDs have the same kind",
27
23
  })
28
24
  .option("plain", {
29
25
  alias: "p",
@@ -46,7 +42,6 @@ void yargs(hideBin(process.argv))
46
42
  }, async (argv) => {
47
43
  const opts = argv;
48
44
  opts.logFn = console.log;
49
- opts.npmPackage = "kubernetes-fluent-client";
50
45
  // Pass the `post` flag to opts
51
46
  opts.noPost = argv.noPost;
52
47
  // Use NodeFileSystem as the file system for post-processing
@@ -5,7 +5,6 @@ export type QuicktypeLang = Parameters<typeof quicktype>[0]["lang"];
5
5
  export interface GenerateOptions {
6
6
  source: string;
7
7
  directory?: string;
8
- overrideClassName?: string;
9
8
  plain?: boolean;
10
9
  language: QuicktypeLang;
11
10
  npmPackage?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,SAAS,EAET,cAAc,EACd,SAAS,EACV,MAAM,gBAAgB,CAAC;AAIxB,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AACpE,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,KAAK,CAAC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C,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,MAAM,EAAE,CAAC,CASnB;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EAAE,EACjB,QAAQ,EAAE,MAAM,GAAG,cAAc,GAChC,IAAI,CAON;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,wBAAwB,EAAE,CAAC,CA0B/F;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,GAAG,IAAI,CAMtD;AAED;;;;;GAKG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAC5D;IACE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,wBAAwB,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;CACjB,EAAE,CACJ,CA8BA"}
package/dist/generate.js CHANGED
@@ -15,8 +15,7 @@ import { CustomResourceDefinition } from "./upstream.js";
15
15
  * @returns A promise that resolves to a record of generated TypeScript types.
16
16
  */
17
17
  export async function convertCRDtoTS(crd, opts) {
18
- const name = opts.overrideClassName || crd.spec.names.kind;
19
- const originalKind = crd.spec.names.kind;
18
+ const name = crd.spec.names.kind;
20
19
  const results = {};
21
20
  const output = [];
22
21
  // Check for missing versions or empty schema
@@ -34,7 +33,7 @@ export async function convertCRDtoTS(crd, opts) {
34
33
  opts.logFn(`- Generating ${crd.spec.group}/${match.name} types for ${name}`);
35
34
  const inputData = await prepareInputData(name, schema);
36
35
  const generatedTypes = await generateTypes(inputData, opts);
37
- const fileName = `${originalKind.toLowerCase()}-${match.name.toLowerCase()}`;
36
+ const fileName = `${name.toLowerCase()}-${match.name.toLowerCase()}`;
38
37
  writeGeneratedFile(fileName, opts.directory || "", generatedTypes, opts.language || "ts");
39
38
  results[fileName] = generatedTypes;
40
39
  output.push({ results, name, crd, version: match.name });
@@ -89,10 +89,10 @@ export declare function updateBraceBalance(line: string, braceBalance: number):
89
89
  * @param name The name of the schema.
90
90
  * @param crd The CustomResourceDefinition object.
91
91
  * @param version The version of the CRD.
92
- * @param opts the options for the generation process.
92
+ * @param npmPackage The NPM package name for the fluent client.
93
93
  * @returns The processed TypeScript lines.
94
94
  */
95
- export declare function wrapWithFluentClient(lines: string[], name: string, crd: CustomResourceDefinition, version: string, opts: GenerateOptions): string[];
95
+ export declare function wrapWithFluentClient(lines: string[], name: string, crd: CustomResourceDefinition, version: string, npmPackage?: string): string[];
96
96
  /**
97
97
  * Processes the lines of the TypeScript file, focusing on classes extending `GenericKind`.
98
98
  *
@@ -1 +1 @@
1
- {"version":3,"file":"postProcessing.d.ts","sourceRoot":"","sources":["../src/postProcessing.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAMzD,KAAK,SAAS,GAAG;IACf,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,wBAAwB,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,KAAK,kBAAkB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,OAAO,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC;AAIvF;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,UAAU,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,eAAe,iBAalF;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,MAAM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KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,QAGpF"}
@@ -31,7 +31,7 @@ export async function postProcessing(allResults, opts) {
31
31
  export function mapFilesToCRD(allResults) {
32
32
  const fileResultMap = {};
33
33
  for (const { name, crd, version } of allResults) {
34
- const expectedFileName = `${crd.spec.names.kind.toLowerCase()}-${version.toLowerCase()}.ts`;
34
+ const expectedFileName = `${name.toLowerCase()}-${version.toLowerCase()}.ts`;
35
35
  fileResultMap[expectedFileName] = { name, crd, version };
36
36
  }
37
37
  if (Object.keys(fileResultMap).length === 0) {
@@ -117,7 +117,7 @@ export function applyCRDPostProcessing(content, name, crd, version, opts) {
117
117
  let lines = content.split("\n");
118
118
  // Wraps with the fluent client if needed
119
119
  if (opts.language === "ts" && !opts.plain) {
120
- lines = wrapWithFluentClient(lines, name, crd, version, opts);
120
+ lines = wrapWithFluentClient(lines, name, crd, version, opts.npmPackage);
121
121
  }
122
122
  const foundInterfaces = collectInterfaceNames(lines);
123
123
  // Process the lines, focusing on classes extending `GenericKind`
@@ -187,18 +187,18 @@ export function updateBraceBalance(line, braceBalance) {
187
187
  * @param name The name of the schema.
188
188
  * @param crd The CustomResourceDefinition object.
189
189
  * @param version The version of the CRD.
190
- * @param opts the options for the generation process.
190
+ * @param npmPackage The NPM package name for the fluent client.
191
191
  * @returns The processed TypeScript lines.
192
192
  */
193
- export function wrapWithFluentClient(lines, name, crd, version, opts) {
194
- const autoGenNotice = `// This file is auto-generated by ${opts.npmPackage}, do not edit manually`;
195
- const imports = `import { GenericKind, RegisterKind } from "${opts.npmPackage}";`;
193
+ export function wrapWithFluentClient(lines, name, crd, version, npmPackage = "kubernetes-fluent-client") {
194
+ const autoGenNotice = `// This file is auto-generated by ${npmPackage}, do not edit manually`;
195
+ const imports = `import { GenericKind, RegisterKind } from "${npmPackage}";`;
196
196
  const classIndex = lines.findIndex(line => line.includes(`export interface ${name} {`));
197
197
  if (classIndex !== -1) {
198
198
  lines[classIndex] = `export class ${name} extends GenericKind {`;
199
199
  }
200
200
  lines.unshift(autoGenNotice, imports);
201
- lines.push(`RegisterKind(${name}, {`, ` group: "${crd.spec.group}",`, ` version: "${version}",`, ` kind: "${crd.spec.names.kind}",`, ` plural: "${crd.spec.names.plural}",`, `});`);
201
+ lines.push(`RegisterKind(${name}, {`, ` group: "${crd.spec.group}",`, ` version: "${version}",`, ` kind: "${name}",`, ` plural: "${crd.spec.names.plural}",`, `});`);
202
202
  return lines;
203
203
  }
204
204
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kubernetes-fluent-client",
3
- "version": "3.7.0-nightly.1",
3
+ "version": "3.7.0",
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",
package/src/cli.ts CHANGED
@@ -27,11 +27,6 @@ void yargs(hideBin(process.argv))
27
27
  describe: "the directory to output the generated types to",
28
28
  type: "string",
29
29
  })
30
- .option("overrideClassName", {
31
- type: "string",
32
- description:
33
- "override the class name for the generated types, useful for generating types when multiple CRDs have the same kind",
34
- })
35
30
  .option("plain", {
36
31
  alias: "p",
37
32
  type: "boolean",
@@ -56,7 +51,6 @@ void yargs(hideBin(process.argv))
56
51
  async argv => {
57
52
  const opts = argv as unknown as GenerateOptions;
58
53
  opts.logFn = console.log;
59
- opts.npmPackage = "kubernetes-fluent-client";
60
54
 
61
55
  // Pass the `post` flag to opts
62
56
  opts.noPost = argv.noPost as boolean;
package/src/generate.ts CHANGED
@@ -20,7 +20,6 @@ export type QuicktypeLang = Parameters<typeof quicktype>[0]["lang"];
20
20
  export interface GenerateOptions {
21
21
  source: string; // URL, file path, or K8s CRD name
22
22
  directory?: string; // Output directory path
23
- overrideClassName?: string; // Override class name for generated types
24
23
  plain?: boolean; // Disable fluent client wrapping
25
24
  language: QuicktypeLang; // Language for type generation (default: "ts")
26
25
  npmPackage?: string; // Override NPM package
@@ -46,8 +45,7 @@ export async function convertCRDtoTS(
46
45
  version: string;
47
46
  }[]
48
47
  > {
49
- const name = opts.overrideClassName || crd.spec.names.kind;
50
- const originalKind = crd.spec.names.kind;
48
+ const name = crd.spec.names.kind;
51
49
  const results: Record<string, string[]> = {};
52
50
  const output: {
53
51
  results: Record<string, string[]>;
@@ -77,7 +75,7 @@ export async function convertCRDtoTS(
77
75
  const inputData = await prepareInputData(name, schema);
78
76
  const generatedTypes = await generateTypes(inputData, opts);
79
77
 
80
- const fileName = `${originalKind.toLowerCase()}-${match.name.toLowerCase()}`;
78
+ const fileName = `${name.toLowerCase()}-${match.name.toLowerCase()}`;
81
79
  writeGeneratedFile(fileName, opts.directory || "", generatedTypes, opts.language || "ts");
82
80
 
83
81
  results[fileName] = generatedTypes;
@@ -52,7 +52,7 @@ export function mapFilesToCRD(allResults: CRDResult[]): Record<string, CRDResult
52
52
  const fileResultMap: Record<string, CRDResult> = {};
53
53
 
54
54
  for (const { name, crd, version } of allResults) {
55
- const expectedFileName = `${crd.spec.names.kind.toLowerCase()}-${version.toLowerCase()}.ts`;
55
+ const expectedFileName = `${name.toLowerCase()}-${version.toLowerCase()}.ts`;
56
56
  fileResultMap[expectedFileName] = { name, crd, version };
57
57
  }
58
58
 
@@ -159,7 +159,7 @@ export function applyCRDPostProcessing(
159
159
 
160
160
  // Wraps with the fluent client if needed
161
161
  if (opts.language === "ts" && !opts.plain) {
162
- lines = wrapWithFluentClient(lines, name, crd, version, opts);
162
+ lines = wrapWithFluentClient(lines, name, crd, version, opts.npmPackage);
163
163
  }
164
164
  const foundInterfaces = collectInterfaceNames(lines);
165
165
 
@@ -242,7 +242,7 @@ export function updateBraceBalance(line: string, braceBalance: number): number {
242
242
  * @param name The name of the schema.
243
243
  * @param crd The CustomResourceDefinition object.
244
244
  * @param version The version of the CRD.
245
- * @param opts the options for the generation process.
245
+ * @param npmPackage The NPM package name for the fluent client.
246
246
  * @returns The processed TypeScript lines.
247
247
  */
248
248
  export function wrapWithFluentClient(
@@ -250,10 +250,11 @@ export function wrapWithFluentClient(
250
250
  name: string,
251
251
  crd: CustomResourceDefinition,
252
252
  version: string,
253
- opts: GenerateOptions,
253
+ npmPackage: string = "kubernetes-fluent-client",
254
254
  ): string[] {
255
- const autoGenNotice = `// This file is auto-generated by ${opts.npmPackage}, do not edit manually`;
256
- const imports = `import { GenericKind, RegisterKind } from "${opts.npmPackage}";`;
255
+ const autoGenNotice = `// This file is auto-generated by ${npmPackage}, do not edit manually`;
256
+ const imports = `import { GenericKind, RegisterKind } from "${npmPackage}";`;
257
+
257
258
  const classIndex = lines.findIndex(line => line.includes(`export interface ${name} {`));
258
259
  if (classIndex !== -1) {
259
260
  lines[classIndex] = `export class ${name} extends GenericKind {`;
@@ -264,7 +265,7 @@ export function wrapWithFluentClient(
264
265
  `RegisterKind(${name}, {`,
265
266
  ` group: "${crd.spec.group}",`,
266
267
  ` version: "${version}",`,
267
- ` kind: "${crd.spec.names.kind}",`,
268
+ ` kind: "${name}",`,
268
269
  ` plural: "${crd.spec.names.plural}",`,
269
270
  `});`,
270
271
  );