@kubed.io/cdn 0.0.1 → 0.0.4

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.
Files changed (62) hide show
  1. package/LICENSE +0 -0
  2. package/README.md +33 -5
  3. package/dist/chunks/define-XzEniRJH.js +10 -0
  4. package/dist/chunks/define-XzEniRJH.js.map +1 -0
  5. package/dist/chunks/element-ChNBLJ5X.js +632 -0
  6. package/dist/chunks/element-ChNBLJ5X.js.map +1 -0
  7. package/dist/chunks/kd-Bbw0GeQ5.js +1149 -0
  8. package/dist/chunks/kd-Bbw0GeQ5.js.map +1 -0
  9. package/dist/chunks/scene-CUr0fSXC.js +240 -0
  10. package/dist/chunks/scene-CUr0fSXC.js.map +1 -0
  11. package/dist/k8s/elements/events.d.ts +54 -0
  12. package/dist/k8s/elements/object.d.ts +47 -0
  13. package/dist/k8s/elements/ref.d.ts +45 -0
  14. package/dist/k8s/events.d.ts +63 -0
  15. package/dist/k8s/icons.d.ts +18 -0
  16. package/dist/k8s/index.d.ts +13 -0
  17. package/dist/k8s/links.d.ts +72 -0
  18. package/dist/k8s/map.d.ts +114 -0
  19. package/dist/k8s.js +909 -0
  20. package/dist/k8s.js.map +1 -0
  21. package/dist/kd/cell.d.ts +45 -0
  22. package/dist/kd/define.d.ts +0 -0
  23. package/dist/kd/element.d.ts +32 -0
  24. package/dist/kd/elements/bar.d.ts +33 -0
  25. package/dist/kd/elements/data.d.ts +27 -0
  26. package/dist/kd/elements/groups.d.ts +32 -0
  27. package/dist/kd/elements/link.d.ts +67 -0
  28. package/dist/kd/elements/mask.d.ts +22 -0
  29. package/dist/kd/elements/meter.d.ts +37 -0
  30. package/dist/kd/elements/pill.d.ts +15 -0
  31. package/dist/kd/elements/sheet.d.ts +28 -0
  32. package/dist/kd/elements/steps.d.ts +30 -0
  33. package/dist/kd/elements/table.d.ts +38 -0
  34. package/dist/kd/elements/tabs.d.ts +27 -0
  35. package/dist/kd/elements/tile.d.ts +19 -0
  36. package/dist/kd/helpers.d.ts +12 -0
  37. package/dist/kd/index.d.ts +30 -0
  38. package/dist/kd/parts.d.ts +15 -0
  39. package/dist/kd/scene.d.ts +178 -0
  40. package/dist/kd/theme.d.ts +2 -0
  41. package/dist/kd/yaml.d.ts +17 -0
  42. package/dist/kd.css +0 -0
  43. package/dist/kd.js +5 -64
  44. package/dist/n8n/config.d.ts +57 -0
  45. package/dist/n8n/fetch.d.ts +35 -0
  46. package/dist/n8n/history.d.ts +8 -0
  47. package/dist/n8n/index.d.ts +8 -0
  48. package/dist/n8n/metadata.d.ts +10 -0
  49. package/dist/n8n/mount.d.ts +29 -0
  50. package/dist/n8n/state.d.ts +44 -0
  51. package/dist/n8n/stream.d.ts +17 -0
  52. package/dist/n8n/styles.d.ts +1 -0
  53. package/dist/n8n.js +384 -0
  54. package/dist/n8n.js.map +1 -0
  55. package/dist/openapi/describe.d.ts +20 -0
  56. package/dist/openapi/index.d.ts +6 -0
  57. package/dist/openapi/model.d.ts +154 -0
  58. package/dist/openapi/schema.d.ts +52 -0
  59. package/dist/openapi.js +504 -0
  60. package/dist/openapi.js.map +1 -0
  61. package/package.json +18 -2
  62. package/dist/kd.js.map +0 -1
