UNPKG

liveperson-functions-cli

Version:
90 lines 4.19 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Toolbelt = exports.SDETypes = exports.ConversationContentTypes = exports.LpServices = exports.SecretError = exports.ErrorCodes = void 0; const conversationUtil_1 = require("./conversation-util/conversationUtil"); const salesforce_1 = require("./crm-clients/salesforce"); const csdsClient_1 = require("./csds-client/csdsClient"); const GDPRUtil_1 = require("./GDPR/GDPRUtil"); const httpClient_1 = require("./http-client/httpClient"); const LpClient_1 = require("./lp-client/LpClient"); const SDEUtil_1 = require("./SDE-util/SDEUtil"); const secretClient_1 = require("./secret-storage/secretClient"); const contextServiceClient_1 = require("./context-service-client/contextServiceClient"); var errorCodes_1 = require("./errors/errorCodes"); Object.defineProperty(exports, "ErrorCodes", { enumerable: true, get: function () { return errorCodes_1.ErrorCodes; } }); var secretError_1 = require("./errors/secretError"); Object.defineProperty(exports, "SecretError", { enumerable: true, get: function () { return secretError_1.SecretError; } }); var LpServices_1 = require("./lp-client/LpServices"); Object.defineProperty(exports, "LpServices", { enumerable: true, get: function () { return LpServices_1.LpServices; } }); var ConversationContentTypes_1 = require("./conversation-util/ConversationContentTypes"); Object.defineProperty(exports, "ConversationContentTypes", { enumerable: true, get: function () { return ConversationContentTypes_1.ConversationContentTypes; } }); var SDETypes_1 = require("./SDE-util/SDETypes"); Object.defineProperty(exports, "SDETypes", { enumerable: true, get: function () { return SDETypes_1.SDETypes; } }); class Toolbelt { /** * Returns an Salesforce Client, that is configured to work with the proxy. */ static SFClient() { return { connectToSalesforce: salesforce_1.ConnectToSalesforce }; } /** * Returns an HTTP CLient, that is configured to work with the proxy. * It is based on request-promise and shares the same interface. */ static HTTPClient() { return httpClient_1.httpClient; } /** * Returns an Secret Client, which is setup to allow read and update access * to the secret storage of the Site ID. */ static SecretClient() { return new secretClient_1.VaultSecretClient(); } /** * Returns a new Conversation Util, which is configured based on the provided apiCredentials. * @param apiCredentials needed to acces conversation data in Live Engage */ static ConversationUtil() { return new conversationUtil_1.ConversationUtil(this.LpClient()); } static SDEUtil() { return new SDEUtil_1.SDEUtil(this.LpClient()); } static lazyInitCsdsClient() { if (!this.csdsClient) { this.csdsClient = new csdsClient_1.CsdsClient(); } return this.csdsClient; } /** * Returns GDPR Util, which can be used for GDPR related functionaliy such as deleting files of a conversation. */ static GDPRUtil() { return new GDPRUtil_1.GDPRUtil(this.lazyInitCsdsClient()); } static LpClient() { return (0, LpClient_1.lpClientFactory)(this.lazyInitCsdsClient(), this.SecretClient(), this.HTTPClient()); } /** * Returns a Context Service Client which can be used to interact with the * Context Session Store. * @param {IFaaSContextServiceClientConfig} config Config Object in which the account ID for which the Client * will be used and a key for the Context Session Store API need to be provided */ static ContextServiceClient(config) { if (!config) { throw new Error('No valid configuration was provided'); } const { apiKey, accountId } = config; if (!apiKey) { throw new Error('No valid API-key was provided'); } if (!accountId) { throw new Error('No valid accountId was provided'); } return new contextServiceClient_1.FaasContextServiceClient(config); } } exports.Toolbelt = Toolbelt; //# sourceMappingURL=index.js.map