import { Dictionary as ContextDictionary, ConnectorConfigOptions as GenericConnectorConfigOptions, ConnectorConfigValue as GenericConnectorConfigValue, QueryPage as QueryResult } from '../../../connector-types/src'; import { Id } from './CommonTypes'; export type { FilePointer, QueryOptions } from '../../../connector-types/src'; export declare enum DeprecatedMediaType { file = 0, collection = 1 } export declare enum DeprecatedMediaConnectorDownloadType { LowResolutionWeb = "lowresWeb", HighResolutionWeb = "highresWeb" } export declare enum MediaType { file = "file", collection = "collection" } export declare enum ConnectorType { media = "media", fonts = "fonts", data = "data", /** * @experimental This is still experimental and might change in future releases. */ components = "components" } export declare enum SortBy { name = "name", path = "relativePath", id = "id" } export declare enum SortOrder { ascending = "asc", descending = "desc" } export declare enum ConnectorConfigValueType { text = "text", boolean = "boolean", number = "number" } export declare enum ConnectorConfigContextType { query = "query", upload = "upload" } export type ConnectorConfigValue = GenericConnectorConfigValue; export type ConnectorConfigOptions = GenericConnectorConfigOptions; interface ConnectorRegistrationBase { /** * Url to the connector. * * - If source is `url`, this must be a publicly accessible url. * * - If source is `grafx`, this must be the full url to the connector GET endpoint on GraFx Environment API. */ url: string; /** * Connector source type. */ source: ConnectorRegistrationSource; } export interface ConnectorUrlRegistration extends ConnectorRegistrationBase { source: ConnectorRegistrationSource.url; } export interface ConnectorGrafxRegistration extends ConnectorRegistrationBase { source: ConnectorRegistrationSource.grafx; } export interface ConnectorLocalRegistration extends ConnectorRegistrationBase { source: ConnectorRegistrationSource.local; } export type ConnectorRegistration = ConnectorUrlRegistration | ConnectorGrafxRegistration | ConnectorLocalRegistration; export type ConnectorInstance = { id: Id; name: string; iconUrl: string; source: ConnectorRegistration; }; export declare enum ConnectorRegistrationSource { /** * Connector is hosted on a publicly accessible link. */ url = "url", /** * Connector is hosted on GraFx Environment API. */ grafx = "grafx", /** * Connector is embedded in the document. * Note: This is a temporary type; only to be used internally. */ local = "local" } export interface EngineToConnectorMapping { name: string; value: ContextDictionary[keyof ContextDictionary]; id?: Id; sourceField?: string; type: ConnectorMappingSource; direction: ConnectorMappingDirection.engineToConnector; } export interface ConnectorToEngineMapping { name: string; /** @deprecated Use id instead. This property holds a string representation of the id in the form: var. */ value: string; id?: Id; type: ConnectorMappingSource.variable; direction: ConnectorMappingDirection.connectorToEngine; } export type ConnectorMappingType = EngineToConnectorMapping | ConnectorToEngineMapping; export declare class ConnectorMapping implements EngineToConnectorMapping, ConnectorToEngineMapping { name: string; value: any; sourceField?: string; direction: any; type: any; id?: Id; constructor(contextProperty: string, mapFrom: ConnectorMappingSource.variable, sourceValue: string, direction: ConnectorMappingDirection.connectorToEngine); constructor(contextProperty: string, mapFrom: ConnectorMappingSource, sourceValue: string | boolean | number, direction?: ConnectorMappingDirection.engineToConnector, sourceField?: string); constructor(contextProperty: string, mapFrom: ConnectorMappingSource, sourceValue: string | boolean | number); } export type ConnectorState = { id: Id; type: ConnectorStateType; }; export type ConnectorEvent = { id: Id; type: ConnectorEventType; }; export type QueryPage = Omit, 'links'> & { nextPageToken?: string; }; export declare enum ConnectorMappingSource { variable = "var", value = "value" } /** * Direction of the Connector Mapping. */ export declare enum ConnectorMappingDirection { /** * Indicates the mapping will propagate a value to the connector. This * mapping might cause the linked connector to refresh. */ engineToConnector = "engineToConnector", /** * Indicates the mapping will propagate a value from inside the connector * to the engine. AKA "reverse mapping". */ connectorToEngine = "connectorToEngine" } export declare enum ConnectorStateType { /** * Connector loading process has started. * Any SDK methods that required the connector id, will start working now. */ loading = "loading", /** * Connector loading completed. */ loaded = "loaded", /** * Connector is running in QuickJS. */ running = "running", /** * Connector is fully configured and has the correct authentication information. * At this point the connector is ready to make requests. */ ready = "ready", /** * Something went wrong, the connector is in error state. * Check the error message for more information. */ error = "error" } export declare enum ConnectorEventType { /** * This event will be triggered by the following state changes of the connector * - loading * - loaded * - running * - ready * - error */ stateChanged = "stateChanged", /** * Authentication information is changed */ authChanged = "authChanged", /** * Connector configuration changed that requires the connector to be reloaded in QuickJS. * This will trigger multiple 'stateChanged' events while it is reloading. * Wait until 'ready'-stateChanged event is received to start using the connector again. */ reloadRequired = "reloadRequired", /** * Connector is unregistered and no longer exists inside the editor engine. * Don't use the 'connectorId' after receiving this event. */ unloaded = "unloaded" } /** * Hardcoded grafx media connector until we get it from the environment. */ export declare const grafxMediaConnectorRegistration: ConnectorLocalRegistration; /** * Grafx token to return to the engine when it expires. */ export declare class GrafxTokenAuthCredentials { token: string; type: AuthCredentialsTypeEnum; /** * Optional HTTP headers to send with connector requests (e.g. Authorization). */ headers?: Record; constructor(token: string, headers?: Record); } /** * Notification to return to the engine whenever a 3rd party auth (user impersonation) * has been renewed by the integration. */ export declare class RefreshedAuthCredendentials { type: AuthCredentialsTypeEnum; /** * Optional HTTP headers to send with connector requests (e.g. Authorization). */ headers?: Record; constructor(headers?: Record); } export declare enum AuthCredentialsTypeEnum { grafxToken = "grafxToken", refreshed = "refreshed" } export type AuthCredentials = GrafxTokenAuthCredentials | RefreshedAuthCredendentials; export declare enum AuthRefreshTypeEnum { grafxToken = "grafxToken", any = "any" } export type GrafxAuthRefreshRequest = { type: AuthRefreshTypeEnum.grafxToken; }; /** * @param connectorId connector id * @param remoteConnectorId remote connector id * @param headerValue the value of the X-GRAFX-UNAUTHORIZED header. This * will notify that the dam authentication expired if it went through the * proxy. * Example: "Static, 1234", "OAuthClientCredentials, 5678" * If the http request did not go through the proxy, headerValue is null. */ export type AnyAuthRefreshRequest = { type: AuthRefreshTypeEnum.any; connectorId: Id; remoteConnectorId: Id; headerValue: string | null; connectorDefinition: ConnectorDefinition; }; export type AuthRefreshRequest = GrafxAuthRefreshRequest | AnyAuthRefreshRequest; export type ConnectorOptions = ContextDictionary; export type MetaData = ContextDictionary; export type UploadValidationConfiguration = { minWidthPixels?: number | null; maxWidthPixels?: number | null; minHeightPixels?: number | null; maxHeightPixels?: number | null; mimeTypes?: string[]; }; export declare enum UploadAssetValidationErrorType { minDimension = "minDimension" } export declare class UploadAssetValidationError extends Error { type: UploadAssetValidationErrorType; constructor(message: string, type: UploadAssetValidationErrorType); } export declare enum ConnectorSupportedAuth { StaticKey = "staticKey", OAuth2ClientCredentials = "oAuth2ClientCredentials", OAuth2AuthorizationCode = "oAuth2AuthorizationCode", OAuth2ResourceOwnerPassword = "oAuth2ResourceOwnerPassword", OAuth2JwtBearer = "oAuth2JwtBearer", None = "none" } interface ConnectorDefinition { id: Id; name: string; type: ConnectorType; supportedAuthentication: { browser: ConnectorSupportedAuth[]; server: ConnectorSupportedAuth[]; }; externalSourceId?: string | null; }