mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Use abort-controller package to fix typing issues (#6077)
This commit is contained in:
parent
e7d9614700
commit
436aa3dcda
@ -225,6 +225,7 @@
|
|||||||
"@sentry/integrations": "^6.19.3",
|
"@sentry/integrations": "^6.19.3",
|
||||||
"@side/jest-runtime": "^1.0.1",
|
"@side/jest-runtime": "^1.0.1",
|
||||||
"@types/circular-dependency-plugin": "5.0.5",
|
"@types/circular-dependency-plugin": "5.0.5",
|
||||||
|
"abort-controller": "^3.0.0",
|
||||||
"auto-bind": "^4.0.0",
|
"auto-bind": "^4.0.0",
|
||||||
"await-lock": "^2.2.2",
|
"await-lock": "^2.2.2",
|
||||||
"byline": "^5.0.0",
|
"byline": "^5.0.0",
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import { DeploymentApi, Ingress, IngressApi, Pod, PodApi } from "../endpoints";
|
|||||||
import { getDiForUnitTesting } from "../../../renderer/getDiForUnitTesting";
|
import { getDiForUnitTesting } from "../../../renderer/getDiForUnitTesting";
|
||||||
import apiManagerInjectable from "../api-manager/manager.injectable";
|
import apiManagerInjectable from "../api-manager/manager.injectable";
|
||||||
import autoRegistrationInjectable from "../api-manager/auto-registration.injectable";
|
import autoRegistrationInjectable from "../api-manager/auto-registration.injectable";
|
||||||
|
import { AbortController } from "abort-controller";
|
||||||
|
|
||||||
jest.mock("../api-manager");
|
jest.mock("../api-manager");
|
||||||
|
|
||||||
|
|||||||
@ -27,9 +27,7 @@ import type { PartialDeep } from "type-fest";
|
|||||||
import logger from "../logger";
|
import logger from "../logger";
|
||||||
import { Environments, getEnvironmentSpecificLegacyGlobalDiForExtensionApi } from "../../extensions/as-legacy-globals-for-extension-api/legacy-global-di-for-extension-api";
|
import { Environments, getEnvironmentSpecificLegacyGlobalDiForExtensionApi } from "../../extensions/as-legacy-globals-for-extension-api/legacy-global-di-for-extension-api";
|
||||||
import autoRegistrationEmitterInjectable from "./api-manager/auto-registration-emitter.injectable";
|
import autoRegistrationEmitterInjectable from "./api-manager/auto-registration-emitter.injectable";
|
||||||
|
import type AbortController from "abort-controller";
|
||||||
// TODO: upgrade node-fetch once we are starting to use ES modules
|
|
||||||
type LegacyAbortSignal = NonNullable<RequestInit["signal"]>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The options used for creating a `KubeApi`
|
* The options used for creating a `KubeApi`
|
||||||
@ -719,7 +717,7 @@ export class KubeApi<
|
|||||||
const requestParams = timeout ? { query: { timeoutSeconds: timeout }} : {};
|
const requestParams = timeout ? { query: { timeoutSeconds: timeout }} : {};
|
||||||
const watchUrl = this.getWatchUrl(namespace);
|
const watchUrl = this.getWatchUrl(namespace);
|
||||||
const responsePromise = this.request.getResponse(watchUrl, requestParams, {
|
const responsePromise = this.request.getResponse(watchUrl, requestParams, {
|
||||||
signal: abortController.signal as LegacyAbortSignal,
|
signal: abortController.signal,
|
||||||
timeout: 600_000,
|
timeout: 600_000,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -20,9 +20,7 @@ import logger from "../logger";
|
|||||||
import assert from "assert";
|
import assert from "assert";
|
||||||
import type { PartialDeep } from "type-fest";
|
import type { PartialDeep } from "type-fest";
|
||||||
import { entries } from "../utils/objects";
|
import { entries } from "../utils/objects";
|
||||||
|
import { AbortController } from "abort-controller";
|
||||||
// TODO: upgrade node-fetch once we are starting to use ES modules
|
|
||||||
type LegacyAbortSignal = NonNullable<RequestInit["signal"]>;
|
|
||||||
|
|
||||||
export type OnLoadFailure = (error: unknown) => void;
|
export type OnLoadFailure = (error: unknown) => void;
|
||||||
|
|
||||||
@ -480,7 +478,7 @@ export abstract class KubeObjectStore<
|
|||||||
});
|
});
|
||||||
|
|
||||||
// TODO: upgrade node-fetch once we are starting to use ES modules
|
// TODO: upgrade node-fetch once we are starting to use ES modules
|
||||||
const signal = abortController.signal as LegacyAbortSignal;
|
const signal = abortController.signal;
|
||||||
|
|
||||||
const callback: KubeApiWatchCallback<D> = (data, error) => {
|
const callback: KubeApiWatchCallback<D> = (data, error) => {
|
||||||
if (!this.isLoaded || error?.type === "aborted") return;
|
if (!this.isLoaded || error?.type === "aborted") return;
|
||||||
|
|||||||
@ -3,6 +3,8 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { AbortController } from "abort-controller";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is like an `AbortController` but will also abort if the parent aborts,
|
* This is like an `AbortController` but will also abort if the parent aborts,
|
||||||
* but won't make the parent abort if this aborts (single direction)
|
* but won't make the parent abort if this aborts (single direction)
|
||||||
|
|||||||
@ -3,6 +3,8 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import type AbortController from "abort-controller";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a promise that will be resolved after at least `timeout` ms have
|
* Return a promise that will be resolved after at least `timeout` ms have
|
||||||
* passed. If `failFast` is provided then the promise is also resolved if it has
|
* passed. If `failFast` is provided then the promise is also resolved if it has
|
||||||
|
|||||||
@ -3,6 +3,8 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import type { AbortSignal } from "abort-controller";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new promise that will be rejected when the signal rejects.
|
* Creates a new promise that will be rejected when the signal rejects.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import type { ClusterFrameContext } from "../cluster-frame-context/cluster-frame
|
|||||||
import logger from "../../common/logger";
|
import logger from "../../common/logger";
|
||||||
import type { KubeObjectStoreLoadAllParams, KubeObjectStoreSubscribeParams } from "../../common/k8s-api/kube-object.store";
|
import type { KubeObjectStoreLoadAllParams, KubeObjectStoreSubscribeParams } from "../../common/k8s-api/kube-object.store";
|
||||||
import type { RequestInit } from "node-fetch";
|
import type { RequestInit } from "node-fetch";
|
||||||
|
import { AbortController } from "abort-controller";
|
||||||
|
|
||||||
// TODO: upgrade node-fetch once we are starting to use ES modules
|
// TODO: upgrade node-fetch once we are starting to use ES modules
|
||||||
type LegacyAbortSignal = NonNullable<RequestInit["signal"]>;
|
type LegacyAbortSignal = NonNullable<RequestInit["signal"]>;
|
||||||
|
|||||||
12
yarn.lock
12
yarn.lock
@ -2833,6 +2833,13 @@ abbrev@1, abbrev@~1.1.1:
|
|||||||
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8"
|
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8"
|
||||||
integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==
|
integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==
|
||||||
|
|
||||||
|
abort-controller@^3.0.0:
|
||||||
|
version "3.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392"
|
||||||
|
integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==
|
||||||
|
dependencies:
|
||||||
|
event-target-shim "^5.0.0"
|
||||||
|
|
||||||
accepts@~1.3.4, accepts@~1.3.5:
|
accepts@~1.3.4, accepts@~1.3.5:
|
||||||
version "1.3.7"
|
version "1.3.7"
|
||||||
resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.7.tgz#531bc726517a3b2b41f850021c6cc15eaab507cd"
|
resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.7.tgz#531bc726517a3b2b41f850021c6cc15eaab507cd"
|
||||||
@ -5911,6 +5918,11 @@ etag@~1.8.1:
|
|||||||
resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887"
|
resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887"
|
||||||
integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=
|
integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=
|
||||||
|
|
||||||
|
event-target-shim@^5.0.0:
|
||||||
|
version "5.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789"
|
||||||
|
integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==
|
||||||
|
|
||||||
eventemitter3@^4.0.0:
|
eventemitter3@^4.0.0:
|
||||||
version "4.0.7"
|
version "4.0.7"
|
||||||
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f"
|
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user