@contentful/app-sdk 4.16.0 → 4.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.d.ts +3 -3
- package/dist/app.d.ts +3 -3
- package/dist/channel.d.ts +13 -13
- package/dist/cmaAdapter.d.ts +3 -3
- package/dist/dialogs.d.ts +3 -3
- package/dist/editor.d.ts +4 -4
- package/dist/entry.d.ts +3 -3
- package/dist/field-locale.d.ts +26 -26
- package/dist/field.d.ts +22 -22
- package/dist/index.d.ts +7 -7
- package/dist/initialize.d.ts +6 -6
- package/dist/locations.d.ts +3 -3
- package/dist/navigator.d.ts +3 -3
- package/dist/signal.d.ts +15 -15
- package/dist/space.d.ts +3 -3
- package/dist/types/api.types.d.ts +281 -263
- package/dist/types/app.types.d.ts +44 -44
- package/dist/types/cmaClient.types.d.ts +35 -31
- package/dist/types/dialogs.types.d.ts +69 -69
- package/dist/types/entities.d.ts +7 -7
- package/dist/types/entry.types.d.ts +45 -45
- package/dist/types/field-locale.types.d.ts +55 -55
- package/dist/types/field.types.d.ts +70 -70
- package/dist/types/index.d.ts +13 -13
- package/dist/types/navigator.types.d.ts +63 -63
- package/dist/types/space.types.d.ts +272 -272
- package/dist/types/utils.d.ts +74 -74
- package/dist/types/validation-error.d.ts +63 -63
- package/dist/types/window.types.d.ts +17 -17
- package/dist/utils/deferred.d.ts +6 -6
- package/dist/window.d.ts +3 -3
- package/package.json +1 -1
|
@@ -1,31 +1,35 @@
|
|
|
1
|
-
import { PlainClientAPI } from 'contentful-management';
|
|
2
|
-
export type CMAClient = {
|
|
3
|
-
appAction: Pick<PlainClientAPI['appAction'], 'get' | 'getMany' | 'getManyForEnvironment'>;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
1
|
+
import { PlainClientAPI } from 'contentful-management';
|
|
2
|
+
export type CMAClient = {
|
|
3
|
+
appAction: Pick<PlainClientAPI['appAction'], 'get' | 'getMany' | 'getManyForEnvironment'>;
|
|
4
|
+
appActionCall: Pick<PlainClientAPI['appActionCall'], 'create'>;
|
|
5
|
+
appDefinition: Pick<PlainClientAPI['appDefinition'], 'get' | 'getInstallationsForOrg'>;
|
|
6
|
+
appInstallation: Pick<PlainClientAPI['appInstallation'], 'getForOrganization'>;
|
|
7
|
+
asset: PlainClientAPI['asset'];
|
|
8
|
+
assetKey: PlainClientAPI['assetKey'];
|
|
9
|
+
appSignedRequest: Pick<PlainClientAPI['appSignedRequest'], 'create'>;
|
|
10
|
+
bulkAction: PlainClientAPI['bulkAction'];
|
|
11
|
+
comment: PlainClientAPI['comment'];
|
|
12
|
+
contentType: PlainClientAPI['contentType'];
|
|
13
|
+
editorInterface: PlainClientAPI['editorInterface'];
|
|
14
|
+
environment: Pick<PlainClientAPI['environment'], 'get'>;
|
|
15
|
+
environmentAlias: Pick<PlainClientAPI['environmentAlias'], 'get'>;
|
|
16
|
+
entry: PlainClientAPI['entry'];
|
|
17
|
+
locale: PlainClientAPI['locale'];
|
|
18
|
+
release: PlainClientAPI['release'];
|
|
19
|
+
releaseAction: PlainClientAPI['releaseAction'];
|
|
20
|
+
role: Pick<PlainClientAPI['role'], 'get' | 'getMany'>;
|
|
21
|
+
scheduledActions: PlainClientAPI['scheduledActions'];
|
|
22
|
+
snapshot: PlainClientAPI['snapshot'];
|
|
23
|
+
space: Pick<PlainClientAPI['space'], 'get'>;
|
|
24
|
+
upload: PlainClientAPI['upload'];
|
|
25
|
+
user: Pick<PlainClientAPI['user'], 'getManyForSpace' | 'getForSpace'>;
|
|
26
|
+
usage: Pick<PlainClientAPI['usage'], 'getManyForSpace'>;
|
|
27
|
+
team: Pick<PlainClientAPI['team'], 'getManyForSpace'>;
|
|
28
|
+
task: PlainClientAPI['task'];
|
|
29
|
+
tag: PlainClientAPI['tag'];
|
|
30
|
+
uiConfig: PlainClientAPI['uiConfig'];
|
|
31
|
+
userUIConfig: PlainClientAPI['userUIConfig'];
|
|
32
|
+
workflow: PlainClientAPI['workflow'];
|
|
33
|
+
workflowDefinition: PlainClientAPI['workflowDefinition'];
|
|
34
|
+
workflowsChangelog: PlainClientAPI['workflowsChangelog'];
|
|
35
|
+
};
|
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
import { SerializedJSONValue } from './utils';
|
|
2
|
-
export interface OpenAlertOptions {
|
|
3
|
-
title: string;
|
|
4
|
-
message: string;
|
|
5
|
-
confirmLabel?: string;
|
|
6
|
-
shouldCloseOnEscapePress?: boolean;
|
|
7
|
-
shouldCloseOnOverlayClick?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export type OpenConfirmOptions = OpenAlertOptions & {
|
|
10
|
-
cancelLabel?: string;
|
|
11
|
-
intent?: 'primary' | 'positive' | 'negative';
|
|
12
|
-
};
|
|
13
|
-
export interface OpenCustomWidgetOptions {
|
|
14
|
-
id?: string;
|
|
15
|
-
width?: number | 'small' | 'medium' | 'large' | 'fullWidth';
|
|
16
|
-
minHeight?: number | string;
|
|
17
|
-
allowHeightOverflow?: boolean;
|
|
18
|
-
position?: 'center' | 'top';
|
|
19
|
-
title?: string;
|
|
20
|
-
shouldCloseOnOverlayClick?: boolean;
|
|
21
|
-
shouldCloseOnEscapePress?: boolean;
|
|
22
|
-
parameters?: SerializedJSONValue;
|
|
23
|
-
}
|
|
24
|
-
export interface EntityDialogOptions {
|
|
25
|
-
locale?: string;
|
|
26
|
-
contentTypes?: string[];
|
|
27
|
-
min?: number;
|
|
28
|
-
max?: number;
|
|
29
|
-
}
|
|
30
|
-
export interface DialogsAPI {
|
|
31
|
-
/** Opens a simple alert window (which can only be closed). */
|
|
32
|
-
openAlert: (options: OpenAlertOptions) => Promise<boolean>;
|
|
33
|
-
/** Opens a confirmation window. A user can either confirm or cancel the dialog. */
|
|
34
|
-
openConfirm: (options: OpenConfirmOptions) => Promise<boolean>;
|
|
35
|
-
/** Opens a prompt window. A user can either provide a string input or cancel the dialog. */
|
|
36
|
-
openPrompt: (options: OpenConfirmOptions & {
|
|
37
|
-
defaultValue?: string;
|
|
38
|
-
}) => Promise<string | boolean>;
|
|
39
|
-
/** Opens an extension in a dialog. */
|
|
40
|
-
openExtension: (options: OpenCustomWidgetOptions) => Promise<any>;
|
|
41
|
-
/** Opens the current app in a dialog */
|
|
42
|
-
openCurrentApp: (options?: Omit<OpenCustomWidgetOptions, 'id'>) => Promise<any>;
|
|
43
|
-
/** Opens the current app or extension in a dialog */
|
|
44
|
-
openCurrent: (options?: Omit<OpenCustomWidgetOptions, 'id'> | OpenCustomWidgetOptions) => Promise<any>;
|
|
45
|
-
/** Opens a dialog for selecting a single entry. */
|
|
46
|
-
selectSingleEntry: <T = Object>(options?: {
|
|
47
|
-
locale?: string;
|
|
48
|
-
contentTypes?: string[];
|
|
49
|
-
}) => Promise<T | null>;
|
|
50
|
-
/** Opens a dialog for selecting multiple entries. */
|
|
51
|
-
selectMultipleEntries: <T = Object>(options?: {
|
|
52
|
-
locale?: string;
|
|
53
|
-
contentTypes?: string[];
|
|
54
|
-
min?: number;
|
|
55
|
-
max?: number;
|
|
56
|
-
}) => Promise<T[] | null>;
|
|
57
|
-
/** Opens a dialog for selecting a single asset. */
|
|
58
|
-
selectSingleAsset: <T = Object>(options?: {
|
|
59
|
-
locale?: string;
|
|
60
|
-
mimetypeGroups?: string[];
|
|
61
|
-
}) => Promise<T | null>;
|
|
62
|
-
/** Opens a dialog for selecting multiple assets. */
|
|
63
|
-
selectMultipleAssets: <T = Object>(options?: {
|
|
64
|
-
locale?: string;
|
|
65
|
-
min?: number;
|
|
66
|
-
max?: number;
|
|
67
|
-
mimetypeGroups?: string[];
|
|
68
|
-
}) => Promise<T[] | null>;
|
|
69
|
-
}
|
|
1
|
+
import { SerializedJSONValue } from './utils';
|
|
2
|
+
export interface OpenAlertOptions {
|
|
3
|
+
title: string;
|
|
4
|
+
message: string;
|
|
5
|
+
confirmLabel?: string;
|
|
6
|
+
shouldCloseOnEscapePress?: boolean;
|
|
7
|
+
shouldCloseOnOverlayClick?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export type OpenConfirmOptions = OpenAlertOptions & {
|
|
10
|
+
cancelLabel?: string;
|
|
11
|
+
intent?: 'primary' | 'positive' | 'negative';
|
|
12
|
+
};
|
|
13
|
+
export interface OpenCustomWidgetOptions {
|
|
14
|
+
id?: string;
|
|
15
|
+
width?: number | 'small' | 'medium' | 'large' | 'fullWidth';
|
|
16
|
+
minHeight?: number | string;
|
|
17
|
+
allowHeightOverflow?: boolean;
|
|
18
|
+
position?: 'center' | 'top';
|
|
19
|
+
title?: string;
|
|
20
|
+
shouldCloseOnOverlayClick?: boolean;
|
|
21
|
+
shouldCloseOnEscapePress?: boolean;
|
|
22
|
+
parameters?: SerializedJSONValue;
|
|
23
|
+
}
|
|
24
|
+
export interface EntityDialogOptions {
|
|
25
|
+
locale?: string;
|
|
26
|
+
contentTypes?: string[];
|
|
27
|
+
min?: number;
|
|
28
|
+
max?: number;
|
|
29
|
+
}
|
|
30
|
+
export interface DialogsAPI {
|
|
31
|
+
/** Opens a simple alert window (which can only be closed). */
|
|
32
|
+
openAlert: (options: OpenAlertOptions) => Promise<boolean>;
|
|
33
|
+
/** Opens a confirmation window. A user can either confirm or cancel the dialog. */
|
|
34
|
+
openConfirm: (options: OpenConfirmOptions) => Promise<boolean>;
|
|
35
|
+
/** Opens a prompt window. A user can either provide a string input or cancel the dialog. */
|
|
36
|
+
openPrompt: (options: OpenConfirmOptions & {
|
|
37
|
+
defaultValue?: string;
|
|
38
|
+
}) => Promise<string | boolean>;
|
|
39
|
+
/** Opens an extension in a dialog. */
|
|
40
|
+
openExtension: (options: OpenCustomWidgetOptions) => Promise<any>;
|
|
41
|
+
/** Opens the current app in a dialog */
|
|
42
|
+
openCurrentApp: (options?: Omit<OpenCustomWidgetOptions, 'id'>) => Promise<any>;
|
|
43
|
+
/** Opens the current app or extension in a dialog */
|
|
44
|
+
openCurrent: (options?: Omit<OpenCustomWidgetOptions, 'id'> | OpenCustomWidgetOptions) => Promise<any>;
|
|
45
|
+
/** Opens a dialog for selecting a single entry. */
|
|
46
|
+
selectSingleEntry: <T = Object>(options?: {
|
|
47
|
+
locale?: string;
|
|
48
|
+
contentTypes?: string[];
|
|
49
|
+
}) => Promise<T | null>;
|
|
50
|
+
/** Opens a dialog for selecting multiple entries. */
|
|
51
|
+
selectMultipleEntries: <T = Object>(options?: {
|
|
52
|
+
locale?: string;
|
|
53
|
+
contentTypes?: string[];
|
|
54
|
+
min?: number;
|
|
55
|
+
max?: number;
|
|
56
|
+
}) => Promise<T[] | null>;
|
|
57
|
+
/** Opens a dialog for selecting a single asset. */
|
|
58
|
+
selectSingleAsset: <T = Object>(options?: {
|
|
59
|
+
locale?: string;
|
|
60
|
+
mimetypeGroups?: string[];
|
|
61
|
+
}) => Promise<T | null>;
|
|
62
|
+
/** Opens a dialog for selecting multiple assets. */
|
|
63
|
+
selectMultipleAssets: <T = Object>(options?: {
|
|
64
|
+
locale?: string;
|
|
65
|
+
min?: number;
|
|
66
|
+
max?: number;
|
|
67
|
+
mimetypeGroups?: string[];
|
|
68
|
+
}) => Promise<T[] | null>;
|
|
69
|
+
}
|
package/dist/types/entities.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export type { AssetProps as Asset, ContentFields as ContentTypeField, ContentTypeFieldValidation, ContentTypeProps as ContentType, EditorInterfaceProps as EditorInterface, EntryProps as Entry, KeyValueMap, MetadataProps as Metadata, QueryOptions, RoleProps as Role, ScheduledActionProps as ScheduledAction, SpaceMembershipProps as SpaceMembership, TagProps as Tag, TagVisibility, TaskProps as Task, TeamProps as Team, UploadProps as Upload, UserProps as User, WorkflowDefinitionProps as WorkflowDefinition, } from 'contentful-management/types';
|
|
2
|
-
export interface CanonicalRequest {
|
|
3
|
-
method: 'GET' | 'PUT' | 'POST' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
|
|
4
|
-
path: string;
|
|
5
|
-
headers?: Record<string, string>;
|
|
6
|
-
body?: string;
|
|
7
|
-
}
|
|
1
|
+
export type { AssetProps as Asset, ContentFields as ContentTypeField, ContentTypeFieldValidation, ContentTypeProps as ContentType, EditorInterfaceProps as EditorInterface, EntryProps as Entry, KeyValueMap, MetadataProps as Metadata, QueryOptions, RoleProps as Role, ScheduledActionProps as ScheduledAction, SpaceMembershipProps as SpaceMembership, TagProps as Tag, TagVisibility, TaskProps as Task, TeamProps as Team, UploadProps as Upload, UserProps as User, WorkflowDefinitionProps as WorkflowDefinition, } from 'contentful-management/types';
|
|
2
|
+
export interface CanonicalRequest {
|
|
3
|
+
method: 'GET' | 'PUT' | 'POST' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
|
|
4
|
+
path: string;
|
|
5
|
+
headers?: Record<string, string>;
|
|
6
|
+
body?: string;
|
|
7
|
+
}
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import { Metadata, Task } from './entities';
|
|
2
|
-
import { EntryFieldAPI } from './field.types';
|
|
3
|
-
import { CollectionResponse, EntrySys, SearchQuery } from './utils';
|
|
4
|
-
type TaskState = 'active' | 'resolved';
|
|
5
|
-
export interface TaskInputData {
|
|
6
|
-
assignedToId: string;
|
|
7
|
-
assignedToType?: 'User' | 'Team';
|
|
8
|
-
body: string;
|
|
9
|
-
status: TaskState;
|
|
10
|
-
dueDate?: string;
|
|
11
|
-
}
|
|
12
|
-
/** Allows accessing the Task API for the current entry. */
|
|
13
|
-
export interface TaskAPI {
|
|
14
|
-
getTask(id: string): Promise<Task>;
|
|
15
|
-
getTasks(query?: SearchQuery): Promise<CollectionResponse<Task>>;
|
|
16
|
-
createTask(data: TaskInputData): Promise<Task>;
|
|
17
|
-
updateTask(task: Task): Promise<Task>;
|
|
18
|
-
deleteTask(task: Task): Promise<void>;
|
|
19
|
-
}
|
|
20
|
-
export interface EntryAPI extends TaskAPI {
|
|
21
|
-
/** Returns sys for an entry. */
|
|
22
|
-
getSys: () => EntrySys;
|
|
23
|
-
/** Publish the entry */
|
|
24
|
-
publish: (options?: {
|
|
25
|
-
skipUiValidation?: boolean;
|
|
26
|
-
}) => Promise<void>;
|
|
27
|
-
/** Unpublish the entry */
|
|
28
|
-
unpublish: () => Promise<void>;
|
|
29
|
-
/** Saves the current changes of the entry */
|
|
30
|
-
save: () => Promise<void>;
|
|
31
|
-
/** Calls the callback with sys every time that sys changes. */
|
|
32
|
-
onSysChanged: (callback: (sys: EntrySys) => void) => () => void;
|
|
33
|
-
/** Allows to control the values of all other fields in the current entry. */
|
|
34
|
-
fields: {
|
|
35
|
-
[key: string]: EntryFieldAPI;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Optional metadata on an entry
|
|
39
|
-
* @deprecated
|
|
40
|
-
*/
|
|
41
|
-
metadata?: Metadata;
|
|
42
|
-
getMetadata: () => Metadata | undefined;
|
|
43
|
-
onMetadataChanged: (callback: (metadata?: Metadata) => void) => VoidFunction;
|
|
44
|
-
}
|
|
45
|
-
export {};
|
|
1
|
+
import { Metadata, Task } from './entities';
|
|
2
|
+
import { EntryFieldAPI } from './field.types';
|
|
3
|
+
import { CollectionResponse, EntrySys, SearchQuery } from './utils';
|
|
4
|
+
type TaskState = 'active' | 'resolved';
|
|
5
|
+
export interface TaskInputData {
|
|
6
|
+
assignedToId: string;
|
|
7
|
+
assignedToType?: 'User' | 'Team';
|
|
8
|
+
body: string;
|
|
9
|
+
status: TaskState;
|
|
10
|
+
dueDate?: string;
|
|
11
|
+
}
|
|
12
|
+
/** Allows accessing the Task API for the current entry. */
|
|
13
|
+
export interface TaskAPI {
|
|
14
|
+
getTask(id: string): Promise<Task>;
|
|
15
|
+
getTasks(query?: SearchQuery): Promise<CollectionResponse<Task>>;
|
|
16
|
+
createTask(data: TaskInputData): Promise<Task>;
|
|
17
|
+
updateTask(task: Task): Promise<Task>;
|
|
18
|
+
deleteTask(task: Task): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export interface EntryAPI extends TaskAPI {
|
|
21
|
+
/** Returns sys for an entry. */
|
|
22
|
+
getSys: () => EntrySys;
|
|
23
|
+
/** Publish the entry */
|
|
24
|
+
publish: (options?: {
|
|
25
|
+
skipUiValidation?: boolean;
|
|
26
|
+
}) => Promise<void>;
|
|
27
|
+
/** Unpublish the entry */
|
|
28
|
+
unpublish: () => Promise<void>;
|
|
29
|
+
/** Saves the current changes of the entry */
|
|
30
|
+
save: () => Promise<void>;
|
|
31
|
+
/** Calls the callback with sys every time that sys changes. */
|
|
32
|
+
onSysChanged: (callback: (sys: EntrySys) => void) => () => void;
|
|
33
|
+
/** Allows to control the values of all other fields in the current entry. */
|
|
34
|
+
fields: {
|
|
35
|
+
[key: string]: EntryFieldAPI;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Optional metadata on an entry
|
|
39
|
+
* @deprecated
|
|
40
|
+
*/
|
|
41
|
+
metadata?: Metadata;
|
|
42
|
+
getMetadata: () => Metadata | undefined;
|
|
43
|
+
onMetadataChanged: (callback: (metadata?: Metadata) => void) => VoidFunction;
|
|
44
|
+
}
|
|
45
|
+
export {};
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { ContentTypeFieldValidation } from './entities';
|
|
2
|
-
import type { Items, SerializedJSONValue } from './utils';
|
|
3
|
-
import { ValidationError } from './validation-error';
|
|
4
|
-
export interface FieldAPI {
|
|
5
|
-
/** The ID of a field is defined in an entry's content type. */
|
|
6
|
-
id: string;
|
|
7
|
-
/** The current locale of a field the app is attached to. */
|
|
8
|
-
locale: string;
|
|
9
|
-
/** Holds the type of the field the app is attached to. */
|
|
10
|
-
type: string;
|
|
11
|
-
/** Indicates if a value for this field is required */
|
|
12
|
-
required: boolean;
|
|
13
|
-
/** A list of validations for this field that are defined in the content type. */
|
|
14
|
-
validations: ContentTypeFieldValidation[];
|
|
15
|
-
/** Defines the shape of array items */
|
|
16
|
-
items?: Items;
|
|
17
|
-
/** Gets the current value of the field and locale. */
|
|
18
|
-
getValue: () => any;
|
|
19
|
-
/** Sets the value for the field and locale. */
|
|
20
|
-
setValue: <Value = any>(value: Value) => Promise<SerializedJSONValue | undefined>;
|
|
21
|
-
/** Removes the value for the field and locale. */
|
|
22
|
-
removeValue: () => Promise<void>;
|
|
23
|
-
/** Communicates to the web application if the field is in a valid state or not. */
|
|
24
|
-
setInvalid: (value: boolean) => void;
|
|
25
|
-
/** Calls the callback every time the value of the field is changed by an external event or when setValue() is called.
|
|
26
|
-
* the returned function can be called to remove the handler function
|
|
27
|
-
**/
|
|
28
|
-
onValueChanged: (callback: (value: any) => void) => () => void;
|
|
29
|
-
/**
|
|
30
|
-
* Returns whether the current field is disabled
|
|
31
|
-
*
|
|
32
|
-
* The disabled state can change. To always work with the latest state, use `onIsDisabledChanged`.
|
|
33
|
-
*/
|
|
34
|
-
getIsDisabled(): boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Subscribes to changes to this field's disabled state
|
|
37
|
-
*
|
|
38
|
-
* @param callback Function that is called every time this field's disabled state changes. Called immidiately with the current state.
|
|
39
|
-
* @returns Function to unsubscribe. `callback` won't be called anymore.
|
|
40
|
-
*/
|
|
41
|
-
onIsDisabledChanged: (callback: (isDisabled: boolean) => void) => () => void;
|
|
42
|
-
/**
|
|
43
|
-
* Returns the field's validation errors
|
|
44
|
-
*
|
|
45
|
-
* The schema errors can change. To always work with the latest errors, use `onSchemaErrorsChanged`.
|
|
46
|
-
*/
|
|
47
|
-
getSchemaErrors(): ValidationError[];
|
|
48
|
-
/**
|
|
49
|
-
* Subscribes to schema errors
|
|
50
|
-
*
|
|
51
|
-
* @param callback Function that is called every time the schema errors change. Called immediately with the current errors.
|
|
52
|
-
* @returns Function to unsubscribe. `callback` won't be called anymore.
|
|
53
|
-
*/
|
|
54
|
-
onSchemaErrorsChanged: (callback: (errors: ValidationError[]) => void) => () => void;
|
|
55
|
-
}
|
|
1
|
+
import { ContentTypeFieldValidation } from './entities';
|
|
2
|
+
import type { Items, SerializedJSONValue } from './utils';
|
|
3
|
+
import { ValidationError } from './validation-error';
|
|
4
|
+
export interface FieldAPI {
|
|
5
|
+
/** The ID of a field is defined in an entry's content type. */
|
|
6
|
+
id: string;
|
|
7
|
+
/** The current locale of a field the app is attached to. */
|
|
8
|
+
locale: string;
|
|
9
|
+
/** Holds the type of the field the app is attached to. */
|
|
10
|
+
type: string;
|
|
11
|
+
/** Indicates if a value for this field is required */
|
|
12
|
+
required: boolean;
|
|
13
|
+
/** A list of validations for this field that are defined in the content type. */
|
|
14
|
+
validations: ContentTypeFieldValidation[];
|
|
15
|
+
/** Defines the shape of array items */
|
|
16
|
+
items?: Items;
|
|
17
|
+
/** Gets the current value of the field and locale. */
|
|
18
|
+
getValue: () => any;
|
|
19
|
+
/** Sets the value for the field and locale. */
|
|
20
|
+
setValue: <Value = any>(value: Value) => Promise<SerializedJSONValue | undefined>;
|
|
21
|
+
/** Removes the value for the field and locale. */
|
|
22
|
+
removeValue: () => Promise<void>;
|
|
23
|
+
/** Communicates to the web application if the field is in a valid state or not. */
|
|
24
|
+
setInvalid: (value: boolean) => void;
|
|
25
|
+
/** Calls the callback every time the value of the field is changed by an external event or when setValue() is called.
|
|
26
|
+
* the returned function can be called to remove the handler function
|
|
27
|
+
**/
|
|
28
|
+
onValueChanged: (callback: (value: any) => void) => () => void;
|
|
29
|
+
/**
|
|
30
|
+
* Returns whether the current field is disabled
|
|
31
|
+
*
|
|
32
|
+
* The disabled state can change. To always work with the latest state, use `onIsDisabledChanged`.
|
|
33
|
+
*/
|
|
34
|
+
getIsDisabled(): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Subscribes to changes to this field's disabled state
|
|
37
|
+
*
|
|
38
|
+
* @param callback Function that is called every time this field's disabled state changes. Called immidiately with the current state.
|
|
39
|
+
* @returns Function to unsubscribe. `callback` won't be called anymore.
|
|
40
|
+
*/
|
|
41
|
+
onIsDisabledChanged: (callback: (isDisabled: boolean) => void) => () => void;
|
|
42
|
+
/**
|
|
43
|
+
* Returns the field's validation errors
|
|
44
|
+
*
|
|
45
|
+
* The schema errors can change. To always work with the latest errors, use `onSchemaErrorsChanged`.
|
|
46
|
+
*/
|
|
47
|
+
getSchemaErrors(): ValidationError[];
|
|
48
|
+
/**
|
|
49
|
+
* Subscribes to schema errors
|
|
50
|
+
*
|
|
51
|
+
* @param callback Function that is called every time the schema errors change. Called immediately with the current errors.
|
|
52
|
+
* @returns Function to unsubscribe. `callback` won't be called anymore.
|
|
53
|
+
*/
|
|
54
|
+
onSchemaErrorsChanged: (callback: (errors: ValidationError[]) => void) => () => void;
|
|
55
|
+
}
|
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
import { Items, SerializedJSONValue } from './utils';
|
|
2
|
-
import { FieldAPI } from './field-locale.types';
|
|
3
|
-
import { ContentTypeFieldValidation } from './entities';
|
|
4
|
-
import { ValidationError } from './validation-error';
|
|
5
|
-
export interface FieldInfo {
|
|
6
|
-
id: string;
|
|
7
|
-
locale: string;
|
|
8
|
-
type: string;
|
|
9
|
-
required: boolean;
|
|
10
|
-
validations: ContentTypeFieldValidation[];
|
|
11
|
-
items?: Items;
|
|
12
|
-
value: any;
|
|
13
|
-
isDisabled: boolean;
|
|
14
|
-
schemaErrors: ValidationError[];
|
|
15
|
-
}
|
|
16
|
-
export interface EntryFieldInfo {
|
|
17
|
-
id: string;
|
|
18
|
-
locales: string[];
|
|
19
|
-
type: string;
|
|
20
|
-
required: boolean;
|
|
21
|
-
validations: ContentTypeFieldValidation[];
|
|
22
|
-
items?: Items;
|
|
23
|
-
values: {
|
|
24
|
-
[locale: string]: any;
|
|
25
|
-
};
|
|
26
|
-
isDisabled: {
|
|
27
|
-
[locale: string]: boolean;
|
|
28
|
-
};
|
|
29
|
-
schemaErrors: {
|
|
30
|
-
[locale: string]: ValidationError[];
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
export interface EntryFieldAPI {
|
|
34
|
-
/** The ID of a field is defined in an entry's content type. */
|
|
35
|
-
id: string;
|
|
36
|
-
/** The list of locales for the field. */
|
|
37
|
-
locales: string[];
|
|
38
|
-
/** Holds the type of the field. */
|
|
39
|
-
type: string;
|
|
40
|
-
/** Indicates if a value for this field is required */
|
|
41
|
-
required: boolean;
|
|
42
|
-
/** A list of validations for this field that are defined in the content type. */
|
|
43
|
-
validations: ContentTypeFieldValidation[];
|
|
44
|
-
/** Defines the shape of array items */
|
|
45
|
-
items?: Items;
|
|
46
|
-
/** Gets the current value of the field and locale. */
|
|
47
|
-
getValue: (locale?: string) => any;
|
|
48
|
-
/** Sets the value for the field and locale. */
|
|
49
|
-
setValue: <Value = any>(value: Value, locale?: string) => Promise<SerializedJSONValue | undefined>;
|
|
50
|
-
/** Removes the value for the field and locale. */
|
|
51
|
-
removeValue: (locale?: string) => Promise<void>;
|
|
52
|
-
/** Calls the callback every time the value of the field is changed by an external event or when setValue() is called.
|
|
53
|
-
* the returned function can be called to remove the handler function
|
|
54
|
-
**/
|
|
55
|
-
onValueChanged: {
|
|
56
|
-
(callback: (value: any) => void): () => void;
|
|
57
|
-
(locale: string, callback: (value: any) => void): () => void;
|
|
58
|
-
};
|
|
59
|
-
/** Calls the callback when the disabled status of the field changes.
|
|
60
|
-
* the returned function can be called to remove the handler function
|
|
61
|
-
**/
|
|
62
|
-
onIsDisabledChanged: {
|
|
63
|
-
(callback: (isDisabled: boolean) => void): () => void;
|
|
64
|
-
(locale: string, callback: (isDisabled: boolean) => void): () => void;
|
|
65
|
-
};
|
|
66
|
-
/** Get an instance of FieldAPI for this field, specific to the locale that is
|
|
67
|
-
* passed as an argument
|
|
68
|
-
**/
|
|
69
|
-
getForLocale: (locale: string) => FieldAPI;
|
|
70
|
-
}
|
|
1
|
+
import { Items, SerializedJSONValue } from './utils';
|
|
2
|
+
import { FieldAPI } from './field-locale.types';
|
|
3
|
+
import { ContentTypeFieldValidation } from './entities';
|
|
4
|
+
import { ValidationError } from './validation-error';
|
|
5
|
+
export interface FieldInfo {
|
|
6
|
+
id: string;
|
|
7
|
+
locale: string;
|
|
8
|
+
type: string;
|
|
9
|
+
required: boolean;
|
|
10
|
+
validations: ContentTypeFieldValidation[];
|
|
11
|
+
items?: Items;
|
|
12
|
+
value: any;
|
|
13
|
+
isDisabled: boolean;
|
|
14
|
+
schemaErrors: ValidationError[];
|
|
15
|
+
}
|
|
16
|
+
export interface EntryFieldInfo {
|
|
17
|
+
id: string;
|
|
18
|
+
locales: string[];
|
|
19
|
+
type: string;
|
|
20
|
+
required: boolean;
|
|
21
|
+
validations: ContentTypeFieldValidation[];
|
|
22
|
+
items?: Items;
|
|
23
|
+
values: {
|
|
24
|
+
[locale: string]: any;
|
|
25
|
+
};
|
|
26
|
+
isDisabled: {
|
|
27
|
+
[locale: string]: boolean;
|
|
28
|
+
};
|
|
29
|
+
schemaErrors: {
|
|
30
|
+
[locale: string]: ValidationError[];
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export interface EntryFieldAPI {
|
|
34
|
+
/** The ID of a field is defined in an entry's content type. */
|
|
35
|
+
id: string;
|
|
36
|
+
/** The list of locales for the field. */
|
|
37
|
+
locales: string[];
|
|
38
|
+
/** Holds the type of the field. */
|
|
39
|
+
type: string;
|
|
40
|
+
/** Indicates if a value for this field is required */
|
|
41
|
+
required: boolean;
|
|
42
|
+
/** A list of validations for this field that are defined in the content type. */
|
|
43
|
+
validations: ContentTypeFieldValidation[];
|
|
44
|
+
/** Defines the shape of array items */
|
|
45
|
+
items?: Items;
|
|
46
|
+
/** Gets the current value of the field and locale. */
|
|
47
|
+
getValue: (locale?: string) => any;
|
|
48
|
+
/** Sets the value for the field and locale. */
|
|
49
|
+
setValue: <Value = any>(value: Value, locale?: string) => Promise<SerializedJSONValue | undefined>;
|
|
50
|
+
/** Removes the value for the field and locale. */
|
|
51
|
+
removeValue: (locale?: string) => Promise<void>;
|
|
52
|
+
/** Calls the callback every time the value of the field is changed by an external event or when setValue() is called.
|
|
53
|
+
* the returned function can be called to remove the handler function
|
|
54
|
+
**/
|
|
55
|
+
onValueChanged: {
|
|
56
|
+
(callback: (value: any) => void): () => void;
|
|
57
|
+
(locale: string, callback: (value: any) => void): () => void;
|
|
58
|
+
};
|
|
59
|
+
/** Calls the callback when the disabled status of the field changes.
|
|
60
|
+
* the returned function can be called to remove the handler function
|
|
61
|
+
**/
|
|
62
|
+
onIsDisabledChanged: {
|
|
63
|
+
(callback: (isDisabled: boolean) => void): () => void;
|
|
64
|
+
(locale: string, callback: (isDisabled: boolean) => void): () => void;
|
|
65
|
+
};
|
|
66
|
+
/** Get an instance of FieldAPI for this field, specific to the locale that is
|
|
67
|
+
* passed as an argument
|
|
68
|
+
**/
|
|
69
|
+
getForLocale: (locale: string) => FieldAPI;
|
|
70
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export type {
|
|
2
|
-
export type { AppConfigAPI, AppState, OnConfigureHandler, OnConfigureHandlerReturn, } from './app.types';
|
|
3
|
-
export type { DialogsAPI, EntityDialogOptions, OpenAlertOptions, OpenConfirmOptions, OpenCustomWidgetOptions, } from './dialogs.types';
|
|
4
|
-
export type { Asset, CanonicalRequest, ContentType, ContentTypeField, EditorInterface, Entry, Metadata, Role, ScheduledAction, SpaceMembership, Tag, TagVisibility, Task, Team, User, WorkflowDefinition, } from './entities';
|
|
5
|
-
export type { EntryAPI, TaskAPI, TaskInputData } from './entry.types';
|
|
6
|
-
export type { FieldInfo, EntryFieldInfo, EntryFieldAPI } from './field.types';
|
|
7
|
-
export type { FieldAPI } from './field-locale.types';
|
|
8
|
-
export type { NavigatorAPI, AppPageLocationOptions, NavigatorAPIOptions, NavigatorOpenResponse, NavigatorPageResponse, NavigatorSlideInfo, PageExtensionOptions, } from './navigator.types';
|
|
9
|
-
export type { SpaceAPI } from './space.types';
|
|
10
|
-
export type { SearchQuery, CollectionResponse, EntrySys, ContentEntitySys, ContentEntityType, Items, Link, WithOptionalId, WithId, SerializedJSONValue, } from './utils';
|
|
11
|
-
export type { DateRangeValidationError, InValidationError, LinkContentTypeValidationError, LinkMimetypeGroupValidationError, NotResolvableValidationError, ProhibitRegexpValidationError, RangeValidationError, RegexpValidationError, RequiredValidationError, SizeValidationError, TypeValidationError, UniqueValidationError, UnknownValidationError, ValidationError, } from './validation-error';
|
|
12
|
-
export type { WindowAPI } from './window.types';
|
|
13
|
-
export type { CMAClient } from './cmaClient.types';
|
|
1
|
+
export type { AppExtensionSDK, BaseExtensionSDK, DialogExtensionSDK, EditorExtensionSDK, FieldExtensionSDK, HomeExtensionSDK, KnownSDK, PageExtensionSDK, SidebarExtensionSDK, ConfigAppSDK, BaseAppSDK, DialogAppSDK, EditorAppSDK, FieldAppSDK, HomeAppSDK, KnownAppSDK, PageAppSDK, SidebarAppSDK, AccessAPI, ArchiveableAction, ConnectMessage, ContentTypeAPI, CrudAction, EditorLocaleSettings, IdsAPI, LocalesAPI, LocationAPI, Locations, NotifierAPI, ParametersAPI, PublishableAction, SharedEditorSDK, UserAPI, JSONPatchItem, } from './api.types';
|
|
2
|
+
export type { AppConfigAPI, AppState, OnConfigureHandler, OnConfigureHandlerReturn, } from './app.types';
|
|
3
|
+
export type { DialogsAPI, EntityDialogOptions, OpenAlertOptions, OpenConfirmOptions, OpenCustomWidgetOptions, } from './dialogs.types';
|
|
4
|
+
export type { Asset, CanonicalRequest, ContentType, ContentTypeField, EditorInterface, Entry, Metadata, Role, ScheduledAction, SpaceMembership, Tag, TagVisibility, Task, Team, User, WorkflowDefinition, } from './entities';
|
|
5
|
+
export type { EntryAPI, TaskAPI, TaskInputData } from './entry.types';
|
|
6
|
+
export type { FieldInfo, EntryFieldInfo, EntryFieldAPI } from './field.types';
|
|
7
|
+
export type { FieldAPI } from './field-locale.types';
|
|
8
|
+
export type { NavigatorAPI, AppPageLocationOptions, NavigatorAPIOptions, NavigatorOpenResponse, NavigatorPageResponse, NavigatorSlideInfo, PageExtensionOptions, } from './navigator.types';
|
|
9
|
+
export type { SpaceAPI } from './space.types';
|
|
10
|
+
export type { SearchQuery, CollectionResponse, EntrySys, ContentEntitySys, ContentEntityType, Items, Link, WithOptionalId, WithId, SerializedJSONValue, } from './utils';
|
|
11
|
+
export type { DateRangeValidationError, InValidationError, LinkContentTypeValidationError, LinkMimetypeGroupValidationError, NotResolvableValidationError, ProhibitRegexpValidationError, RangeValidationError, RegexpValidationError, RequiredValidationError, SizeValidationError, TypeValidationError, UniqueValidationError, UnknownValidationError, ValidationError, } from './validation-error';
|
|
12
|
+
export type { WindowAPI } from './window.types';
|
|
13
|
+
export type { CMAClient } from './cmaClient.types';
|