import { AdlsPluginV1 as AdlsPlugin, AthenaPluginV1 as AthenaPlugin, CosmosDbPluginV1 as CosmosDbPlugin, CouchbasePluginV1 as CouchbasePlugin, DatabricksPluginV1 as DatabricksPlugin, KafkaV1 as KafkaPlugin, KinesisPluginV1 as KinesisPlugin, OracleDbPluginV1 as OracleDbPlugin, PluginCommonV1 as PluginCommon, RedisPluginV1 as RedisPlugin, SalesforcePluginV1 as SalesforcePlugin, SmtpPluginV1 as SmtpPlugin } from '@superblocksteam/types';
import { SecretsV1 as Secrets } from '@superblocksteam/types';
import { Property } from '../common/property.js';
import { Plugin, PluginMetadata } from '../plugin/index.js';
import { CreatorDto } from '../rbac/index.js';
import { AWSAuthType, AuthConfig, AuthId, AuthType, IntegrationAuthType } from './auth.js';
export { PluginCommonV1 as PluginCommon } from '@superblocksteam/types';
export declare class DatasourceDto {
    id: string;
    name: string;
    pluginId: string;
    pluginName?: string;
    organizationId?: string;
    configuration?: DatasourceConfiguration;
    configurationProd?: DatasourceConfiguration;
    configurationStaging?: DatasourceConfiguration;
    configurationProfiles?: Record<string, DatasourceConfiguration>;
    isDefault?: boolean;
    creator?: CreatorDto;
    demoIntegrationId?: string;
    ownerEmail?: string;
    error?: string;
    constructor(datasource: DatasourceDto, ownerEmail?: string, configurationProfiles?: Record<string, DatasourceConfiguration>);
}
export declare class ViewDatasourceDto {
    id: string;
    name: string;
    pluginId: string;
    organizationId?: string;
    isDefault?: boolean;
    readOnly: boolean;
    ownerEmail?: string;
    constructor(datasource: DatasourceDto, readOnly: boolean, ownerEmail?: string);
}
export declare function getAuthIdFromConfig(integrationId: string, config: RestApiIntegrationDatasourceConfiguration): AuthId;
type TemporaryFields = {
    bindingFields?: string[];
};
export type DynamicWorkflowConfig = {
    enabled?: boolean;
    workflowId?: string;
};
export type BaseDatasourceConfiguration = PluginMetadata & {
    name?: string;
    dynamicWorkflowConfiguration?: DynamicWorkflowConfig;
    id?: string;
};
type DefaultDatasourceConfiguration = BaseDatasourceConfiguration;
type LanguageDatasourceConfiguration = DefaultDatasourceConfiguration;
interface DBAuthentication {
    authentication?: {
        custom?: {
            databaseName?: Property;
        };
        username?: string;
        password?: string;
    };
}
type DBDatasourceConfiguration = BaseDatasourceConfiguration & {
    endpoint?: {
        host?: string;
        /**
         * @type integer
         * @minimum 0
         * @maximum 65536
         */
        port?: number;
    };
};
interface DBConnection {
    connection?: {
        useSsl?: FakeBoolean;
        useSelfSignedSsl?: FakeBoolean;
        ca?: string;
        key?: string;
        cert?: string;
        mode?: 0;
    };
}
interface SSHTunnel {
    tunnel?: SSHAuthConfiguration;
}
export declare enum SharedSSHAuthMethod {
    PASSWORD = 0,
    PUB_KEY_RSA = 1,
    PUB_KEY_ED25519 = 2,
    USER_PRIVATE_KEY = 3
}
type SSHAuthConfiguration = PluginCommon.SSHConfiguration & {
    authMethod?: SharedSSHAuthMethod;
};
type AWSDatasourceConfiguration = BaseDatasourceConfiguration & {
    awsAuthType?: AWSAuthType;
    authentication?: {
        [key: string]: unknown;
        custom?: {
            region?: Property;
            accessKeyID?: Property;
            secretKey?: Property;
            iamRoleArn?: Property;
        };
    };
};
type BigqueryDatasourceConfiguration = BaseDatasourceConfiguration & {
    connectionType?: 'fields' | 'service-account-key' | IntegrationAuthType.OAUTH2_TOKEN_EXCHANGE;
    authTypeField?: string;
    authConfig?: {
        tokenUrl?: string;
        audience?: string;
        scope?: string;
        subjectTokenType?: string;
        subjectTokenSource?: string;
        subjectTokenSourceStaticToken?: string;
        workforcePoolId?: string;
        workforceProviderId?: string;
        projectId?: string;
        billingProjectNumber?: string;
    };
    authentication?: {
        custom?: {
            googleServiceAccount?: Property;
        };
    };
};
type GCSDatasourceConfiguration = BaseDatasourceConfiguration & {
    authentication?: {
        custom?: {
            googleServiceAccount?: Property;
        };
    };
};
type DynamoDBDatasourceConfiguration = AWSDatasourceConfiguration;
type EmailDatasourceConfiguration = BaseDatasourceConfiguration & {
    authentication?: {
        custom?: {
            apiKey?: Property;
            senderEmail?: Property;
            senderName?: Property;
        };
    };
    sendgridTemplateId?: string;
};
type SmtpDatasourceConfiguration = Pick<SmtpPlugin.Plugin, 'name' | 'connection' | 'dynamicWorkflowConfiguration'>;
export type AdlsDatasourceConfiguration = Pick<AdlsPlugin.Plugin, 'name' | 'connection' | 'dynamicWorkflowConfiguration'>;
type SuperblocksOcrDatasourceConfiguration = BaseDatasourceConfiguration & {
    microsoftComputerVisionApiKey?: string;
    microsoftComputerVisionResourceBaseUrl?: string;
};
export type AuthenticatedDatasourceConfig = BaseDatasourceConfiguration & {
    authConfig?: AuthConfig;
    authType?: AuthType;
};
export declare function isAuthenticatedDatasourceConfig(dc: DatasourceConfiguration): dc is AuthenticatedDatasourceConfig;
type AuthenticatedDatasourceConfigWithDynamicAuthType = BaseDatasourceConfiguration & {
    authConfig?: AuthConfig;
    authTypeField: string;
    [key: string]: string | AuthConfig | undefined;
};
export declare function isAuthenticatedDatasourceConfigWithDynamicAuthType(dc: DatasourceConfiguration): dc is AuthenticatedDatasourceConfigWithDynamicAuthType;
/**
 * Safely extracts the authType from an authenticated datasource configuration.
 * This function handles both direct authType fields and authTypeField references.
 *
 * @param dc - The datasource configuration
 * @returns The authType if available, undefined otherwise
 */
