Revert breaking change to KubeObjectStore constructor

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton committed 2022-07-06 11:57:16 -04:00
1 parent fb4dca8e58
commit 4d408e6e30
1 file changed
+12 -3
+12 -3
View File
@@ -90,7 +90,7 @@ export abstract class KubeObjectStore<
> extends ItemStore<K> { > extends ItemStore<K> {
static readonly defaultContext = observable.box<ClusterContext>(); // TODO: support multiple cluster contexts static readonly defaultContext = observable.box<ClusterContext>(); // TODO: support multiple cluster contexts
public readonly api: A; public readonly api!: A;
public readonly limit: number | undefined; public readonly limit: number | undefined;
public readonly bufferSize: number; public readonly bufferSize: number;
@observable private loadedNamespaces: string[] | undefined = undefined; @observable private loadedNamespaces: string[] | undefined = undefined;
@@ -103,9 +103,18 @@ export abstract class KubeObjectStore<
return when(() => Boolean(this.loadedNamespaces)); return when(() => Boolean(this.loadedNamespaces));
} }
constructor(api: A, opts?: KubeObjectStoreOptions) { constructor(api: A, opts?: KubeObjectStoreOptions);
/**
* @deprecated Supply API instance through constructor
*/
constructor();
constructor(api?: A, opts?: KubeObjectStoreOptions) {
super(); super();
this.api = api;
if (api) {
this.api = api;
}
this.limit = opts?.limit; this.limit = opts?.limit;
this.bufferSize = opts?.bufferSize ?? 50_000; this.bufferSize = opts?.bufferSize ?? 50_000;