chore: extract @k8slens/random

Signed-off-by: Gabriel <gaccettola@mirantis.com>
This commit is contained in:
Gabriel authored and Gabriel Accettola committed 2023-06-01 11:36:30 +02:00
1 parent 847f2b1b7b
commit 86fa93ac8b
30 files changed
+137 -20

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
import { getFeature } from "@k8slens/feature-core";
import { autoRegister } from "@ogre-tools/injectable-extension-for-auto-registration";
export const randomFeature = getFeature({
id: "random-feature",
register: (di) => {
autoRegister({
di,
targetModule: module,
getRequireContexts: () => [require.context("./", true, /\.injectable\.(ts|tsx)$/)],
});
},
});
@@ -0,0 +1,12 @@
/**
* 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 { v4 as getRandomId } from "uuid";
export const getRandomIdInjectable = getInjectable({
id: "get-random-id",
instantiate: () => () => getRandomId(),
causesSideEffects: true,
});