export declare function getAuthTypeFromConfig(dc: DatasourceConfiguration): AuthType | undefined;
export type GraphQLDatasourceConfiguration = AuthenticatedHttpDatasourceConfig & {
    path?: string;
};
type JavascriptDatasourceConfiguration = LanguageDatasourceConfiguration;
type MariaDBDatasourceConfiguration = DBDatasourceConfiguration & DBConnection & DBAuthentication & {
    connectionType?: 'fields' | 'url';
    connectionUrl?: string;
};
type MongoDBDatasourceConfiguration = DBDatasourceConfiguration & DBConnection & DBAuthentication & SSHTunnel;
type MySQLDatasourceConfiguration = DBDatasourceConfiguration & DBConnection & DBAuthentication & SSHTunnel & {
    connectionType?: 'fields' | 'url';
    connectionUrl?: string;
};
type FakeBoolean = boolean | string;
export type PostgresDatasourceConfiguration = DBDatasourceConfiguration & DBConnection & DBAuthentication & SSHTunnel & {
    connectionType?: 'fields' | 'url';
    connectionUrl?: string;
};
type CockroachDBDatasourceConfiguration = PostgresDatasourceConfiguration;
type PythonDatasourceConfiguration = LanguageDatasourceConfiguration;
type RedshiftDatasourceConfiguration = DBDatasourceConfiguration & DBConnection & {
    authentication?: {
        custom?: {
            databaseName?: Property;
            databaseSchema?: Property;
        };
        username?: string;
        password?: string;
    };
} & {
    connectionType?: 'fields' | 'url';
    connectionUrl?: string;
};
export type AuthenticatedHttpDatasourceConfig = AuthenticatedDatasourceConfig & {
    headers?: Property[];
    params?: Property[];
};
export type RestApiDatasourceConfiguration = AuthenticatedHttpDatasourceConfig & {
    urlBase?: string;
    AuthCodeExplanation?: string;
    FirebaseAlert?: string;
    HTTPBasicAlert?: string;
    'oauth-callback-alert'?: string;
    'oauth-connect-button'?: string;
    'oauth-revoke-shared-tokens-button'?: string;
    OAuth2PasswordAlert?: string;
    openApiSpecRef?: string;
    openApiTenantName?: string;
};
type OpenAiDatasourceConfiguration = BaseDatasourceConfiguration & {
    bearerToken: string;
    organizationId?: string;
};
export type RestApiIntegrationDatasourceConfiguration = RestApiDatasourceConfiguration;
type S3DatasourceConfiguration = AWSDatasourceConfiguration;
type SnowflakeDatasourceConfiguration = AuthenticatedDatasourceConfig & DBDatasourceConfiguration & DBConnection & {
    connectionType?: 'fields' | 'okta' | 'key-pair' | IntegrationAuthType.OAUTH2_TOKEN_EXCHANGE;
    authTypeField?: string;
    okta?: {
        authenticatorUrl?: string;
    };
    keyPair?: {
        privateKey: string;
        password?: string;
    };
    authentication?: {
        username?: string;
        password?: string;
        custom?: {
            databaseName?: Property;
            account?: Property;
            warehouse?: Property;
            schema?: Property;
            role?: Property;
        };
    };
};
type MsSqlDatasourceConfiguration = DBDatasourceConfiguration & DBConnection & DBAuthentication & {
    connectionType?: 'fields' | 'url';
    connectionUrl?: string;
};
type WorkflowDatasourceConfiguration = BaseDatasourceConfiguration;
type GoogleSheetsDatasourceConfiguration = RestApiDatasourceConfiguration;
type KafkaDatasourceConfiguration = {
    superblocksMetadata?: Partial<Pick<KafkaPlugin.SuperblocksMetadata, 'pluginVersion' | 'syncedFromProfileId'>>;
} & Pick<KafkaPlugin.Plugin, 'name' | 'cluster' | 'dynamicWorkflowConfiguration'>;
type KinesisDatasourceConfiguration = Pick<KinesisPlugin.Plugin, 'name' | 'connection' | 'dynamicWorkflowConfiguration'>;
type AthenaDatasourceConfiguration = Pick<AthenaPlugin.Plugin, 'name' | 'connection' | 'dynamicWorkflowConfiguration'>;
export type RedisDatasourceConfiguration = Pick<RedisPlugin.Plugin, 'name' | 'connection' | 'dynamicWorkflowConfiguration'>;
type SecretStore = {
    provider?: Secrets.Provider;
    ttl?: number;
    configurationId: string;
};
export type CosmosDbDatasourceConfiguration = Pick<CosmosDbPlugin.Plugin, 'name' | 'connection' | 'dynamicWorkflowConfiguration'>;
export type CouchbaseDatasourceConfiguration = Pick<CouchbasePlugin.Plugin, 'name' | 'connection' | 'tunnel' | 'dynamicWorkflowConfiguration'>;
type DatabricksDatasourceConfiguration = Pick<DatabricksPlugin.Plugin, 'name' | 'connection' | 'dynamicWorkflowConfiguration'> & AuthenticatedDatasourceConfig & {
    authTypeField?: string;
    oauthType?: IntegrationAuthType.OAUTH2_TOKEN_EXCHANGE;
};
export type LakebaseDatasourceConfiguration = {
    name?: string;
    connection?: {
        host?: string;
        port?: number;
        databaseName?: string;
        connectionType?: string;
        username?: string;
        password?: string;
        oauthClientId?: string;
        oauthClientSecret?: string;
        oauthWorkspaceUrl?: string;
    };
} & AuthenticatedDatasourceConfig & {
    authTypeField?: string;
    oauthType?: IntegrationAuthType.OAUTH2_TOKEN_EXCHANGE;
};
export type SnowflakePostgresDatasourceConfiguration = {
    name?: string;
    connection?: {
        host?: string;
        port?: number;
        databaseName?: string;
        username?: string;
        password?: string;
        useSelfSignedSsl?: boolean;
        ca?: string;
        key?: string;
        cert?: string;
    };
    connectionType?: 'fields' | 'url';
    connectionUrl?: string;
};
export type OracleDbDatasourceConfiguration = Pick<OracleDbPlugin.Plugin, 'name' | 'connection' | 'dynamicWorkflowConfiguration'> & {
    connectionType?: 'fields' | 'url';
    connectionUrl?: string;
};
export type SalesforceDatasourceConfiguration = AuthenticatedDatasourceConfig & {
    authTypeField?: string;
    authTypeOnBehalfOfToken?: string;
} & Pick<SalesforcePlugin.Plugin, 'name' | 'connection'>;
export type DatasourceConfiguration = (AthenaDatasourceConfiguration | BigqueryDatasourceConfiguration | CockroachDBDatasourceConfiguration | CosmosDbDatasourceConfiguration | DynamoDBDatasourceConfiguration | EmailDatasourceConfiguration | GCSDatasourceConfiguration | GraphQLDatasourceConfiguration | JavascriptDatasourceConfiguration | MariaDBDatasourceConfiguration | MongoDBDatasourceConfiguration | MySQLDatasourceConfiguration | OpenAiDatasourceConfiguration | PostgresDatasourceConfiguration | PythonDatasourceConfiguration | RedisDatasourceConfiguration | RedshiftDatasourceConfiguration | RestApiDatasourceConfiguration | RestApiIntegrationDatasourceConfiguration | S3DatasourceConfiguration | SnowflakeDatasourceConfiguration | SuperblocksOcrDatasourceConfiguration | WorkflowDatasourceConfiguration | MsSqlDatasourceConfiguration | GoogleSheetsDatasourceConfiguration | KafkaDatasourceConfiguration | SalesforceDatasourceConfiguration | SmtpDatasourceConfiguration | AdlsDatasourceConfiguration | OracleDbDatasourceConfiguration | DatabricksDatasourceConfiguration | LakebaseDatasourceConfiguration | SnowflakePostgresDatasourceConfiguration | CouchbaseDatasourceConfiguration | SecretStore) & TemporaryFields;
export type DatasourceConfigurationByType = {
    adls?: AdlsDatasourceConfiguration & TemporaryFields;
    aivenkafka?: KafkaDatasourceConfiguration & TemporaryFields;
    athena?: AthenaDatasourceConfiguration & TemporaryFields;
    bigquery?: BigqueryDatasourceConfiguration & TemporaryFields;
    cockroachdb?: CockroachDBDatasourceConfiguration & TemporaryFields;
    confluent?: KafkaDatasourceConfiguration & TemporaryFields;
    couchbase?: CouchbaseDatasourceConfiguration & TemporaryFields;
    databricks?: DatabricksDatasourceConfiguration & TemporaryFields;
    dynamodb?: DynamoDBDatasourceConfiguration & TemporaryFields;
    email?: EmailDatasourceConfiguration & TemporaryFields;
    gcs?: GCSDatasourceConfiguration & TemporaryFields;
    graphqlintegration?: GraphQLDatasourceConfiguration & TemporaryFields;
    graphql?: GraphQLDatasourceConfiguration & TemporaryFields;
    javascript?: JavascriptDatasourceConfiguration & TemporaryFields;
    lakebase?: LakebaseDatasourceConfiguration & TemporaryFields;
    mariadb?: MariaDBDatasourceConfiguration & TemporaryFields;
    mongodb?: MongoDBDatasourceConfiguration & TemporaryFields;
    msk?: KafkaDatasourceConfiguration & TemporaryFields;
    mysql?: MySQLDatasourceConfiguration & TemporaryFields;
    openai?: OpenAiDatasourceConfiguration & TemporaryFields;
    oracledb?: OracleDbDatasourceConfiguration & TemporaryFields;
    postgres?: PostgresDatasourceConfiguration & TemporaryFields;
    python?: PythonDatasourceConfiguration & TemporaryFields;
    redpanda?: KafkaDatasourceConfiguration & TemporaryFields;
    redshift?: RedshiftDatasourceConfiguration & TemporaryFields;
    restapi?: RestApiDatasourceConfiguration & TemporaryFields;
    restapiintegration?: RestApiIntegrationDatasourceConfiguration & TemporaryFields;
    s3?: S3DatasourceConfiguration & TemporaryFields;
    smtp?: SmtpDatasourceConfiguration & TemporaryFields;
    snowflake?: SnowflakeDatasourceConfiguration & TemporaryFields;
    snowflakecortex?: RestApiIntegrationDatasourceConfiguration & TemporaryFields;
    snowflakepostgres?: SnowflakePostgresDatasourceConfiguration & TemporaryFields;
    salesforce?: SalesforceDatasourceConfiguration & TemporaryFields;
    'superblocks-ocr'?: SuperblocksOcrDatasourceConfiguration & TemporaryFields;
    workflow?: WorkflowDatasourceConfiguration & TemporaryFields;
    mssql?: MsSqlDatasourceConfiguration & TemporaryFields;
    gsheets?: GoogleSheetsDatasourceConfiguration & TemporaryFields;
    kafka?: KafkaDatasourceConfiguration & TemporaryFields;
    kinesis?: KinesisDatasourceConfiguration & TemporaryFields;
};
export declare enum DatasourceEnvironments {
    PRODUCTION = "Production",
    STAGING = "Staging",// Only for V1 orgs, V2 orgs use DEV
    DEV = "Dev"
}
export declare const ENVIRONMENT_PRODUCTION = "production";
export declare const ENVIRONMENT_STAGING = "staging";
export declare const ENVIRONMENT_DEV = "dev";
export declare const ENVIRONMENT_ALL = "*";
export declare const VALID_DATASOURCE_ENVIRONMENTS: string[];
export type Integration = {
    datasource: DatasourceDto;
    plugin: Plugin;
};
export * from './auth.js';
export * from './metadata/index.js';
export * from './test.js';
//# sourceMappingURL=index.d.ts.map