@k8ts/metadata
Version:
K8ts tools for working with k8ts metadata.
103 lines • 3.87 kB
TypeScript
import { Map } from "immutable";
import type { InputMeta, MetaInputParts } from "./input/dict-input";
import { ValueKey } from "./key/repr";
import { Key as Key_ } from "./key/types";
export type Meta = Meta.Meta;
export type MutableMeta = Meta.MutableMeta;
export declare namespace Meta {
function _checkNameValue(what: string, v: string): void;
function _checkValue(key: ValueKey, v: string): void;
type Input = InputMeta;
export import Key = Key_;
class Meta implements Iterable<[ValueKey, string]> {
private readonly _dict;
constructor(_dict: Map<ValueKey, string>);
[Symbol.iterator](): IterableIterator<[ValueKey, string]>;
protected _create(raw: Map<ValueKey, string>): Meta;
private _createWith;
add(key: Key.Value, value: string): Meta;
add(key: Key.Section, value: MetaInputParts.Nested): Meta;
add(input: InputMeta): Meta;
equals(other: Meta.Input): boolean;
section(key: string): Meta;
overwrite(key: Key.Value, value: string): Meta;
overwrite(key: Key.Section, value: MetaInputParts.Nested): Meta;
overwrite(input?: InputMeta): Meta;
has<X extends Key.Value>(key: X): boolean;
get(key: Key.Value): string;
tryGet(key: Key.Value, fallback?: string): string | undefined;
private _matchSectionKeys;
pick(...keySpecs: Key.Key[]): Meta;
private _prefixed;
get labels(): {
[key: string]: string;
};
get annotations(): {
[key: string]: string;
};
get comments(): {
[key: string]: string;
};
get values(): {
[x: string]: string;
[x: number]: string;
[x: symbol]: string;
};
get core(): { [key in Key.Special]?: string; };
remove(key: Key.Value): this;
remove(ns: Key.Section, key: string): this;
remove(ns: Key.Section): this;
expand(): {
labels: {
[key: string]: string;
};
annotations: {
[key: string]: string;
};
namespace?: string | undefined;
name?: string | undefined;
};
toMutable(): MutableMeta;
}
function make(key: Key.Value, value: string): Meta;
function make(key: Key.Section, value: MetaInputParts.Nested): Meta;
function make(input?: InputMeta): Meta;
function makeMutable(input?: InputMeta): MutableMeta;
function splat(...input: InputMeta[]): Meta;
function is(value: any): value is Meta;
class MutableMeta {
private _meta;
constructor(_meta: Meta);
add(key: Key.Value, value: string): this;
add(key: Key.Section, value: MetaInputParts.Nested): this;
add(input: InputMeta): this;
remove(key: Key.Value): this;
remove(ns: Key.Section, key: string): this;
remove(ns: Key.Section): this;
overwrite(key: Key.Value, value: string): this;
overwrite(key: Key.Section, value: MetaInputParts.Nested): this;
overwrite(input?: InputMeta): this;
equals(other: Meta.Input): boolean;
get(key: Key.Value): string;
tryGet(key: Key.Value, fallback?: string): string | undefined;
has(key: Key.Value): boolean;
pick(...keySpecs: Key.Key[]): MutableMeta;
toMutable(): MutableMeta;
section(key: string): MutableMeta;
get labels(): {
[key: string]: string;
};
get annotations(): {
[key: string]: string;
};
get comments(): {
[key: string]: string;
};
get core(): {
namespace?: string | undefined;
name?: string | undefined;
};
toImmutable(): Meta;
}
}
//# sourceMappingURL=meta.d.ts.map