| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- // tslint:disable:no-shadowed-variable
- // prettier-ignore
- /**
- * A recursive implementation of the Partial<T> type.
- * Source: https://stackoverflow.com/a/49936686/772859
- */
- export type DeepPartial<T> = {
- [P in keyof T]?: null | (T[P] extends Array<infer U>
- ? Array<DeepPartial<U>>
- : T[P] extends ReadonlyArray<infer U>
- ? ReadonlyArray<DeepPartial<U>>
- : DeepPartial<T[P]>)
- };
- // tslint:enable:no-shadowed-variable
- // tslint:disable:ban-types
- /**
- * A recursive implementation of Required<T>.
- * Source: https://github.com/microsoft/TypeScript/issues/15012#issuecomment-365453623
- */
- export type DeepRequired<T, U extends object | undefined = undefined> = T extends object
- ? {
- [P in keyof T]-?: NonNullable<T[P]> extends NonNullable<U | Function | Type<any>>
- ? NonNullable<T[P]>
- : DeepRequired<NonNullable<T[P]>, U>
- }
- : T;
- // tslint:enable:ban-types
- /**
- * A type representing the type rather than instance of a class.
- */
- export interface Type<T> extends Function {
- // tslint:disable-next-line:callable-types
- new (...args: any[]): T;
- }
- /**
- * A type describing the shape of a paginated list response
- */
- export type PaginatedList<T> = {
- items: T[];
- totalItems: number;
- };
- /**
- * @description
- * An entity ID. Depending on the configured {@link EntityIdStrategy}, it will be either
- * a `string` or a `number`;
- *
- * @docsCategory common
- */
- export type ID = string | number;
- /**
- * @description
- * A data type for a custom field.
- *
- * @docsCategory custom-fields
- */
- export type CustomFieldType = 'string' | 'localeString' | 'int' | 'float' | 'boolean' | 'datetime';
- /**
- * @description
- * Certain entities (those which implement {@link ConfigurableOperationDef}) allow arbitrary
- * configuration arguments to be specified which can then be set in the admin-ui and used in
- * the business logic of the app. These are the valid data types of such arguments.
- * The data type influences:
- *
- * 1. How the argument form field is rendered in the admin-ui
- * 2. The JavaScript type into which the value is coerced before being passed to the business logic.
- *
- * @docsCategory common
- * @docsPage Configurable Operations
- */
- export type ConfigArgType = 'string' | 'int' | 'float' | 'boolean' | 'datetime' | 'facetValueIds';
- export type ConfigArgSubset<T extends ConfigArgType> = T;
- export type CustomFieldsObject = { [key: string]: any };
- /**
- * This interface describes the shape of the JSON config file used by the Admin UI.
- */
- export interface AdminUiConfig {
- apiHost: string | 'auto';
- apiPort: number | 'auto';
- adminApiPath: string;
- tokenMethod: 'cookie' | 'bearer';
- authTokenHeaderKey: string;
- }
- /**
- * @description
- * Defines extensions to the Admin UI application by specifying additional
- * Angular [NgModules](https://angular.io/guide/ngmodules) which are compiled
- * into the application.
- *
- * See [Extending the Admin UI](/docs/developer-guide/plugins/extending-the-admin-ui/) for
- * detailed instructions.
- *
- * @docsCategory AdminUiPlugin
- */
- export interface AdminUiExtension {
- /**
- * @description
- * An optional ID for the extension module. Only used internally for generating
- * import paths to your module. If not specified, a unique hash will be used as the id.
- */
- id?: string;
- /**
- * @description
- * The path to the directory containing the extension module(s). The entire contents of this directory
- * will be copied into the Admin UI app, including all TypeScript source files, html templates,
- * scss style sheets etc.
- */
- extensionPath: string;
- /**
- * @description
- * One or more Angular modules which extend the default Admin UI.
- */
- ngModules: AdminUiExtensionModule[];
- }
- /**
- * @description
- * Configuration defining a single NgModule with which to extend the Admin UI.
- *
- * @docsCategory AdminUiPlugin
- */
- export interface AdminUiExtensionModule {
- /**
- * @description
- * Lazy modules are lazy-loaded at the `/extensions/` route and should be used for
- * modules which define new views for the Admin UI.
- *
- * Shared modules are directly imported into the main AppModule of the Admin UI
- * and should be used to declare custom form components and define custom
- * navigation items.
- */
- type: 'shared' | 'lazy';
- /**
- * @description
- * The name of the file containing the extension module class.
- */
- ngModuleFileName: string;
- /**
- * @description
- * The name of the extension module class.
- */
- ngModuleName: string;
- }
|