@kubed.io/cdn 0.0.3 → 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.
- package/README.md +33 -5
- package/dist/chunks/define-XzEniRJH.js +10 -0
- package/dist/chunks/define-XzEniRJH.js.map +1 -0
- package/dist/chunks/element-ChNBLJ5X.js +632 -0
- package/dist/chunks/element-ChNBLJ5X.js.map +1 -0
- package/dist/chunks/kd-Bbw0GeQ5.js +1149 -0
- package/dist/chunks/kd-Bbw0GeQ5.js.map +1 -0
- package/dist/chunks/scene-CUr0fSXC.js +240 -0
- package/dist/chunks/scene-CUr0fSXC.js.map +1 -0
- package/dist/k8s/elements/events.d.ts +54 -0
- package/dist/k8s/elements/object.d.ts +47 -0
- package/dist/k8s/elements/ref.d.ts +45 -0
- package/dist/k8s/events.d.ts +63 -0
- package/dist/k8s/icons.d.ts +18 -0
- package/dist/k8s/index.d.ts +13 -0
- package/dist/k8s/links.d.ts +72 -0
- package/dist/k8s/map.d.ts +114 -0
- package/dist/k8s.js +909 -0
- package/dist/k8s.js.map +1 -0
- package/dist/kd/cell.d.ts +45 -0
- package/dist/kd/element.d.ts +32 -0
- package/dist/kd/elements/bar.d.ts +33 -0
- package/dist/kd/elements/data.d.ts +27 -0
- package/dist/kd/elements/groups.d.ts +32 -0
- package/dist/kd/elements/link.d.ts +67 -0
- package/dist/kd/elements/mask.d.ts +22 -0
- package/dist/kd/elements/meter.d.ts +37 -0
- package/dist/kd/elements/pill.d.ts +15 -0
- package/dist/kd/elements/sheet.d.ts +28 -0
- package/dist/kd/elements/steps.d.ts +30 -0
- package/dist/kd/elements/table.d.ts +38 -0
- package/dist/kd/elements/tabs.d.ts +27 -0
- package/dist/kd/elements/tile.d.ts +19 -0
- package/dist/kd/helpers.d.ts +12 -0
- package/dist/kd/index.d.ts +30 -0
- package/dist/kd/parts.d.ts +15 -0
- package/dist/kd/scene.d.ts +178 -0
- package/dist/kd/theme.d.ts +2 -0
- package/dist/kd/yaml.d.ts +17 -0
- package/dist/kd.js +5 -64
- package/dist/n8n/config.d.ts +57 -0
- package/dist/n8n/fetch.d.ts +35 -0
- package/dist/n8n/history.d.ts +8 -0
- package/dist/n8n/index.d.ts +8 -0
- package/dist/n8n/metadata.d.ts +10 -0
- package/dist/n8n/mount.d.ts +29 -0
- package/dist/n8n/state.d.ts +44 -0
- package/dist/n8n/stream.d.ts +17 -0
- package/dist/n8n/styles.d.ts +1 -0
- package/dist/n8n.js +384 -0
- package/dist/n8n.js.map +1 -0
- package/dist/openapi/describe.d.ts +20 -0
- package/dist/openapi/index.d.ts +6 -0
- package/dist/openapi/model.d.ts +154 -0
- package/dist/openapi/schema.d.ts +52 -0
- package/dist/openapi.js +504 -0
- package/dist/openapi.js.map +1 -0
- package/package.json +18 -2
- package/dist/kd.js.map +0 -1
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/** A raw schema object, as it appears in the document. */
|
|
2
|
+
export type Schema = Record<string, unknown>;
|
|
3
|
+
/** An OpenAPI v3 document, or any JSON document that holds schemas. */
|
|
4
|
+
export interface OpenApiDocument {
|
|
5
|
+
components?: {
|
|
6
|
+
schemas?: Record<string, Schema>;
|
|
7
|
+
};
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
/** One `x-kubernetes-validations` entry: a CEL rule. */
|
|
11
|
+
export interface Validation {
|
|
12
|
+
rule: string;
|
|
13
|
+
message?: string;
|
|
14
|
+
messageExpression?: string;
|
|
15
|
+
reason?: string;
|
|
16
|
+
fieldPath?: string;
|
|
17
|
+
optionalOldSelf?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/** One `x-kubernetes-group-version-kind` entry. */
|
|
20
|
+
export interface GroupVersionKind {
|
|
21
|
+
group: string;
|
|
22
|
+
version: string;
|
|
23
|
+
kind: string;
|
|
24
|
+
}
|
|
25
|
+
/** One `x-kubernetes-unions` entry. */
|
|
26
|
+
export interface Union {
|
|
27
|
+
discriminator?: string;
|
|
28
|
+
'fields-to-discriminateBy'?: Record<string, string>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Every keyword the model knows, typed. Values are the document's own, after
|
|
32
|
+
* `$ref` resolution and the `allOf` merge; nothing is rewritten. Kubernetes'
|
|
33
|
+
* `x-kubernetes-*` extensions are OpenAPI extensions, so they are known here
|
|
34
|
+
* like any other keyword.
|
|
35
|
+
*/
|
|
36
|
+
export interface Keywords {
|
|
37
|
+
$ref?: string;
|
|
38
|
+
type?: string | string[];
|
|
39
|
+
title?: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
format?: string;
|
|
42
|
+
pattern?: string;
|
|
43
|
+
default?: unknown;
|
|
44
|
+
enum?: unknown[];
|
|
45
|
+
const?: unknown;
|
|
46
|
+
example?: unknown;
|
|
47
|
+
examples?: unknown[];
|
|
48
|
+
minimum?: number;
|
|
49
|
+
maximum?: number;
|
|
50
|
+
/** A boolean in OpenAPI 3.0, a number in JSON Schema 2019+. */
|
|
51
|
+
exclusiveMinimum?: boolean | number;
|
|
52
|
+
exclusiveMaximum?: boolean | number;
|
|
53
|
+
multipleOf?: number;
|
|
54
|
+
minLength?: number;
|
|
55
|
+
maxLength?: number;
|
|
56
|
+
minItems?: number;
|
|
57
|
+
maxItems?: number;
|
|
58
|
+
uniqueItems?: boolean;
|
|
59
|
+
minProperties?: number;
|
|
60
|
+
maxProperties?: number;
|
|
61
|
+
nullable?: boolean;
|
|
62
|
+
readOnly?: boolean;
|
|
63
|
+
writeOnly?: boolean;
|
|
64
|
+
deprecated?: boolean;
|
|
65
|
+
externalDocs?: {
|
|
66
|
+
url?: string;
|
|
67
|
+
description?: string;
|
|
68
|
+
};
|
|
69
|
+
required?: string[];
|
|
70
|
+
properties?: Record<string, Schema>;
|
|
71
|
+
items?: Schema | Schema[];
|
|
72
|
+
additionalProperties?: boolean | Schema;
|
|
73
|
+
allOf?: Schema[];
|
|
74
|
+
anyOf?: Schema[];
|
|
75
|
+
oneOf?: Schema[];
|
|
76
|
+
not?: Schema;
|
|
77
|
+
'x-kubernetes-int-or-string'?: boolean;
|
|
78
|
+
'x-kubernetes-preserve-unknown-fields'?: boolean;
|
|
79
|
+
'x-kubernetes-embedded-resource'?: boolean;
|
|
80
|
+
'x-kubernetes-list-type'?: 'atomic' | 'set' | 'map' | string;
|
|
81
|
+
'x-kubernetes-list-map-keys'?: string[];
|
|
82
|
+
'x-kubernetes-map-type'?: 'atomic' | 'granular' | string;
|
|
83
|
+
'x-kubernetes-validations'?: Validation[];
|
|
84
|
+
'x-kubernetes-patch-strategy'?: string;
|
|
85
|
+
'x-kubernetes-patch-merge-key'?: string;
|
|
86
|
+
'x-kubernetes-unions'?: Union[];
|
|
87
|
+
'x-kubernetes-group-version-kind'?: GroupVersionKind[];
|
|
88
|
+
}
|
|
89
|
+
/** The names of every known keyword, in display order. */
|
|
90
|
+
export declare const KEYWORDS: readonly (keyof Keywords)[];
|
|
91
|
+
/**
|
|
92
|
+
* A node of the schema tree: a field, the root, or the item/value schema of a
|
|
93
|
+
* list/map.
|
|
94
|
+
*
|
|
95
|
+
* Children (`properties`, `items`, `values`, `fields`) are computed when first
|
|
96
|
+
* read and then kept, so normalizing a root costs one node and a viewer pays
|
|
97
|
+
* only for what it opens. `parent` and `cycle` are getters, so a node
|
|
98
|
+
* serialises as plain data without looping.
|
|
99
|
+
*
|
|
100
|
+
* Recursion is cut, never depth-limited: a node whose type is already open
|
|
101
|
+
* above it has `cycle` set to that ancestor and no children.
|
|
102
|
+
*/
|
|
103
|
+
export interface SchemaNode {
|
|
104
|
+
/** `root` (what normalize returns), `field` (a property), `item` (an array's items), `value` (a map's values). */
|
|
105
|
+
readonly role: 'root' | 'field' | 'item' | 'value';
|
|
106
|
+
/** The property name; `''` for the root, an item or a value. */
|
|
107
|
+
readonly name: string;
|
|
108
|
+
/** The path as kubectl explain spells it (`spec.template.spec.containers.name`); items and values share their owner's. */
|
|
109
|
+
readonly path: string;
|
|
110
|
+
/** Listed in the owning object's `required`. */
|
|
111
|
+
readonly required: boolean;
|
|
112
|
+
/** The display type in kubectl explain's spelling: `string`, `Object`, `[]Container`, `map[string]string`, `int-or-string`, `any`. */
|
|
113
|
+
readonly type: string;
|
|
114
|
+
/** The short name of the type it was referenced as (`PodSpec` for `io.k8s.api.core.v1.PodSpec`). */
|
|
115
|
+
readonly typeName?: string;
|
|
116
|
+
/** The full name of the schema `$ref`/`allOf` brought in (`io.k8s.api.core.v1.PodSpec`). */
|
|
117
|
+
readonly ref?: string;
|
|
118
|
+
/** The schema after `$ref` resolution and the `allOf` merge; the node's own keywords win. */
|
|
119
|
+
readonly schema: Schema;
|
|
120
|
+
/** The known keywords of `schema`. */
|
|
121
|
+
readonly keywords: Keywords;
|
|
122
|
+
/** Every keyword of `schema` the model does not know, raw. */
|
|
123
|
+
readonly other: Record<string, unknown>;
|
|
124
|
+
/** The node it belongs to; the root has none. */
|
|
125
|
+
readonly parent: SchemaNode | undefined;
|
|
126
|
+
/** When this node's type is open in an ancestor, that ancestor. Its children are listed there, not here. */
|
|
127
|
+
readonly cycle: SchemaNode | undefined;
|
|
128
|
+
/** The object's own properties, in document order. */
|
|
129
|
+
readonly properties: readonly SchemaNode[];
|
|
130
|
+
/** An array's item schema. */
|
|
131
|
+
readonly items: SchemaNode | undefined;
|
|
132
|
+
/** A map's value schema (an `additionalProperties` schema). */
|
|
133
|
+
readonly values: SchemaNode | undefined;
|
|
134
|
+
/** The children kubectl explain lists: the properties, else the items' fields, else the values' fields. */
|
|
135
|
+
readonly fields: readonly SchemaNode[];
|
|
136
|
+
/** Whether `fields` is non-empty. */
|
|
137
|
+
readonly expandable: boolean;
|
|
138
|
+
}
|
|
139
|
+
/** A root: a component name (`X` or `#/components/schemas/X`, or a unique `.X` suffix), any `#/` pointer, a schema, a CRD version, or a CRD. */
|
|
140
|
+
export type Root = string | Schema;
|
|
141
|
+
/** The short name of a component, as kubectl explain shows it: `io.k8s.api.core.v1.PodSpec` -> `PodSpec`. */
|
|
142
|
+
export declare function shortName(ref: string): string;
|
|
143
|
+
/**
|
|
144
|
+
* The schema tree of `root` in `document`. Only the root is built; every other
|
|
145
|
+
* node is built when its parent's children are first read.
|
|
146
|
+
*
|
|
147
|
+
* @param document an OpenAPI v3 document (its `components.schemas` resolve `$ref`), a CRD, or a bare schema
|
|
148
|
+
* @param root a component name (`io.k8s.api.apps.v1.Deployment`, `#/components/schemas/...`, or a unique suffix
|
|
149
|
+
* such as `apps.v1.Deployment`), a `#/` pointer, a schema object, a CRD version (`{schema: {openAPIV3Schema}}`)
|
|
150
|
+
* or its `openAPIV3Schema`; omitted, the document itself (a CRD: its storage version)
|
|
151
|
+
*/
|
|
152
|
+
export declare function normalize(document: unknown, root?: Root): SchemaNode;
|
|
153
|
+
/** The node at a dotted field path below `node` (`spec.template.spec.containers.name`), or undefined. */
|
|
154
|
+
export declare function find(node: SchemaNode, path: string): SchemaNode | undefined;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
2
|
+
import { KdElement } from '../kd/element';
|
|
3
|
+
import { type Root } from './model';
|
|
4
|
+
/**
|
|
5
|
+
* An OpenAPI v3 / JSON Schema viewer, written the way the YAML is: a field per
|
|
6
|
+
* line with its type, constraints and Kubernetes behaviours beside it, a
|
|
7
|
+
* required marker, and the description, rules and fields when opened. A
|
|
8
|
+
* subtree is rendered only when it is opened.
|
|
9
|
+
*
|
|
10
|
+
* Data in: `document` (an OpenAPI document, a CRD or a schema) and `root` (see
|
|
11
|
+
* `normalize`) as properties, or `src`, a URL returning the document.
|
|
12
|
+
*
|
|
13
|
+
* Attributes: `root`, `src`, `expand` (top-level fields open at first, default
|
|
14
|
+
* `spec status`), `omit` (top-level fields left out, e.g. `apiVersion kind metadata`).
|
|
15
|
+
*/
|
|
16
|
+
export declare class KdSchema extends KdElement {
|
|
17
|
+
#private;
|
|
18
|
+
static properties: {
|
|
19
|
+
document: {
|
|
20
|
+
attribute: boolean;
|
|
21
|
+
};
|
|
22
|
+
root: {
|
|
23
|
+
attribute: string;
|
|
24
|
+
};
|
|
25
|
+
src: {
|
|
26
|
+
attribute: string;
|
|
27
|
+
};
|
|
28
|
+
expand: {
|
|
29
|
+
attribute: string;
|
|
30
|
+
};
|
|
31
|
+
omit: {
|
|
32
|
+
attribute: string;
|
|
33
|
+
};
|
|
34
|
+
error: {
|
|
35
|
+
state: boolean;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
document: unknown;
|
|
39
|
+
root: Root | undefined;
|
|
40
|
+
src: string | undefined;
|
|
41
|
+
expand: string | undefined;
|
|
42
|
+
omit: string | undefined;
|
|
43
|
+
error: string | undefined;
|
|
44
|
+
static styles: import("lit").CSSResult[];
|
|
45
|
+
protected willUpdate(changed: PropertyValues<this>): void;
|
|
46
|
+
render(): TemplateResult;
|
|
47
|
+
}
|
|
48
|
+
declare global {
|
|
49
|
+
interface HTMLElementTagNameMap {
|
|
50
|
+
'kd-schema': KdSchema;
|
|
51
|
+
}
|
|
52
|
+
}
|