@@ -0,0 +1,63 @@
1
+ import type { TableData } from '../kd/elements/table';
2
+ /** The labels the kube-events source puts on each line. */
3
+ export interface EventLabels {
4
+ kind?: string;
5
+ name?: string;
6
+ namespace?: string;
7
+ objectAPIversion?: string;
8
+ reason?: string;
9
+ type?: string;
10
+ sourcecomponent?: string;
11
+ reportingcontroller?: string;
12
+ [key: string]: unknown;
13
+ }
14
+ /** One Loki log row, as Business Text hands a frame's rows to a panel. */
15
+ export interface EventRow {
16
+ labels?: EventLabels | string;
17
+ Line?: string;
18
+ body?: string;
19
+ Time?: number | string;
20
+ timestamp?: number | string;
21
+ tsNs?: string;
22
+ [key: string]: unknown;
23
+ }
24
+ /** One folded event. */
25
+ export interface EventGroup {
26
+ kind: string;
27
+ name: string;
28
+ namespace: string;
29
+ apiVersion: string;
30
+ reason: string;
31
+ message: string;
32
+ /** The component that reported it. */
33
+ source: string;
34
+ warning: boolean;
35
+ count: number;
36
+ /** ms */
37
+ first: number;
38
+ /** ms */
39
+ last: number;
40
+ }
41
+ /** Reasons that mean something went wrong, for sources whose lines carry no `type` label. */
42
+ export declare const WARNING_REASONS: RegExp;
43
+ /** Whether an event is a warning: its `type` label says so, or its reason does. */
44
+ export declare function isWarning(labels: EventLabels): boolean;
45
+ /**
46
+ * The log rows in whatever Business Text or a query hands over: rows, an
47
+ * array of frames' rows, or data frames with `fields`. Rows that are not log
48
+ * lines (an Infinity query's rows in the same panel) are dropped.
49
+ */
50
+ export declare function eventRows(input: unknown): EventRow[];
51
+ /** Events folded by object, reason and message, the most recent first. */
52
+ export declare function foldEvents(input: unknown): EventGroup[];
53
+ /** Which optional columns an events table has. */
54
+ export interface EventColumns {
55
+ /** The object each event is about, for a view of many objects (a namespace, a workload). */
56
+ object?: boolean;
57
+ /** The object's namespace, for a cluster-wide view (a node). */
58
+ namespace?: boolean;
59
+ /** The end of the time range, in ms: "last seen" is measured to it. */
60
+ now?: number;
61
+ }
62
+ /** Folded events as `kd-table` data: reason pill, [namespace], [object], message, count, last seen. */
63
+ export declare function eventsTable(groups: EventGroup[], opt?: EventColumns): TableData;
@@ -0,0 +1,18 @@
1
+ /** The Kubernetes wheel: a kind nobody drew an icon for. */
2
+ export declare const DEFAULT_ICON = "https://cdn.jsdelivr.net/gh/cncf/artwork@002662490acb2303c7301acc0256c00790e03e9f/projects/kubernetes/icon/color/kubernetes-icon-color.svg";
3
+ /** A custom resource whose group has no icon of its own. */
4
+ export declare const CRD_ICON: string;
5
+ /** The kubernetes/community icon of each built-in kind that has one. */
6
+ export declare const KIND_ICONS: Readonly<Record<string, string>>;
7
+ /** The icon of each API group that has one; a group missing here falls back to `CRD_ICON`. */
8
+ export declare const GROUP_ICONS: Readonly<Record<string, string>>;
9
+ /** The group of an apiVersion: `apps` for `apps/v1`, `''` for `v1`. */
10
+ export declare function apiGroup(apiVersion: string | null | undefined): string;
11
+ /** Whether a group is served by Kubernetes itself rather than a CRD or an aggregated API. */
12
+ export declare function isBuiltInGroup(group: string): boolean;
13
+ /**
14
+ * The icon of a kind. With an apiVersion, a custom resource takes its group's
15
+ * icon (or the CRD icon), so a `ServiceAccount` of some operator's group is not
16
+ * drawn as the core one. A kind with no icon at all gets `DEFAULT_ICON`.
17
+ */
18
+ export declare function kindIcon(kind: string | null | undefined, apiVersion?: string | null): string;
@@ -0,0 +1,13 @@
1
+ import '../kd/index';
2
+ import './elements/events';
3
+ import './elements/object';
4
+ import './elements/ref';
5
+ export { VERSION } from '../kd/define';
6
+ export { applyTheme } from '../kd/theme';
7
+ export { CRD_ICON, DEFAULT_ICON, GROUP_ICONS, KIND_ICONS, apiGroup, isBuiltInGroup, kindIcon } from './icons';
8
+ export { DASHBOARDS, WORKLOAD_KINDS, apiPath, definitionRoute, kindLink, namespaceLink, namespaceRoute, plural, refLink, route, type LinkOptions, type ObjectRef, type RefCell, type Route, } from './links';
9
+ export { HIDDEN_ANNOTATIONS, NEGATIVE_CONDITIONS, age, annotations, bar, chips, conditionOk, conditions, duration, labels, owners, quantity, resources, summary, trimmed, type Condition, type ContainerLike, type K8sObject, type MapOptions, type ObjectMeta, type OwnerReference, type ResourceMeter, type ResourceRequirements, } from './map';
10
+ export { WARNING_REASONS, eventRows, eventsTable, foldEvents, isWarning, type EventColumns, type EventGroup, type EventLabels, type EventRow, } from './events';
11
+ export { KdK8sEvents } from './elements/events';
12
+ export { KdK8sObject } from './elements/object';
13
+ export { KdK8sRef } from './elements/ref';
@@ -0,0 +1,72 @@
1
+ import type { DashboardCell, HrefCell } from '../kd/cell';
2
+ import type { Vars } from '../kd/elements/link';
3
+ /** What names one Kubernetes object. */
4
+ export interface ObjectRef {
5
+ kind: string;
6
+ name: string;
7
+ namespace?: string | null;
8
+ apiVersion?: string | null;
9
+ /** The resource name (`deployments`) when the kind's plural is irregular; guessed otherwise. */
10
+ plural?: string | null;
11
+ }
12
+ /** A dashboard and its variables. */
13
+ export interface Route {
14
+ dashboard: string;
15
+ vars: Vars;
16
+ }
17
+ /** Options for a link cell. */
18
+ export interface LinkOptions {
19
+ /** The label; defaults to the object's name. */
20
+ text?: string;
21
+ /** False leaves the icon out; a string replaces it. */
22
+ icon?: boolean | string;
23
+ /** Tooltip; defaults to the kind. */
24
+ title?: string;
25
+ }
26
+ /** A dashboard link, or a plain label (an `href` cell with an empty href) where no view shows the kind. */
27
+ export type RefCell = DashboardCell | HrefCell;
28
+ /** Kinds the workload view opens, and the apiVersion each has when a reference omits it. */
29
+ export declare const WORKLOAD_KINDS: Readonly<Record<string, string>>;
30
+ /** The k8s-* dashboards, by kind, that the routes below can open. */
31
+ export declare const DASHBOARDS: {
32
+ readonly pod: 'k8s-pod';
33
+ readonly workload: 'k8s-workload';
34
+ readonly maps: 'k8s-maps';
35
+ readonly volume: 'k8s-volume';
36
+ readonly class: 'k8s-class';
37
+ readonly serviceaccount: 'k8s-serviceaccount';
38
+ readonly crd: 'k8s-crd';
39
+ readonly rd: 'k8s-rd';
40
+ readonly namespace: 'k8s-namespace';
41
+ readonly node: 'k8s-node';
42
+ readonly service: 'k8s-service';
43
+ readonly ingress: 'k8s-ingress';
44
+ readonly resource: 'k8s-resource';
45
+ };
46
+ /** A kind's resource name, as the API guesses it: `Ingress` -> `ingresses`, `Policy` -> `policies`. */
47
+ export declare function plural(kind: string): string;
48
+ /** The API path of an object: `apis/apps/v1/namespaces/db/statefulsets/postgresql`, or `api/v1/nodes/n1`. */
49
+ export declare function apiPath(ref: ObjectRef): string | undefined;
50
+ /** The namespace view. */
51
+ export declare function namespaceRoute(namespace: string): Route;
52
+ /**
53
+ * The dashboard that shows an object: its own k8s-* view for the kinds that
54
+ * have one, else the generic resource view (which needs the apiVersion to
55
+ * build the API path). Undefined when there is neither.
56
+ */
57
+ export declare function route(ref: ObjectRef): Route | undefined;
58
+ /**
59
+ * The view of a kind's definition: the CRD view for a custom resource (its
60
+ * CRD is named `<plural>.<group>`), the resource-definition view for a
61
+ * built-in kind (which picks it as `<api path>#<Kind>`).
62
+ */
63
+ export declare function definitionRoute(kind: string, apiVersion: string, resource?: string | null): Route;
64
+ /**
65
+ * An object as a link cell (`kd-link` data) to its view, with its kind's icon
66
+ * and a back link to this page. A kind no view shows is a plain label.
67
+ */
68
+ export declare function refLink(ref: ObjectRef, opt?: LinkOptions): RefCell;
69
+ /** A namespace as a link cell to the namespace view. */
70
+ export declare function namespaceLink(namespace: string, opt?: LinkOptions): DashboardCell;
71
+ /** A kind as a link cell to its definition. */
72
+ export declare function kindLink(kind: string, apiVersion: string, opt?: LinkOptions): DashboardCell;
@@ -0,0 +1,114 @@
1
+ import type { Cell } from '../kd/cell';
2
+ import type { BarData } from '../kd/elements/bar';
3
+ import type { GroupsData } from '../kd/elements/groups';
4
+ import type { MeterData } from '../kd/elements/meter';
5
+ import type { SheetRow } from '../kd/elements/sheet';
6
+ import type { Step } from '../kd/elements/steps';
7
+ import { type RefCell } from './links';
8
+ export interface OwnerReference {
9
+ apiVersion?: string;
10
+ kind: string;
11
+ name: string;
12
+ uid?: string;
13
+ controller?: boolean;
14
+ }
15
+ export interface Condition {
16
+ type: string;
17
+ status: 'True' | 'False' | 'Unknown' | string;
18
+ reason?: string;
19
+ message?: string;
20
+ lastTransitionTime?: string;
21
+ }
22
+ export interface ObjectMeta {
23
+ name?: string;
24
+ namespace?: string;
25
+ uid?: string;
26
+ creationTimestamp?: string;
27
+ deletionTimestamp?: string;
28
+ labels?: Record<string, string>;
29
+ annotations?: Record<string, string>;
30
+ ownerReferences?: OwnerReference[];
31
+ finalizers?: string[];
32
+ [key: string]: unknown;
33
+ }
34
+ /** Any Kubernetes API object; only the parts the mappings read are typed. */
35
+ export interface K8sObject {
36
+ apiVersion?: string;
37
+ kind?: string;
38
+ metadata?: ObjectMeta;
39
+ spec?: any;
40
+ status?: any;
41
+ [key: string]: unknown;
42
+ }
43
+ export interface ResourceRequirements {
44
+ requests?: Record<string, string | number>;
45
+ limits?: Record<string, string | number>;
46
+ }
47
+ /** A container, or anything with `resources`. */
48
+ export interface ContainerLike {
49
+ name?: string;
50
+ resources?: ResourceRequirements;
51
+ }
52
+ /** Options shared by the mappings that show an age. */
53
+ export interface MapOptions {
54
+ /** The time ages are measured to, in ms; defaults to now. */
55
+ now?: number;
56
+ /** Other objects the owner chain may walk through (the ReplicaSet a pod's Deployment owns, say). */
57
+ related?: K8sObject[];
58
+ }
59
+ /**
60
+ * A Kubernetes quantity as a plain number in base units: `100m` -> 0.1,
61
+ * `128Mi` -> 134217728, `1e3` -> 1000, `2E` -> 2e18. NaN when it is not one.
62
+ */
63
+ export declare function quantity(value: string | number | null | undefined): number;
64
+ /** Seconds as kubectl-ish text: `42s`, `5m`, `3h 12m`, `2d 4h`. */
65
+ export declare function duration(seconds: number): string;
66
+ /** How long ago a timestamp was, or '' without one. */
67
+ export declare function age(iso: string | null | undefined, now?: number): string;
68
+ export interface ResourceMeter {
69
+ /** `cpu`, `memory`, or any other resource name. */
70
+ resource: string;
71
+ data: MeterData;
72
+ }
73
+ /**
74
+ * One meter per resource a container requests or limits, cpu and memory
75
+ * first: CPU in millicores, bytes in Ki/Mi/Gi/Ti. `usage` (quantities or base
76
+ * numbers, by resource name) fills the meter; without it only the marks show.
77
+ */
78
+ export declare function resources(container: ContainerLike | null | undefined, usage?: Record<string, string | number>): ResourceMeter[];
79
+ /** Condition types that are good when False. */
80
+ export declare const NEGATIVE_CONDITIONS: ReadonlySet<string>;
81
+ /** Whether a condition is in its good state (true), its bad one (false), or unknown (null). */
82
+ export declare function conditionOk(c: Condition): boolean | null;
83
+ /**
84
+ * The object's conditions as steps, in the order they happen for the kinds
85
+ * that have one: done when good, failed when bad, warning when unknown. The
86
+ * time is how long after creation the condition last changed.
87
+ */
88
+ export declare function conditions(obj: K8sObject | null | undefined): Step[];
89
+ /**
90
+ * The owner chain, outermost first, as link cells: each owner reference, with
91
+ * the owners of any owner found in `related` before it. A pod's ReplicaSet
92
+ * that carries its `pod-template-hash` is preceded by the Deployment it
93
+ * implies even when the ReplicaSet itself is not at hand.
94
+ */
95
+ export declare function owners(obj: K8sObject | null | undefined, related?: K8sObject[]): RefCell[];
96
+ /** The labels, for `<kd-groups mode="pills">`. */
97
+ export declare function labels(obj: K8sObject | null | undefined): GroupsData;
98
+ /** Annotations too large and too stale to show: the copy of the object kubectl apply keeps. */
99
+ export declare const HIDDEN_ANNOTATIONS: readonly string[];
100
+ /** The annotations, for `<kd-groups mode="tree">`, without the last-applied copy. */
101
+ export declare function annotations(obj: K8sObject | null | undefined): GroupsData;
102
+ /**
103
+ * A property sheet of the object, as the k8s views show it: kind (linked to
104
+ * its definition), namespace, age, owners and uid, then what the kind adds
105
+ * (a pod's node and IPs, a workload's replicas, a node's addresses and
106
+ * capacity), then finalizers. Empty rows are left in; `kd-sheet` drops them.
107
+ */
108
+ export declare function summary(obj: K8sObject | null | undefined, opt?: MapOptions): SheetRow[];
109
+ /** Status pills for the title bar: a pod's phase, readiness and restarts; a node's readiness; else phase, replicas and conditions. */
110
+ export declare function chips(obj: K8sObject | null | undefined): Cell[];
111
+ /** The title bar: the kind's icon, `Kind · namespace` above the name, status pills and the owner chain. */
112
+ export declare function bar(obj: K8sObject | null | undefined, opt?: MapOptions): BarData;
113
+ /** The object without what nobody reads: managedFields and the last-applied copy. */
114
+ export declare function trimmed(obj: K8sObject): K8sObject;