frontend-plugin-api: remove ConfigFieldSchema and fix API report warnings
Remove the `ConfigFieldSchema` and `ConfigSchemaRecord` types that are no longer needed now that `configSchema` and `config.schema` each accept only one form. The deprecated overloads now constrain directly to the factory signature `(zImpl: typeof z) => z.ZodType`. Also fix pre-existing API report warnings by promoting `ResolvedExtensionInputs`, `RequiredExtensionIds`, `VerifyExtensionFactoryOutput`, and `VerifyExtensionAttachTo` to `@public` and exporting them from both entry points. Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com> Made-with: Cursor
This commit is contained in:
@@ -15,8 +15,7 @@ import { JsonObject } from '@backstage/types';
|
||||
import { JSX as JSX_2 } from 'react';
|
||||
import { ReactNode } from 'react';
|
||||
import { StandardSchemaV1 } from '@standard-schema/spec';
|
||||
import { z } from 'zod/v3';
|
||||
import { ZodType } from 'zod/v3';
|
||||
import type { z } from 'zod/v3';
|
||||
|
||||
// @public
|
||||
export type AnyRouteRefParams =
|
||||
@@ -86,12 +85,6 @@ export interface AppTree {
|
||||
readonly root: AppNode;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type ConfigFieldSchema = StandardSchemaV1 | ConfigFieldSchemaFactory;
|
||||
|
||||
// @public @deprecated
|
||||
export type ConfigFieldSchemaFactory = (zImpl: typeof z) => ZodType;
|
||||
|
||||
// @public (undocumented)
|
||||
export interface ConfigurableExtensionDataRef<
|
||||
TData,
|
||||
@@ -170,9 +163,6 @@ export interface ExtensionBlueprint<
|
||||
}>;
|
||||
makeWithOverrides<
|
||||
TName extends string | undefined,
|
||||
TExtensionConfigSchema extends {
|
||||
[key in string]: ConfigFieldSchema;
|
||||
},
|
||||
UFactoryOutput extends ExtensionDataValue<any, any>,
|
||||
UNewOutput extends ExtensionDataRef,
|
||||
UParentInputs extends ExtensionDataRef,
|
||||
@@ -198,10 +188,92 @@ export interface ExtensionBlueprint<
|
||||
string}' is already defined in parent definition`;
|
||||
};
|
||||
output?: Array<UNewOutput>;
|
||||
config?: never;
|
||||
configSchema?: TNewExtensionConfigSchema & {
|
||||
[KName in keyof T['config']]?: `Error: Config key '${KName &
|
||||
string}' is already defined in parent schema`;
|
||||
};
|
||||
factory(
|
||||
originalFactory: <
|
||||
TParamsInput extends AnyParamsInput<NonNullable<T['params']>>,
|
||||
>(
|
||||
params: TParamsInput extends ExtensionBlueprintDefineParams
|
||||
? TParamsInput
|
||||
: T['params'] extends ExtensionBlueprintDefineParams
|
||||
? 'Error: This blueprint uses advanced parameter types and requires you to pass parameters as using the following callback syntax: `originalFactory(defineParams => defineParams(<params>))`'
|
||||
: T['params'],
|
||||
context?: {
|
||||
config?: T['config'];
|
||||
inputs?: ResolvedInputValueOverrides<NonNullable<T['inputs']>>;
|
||||
},
|
||||
) => ExtensionDataContainer<NonNullable<T['output']>>,
|
||||
context: {
|
||||
node: AppNode;
|
||||
apis: ApiHolder;
|
||||
config: T['config'] & {
|
||||
[key in keyof TNewExtensionConfigSchema]: NonNullable<
|
||||
TNewExtensionConfigSchema[key]['~standard']['types']
|
||||
>['output'];
|
||||
};
|
||||
inputs: Expand<ResolvedExtensionInputs<T['inputs'] & TExtraInputs>>;
|
||||
},
|
||||
): Iterable<UFactoryOutput> &
|
||||
VerifyExtensionFactoryOutput<
|
||||
ExtensionDataRef extends UNewOutput
|
||||
? NonNullable<T['output']>
|
||||
: UNewOutput,
|
||||
UFactoryOutput
|
||||
>;
|
||||
}): OverridableExtensionDefinition<{
|
||||
config: Expand<
|
||||
{
|
||||
[key in keyof TNewExtensionConfigSchema]: NonNullable<
|
||||
TNewExtensionConfigSchema[key]['~standard']['types']
|
||||
>['output'];
|
||||
} & T['config']
|
||||
>;
|
||||
configInput: Expand<
|
||||
{
|
||||
[key in keyof TNewExtensionConfigSchema]?: NonNullable<
|
||||
TNewExtensionConfigSchema[key]['~standard']['types']
|
||||
>['input'];
|
||||
} & T['configInput']
|
||||
>;
|
||||
output: ExtensionDataRef extends UNewOutput ? T['output'] : UNewOutput;
|
||||
inputs: Expand<T['inputs'] & TExtraInputs>;
|
||||
kind: T['kind'];
|
||||
name: string | undefined extends TName ? undefined : TName;
|
||||
params: T['params'];
|
||||
}>;
|
||||
// @deprecated (undocumented)
|
||||
makeWithOverrides<
|
||||
TName extends string | undefined,
|
||||
TExtensionConfigSchema extends {
|
||||
[key in string]: (zImpl: typeof z) => z.ZodType;
|
||||
},
|
||||
UFactoryOutput extends ExtensionDataValue<any, any>,
|
||||
UNewOutput extends ExtensionDataRef,
|
||||
UParentInputs extends ExtensionDataRef,
|
||||
TExtraInputs extends {
|
||||
[inputName in string]: ExtensionInput;
|
||||
} = {},
|
||||
>(args: {
|
||||
name?: TName;
|
||||
attachTo?: ExtensionDefinitionAttachTo<UParentInputs> &
|
||||
VerifyExtensionAttachTo<
|
||||
ExtensionDataRef extends UNewOutput
|
||||
? NonNullable<T['output']>
|
||||
: UNewOutput,
|
||||
UParentInputs
|
||||
>;
|
||||
disabled?: boolean;
|
||||
if?: FilterPredicate;
|
||||
inputs?: TExtraInputs & {
|
||||
[KName in keyof T['inputs']]?: `Error: Input '${KName &
|
||||
string}' is already defined in parent definition`;
|
||||
};
|
||||
output?: Array<UNewOutput>;
|
||||
configSchema?: never;
|
||||
config?: {
|
||||
schema: TExtensionConfigSchema & {
|
||||
[KName in keyof T['config']]?: `Error: Config key '${KName &
|
||||
@@ -226,10 +298,6 @@ export interface ExtensionBlueprint<
|
||||
node: AppNode;
|
||||
apis: ApiHolder;
|
||||
config: T['config'] & {
|
||||
[key in keyof TNewExtensionConfigSchema]: NonNullable<
|
||||
TNewExtensionConfigSchema[key]['~standard']['types']
|
||||
>['output'];
|
||||
} & {
|
||||
[key in keyof TExtensionConfigSchema]: z.infer<
|
||||
ReturnType<((...args: any[]) => any) & TExtensionConfigSchema[key]>
|
||||
>;
|
||||
@@ -245,11 +313,7 @@ export interface ExtensionBlueprint<
|
||||
>;
|
||||
}): OverridableExtensionDefinition<{
|
||||
config: Expand<
|
||||
{
|
||||
[key in keyof TNewExtensionConfigSchema]: NonNullable<
|
||||
TNewExtensionConfigSchema[key]['~standard']['types']
|
||||
>['output'];
|
||||
} & (string extends keyof TExtensionConfigSchema
|
||||
(string extends keyof TExtensionConfigSchema
|
||||
? {}
|
||||
: {
|
||||
[key in keyof TExtensionConfigSchema]: z.infer<
|
||||
@@ -261,11 +325,7 @@ export interface ExtensionBlueprint<
|
||||
T['config']
|
||||
>;
|
||||
configInput: Expand<
|
||||
{
|
||||
[key in keyof TNewExtensionConfigSchema]?: NonNullable<
|
||||
TNewExtensionConfigSchema[key]['~standard']['types']
|
||||
>['input'];
|
||||
} & (string extends keyof TExtensionConfigSchema
|
||||
(string extends keyof TExtensionConfigSchema
|
||||
? {}
|
||||
: z.input<
|
||||
z.ZodObject<{
|
||||
@@ -501,9 +561,6 @@ export interface OverridableExtensionDefinition<
|
||||
};
|
||||
// (undocumented)
|
||||
override<
|
||||
TExtensionConfigSchema extends {
|
||||
[key in string]: ConfigFieldSchema;
|
||||
},
|
||||
UFactoryOutput extends ExtensionDataValue<any, any>,
|
||||
UNewOutput extends ExtensionDataRef,
|
||||
TExtraInputs extends {
|
||||
@@ -531,10 +588,105 @@ export interface OverridableExtensionDefinition<
|
||||
string}' is already defined in parent definition`;
|
||||
};
|
||||
output?: Array<UNewOutput>;
|
||||
config?: never;
|
||||
configSchema?: TNewExtensionConfigSchema & {
|
||||
[KName in keyof T['config']]?: `Error: Config key '${KName &
|
||||
string}' is already defined in parent schema`;
|
||||
};
|
||||
factory?(
|
||||
originalFactory: <
|
||||
TFactoryParamsReturn extends AnyParamsInput_2<
|
||||
NonNullable<T['params']>
|
||||
>,
|
||||
>(
|
||||
context?: Expand<
|
||||
{
|
||||
config?: T['config'];
|
||||
inputs?: ResolvedInputValueOverrides<NonNullable<T['inputs']>>;
|
||||
} & ([T['params']] extends [never]
|
||||
? {}
|
||||
: {
|
||||
params?: TFactoryParamsReturn extends ExtensionBlueprintDefineParams
|
||||
? TFactoryParamsReturn
|
||||
: T['params'] extends ExtensionBlueprintDefineParams
|
||||
? 'Error: This blueprint uses advanced parameter types and requires you to pass parameters as using the following callback syntax: `originalFactory(defineParams => defineParams(<params>))`'
|
||||
: Partial<T['params']>;
|
||||
})
|
||||
>,
|
||||
) => ExtensionDataContainer<NonNullable<T['output']>>,
|
||||
context: {
|
||||
node: AppNode;
|
||||
apis: ApiHolder;
|
||||
config: T['config'] & {
|
||||
[key in keyof TNewExtensionConfigSchema]: NonNullable<
|
||||
TNewExtensionConfigSchema[key]['~standard']['types']
|
||||
>['output'];
|
||||
};
|
||||
inputs: Expand<ResolvedExtensionInputs<T['inputs'] & TExtraInputs>>;
|
||||
},
|
||||
): Iterable<UFactoryOutput>;
|
||||
} & ([T['params']] extends [never]
|
||||
? {}
|
||||
: {
|
||||
params?: TParamsInput extends ExtensionBlueprintDefineParams
|
||||
? TParamsInput
|
||||
: T['params'] extends ExtensionBlueprintDefineParams
|
||||
? 'Error: This blueprint uses advanced parameter types and requires you to pass parameters as using the following callback syntax: `originalFactory(defineParams => defineParams(<params>))`'
|
||||
: Partial<T['params']>;
|
||||
})
|
||||
> &
|
||||
VerifyExtensionFactoryOutput<
|
||||
ExtensionDataRef extends UNewOutput
|
||||
? NonNullable<T['output']>
|
||||
: UNewOutput,
|
||||
UFactoryOutput
|
||||
>,
|
||||
): OverridableExtensionDefinition<{
|
||||
kind: T['kind'];
|
||||
name: T['name'];
|
||||
output: ExtensionDataRef extends UNewOutput ? T['output'] : UNewOutput;
|
||||
inputs: T['inputs'] & TExtraInputs;
|
||||
config: T['config'] & {
|
||||
[key in keyof TNewExtensionConfigSchema]: NonNullable<
|
||||
TNewExtensionConfigSchema[key]['~standard']['types']
|
||||
>['output'];
|
||||
};
|
||||
configInput: T['configInput'] & {
|
||||
[key in keyof TNewExtensionConfigSchema]?: NonNullable<
|
||||
TNewExtensionConfigSchema[key]['~standard']['types']
|
||||
>['input'];
|
||||
};
|
||||
}>;
|
||||
// @deprecated (undocumented)
|
||||
override<
|
||||
TExtensionConfigSchema extends {
|
||||
[key in string]: (zImpl: typeof z) => z.ZodType;
|
||||
},
|
||||
UFactoryOutput extends ExtensionDataValue<any, any>,
|
||||
UNewOutput extends ExtensionDataRef,
|
||||
TExtraInputs extends {
|
||||
[inputName in string]: ExtensionInput;
|
||||
},
|
||||
TParamsInput extends AnyParamsInput_2<NonNullable<T['params']>>,
|
||||
UParentInputs extends ExtensionDataRef,
|
||||
>(
|
||||
args: Expand<
|
||||
{
|
||||
attachTo?: ExtensionDefinitionAttachTo<UParentInputs> &
|
||||
VerifyExtensionAttachTo<
|
||||
ExtensionDataRef extends UNewOutput
|
||||
? NonNullable<T['output']>
|
||||
: UNewOutput,
|
||||
UParentInputs
|
||||
>;
|
||||
disabled?: boolean;
|
||||
if?: FilterPredicate;
|
||||
inputs?: TExtraInputs & {
|
||||
[KName in keyof T['inputs']]?: `Error: Input '${KName &
|
||||
string}' is already defined in parent definition`;
|
||||
};
|
||||
output?: Array<UNewOutput>;
|
||||
configSchema?: never;
|
||||
config?: {
|
||||
schema: TExtensionConfigSchema & {
|
||||
[KName in keyof T['config']]?: `Error: Config key '${KName &
|
||||
@@ -566,10 +718,6 @@ export interface OverridableExtensionDefinition<
|
||||
node: AppNode;
|
||||
apis: ApiHolder;
|
||||
config: T['config'] & {
|
||||
[key in keyof TNewExtensionConfigSchema]: NonNullable<
|
||||
TNewExtensionConfigSchema[key]['~standard']['types']
|
||||
>['output'];
|
||||
} & {
|
||||
[key in keyof TExtensionConfigSchema]: z.infer<
|
||||
ReturnType<
|
||||
((...args: any[]) => any) & TExtensionConfigSchema[key]
|
||||
@@ -601,19 +749,12 @@ export interface OverridableExtensionDefinition<
|
||||
output: ExtensionDataRef extends UNewOutput ? T['output'] : UNewOutput;
|
||||
inputs: T['inputs'] & TExtraInputs;
|
||||
config: T['config'] & {
|
||||
[key in keyof TNewExtensionConfigSchema]: NonNullable<
|
||||
TNewExtensionConfigSchema[key]['~standard']['types']
|
||||
>['output'];
|
||||
} & {
|
||||
[key in keyof TExtensionConfigSchema]: z.infer<
|
||||
ReturnType<((...args: any[]) => any) & TExtensionConfigSchema[key]>
|
||||
>;
|
||||
};
|
||||
configInput: T['configInput'] & {
|
||||
[key in keyof TNewExtensionConfigSchema]?: NonNullable<
|
||||
TNewExtensionConfigSchema[key]['~standard']['types']
|
||||
>['input'];
|
||||
} & z.input<
|
||||
configInput: T['configInput'] &
|
||||
z.input<
|
||||
z.ZodObject<{
|
||||
[key in keyof TExtensionConfigSchema]: ReturnType<
|
||||
((...args: any[]) => any) & TExtensionConfigSchema[key]
|
||||
@@ -683,6 +824,27 @@ export type PortableSchema<TOutput, TInput = TOutput> = {
|
||||
schema: JsonObject;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type RequiredExtensionIds<UExtensionData extends ExtensionDataRef> =
|
||||
UExtensionData extends any
|
||||
? UExtensionData['config']['optional'] extends true
|
||||
? never
|
||||
: UExtensionData['id']
|
||||
: never;
|
||||
|
||||
// @public
|
||||
export type ResolvedExtensionInputs<
|
||||
TInputs extends {
|
||||
[name in string]: ExtensionInput;
|
||||
},
|
||||
> = {
|
||||
[InputName in keyof TInputs]: false extends TInputs[InputName]['config']['singleton']
|
||||
? Array<Expand<ResolvedExtensionInput<TInputs[InputName]>>>
|
||||
: false extends TInputs[InputName]['config']['optional']
|
||||
? Expand<ResolvedExtensionInput<TInputs[InputName]>>
|
||||
: Expand<ResolvedExtensionInput<TInputs[InputName]> | undefined>;
|
||||
};
|
||||
|
||||
// @public
|
||||
export interface RouteRef<
|
||||
TParams extends AnyRouteRefParams = AnyRouteRefParams,
|
||||
@@ -707,8 +869,31 @@ export interface SubRouteRef<
|
||||
readonly T: TParams;
|
||||
}
|
||||
|
||||
// @public @deprecated
|
||||
export function zodField<T extends ZodType>(factory: (zImpl: typeof z) => T): T;
|
||||
// @public (undocumented)
|
||||
export type VerifyExtensionAttachTo<
|
||||
UOutput extends ExtensionDataRef,
|
||||
UParentInput extends ExtensionDataRef,
|
||||
> = ExtensionDataRef extends UParentInput
|
||||
? {}
|
||||
: [RequiredExtensionIds<UParentInput>] extends [RequiredExtensionIds<UOutput>]
|
||||
? {}
|
||||
: `Error: This parent extension input requires the following extension data, but it is not declared as guaranteed output of this extension: ${JoinStringUnion<
|
||||
Exclude<RequiredExtensionIds<UParentInput>, RequiredExtensionIds<UOutput>>
|
||||
>}`;
|
||||
|
||||
// @public (undocumented)
|
||||
export type VerifyExtensionFactoryOutput<
|
||||
UDeclaredOutput extends ExtensionDataRef,
|
||||
UFactoryOutput extends ExtensionDataValue<any, any>,
|
||||
> = [RequiredExtensionIds<UDeclaredOutput>] extends [UFactoryOutput['id']]
|
||||
? [UFactoryOutput['id']] extends [UDeclaredOutput['id']]
|
||||
? {}
|
||||
: `Error: The extension factory has undeclared output(s): ${JoinStringUnion<
|
||||
Exclude<UFactoryOutput['id'], UDeclaredOutput['id']>
|
||||
>}`
|
||||
: `Error: The extension factory is missing the following output(s): ${JoinStringUnion<
|
||||
Exclude<RequiredExtensionIds<UDeclaredOutput>, UFactoryOutput['id']>
|
||||
>}`;
|
||||
|
||||
// (No @packageDocumentation comment for this package)
|
||||
```
|
||||
|
||||
@@ -24,8 +24,7 @@ import { PropsWithChildren } from 'react';
|
||||
import { ReactNode } from 'react';
|
||||
import { StandardSchemaV1 } from '@standard-schema/spec';
|
||||
import { SwappableComponentRef as SwappableComponentRef_2 } from '@backstage/frontend-plugin-api';
|
||||
import { z } from 'zod/v3';
|
||||
import { ZodType } from 'zod/v3';
|
||||
import type { z } from 'zod/v3';
|
||||
|
||||
// @public @deprecated
|
||||
export type AlertApi = {
|
||||
@@ -390,16 +389,6 @@ export const configApiRef: ApiRef_2<Config, 'core.config'> & {
|
||||
readonly $$type: '@backstage/ApiRef';
|
||||
};
|
||||
|
||||
// @public
|
||||
export type ConfigFieldSchema =
|
||||
| StandardSchemaV1
|
||||
| ((zImpl: typeof z) => ZodType);
|
||||
|
||||
// @public
|
||||
export type ConfigSchemaRecord = {
|
||||
[key: string]: ConfigFieldSchema;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export interface ConfigurableExtensionDataRef<
|
||||
TData,
|
||||
@@ -469,8 +458,6 @@ export function createApiRef<T>(): {
|
||||
};
|
||||
};
|
||||
|
||||
// Warning: (ae-forgotten-export) The symbol "VerifyExtensionFactoryOutput" needs to be exported by the entry point index.d.ts
|
||||
//
|
||||
// @public
|
||||
export function createExtension<
|
||||
UOutput extends ExtensionDataRef,
|
||||
@@ -538,7 +525,7 @@ export function createExtension<
|
||||
[inputName in string]: ExtensionInput;
|
||||
},
|
||||
TConfigSchema extends {
|
||||
[key: string]: ConfigFieldSchema;
|
||||
[key: string]: (zImpl: typeof z) => z.ZodType;
|
||||
},
|
||||
UFactoryOutput extends ExtensionDataValue<any, any>,
|
||||
const TKind extends string | undefined = undefined,
|
||||
@@ -599,8 +586,6 @@ export function createExtension<
|
||||
name: string | undefined extends TName ? undefined : TName;
|
||||
}>;
|
||||
|
||||
// Warning: (ae-unresolved-link) The @link reference could not be resolved: The reference is ambiguous because "createExtension" has more than one declaration; you need to add a TSDoc member reference selector
|
||||
//
|
||||
// @public
|
||||
export function createExtensionBlueprint<
|
||||
TParams extends object | ExtensionBlueprintDefineParams,
|
||||
@@ -680,7 +665,7 @@ export function createExtensionBlueprint<
|
||||
[inputName in string]: ExtensionInput;
|
||||
},
|
||||
TConfigSchema extends {
|
||||
[key in string]: ConfigFieldSchema;
|
||||
[key in string]: (zImpl: typeof z) => z.ZodType;
|
||||
},
|
||||
UFactoryOutput extends ExtensionDataValue<any, any>,
|
||||
TKind extends string,
|
||||
@@ -760,7 +745,7 @@ export type CreateExtensionBlueprintOptions<
|
||||
[inputName in string]: ExtensionInput;
|
||||
},
|
||||
TConfigSchema extends {
|
||||
[key in string]: ConfigFieldSchema;
|
||||
[key in string]: (zImpl: typeof z) => z.ZodType;
|
||||
},
|
||||
UFactoryOutput extends ExtensionDataValue<any, any>,
|
||||
TDataRefs extends {
|
||||
@@ -859,7 +844,7 @@ export type CreateExtensionOptions<
|
||||
[inputName in string]: ExtensionInput;
|
||||
},
|
||||
TConfigSchema extends {
|
||||
[key: string]: ConfigFieldSchema;
|
||||
[key: string]: (zImpl: typeof z) => z.ZodType;
|
||||
},
|
||||
UFactoryOutput extends ExtensionDataValue<any, any>,
|
||||
UParentInputs extends ExtensionDataRef,
|
||||
@@ -1339,7 +1324,7 @@ export interface ExtensionBlueprint<
|
||||
makeWithOverrides<
|
||||
TName extends string | undefined,
|
||||
TExtensionConfigSchema extends {
|
||||
[key in string]: ConfigFieldSchema;
|
||||
[key in string]: (zImpl: typeof z) => z.ZodType;
|
||||
},
|
||||
UFactoryOutput extends ExtensionDataValue<any, any>,
|
||||
UNewOutput extends ExtensionDataRef,
|
||||
@@ -2080,7 +2065,7 @@ export interface OverridableExtensionDefinition<
|
||||
// @deprecated (undocumented)
|
||||
override<
|
||||
TExtensionConfigSchema extends {
|
||||
[key in string]: ConfigFieldSchema;
|
||||
[key in string]: (zImpl: typeof z) => z.ZodType;
|
||||
},
|
||||
UFactoryOutput extends ExtensionDataValue<any, any>,
|
||||
UNewOutput extends ExtensionDataRef,
|
||||
@@ -2459,6 +2444,27 @@ export const Progress: {
|
||||
// @public (undocumented)
|
||||
export type ProgressProps = {};
|
||||
|
||||
// @public (undocumented)
|
||||
export type RequiredExtensionIds<UExtensionData extends ExtensionDataRef> =
|
||||
UExtensionData extends any
|
||||
? UExtensionData['config']['optional'] extends true
|
||||
? never
|
||||
: UExtensionData['id']
|
||||
: never;
|
||||
|
||||
// @public
|
||||
export type ResolvedExtensionInputs<
|
||||
TInputs extends {
|
||||
[name in string]: ExtensionInput;
|
||||
},
|
||||
> = {
|
||||
[InputName in keyof TInputs]: false extends TInputs[InputName]['config']['singleton']
|
||||
? Array<Expand<ResolvedExtensionInput<TInputs[InputName]>>>
|
||||
: false extends TInputs[InputName]['config']['optional']
|
||||
? Expand<ResolvedExtensionInput<TInputs[InputName]>>
|
||||
: Expand<ResolvedExtensionInput<TInputs[InputName]> | undefined>;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type RouteFunc<TParams extends AnyRouteRefParams> = (
|
||||
...input: TParams extends undefined ? readonly [] : readonly [params: TParams]
|
||||
@@ -2871,6 +2877,32 @@ export const useTranslationRef: <TMessages extends { [key in string]: string }>(
|
||||
t: TranslationFunction<TMessages>;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type VerifyExtensionAttachTo<
|
||||
UOutput extends ExtensionDataRef,
|
||||
UParentInput extends ExtensionDataRef,
|
||||
> = ExtensionDataRef extends UParentInput
|
||||
? {}
|
||||
: [RequiredExtensionIds<UParentInput>] extends [RequiredExtensionIds<UOutput>]
|
||||
? {}
|
||||
: `Error: This parent extension input requires the following extension data, but it is not declared as guaranteed output of this extension: ${JoinStringUnion<
|
||||
Exclude<RequiredExtensionIds<UParentInput>, RequiredExtensionIds<UOutput>>
|
||||
>}`;
|
||||
|
||||
// @public (undocumented)
|
||||
export type VerifyExtensionFactoryOutput<
|
||||
UDeclaredOutput extends ExtensionDataRef,
|
||||
UFactoryOutput extends ExtensionDataValue<any, any>,
|
||||
> = [RequiredExtensionIds<UDeclaredOutput>] extends [UFactoryOutput['id']]
|
||||
? [UFactoryOutput['id']] extends [UDeclaredOutput['id']]
|
||||
? {}
|
||||
: `Error: The extension factory has undeclared output(s): ${JoinStringUnion<
|
||||
Exclude<UFactoryOutput['id'], UDeclaredOutput['id']>
|
||||
>}`
|
||||
: `Error: The extension factory is missing the following output(s): ${JoinStringUnion<
|
||||
Exclude<RequiredExtensionIds<UDeclaredOutput>, UFactoryOutput['id']>
|
||||
>}`;
|
||||
|
||||
// @public
|
||||
export const vmwareCloudAuthApiRef: ApiRef_2<
|
||||
OAuthApi &
|
||||
@@ -2892,9 +2924,4 @@ export function withApis<T extends {}>(
|
||||
(props: PropsWithChildren<Omit<TProps, keyof T>>): JSX_3.Element;
|
||||
displayName: string;
|
||||
};
|
||||
|
||||
// Warnings were encountered during analysis:
|
||||
//
|
||||
// src/wiring/createExtension.d.ts:280:5 - (ae-forgotten-export) The symbol "VerifyExtensionAttachTo" needs to be exported by the entry point index.d.ts
|
||||
// src/wiring/createExtension.d.ts:293:9 - (ae-forgotten-export) The symbol "ResolvedExtensionInputs" needs to be exported by the entry point index.d.ts
|
||||
```
|
||||
|
||||
@@ -37,6 +37,10 @@ export type {
|
||||
ExtensionInput,
|
||||
FrontendPlugin,
|
||||
OverridableExtensionDefinition,
|
||||
ResolvedExtensionInputs,
|
||||
RequiredExtensionIds,
|
||||
VerifyExtensionFactoryOutput,
|
||||
VerifyExtensionAttachTo,
|
||||
} from './wiring';
|
||||
export type {
|
||||
ApiHolder,
|
||||
@@ -47,11 +51,7 @@ export type {
|
||||
AppNodeSpec,
|
||||
AppTree,
|
||||
} from './apis';
|
||||
export type {
|
||||
PortableSchema,
|
||||
StandardSchemaV1,
|
||||
ConfigFieldSchema,
|
||||
} from './schema';
|
||||
export type { PortableSchema, StandardSchemaV1 } from './schema';
|
||||
export type {
|
||||
AnyRouteRefParams,
|
||||
RouteRef,
|
||||
|
||||
@@ -41,89 +41,10 @@ export type { StandardSchemaV1 } from '@standard-schema/spec';
|
||||
import { type StandardSchemaV1 } from '@standard-schema/spec';
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public types
|
||||
// Internal type for the field record accepted by createPortableSchema
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* A single config field schema. Accepts any Standard Schema implementation,
|
||||
* or the legacy factory form for backward compat.
|
||||
* @public
|
||||
*/
|
||||
export type ConfigFieldSchema =
|
||||
| StandardSchemaV1
|
||||
| ((zImpl: typeof zodV3) => ZodType);
|
||||
|
||||
/**
|
||||
* A record of per-field config schemas.
|
||||
* @public
|
||||
*/
|
||||
export type ConfigSchemaRecord = { [key: string]: ConfigFieldSchema };
|
||||
|
||||
/**
|
||||
* Infers the parsed output type of a config schema record.
|
||||
* Replaces: `{ [key in keyof T]: z.infer<ReturnType<T[key]>> }`
|
||||
*
|
||||
* Split into two mapped types joined by intersection to avoid conditional
|
||||
* types in the value position, which TypeScript defers in declaration emit.
|
||||
* Factory-form fields use `ReturnType<...>['_output']` (eagerly evaluated),
|
||||
* Standard Schema fields use `['~standard']['types']['output']`.
|
||||
* @ignore
|
||||
*/
|
||||
type InferConfigOutput<T extends ConfigSchemaRecord> = {
|
||||
[K in keyof T as T[K] extends (...args: any[]) => any
|
||||
? K
|
||||
: never]: ReturnType<T[K] & ((...args: any[]) => any)>['_output'];
|
||||
} & {
|
||||
[K in keyof T as T[K] extends (...args: any[]) => any
|
||||
? never
|
||||
: K]: NonNullable<
|
||||
(T[K] & StandardSchemaV1)['~standard']['types']
|
||||
>['output'];
|
||||
};
|
||||
|
||||
/**
|
||||
* Infers the raw input type (before defaults/transforms) of a config
|
||||
* schema record.
|
||||
* Replaces: `z.input<z.ZodObject<{ ... }>>`
|
||||
*
|
||||
* Fields whose input type includes `undefined` are made optional keys,
|
||||
* matching the behavior of `z.input<z.ZodObject<...>>` for ZodDefault
|
||||
* and ZodOptional fields.
|
||||
* @ignore
|
||||
*/
|
||||
type InferConfigInput<T extends ConfigSchemaRecord> = _RequiredInput<T> &
|
||||
_OptionalInput<T>;
|
||||
|
||||
type _FactoryInput<T extends (...args: any[]) => any> = ReturnType<T>['_input'];
|
||||
type _SchemaInput<T extends StandardSchemaV1> = NonNullable<
|
||||
T['~standard']['types']
|
||||
>['input'];
|
||||
|
||||
/** @ignore */
|
||||
type _RequiredInput<T extends ConfigSchemaRecord> = {
|
||||
[K in keyof T as T[K] extends (...args: any[]) => any
|
||||
? undefined extends _FactoryInput<T[K] & ((...args: any[]) => any)>
|
||||
? never
|
||||
: K
|
||||
: undefined extends _SchemaInput<T[K] & StandardSchemaV1>
|
||||
? never
|
||||
: K]: T[K] extends (...args: any[]) => any
|
||||
? _FactoryInput<T[K] & ((...args: any[]) => any)>
|
||||
: _SchemaInput<T[K] & StandardSchemaV1>;
|
||||
};
|
||||
|
||||
/** @ignore */
|
||||
type _OptionalInput<T extends ConfigSchemaRecord> = {
|
||||
[K in keyof T as T[K] extends (...args: any[]) => any
|
||||
? undefined extends _FactoryInput<T[K] & ((...args: any[]) => any)>
|
||||
? K
|
||||
: never
|
||||
: undefined extends _SchemaInput<T[K] & StandardSchemaV1>
|
||||
? K
|
||||
: never]?: T[K] extends (...args: any[]) => any
|
||||
? _FactoryInput<T[K] & ((...args: any[]) => any)>
|
||||
: _SchemaInput<T[K] & StandardSchemaV1>;
|
||||
};
|
||||
type FieldSchema = StandardSchemaV1 | ((zImpl: typeof zodV3) => ZodType);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// The PortableSchema — now with per-field tracking for mergeability
|
||||
@@ -156,9 +77,9 @@ export interface MergeablePortableSchema<TOutput = any, TInput = any>
|
||||
// createPortableSchema — builds from a field record
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export function createPortableSchema<T extends ConfigSchemaRecord>(
|
||||
fields: T,
|
||||
): MergeablePortableSchema<InferConfigOutput<T>, InferConfigInput<T>> {
|
||||
export function createPortableSchema(
|
||||
fields: Record<string, FieldSchema>,
|
||||
): MergeablePortableSchema {
|
||||
const fieldValidators: Record<string, FieldValidator> = {};
|
||||
|
||||
for (const [key, field] of Object.entries(fields)) {
|
||||
|
||||
@@ -15,8 +15,4 @@
|
||||
*/
|
||||
|
||||
export { type PortableSchema } from './types';
|
||||
export {
|
||||
type StandardSchemaV1,
|
||||
type ConfigFieldSchema,
|
||||
type ConfigSchemaRecord,
|
||||
} from './createPortableSchema';
|
||||
export { type StandardSchemaV1 } from './createPortableSchema';
|
||||
|
||||
@@ -28,7 +28,6 @@ import { ExtensionDataRef, ExtensionDataValue } from './createExtensionDataRef';
|
||||
import { ExtensionInput } from './createExtensionInput';
|
||||
import type { z } from 'zod/v3';
|
||||
import { createSchemaFromZod } from '../schema/createSchemaFromZod';
|
||||
import type { ConfigFieldSchema } from '../schema/createPortableSchema';
|
||||
import { warnConfigSchemaPropDeprecation } from '../schema/createPortableSchema';
|
||||
import { type StandardSchemaV1 } from '@standard-schema/spec';
|
||||
import { OpaqueExtensionDefinition } from '@internal/frontend';
|
||||
@@ -58,7 +57,7 @@ type ResolvedExtensionInput<TExtensionInput extends ExtensionInput> =
|
||||
/**
|
||||
* Converts an extension input map into a matching collection of resolved inputs.
|
||||
*
|
||||
* @ignore
|
||||
* @public
|
||||
*/
|
||||
export type ResolvedExtensionInputs<
|
||||
TInputs extends {
|
||||
@@ -95,7 +94,7 @@ type JoinStringUnion<
|
||||
: JoinStringUnion<IRest, TDiv, `${TResult}${TDiv}${INext}`>
|
||||
: TResult;
|
||||
|
||||
/** @ignore */
|
||||
/** @public */
|
||||
export type RequiredExtensionIds<UExtensionData extends ExtensionDataRef> =
|
||||
UExtensionData extends any
|
||||
? UExtensionData['config']['optional'] extends true
|
||||
@@ -103,7 +102,7 @@ export type RequiredExtensionIds<UExtensionData extends ExtensionDataRef> =
|
||||
: UExtensionData['id']
|
||||
: never;
|
||||
|
||||
/** @ignore */
|
||||
/** @public */
|
||||
export type VerifyExtensionFactoryOutput<
|
||||
UDeclaredOutput extends ExtensionDataRef,
|
||||
UFactoryOutput extends ExtensionDataValue<any, any>,
|
||||
@@ -117,7 +116,7 @@ export type VerifyExtensionFactoryOutput<
|
||||
Exclude<RequiredExtensionIds<UDeclaredOutput>, UFactoryOutput['id']>
|
||||
>}`;
|
||||
|
||||
/** @ignore */
|
||||
/** @public */
|
||||
export type VerifyExtensionAttachTo<
|
||||
UOutput extends ExtensionDataRef,
|
||||
UParentInput extends ExtensionDataRef,
|
||||
@@ -169,7 +168,7 @@ export type CreateExtensionOptions<
|
||||
TName extends string | undefined,
|
||||
UOutput extends ExtensionDataRef,
|
||||
TInputs extends { [inputName in string]: ExtensionInput },
|
||||
TConfigSchema extends { [key: string]: ConfigFieldSchema },
|
||||
TConfigSchema extends { [key: string]: (zImpl: typeof z) => z.ZodType },
|
||||
UFactoryOutput extends ExtensionDataValue<any, any>,
|
||||
UParentInputs extends ExtensionDataRef,
|
||||
TNewConfigSchema extends { [key: string]: StandardSchemaV1 } = {},
|
||||
@@ -355,7 +354,7 @@ export interface OverridableExtensionDefinition<
|
||||
*/
|
||||
override<
|
||||
TExtensionConfigSchema extends {
|
||||
[key in string]: ConfigFieldSchema;
|
||||
[key in string]: (zImpl: typeof z) => z.ZodType;
|
||||
},
|
||||
UFactoryOutput extends ExtensionDataValue<any, any>,
|
||||
UNewOutput extends ExtensionDataRef,
|
||||
@@ -578,7 +577,7 @@ export function createExtension<
|
||||
export function createExtension<
|
||||
UOutput extends ExtensionDataRef,
|
||||
TInputs extends { [inputName in string]: ExtensionInput },
|
||||
TConfigSchema extends { [key: string]: ConfigFieldSchema },
|
||||
TConfigSchema extends { [key: string]: (zImpl: typeof z) => z.ZodType },
|
||||
UFactoryOutput extends ExtensionDataValue<any, any>,
|
||||
const TKind extends string | undefined = undefined,
|
||||
const TName extends string | undefined = undefined,
|
||||
|
||||
@@ -28,7 +28,6 @@ import {
|
||||
} from './createExtension';
|
||||
import type { z } from 'zod/v3';
|
||||
import { ExtensionInput } from './createExtensionInput';
|
||||
import type { ConfigFieldSchema } from '../schema/createPortableSchema';
|
||||
import { type StandardSchemaV1 } from '@standard-schema/spec';
|
||||
import { ExtensionDataRef, ExtensionDataValue } from './createExtensionDataRef';
|
||||
import { createExtensionDataContainer } from '@internal/frontend';
|
||||
@@ -108,7 +107,7 @@ export type CreateExtensionBlueprintOptions<
|
||||
TParams extends object | ExtensionBlueprintDefineParams,
|
||||
UOutput extends ExtensionDataRef,
|
||||
TInputs extends { [inputName in string]: ExtensionInput },
|
||||
TConfigSchema extends { [key in string]: ConfigFieldSchema },
|
||||
TConfigSchema extends { [key in string]: (zImpl: typeof z) => z.ZodType },
|
||||
UFactoryOutput extends ExtensionDataValue<any, any>,
|
||||
TDataRefs extends { [name in string]: ExtensionDataRef },
|
||||
UParentInputs extends ExtensionDataRef,
|
||||
@@ -350,7 +349,7 @@ export interface ExtensionBlueprint<
|
||||
makeWithOverrides<
|
||||
TName extends string | undefined,
|
||||
TExtensionConfigSchema extends {
|
||||
[key in string]: ConfigFieldSchema;
|
||||
[key in string]: (zImpl: typeof z) => z.ZodType;
|
||||
},
|
||||
UFactoryOutput extends ExtensionDataValue<any, any>,
|
||||
UNewOutput extends ExtensionDataRef,
|
||||
@@ -524,7 +523,7 @@ function unwrapParams<TParams extends object>(
|
||||
* in the frontend system documentation.
|
||||
*
|
||||
* Extension blueprints make it much easier for users to create new extensions
|
||||
* for your plugin. Rather than letting them use {@link createExtension}
|
||||
* for your plugin. Rather than letting them use `createExtension`
|
||||
* directly, you can define a set of parameters and default factory for your
|
||||
* blueprint, removing a lot of the boilerplate and complexity that is otherwise
|
||||
* needed to create an extension.
|
||||
@@ -634,7 +633,7 @@ export function createExtensionBlueprint<
|
||||
TParams extends object | ExtensionBlueprintDefineParams,
|
||||
UOutput extends ExtensionDataRef,
|
||||
TInputs extends { [inputName in string]: ExtensionInput },
|
||||
TConfigSchema extends { [key in string]: ConfigFieldSchema },
|
||||
TConfigSchema extends { [key in string]: (zImpl: typeof z) => z.ZodType },
|
||||
UFactoryOutput extends ExtensionDataValue<any, any>,
|
||||
TKind extends string,
|
||||
UParentInputs extends ExtensionDataRef,
|
||||
|
||||
@@ -22,6 +22,10 @@ export {
|
||||
type ExtensionDefinitionParameters,
|
||||
type CreateExtensionOptions,
|
||||
type OverridableExtensionDefinition,
|
||||
type ResolvedExtensionInputs,
|
||||
type RequiredExtensionIds,
|
||||
type VerifyExtensionFactoryOutput,
|
||||
type VerifyExtensionAttachTo,
|
||||
} from './createExtension';
|
||||
export {
|
||||
createExtensionInput,
|
||||
|
||||
Reference in New Issue
Block a user