npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@k8slens/kubernetes-contracts

v2.0.2

Published

Names and types for Kubernetes resources: every API version and built-in kind, and the types of the Kubernetes API, generated from @kubernetes/client-node

Readme

@k8slens/kubernetes-contracts

What names and types a Kubernetes resource: every API version as a typed specifier, every kind Lens itself knows as a typed kind, and the types of the Kubernetes API, generated from @kubernetes/client-node.

import { podKind, coreV1, type V1PodSpec, type KubeResource } from "@k8slens/kubernetes-contracts";

type ServedPod = KubeResource<typeof podKind, typeof coreV1>; // metadata.name, metadata.uid and spec are required
  • getKubernetesApiVersion and getKubeResourceKind declare an API version and a kind of your own, typed; coreV1, appsV1, autoscalingV2, ... and podKind, deploymentKind, ... are the built-in ones.
  • The schema types are named as client-node names them, the API version first: V1Pod, V1PodSpec, V2HorizontalPodAutoscaler. A kind carries its apiVersion and kind as literals, timestamps are the strings the API serves (Time, MicroTime), ports that may be named are IntOrString, and what the schema leaves open is unknown. Property names are the wire names. The few names client-node had to disambiguate keep their group prefix: CoreV1Event is the core Event, EventsV1Event the one of events.k8s.io.
  • PodV1, DeploymentV1, ... are the built-in kinds' resources as the API serves them, with the fields a served resource always carries made required.

Regenerating

src/generated/ is generated by generator/ from the installed @kubernetes/client-node and the list of built-in kinds in generator/built-in-kinds.ts, and committed. When Dependabot bumps client-node, CI fails until the types are regenerated:

npm run generate --workspace @k8slens/kubernetes-contracts

npm run generate:check --workspace @k8slens/kubernetes-contracts is what CI runs. Which Kubernetes release the types describe, and which client-node version they came from, is recorded in the kubernetes field of package.json and in the header of every generated module.

Versioning

Semver from conventional commits, like every @k8slens package: a regeneration that only adds fields is a feat, one that removes an API version is a breaking change. The Kubernetes release is not the package version.

Provenance

Derived from @kubernetes/client-node (Apache-2.0), itself generated from the Kubernetes OpenAPI specification (Apache-2.0). This package is MIT like its siblings; the notices travel in the generated modules' headers. The field documentation is kept on purpose: it is the Kubernetes API reference, which is what an extension author needs at the call site.