"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PLUGIN_ID_TO_PROTO_ACTION_CONFIGURATION_OBJECT_CALLABLE = exports.PLUGIN_ID_TO_PROTO_DATASOURCE_CONFIGURATION_OBJECT_CALLABLE = exports.PLUGIN_ID_TO_PROTO_CLASS = exports.NULL_AS_STRING = exports.EMAIL_VERIFICATION_CODE_LENGTH = exports.DEFAULT_BRANCH = exports.DEFAULT_NON_GIT_BRANCH = exports.SUPERBLOCKS_LIVE_GIT_BRANCH = exports.SUPERBLOCKS_SESSION_ID_HEADER = exports.SUPERBLOCKS_EMBED_HEADER = exports.SUPERBLOCKS_AUTHORIZATION_HEADER = exports.SUPERBLOCKS_URL_HEADER = exports.SUPERBLOCKS_COMPONENT_EVENT_HEADER = exports.SUPERBLOCKS_CLI_VERSION_HEADER = exports.SUPERBLOCKS_REQUEST_ID_HEADER = void 0;
const types_1 = require("@superblocksteam/types");
const types_2 = require("@superblocksteam/types");
exports.SUPERBLOCKS_REQUEST_ID_HEADER = 'x-superblocks-request-id';
exports.SUPERBLOCKS_CLI_VERSION_HEADER = 'x-superblocks-cli-version';
exports.SUPERBLOCKS_COMPONENT_EVENT_HEADER = 'x-superblocks-component-event';
exports.SUPERBLOCKS_URL_HEADER = 'x-superblocks-url';
exports.SUPERBLOCKS_AUTHORIZATION_HEADER = 'x-superblocks-authorization';
exports.SUPERBLOCKS_EMBED_HEADER = 'x-superblocks-embed';
exports.SUPERBLOCKS_SESSION_ID_HEADER = 'x-superblocks-session-id';
exports.SUPERBLOCKS_LIVE_GIT_BRANCH = 'superblocks/live';
// Baseline branch used after disconnecting from git-backed workflows.
exports.DEFAULT_NON_GIT_BRANCH = 'main';
exports.DEFAULT_BRANCH = exports.DEFAULT_NON_GIT_BRANCH;
exports.EMAIL_VERIFICATION_CODE_LENGTH = 6;
exports.NULL_AS_STRING = 'null';
// this is needed due to the migration from ts -> proto objects
// which have different JSON representations for plugins
// eslint-disable-next-line @typescript-eslint/no-explicit-any
exports.PLUGIN_ID_TO_PROTO_CLASS = {
    cosmosdb: types_1.CosmosDbPluginV1.Plugin,
    redis: types_1.RedisPluginV1.Plugin,
    rediscloud: types_1.RedisPluginV1.Plugin,
    awselasticache: types_1.RedisPluginV1.Plugin,
    aivenredis: types_1.RedisPluginV1.Plugin,
    salesforce: types_1.SalesforcePluginV1.Plugin,
    adls: types_1.AdlsPluginV1.Plugin,
    oracledb: types_1.OracleDbPluginV1.Plugin,
    gcpsecretsmanager: types_2.SecretsV1.Store,
    awssecretsmanager: types_2.SecretsV1.Store,
    hashicorpvault: types_2.SecretsV1.Store,
    akeylesssecretsmanager: types_2.SecretsV1.Store,
    couchbase: types_1.CouchbasePluginV1.Plugin
};
// this is used to deserialize datasource configuration objects that contain
// proto objects
exports.PLUGIN_ID_TO_PROTO_DATASOURCE_CONFIGURATION_OBJECT_CALLABLE = {
    cosmosdb: deserializeCosmosDbDatasourceConfig,
    redis: deserializeRedisDatasourceConfig,
    rediscloud: deserializeRedisDatasourceConfig,
    awselasticache: deserializeRedisDatasourceConfig,
    aivenredis: deserializeRedisDatasourceConfig,
    salesforce: deserializeSalesforceDatasourceConfig,
    adls: deserializeAdlsDatasourceConfig,
    oracledb: deserializeOracleDbDatasourceConfig,
    couchbase: deserializeCouchbaseDatasourceConfig
};
// this is used to deserialize action configuration objects that contain proto
// objects
exports.PLUGIN_ID_TO_PROTO_ACTION_CONFIGURATION_OBJECT_CALLABLE = {
    cosmosdb: deserializeCosmosDbActionConfig,
    redis: deserializeRedisActionConfig,
    rediscloud: deserializeRedisActionConfig,
    awselasticache: deserializeRedisActionConfig,
    aivenredis: deserializeRedisActionConfig,
    salesforce: deserializeSalesforceActionConfig,
    adls: deserializeAdlsActionConfig,
    oracledb: deserializeOracleDbActionConfig,
    couchbase: deserializeCouchbaseActionConfig
};
function deserializeRedisDatasourceConfig(serialized) {
    const plugin = types_1.RedisPluginV1.Plugin.fromJsonString(JSON.stringify(serialized), { ignoreUnknownFields: true });
    const { name, connection } = plugin;
    return { connection, name };
}
function deserializeRedisActionConfig(serialized) {
    const plugin = types_1.RedisPluginV1.Plugin.fromJsonString(JSON.stringify(serialized), { ignoreUnknownFields: true });
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    const { name, connection, ...rest } = plugin;
    return rest;
}
function deserializeSalesforceDatasourceConfig(serialized) {
    const plugin = types_1.SalesforcePluginV1.Plugin.fromJsonString(JSON.stringify(serialized), { ignoreUnknownFields: true });
    const { name, connection } = plugin;
    const { authConfig, authTypeField, authTypeOnBehalfOfToken } = serialized;
    return { connection, name, authConfig, authTypeField, authTypeOnBehalfOfToken };
}
function deserializeSalesforceActionConfig(serialized) {
    const plugin = types_1.SalesforcePluginV1.Plugin.fromJsonString(JSON.stringify(serialized), { ignoreUnknownFields: true });
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    const { name, connection, ...rest } = plugin;
    return rest;
}
function deserializeCosmosDbDatasourceConfig(serialized) {
    const plugin = types_1.CosmosDbPluginV1.Plugin.fromJsonString(JSON.stringify(serialized), { ignoreUnknownFields: true });
    const { name, connection } = plugin;
    return { connection, name };
}
function deserializeCosmosDbActionConfig(serialized) {
    const plugin = types_1.CosmosDbPluginV1.Plugin.fromJsonString(JSON.stringify(serialized), { ignoreUnknownFields: true });
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    const { name, connection, ...rest } = plugin;
    return rest;
}
function deserializeOracleDbDatasourceConfig(serialized) {
    const plugin = types_1.OracleDbPluginV1.Plugin.fromJsonString(JSON.stringify(serialized), { ignoreUnknownFields: true });
    const { name, connection } = plugin;
    return { connection, name };
}
function deserializeOracleDbActionConfig(serialized) {
    const plugin = types_1.OracleDbPluginV1.Plugin.fromJsonString(JSON.stringify(serialized), { ignoreUnknownFields: true });
    const { ...rest } = plugin;
    return rest;
}
function deserializeAdlsDatasourceConfig(serialized) {
    const plugin = types_1.AdlsPluginV1.Plugin.fromJsonString(JSON.stringify(serialized), { ignoreUnknownFields: true });
    const { name, connection } = plugin;
    return { connection, name };
}
function deserializeAdlsActionConfig(serialized) {
    const plugin = types_1.AdlsPluginV1.Plugin.fromJsonString(JSON.stringify(serialized), { ignoreUnknownFields: true });
    const { ...rest } = plugin;
    return rest;
}
function deserializeCouchbaseDatasourceConfig(serialized) {
    const plugin = types_1.CouchbasePluginV1.Plugin.fromJsonString(JSON.stringify(serialized), { ignoreUnknownFields: true });
    const { name, connection, tunnel } = plugin;
    return { name, connection, tunnel };
}
function deserializeCouchbaseActionConfig(serialized) {
    const plugin = types_1.CouchbasePluginV1.Plugin.fromJsonString(JSON.stringify(serialized), { ignoreUnknownFields: true });
    const { ...rest } = plugin;
    return rest;
}
//# sourceMappingURL=constants.js.map