diff --git a/package.json b/package.json index b7507cf0ad..9cf989ca96 100644 --- a/package.json +++ b/package.json @@ -188,8 +188,8 @@ "@kubernetes/client-node": "^0.15.1", "@sentry/electron": "^2.5.4", "@sentry/integrations": "^6.15.0", - "@ogre-tools/injectable": "^1.1.0", - "@ogre-tools/injectable-react": "^1.2.0", + "@ogre-tools/injectable": "^1.2.1", + "@ogre-tools/injectable-react": "^1.2.1", "abort-controller": "^3.0.0", "auto-bind": "^4.0.0", "autobind-decorator": "^2.4.0", diff --git a/types/ogre-tools-injectable-react.d.ts b/types/ogre-tools-injectable-react.d.ts deleted file mode 100644 index 27e3fdbdfa..0000000000 --- a/types/ogre-tools-injectable-react.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright (c) 2021 OpenLens Authors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -/// -declare module "@ogre-tools/injectable-react" { - import type { DependencyInjectionContainer, Injectable } from "@ogre-tools/injectable"; - - interface DependencyInjectionContainerProviderProps { - di: DependencyInjectionContainer; - } - - export const DiContextProvider: React.Provider; - - export const Inject: < - TComponentInjectable extends Injectable, - >({ - Component, - injectableKey, - getPlaceholder, - ...props - }: Parameters[1] & { - injectableKey: TComponentInjectable; - getPlaceholder?: () => JSX.Element | null; - }) => JSX.Element; -} diff --git a/types/ogre-tools-injectable.d.ts b/types/ogre-tools-injectable.d.ts deleted file mode 100644 index f8d6a27ebf..0000000000 --- a/types/ogre-tools-injectable.d.ts +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Copyright (c) 2021 OpenLens Authors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -declare module "@ogre-tools/injectable" { - type Awaited = TMaybePromise extends PromiseLike - ? TValue - : TMaybePromise; - - export interface DependencyInjectionContainer { - inject: < - TInjectable extends Injectable, - TInstance, - TDependencies, - TMaybePromiseInstance = ReturnType, - >( - injectableKey: TInjectable, - ) => TMaybePromiseInstance extends PromiseLike - ? Awaited - : TMaybePromiseInstance; - } - - export interface ConfigurableDependencyInjectionContainer - extends DependencyInjectionContainer { - register: (injectable: Injectable) => void; - preventSideEffects: () => void; - - override: , TInstance>( - injectable: TInjectable, - overrider: - | ReturnType - | jest.MockInstance< - ReturnType, - ReturnType - >, - ) => void; - } - - export interface Injectable< - TInstance, - TDependencies extends object = {}, - TInstantiationParameter extends object = {}, - > { - id?: string; - - getDependencies: ( - di?: DependencyInjectionContainer, - ) => TDependencies | Promise; - - lifecycle?: lifecycleEnum; - - instantiate: ( - dependencies: TDependencies, - instantiationParameter: TInstantiationParameter, - ) => Promise | TInstance; - - causesSideEffects?: boolean; - } - - export enum lifecycleEnum { - singleton, - transient, - scopedTransient, - } - - // eslint-disable-next-line unused-imports/no-unused-vars-ts - export const createContainer = (...getRequireContexts: any[]) => - ConfigurableDependencyInjectionContainer; -} diff --git a/yarn.lock b/yarn.lock index b2f1e93d8f..4be6fb2c11 100644 --- a/yarn.lock +++ b/yarn.lock @@ -953,19 +953,19 @@ dependencies: lodash "^4.17.21" -"@ogre-tools/injectable-react@^1.2.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@ogre-tools/injectable-react/-/injectable-react-1.2.0.tgz#1634f702bf017f934d06e4332505c2c4aa0d87d6" - integrity sha512-T4GEuK0HBIHgE5B2WoibDaeQvhn1jgwwsR1K6fy5sYkNnU5Qa4LlciCuxHU7j7dKy6cDVwNWQVg/OXocb0h0lA== +"@ogre-tools/injectable-react@^1.2.1": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@ogre-tools/injectable-react/-/injectable-react-1.2.1.tgz#886fbb9f9816d68daf41b6fd7ff5def6eae833b4" + integrity sha512-kr9Q2T/VyhtUG8EbfzpFPk2ndwKQl9WHzqEfp8fasAXMNmUfUnyWs6iPNoJiuy2gh4/CNBvlFB8c647ls6/jUA== dependencies: "@ogre-tools/fp" "^1.0.2" - "@ogre-tools/injectable" "^1.1.0" + "@ogre-tools/injectable" "^1.2.1" lodash "^4.17.21" -"@ogre-tools/injectable@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@ogre-tools/injectable/-/injectable-1.1.0.tgz#095c9d12001d03dd96c98d8986392b0fee05262c" - integrity sha512-ViuFC2iHM86os87W2qubUCAlPYzdxmZwtPBAExb2SLNMHk8Z8dRx9BGDk8AcfCd8aPUw5GHIgf7wxCAMWcyvlw== +"@ogre-tools/injectable@^1.2.1": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@ogre-tools/injectable/-/injectable-1.2.1.tgz#f3eb481806dd6e53af8d9d37f8b20f3c0d875a60" + integrity sha512-bfTlnT08uDydE0i5GxJ9SIoRKfNYVabQRrZfBraZi2rs3zx+DOpcZrJjhjDoSCzIr6C2azySuyxn1h8x8CMUPw== dependencies: "@ogre-tools/fp" "^1.0.2" lodash "^4.17.21"