@litelens/core 1.0.0

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.
@@ -0,0 +1,954 @@
1
+ import { ElementType, ReactNode, ComponentType } from 'react';
2
+
3
+ interface UseQueryCallback<T = unknown> {
4
+ select?: (data?: T) => T;
5
+ }
6
+
7
+ interface NavItem<T> {
8
+ id: string;
9
+ label: string;
10
+ view?: T;
11
+ }
12
+ interface NavGroup<T> {
13
+ id: string;
14
+ label: string;
15
+ icon: ElementType;
16
+ items: NavItem<T>[];
17
+ /** Whether the sidebar should render this group expanded the first time it's registered. */
18
+ defaultOpen?: boolean;
19
+ }
20
+ type NavEntry<T> = {
21
+ kind: "item";
22
+ icon: ElementType;
23
+ item: NavItem<T>;
24
+ } | {
25
+ kind: "group";
26
+ group: NavGroup<T>;
27
+ };
28
+
29
+ interface ManagedField {
30
+ Manager: string;
31
+ Operation: string;
32
+ FieldsYAML: string;
33
+ }
34
+
35
+ interface PolicyRule {
36
+ Resources: string[];
37
+ Verbs: string[];
38
+ APIGroups: string[];
39
+ ResourceNames: string[];
40
+ NonResourceURLs: string[];
41
+ }
42
+ interface ClusterRole {
43
+ Name: string;
44
+ Age: string;
45
+ CreatedAt: string;
46
+ Labels: Record<string, string>;
47
+ Annotations: Record<string, string>;
48
+ ManagedFields: ManagedField[];
49
+ Rules: PolicyRule[];
50
+ }
51
+
52
+ interface CRBSubject {
53
+ Kind: string;
54
+ Name: string;
55
+ Namespace: string;
56
+ }
57
+ interface ClusterRoleBinding {
58
+ Name: string;
59
+ Bindings: string;
60
+ Age: string;
61
+ CreatedAt: string;
62
+ Labels: Record<string, string>;
63
+ Annotations: Record<string, string>;
64
+ ManagedFields: ManagedField[];
65
+ RoleRefKind: string;
66
+ RoleRefName: string;
67
+ RoleRefGroup: string;
68
+ Subjects: CRBSubject[];
69
+ }
70
+
71
+ interface ConfigMap {
72
+ Name: string;
73
+ Namespace: string;
74
+ Keys: string[];
75
+ Age: string;
76
+ CreatedAt: string;
77
+ Labels: Record<string, string>;
78
+ Annotations: Record<string, string>;
79
+ ManagedFields: ManagedField[];
80
+ Data: Record<string, string>;
81
+ }
82
+
83
+ interface CronJob {
84
+ Name: string;
85
+ Namespace: string;
86
+ Schedule: string;
87
+ Timezone: string;
88
+ Suspend: boolean;
89
+ Active: number;
90
+ LastSchedule: string;
91
+ Age: string;
92
+ CreatedAt: string;
93
+ Annotations?: Record<string, string>;
94
+ ManagedFields: ManagedField[];
95
+ ConcurrencyPolicy: string;
96
+ SuccessfulJobsHistoryLimit: number;
97
+ FailedJobsHistoryLimit: number;
98
+ LastSuccessfulTime?: string;
99
+ LastSuccessfulTimeAt?: string;
100
+ LastScheduleAt?: string;
101
+ JobParallelism: number;
102
+ JobCompletions: string;
103
+ JobSuspend: boolean;
104
+ JobTTLSecondsAfterFinished: number;
105
+ }
106
+ interface CronJobSummary {
107
+ Scheduled: number;
108
+ Suspended: number;
109
+ }
110
+
111
+ interface DaemonSet {
112
+ Name: string;
113
+ Namespace: string;
114
+ Pods: string;
115
+ NodeSelector: string;
116
+ Age: string;
117
+ CreatedAt: string;
118
+ Labels: Record<string, string>;
119
+ Annotations: Record<string, string>;
120
+ ManagedFields: ManagedField[];
121
+ Selector: string;
122
+ Images: string[];
123
+ StrategyType: string;
124
+ Tolerations: number;
125
+ PodStatus: string;
126
+ }
127
+ interface DaemonSetSummary {
128
+ Running: number;
129
+ Pending: number;
130
+ }
131
+
132
+ interface PodCondition {
133
+ Type: string;
134
+ Status: string;
135
+ Message: string;
136
+ Reason: string;
137
+ LastProbeTime: string;
138
+ LastTransitionTime: string;
139
+ }
140
+ interface PodContainerPort {
141
+ Name: string;
142
+ HostIP: string;
143
+ HostPort: number;
144
+ ContainerPort: number;
145
+ Protocol: string;
146
+ }
147
+ interface PodContainerMount {
148
+ Path: string;
149
+ Name: string;
150
+ ReadOnly: boolean;
151
+ }
152
+ interface PodContainerLastStatus {
153
+ Reason: string;
154
+ ExitCode: number;
155
+ Started: string;
156
+ Finished: string;
157
+ }
158
+ interface PodContainerDetail {
159
+ Name: string;
160
+ Status: string;
161
+ Image: string;
162
+ Ready: boolean;
163
+ RestartCount: number;
164
+ LastStatus?: PodContainerLastStatus | null;
165
+ Ports: PodContainerPort[];
166
+ EnvVars: string[];
167
+ Mounts: PodContainerMount[];
168
+ Liveness: string;
169
+ Readiness: string;
170
+ Startup: string;
171
+ Command: string[];
172
+ Args: string[];
173
+ StatusMessage: string;
174
+ CPURequest: string;
175
+ CPULimit: string;
176
+ MemRequest: string;
177
+ MemLimit: string;
178
+ DiskRequest: string;
179
+ DiskLimit: string;
180
+ ContainerID: string;
181
+ Reason: string;
182
+ ExitCode?: number | null;
183
+ StartedAt: string;
184
+ FinishedAt: string;
185
+ }
186
+ interface PodVolumeSource {
187
+ Type: string;
188
+ Name: string;
189
+ Items: string[];
190
+ Expiration: string;
191
+ Path: string;
192
+ }
193
+ interface PodVolume {
194
+ Name: string;
195
+ Kind: string;
196
+ HostPath: string;
197
+ CheckBehavior: string;
198
+ Medium: string;
199
+ DefaultMode: string;
200
+ Sources: PodVolumeSource[];
201
+ }
202
+ interface TolerationDetail {
203
+ Key: string;
204
+ Operator: string;
205
+ Value: string;
206
+ Effect: string;
207
+ Seconds?: number | null;
208
+ }
209
+ interface Pod {
210
+ Name: string;
211
+ Namespace: string;
212
+ Status: string;
213
+ Ready: string;
214
+ Containers: number;
215
+ Restarts: number;
216
+ ControlledBy: string;
217
+ NodeName: string;
218
+ QoS: string;
219
+ Age: string;
220
+ CPU: string;
221
+ Memory: string;
222
+ Disk: string;
223
+ CPUPercent: number;
224
+ MemPercent: number;
225
+ DiskPercent: number;
226
+ CreatedAt: string;
227
+ ServiceAccount: string;
228
+ PriorityClass: string;
229
+ TerminationGracePeriod: string;
230
+ ControlledByName: string;
231
+ HostIPs: string[];
232
+ PodIPs: string[];
233
+ Tolerations: number;
234
+ TolerationDetails: TolerationDetail[];
235
+ AffinityCount: number;
236
+ Affinities: string;
237
+ Labels: Record<string, string>;
238
+ Annotations: Record<string, string>;
239
+ ManagedFields: ManagedField[];
240
+ Conditions: PodCondition[];
241
+ ContainerDetails: PodContainerDetail[];
242
+ InitContainerDetails: PodContainerDetail[];
243
+ Volumes: PodVolume[];
244
+ }
245
+ interface PodSummary {
246
+ Running: number;
247
+ Pending: number;
248
+ Failed: number;
249
+ Succeeded: number;
250
+ Evicted: number;
251
+ }
252
+
253
+ interface DeploymentCondition {
254
+ Type: string;
255
+ Status: string;
256
+ Message?: string;
257
+ Reason?: string;
258
+ LastTransitionTime?: string;
259
+ LastUpdateTime?: string;
260
+ }
261
+ interface Deployment {
262
+ Name: string;
263
+ Namespace: string;
264
+ Pods: string;
265
+ Replicas: number;
266
+ Age: string;
267
+ CreatedAt: string;
268
+ Labels: Record<string, string>;
269
+ Annotations: Record<string, string>;
270
+ ManagedFields: ManagedField[];
271
+ ReplicasDetail: string;
272
+ Selector: string;
273
+ NodeSelector: string;
274
+ StrategyType: string;
275
+ Conditions: DeploymentCondition[];
276
+ Tolerations: number;
277
+ TolerationDetails: TolerationDetail[];
278
+ AffinityCount: number;
279
+ Affinities: string;
280
+ }
281
+ interface DeploymentSummary {
282
+ Running: number;
283
+ Pending: number;
284
+ }
285
+
286
+ interface EndpointAddress {
287
+ IP: string;
288
+ Hostname: string;
289
+ TargetName: string;
290
+ }
291
+ interface EndpointPort {
292
+ Name: string;
293
+ Port: number;
294
+ Protocol: string;
295
+ }
296
+ interface EndpointSubset {
297
+ Addresses: EndpointAddress[];
298
+ Ports: EndpointPort[];
299
+ }
300
+ interface Endpoint {
301
+ Name: string;
302
+ Namespace: string;
303
+ Endpoints: string;
304
+ Age: string;
305
+ CreatedAt: string;
306
+ Labels: Record<string, string>;
307
+ Annotations: Record<string, string>;
308
+ ManagedFields: ManagedField[];
309
+ Subsets: EndpointSubset[];
310
+ }
311
+
312
+ interface EndpointSliceEndpoint {
313
+ Addresses: string[];
314
+ Hostname: string;
315
+ NodeName: string;
316
+ Zone: string;
317
+ TargetName: string;
318
+ TargetKind: string;
319
+ Ready: boolean;
320
+ Serving: boolean;
321
+ Terminating: boolean;
322
+ }
323
+ interface EndpointSlicePort {
324
+ Name: string;
325
+ Port: number;
326
+ Protocol: string;
327
+ }
328
+ interface EndpointSlice {
329
+ Name: string;
330
+ Namespace: string;
331
+ AddressType: string;
332
+ Age: string;
333
+ Ports: EndpointSlicePort[];
334
+ Endpoints: EndpointSliceEndpoint[];
335
+ CreatedAt: string;
336
+ ControlledBy: string;
337
+ ServiceName: string;
338
+ Labels: Record<string, string>;
339
+ Annotations: Record<string, string>;
340
+ ManagedFields: ManagedField[];
341
+ }
342
+
343
+ interface Event {
344
+ Type: string;
345
+ Message: string;
346
+ Namespace: string;
347
+ InvolvedObjectKind: string;
348
+ InvolvedObjectName: string;
349
+ Source: string;
350
+ Count: number;
351
+ Age: string;
352
+ LastSeen: string;
353
+ CreatedAt: number;
354
+ Name: string;
355
+ Reason: string;
356
+ FirstSeen: string;
357
+ FirstSeenAt: number;
358
+ LastSeenAt: number;
359
+ InvolvedObjectFieldPath: string;
360
+ InvolvedObjectNamespace: string;
361
+ ManagedFields: ManagedField[];
362
+ }
363
+
364
+ interface HPA {
365
+ Name: string;
366
+ Namespace: string;
367
+ Metrics: string;
368
+ MinPods: number;
369
+ MaxPods: number;
370
+ Replicas: number;
371
+ Age: string;
372
+ Status: string;
373
+ }
374
+ interface HPAMetric {
375
+ Name: string;
376
+ Current: string;
377
+ Target: string;
378
+ }
379
+ interface ScaleTargetRef {
380
+ Kind: string;
381
+ Name: string;
382
+ }
383
+ interface HPADetail {
384
+ Name: string;
385
+ Namespace: string;
386
+ CreatedAt: string;
387
+ Labels: Record<string, string>;
388
+ Annotations: Record<string, string>;
389
+ ScaleTargetRef: ScaleTargetRef;
390
+ Metrics: HPAMetric[];
391
+ MinPods: number;
392
+ MaxPods: number;
393
+ Replicas: number;
394
+ Status: string;
395
+ Age: string;
396
+ }
397
+
398
+ interface Ingress {
399
+ Name: string;
400
+ Namespace: string;
401
+ LoadBalancers: string;
402
+ Rules: IngressRule[];
403
+ Age: string;
404
+ }
405
+ interface IngressPath {
406
+ Path: string;
407
+ Backend: string;
408
+ }
409
+ interface IngressRule {
410
+ Host: string;
411
+ Paths: IngressPath[];
412
+ }
413
+ interface IngressDetail {
414
+ Name: string;
415
+ Namespace: string;
416
+ Age: string;
417
+ CreatedAt: string;
418
+ Labels: Record<string, string>;
419
+ Annotations: Record<string, string>;
420
+ LoadBalancers: string;
421
+ Ports: string;
422
+ Rules: IngressRule[];
423
+ }
424
+
425
+ interface IngressClass {
426
+ Name: string;
427
+ Controller: string;
428
+ IsDefault: boolean;
429
+ Age: string;
430
+ CreatedAt: string;
431
+ Labels: Record<string, string>;
432
+ Annotations: Record<string, string>;
433
+ }
434
+
435
+ interface JobCondition {
436
+ Type: string;
437
+ Status: string;
438
+ Message: string;
439
+ Reason: string;
440
+ LastProbeTime: string;
441
+ LastTransitionTime: string;
442
+ }
443
+ interface Job {
444
+ Name: string;
445
+ Namespace: string;
446
+ Completions: number;
447
+ Age: string;
448
+ Conditions: JobCondition[];
449
+ Resumed: boolean;
450
+ Status: string;
451
+ Succeeded: number;
452
+ Parallelism: number;
453
+ Duration: string;
454
+ CreatedAt: string;
455
+ Labels: Record<string, string>;
456
+ Annotations: Record<string, string>;
457
+ ManagedFields: ManagedField[];
458
+ Selector: string;
459
+ CompletionMode: string;
460
+ StartTime: string;
461
+ StartTimeAge: string;
462
+ CompletedAt: string;
463
+ CompletedAtAge: string;
464
+ PodsStatuses: string;
465
+ PodStatus: string;
466
+ }
467
+ interface JobSummary {
468
+ Succeeded: number;
469
+ Failed: number;
470
+ Pending: number;
471
+ }
472
+
473
+ interface Lease {
474
+ Name: string;
475
+ Namespace: string;
476
+ HolderIdentity: string;
477
+ LeaseDurationSeconds: number;
478
+ RenewTime: string;
479
+ AcquireTime: string;
480
+ LeaseTransitions: number;
481
+ Age: string;
482
+ CreatedAt: string;
483
+ Labels: Record<string, string>;
484
+ Annotations: Record<string, string>;
485
+ ManagedFields: ManagedField[];
486
+ }
487
+
488
+ interface LimitRange {
489
+ Name: string;
490
+ Namespace: string;
491
+ Age: string;
492
+ }
493
+ interface LimitRangeDetail {
494
+ Name: string;
495
+ Namespace: string;
496
+ Age: string;
497
+ CreatedAt: string;
498
+ Labels: Record<string, string>;
499
+ Annotations: Record<string, string>;
500
+ Limits: Record<string, Record<string, Record<string, string>>>;
501
+ }
502
+
503
+ interface SharedNamespaceContext {
504
+ Name: string;
505
+ }
506
+ interface Namespace extends SharedNamespaceContext {
507
+ Labels: Record<string, string>;
508
+ Annotations: Record<string, string>;
509
+ Age: string;
510
+ CreatedAt: string;
511
+ Status: string;
512
+ ManagedFields: ManagedField[];
513
+ ResourceQuotas: string[];
514
+ LimitRanges: string[];
515
+ }
516
+
517
+ interface NetworkPolicy {
518
+ Name: string;
519
+ Namespace: string;
520
+ PolicyTypes: string;
521
+ Age: string;
522
+ }
523
+ interface NetworkPolicyDetail {
524
+ Name: string;
525
+ Namespace: string;
526
+ CreatedAt: string;
527
+ Labels: Record<string, string>;
528
+ Annotations: Record<string, string>;
529
+ ManagedFields: ManagedField[];
530
+ PodSelector: Record<string, string>;
531
+ IngressRules: NetworkPolicyIngressRule[];
532
+ EgressRules: NetworkPolicyEgressRule[];
533
+ }
534
+ interface NetworkPolicyIngressRule {
535
+ Ports: string[];
536
+ From: NetworkPolicyPeer[];
537
+ }
538
+ interface NetworkPolicyEgressRule {
539
+ Ports: string[];
540
+ To: NetworkPolicyPeer[];
541
+ }
542
+ interface NetworkPolicyPeer {
543
+ PodSelector: Record<string, string>;
544
+ NamespaceSelector: Record<string, string>;
545
+ IPBlock: string;
546
+ }
547
+
548
+ interface NodeAddress {
549
+ Type: string;
550
+ Address: string;
551
+ }
552
+ interface NodeCondition {
553
+ Type: string;
554
+ Status: string;
555
+ Reason: string;
556
+ Message: string;
557
+ LastHeartbeatTime: string;
558
+ LastTransitionTime: string;
559
+ }
560
+ interface Node {
561
+ Name: string;
562
+ Roles: string;
563
+ Version: string;
564
+ Age: string;
565
+ Taints: number;
566
+ Unschedulable: boolean;
567
+ CPU: string;
568
+ CPUPercent: number;
569
+ Memory: string;
570
+ MemPercent: number;
571
+ Disk: string;
572
+ DiskPercent: number;
573
+ CreatedAt: string;
574
+ Labels: Record<string, string>;
575
+ Annotations: Record<string, string>;
576
+ ManagedFields: ManagedField[];
577
+ Addresses: NodeAddress[];
578
+ OS: string;
579
+ OSImage: string;
580
+ KernelVersion: string;
581
+ ContainerRuntime: string;
582
+ Conditions: NodeCondition[];
583
+ Capacity: Record<string, string>;
584
+ Allocatable: Record<string, string>;
585
+ }
586
+
587
+ interface PodDisruptionBudget {
588
+ Name: string;
589
+ Namespace: string;
590
+ MinAvailable: string;
591
+ MaxUnavailable: string;
592
+ CurrentHealthy: number;
593
+ DesiredHealthy: number;
594
+ Age: string;
595
+ }
596
+ interface PodDisruptionBudgetDetail {
597
+ Name: string;
598
+ Namespace: string;
599
+ MinAvailable: string;
600
+ MaxUnavailable: string;
601
+ CurrentHealthy: number;
602
+ DesiredHealthy: number;
603
+ Age: string;
604
+ CreatedAt: string;
605
+ Labels: Record<string, string>;
606
+ Annotations: Record<string, string>;
607
+ Selector: Record<string, string>;
608
+ }
609
+
610
+ interface PortForward {
611
+ ID: string;
612
+ Name: string;
613
+ Namespace: string;
614
+ Kind: string;
615
+ PodPort: string;
616
+ TargetPort: string;
617
+ ServicePort: string;
618
+ LocalPort: string;
619
+ Scheme: string;
620
+ Protocol: string;
621
+ Address: string;
622
+ Status: string;
623
+ }
624
+
625
+ interface PriorityClass {
626
+ Name: string;
627
+ Value: number;
628
+ GlobalDefault: boolean;
629
+ Description: string;
630
+ PreemptionPolicy: string;
631
+ Age: string;
632
+ CreatedAt: string;
633
+ ManagedFields: ManagedField[];
634
+ }
635
+
636
+ interface PersistentVolume {
637
+ Name: string;
638
+ StorageClass: string;
639
+ Capacity: string;
640
+ Claim: string;
641
+ Age: string;
642
+ Status: string;
643
+ }
644
+ interface PersistentVolumeDetail {
645
+ Name: string;
646
+ Capacity: string;
647
+ AccessModes: string[];
648
+ ReclaimPolicy: string;
649
+ Status: string;
650
+ StorageClass: string;
651
+ Claim: string;
652
+ VolumeMode: string;
653
+ MountOptions: string[];
654
+ NodeAffinitySummary: string;
655
+ Age: string;
656
+ CreatedAt: string;
657
+ Labels: Record<string, string>;
658
+ Annotations: Record<string, string>;
659
+ }
660
+
661
+ interface PersistentVolumeClaim {
662
+ Name: string;
663
+ Namespace: string;
664
+ StorageClass: string;
665
+ Size: string;
666
+ Pods: string;
667
+ Age: string;
668
+ Status: string;
669
+ }
670
+ interface PersistentVolumeClaimDetail {
671
+ Name: string;
672
+ Namespace: string;
673
+ StorageClass: string;
674
+ Size: string;
675
+ Pods: string[];
676
+ Age: string;
677
+ CreatedAt: string;
678
+ Status: string;
679
+ Labels: Record<string, string>;
680
+ Annotations: Record<string, string>;
681
+ Finalizers: string[];
682
+ AccessModes: string[];
683
+ MatchLabels: Record<string, string>;
684
+ MatchExprs: string[];
685
+ }
686
+
687
+ interface ReplicaSet {
688
+ Name: string;
689
+ Namespace: string;
690
+ Desired: number;
691
+ Current: number;
692
+ Ready: number;
693
+ Age: string;
694
+ OwnerName: string;
695
+ CreatedAt: string;
696
+ OwnerKind: string;
697
+ Labels: Record<string, string>;
698
+ Annotations: Record<string, string>;
699
+ ManagedFields: ManagedField[];
700
+ Selector: string;
701
+ NodeSelector: string;
702
+ Images: string[];
703
+ ReplicasDetail: string;
704
+ Tolerations: number;
705
+ Affinities: number;
706
+ PodStatus: string;
707
+ }
708
+ interface ReplicaSetSummary {
709
+ Running: number;
710
+ Pending: number;
711
+ }
712
+
713
+ interface ResourceQuota {
714
+ Name: string;
715
+ Namespace: string;
716
+ Age: string;
717
+ }
718
+ interface ResourceQuotaDetail {
719
+ Name: string;
720
+ Namespace: string;
721
+ Age: string;
722
+ CreatedAt: string;
723
+ Labels: Record<string, string>;
724
+ Annotations: Record<string, string>;
725
+ Hard: Record<string, string>;
726
+ Used: Record<string, string>;
727
+ }
728
+
729
+ interface Role {
730
+ Name: string;
731
+ Namespace: string;
732
+ Age: string;
733
+ CreatedAt: string;
734
+ Labels: Record<string, string>;
735
+ Annotations: Record<string, string>;
736
+ ManagedFields: ManagedField[];
737
+ Rules: PolicyRule[];
738
+ }
739
+
740
+ interface RBSubject {
741
+ Kind: string;
742
+ Name: string;
743
+ Namespace: string;
744
+ }
745
+ interface RoleBinding {
746
+ Name: string;
747
+ Namespace: string;
748
+ Bindings: string;
749
+ Age: string;
750
+ RoleRefName: string;
751
+ Types: string;
752
+ CreatedAt: string;
753
+ Labels: Record<string, string>;
754
+ Annotations: Record<string, string>;
755
+ ManagedFields: ManagedField[];
756
+ RoleRefKind: string;
757
+ RoleRefGroup: string;
758
+ Subjects: RBSubject[];
759
+ }
760
+
761
+ interface Secret {
762
+ Name: string;
763
+ Namespace: string;
764
+ Labels: string[];
765
+ Keys: string[];
766
+ Type: string;
767
+ Age: string;
768
+ }
769
+ interface SecretDetail {
770
+ Name: string;
771
+ Namespace: string;
772
+ Type: string;
773
+ Age: string;
774
+ CreatedAt: string;
775
+ Labels: Record<string, string>;
776
+ Annotations: Record<string, string>;
777
+ Data: Record<string, string>;
778
+ }
779
+
780
+ interface ServicePort {
781
+ Name: string;
782
+ Port: number;
783
+ TargetPort: string;
784
+ Protocol: string;
785
+ NodePort: number;
786
+ }
787
+ interface Service {
788
+ Name: string;
789
+ Namespace: string;
790
+ Type: string;
791
+ ClusterIP: string;
792
+ Ports: string;
793
+ ExternalIP: string;
794
+ Selector: string;
795
+ Age: string;
796
+ Status: string;
797
+ CreatedAt: string;
798
+ Labels: Record<string, string>;
799
+ Annotations: Record<string, string>;
800
+ ManagedFields: ManagedField[];
801
+ SessionAffinity: string;
802
+ InternalTrafficPolicy: string;
803
+ ClusterIPs: string[];
804
+ IPFamilyPolicy: string;
805
+ IPFamilies: string[];
806
+ ServicePorts: ServicePort[];
807
+ }
808
+
809
+ interface ServiceAccount {
810
+ Name: string;
811
+ Namespace: string;
812
+ Age: string;
813
+ CreatedAt: string;
814
+ Secrets: string[];
815
+ }
816
+
817
+ interface StatefulSet {
818
+ Name: string;
819
+ Namespace: string;
820
+ Pods: string;
821
+ Replicas: number;
822
+ Age: string;
823
+ CreatedAt: string;
824
+ Labels: Record<string, string>;
825
+ Annotations: Record<string, string>;
826
+ ManagedFields: ManagedField[];
827
+ Selector: string;
828
+ Images: string[];
829
+ Affinities: number;
830
+ PodStatus: string;
831
+ }
832
+ interface StatefulSetSummary {
833
+ Running: number;
834
+ Pending: number;
835
+ }
836
+
837
+ interface StorageClass {
838
+ Name: string;
839
+ Provisioner: string;
840
+ ReclaimPolicy: string;
841
+ Default: boolean;
842
+ Age: string;
843
+ CreatedAt: string;
844
+ Labels: Record<string, string>;
845
+ Annotations: Record<string, string>;
846
+ ManagedFields: ManagedField[];
847
+ VolumeBindingMode: string;
848
+ MountOptions: string[];
849
+ Parameters: Record<string, string>;
850
+ }
851
+
852
+ interface ValidatingWebhookConfig {
853
+ Name: string;
854
+ Webhooks: number;
855
+ Age: string;
856
+ }
857
+ interface ValidatingWebhookConfigDetail {
858
+ Name: string;
859
+ APIVersion: string;
860
+ CreatedAt: string;
861
+ Labels: Record<string, string>;
862
+ Annotations: Record<string, string>;
863
+ Webhooks: WebhookDetail[];
864
+ }
865
+ interface WebhookDetail {
866
+ Name: string;
867
+ ClientConfigServiceName: string;
868
+ ClientConfigServiceNamespace: string;
869
+ MatchPolicy: string;
870
+ FailurePolicy: string;
871
+ AdmissionReviewVersions: string[];
872
+ SideEffects: string;
873
+ TimeoutSeconds: number;
874
+ NamespaceSelectorExpressions: string;
875
+ ObjectSelectorExpressions: string;
876
+ RulesAPIGroups: string[];
877
+ RulesAPIVersions: string[];
878
+ RulesOperations: string[];
879
+ RulesResources: string[];
880
+ RulesScope: string;
881
+ }
882
+
883
+ type UnifiedTrayCoreFamily = "modification" | "pod";
884
+ type UnifiedTrayAllFamily = UnifiedTrayCoreFamily | (string & {});
885
+ interface SharedUnifiedTrayOpenParams {
886
+ label: string;
887
+ icon?: ReactNode;
888
+ dedupeKey: string;
889
+ [key: string]: unknown;
890
+ }
891
+ interface SharedUnifiedTrayTab {
892
+ family: string;
893
+ id: string;
894
+ label: string;
895
+ icon?: ReactNode;
896
+ params: Record<string, unknown>;
897
+ }
898
+ interface SharedUnifiedTrayContentProps {
899
+ tab: SharedUnifiedTrayTab;
900
+ collapsed: boolean;
901
+ onClose: () => void;
902
+ }
903
+ interface SharedUnifiedTrayContext {
904
+ openTab: (family: UnifiedTrayAllFamily, params: any) => void;
905
+ }
906
+
907
+ /**
908
+ * @litelens/core — React hooks for litelens plugin development
909
+ *
910
+ * This package exports hooks that plugin frontends can consume. The implementations
911
+ * are provided by the host at runtime via import injection.
912
+ */
913
+ /**
914
+ * Hook to access cluster-scoped APIs exposed to plugins. Returns a collection
915
+ * of capabilities valid only within the single-cluster view — i.e. inside
916
+ * MainLayout's subtree (MainLayoutProvider → DetailDrawerProvider). Calling
917
+ * this from a component rendered outside that subtree (e.g. Settings,
918
+ * Marketplace, or any future app-wide screen) will throw, because the
919
+ * underlying host state (DetailDrawerContext) has no provider there. A future
920
+ * useAppWideAPI() will cover capabilities that don't have this constraint.
921
+ *
922
+ * Example:
923
+ * const { activeContext, activeNamespaces, activeResource, availableNamespaces, onNavigateToView, resourceLinks, unifiedTray, useRegisterClusterWideEvents, useRegisterNavEntry, useRegisterTrayFamilies } = useClusterWideAPI();
924
+ * resourceLinks.pod(namespace, podName); // Opens pod detail drawer
925
+ * unifiedTray.openTab("my-plugin-family", { pluginId: "my-plugin", label: "...", dedupeKey: "..." });
926
+ * useRegisterClusterWideEvents({
927
+ * "helm:release-updated": (payload) => { console.log("Release updated:", payload); },
928
+ * });
929
+ * useRegisterNavEntry("helm", "Helm", HELM_NAV_ENTRY);
930
+ * useRegisterTrayFamilies("helm", HELM_TRAY_FAMILIES);
931
+ *
932
+ * This signature is duplicated from the host's real implementation at
933
+ * frontend/src/expose/hooks/useClusterWideAPI.ts (which this package can't
934
+ * import directly — see main.tsx's vendor injection). If that hook's return
935
+ * type changes, update this signature to match.
936
+ */
937
+ declare function useClusterWideAPI(): {
938
+ activeContext: string;
939
+ activeNamespaces: string[];
940
+ activeResource: string;
941
+ availableNamespaces: Array<{
942
+ Name: string;
943
+ }>;
944
+ onNavigateToView: (view: string) => void;
945
+ resourceLinks: Record<string, (namespace: string, name: string) => void>;
946
+ unifiedTray: {
947
+ openTab: (family: string, params: unknown) => void;
948
+ } | null;
949
+ useRegisterClusterWideEvents: (handlers: Record<string, (payload: unknown) => void>) => void;
950
+ useRegisterNavEntry: (pluginId: string, pluginName: string, navEntry: NavEntry<string> | undefined) => void;
951
+ useRegisterTrayFamilies: (pluginId: string, families: Record<string, ComponentType<SharedUnifiedTrayContentProps>> | undefined) => void;
952
+ };
953
+
954
+ export { type CRBSubject, type ClusterRole, type ClusterRoleBinding, type ConfigMap, type CronJob, type CronJobSummary, type DaemonSet, type DaemonSetSummary, type Deployment, type DeploymentCondition, type DeploymentSummary, type Endpoint, type EndpointAddress, type EndpointPort, type EndpointSlice, type EndpointSliceEndpoint, type EndpointSlicePort, type EndpointSubset, type Event, type HPA, type HPADetail, type HPAMetric, type Ingress, type IngressClass, type IngressDetail, type IngressPath, type IngressRule, type Job, type JobCondition, type JobSummary, type Lease, type LimitRange, type LimitRangeDetail, type ManagedField, type Namespace, type NavEntry, type NavGroup, type NavItem, type NetworkPolicy, type NetworkPolicyDetail, type NetworkPolicyEgressRule, type NetworkPolicyIngressRule, type NetworkPolicyPeer, type Node, type NodeAddress, type NodeCondition, type PersistentVolume, type PersistentVolumeClaim, type PersistentVolumeClaimDetail, type PersistentVolumeDetail, type Pod, type PodCondition, type PodContainerDetail, type PodContainerLastStatus, type PodContainerMount, type PodContainerPort, type PodDisruptionBudget, type PodDisruptionBudgetDetail, type PodSummary, type PodVolume, type PodVolumeSource, type PolicyRule, type PortForward, type PriorityClass, type RBSubject, type ReplicaSet, type ReplicaSetSummary, type ResourceQuota, type ResourceQuotaDetail, type Role, type RoleBinding, type ScaleTargetRef, type Secret, type SecretDetail, type Service, type ServiceAccount, type ServicePort, type SharedNamespaceContext, type SharedUnifiedTrayContentProps, type SharedUnifiedTrayContext, type SharedUnifiedTrayOpenParams, type SharedUnifiedTrayTab, type StatefulSet, type StatefulSetSummary, type StorageClass, type TolerationDetail, type UnifiedTrayAllFamily, type UnifiedTrayCoreFamily, type UseQueryCallback, type ValidatingWebhookConfig, type ValidatingWebhookConfigDetail, type WebhookDetail, useClusterWideAPI };
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ // src/index.ts
2
+ function useClusterWideAPI() {
3
+ throw new Error(
4
+ "useClusterWideAPI is not available. This hook must be imported from '@litelens/core' within a plugin bundle loaded by the litelens host."
5
+ );
6
+ }
7
+
8
+ export { useClusterWideAPI };
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@litelens/core",
3
+ "version": "1.0.0",
4
+ "description": "React hooks and utilities for litelens plugin development",
5
+ "private": false,
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/litelensapp/litelens.git",
9
+ "directory": "packages/core/frontend"
10
+ },
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "type": "module",
15
+ "main": "./dist/index.js",
16
+ "files": [
17
+ "dist",
18
+ "README.md"
19
+ ],
20
+ "exports": {
21
+ ".": {
22
+ "import": "./dist/index.js"
23
+ }
24
+ },
25
+ "scripts": {
26
+ "build": "tsup",
27
+ "test": "vitest run",
28
+ "test:watch": "vitest",
29
+ "test:coverage": "vitest run --coverage"
30
+ },
31
+ "peerDependencies": {
32
+ "react": "^19.0.0",
33
+ "react-dom": "^19.0.0"
34
+ },
35
+ "devDependencies": {
36
+ "@types/node": "catalog:",
37
+ "@types/react": "catalog:",
38
+ "@types/react-dom": "catalog:",
39
+ "@vitejs/plugin-react": "catalog:",
40
+ "@vitest/coverage-v8": "catalog:",
41
+ "jsdom": "catalog:",
42
+ "tsup": "^8.5.1",
43
+ "typescript": "catalog:",
44
+ "vitest": "catalog:"
45
+ }
46
+ }