mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
* Change type of RequestHelmChartValues to be AsyncResult Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Fixing tests Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Linter fix Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
26 lines
955 B
TypeScript
26 lines
955 B
TypeScript
/**
|
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
|
*/
|
|
import { getInjectable } from "@ogre-tools/injectable";
|
|
import type { AsyncResult } from "../../../utils/async-result";
|
|
import { urlBuilderFor } from "../../../utils/buildUrl";
|
|
import { apiBaseInjectionToken } from "../../api-base";
|
|
|
|
const requestValuesEndpoint = urlBuilderFor("/v2/charts/:repo/:name/values");
|
|
|
|
export type RequestHelmChartValues = (repo: string, name: string, version: string) => Promise<AsyncResult<string>>;
|
|
|
|
const requestHelmChartValuesInjectable = getInjectable({
|
|
id: "request-helm-chart-values",
|
|
instantiate: (di): RequestHelmChartValues => {
|
|
const apiBase = di.inject(apiBaseInjectionToken);
|
|
|
|
return (repo, name, version) => (
|
|
apiBase.get(requestValuesEndpoint.compile({ repo, name }, { version }))
|
|
);
|
|
},
|
|
});
|
|
|
|
export default requestHelmChartValuesInjectable;
|