@k8ts/instruments
Version:
A collection of utilities and core components for k8ts.
45 lines • 2.4 kB
TypeScript
export type Kind<Name extends string = string, Version extends Kind.Version = Kind.Version> = Kind.Kind<Name, Version>;
export declare namespace Kind {
type InputVersion = `v${string}`;
interface IdentParent {
text: string;
name: string;
dns: string;
}
abstract class Identifier<Name extends string = string, Parent extends IdentParent | null = IdentParent | null> implements IdentParent {
readonly name: Name;
readonly parent: Parent;
constructor(name: Name, parent: Parent);
get text(): string;
get dns(): string;
abstract child<Name extends string>(name: Name): Identifier<Name, this>;
equals(other: any): boolean;
private hashCode;
}
class Group<const Name extends string = string> extends Identifier<Name, null> {
name: Name;
constructor(name: Name);
version<Version extends InputVersion>(apiVersion: Version): Kind.Version<Version, this>;
child<Name extends string>(name: Name): Version<Name, this>;
}
class Version<const _Version extends string = string, const _Group extends Group = Group> extends Identifier<_Version, _Group> {
kind<Kind extends string>(kind: Kind): Kind.Kind<Kind, this>;
get group(): _Group;
child<Name extends string>(name: Name): Kind<Name, this>;
}
class Kind<const Name extends string = string, const V extends Version = Version> extends Identifier<Name, V> {
get version(): V;
get group(): Group<string>;
subkind<SubKind extends string>(subkind: SubKind): Kind.SubKind<SubKind, this>;
child<Name extends string>(name: Name): SubKind<Name, this>;
}
class SubKind<_SubKind extends string = string, _Parent extends Identifier = Identifier> extends Identifier<_SubKind, _Parent> {
constructor(name: _SubKind, parent: _Parent);
subkind<_SubKind2 extends string>(subkind: _SubKind2): SubKind<_SubKind2, this>;
child<Name extends string>(name: Name): SubKind<Name, this>;
}
function group<ApiGroup extends string>(apiGroup: ApiGroup): Group<ApiGroup>;
function version<ApiVersion extends InputVersion>(apiVersion: ApiVersion): Version<ApiVersion, Group<"">>;
}
export declare function kinded(kind: Kind.Identifier): <T extends abstract new (...args: any[]) => object>(ctor: T) => T;
//# sourceMappingURL=index.d.ts.map