UNPKG

2.81 kBTypeScriptView Raw
1import type { DefaultElements, BasicMetaSysProps, SysLink, MakeRequest, Link } from '../common-types';
2import type { ContentfulAppDefinitionAPI } from '../create-app-definition-api';
3import type { SetOptional, Except } from 'type-fest';
4import type { FieldType } from './field-type';
5import type { InstallationParameterType, ParameterDefinition } from './widget-parameters';
6import type { AppInstallationProps } from './app-installation';
7import type { EnvironmentProps } from './environment';
8export interface NavigationItem {
9 name: string;
10 path: string;
11}
12type LocationType = 'app-config' | 'entry-sidebar' | 'entry-editor' | 'dialog' | 'page' | 'home';
13export interface SimpleLocation {
14 location: LocationType;
15}
16export interface EntryFieldLocation {
17 location: 'entry-field';
18 fieldTypes: FieldType[];
19}
20export interface PageLocation {
21 location: 'page';
22 navigationItem?: NavigationItem;
23}
24export type AppLocation = SimpleLocation | EntryFieldLocation | PageLocation;
25export type AppDefinitionProps = {
26 /**
27 * System metadata
28 */
29 sys: BasicMetaSysProps & {
30 organization: SysLink;
31 shared: boolean;
32 };
33 /**
34 * App name
35 */
36 name: string;
37 /**
38 * URL where the root HTML document of the app can be found
39 */
40 src?: string;
41 /**
42 * Link to an AppBundle
43 */
44 bundle?: Link<'AppBundle'>;
45 /**
46 * Locations where the app can be installed
47 */
48 locations?: AppLocation[];
49 /**
50 * Instance parameter definitions
51 */
52 parameters?: {
53 instance?: ParameterDefinition[];
54 installation?: ParameterDefinition<InstallationParameterType>[];
55 };
56};
57export type CreateAppDefinitionProps = SetOptional<Except<AppDefinitionProps, 'sys' | 'bundle'>, 'src' | 'locations'>;
58export type AppDefinition = ContentfulAppDefinitionAPI & AppDefinitionProps & DefaultElements<AppDefinitionProps>;
59export type AppInstallationsForOrganizationProps = {
60 sys: {
61 type: 'Array';
62 };
63 items: AppInstallationProps[];
64 includes: {
65 Environment: EnvironmentProps[];
66 };
67};
68/**
69 * @private
70 * @param makeRequest - function to make requests via an adapter
71 * @param data - Raw App Definition data
72 * @return Wrapped App Definition data
73 */
74export declare function wrapAppDefinition(makeRequest: MakeRequest, data: AppDefinitionProps): AppDefinition;
75/**
76 * @private
77 * @param makeRequest - function to make requests via an adapter
78 * @param data - Raw App Definition collection data
79 * @return Wrapped App Definition collection data
80 */
81export declare const wrapAppDefinitionCollection: (makeRequest: MakeRequest, data: import("../common-types").CollectionProp<AppDefinitionProps>) => import("../common-types").Collection<AppDefinition, AppDefinitionProps>;
82export {};