config-loader: API report warnings cleanup
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -7,30 +7,31 @@ import { AppConfig } from '@backstage/config';
|
||||
import { JsonObject } from '@backstage/config';
|
||||
import { JSONSchema7 } from 'json-schema';
|
||||
|
||||
// Warning: (ae-missing-release-tag) "ConfigSchema" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public
|
||||
export type ConfigSchema = {
|
||||
process(
|
||||
appConfigs: AppConfig[],
|
||||
options?: ConfigProcessingOptions,
|
||||
options?: ConfigSchemaProcessingOptions,
|
||||
): AppConfig[];
|
||||
serialize(): JsonObject;
|
||||
};
|
||||
|
||||
// Warning: (ae-forgotten-export) The symbol "CONFIG_VISIBILITIES" needs to be exported by the entry point index.d.ts
|
||||
// Warning: (ae-missing-release-tag) "ConfigVisibility" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public
|
||||
export type ConfigVisibility = typeof CONFIG_VISIBILITIES[number];
|
||||
export type ConfigSchemaProcessingOptions = {
|
||||
visibility?: ConfigVisibility[];
|
||||
valueTransform?: TransformFunc<any>;
|
||||
withFilteredKeys?: boolean;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type ConfigVisibility = 'frontend' | 'backend' | 'secret';
|
||||
|
||||
// Warning: (ae-missing-release-tag) "loadConfig" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export type EnvFunc = (name: string) => Promise<string | undefined>;
|
||||
|
||||
// @public
|
||||
export function loadConfig(options: LoadConfigOptions): Promise<AppConfig[]>;
|
||||
|
||||
// Warning: (ae-missing-release-tag) "LoadConfigOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export type LoadConfigOptions = {
|
||||
configRoot: string;
|
||||
@@ -43,28 +44,35 @@ export type LoadConfigOptions = {
|
||||
};
|
||||
};
|
||||
|
||||
// Warning: (ae-forgotten-export) The symbol "Options" needs to be exported by the entry point index.d.ts
|
||||
// Warning: (ae-missing-release-tag) "loadConfigSchema" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public
|
||||
export function loadConfigSchema(options: Options): Promise<ConfigSchema>;
|
||||
export function loadConfigSchema(
|
||||
options: LoadConfigSchemaOptions,
|
||||
): Promise<ConfigSchema>;
|
||||
|
||||
// @public (undocumented)
|
||||
export type LoadConfigSchemaOptions =
|
||||
| {
|
||||
dependencies: string[];
|
||||
}
|
||||
| {
|
||||
serialized: JsonObject;
|
||||
};
|
||||
|
||||
// Warning: (ae-missing-release-tag) "mergeConfigSchemas" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public
|
||||
export function mergeConfigSchemas(schemas: JSONSchema7[]): JSONSchema7;
|
||||
|
||||
// Warning: (ae-missing-release-tag) "readEnvConfig" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public
|
||||
export function readEnvConfig(env: {
|
||||
[name: string]: string | undefined;
|
||||
}): AppConfig[];
|
||||
|
||||
// Warnings were encountered during analysis:
|
||||
//
|
||||
// src/lib/schema/types.d.ts:83:5 - (ae-forgotten-export) The symbol "ConfigProcessingOptions" needs to be exported by the entry point index.d.ts
|
||||
// src/loader.d.ts:13:5 - (ae-forgotten-export) The symbol "EnvFunc" needs to be exported by the entry point index.d.ts
|
||||
// @public
|
||||
export type TransformFunc<T extends number | string | boolean> = (
|
||||
value: T,
|
||||
context: {
|
||||
visibility: ConfigVisibility;
|
||||
},
|
||||
) => T | undefined;
|
||||
|
||||
// (No @packageDocumentation comment for this package)
|
||||
```
|
||||
|
||||
@@ -15,6 +15,13 @@
|
||||
*/
|
||||
|
||||
export { readEnvConfig, loadConfigSchema, mergeConfigSchemas } from './lib';
|
||||
export type { ConfigSchema, ConfigVisibility } from './lib';
|
||||
export type {
|
||||
ConfigSchema,
|
||||
ConfigSchemaProcessingOptions,
|
||||
ConfigVisibility,
|
||||
EnvFunc,
|
||||
LoadConfigSchemaOptions,
|
||||
TransformFunc,
|
||||
} from './lib';
|
||||
export { loadConfig } from './loader';
|
||||
export type { LoadConfigOptions } from './loader';
|
||||
|
||||
@@ -38,6 +38,8 @@ const CONFIG_KEY_PART_PATTERN = /^[a-z][a-z0-9]*(?:[-_][a-z][a-z0-9]*)*$/i;
|
||||
* For example, to set the config app.title to "My Title", use the following:
|
||||
*
|
||||
* APP_CONFIG_app_title='"My Title"'
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export function readEnvConfig(env: {
|
||||
[name: string]: string | undefined;
|
||||
|
||||
@@ -108,6 +108,8 @@ export function compileConfigSchemas(
|
||||
/**
|
||||
* Given a list of configuration schemas from packages, merge them
|
||||
* into a single json schema.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export function mergeConfigSchemas(schemas: JSONSchema[]): JSONSchema {
|
||||
const merged = mergeAllOf(
|
||||
|
||||
@@ -16,4 +16,10 @@
|
||||
|
||||
export { mergeConfigSchemas } from './compile';
|
||||
export { loadConfigSchema } from './load';
|
||||
export type { ConfigSchema, ConfigVisibility } from './types';
|
||||
export type { LoadConfigSchemaOptions } from './load';
|
||||
export type {
|
||||
ConfigSchema,
|
||||
ConfigVisibility,
|
||||
ConfigSchemaProcessingOptions,
|
||||
TransformFunc,
|
||||
} from './types';
|
||||
|
||||
@@ -24,7 +24,8 @@ import {
|
||||
CONFIG_VISIBILITIES,
|
||||
} from './types';
|
||||
|
||||
type Options =
|
||||
/** @public */
|
||||
export type LoadConfigSchemaOptions =
|
||||
| {
|
||||
dependencies: string[];
|
||||
}
|
||||
@@ -34,9 +35,11 @@ type Options =
|
||||
|
||||
/**
|
||||
* Loads config schema for a Backstage instance.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export async function loadConfigSchema(
|
||||
options: Options,
|
||||
options: LoadConfigSchemaOptions,
|
||||
): Promise<ConfigSchema> {
|
||||
let schemas: ConfigSchemaPackageEntry[];
|
||||
|
||||
|
||||
@@ -37,8 +37,10 @@ export const CONFIG_VISIBILITIES = ['frontend', 'backend', 'secret'] as const;
|
||||
|
||||
/**
|
||||
* A type representing the possible configuration value visibilities
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type ConfigVisibility = typeof CONFIG_VISIBILITIES[number];
|
||||
export type ConfigVisibility = 'frontend' | 'backend' | 'secret';
|
||||
|
||||
/**
|
||||
* The default configuration visibility if no other values is given.
|
||||
@@ -73,6 +75,8 @@ export type ValidationFunc = (configs: AppConfig[]) => ValidationResult;
|
||||
|
||||
/**
|
||||
* A function used to transform primitive configuration values.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type TransformFunc<T extends number | string | boolean> = (
|
||||
value: T,
|
||||
@@ -81,8 +85,10 @@ export type TransformFunc<T extends number | string | boolean> = (
|
||||
|
||||
/**
|
||||
* Options used to process configuration data with a schema.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
type ConfigProcessingOptions = {
|
||||
export type ConfigSchemaProcessingOptions = {
|
||||
/**
|
||||
* The visibilities that should be included in the output data.
|
||||
* If omitted, the data will not be filtered by visibility.
|
||||
@@ -107,11 +113,13 @@ type ConfigProcessingOptions = {
|
||||
|
||||
/**
|
||||
* A loaded configuration schema that is ready to process configuration data.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type ConfigSchema = {
|
||||
process(
|
||||
appConfigs: AppConfig[],
|
||||
options?: ConfigProcessingOptions,
|
||||
options?: ConfigSchemaProcessingOptions,
|
||||
): AppConfig[];
|
||||
|
||||
serialize(): JsonObject;
|
||||
|
||||
@@ -17,3 +17,4 @@
|
||||
export { applyConfigTransforms } from './apply';
|
||||
export { createIncludeTransform } from './include';
|
||||
export { createSubstitutionTransform } from './substitution';
|
||||
export type { EnvFunc } from './types';
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
import { JsonValue } from '@backstage/config';
|
||||
|
||||
/** @public */
|
||||
export type EnvFunc = (name: string) => Promise<string | undefined>;
|
||||
|
||||
export type ReadFileFunc = (path: string) => Promise<string>;
|
||||
|
||||
@@ -27,6 +27,7 @@ import {
|
||||
} from './lib';
|
||||
import { EnvFunc } from './lib/transform/types';
|
||||
|
||||
/** @public */
|
||||
export type LoadConfigOptions = {
|
||||
// The root directory of the config loading context. Used to find default configs.
|
||||
configRoot: string;
|
||||
@@ -60,6 +61,11 @@ export type LoadConfigOptions = {
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Load configuration data.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export async function loadConfig(
|
||||
options: LoadConfigOptions,
|
||||
): Promise<AppConfig[]> {
|
||||
|
||||
Reference in New Issue
Block a user