kustodian 1.0.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/LICENSE +21 -0
- package/README.md +346 -0
- package/dist/cli/bin.d.ts +3 -0
- package/dist/cli/bin.d.ts.map +1 -0
- package/dist/cli/bin.js +67 -0
- package/dist/cli/bin.js.map +1 -0
- package/dist/cli/command.d.ts +57 -0
- package/dist/cli/command.d.ts.map +1 -0
- package/dist/cli/command.js +26 -0
- package/dist/cli/command.js.map +1 -0
- package/dist/cli/commands/apply.d.ts +8 -0
- package/dist/cli/commands/apply.d.ts.map +1 -0
- package/dist/cli/commands/apply.js +802 -0
- package/dist/cli/commands/apply.js.map +1 -0
- package/dist/cli/commands/init.d.ts +5 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +403 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/sources.d.ts +5 -0
- package/dist/cli/commands/sources.d.ts.map +1 -0
- package/dist/cli/commands/sources.js +377 -0
- package/dist/cli/commands/sources.js.map +1 -0
- package/dist/cli/commands/update.d.ts +5 -0
- package/dist/cli/commands/update.d.ts.map +1 -0
- package/dist/cli/commands/update.js +314 -0
- package/dist/cli/commands/update.js.map +1 -0
- package/dist/cli/commands/validate.d.ts +5 -0
- package/dist/cli/commands/validate.d.ts.map +1 -0
- package/dist/cli/commands/validate.js +126 -0
- package/dist/cli/commands/validate.js.map +1 -0
- package/dist/cli/container.d.ts +48 -0
- package/dist/cli/container.d.ts.map +1 -0
- package/dist/cli/container.js +49 -0
- package/dist/cli/container.js.map +1 -0
- package/dist/cli/index.d.ts +8 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +9 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/middleware.d.ts +118 -0
- package/dist/cli/middleware.d.ts.map +1 -0
- package/dist/cli/middleware.js +280 -0
- package/dist/cli/middleware.js.map +1 -0
- package/dist/cli/runner.d.ts +34 -0
- package/dist/cli/runner.d.ts.map +1 -0
- package/dist/cli/runner.js +156 -0
- package/dist/cli/runner.js.map +1 -0
- package/dist/cli/utils/defaults.d.ts +23 -0
- package/dist/cli/utils/defaults.d.ts.map +1 -0
- package/dist/cli/utils/defaults.js +43 -0
- package/dist/cli/utils/defaults.js.map +1 -0
- package/dist/core/error.d.ts +117 -0
- package/dist/core/error.d.ts.map +1 -0
- package/dist/core/error.js +210 -0
- package/dist/core/error.js.map +1 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +6 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/logger.d.ts +31 -0
- package/dist/core/logger.d.ts.map +1 -0
- package/dist/core/logger.js +78 -0
- package/dist/core/logger.js.map +1 -0
- package/dist/core/path.d.ts +57 -0
- package/dist/core/path.d.ts.map +1 -0
- package/dist/core/path.js +154 -0
- package/dist/core/path.js.map +1 -0
- package/dist/core/result.d.ts +80 -0
- package/dist/core/result.d.ts.map +1 -0
- package/dist/core/result.js +150 -0
- package/dist/core/result.js.map +1 -0
- package/dist/core/types.d.ts +80 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +5 -0
- package/dist/core/types.js.map +1 -0
- package/dist/generator/external-substitutions.d.ts +21 -0
- package/dist/generator/external-substitutions.d.ts.map +1 -0
- package/dist/generator/external-substitutions.js +49 -0
- package/dist/generator/external-substitutions.js.map +1 -0
- package/dist/generator/flux.d.ts +61 -0
- package/dist/generator/flux.d.ts.map +1 -0
- package/dist/generator/flux.js +294 -0
- package/dist/generator/flux.js.map +1 -0
- package/dist/generator/generator.d.ts +77 -0
- package/dist/generator/generator.d.ts.map +1 -0
- package/dist/generator/generator.js +183 -0
- package/dist/generator/generator.js.map +1 -0
- package/dist/generator/index.d.ts +9 -0
- package/dist/generator/index.d.ts.map +1 -0
- package/dist/generator/index.js +9 -0
- package/dist/generator/index.js.map +1 -0
- package/dist/generator/kustomization-resolution.d.ts +40 -0
- package/dist/generator/kustomization-resolution.d.ts.map +1 -0
- package/dist/generator/kustomization-resolution.js +59 -0
- package/dist/generator/kustomization-resolution.js.map +1 -0
- package/dist/generator/namespace.d.ts +74 -0
- package/dist/generator/namespace.d.ts.map +1 -0
- package/dist/generator/namespace.js +109 -0
- package/dist/generator/namespace.js.map +1 -0
- package/dist/generator/output.d.ts +56 -0
- package/dist/generator/output.d.ts.map +1 -0
- package/dist/generator/output.js +171 -0
- package/dist/generator/output.js.map +1 -0
- package/dist/generator/preservation.d.ts +45 -0
- package/dist/generator/preservation.d.ts.map +1 -0
- package/dist/generator/preservation.js +71 -0
- package/dist/generator/preservation.js.map +1 -0
- package/dist/generator/substitution.d.ts +79 -0
- package/dist/generator/substitution.d.ts.map +1 -0
- package/dist/generator/substitution.js +210 -0
- package/dist/generator/substitution.js.map +1 -0
- package/dist/generator/types.d.ts +162 -0
- package/dist/generator/types.d.ts.map +1 -0
- package/dist/generator/types.js +2 -0
- package/dist/generator/types.js.map +1 -0
- package/dist/generator/validation/cycle-detection.d.ts +25 -0
- package/dist/generator/validation/cycle-detection.d.ts.map +1 -0
- package/dist/generator/validation/cycle-detection.js +101 -0
- package/dist/generator/validation/cycle-detection.js.map +1 -0
- package/dist/generator/validation/enablement.d.ts +24 -0
- package/dist/generator/validation/enablement.d.ts.map +1 -0
- package/dist/generator/validation/enablement.js +69 -0
- package/dist/generator/validation/enablement.js.map +1 -0
- package/dist/generator/validation/graph.d.ts +29 -0
- package/dist/generator/validation/graph.d.ts.map +1 -0
- package/dist/generator/validation/graph.js +106 -0
- package/dist/generator/validation/graph.js.map +1 -0
- package/dist/generator/validation/index.d.ts +38 -0
- package/dist/generator/validation/index.d.ts.map +1 -0
- package/dist/generator/validation/index.js +64 -0
- package/dist/generator/validation/index.js.map +1 -0
- package/dist/generator/validation/reference.d.ts +45 -0
- package/dist/generator/validation/reference.d.ts.map +1 -0
- package/dist/generator/validation/reference.js +143 -0
- package/dist/generator/validation/reference.js.map +1 -0
- package/dist/generator/validation/requirements.d.ts +25 -0
- package/dist/generator/validation/requirements.d.ts.map +1 -0
- package/dist/generator/validation/requirements.js +64 -0
- package/dist/generator/validation/requirements.js.map +1 -0
- package/dist/generator/validation/types.d.ts +116 -0
- package/dist/generator/validation/types.d.ts.map +1 -0
- package/dist/generator/validation/types.js +13 -0
- package/dist/generator/validation/types.js.map +1 -0
- package/dist/k8s/exec.d.ts +20 -0
- package/dist/k8s/exec.d.ts.map +1 -0
- package/dist/k8s/exec.js +47 -0
- package/dist/k8s/exec.js.map +1 -0
- package/dist/k8s/flux.d.ts +57 -0
- package/dist/k8s/flux.d.ts.map +1 -0
- package/dist/k8s/flux.js +202 -0
- package/dist/k8s/flux.js.map +1 -0
- package/dist/k8s/index.d.ts +6 -0
- package/dist/k8s/index.d.ts.map +1 -0
- package/dist/k8s/index.js +6 -0
- package/dist/k8s/index.js.map +1 -0
- package/dist/k8s/kubeconfig.d.ts +45 -0
- package/dist/k8s/kubeconfig.d.ts.map +1 -0
- package/dist/k8s/kubeconfig.js +152 -0
- package/dist/k8s/kubeconfig.js.map +1 -0
- package/dist/k8s/kubectl.d.ts +68 -0
- package/dist/k8s/kubectl.d.ts.map +1 -0
- package/dist/k8s/kubectl.js +187 -0
- package/dist/k8s/kubectl.js.map +1 -0
- package/dist/k8s/types.d.ts +65 -0
- package/dist/k8s/types.d.ts.map +1 -0
- package/dist/k8s/types.js +2 -0
- package/dist/k8s/types.js.map +1 -0
- package/dist/loader/file.d.ts +39 -0
- package/dist/loader/file.d.ts.map +1 -0
- package/dist/loader/file.js +121 -0
- package/dist/loader/file.js.map +1 -0
- package/dist/loader/index.d.ts +5 -0
- package/dist/loader/index.d.ts.map +1 -0
- package/dist/loader/index.js +5 -0
- package/dist/loader/index.js.map +1 -0
- package/dist/loader/profile.d.ts +23 -0
- package/dist/loader/profile.d.ts.map +1 -0
- package/dist/loader/profile.js +84 -0
- package/dist/loader/profile.js.map +1 -0
- package/dist/loader/project.d.ts +76 -0
- package/dist/loader/project.d.ts.map +1 -0
- package/dist/loader/project.js +279 -0
- package/dist/loader/project.js.map +1 -0
- package/dist/loader/yaml.d.ts +15 -0
- package/dist/loader/yaml.d.ts.map +1 -0
- package/dist/loader/yaml.js +44 -0
- package/dist/loader/yaml.js.map +1 -0
- package/dist/nodes/index.d.ts +5 -0
- package/dist/nodes/index.d.ts.map +1 -0
- package/dist/nodes/index.js +5 -0
- package/dist/nodes/index.js.map +1 -0
- package/dist/nodes/kubectl-labeler.d.ts +7 -0
- package/dist/nodes/kubectl-labeler.d.ts.map +1 -0
- package/dist/nodes/kubectl-labeler.js +89 -0
- package/dist/nodes/kubectl-labeler.js.map +1 -0
- package/dist/nodes/labeler.d.ts +74 -0
- package/dist/nodes/labeler.d.ts.map +1 -0
- package/dist/nodes/labeler.js +118 -0
- package/dist/nodes/labeler.js.map +1 -0
- package/dist/nodes/profile.d.ts +58 -0
- package/dist/nodes/profile.d.ts.map +1 -0
- package/dist/nodes/profile.js +128 -0
- package/dist/nodes/profile.js.map +1 -0
- package/dist/nodes/types.d.ts +84 -0
- package/dist/nodes/types.d.ts.map +1 -0
- package/dist/nodes/types.js +77 -0
- package/dist/nodes/types.js.map +1 -0
- package/dist/plugins/generators.d.ts +49 -0
- package/dist/plugins/generators.d.ts.map +1 -0
- package/dist/plugins/generators.js +7 -0
- package/dist/plugins/generators.js.map +1 -0
- package/dist/plugins/hooks.d.ts +120 -0
- package/dist/plugins/hooks.d.ts.map +1 -0
- package/dist/plugins/hooks.js +41 -0
- package/dist/plugins/hooks.js.map +1 -0
- package/dist/plugins/index.d.ts +8 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +15 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/loader.d.ts +40 -0
- package/dist/plugins/loader.d.ts.map +1 -0
- package/dist/plugins/loader.js +236 -0
- package/dist/plugins/loader.js.map +1 -0
- package/dist/plugins/object-types.d.ts +71 -0
- package/dist/plugins/object-types.d.ts.map +1 -0
- package/dist/plugins/object-types.js +65 -0
- package/dist/plugins/object-types.js.map +1 -0
- package/dist/plugins/registry.d.ts +87 -0
- package/dist/plugins/registry.d.ts.map +1 -0
- package/dist/plugins/registry.js +158 -0
- package/dist/plugins/registry.js.map +1 -0
- package/dist/plugins/substitution-providers.d.ts +48 -0
- package/dist/plugins/substitution-providers.d.ts.map +1 -0
- package/dist/plugins/substitution-providers.js +2 -0
- package/dist/plugins/substitution-providers.js.map +1 -0
- package/dist/plugins/types.d.ts +288 -0
- package/dist/plugins/types.d.ts.map +1 -0
- package/dist/plugins/types.js +25 -0
- package/dist/plugins/types.js.map +1 -0
- package/dist/registry/auth.d.ts +14 -0
- package/dist/registry/auth.d.ts.map +1 -0
- package/dist/registry/auth.js +40 -0
- package/dist/registry/auth.js.map +1 -0
- package/dist/registry/client.d.ts +24 -0
- package/dist/registry/client.d.ts.map +1 -0
- package/dist/registry/client.js +85 -0
- package/dist/registry/client.js.map +1 -0
- package/dist/registry/dockerhub.d.ts +6 -0
- package/dist/registry/dockerhub.d.ts.map +1 -0
- package/dist/registry/dockerhub.js +91 -0
- package/dist/registry/dockerhub.js.map +1 -0
- package/dist/registry/ghcr.d.ts +6 -0
- package/dist/registry/ghcr.d.ts.map +1 -0
- package/dist/registry/ghcr.js +95 -0
- package/dist/registry/ghcr.js.map +1 -0
- package/dist/registry/helm.d.ts +11 -0
- package/dist/registry/helm.d.ts.map +1 -0
- package/dist/registry/helm.js +124 -0
- package/dist/registry/helm.js.map +1 -0
- package/dist/registry/index.d.ts +8 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/registry/index.js +12 -0
- package/dist/registry/index.js.map +1 -0
- package/dist/registry/types.d.ts +55 -0
- package/dist/registry/types.d.ts.map +1 -0
- package/dist/registry/types.js +2 -0
- package/dist/registry/types.js.map +1 -0
- package/dist/registry/version.d.ts +22 -0
- package/dist/registry/version.d.ts.map +1 -0
- package/dist/registry/version.js +62 -0
- package/dist/registry/version.js.map +1 -0
- package/dist/schema/cluster.d.ts +2890 -0
- package/dist/schema/cluster.d.ts.map +1 -0
- package/dist/schema/cluster.js +231 -0
- package/dist/schema/cluster.js.map +1 -0
- package/dist/schema/common.d.ts +1059 -0
- package/dist/schema/common.d.ts.map +1 -0
- package/dist/schema/common.js +340 -0
- package/dist/schema/common.js.map +1 -0
- package/dist/schema/index.d.ts +8 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +8 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/node-list.d.ts +361 -0
- package/dist/schema/node-list.d.ts.map +1 -0
- package/dist/schema/node-list.js +104 -0
- package/dist/schema/node-list.js.map +1 -0
- package/dist/schema/profile.d.ts +166 -0
- package/dist/schema/profile.d.ts.map +1 -0
- package/dist/schema/profile.js +61 -0
- package/dist/schema/profile.js.map +1 -0
- package/dist/schema/project.d.ts +168 -0
- package/dist/schema/project.d.ts.map +1 -0
- package/dist/schema/project.js +40 -0
- package/dist/schema/project.js.map +1 -0
- package/dist/schema/sources.d.ts +338 -0
- package/dist/schema/sources.d.ts.map +1 -0
- package/dist/schema/sources.js +111 -0
- package/dist/schema/sources.js.map +1 -0
- package/dist/schema/template.d.ts +2711 -0
- package/dist/schema/template.d.ts.map +1 -0
- package/dist/schema/template.js +97 -0
- package/dist/schema/template.js.map +1 -0
- package/dist/sources/cache/index.d.ts +9 -0
- package/dist/sources/cache/index.d.ts.map +1 -0
- package/dist/sources/cache/index.js +278 -0
- package/dist/sources/cache/index.js.map +1 -0
- package/dist/sources/cache/metadata.d.ts +36 -0
- package/dist/sources/cache/metadata.d.ts.map +1 -0
- package/dist/sources/cache/metadata.js +21 -0
- package/dist/sources/cache/metadata.js.map +1 -0
- package/dist/sources/cache/ttl.d.ts +20 -0
- package/dist/sources/cache/ttl.d.ts.map +1 -0
- package/dist/sources/cache/ttl.js +53 -0
- package/dist/sources/cache/ttl.js.map +1 -0
- package/dist/sources/fetchers/git.d.ts +6 -0
- package/dist/sources/fetchers/git.d.ts.map +1 -0
- package/dist/sources/fetchers/git.js +165 -0
- package/dist/sources/fetchers/git.js.map +1 -0
- package/dist/sources/fetchers/http.d.ts +6 -0
- package/dist/sources/fetchers/http.d.ts.map +1 -0
- package/dist/sources/fetchers/http.js +159 -0
- package/dist/sources/fetchers/http.js.map +1 -0
- package/dist/sources/fetchers/index.d.ts +11 -0
- package/dist/sources/fetchers/index.d.ts.map +1 -0
- package/dist/sources/fetchers/index.js +24 -0
- package/dist/sources/fetchers/index.js.map +1 -0
- package/dist/sources/fetchers/oci.d.ts +6 -0
- package/dist/sources/fetchers/oci.d.ts.map +1 -0
- package/dist/sources/fetchers/oci.js +156 -0
- package/dist/sources/fetchers/oci.js.map +1 -0
- package/dist/sources/fetchers/types.d.ts +25 -0
- package/dist/sources/fetchers/types.d.ts.map +1 -0
- package/dist/sources/fetchers/types.js +2 -0
- package/dist/sources/fetchers/types.js.map +1 -0
- package/dist/sources/index.d.ts +6 -0
- package/dist/sources/index.d.ts.map +1 -0
- package/dist/sources/index.js +10 -0
- package/dist/sources/index.js.map +1 -0
- package/dist/sources/loader.d.ts +34 -0
- package/dist/sources/loader.d.ts.map +1 -0
- package/dist/sources/loader.js +89 -0
- package/dist/sources/loader.js.map +1 -0
- package/dist/sources/resolver.d.ts +17 -0
- package/dist/sources/resolver.d.ts.map +1 -0
- package/dist/sources/resolver.js +125 -0
- package/dist/sources/resolver.js.map +1 -0
- package/dist/sources/types.d.ts +151 -0
- package/dist/sources/types.d.ts.map +1 -0
- package/dist/sources/types.js +2 -0
- package/dist/sources/types.js.map +1 -0
- package/package.json +101 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node role in the cluster.
|
|
3
|
+
*/
|
|
4
|
+
export type NodeRoleType = 'controller' | 'worker' | 'controller+worker';
|
|
5
|
+
/**
|
|
6
|
+
* SSH configuration for connecting to a node.
|
|
7
|
+
*/
|
|
8
|
+
export interface SshConfigType {
|
|
9
|
+
user?: string;
|
|
10
|
+
key_path?: string;
|
|
11
|
+
known_hosts_path?: string;
|
|
12
|
+
port?: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Kubernetes taint configuration.
|
|
16
|
+
*/
|
|
17
|
+
export interface TaintType {
|
|
18
|
+
key: string;
|
|
19
|
+
value?: string;
|
|
20
|
+
effect: 'NoSchedule' | 'PreferNoSchedule' | 'NoExecute';
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Node definition with its configuration.
|
|
24
|
+
*/
|
|
25
|
+
export interface NodeType {
|
|
26
|
+
name: string;
|
|
27
|
+
role: NodeRoleType;
|
|
28
|
+
address: string;
|
|
29
|
+
profile?: string;
|
|
30
|
+
ssh?: SshConfigType;
|
|
31
|
+
labels?: Record<string, string | boolean | number>;
|
|
32
|
+
taints?: TaintType[];
|
|
33
|
+
annotations?: Record<string, string>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Node list with default SSH configuration.
|
|
37
|
+
*/
|
|
38
|
+
export interface NodeListType {
|
|
39
|
+
cluster: string;
|
|
40
|
+
label_prefix?: string;
|
|
41
|
+
ssh?: SshConfigType;
|
|
42
|
+
nodes: NodeType[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Default label prefix.
|
|
46
|
+
*/
|
|
47
|
+
export declare const DEFAULT_LABEL_PREFIX = "kustodian.io";
|
|
48
|
+
/**
|
|
49
|
+
* Formats a label key with the configured prefix.
|
|
50
|
+
*/
|
|
51
|
+
export declare function format_label_key(key: string, prefix?: string): string;
|
|
52
|
+
/**
|
|
53
|
+
* Formats a label value as a string.
|
|
54
|
+
*/
|
|
55
|
+
export declare function format_label_value(value: string | boolean | number): string;
|
|
56
|
+
/**
|
|
57
|
+
* Formats all labels for a node with the configured prefix.
|
|
58
|
+
*/
|
|
59
|
+
export declare function format_node_labels(labels: Record<string, string | boolean | number> | undefined, prefix?: string): Record<string, string>;
|
|
60
|
+
/**
|
|
61
|
+
* Gets the SSH configuration for a node, merging with defaults.
|
|
62
|
+
*/
|
|
63
|
+
export declare function get_node_ssh_config(node: NodeType, default_ssh?: SshConfigType): SshConfigType;
|
|
64
|
+
/**
|
|
65
|
+
* Checks if a node has a controller role.
|
|
66
|
+
*/
|
|
67
|
+
export declare function is_controller(node: NodeType): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Checks if a node has a worker role.
|
|
70
|
+
*/
|
|
71
|
+
export declare function is_worker(node: NodeType): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Gets all controller nodes from a node list.
|
|
74
|
+
*/
|
|
75
|
+
export declare function get_controllers(nodes: NodeType[]): NodeType[];
|
|
76
|
+
/**
|
|
77
|
+
* Gets all worker nodes from a node list.
|
|
78
|
+
*/
|
|
79
|
+
export declare function get_workers(nodes: NodeType[]): NodeType[];
|
|
80
|
+
/**
|
|
81
|
+
* Gets the primary controller node (first controller).
|
|
82
|
+
*/
|
|
83
|
+
export declare function get_primary_controller(nodes: NodeType[]): NodeType | undefined;
|
|
84
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/nodes/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG,QAAQ,GAAG,mBAAmB,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,YAAY,GAAG,kBAAkB,GAAG,WAAW,CAAC;CACzD;AAED;;GAEG;AACH,MAAM,WAAW,Q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AAI,EAAE,QAAQ,GAAG,OAAO,CAEjD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,QAAQ,EAAE,CAE7D;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,QAAQ,EAAE,CAEzD;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,QAAQ,GAAG,SAAS,CAE9E"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default label prefix.
|
|
3
|
+
*/
|
|
4
|
+
export const DEFAULT_LABEL_PREFIX = 'kustodian.io';
|
|
5
|
+
/**
|
|
6
|
+
* Formats a label key with the configured prefix.
|
|
7
|
+
*/
|
|
8
|
+
export function format_label_key(key, prefix = DEFAULT_LABEL_PREFIX) {
|
|
9
|
+
// If key already has a prefix (contains /), return as-is
|
|
10
|
+
if (key.includes('/')) {
|
|
11
|
+
return key;
|
|
12
|
+
}
|
|
13
|
+
return `${prefix}/${key}`;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Formats a label value as a string.
|
|
17
|
+
*/
|
|
18
|
+
export function format_label_value(value) {
|
|
19
|
+
if (typeof value === 'boolean') {
|
|
20
|
+
return value ? 'true' : 'false';
|
|
21
|
+
}
|
|
22
|
+
return String(value);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Formats all labels for a node with the configured prefix.
|
|
26
|
+
*/
|
|
27
|
+
export function format_node_labels(labels, prefix = DEFAULT_LABEL_PREFIX) {
|
|
28
|
+
if (!labels) {
|
|
29
|
+
return {};
|
|
30
|
+
}
|
|
31
|
+
const result = {};
|
|
32
|
+
for (const [key, value] of Object.entries(labels)) {
|
|
33
|
+
const formatted_key = format_label_key(key, prefix);
|
|
34
|
+
result[formatted_key] = format_label_value(value);
|
|
35
|
+
}
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Gets the SSH configuration for a node, merging with defaults.
|
|
40
|
+
*/
|
|
41
|
+
export function get_node_ssh_config(node, default_ssh) {
|
|
42
|
+
return {
|
|
43
|
+
...default_ssh,
|
|
44
|
+
...node.ssh,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Checks if a node has a controller role.
|
|
49
|
+
*/
|
|
50
|
+
export function is_controller(node) {
|
|
51
|
+
return node.role === 'controller' || node.role === 'controller+worker';
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Checks if a node has a worker role.
|
|
55
|
+
*/
|
|
56
|
+
export function is_worker(node) {
|
|
57
|
+
return node.role === 'worker' || node.role === 'controller+worker';
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Gets all controller nodes from a node list.
|
|
61
|
+
*/
|
|
62
|
+
export function get_controllers(nodes) {
|
|
63
|
+
return nodes.filter(is_controller);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Gets all worker nodes from a node list.
|
|
67
|
+
*/
|
|
68
|
+
export function get_workers(nodes) {
|
|
69
|
+
return nodes.filter(is_worker);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Gets the primary controller node (first controller).
|
|
73
|
+
*/
|
|
74
|
+
export function get_primary_controller(nodes) {
|
|
75
|
+
return nodes.find(is_controller);
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/nodes/types.ts"],"names":[],"mappings":"AAgDA;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,cAAc,CAAC;AAEnD;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAW,EAAE,SAAiB,oBAAoB;IACjF,yDAAyD;IACzD,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACt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AAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,KAAiB;IAC/C,OAAO,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,KAAiB;IAC3C,OAAO,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAiB;IACtD,OAAO,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { KustodianErrorType, ResultType } from '../core/index.js';
|
|
2
|
+
import type { ClusterType, TemplateType } from '../schema/index.js';
|
|
3
|
+
import type { GeneratedResourceType } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Object type reference that a generator handles.
|
|
6
|
+
*/
|
|
7
|
+
export interface ObjectTypeRefType {
|
|
8
|
+
api_version: string;
|
|
9
|
+
kind: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Context provided to generators during resource generation.
|
|
13
|
+
*/
|
|
14
|
+
export interface GeneratorContextType {
|
|
15
|
+
/** Current cluster being processed */
|
|
16
|
+
cluster: ClusterType;
|
|
17
|
+
/** Current template being processed (if applicable) */
|
|
18
|
+
template?: TemplateType;
|
|
19
|
+
/** Plugin configuration */
|
|
20
|
+
config: Record<string, unknown>;
|
|
21
|
+
/** All loaded objects by kind (for cross-referencing) */
|
|
22
|
+
all_objects: Map<string, unknown[]>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Plugin generator interface.
|
|
26
|
+
* Generators produce Kubernetes resources from objects they handle.
|
|
27
|
+
*/
|
|
28
|
+
export interface PluginGeneratorType {
|
|
29
|
+
/** Generator name for identification */
|
|
30
|
+
name: string;
|
|
31
|
+
/**
|
|
32
|
+
* Object types this generator handles.
|
|
33
|
+
* When objects of these types are encountered, this generator is invoked.
|
|
34
|
+
*/
|
|
35
|
+
handles: ObjectTypeRefType[];
|
|
36
|
+
/**
|
|
37
|
+
* Generates Kubernetes resources from an object.
|
|
38
|
+
*
|
|
39
|
+
* @param object The object to generate resources from
|
|
40
|
+
* @param context Generation context with cluster and config
|
|
41
|
+
* @returns Generated Kubernetes resources
|
|
42
|
+
*/
|
|
43
|
+
generate(object: unknown, context: GeneratorContextType): Promise<ResultType<GeneratedResourceType[], KustodianErrorType>>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Creates a generator that handles specific object types.
|
|
47
|
+
*/
|
|
48
|
+
export declare function define_generator(config: PluginGeneratorType): PluginGeneratorType;
|
|
49
|
+
//# sourceMappingURL=generators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generators.d.ts","sourceRoot":"","sources":["../../src/plugins/generators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEvE,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,sCAAsC;IACtC,OAAO,EAAE,WAAW,CAAC;IACrB,uDAAuD;IACvD,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,2BAA2B;IAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,yDAAyD;IACzD,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;CACrC;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAE7B;;;;;;OAMG;IACH,QAAQ,CACN,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,UAAU,CAAC,qBAAqB,EAAE,EAAE,kBAAkB,CAAC,CAAC,CAAC;CACrE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,mBAAmB,GAAG,mBAAmB,CAEjF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generators.js","sourceRoot":"","sources":["../../src/plugins/generators.ts"],"names":[],"mappings":"AAsDA;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAA2B;IAC1D,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import type { KustodianErrorType, ResultType } from '../core/index.js';
|
|
2
|
+
import type { ClusterType, TemplateType } from '../schema/index.js';
|
|
3
|
+
import type { GeneratedResourceType } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Hook event types organized by category.
|
|
6
|
+
*/
|
|
7
|
+
export type GeneratorHookEventType = 'generator:before' | 'generator:after_resolve' | 'generator:after_kustomization' | 'generator:after' | 'generator:before_write' | 'generator:after_write';
|
|
8
|
+
export type CLIHookEventType = 'cli:before_command' | 'cli:after_command' | 'cli:on_error';
|
|
9
|
+
export type BootstrapHookEventType = 'bootstrap:before' | 'bootstrap:after' | 'bootstrap:before_step' | 'bootstrap:after_step' | 'bootstrap:on_error';
|
|
10
|
+
export type ValidationHookEventType = 'validation:cluster' | 'validation:template' | 'validation:object';
|
|
11
|
+
export type OutputHookEventType = 'output:before_write' | 'output:after_write';
|
|
12
|
+
/**
|
|
13
|
+
* Union of all hook event types.
|
|
14
|
+
*/
|
|
15
|
+
export type HookEventType = GeneratorHookEventType | CLIHookEventType | BootstrapHookEventType | ValidationHookEventType | OutputHookEventType;
|
|
16
|
+
/**
|
|
17
|
+
* Base hook context shared by all hooks.
|
|
18
|
+
*/
|
|
19
|
+
export interface BaseHookContextType {
|
|
20
|
+
cluster?: ClusterType;
|
|
21
|
+
template?: TemplateType;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Generator hook context.
|
|
25
|
+
*/
|
|
26
|
+
export interface GeneratorHookContextType extends BaseHookContextType {
|
|
27
|
+
cluster: ClusterType;
|
|
28
|
+
templates?: unknown[];
|
|
29
|
+
kustomization?: unknown;
|
|
30
|
+
flux_kustomization?: unknown;
|
|
31
|
+
result?: unknown;
|
|
32
|
+
additional_resources?: GeneratedResourceType[];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* CLI hook context.
|
|
36
|
+
*/
|
|
37
|
+
export interface CLIHookContextType extends BaseHookContextType {
|
|
38
|
+
command_name: string;
|
|
39
|
+
command_path: string[];
|
|
40
|
+
args: string[];
|
|
41
|
+
options: Record<string, unknown>;
|
|
42
|
+
error?: KustodianErrorType;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Bootstrap hook context.
|
|
46
|
+
*/
|
|
47
|
+
export interface BootstrapHookContextType extends BaseHookContextType {
|
|
48
|
+
cluster: ClusterType;
|
|
49
|
+
config?: unknown;
|
|
50
|
+
state?: unknown;
|
|
51
|
+
step_name?: string;
|
|
52
|
+
error?: KustodianErrorType;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Validation hook context.
|
|
56
|
+
*/
|
|
57
|
+
export interface ValidationHookContextType extends BaseHookContextType {
|
|
58
|
+
resource: unknown;
|
|
59
|
+
resource_type: 'cluster' | 'template' | 'object';
|
|
60
|
+
errors: string[];
|
|
61
|
+
warnings: string[];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Output hook context.
|
|
65
|
+
*/
|
|
66
|
+
export interface OutputHookContextType extends BaseHookContextType {
|
|
67
|
+
file_path?: string;
|
|
68
|
+
content?: string;
|
|
69
|
+
files?: Array<{
|
|
70
|
+
path: string;
|
|
71
|
+
content: string;
|
|
72
|
+
}>;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Union of all hook context types.
|
|
76
|
+
*/
|
|
77
|
+
export type HookContextType = GeneratorHookContextType | CLIHookContextType | BootstrapHookContextType | ValidationHookContextType | OutputHookContextType;
|
|
78
|
+
/**
|
|
79
|
+
* Hook handler function type.
|
|
80
|
+
*/
|
|
81
|
+
export type HookHandlerType<C extends HookContextType = HookContextType> = (event: HookEventType, context: C) => Promise<ResultType<C, KustodianErrorType>>;
|
|
82
|
+
/**
|
|
83
|
+
* Plugin hook contribution.
|
|
84
|
+
*/
|
|
85
|
+
export interface PluginHookContributionType {
|
|
86
|
+
/** Event this hook listens to */
|
|
87
|
+
event: HookEventType;
|
|
88
|
+
/** Hook priority (lower runs first, default 100) */
|
|
89
|
+
priority?: number;
|
|
90
|
+
/** Hook handler */
|
|
91
|
+
handler: HookHandlerType;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Hook dispatcher for running hooks with priority ordering.
|
|
95
|
+
*/
|
|
96
|
+
export interface HookDispatcherType {
|
|
97
|
+
/**
|
|
98
|
+
* Registers a hook contribution.
|
|
99
|
+
*/
|
|
100
|
+
register(contribution: PluginHookContributionType): void;
|
|
101
|
+
/**
|
|
102
|
+
* Dispatches an event to all registered handlers.
|
|
103
|
+
* Handlers run in priority order (lowest first).
|
|
104
|
+
* Context is passed through the chain, allowing modifications.
|
|
105
|
+
*/
|
|
106
|
+
dispatch<C extends HookContextType>(event: HookEventType, context: C): Promise<ResultType<C, KustodianErrorType>>;
|
|
107
|
+
/**
|
|
108
|
+
* Checks if any hooks are registered for an event.
|
|
109
|
+
*/
|
|
110
|
+
has_hooks(event: HookEventType): boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Lists all registered events.
|
|
113
|
+
*/
|
|
114
|
+
list_events(): HookEventType[];
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Creates a new hook dispatcher.
|
|
118
|
+
*/
|
|
119
|
+
export declare function create_hook_dispatcher(): HookDispatcherType;
|
|
120
|
+
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/plugins/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGvE,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExD;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAC9B,kBAAkB,GAClB,yBAAyB,GACzB,+BAA+B,GAC/B,iBAAiB,GACjB,wBAAwB,GACxB,uBAAuB,CAAC;AAE5B,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,GAAG,mBAAmB,GAAG,cAAc,CAAC;AAE3F,MAAM,MAAM,sBAAsB,GAC9B,kBAAkB,GAClB,iBAAiB,GACjB,uBAAuB,GACvB,sBAAsB,GACtB,oBAAoB,CAAC;AAEzB,MAAM,MAAM,uBAAuB,GAC/B,oBAAoB,GACpB,qBAAqB,GACrB,mBAAmB,CAAC;AAExB,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,GAAG,oBAAoB,CAAC;AAE/E;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,sBAAsB,GACtB,gBAAgB,GAChB,sBAAsB,GACtB,uBAAuB,GACvB,mBAAmB,CAAC;AAExB;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,QAAQ,CAAC,EAAE,YAAY,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAyB,SAAQ,mBAAmB;IACnE,OAAO,EAAE,WAAW,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,EAAE,CAAC;IACtB,aA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AAE1B;;GAEG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe,IAAI,CACzE,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,CAAC,KACP,OAAO,CAAC,UAAU,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,iCAAiC;IACjC,KAAK,EAAE,aAAa,CAAC;IACrB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mBAAmB;IACnB,OAAO,EAAE,eAAe,CAAC;CAC1B;AAUD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,0BAA0B,GAAG,IAAI,CAAC;IAEzD;;;;OAIG;IACH,QAAQ,CAAC,CAAC,SAAS,eAAe,EAChC,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,CAAC,GACT,OAAO,CAAC,UAAU,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAE9C;;OAEG;IACH,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC;IAEzC;;OAEG;IACH,WAAW,IAAI,aAAa,EAAE,CAAC;CAChC;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,kBAAkB,CA2C3D"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { is_success, success } from '../core/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a new hook dispatcher.
|
|
4
|
+
*/
|
|
5
|
+
export function create_hook_dispatcher() {
|
|
6
|
+
const hooks = new Map();
|
|
7
|
+
return {
|
|
8
|
+
register(contribution) {
|
|
9
|
+
const { event, priority = 100, handler } = contribution;
|
|
10
|
+
if (!hooks.has(event)) {
|
|
11
|
+
hooks.set(event, []);
|
|
12
|
+
}
|
|
13
|
+
const event_hooks = hooks.get(event);
|
|
14
|
+
if (event_hooks) {
|
|
15
|
+
event_hooks.push({ priority, handler });
|
|
16
|
+
// Sort by priority (lower runs first)
|
|
17
|
+
event_hooks.sort((a, b) => a.priority - b.priority);
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
async dispatch(event, context) {
|
|
21
|
+
const event_hooks = hooks.get(event) ?? [];
|
|
22
|
+
let current_context = context;
|
|
23
|
+
for (const { handler } of event_hooks) {
|
|
24
|
+
const result = await handler(event, current_context);
|
|
25
|
+
if (!is_success(result)) {
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
28
|
+
current_context = result.value;
|
|
29
|
+
}
|
|
30
|
+
return success(current_context);
|
|
31
|
+
},
|
|
32
|
+
has_hooks(event) {
|
|
33
|
+
const event_hooks = hooks.get(event);
|
|
34
|
+
return event_hooks !== undefined && event_hooks.length > 0;
|
|
35
|
+
},
|
|
36
|
+
list_events() {
|
|
37
|
+
return Array.from(hooks.keys());
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../src/plugins/hooks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AA2KvD;;GAEG;AACH,MAAM,UAAU,sBAAsB;IACpC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAuC,CAAC;IAE7D,OAAO;QACL,QAAQ,CAAC,YAAY;YACnB,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,GAAG,EAAE,OAAO,EAAE,GAAG,YAAY,CAAC;YAExD,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;gBACtB,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YACvB,CAAC;YAED,MAAM,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACrC,IAAI,WAAW,EAAE,CAAC;gBAChB,WAAW,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;gBACxC,sCAAsC;gBACtC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;YACtD,CAAC;QACH,CAAC;QAED,KAAK,CAAC,QAAQ,CAA4B,KAAoB,EAAE,OAAU;YACxE,MAAM,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;YAC3C,IAAI,eAAe,GAAG,OAAO,CAAC;YAE9B,KAAK,MAAM,EAAE,OAAO,EAAE,IAAI,WAAW,EAAE,CAAC;gBACtC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;gBACrD,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;oBACxB,OAAO,MAAM,CAAC;gBAChB,CAAC;gBACD,eAAe,GAAG,MAAM,CAAC,KAAU,CAAC;YACtC,CAAC;YAED,OAAO,OAAO,CAAC,eAAe,CAAC,CAAC;QAClC,CAAC;QAED,SAAS,CAAC,KAAK;YACb,MAAM,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACrC,OAAO,WAAW,KAAK,SAAS,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC;QAC7D,CAAC;QAED,WAAW;YACT,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;QAClC,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './generators.js';
|
|
2
|
+
export * from './hooks.js';
|
|
3
|
+
export * from './loader.js';
|
|
4
|
+
export * from './object-types.js';
|
|
5
|
+
export * from './registry.js';
|
|
6
|
+
export * from './substitution-providers.js';
|
|
7
|
+
export * from './types.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAGA,cAAc,iBAAiB,CAAC;AAGhC,cAAc,YAAY,CAAC;AAE3B,cAAc,aAAa,CAAC;AAG5B,cAAc,mBAAmB,CAAC;AAElC,cAAc,eAAe,CAAC;AAE9B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Core types
|
|
2
|
+
// Generator interface
|
|
3
|
+
export * from './generators.js';
|
|
4
|
+
// Hook system
|
|
5
|
+
export * from './hooks.js';
|
|
6
|
+
// Plugin loader
|
|
7
|
+
export * from './loader.js';
|
|
8
|
+
// Object types system
|
|
9
|
+
export * from './object-types.js';
|
|
10
|
+
// Plugin registry
|
|
11
|
+
export * from './registry.js';
|
|
12
|
+
// Substitution providers
|
|
13
|
+
export * from './substitution-providers.js';
|
|
14
|
+
export * from './types.js';
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,aAAa;AAEb,sBAAsB;AACtB,cAAc,iBAAiB,CAAC;AAEhC,cAAc;AACd,cAAc,YAAY,CAAC;AAC3B,gBAAgB;AAChB,cAAc,aAAa,CAAC;AAE5B,sBAAsB;AACtB,cAAc,mBAAmB,CAAC;AAClC,kBAAkB;AAClB,cAAc,eAAe,CAAC;AAC9B,yBAAyB;AACzB,cAAc,6BAA6B,CAAC;AAC5C,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { KustodianErrorType } from '../core/index.js';
|
|
2
|
+
import { type ResultType } from '../core/index.js';
|
|
3
|
+
import type { LoadedPluginType, PluginLocationInfoType } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Plugin discovery configuration.
|
|
6
|
+
*/
|
|
7
|
+
export interface PluginDiscoveryConfigType {
|
|
8
|
+
/** Directories to search for local plugins (default: ['./plugins']) */
|
|
9
|
+
local_plugin_dirs?: string[];
|
|
10
|
+
/** Whether to search node_modules (default: true) */
|
|
11
|
+
search_node_modules?: boolean;
|
|
12
|
+
/** Plugin name prefixes for npm packages (default: ['@kustodian/plugin-', 'kustodian-plugin-']) */
|
|
13
|
+
npm_prefixes?: string[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Plugin loader interface.
|
|
17
|
+
*/
|
|
18
|
+
export interface PluginLoaderType {
|
|
19
|
+
/**
|
|
20
|
+
* Discovers available plugins from npm and local directories.
|
|
21
|
+
*/
|
|
22
|
+
discover(): Promise<ResultType<PluginLocationInfoType[], KustodianErrorType>>;
|
|
23
|
+
/**
|
|
24
|
+
* Loads a plugin by name.
|
|
25
|
+
*/
|
|
26
|
+
load(name: string): Promise<ResultType<LoadedPluginType, KustodianErrorType>>;
|
|
27
|
+
/**
|
|
28
|
+
* Loads a plugin from a specific path.
|
|
29
|
+
*/
|
|
30
|
+
load_from_path(plugin_path: string): Promise<ResultType<LoadedPluginType, KustodianErrorType>>;
|
|
31
|
+
/**
|
|
32
|
+
* Loads multiple plugins by name.
|
|
33
|
+
*/
|
|
34
|
+
load_all(names: string[]): Promise<ResultType<LoadedPluginType[], KustodianErrorType>>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Creates a new plugin loader.
|
|
38
|
+
*/
|
|
39
|
+
export declare function create_plugin_loader(config?: PluginDiscoveryConfigType): PluginLoaderType;
|
|
40
|
+
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/plugins/loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAU,KAAK,UAAU,EAAgC,MAAM,kBAAkB,CAAC;AAEzF,OAAO,KAAK,EAEV,gBAAgB,EAChB,sBAAsB,EAGvB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,uEAAuE;IACvE,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,qDAAqD;IACrD,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,mGAAmG;IACnG,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,QAAQ,IAAI,OAAO,CAAC,UAAU,CAAC,sBAAsB,EAAE,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAE9E;;OAEG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAE9E;;OAEG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAE/F;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,gBAAgB,EAAE,EAAE,kBAAkB,CAAC,CAAC,CAAC;CACxF;AA4BD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,GAAE,yBAA8B,GAAG,gBAAgB,CAyP7F"}
|