kubernetes-fluent-client 3.0.4 → 3.0.5
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/e2e/cli.e2e.test.ts +11 -7
- package/package.json +6 -6
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -68
- package/dist/fetch.d.ts +0 -22
- package/dist/fetch.d.ts.map +0 -1
- package/dist/fetch.js +0 -82
- package/dist/fetch.test.d.ts +0 -2
- package/dist/fetch.test.d.ts.map +0 -1
- package/dist/fetch.test.js +0 -97
- package/dist/fileSystem.d.ts +0 -11
- package/dist/fileSystem.d.ts.map +0 -1
- package/dist/fileSystem.js +0 -42
- package/dist/fileSystem.test.d.ts +0 -2
- package/dist/fileSystem.test.d.ts.map +0 -1
- package/dist/fileSystem.test.js +0 -75
- package/dist/fluent/index.d.ts +0 -12
- package/dist/fluent/index.d.ts.map +0 -1
- package/dist/fluent/index.js +0 -228
- package/dist/fluent/index.test.d.ts +0 -2
- package/dist/fluent/index.test.d.ts.map +0 -1
- package/dist/fluent/index.test.js +0 -193
- package/dist/fluent/types.d.ts +0 -187
- package/dist/fluent/types.d.ts.map +0 -1
- package/dist/fluent/types.js +0 -16
- package/dist/fluent/utils.d.ts +0 -41
- package/dist/fluent/utils.d.ts.map +0 -1
- package/dist/fluent/utils.js +0 -153
- package/dist/fluent/utils.test.d.ts +0 -2
- package/dist/fluent/utils.test.d.ts.map +0 -1
- package/dist/fluent/utils.test.js +0 -215
- package/dist/fluent/watch.d.ts +0 -86
- package/dist/fluent/watch.d.ts.map +0 -1
- package/dist/fluent/watch.js +0 -425
- package/dist/fluent/watch.spec.d.ts +0 -2
- package/dist/fluent/watch.spec.d.ts.map +0 -1
- package/dist/fluent/watch.spec.js +0 -261
- package/dist/generate.d.ts +0 -84
- package/dist/generate.d.ts.map +0 -1
- package/dist/generate.js +0 -208
- package/dist/generate.test.d.ts +0 -2
- package/dist/generate.test.d.ts.map +0 -1
- package/dist/generate.test.js +0 -320
- package/dist/helpers.d.ts +0 -33
- package/dist/helpers.d.ts.map +0 -1
- package/dist/helpers.js +0 -103
- package/dist/helpers.test.d.ts +0 -2
- package/dist/helpers.test.d.ts.map +0 -1
- package/dist/helpers.test.js +0 -37
- package/dist/index.d.ts +0 -14
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -60
- package/dist/kinds.d.ts +0 -16
- package/dist/kinds.d.ts.map +0 -1
- package/dist/kinds.js +0 -570
- package/dist/kinds.test.d.ts +0 -2
- package/dist/kinds.test.d.ts.map +0 -1
- package/dist/kinds.test.js +0 -155
- package/dist/patch.d.ts +0 -7
- package/dist/patch.d.ts.map +0 -1
- package/dist/patch.js +0 -2
- package/dist/postProcessing.d.ts +0 -246
- package/dist/postProcessing.d.ts.map +0 -1
- package/dist/postProcessing.js +0 -497
- package/dist/postProcessing.test.d.ts +0 -2
- package/dist/postProcessing.test.d.ts.map +0 -1
- package/dist/postProcessing.test.js +0 -550
- package/dist/types.d.ts +0 -32
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -16
- package/dist/upstream.d.ts +0 -4
- package/dist/upstream.d.ts.map +0 -1
- package/dist/upstream.js +0 -56
package/dist/kinds.test.js
DELETED
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
// SPDX-FileCopyrightText: 2023-Present The Kubernetes Fluent Client Authors
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
const globals_1 = require("@jest/globals");
|
|
6
|
-
const index_1 = require("./index");
|
|
7
|
-
const kinds_1 = require("./kinds");
|
|
8
|
-
const testCases = [
|
|
9
|
-
{
|
|
10
|
-
name: index_1.kind.Event,
|
|
11
|
-
expected: { group: "events.k8s.io", version: "v1", kind: "Event" },
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
name: index_1.kind.CoreEvent,
|
|
15
|
-
expected: { group: "", version: "v1", kind: "Event" },
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
name: index_1.kind.ClusterRole,
|
|
19
|
-
expected: { group: "rbac.authorization.k8s.io", version: "v1", kind: "ClusterRole" },
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
name: index_1.kind.ClusterRoleBinding,
|
|
23
|
-
expected: { group: "rbac.authorization.k8s.io", version: "v1", kind: "ClusterRoleBinding" },
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
name: index_1.kind.Role,
|
|
27
|
-
expected: { group: "rbac.authorization.k8s.io", version: "v1", kind: "Role" },
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: index_1.kind.RoleBinding,
|
|
31
|
-
expected: { group: "rbac.authorization.k8s.io", version: "v1", kind: "RoleBinding" },
|
|
32
|
-
},
|
|
33
|
-
{ name: index_1.kind.Pod, expected: { group: "", version: "v1", kind: "Pod" } },
|
|
34
|
-
{ name: index_1.kind.Deployment, expected: { group: "apps", version: "v1", kind: "Deployment" } },
|
|
35
|
-
{ name: index_1.kind.StatefulSet, expected: { group: "apps", version: "v1", kind: "StatefulSet" } },
|
|
36
|
-
{ name: index_1.kind.DaemonSet, expected: { group: "apps", version: "v1", kind: "DaemonSet" } },
|
|
37
|
-
{ name: index_1.kind.Job, expected: { group: "batch", version: "v1", kind: "Job" } },
|
|
38
|
-
{ name: index_1.kind.CronJob, expected: { group: "batch", version: "v1", kind: "CronJob" } },
|
|
39
|
-
{ name: index_1.kind.ConfigMap, expected: { group: "", version: "v1", kind: "ConfigMap" } },
|
|
40
|
-
{ name: index_1.kind.Secret, expected: { group: "", version: "v1", kind: "Secret" } },
|
|
41
|
-
{ name: index_1.kind.Service, expected: { group: "", version: "v1", kind: "Service" } },
|
|
42
|
-
{ name: index_1.kind.ServiceAccount, expected: { group: "", version: "v1", kind: "ServiceAccount" } },
|
|
43
|
-
{ name: index_1.kind.Namespace, expected: { group: "", version: "v1", kind: "Namespace" } },
|
|
44
|
-
{
|
|
45
|
-
name: index_1.kind.HorizontalPodAutoscaler,
|
|
46
|
-
expected: { group: "autoscaling", version: "v2", kind: "HorizontalPodAutoscaler" },
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
name: index_1.kind.CustomResourceDefinition,
|
|
50
|
-
expected: { group: "apiextensions.k8s.io", version: "v1", kind: "CustomResourceDefinition" },
|
|
51
|
-
},
|
|
52
|
-
{ name: index_1.kind.Ingress, expected: { group: "networking.k8s.io", version: "v1", kind: "Ingress" } },
|
|
53
|
-
{
|
|
54
|
-
name: index_1.kind.NetworkPolicy,
|
|
55
|
-
expected: {
|
|
56
|
-
group: "networking.k8s.io",
|
|
57
|
-
version: "v1",
|
|
58
|
-
kind: "NetworkPolicy",
|
|
59
|
-
plural: "networkpolicies",
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
{ name: index_1.kind.Node, expected: { group: "", version: "v1", kind: "Node" } },
|
|
63
|
-
{ name: index_1.kind.PersistentVolume, expected: { group: "", version: "v1", kind: "PersistentVolume" } },
|
|
64
|
-
{
|
|
65
|
-
name: index_1.kind.PersistentVolumeClaim,
|
|
66
|
-
expected: { group: "", version: "v1", kind: "PersistentVolumeClaim" },
|
|
67
|
-
},
|
|
68
|
-
{ name: index_1.kind.Pod, expected: { group: "", version: "v1", kind: "Pod" } },
|
|
69
|
-
{
|
|
70
|
-
name: index_1.kind.PodDisruptionBudget,
|
|
71
|
-
expected: { group: "policy", version: "v1", kind: "PodDisruptionBudget" },
|
|
72
|
-
},
|
|
73
|
-
{ name: index_1.kind.PodTemplate, expected: { group: "", version: "v1", kind: "PodTemplate" } },
|
|
74
|
-
{ name: index_1.kind.ReplicaSet, expected: { group: "apps", version: "v1", kind: "ReplicaSet" } },
|
|
75
|
-
{
|
|
76
|
-
name: index_1.kind.ReplicationController,
|
|
77
|
-
expected: { group: "", version: "v1", kind: "ReplicationController" },
|
|
78
|
-
},
|
|
79
|
-
{ name: index_1.kind.ResourceQuota, expected: { group: "", version: "v1", kind: "ResourceQuota" } },
|
|
80
|
-
{
|
|
81
|
-
name: index_1.kind.RuntimeClass,
|
|
82
|
-
expected: { group: "node.k8s.io", version: "v1", kind: "RuntimeClass" },
|
|
83
|
-
},
|
|
84
|
-
{ name: index_1.kind.Secret, expected: { group: "", version: "v1", kind: "Secret" } },
|
|
85
|
-
{
|
|
86
|
-
name: index_1.kind.SelfSubjectAccessReview,
|
|
87
|
-
expected: { group: "authorization.k8s.io", version: "v1", kind: "SelfSubjectAccessReview" },
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
name: index_1.kind.SelfSubjectRulesReview,
|
|
91
|
-
expected: { group: "authorization.k8s.io", version: "v1", kind: "SelfSubjectRulesReview" },
|
|
92
|
-
},
|
|
93
|
-
{ name: index_1.kind.Service, expected: { group: "", version: "v1", kind: "Service" } },
|
|
94
|
-
{ name: index_1.kind.ServiceAccount, expected: { group: "", version: "v1", kind: "ServiceAccount" } },
|
|
95
|
-
{ name: index_1.kind.StatefulSet, expected: { group: "apps", version: "v1", kind: "StatefulSet" } },
|
|
96
|
-
{
|
|
97
|
-
name: index_1.kind.StorageClass,
|
|
98
|
-
expected: { group: "storage.k8s.io", version: "v1", kind: "StorageClass" },
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
name: index_1.kind.SubjectAccessReview,
|
|
102
|
-
expected: { group: "authorization.k8s.io", version: "v1", kind: "SubjectAccessReview" },
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
name: index_1.kind.TokenReview,
|
|
106
|
-
expected: { group: "authentication.k8s.io", version: "v1", kind: "TokenReview" },
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
name: index_1.kind.ValidatingWebhookConfiguration,
|
|
110
|
-
expected: {
|
|
111
|
-
group: "admissionregistration.k8s.io",
|
|
112
|
-
version: "v1",
|
|
113
|
-
kind: "ValidatingWebhookConfiguration",
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
name: index_1.kind.VolumeAttachment,
|
|
118
|
-
expected: { group: "storage.k8s.io", version: "v1", kind: "VolumeAttachment" },
|
|
119
|
-
},
|
|
120
|
-
];
|
|
121
|
-
globals_1.test.each(testCases)("should return the correct GroupVersionKind for '%s'", ({ name, expected }) => {
|
|
122
|
-
const { name: modelName } = name;
|
|
123
|
-
const gvk = (0, index_1.modelToGroupVersionKind)(modelName);
|
|
124
|
-
try {
|
|
125
|
-
(0, globals_1.expect)(gvk.group).toBe(expected.group);
|
|
126
|
-
(0, globals_1.expect)(gvk.version).toBe(expected.version);
|
|
127
|
-
(0, globals_1.expect)(gvk.kind).toBe(expected.kind);
|
|
128
|
-
}
|
|
129
|
-
catch (error) {
|
|
130
|
-
console.error(`Failed for model ${modelName}: Expected GroupVersionKind to be ${JSON.stringify(expected)}, but got ${JSON.stringify(gvk)}`);
|
|
131
|
-
throw error;
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
(0, globals_1.test)("new registered type", () => {
|
|
135
|
-
class foo {
|
|
136
|
-
kind;
|
|
137
|
-
group;
|
|
138
|
-
constructor() {
|
|
139
|
-
this.kind = "foo";
|
|
140
|
-
this.group = "bar";
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
(0, kinds_1.RegisterKind)(foo, new foo());
|
|
144
|
-
});
|
|
145
|
-
(0, globals_1.test)("throws an error for already registered", () => {
|
|
146
|
-
const { name } = index_1.kind.VolumeAttachment;
|
|
147
|
-
const gvk = (0, index_1.modelToGroupVersionKind)(name);
|
|
148
|
-
(0, globals_1.expect)(() => {
|
|
149
|
-
(0, kinds_1.RegisterKind)(index_1.kind.VolumeAttachment, {
|
|
150
|
-
kind: gvk.kind,
|
|
151
|
-
version: gvk.version,
|
|
152
|
-
group: gvk.group,
|
|
153
|
-
});
|
|
154
|
-
}).toThrow(`GVK ${name} already registered`);
|
|
155
|
-
});
|
package/dist/patch.d.ts
DELETED
package/dist/patch.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"patch.d.ts","sourceRoot":"","sources":["../src/patch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,QAAQ,yBAAyB,CAAC;IACvC,UAAU,0BAA0B;QAClC,IAAI,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC;KAEnC;CACF"}
|
package/dist/patch.js
DELETED
package/dist/postProcessing.d.ts
DELETED
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
import { GenerateOptions } from "./generate";
|
|
2
|
-
import { CustomResourceDefinition } from "./upstream";
|
|
3
|
-
import { FileSystem } from "./fileSystem";
|
|
4
|
-
type CRDResult = {
|
|
5
|
-
name: string;
|
|
6
|
-
crd: CustomResourceDefinition;
|
|
7
|
-
version: string;
|
|
8
|
-
};
|
|
9
|
-
type CodeLines = string[];
|
|
10
|
-
type ClassContextResult = {
|
|
11
|
-
line: string;
|
|
12
|
-
insideClass: boolean;
|
|
13
|
-
braceBalance: number;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Performs post-processing on generated TypeScript files.
|
|
17
|
-
*
|
|
18
|
-
* @param allResults The array of CRD results.
|
|
19
|
-
* @param opts The options for post-processing.
|
|
20
|
-
* @param fileSystem The file system interface for reading and writing files.
|
|
21
|
-
*/
|
|
22
|
-
export declare function postProcessing(allResults: CRDResult[], opts: GenerateOptions, fileSystem?: FileSystem): Promise<void>;
|
|
23
|
-
/**
|
|
24
|
-
* Creates a map linking each file to its corresponding CRD result.
|
|
25
|
-
*
|
|
26
|
-
* @param allResults - The array of CRD results.
|
|
27
|
-
* @returns A map linking file names to their corresponding CRD results.
|
|
28
|
-
*/
|
|
29
|
-
export declare function mapFilesToCRD(allResults: CRDResult[]): Record<string, CRDResult>;
|
|
30
|
-
/**
|
|
31
|
-
* Processes the list of files, applying CRD post-processing to each.
|
|
32
|
-
*
|
|
33
|
-
* @param files - The list of file names to process.
|
|
34
|
-
* @param fileResultMap - A map linking file names to their corresponding CRD results.
|
|
35
|
-
* @param opts - Options for the generation process.
|
|
36
|
-
* @param fileSystem - The file system interface for reading and writing files.
|
|
37
|
-
*/
|
|
38
|
-
export declare function processFiles(files: string[], fileResultMap: Record<string, CRDResult>, opts: GenerateOptions, fileSystem: FileSystem): Promise<void>;
|
|
39
|
-
/**
|
|
40
|
-
* Handles the processing of a single file: reading, modifying, and writing back to disk.
|
|
41
|
-
*
|
|
42
|
-
* @param filePath - The path to the file to be processed.
|
|
43
|
-
* @param fileResult - The associated CRD result for this file.
|
|
44
|
-
* @param fileResult.name - The name of the schema.
|
|
45
|
-
* @param fileResult.crd - The CustomResourceDefinition object.
|
|
46
|
-
* @param fileResult.version - The version of the CRD.
|
|
47
|
-
* @param opts - Options for the generation process.
|
|
48
|
-
* @param fileSystem - The file system interface for reading and writing files.
|
|
49
|
-
*/
|
|
50
|
-
export declare function processAndModifySingleFile(filePath: string, fileResult: CRDResult, opts: GenerateOptions, fileSystem: FileSystem): void;
|
|
51
|
-
/**
|
|
52
|
-
* Processes the TypeScript file content, applying wrapping and property modifications.
|
|
53
|
-
*
|
|
54
|
-
* @param content The content of the TypeScript file.
|
|
55
|
-
* @param name The name of the schema.
|
|
56
|
-
* @param crd The CustomResourceDefinition object.
|
|
57
|
-
* @param version The version of the CRD.
|
|
58
|
-
* @param opts The options for processing.
|
|
59
|
-
* @returns The processed TypeScript file content.
|
|
60
|
-
*/
|
|
61
|
-
export declare function applyCRDPostProcessing(content: string, name: string, crd: CustomResourceDefinition, version: string, opts: GenerateOptions): string;
|
|
62
|
-
/**
|
|
63
|
-
* Reads the content of a file from disk.
|
|
64
|
-
*
|
|
65
|
-
* @param filePath The path to the file.
|
|
66
|
-
* @returns The file contents as a string.
|
|
67
|
-
*/
|
|
68
|
-
export declare function readFile(filePath: string): string;
|
|
69
|
-
/**
|
|
70
|
-
* Writes the modified content back to the file.
|
|
71
|
-
*
|
|
72
|
-
* @param filePath The path to the file.
|
|
73
|
-
* @param content The modified content to write.
|
|
74
|
-
*/
|
|
75
|
-
export declare function writeFile(filePath: string, content: string): void;
|
|
76
|
-
/**
|
|
77
|
-
* Retrieves the properties of the `GenericKind` class, excluding dynamic properties like `[key: string]: any`.
|
|
78
|
-
*
|
|
79
|
-
* @returns An array of property names that belong to `GenericKind`.
|
|
80
|
-
*/
|
|
81
|
-
export declare function getGenericKindProperties(): string[];
|
|
82
|
-
/**
|
|
83
|
-
* Collects interface names from TypeScript file lines.
|
|
84
|
-
*
|
|
85
|
-
* @param lines The lines of the file content.
|
|
86
|
-
* @returns A set of found interface names.
|
|
87
|
-
*/
|
|
88
|
-
export declare function collectInterfaceNames(lines: CodeLines): Set<string>;
|
|
89
|
-
/**
|
|
90
|
-
* Identifies whether a line declares a class that extends `GenericKind`.
|
|
91
|
-
*
|
|
92
|
-
* @param line The current line of code.
|
|
93
|
-
* @returns True if the line defines a class that extends `GenericKind`, false otherwise.
|
|
94
|
-
*/
|
|
95
|
-
export declare function isClassExtendingGenericKind(line: string): boolean;
|
|
96
|
-
/**
|
|
97
|
-
* Adjusts the brace balance to determine if the parser is within a class definition.
|
|
98
|
-
*
|
|
99
|
-
* @param line The current line of code.
|
|
100
|
-
* @param braceBalance The current balance of curly braces.
|
|
101
|
-
* @returns The updated brace balance.
|
|
102
|
-
*/
|
|
103
|
-
export declare function updateBraceBalance(line: string, braceBalance: number): number;
|
|
104
|
-
/**
|
|
105
|
-
* Generates a regular expression to match a property pattern in TypeScript.
|
|
106
|
-
*
|
|
107
|
-
* @param prop The property name to match.
|
|
108
|
-
* @returns A regular expression to match the property pattern.
|
|
109
|
-
*/
|
|
110
|
-
export declare function getPropertyPattern(prop: string): RegExp;
|
|
111
|
-
/**
|
|
112
|
-
* Applies ESLint and property modifiers to a line of code.
|
|
113
|
-
*
|
|
114
|
-
* @param line - The current line of code.
|
|
115
|
-
* @param genericKindProperties - The list of properties from `GenericKind`.
|
|
116
|
-
* @param foundInterfaces - The set of found interfaces in the file.
|
|
117
|
-
* @returns The modified line.
|
|
118
|
-
*/
|
|
119
|
-
export declare function modifyPropertiesAndAddEslintDirective(line: string, genericKindProperties: string[], foundInterfaces: Set<string>): string;
|
|
120
|
-
/**
|
|
121
|
-
* Applies property modifiers to a line of code.
|
|
122
|
-
*
|
|
123
|
-
* @param line The current line of code.
|
|
124
|
-
* @param genericKindProperties The list of properties from `GenericKind`.
|
|
125
|
-
* @param foundInterfaces The set of found interfaces in the file.
|
|
126
|
-
* @returns The modified line.
|
|
127
|
-
*/
|
|
128
|
-
export declare function addDeclareAndOptionalModifiersToProperties(line: string, genericKindProperties: string[], foundInterfaces: Set<string>): string;
|
|
129
|
-
/**
|
|
130
|
-
* Adds the `declare` keyword to `GenericKind` properties.
|
|
131
|
-
*
|
|
132
|
-
* @param line The current line of code.
|
|
133
|
-
* @param genericKindProperties The list of properties from `GenericKind`.
|
|
134
|
-
* @returns The modified line with the `declare` keyword, if applicable.
|
|
135
|
-
*/
|
|
136
|
-
export declare function addDeclareToGenericKindProperties(line: string, genericKindProperties: string[]): string;
|
|
137
|
-
/**
|
|
138
|
-
* Makes a property optional if its type matches one of the found interfaces and it is not already optional.
|
|
139
|
-
*
|
|
140
|
-
* @param line The current line of code.
|
|
141
|
-
* @param foundInterfaces The set of found interfaces in the file.
|
|
142
|
-
* @returns The modified line with the optional `?` symbol.
|
|
143
|
-
*/
|
|
144
|
-
export declare function makePropertiesOptional(line: string, foundInterfaces: Set<string>): string;
|
|
145
|
-
/**
|
|
146
|
-
* Adds an ESLint disable comment for `[key: string]: any` if it's not part of `GenericKind`.
|
|
147
|
-
*
|
|
148
|
-
* @param line The current line of code.
|
|
149
|
-
* @param genericKindProperties The list of properties from `GenericKind`.
|
|
150
|
-
* @returns The modified line with the ESLint disable comment.
|
|
151
|
-
*/
|
|
152
|
-
export declare function processEslintDisable(line: string, genericKindProperties: string[]): string;
|
|
153
|
-
/**
|
|
154
|
-
* Wraps the generated TypeScript file with fluent client elements (`GenericKind` and `RegisterKind`).
|
|
155
|
-
*
|
|
156
|
-
* @param lines The generated TypeScript lines.
|
|
157
|
-
* @param name The name of the schema.
|
|
158
|
-
* @param crd The CustomResourceDefinition object.
|
|
159
|
-
* @param version The version of the CRD.
|
|
160
|
-
* @param npmPackage The NPM package name for the fluent client.
|
|
161
|
-
* @returns The processed TypeScript lines.
|
|
162
|
-
*/
|
|
163
|
-
export declare function wrapWithFluentClient(lines: CodeLines, name: string, crd: CustomResourceDefinition, version: string, npmPackage?: string): string[];
|
|
164
|
-
/**
|
|
165
|
-
* Normalizes indentation for TypeScript lines to a consistent format.
|
|
166
|
-
*
|
|
167
|
-
* @param lines The generated TypeScript lines.
|
|
168
|
-
* @returns The lines with normalized indentation.
|
|
169
|
-
*/
|
|
170
|
-
export declare function normalizeIndentation(lines: CodeLines): string[];
|
|
171
|
-
/**
|
|
172
|
-
* Normalizes the indentation of a single line to use two spaces instead of four.
|
|
173
|
-
*
|
|
174
|
-
* @param line The line of code to normalize.
|
|
175
|
-
* @returns The line with normalized indentation.
|
|
176
|
-
*/
|
|
177
|
-
export declare function normalizeLineIndentation(line: string): string;
|
|
178
|
-
/**
|
|
179
|
-
* Normalizes spacing between property names and types in TypeScript lines.
|
|
180
|
-
*
|
|
181
|
-
* @param lines The generated TypeScript lines.
|
|
182
|
-
* @returns The lines with normalized property spacing.
|
|
183
|
-
*/
|
|
184
|
-
export declare function normalizePropertySpacing(lines: CodeLines): string[];
|
|
185
|
-
/**
|
|
186
|
-
* Removes lines containing `[property: string]: any;` from TypeScript files.
|
|
187
|
-
*
|
|
188
|
-
* @param lines The generated TypeScript lines.
|
|
189
|
-
* @param opts The options for processing.
|
|
190
|
-
* @returns The lines with `[property: string]: any;` removed.
|
|
191
|
-
*/
|
|
192
|
-
export declare function removePropertyStringAny(lines: CodeLines, opts: GenerateOptions): string[];
|
|
193
|
-
/**
|
|
194
|
-
* Determines if the content should be wrapped with the fluent client.
|
|
195
|
-
*
|
|
196
|
-
* @param opts The options for generating the content.
|
|
197
|
-
* @returns True if the content should be wrapped with the fluent client, false otherwise.
|
|
198
|
-
*/
|
|
199
|
-
export declare function shouldWrapWithFluentClient(opts: GenerateOptions): boolean;
|
|
200
|
-
/**
|
|
201
|
-
* Processes the lines of the TypeScript file, focusing on classes extending `GenericKind`.
|
|
202
|
-
*
|
|
203
|
-
* @param lines The lines of the file content.
|
|
204
|
-
* @param genericKindProperties The list of properties from `GenericKind`.
|
|
205
|
-
* @param foundInterfaces The set of found interfaces in the file.
|
|
206
|
-
* @returns The processed lines.
|
|
207
|
-
*/
|
|
208
|
-
export declare function processLines(lines: CodeLines, genericKindProperties: string[], foundInterfaces: Set<string>): string[];
|
|
209
|
-
/**
|
|
210
|
-
* Processes a single line inside a class extending `GenericKind`.
|
|
211
|
-
*
|
|
212
|
-
* @param line The current line of code.
|
|
213
|
-
* @param insideClass Whether we are inside a class context.
|
|
214
|
-
* @param braceBalance The current brace balance to detect when we exit the class.
|
|
215
|
-
* @param genericKindProperties The list of properties from `GenericKind`.
|
|
216
|
-
* @param foundInterfaces The set of found interfaces in the file.
|
|
217
|
-
* @returns An object containing the updated line, updated insideClass flag, and braceBalance.
|
|
218
|
-
*/
|
|
219
|
-
export declare function processClassContext(line: string, insideClass: boolean, braceBalance: number, genericKindProperties: string[], foundInterfaces: Set<string>): ClassContextResult;
|
|
220
|
-
/**
|
|
221
|
-
* Processes a single line inside a class extending `GenericKind`.
|
|
222
|
-
*
|
|
223
|
-
* @param line The current line of code.
|
|
224
|
-
* @param genericKindProperties The list of properties from `GenericKind`.
|
|
225
|
-
* @param foundInterfaces The set of found interfaces in the file.
|
|
226
|
-
* @returns The modified line.
|
|
227
|
-
*/
|
|
228
|
-
export declare function modifyAndNormalizeClassProperties(line: string, genericKindProperties: string[], foundInterfaces: Set<string>): string;
|
|
229
|
-
/**
|
|
230
|
-
* Normalizes lines after processing, including indentation, spacing, and removing unnecessary lines.
|
|
231
|
-
*
|
|
232
|
-
* @param lines The lines of the file content.
|
|
233
|
-
* @param opts The options for processing.
|
|
234
|
-
* @returns The normalized lines.
|
|
235
|
-
*/
|
|
236
|
-
export declare function normalizeIndentationAndSpacing(lines: CodeLines, opts: GenerateOptions): string[];
|
|
237
|
-
/**
|
|
238
|
-
* Handles logging for errors with stack trace.
|
|
239
|
-
*
|
|
240
|
-
* @param error The error object to log.
|
|
241
|
-
* @param filePath The path of the file being processed.
|
|
242
|
-
* @param logFn The logging function.
|
|
243
|
-
*/
|
|
244
|
-
export declare function logError(error: Error, filePath: string, logFn: (msg: string) => void): void;
|
|
245
|
-
export {};
|
|
246
|
-
//# sourceMappingURL=postProcessing.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"postProcessing.d.ts","sourceRoot":"","sources":["../src/postProcessing.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,UAAU,EAAkB,MAAM,cAAc,CAAC;AAE1D,KAAK,SAAS,GAAG;IACf,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,wBAAwB,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,KAAK,SAAS,GAAG,MAAM,EAAE,CAAC;AAE1B,KAAK,kBAAkB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,OAAO,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC;AAIvF;;;;;;GAMG;AACH,wBAAsB,cAAc,CAClC,UAAU,EAAE,SAAS,EAAE,EACvB,IAAI,EAAE,eAAe,EACrB,UAAU,GAAE,UAAiC,iBAc9C;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAahF;AAED;;;;;;;GAOG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