mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
# Backport This will backport the following commits from `main` to `8.x`: - [SKA: Categorise remaining packages (#205875)](https://github.com/elastic/kibana/pull/205875) <!--- Backport version: 8.9.8 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Gerard Soldevila","email":"gerard.soldevila@elastic.co"},"sourceCommit":{"committedDate":"2025-01-08T21:20:14Z","message":"SKA: Categorise remaining packages (#205875)\n\n## Summary\r\n\r\n* Delete unused package `@kbn/formatters`\r\n* Delete unused package `@kbn/response-ops-feature-flag-service`\r\n* Flag `@kbn/generate-console-definitions` as `devOnly: true`\r\n* Flag `@kbn/plugin-check` as `devOnly: true`\r\n* Flag `@kbn/set-map` as `devOnly: true`\r\n* Flag `@kbn/synthetics-private-location` as `devOnly: true`\r\n* Categorise `@kbn/calculate-auto` as `platform/shared`\r\n* Categorise `@kbn/charts-theme` as `platform/shared`\r\n* Categorise `@kbn/saved-search-component` as `platform/shared`\r\n* Categorise `@kbn/use-tracked-promise` as `platform/shared`\r\n* Categorise `@kbn/charts-theme` as `platform/shared`\r\n* Categorise `@kbn/response-ops-rule-form` as `platform/shared`","sha":"2be928c489601fac46ce1e5136ed9ecc63fd4e22","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","release_note:skip","v9.0.0","backport:prev-minor","Team:obs-ux-management"],"number":205875,"url":"https://github.com/elastic/kibana/pull/205875","mergeCommit":{"message":"SKA: Categorise remaining packages (#205875)\n\n## Summary\r\n\r\n* Delete unused package `@kbn/formatters`\r\n* Delete unused package `@kbn/response-ops-feature-flag-service`\r\n* Flag `@kbn/generate-console-definitions` as `devOnly: true`\r\n* Flag `@kbn/plugin-check` as `devOnly: true`\r\n* Flag `@kbn/set-map` as `devOnly: true`\r\n* Flag `@kbn/synthetics-private-location` as `devOnly: true`\r\n* Categorise `@kbn/calculate-auto` as `platform/shared`\r\n* Categorise `@kbn/charts-theme` as `platform/shared`\r\n* Categorise `@kbn/saved-search-component` as `platform/shared`\r\n* Categorise `@kbn/use-tracked-promise` as `platform/shared`\r\n* Categorise `@kbn/charts-theme` as `platform/shared`\r\n* Categorise `@kbn/response-ops-rule-form` as `platform/shared`","sha":"2be928c489601fac46ce1e5136ed9ecc63fd4e22"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/205875","number":205875,"mergeCommit":{"message":"SKA: Categorise remaining packages (#205875)\n\n## Summary\r\n\r\n* Delete unused package `@kbn/formatters`\r\n* Delete unused package `@kbn/response-ops-feature-flag-service`\r\n* Flag `@kbn/generate-console-definitions` as `devOnly: true`\r\n* Flag `@kbn/plugin-check` as `devOnly: true`\r\n* Flag `@kbn/set-map` as `devOnly: true`\r\n* Flag `@kbn/synthetics-private-location` as `devOnly: true`\r\n* Categorise `@kbn/calculate-auto` as `platform/shared`\r\n* Categorise `@kbn/charts-theme` as `platform/shared`\r\n* Categorise `@kbn/saved-search-component` as `platform/shared`\r\n* Categorise `@kbn/use-tracked-promise` as `platform/shared`\r\n* Categorise `@kbn/charts-theme` as `platform/shared`\r\n* Categorise `@kbn/response-ops-rule-form` as `platform/shared`","sha":"2be928c489601fac46ce1e5136ed9ecc63fd4e22"}}]}] BACKPORT-->
This commit is contained in:
parent
61aa939461
commit
935d2e1444
30 changed files with 29 additions and 277 deletions
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
|
@ -488,7 +488,6 @@ packages/kbn-find-used-node-modules @elastic/kibana-operations
|
|||
x-pack/platform/plugins/shared/fleet @elastic/fleet
|
||||
packages/kbn-flot-charts @elastic/kibana-operations
|
||||
x-pack/test/ui_capabilities/common/plugins/foo_plugin @elastic/kibana-security
|
||||
packages/kbn-formatters @elastic/obs-ux-logs-team
|
||||
src/platform/plugins/private/ftr_apis @elastic/kibana-core
|
||||
packages/kbn-ftr-common-functional-services @elastic/kibana-operations @elastic/appex-qa
|
||||
packages/kbn-ftr-common-functional-ui-services @elastic/appex-qa
|
||||
|
@ -748,7 +747,6 @@ src/platform/packages/private/kbn-reporting/server @elastic/appex-sharedux
|
|||
src/platform/packages/shared/kbn-resizable-layout @elastic/kibana-data-discovery
|
||||
examples/resizable_layout_examples @elastic/kibana-data-discovery
|
||||
x-pack/test/plugin_functional/plugins/resolver_test @elastic/security-solution
|
||||
packages/response-ops/feature_flag_service @elastic/response-ops
|
||||
packages/response-ops/rule_form @elastic/response-ops
|
||||
src/platform/packages/shared/response-ops/rule_params @elastic/response-ops
|
||||
examples/response_stream @elastic/ml-ui
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
"type": "plugin",
|
||||
"id": "@kbn/grid-example-plugin",
|
||||
"owner": "@elastic/kibana-presentation",
|
||||
"group": "platform",
|
||||
"visibility": "private",
|
||||
"description": "Temporary example app used to build out the new Dashboard layout system",
|
||||
"plugin": {
|
||||
"id": "gridExample",
|
||||
|
|
10
package.json
10
package.json
|
@ -539,11 +539,9 @@
|
|||
"@kbn/fleet-plugin": "link:x-pack/platform/plugins/shared/fleet",
|
||||
"@kbn/flot-charts": "link:packages/kbn-flot-charts",
|
||||
"@kbn/foo-plugin": "link:x-pack/test/ui_capabilities/common/plugins/foo_plugin",
|
||||
"@kbn/formatters": "link:packages/kbn-formatters",
|
||||
"@kbn/ftr-apis-plugin": "link:src/platform/plugins/private/ftr_apis",
|
||||
"@kbn/functional-with-es-ssl-cases-test-plugin": "link:x-pack/test/functional_with_es_ssl/plugins/cases",
|
||||
"@kbn/gen-ai-streaming-response-example-plugin": "link:x-pack/examples/gen_ai_streaming_response_example",
|
||||
"@kbn/generate-console-definitions": "link:packages/kbn-generate-console-definitions",
|
||||
"@kbn/generate-csv": "link:src/platform/packages/private/kbn-generate-csv",
|
||||
"@kbn/global-search-bar-plugin": "link:x-pack/platform/plugins/private/global_search_bar",
|
||||
"@kbn/global-search-plugin": "link:x-pack/platform/plugins/shared/global_search",
|
||||
|
@ -718,7 +716,6 @@
|
|||
"@kbn/paertial-results-example-plugin": "link:examples/partial_results_example",
|
||||
"@kbn/painless-lab-plugin": "link:x-pack/platform/plugins/private/painless_lab",
|
||||
"@kbn/panel-loader": "link:src/platform/packages/private/kbn-panel-loader",
|
||||
"@kbn/plugin-check": "link:packages/kbn-plugin-check",
|
||||
"@kbn/portable-dashboards-example": "link:examples/portable_dashboards_example",
|
||||
"@kbn/preboot-example-plugin": "link:examples/preboot_example",
|
||||
"@kbn/presentation-containers": "link:src/platform/packages/shared/presentation/presentation_containers",
|
||||
|
@ -760,7 +757,6 @@
|
|||
"@kbn/resizable-layout": "link:src/platform/packages/shared/kbn-resizable-layout",
|
||||
"@kbn/resizable-layout-examples-plugin": "link:examples/resizable_layout_examples",
|
||||
"@kbn/resolver-test-plugin": "link:x-pack/test/plugin_functional/plugins/resolver_test",
|
||||
"@kbn/response-ops-feature-flag-service": "link:packages/response-ops/feature_flag_service",
|
||||
"@kbn/response-ops-rule-form": "link:packages/response-ops/rule_form",
|
||||
"@kbn/response-ops-rule-params": "link:src/platform/packages/shared/response-ops/rule_params",
|
||||
"@kbn/response-stream-plugin": "link:examples/response_stream",
|
||||
|
@ -873,7 +869,6 @@
|
|||
"@kbn/serverless-types": "link:packages/serverless/types",
|
||||
"@kbn/session-notifications-plugin": "link:test/plugin_functional/plugins/session_notifications",
|
||||
"@kbn/session-view-plugin": "link:x-pack/solutions/security/plugins/session_view",
|
||||
"@kbn/set-map": "link:packages/kbn-set-map",
|
||||
"@kbn/share-examples-plugin": "link:examples/share_examples",
|
||||
"@kbn/share-plugin": "link:src/platform/plugins/shared/share",
|
||||
"@kbn/shared-svg": "link:src/platform/packages/shared/kbn-shared-svg",
|
||||
|
@ -947,7 +942,6 @@
|
|||
"@kbn/streams-plugin": "link:x-pack/solutions/observability/plugins/streams",
|
||||
"@kbn/streams-schema": "link:x-pack/packages/kbn-streams-schema",
|
||||
"@kbn/synthetics-plugin": "link:x-pack/solutions/observability/plugins/synthetics",
|
||||
"@kbn/synthetics-private-location": "link:x-pack/packages/kbn-synthetics-private-location",
|
||||
"@kbn/task-manager-fixture-plugin": "link:x-pack/test/alerting_api_integration/common/plugins/task_manager_fixture",
|
||||
"@kbn/task-manager-performance-plugin": "link:x-pack/test/plugin_api_perf/plugins/task_manager_performance",
|
||||
"@kbn/task-manager-plugin": "link:x-pack/platform/plugins/shared/task_manager",
|
||||
|
@ -1463,6 +1457,7 @@
|
|||
"@kbn/ftr-screenshot-filename": "link:packages/kbn-ftr-screenshot-filename",
|
||||
"@kbn/gen-ai-functional-testing": "link:packages/kbn-gen-ai-functional-testing",
|
||||
"@kbn/generate": "link:packages/kbn-generate",
|
||||
"@kbn/generate-console-definitions": "link:packages/kbn-generate-console-definitions",
|
||||
"@kbn/get-repo-files": "link:packages/kbn-get-repo-files",
|
||||
"@kbn/import-locator": "link:packages/kbn-import-locator",
|
||||
"@kbn/import-resolver": "link:packages/kbn-import-resolver",
|
||||
|
@ -1488,6 +1483,7 @@
|
|||
"@kbn/peggy-loader": "link:packages/kbn-peggy-loader",
|
||||
"@kbn/performance-testing-dataset-extractor": "link:packages/kbn-performance-testing-dataset-extractor",
|
||||
"@kbn/picomatcher": "link:packages/kbn-picomatcher",
|
||||
"@kbn/plugin-check": "link:packages/kbn-plugin-check",
|
||||
"@kbn/plugin-generator": "link:packages/kbn-plugin-generator",
|
||||
"@kbn/plugin-helpers": "link:packages/kbn-plugin-helpers",
|
||||
"@kbn/product-doc-artifact-builder": "link:x-pack/packages/ai-infra/product-doc-artifact-builder",
|
||||
|
@ -1502,12 +1498,14 @@
|
|||
"@kbn/scout-reporting": "link:packages/kbn-scout-reporting",
|
||||
"@kbn/security-api-integration-helpers": "link:x-pack/test/security_api_integration/packages/helpers",
|
||||
"@kbn/serverless-storybook-config": "link:packages/serverless/storybook/config",
|
||||
"@kbn/set-map": "link:packages/kbn-set-map",
|
||||
"@kbn/some-dev-log": "link:packages/kbn-some-dev-log",
|
||||
"@kbn/sort-package-json": "link:packages/kbn-sort-package-json",
|
||||
"@kbn/spec-to-console": "link:packages/kbn-spec-to-console",
|
||||
"@kbn/stdio-dev-helpers": "link:packages/kbn-stdio-dev-helpers",
|
||||
"@kbn/storybook": "link:packages/kbn-storybook",
|
||||
"@kbn/synthetics-e2e": "link:x-pack/solutions/observability/plugins/synthetics/e2e",
|
||||
"@kbn/synthetics-private-location": "link:x-pack/packages/kbn-synthetics-private-location",
|
||||
"@kbn/telemetry-tools": "link:packages/kbn-telemetry-tools",
|
||||
"@kbn/test": "link:packages/kbn-test",
|
||||
"@kbn/test-eui-helpers": "link:packages/kbn-test-eui-helpers",
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
{
|
||||
"type": "shared-common",
|
||||
"id": "@kbn/calculate-auto",
|
||||
"owner": "@elastic/obs-ux-management-team"
|
||||
"owner": "@elastic/obs-ux-management-team",
|
||||
"group": "platform",
|
||||
"visibility": "shared"
|
||||
}
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
# @kbn/formatters
|
||||
|
||||
Utilities for formatting common fields and values.
|
|
@ -1,10 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the "Elastic License
|
||||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
export { formatBytes } from './src/bytes_formatter';
|
|
@ -1,14 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the "Elastic License
|
||||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
preset: '@kbn/test',
|
||||
rootDir: '../..',
|
||||
roots: ['<rootDir>/packages/kbn-formatters'],
|
||||
};
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"type": "shared-common",
|
||||
"id": "@kbn/formatters",
|
||||
"owner": "@elastic/obs-ux-logs-team"
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"name": "@kbn/formatters",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0"
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the "Elastic License
|
||||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
import { formatBytes } from '.';
|
||||
|
||||
describe('BytesFormatter', () => {
|
||||
it('should format bytes correctly', () => {
|
||||
const result = formatBytes(1000);
|
||||
expect(result).toBe('1000 Bytes');
|
||||
});
|
||||
|
||||
it('should format bytes correctly if 0 is sent', () => {
|
||||
const result = formatBytes(0);
|
||||
expect(result).toBe('0 Bytes');
|
||||
});
|
||||
|
||||
it('should format bytes correctly into KB', () => {
|
||||
const result = formatBytes(10000);
|
||||
expect(result).toBe('10 KB');
|
||||
});
|
||||
|
||||
it('should format bytes correctly into MB', () => {
|
||||
const result = formatBytes(1048576);
|
||||
expect(result).toBe('1 MB');
|
||||
});
|
||||
|
||||
it('should format bytes correctly with decimals', () => {
|
||||
const result = formatBytes(10000, 3);
|
||||
expect(result).toBe('9.766 KB');
|
||||
});
|
||||
});
|
|
@ -1,20 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the "Elastic License
|
||||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
export const formatBytes = (bytes: number, decimals = 0) => {
|
||||
if (bytes === 0) return '0 Bytes';
|
||||
|
||||
const k = 1024;
|
||||
const dm = decimals < 0 ? 0 : decimals;
|
||||
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
||||
|
||||
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
||||
|
||||
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
|
||||
};
|
|
@ -1,17 +0,0 @@
|
|||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "target/types",
|
||||
"types": [
|
||||
"jest",
|
||||
"node",
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
],
|
||||
"exclude": [
|
||||
"target/**/*"
|
||||
],
|
||||
"kbn_references": []
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"type": "shared-common",
|
||||
"id": "@kbn/generate-console-definitions",
|
||||
"owner": "@elastic/kibana-management"
|
||||
"owner": "@elastic/kibana-management",
|
||||
"devOnly": true
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
{
|
||||
"type": "shared-browser",
|
||||
"id": "@kbn/grid-layout",
|
||||
"owner": "@elastic/kibana-presentation"
|
||||
"owner": "@elastic/kibana-presentation",
|
||||
"group": "platform",
|
||||
"visibility": "private"
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"type": "shared-server",
|
||||
"id": "@kbn/plugin-check",
|
||||
"owner": "@elastic/appex-sharedux"
|
||||
"owner": "@elastic/appex-sharedux",
|
||||
"devOnly": true
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
{
|
||||
"type": "shared-browser",
|
||||
"id": "@kbn/saved-search-component",
|
||||
"owner": "@elastic/obs-ux-logs-team"
|
||||
"owner": "@elastic/obs-ux-logs-team",
|
||||
"group": "platform",
|
||||
"visibility": "shared"
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"type": "shared-common",
|
||||
"id": "@kbn/set-map",
|
||||
"owner": "@elastic/kibana-operations"
|
||||
"owner": "@elastic/kibana-operations",
|
||||
"devOnly": true
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
{
|
||||
"type": "shared-common",
|
||||
"id": "@kbn/use-tracked-promise",
|
||||
"owner": "@elastic/obs-ux-logs-team"
|
||||
"owner": "@elastic/obs-ux-logs-team",
|
||||
"group": "platform",
|
||||
"visibility": "shared"
|
||||
}
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
# @kbn/response-ops-feature-flags
|
||||
|
||||
This packages exposes a feature flag service that is used in the ResponseOps plugins and packages to handle feature flags.
|
||||
|
||||
## Usage
|
||||
|
||||
### Create feature flag service
|
||||
|
||||
```
|
||||
const featureFlagService = createFeatureFlagService(['test.myFeature', 'test.myFeature.subFeature']); // TS will infer the types automatically
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```
|
||||
type FeatureFlagValues = 'test.myFeature' | 'test.myOtherFeature'
|
||||
const featureFlagService = createFeatureFlagService<FeatureFlagValues>(['test.myFeature']);
|
||||
```
|
||||
|
||||
### Checking the existence of a feature flag
|
||||
```
|
||||
const featureFlagService = createFeatureFlagService(['test.myFeature', 'test.myFeature.subFeature']);
|
||||
|
||||
if (featureFlagService.isFeatureFlagSet('test.myFeature')) {
|
||||
// my feature code
|
||||
}
|
||||
```
|
|
@ -1,30 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the "Elastic License
|
||||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
import { createFeatureFlagService } from './feature_flag_service';
|
||||
|
||||
type FeatureFlagValues = 'test.myFeature' | 'test.myOtherFeature';
|
||||
|
||||
describe('FeatureFlagService', () => {
|
||||
it('returns true if the feature exists', () => {
|
||||
const featureFlagService = createFeatureFlagService(['test.myFeature']);
|
||||
expect(featureFlagService.isFeatureFlagSet('test.myFeature')).toBe(true);
|
||||
});
|
||||
|
||||
it('returns false if the feature does not exist', () => {
|
||||
const featureFlagService = createFeatureFlagService(['test.myFeature']);
|
||||
// @ts-expect-error: foo is not part of the valid feature flags
|
||||
expect(featureFlagService.isFeatureFlagSet('foo')).toBe(false);
|
||||
});
|
||||
|
||||
it('returns true if the feature exists (as typed)', () => {
|
||||
const featureFlagService = createFeatureFlagService<FeatureFlagValues>(['test.myFeature']);
|
||||
expect(featureFlagService.isFeatureFlagSet('test.myFeature')).toBe(true);
|
||||
});
|
||||
});
|
|
@ -1,26 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the "Elastic License
|
||||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
class FeatureFlag<T extends string = string> {
|
||||
private readonly featureFlags = new Set<T>();
|
||||
|
||||
constructor(featureFlags: T[]) {
|
||||
featureFlags.forEach((featureFlag) => this.featureFlags.add(featureFlag));
|
||||
}
|
||||
|
||||
public isFeatureFlagSet(featureFlag: T): boolean {
|
||||
return this.featureFlags.has(featureFlag);
|
||||
}
|
||||
}
|
||||
|
||||
export const createFeatureFlagService = <T extends string>(featureFlags: T[]) => {
|
||||
return new FeatureFlag<(typeof featureFlags)[number]>(featureFlags);
|
||||
};
|
||||
|
||||
export type FeatureFlagService<T extends string = string> = InstanceType<typeof FeatureFlag<T>>;
|
|
@ -1,11 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the "Elastic License
|
||||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
export { createFeatureFlagService } from './feature_flag_service';
|
||||
export type { FeatureFlagService } from './feature_flag_service';
|
|
@ -1,14 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the "Elastic License
|
||||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
||||
* Public License v 1"; you may not use this file except in compliance with, at
|
||||
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
preset: '@kbn/test/jest_node',
|
||||
rootDir: '../../..',
|
||||
roots: ['<rootDir>/packages/response-ops/feature_flag_service'],
|
||||
};
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"type": "shared-common",
|
||||
"id": "@kbn/response-ops-feature-flag-service",
|
||||
"owner": "@elastic/response-ops"
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"name": "@kbn/response-ops-feature-flag-service",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0"
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
{
|
||||
"extends": "../../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "target/types",
|
||||
"types": [
|
||||
"jest",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
],
|
||||
"exclude": [
|
||||
"target/**/*"
|
||||
],
|
||||
"kbn_references": []
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
{
|
||||
"type": "shared-browser",
|
||||
"id": "@kbn/response-ops-rule-form",
|
||||
"owner": "@elastic/response-ops"
|
||||
"owner": "@elastic/response-ops",
|
||||
"group": "platform",
|
||||
"visibility": "shared"
|
||||
}
|
||||
|
|
|
@ -970,8 +970,6 @@
|
|||
"@kbn/flot-charts/*": ["packages/kbn-flot-charts/*"],
|
||||
"@kbn/foo-plugin": ["x-pack/test/ui_capabilities/common/plugins/foo_plugin"],
|
||||
"@kbn/foo-plugin/*": ["x-pack/test/ui_capabilities/common/plugins/foo_plugin/*"],
|
||||
"@kbn/formatters": ["packages/kbn-formatters"],
|
||||
"@kbn/formatters/*": ["packages/kbn-formatters/*"],
|
||||
"@kbn/ftr-apis-plugin": ["src/platform/plugins/private/ftr_apis"],
|
||||
"@kbn/ftr-apis-plugin/*": ["src/platform/plugins/private/ftr_apis/*"],
|
||||
"@kbn/ftr-common-functional-services": ["packages/kbn-ftr-common-functional-services"],
|
||||
|
@ -1490,8 +1488,6 @@
|
|||
"@kbn/resizable-layout-examples-plugin/*": ["examples/resizable_layout_examples/*"],
|
||||
"@kbn/resolver-test-plugin": ["x-pack/test/plugin_functional/plugins/resolver_test"],
|
||||
"@kbn/resolver-test-plugin/*": ["x-pack/test/plugin_functional/plugins/resolver_test/*"],
|
||||
"@kbn/response-ops-feature-flag-service": ["packages/response-ops/feature_flag_service"],
|
||||
"@kbn/response-ops-feature-flag-service/*": ["packages/response-ops/feature_flag_service/*"],
|
||||
"@kbn/response-ops-rule-form": ["packages/response-ops/rule_form"],
|
||||
"@kbn/response-ops-rule-form/*": ["packages/response-ops/rule_form/*"],
|
||||
"@kbn/response-ops-rule-params": ["src/platform/packages/shared/response-ops/rule_params"],
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"type": "shared-common",
|
||||
"id": "@kbn/synthetics-private-location",
|
||||
"owner": "@elastic/obs-ux-management-team"
|
||||
"owner": "@elastic/obs-ux-management-team",
|
||||
"devOnly": true
|
||||
}
|
||||
|
|
|
@ -5792,10 +5792,6 @@
|
|||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/formatters@link:packages/kbn-formatters":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/ftr-apis-plugin@link:src/platform/plugins/private/ftr_apis":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
@ -6832,10 +6828,6 @@
|
|||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/response-ops-feature-flag-service@link:packages/response-ops/feature_flag_service":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/response-ops-rule-form@link:packages/response-ops/rule_form":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue