import { NonNullablePaths } from '@wix/sdk-types'; /** An external database connection defines a connection between an external database and a Wix site. */ interface ExternalDatabaseConnection { /** * Name of the external database connection. * * An external database connection can connect to one or more external data collections or tables. These appear as `connectionName/dataCollectionId`. * @immutable * @minLength 1 * @maxLength 255 */ name?: string; /** * Base URL for accessing and managing data in the external database. For example: `https://example.com/my-external-database`. * Required for STANDALONE connection type. * @format WEB_URL */ endpoint?: string | null; /** * Settings specified to the external database connection as part of each request. * * These settings can relate to authentication, tenancy, or provide any other information necessary for processing a request. Their content and structure depend on the specific requirements of the external database's API. */ configuration?: Record | null; /** * Status of the external database connection. Includes whether the connection was established successfully, and if not, the reason for the failure. * @readonly */ connectionStatus?: ConnectionStatus; /** * Public key used to validate requests to the external database. * @readonly * @maxLength 128 */ publicKey?: string | null; /** * Capabilities of the external database. * @readonly */ capabilities?: Capabilities; } declare enum CauseOfFailure { /** No connection failure. */ NONE = "NONE", /** General communication failure. */ COMMUNICATION_FAILURE = "COMMUNICATION_FAILURE", /** External database host is unreachable. */ DESTINATION_HOST_UNREACHABLE = "DESTINATION_HOST_UNREACHABLE", /** Unauthorized to access the external database. */ UNAUTHORIZED = "UNAUTHORIZED", /** `endpoint` is not set. */ DESTINATION_ENDPOINT_NOT_DEFINED = "DESTINATION_ENDPOINT_NOT_DEFINED" } /** @enumType */ type CauseOfFailureWithLiterals = CauseOfFailure | 'NONE' | 'COMMUNICATION_FAILURE' | 'DESTINATION_HOST_UNREACHABLE' | 'UNAUTHORIZED' | 'DESTINATION_ENDPOINT_NOT_DEFINED'; declare enum CollectionsFound { /** Attempt to connect to the external database failed, so status is unknown. */ UNKNOWN = "UNKNOWN", /** External database has collections. */ YES = "YES", /** External database does not have any collections. */ NO = "NO" } /** @enumType */ type CollectionsFoundWithLiterals = CollectionsFound | 'UNKNOWN' | 'YES' | 'NO'; declare enum FieldType { TEXT = "TEXT", NUMBER = "NUMBER", DATE = "DATE", DATETIME = "DATETIME", IMAGE = "IMAGE", BOOLEAN = "BOOLEAN", DOCUMENT = "DOCUMENT", URL = "URL", RICH_TEXT = "RICH_TEXT", VIDEO = "VIDEO", ANY = "ANY", ARRAY_STRING = "ARRAY_STRING", ARRAY_DOCUMENT = "ARRAY_DOCUMENT", AUDIO = "AUDIO", TIME = "TIME", LANGUAGE = "LANGUAGE", RICH_CONTENT = "RICH_CONTENT", MEDIA_GALLERY = "MEDIA_GALLERY", ADDRESS = "ADDRESS", PAGE_LINK = "PAGE_LINK", REFERENCE = "REFERENCE", MULTI_REFERENCE = "MULTI_REFERENCE", OBJECT = "OBJECT", ARRAY = "ARRAY", /** Deprecated - can’t be added to collections. Can only appear in older collections. */ LEGACY_TIME = "LEGACY_TIME", /** Deprecated - can’t be added to collections. Can only appear in older collections. */ LEGACY_BOOK = "LEGACY_BOOK", /** Deprecated - can’t be added to collections. Can only appear in older collections. */ LEGACY_EXTERNAL_URL = "LEGACY_EXTERNAL_URL", /** Deprecated - can’t be added to collections. Can only appear in older collections. */ LEGACY_BROKEN_REFERENCE = "LEGACY_BROKEN_REFERENCE", /** Deprecated - can’t be added to collections. Can only appear in older collections. */ LEGACY_IMAGE = "LEGACY_IMAGE", /** Deprecated - can’t be added to collections. Can only appear in older collections. */ LEGACY_COLOR = "LEGACY_COLOR", /** Deprecated - can’t be added to collections. Can only appear in older collections. */ LEGACY_EXTERNAL_VIDEO = "LEGACY_EXTERNAL_VIDEO" } /** @enumType */ type FieldTypeWithLiterals = FieldType | 'TEXT' | 'NUMBER' | 'DATE' | 'DATETIME' | 'IMAGE' | 'BOOLEAN' | 'DOCUMENT' | 'URL' | 'RICH_TEXT' | 'VIDEO' | 'ANY' | 'ARRAY_STRING' | 'ARRAY_DOCUMENT' | 'AUDIO' | 'TIME' | 'LANGUAGE' | 'RICH_CONTENT' | 'MEDIA_GALLERY' | 'ADDRESS' | 'PAGE_LINK' | 'REFERENCE' | 'MULTI_REFERENCE' | 'OBJECT' | 'ARRAY' | 'LEGACY_TIME' | 'LEGACY_BOOK' | 'LEGACY_EXTERNAL_URL' | 'LEGACY_BROKEN_REFERENCE' | 'LEGACY_IMAGE' | 'LEGACY_COLOR' | 'LEGACY_EXTERNAL_VIDEO'; interface ConnectionStatus { /** Whether the connection was established successfully. */ successful?: boolean; /** Whether and why the connection attempt failed. */ causeOfFailure?: CauseOfFailureWithLiterals; /** * Whether the external database has collections. * @readonly */ hasCollections?: CollectionsFoundWithLiterals; } declare enum ProtocolVersion { V1 = "V1", V2 = "V2", V3 = "V3" } /** @enumType */ type ProtocolVersionWithLiterals = ProtocolVersion | 'V1' | 'V2' | 'V3'; interface Capabilities { /** Whether the external database supports creating new collections, updating the structure of existing collections, or deleting them. */ collectionModificationsSupported?: boolean; /** * Field types the external database supports. Applies only when `collectionModificationsSupported` is set to `true`. * @maxSize 255 */ fieldTypes?: FieldTypeWithLiterals[]; } interface GetExternalDatabaseConnectionRequest { /** * Name of the external database connection to retrieve. * @maxLength 255 */ name: string; } interface GetExternalDatabaseConnectionResponse { /** Details of the retrieved external database connection. */ externalDatabaseConnection?: ExternalDatabaseConnection; } interface ListExternalDatabaseConnectionsRequest { /** Paging metadata. */ paging?: Paging; } interface Paging { /** Number of items to load. */ limit?: number | null; /** Number of items to skip in the current sort order. */ offset?: number | null; } interface ListExternalDatabaseConnectionsResponse { /** List of external database connections. */ externalDatabaseConnections?: ExternalDatabaseConnection[]; /** Paging metadata. */ pagingMetadata?: PagingMetadata; } interface PagingMetadata { /** Number of items returned in the response. */ count?: number | null; /** Offset that was requested. */ offset?: number | null; /** Total number of items that match the query. */ total?: number | null; /** Flag that indicates the server failed to calculate the `total` field. */ tooManyToCount?: boolean | null; } interface CreateExternalDatabaseConnectionRequest { /** External database connection details. */ externalDatabaseConnection: ExternalDatabaseConnection; /** Connection type. The connection type specifies the type of adaptor by which the external collection is integrated with the site. */ connectionType: ConnectionTypeWithLiterals; } declare enum ConnectionType { /** External database connection based on the legacy [external database collection service plugin](https://dev.wix.com/docs/velo/api-reference/wix-data-v2/service-plugins-spis/external-database-collection-legacy/introduction). */ STANDALONE = "STANDALONE", /** External database connection based on the [external database service plugin](https://dev.wix.com/docs/rest/business-solutions/cms/service-plugins/external-database-service-plugin/introduction). */ WIX_SERVICE_PLUGIN = "WIX_SERVICE_PLUGIN" } /** @enumType */ type ConnectionTypeWithLiterals = ConnectionType | 'STANDALONE' | 'WIX_SERVICE_PLUGIN'; interface CreateExternalDatabaseConnectionResponse { /** Details of the created external database connection. */ externalDatabaseConnection?: ExternalDatabaseConnection; } interface UpdateExternalDatabaseConnectionRequest { /** Updated external database connection. The existing connection is replaced with this version. */ externalDatabaseConnection: ExternalDatabaseConnection; } interface UpdateExternalDatabaseConnectionResponse { /** Details of the updated external database connection. */ externalDatabaseConnection?: ExternalDatabaseConnection; } interface DeleteExternalDatabaseConnectionRequest { /** * Name of the external database connection to delete. * @maxLength 255 */ name: string; } interface DeleteExternalDatabaseConnectionResponse { } interface DomainEvent extends DomainEventBodyOneOf { createdEvent?: EntityCreatedEvent; updatedEvent?: EntityUpdatedEvent; deletedEvent?: EntityDeletedEvent; actionEvent?: ActionEvent; /** Event ID. With this ID you can easily spot duplicated events and ignore them. */ _id?: string; /** * Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities. * For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`. */ entityFqdn?: string; /** * Event action name, placed at the top level to make it easier for users to dispatch messages. * For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`. */ slug?: string; /** ID of the entity associated with the event. */ entityId?: string; /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`. */ eventTime?: Date | null; /** * Whether the event was triggered as a result of a privacy regulation application * (for example, GDPR). */ triggeredByAnonymizeRequest?: boolean | null; /** If present, indicates the action that triggered the event. */ originatedFrom?: string | null; /** * A sequence number that indicates the order of updates to an entity. For example, if an entity was updated at 16:00 and then again at 16:01, the second update will always have a higher sequence number. * You can use this number to make sure you're handling updates in the right order. Just save the latest sequence number on your end and compare it to the one in each new message. If the new message has an older (lower) number, you can safely ignore it. */ entityEventSequence?: string | null; } /** @oneof */ interface DomainEventBodyOneOf { createdEvent?: EntityCreatedEvent; updatedEvent?: EntityUpdatedEvent; deletedEvent?: EntityDeletedEvent; actionEvent?: ActionEvent; } interface EntityCreatedEvent { entity?: string; } interface RestoreInfo { deletedDate?: Date | null; } interface EntityUpdatedEvent { /** * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff. * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects. * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it. */ currentEntity?: string; } interface EntityDeletedEvent { /** Entity that was deleted. */ deletedEntity?: string | null; } interface ActionEvent { body?: string; } interface MessageEnvelope { /** * App instance ID. * @format GUID */ instanceId?: string | null; /** * Event type. * @maxLength 150 */ eventType?: string; /** The identification type and identity data. */ identity?: IdentificationData; /** Stringify payload. */ data?: string; /** Details related to the account */ accountInfo?: AccountInfo; } interface IdentificationData extends IdentificationDataIdOneOf { /** * ID of a site visitor that has not logged in to the site. * @format GUID */ anonymousVisitorId?: string; /** * ID of a site visitor that has logged in to the site. * @format GUID */ memberId?: string; /** * ID of a Wix user (site owner, contributor, etc.). * @format GUID */ wixUserId?: string; /** * ID of an app. * @format GUID */ appId?: string; /** @readonly */ identityType?: WebhookIdentityTypeWithLiterals; } /** @oneof */ interface IdentificationDataIdOneOf { /** * ID of a site visitor that has not logged in to the site. * @format GUID */ anonymousVisitorId?: string; /** * ID of a site visitor that has logged in to the site. * @format GUID */ memberId?: string; /** * ID of a Wix user (site owner, contributor, etc.). * @format GUID */ wixUserId?: string; /** * ID of an app. * @format GUID */ appId?: string; } declare enum WebhookIdentityType { UNKNOWN = "UNKNOWN", ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR", MEMBER = "MEMBER", WIX_USER = "WIX_USER", APP = "APP" } /** @enumType */ type WebhookIdentityTypeWithLiterals = WebhookIdentityType | 'UNKNOWN' | 'ANONYMOUS_VISITOR' | 'MEMBER' | 'WIX_USER' | 'APP'; interface AccountInfo { /** * ID of the Wix account associated with the event. * @format GUID */ accountId?: string | null; /** * ID of the parent Wix account. Only included when accountId belongs to a child account. * @format GUID */ parentAccountId?: string | null; /** * ID of the Wix site associated with the event. Only included when the event is tied to a specific site. * @format GUID */ siteId?: string | null; } /** * Retrieves the specified external database connection. * @param name - Name of the external database connection to retrieve. * @public * @requiredField name * @permissionId WIX_DATA.GET_EXTERNAL_DATABASE_CONNECTION * @applicableIdentity APP * @returns Details of the retrieved external database connection. * @fqn com.wixpress.cloud.data.api.externaldatabase.ExternalDatabaseConnectionService.GetExternalDatabaseConnection */ declare function getExternalDatabaseConnection(name: string): Promise>; /** * Lists all of the site's external database connections of all adaptor types. * @public * @permissionId WIX_DATA.LIST_EXTERNAL_DATABASE_CONNECTIONS * @applicableIdentity APP * @fqn com.wixpress.cloud.data.api.externaldatabase.ExternalDatabaseConnectionService.ListExternalDatabaseConnections */ declare function listExternalDatabaseConnections(options?: ListExternalDatabaseConnectionsOptions): Promise>; interface ListExternalDatabaseConnectionsOptions { /** Paging metadata. */ paging?: Paging; } /** * Creates a new external database connection. * * Before you can establish a connection between a site and an external database, you must prepare an external database adaptor. * @param externalDatabaseConnection - External database connection details. * @param connectionType - Connection type. The connection type specifies the type of adaptor by which the external collection is integrated with the site. * @public * @requiredField connectionType * @requiredField externalDatabaseConnection * @requiredField externalDatabaseConnection.name * @param options - Options for creating an external database connection. * @permissionId WIX_DATA.CREATE_EXTERNAL_DATABASE_CONNECTION * @applicableIdentity APP * @returns Details of the created external database connection. * @fqn com.wixpress.cloud.data.api.externaldatabase.ExternalDatabaseConnectionService.CreateExternalDatabaseConnection */ declare function createExternalDatabaseConnection(externalDatabaseConnection: NonNullablePaths, connectionType: ConnectionTypeWithLiterals): Promise>; /** * Updates an external database connection. * * > **Note:** After an external database connection is updated, it only contains the values provided in the request. All previous values are lost. * @param name - Name of the external database connection. * * An external database connection can connect to one or more external data collections or tables. These appear as `connectionName/dataCollectionId`. * @public * @requiredField externalDatabaseConnection * @requiredField name * @param options - Options for updating an external database connection. * @param externalDatabaseConnection - Updated external database connection details. The existing connection is replaced with this version. * @permissionId WIX_DATA.UPDATE_EXTERNAL_DATABASE_CONNECTION * @applicableIdentity APP * @returns Details of the updated external database connection. * @fqn com.wixpress.cloud.data.api.externaldatabase.ExternalDatabaseConnectionService.UpdateExternalDatabaseConnection */ declare function updateExternalDatabaseConnection(name: string, externalDatabaseConnection: UpdateExternalDatabaseConnection): Promise>; interface UpdateExternalDatabaseConnection { /** * Base URL for accessing and managing data in the external database. For example: `https://example.com/my-external-database`. * Required for STANDALONE connection type. * @format WEB_URL */ endpoint?: string | null; /** * Settings specified to the external database connection as part of each request. * * These settings can relate to authentication, tenancy, or provide any other information necessary for processing a request. Their content and structure depend on the specific requirements of the external database's API. */ configuration?: Record | null; /** * Status of the external database connection. Includes whether the connection was established successfully, and if not, the reason for the failure. * @readonly */ connectionStatus?: ConnectionStatus; /** * Public key used to validate requests to the external database. * @readonly * @maxLength 128 */ publicKey?: string | null; /** * Capabilities of the external database. * @readonly */ capabilities?: Capabilities; } /** * Deletes an external database connection. * * > **Note:** Once an external database connection is deleted, it can't be restored. To reconnect the database, create a new external database connection. * @param name - Name of the external database connection to delete. * @public * @requiredField name * @permissionId WIX_DATA.DELETE_EXTERNAL_DATABASE_CONNECTION * @applicableIdentity APP * @fqn com.wixpress.cloud.data.api.externaldatabase.ExternalDatabaseConnectionService.DeleteExternalDatabaseConnection */ declare function deleteExternalDatabaseConnection(name: string): Promise; export { type AccountInfo, type ActionEvent, type Capabilities, CauseOfFailure, type CauseOfFailureWithLiterals, CollectionsFound, type CollectionsFoundWithLiterals, type ConnectionStatus, ConnectionType, type ConnectionTypeWithLiterals, type CreateExternalDatabaseConnectionRequest, type CreateExternalDatabaseConnectionResponse, type DeleteExternalDatabaseConnectionRequest, type DeleteExternalDatabaseConnectionResponse, type DomainEvent, type DomainEventBodyOneOf, type EntityCreatedEvent, type EntityDeletedEvent, type EntityUpdatedEvent, type ExternalDatabaseConnection, FieldType, type FieldTypeWithLiterals, type GetExternalDatabaseConnectionRequest, type GetExternalDatabaseConnectionResponse, type IdentificationData, type IdentificationDataIdOneOf, type ListExternalDatabaseConnectionsOptions, type ListExternalDatabaseConnectionsRequest, type ListExternalDatabaseConnectionsResponse, type MessageEnvelope, type Paging, type PagingMetadata, ProtocolVersion, type ProtocolVersionWithLiterals, type RestoreInfo, type UpdateExternalDatabaseConnection, type UpdateExternalDatabaseConnectionRequest, type UpdateExternalDatabaseConnectionResponse, WebhookIdentityType, type WebhookIdentityTypeWithLiterals, createExternalDatabaseConnection, deleteExternalDatabaseConnection, getExternalDatabaseConnection, listExternalDatabaseConnections, updateExternalDatabaseConnection };