() => { type: DestinationType.Destination; name: string; vendor: string; id_in_provider_system?: string or undefined; recipient_id?: string or undefined; use_ssh_tunnel?: boolean or undefined; ... 53 more ...; secondary_public_key?: string or undefined; }
getDefaultExistingDestination
Function
Type
getDefaultExistingDestination
() => { vendor: string; name: string; id_in_provider_system?: string or undefined; recipient_id?: string or undefined; frequency_minutes?: FrequencyMinutes or undefined; ... 33 more ...; updated_at: string; }
encodeCursor
Function
Type
encodeCursor
(c: PaginationCursor) => string
decodeCursor
Function
Type
decodeCursor
(s: string) => PaginationCursor
prepareDestinationWithForm
Function to prepare a destination using the given destination data and form.
This function takes a destination and an optional form, and returns a prepared destination
that includes the necessary updates and modifications from the form.
Function
Type
prepareDestinationWithForm
(d: Destination, f: Form or undefined) => PreparedDestination
Parameters:
d: - The destination data to be prepared.
f: - The optional form containing updates and modifications for the destination.
parseServiceAccountKey
Function to parse a service account key from a JSON string.
This function takes an optional JSON string representing a service account key
and returns the parsed service account key object. If the input string is
undefined or cannot be parsed, it returns undefined.
Function
Type
parseServiceAccountKey
(k?: string or undefined) => ServiceAccountKey or undefined
Parameters:
k: - The optional JSON string representing the service account key.
parseGcpIamRoleMetadata
Function to parse GCP IAM role metadata from a JSON string.
This function takes an optional JSON string representing GCP IAM role metadata
and returns the parsed metadata object. If the input string is undefined or cannot be parsed,
it returns undefined.
Function
Type
parseGcpIamRoleMetadata
(string?: string or undefined) => GcpExternalAccountMetadata or undefined
Parameters:
string: - The optional JSON string representing the GCP IAM role metadata.
prepareDestinationFromExisting
Function to prepare a destination from an existing destination.
This function takes an existing destination and transforms it into a new destination
object, ready for further processing or updates.
Function
Type
prepareDestinationFromExisting
(e: ExistingDestination) => Destination
Parameters:
e: - The existing destination to be transformed.
computeChangedFields
Function to compute the changed fields between an existing destination and a prepared destination.
This function takes an existing destination, a prepared destination, and an optional partial prepared destination.
It returns the fields that have changed between the existing and prepared destinations, optionally including additional changes.
d: - The prepared destination with potential changes.
useCreateDestination
Custom hook to create a new destination.
This hook returns an asynchronous function that creates a new destination
using the provided token, origin, and an optional host. It utilizes a token
fetched from a prepared destination.
This hook returns an asynchronous function that deletes an existing destination
using the provided token, origin, and an optional host. It utilizes a token
fetched from an existing destination.
This hook initializes the destination state with a default or provided initial state,
and returns the current destination state along with a function to update it partially.
Function
Type
useDestination
(initialState?: Partial<Destination> or undefined) => [Destination, Dispatch<SetStateAction<Partial<Destination>>>]
Parameters:
initialState: - Optional initial state to override the default destination state.
Custom hook to manage the state and behavior of a destination form.
This hook creates a form state for a given destination and organization ID,
with optional settings to include internal fields, specify a host, and provide
a vendor query.
Function
Type
useDestinationForm
(destination: Destination, orgId: string, options?: UseDestinationFormOptions or undefined) => Form
Parameters:
destination: - The destination for which the form is created.
orgId: - The organization ID associated with the form.
options: - Optional settings for the form behavior.
options.includeInternalFields: - Whether to include internal fields in the form.
options.host: - The host to which the form data is submitted.
options.vendorQuery: - A query string to filter vendors.
Examples:
import{useDestination,useDestinationForm}from"@prequel/react";const[destination,setDestination]=useDestination();constdestinationForm=useDestinationForm(destination,"your-prequel-org-uuid",);return(<div>{destinationForm.map((section)=>(// Render the section...{section.fields((field)=>(// Render the field...)}))}</div>);
useGetDestinations
Custom hook to fetch a list of destinations.
This hook returns an asynchronous function that retrieves a list of destinations
using the provided token, origin, and an optional host.
Custom hook to fetch the models available for a particular recipient.
This hook returns an asynchronous function that retrieves a list of models
using the provided token, origin, and an optional host. The models are scoped
to the Recipient ID that was declared when creating the token.
Custom hook to fetch a list of transfers for a given destination.
This hook returns an asynchronous function that retrieves a list of transfers
using the provided token, origin, destination, and optional host and parameters.
Function
Type
useGetTransfers
(fetchToken: FetchAuthTokenWithExistingDestination, origin: string, host?: string or undefined) => (destination: ExistingDestination, params?: GetTransfersParams or undefined) => Promise<...>
Parameters:
fetchToken: - A function to fetch the authentication token using an existing destination.
origin: - The origin from where the request is made.
host: - Optional host to which the request is made. If not provided, a default host will be used.
Examples:
import{useGetTransfers,TransferStatus}from"@prequel/react";// destination fetching elided...constgetTransfers=useGetTransfers(fetchToken,"app.example.co",PREQUEL_HOST);// Get all transfers for destinationconstallTransfers=getTransfers(destination);// Get transfers for destination with limitconstsomeTransfers=getTransfers(destination,{count: 5});// Get all transfers for destination with success statusconstsuccessfulTransfers=getTransfers(destination,{status: TransferStatus.SUCCESS});
useListTransfers
Custom hook to fetch a paginated list of transfers for a destination.
This hook returns an asynchronous function with optional pagination parameters
that fetches a list of transfers for the given destination alongside pagination
metadata using the provided token, origin, and an optional host.
Function
Type
useListTransfers
(fetchToken: FetchAuthToken, origin: string, host?: string or undefined) => (d: ExistingDestination, p?: ListResourceParameters or undefined) => Promise<...>
Parameters:
fetchToken: - A function that retrieves an authorization token to access the API.
origin: - The origin from where the request is made.
host: - Optional host to which the request is made. If not provided, a default host will be used.
useFetchResource
Function
Type
useFetchResource
<T>(fetchToken: FetchAuthToken, origin: string, url: string) => APIResponse<T> or undefined
useModels
Custom hook to fetch a list of models.
This hook returns the response containing a list of models
using the provided token, origin, and an optional host.
Function
Type
useModels
(fetchToken: FetchAuthToken, origin: string, host?: string or undefined) => ModelsResponse
Parameters:
fetchToken: - A function to fetch the authentication token.
origin: - The origin from where the request is made.
host: - Optional host to which the request is made. If not provided, a default host will be used.
(fetchToken: FetchAuthToken, origin: string, host?: string or undefined) => ProductsResponse
useDestinationVendors
Function
Type
useDestinationVendors
(host?: string or undefined) => DestinationVendorsResponse
useTestConnection
Custom hook to test the connection to a prepared destination.
This hook returns an asynchronous function that tests the connection
to a given prepared destination using the provided token, origin, and an optional host.
fetchToken: - A function to fetch the authentication token using a prepared destination.
origin: - The origin from where the request is made.
host: - Optional host to which the request is made. Defaults to PREQUEL_US if not provided.
Examples:
import{useTestConnection}from"@prequel/react";consttestConnection=useTestConnection(fetchToken,"app.example.co",PREQUEL_HOST);asyncfunctiontestDestinationConnection(){const{ data, status, message }=awaittestConnection(preparedDestination);if(response.status==="success"){// handle test success}else{// handle test failure}}
useTestExistingConnection
Custom hook to test the existing connection to a destination.
This hook returns an asynchronous function that tests the connection
between a given existing destination and a prepared destination.
It utilizes a token fetched from an existing destination.
fetchToken: - A function to fetch the authentication token using an existing destination.
origin: - The origin from where the request is made.
host: - Optional host to which the request is made. If not provided, a default host will be used.
useUpdateDestination
Custom hook to update an existing destination.
This hook returns an asynchronous function that updates an existing destination
with the provided changes using the given token, origin, and an optional host.
{ host: string; // The hostname of the MySQL server. port: number; // The port of the MySQL server. connection_database: string; // The name of the database to connect to. write_database: string; // The name of the database where final data will be written. auth_method: "password_auth"; // Placeholder value in case authentication options are added. Currently must be set to password_auth. password_auth: PasswordAuth; // Required details for username/password authentication. disable_ssl?: boolean; // Whether to disable SSL for the MySQL connection. } and SSHTunnelOptions
PostgresDestinationOptions
Type
Type
PostgresDestinationOptions
{ host: string; // The hostname of the PostgreSQL server. port: number; // The port of the PostgreSQL server. database: string; // The name of the database to connect to. schema: string; // The name of the schema to write to. auth_method: "password_auth"; // Placeholder value in case authentication options are added. Currently must be set to password_auth. password_auth: PasswordAuth; // Required details for username/password authentication. disable_ssl?: boolean; // Whether to disable SSL for the PostgreSQL connection. connection_timeout_in_seconds?: number; // Duration to wait for successful connection to Postgres } and SSHTunnelOptions
BigQueryDestinationOptions
Type
Type
BigQueryDestinationOptions
{ project_id: string; // The BigQuery project ID. schema: string; // The name of the schema to write to. auth_method: or "gcp_service_account_role" or "gcp_service_account_key" or "federated_gcp_service_account_role"; // The method of authentication to use for this destination. gcp_service_account_role?: GCPServiceAccountRole; // Required details if authenticating using a GCP service account role. federated_gcp_service_account_role?: FederatedGCPServiceAccountRole; gcp_service_account_key?: GCPServiceAccountKey; // Required details if authenticating using a GCP service account key. bucket_gcs: BigQueryGCSBucketParams; // Required details about the GCS bucket used for staging data. }
ClickhouseDestinationOptions
Type
Type
ClickhouseDestinationOptions
{ host: string; // The hostname of the ClickHouse server. port: number; // The port of the ClickHouse server. cluster?: string; // The name of the ClickHouse cluster to use for this destination. connection_database: string; // The name of the database to connect to. write_database: string; // The name of the database where final data will be written. auth_method: "password_auth"; // Placeholder value in case authentication options are added. Currently must be set to password_auth. password_auth: PasswordAuth; // Required details for username/password authentication. bucket_vendor: "bucket_s3" or "bucket_gcs" or "bucket_implicit"; // Where the staging bucket is hosted. bucket_s3?: ClickhouseS3BucketParams; // Required details about the S3 bucket used for staging data. bucket_gcs?: ClickhouseGCSBucketParams; // Required details about the GCS bucket used for staging data. disable_ssl?: boolean; // Whether to disable SSL for the ClickHouse connection. }
DatabricksDestinationOptions
Type
Type
DatabricksDestinationOptions
{ host: string; // The hostname of the Databricks server. port: number; // The port of the Databricks server. schema: string; // The name of the schema to write to. catalog: string; // The name of the catalog to write to. http_path: string; // The HTTP path to use for the Databricks connection. auth_method: "access_token_auth"; // Placeholder value in case authentication options are added. Currently must be set to access_token_auth. access_token_auth?: DatabricksAccessToken; // The access token authentication object. metastore: "hive" or "unity_catalog"; // The metastore configuration. hive?: DatabricksHiveOptions; // Optional Hive configuration. }
DatabricksAccessToken
Type
Type
DatabricksAccessToken
{ access_token: string; // The access token to use for the Databricks connection. }
DatabricksHiveOptions
Type
Type
DatabricksHiveOptions
{ bucket_vendor: string; // Where the staging bucket is hosted. bucket_s3?: DatabricksS3BucketParams; // Required details if using an S3 bucket for staging data. }
DatabricksS3BucketParams
Type
Type
DatabricksS3BucketParams
{ bucket_name: string; // The name of the S3 bucket. bucket_region: string; // The name of the S3 bucket region. aws_access_keys: AWSAccessKeys; // Required details if authenticating using AWS access keys. }
GCSDestinationOptions
Type
Type
GCSDestinationOptions
{ folder: string; // The folder to write to. The folder will be created if it does not exist. bucket_name: string; // Required details about the GCS bucket used for staging data. auth_method: "gcp_service_account_role" or "gcs_hmac_keys"; // The method of authentication to use for this destination. gcp_service_account_role?: GCPServiceAccountRole; // Required details if authenticating using a GCP service account role. gcs_hmac_keys?: GCSAccessKeys; // Required details if authenticating using GCS HMAC keys. }
MongoDBDestinationOptions
Type
Type
MongoDBDestinationOptions
{ host: string; // The hostname of the MongoDB server. port: number; // The port of the MongoDB server. authentication_database: string; // The name of the MongoDB Authentication Database. write_database: string; // The name of the MongoDB database to write to. auth_method: "aws_iam_role" or "password_auth"; // The method of authentication to use for this destination. aws_iam_role?: AWSIAMRole; // Required details if authenticating using an AWS IAM role. password_auth?: PasswordAuth; // Required details if authenticating with username/password. disable_ssl?: boolean; // Whether to disable SSL for the MongoDB connection. } and SSHTunnelOptions
RedshiftDestinationOptions
Type
Type
RedshiftDestinationOptions
{ host: string; // The hostname of the Redshift server. port: number; // The port of the Redshift server. database: string; // The name of the database to connect to. schema: string; // The name of the schema to write to. cluster?: string; // The name of the Redshift cluster to connect to. username: string; // The name of the Redshift user to connect as. auth_method: "aws_iam_role" or "aws_access_keys"; // Placeholder value in case authentication options are added. Currently must be set to password_auth. aws_iam_role?: AWSIAMRole; // Required details if authenticating using an AWS IAM role. aws_access_keys?: RedshiftAccessKeys; // Required details if authenticating using AWS access keys. bucket_s3: RedshiftS3BucketParams; // Required details about the S3 bucket used for staging data. }
RedshiftServerlessDestinationOptions
Type
Type
RedshiftServerlessDestinationOptions
{ workgroup: string; // The name of the Redshift Serverless workgroup. host: string; // The hostname to use to connect. port: number; // The port to use to connect. database: string; // The name of the database to connect to. schema: string; // The name of the schema to write to. auth_method: "aws_iam_role" or "aws_access_keys"; aws_iam_role?: AWSIAMRole; // Required details if authenticating using an AWS IAM role. aws_access_keys?: AWSAccessKeys; // Required details if authenticating using AWS access keys. bucket_s3: RedshiftS3BucketParams; // Required details about the S3 bucket used for staging data. }
SFTPDestinationOptions
Type
Type
SFTPDestinationOptions
{ username: string; // The username to use for the SFTP connection. host: string; // The hostname of the SFTP server. port: number; // The port of the SFTP server. folder: string; // The folder to write to. The folder will be created if it does not exist. file_format: "csv"; // Placeholder representing the format of the files to write to the SFTP server. Currently must be set to CSV. csv: FileFormatCSV; // Required details for writing CSV file format. auth_method: "public_key_auth"; // Placeholder value in case authentication options are added. Currently must be set to public_key_auth. public_key_auth: PublicKeyAuth; // Required details for public key authentication. }
SnowflakeDestinationOptions
Type
Type
SnowflakeDestinationOptions
{ host: string; // The hostname of the Snowflake server. port: number; // The port of the Snowflake server. database: string; // The name of the database to connect to. schema: string; // The name of the schema to write to. auth_method: "password_auth"; // Placeholder value in case authentication options are added. Currently must be set to password_auth. password_auth: PasswordAuth; // Required details for username/password authentication. }
S3DestinationOptions
Type
Type
S3DestinationOptions
{ folder: string; // The folder to write to. The folder will be created if it does not exist. bucket_name: string; // The name of the S3 bucket. bucket_region: string; // The name of the S3 bucket region. auth_method: "aws_iam_role" or "aws_access_keys"; // The method of authentication to use for this destination. aws_iam_role?: AWSIAMRole; // Required details if authenticating using an AWS IAM role. aws_access_keys?: AWSAccessKeys; // Required details if authenticating using AWS access keys. }
S3CompatibleDestinationOptions
Type
Type
S3CompatibleDestinationOptions
{ host: string; // The hostname of the S3-compatible server. folder: string; // The folder to write to. The folder will be created if it does not exist. bucket_name: string; // The name of the S3-compatible bucket to write to. disable_ssl?: boolean; // Whether to disable SSL for the S3-compatible connection. auth_method: "access_keys"; // Placeholder value in case authentication options are added. Currently must be set to access_keys. access_keys: AccessKeys; // Required details for access key authentication. }
GoogleSheetsDestinationOptions
Type
Type
GoogleSheetsDestinationOptions
{ host: string; // The URL of the Google Sheet. }
OracleSSLOptions
Type
Type
OracleSSLOptions
{ wallet?: string; }
OracleDestinationOptions
Type
Type
OracleDestinationOptions
{ host: string; // The hostname of the MySQL server. port: number; // The port of the MySQL server. database: string; // The name of the database to connect to. schema: string; // The name of the database where final data will be written. auth_method: "password_auth"; // Placeholder value in case authentication options are added. Currently must be set to password_auth. password_auth: PasswordAuth; // Required details for username/password authentication. disable_ssl?: boolean; // Whether to disable SSL for the MySQL connection. ssl_options?: OracleSSLOptions; } and SSHTunnelOptions
{ service_account_email: string; // The email of the GCP service account to use for authentication. service_account_key?: ServiceAccountKey; // The full Google-generated JSON service account key object. }
S3BucketParams
Type
Type
S3BucketParams
{ bucket_name: string; // The name of the S3 bucket. bucket_region: string; // The name of the S3 bucket region. }
GCSBucketParams
Type
Type
GCSBucketParams
{ bucket_name: string; // The name of the GCS bucket. }
BigQueryGCSBucketParams
Type
Type
BigQueryGCSBucketParams
{ bucket_name: string; // The name of the GCS bucket. bucket_region: string; // The name of the GCS bucket region; }
GCSAccessKeys
Type
Type
GCSAccessKeys
{ access_key: string; // The access key to use for authentication secret: string; // The secret to use for authentication }
ClickhouseS3BucketParams
Type
Type
ClickhouseS3BucketParams
{ bucket_name: string; // The name of the S3 bucket. bucket_region: string; // The name of the S3 bucket region; aws_access_keys: AWSAccessKeys; // Required details for access key authentication. }
ClickhouseGCSBucketParams
Type
Type
ClickhouseGCSBucketParams
{ bucket_name: string; // The name of the GCS bucket. gcs_hmac_keys: GCSAccessKeys; // Required details for GCS HMAC key authentication. }
RedshiftS3BucketParams
Type
Type
RedshiftS3BucketParams
{ bucket_name: string; // The name of the S3 bucket. bucket_region: string; // The name of the S3 bucket region; }
{ delimiter: string; // The delimiter to use for the CSV file. Must be a single character. }
PasswordAuth
Type
Type
PasswordAuth
{ username: string; // The username to use for authentication. password?: string; // The password to use for authentication. }
AccessKeys
Type
Type
AccessKeys
{ access_id: string; // The access key ID to use for authentication. secret_key: string; // The secret key to use for authentication. }
PublicKeyAuth
Type
Type
PublicKeyAuth
{ public_key: string; // The public key to use for authentication. }
AWSIAMRole
Type
Type
AWSIAMRole
{ aws_iam_role_arn: string; // The ARN of the IAM role to use for authentication. }
AWSAccessKeys
Type
Type
AWSAccessKeys
{ access_id: string; // The access key ID to use for authentication. secret_key: string; // The secret key to use for authentication. }
GCPServiceAccountRole
Type
Type
GCPServiceAccountRole
{ service_account_email: string; // The email of the GCP service account to use for authentication. }
FederatedGCPServiceAccountRole
Type
Type
FederatedGCPServiceAccountRole
GCPServiceAccountRole and { workload_identity_federation_metadata?: GcpExternalAccountMetadata; // The federation metadata to use for authentication. }
{ use_ssh_tunnel: boolean; // Whether to use an SSH tunnel for the connection. ssh_tunnel?: SSHTunnelParams; // Required details if using SSH tunneling. }
SSHTunnelParams
Type
Type
SSHTunnelParams
{ ssh_tunnel_host: string; // The hostname of the SSH tunnel server. ssh_tunnel_port: number; // The port of the SSH tunnel server. ssh_tunnel_username: string; // The username to use for the SSH tunnel connection. ssh_public_key?: string; // The public key to use for the SSH tunnel connection. }
DestinationForm
Type
Type
DestinationForm
{ sections: Section[]; form: FormNode; }
Section
Type
Type
Section
{ id: number; title: string; subtitle: string or null; }
EnumObject
Type
Type
EnumObject
{ key: string or boolean or number; display: string; docs?: string; icon_url?: string; disabled?: boolean; }
KeyFormat
Type
Type
KeyFormat
ssh_rsa" or "pkcs8
FormNode
Type
Type
FormNode
{ parent: string or boolean; name: keyof Destination or "trust_policy" or "role" or "service_account"; required: boolean; type: "string" or "number" or "boolean" or "json"; enum?: EnumObject[]; const?: string or object; attributes: { section_id: number; internal: boolean; label: string; placeholder: string; description: string; form_element: "select" or "input" or "radio" or "textarea" or "div"; input_type?: "text" or "password" or "number"; key_format?: KeyFormat; }; children: FormNode[] or null; }
FormField
Type
Type
FormField
{ readonly prepared_destination_path: string; name: keyof Destination; required: boolean; type: "string" or "number" or "boolean" or "json"; label: string; description: string; placeholder: string; section_id: number; internal: boolean; const?: string or object; } and ( or { form_element: "input"; input_type: "text" or "password" or "number"; } or { form_element: "textarea"; } or { form_element: "radio"; enum: EnumObject[]; } or { form_element: "select"; enum?: EnumObject[]; } or { form_element: "div"; } )