import { SalesforceLookupService, SalesforceSchemaService, SalesforceConnectionProvider } from '@vlocode/salesforce'; import { Logger, Container } from '@vlocode/core'; import { CancellationToken } from '@vlocode/util'; import { DatapackDeployment } from './datapackDeployment'; import { VlocityDatapack } from '@vlocode/vlocity'; /** * Import all default deployment specs and trigger the decorators to register each sepc * in the deployment spec registry singleton */ import './deploymentSpecs'; import { DatapackDeploymentOptions } from './datapackDeploymentOptions'; /** * Filter that determines if a datapack is applicable for the given spec. The filter can be either a regular expression or a string. * When a string is passed the filter will match if the datapack type or record type matches the string. When a regular expression is passed * the filter will match if the datapack type or record type matches the regular expression. * * Record filters (`recordFilter`) are only applicable when the spec is executed for a single record and should be preferred over datapack * filters as they are more specific and thus reduce the number of records that need to be processed by the spec. Another advantage of record * filters is that they do not rely on the datapack type being set which is derived from the folder structure of the datapack. */ export type DatapackFilter = { recordFilter?: RegExp | string; datapackFilter: RegExp | string; } | { recordFilter: RegExp | string; datapackFilter?: RegExp | string; }; export declare class DatapackDeployer { private readonly connectionProvider; private readonly objectLookupService; private readonly schemaService; private readonly logger; private readonly container; private readonly specRegistry; /** * List of Vlocity global identifier field names that need verification after deployment. * These fields may be modified by Vlocity triggers during deployment, requiring * additional verification and potential updates to ensure data consistency. */ vlocityGlobalKeyFields: string[]; constructor(connectionProvider: SalesforceConnectionProvider, objectLookupService: SalesforceLookupService, schemaService: SalesforceSchemaService, logger: Logger, creatingContainer?: Container); /** * Create new Datapack deployment * @param datapacks Datapacks to deploy * @returns Datapack deployment object */ createDeployment(datapacks: VlocityDatapack[], options?: DatapackDeploymentOptions, cancellationToken?: CancellationToken): Promise; /** * Creates and starts a deployment returning the {@link DatapackDeployment} object which contains results of the deployment. * @param datapacks Datapacks to deploy * @param options options passed to the deployment * @param cancellationToken optional cancellation token * @returns */ deploy(datapacks: VlocityDatapack[], options?: DatapackDeploymentOptions, cancellationToken?: CancellationToken): Promise; /** * Disable or enable all Vlocity triggers * @param newTriggerState true to enable all Vlocity Triggers; false to disabled all Vlocity triggers */ private setVlocityTriggerState; /** * Verifies the data deployed to the org matched the local data for the specified list of fields. This is especially useful for GlobalKey fields that are * updated by a Vlocity before update/insert trigger making it impossible to update the global key when Vlocity triggers are enabled. * @param records records * @param fieldNames Array of field names to compare */ private verifyDeployedFieldData; /** * Executes the necessary actions before deploying a record. * If the `disableTriggers` option is set in the deployment, it will disable triggers. * If the deployment is cancelled, the method will return early. * It then runs the `beforeDeployRecord` spec function with the provided arguments. * * @param deployment - The DatapackDeployment object. * @param datapackRecords - An iterable of DatapackDeploymentRecord objects. * @returns A Promise that resolves when the actions are completed. */ private beforeDeployRecord; /** * Executes the necessary actions before retrying a record deployment. * * @param deployment - The DatapackDeployment object. * @param datapackRecords - An iterable of DatapackDeploymentRecord objects. */ private beforeRetryRecord; /** * Handles errors encountered during the deployment of a specific datapack record. * If the deployment has been cancelled, this method will return immediately without performing any actions. * Otherwise, it invokes a specified function (`onRecordError`) to handle the error, * passing the problematic datapack record as an argument. * * @param deployment - The current datapack deployment instance. * @param datapackRecord - The specific datapack record that encountered an error during deployment. * @returns A promise that resolves when the error handling process is complete. */ private onRecordError; /** * Performs additional tasks after the deployment of a datapack record. * If triggers are disabled in the deployment options, it sets the Vlocity trigger state to true. * Verifies the deployed field data for specific fields. * Runs the 'afterDeployRecord' spec function with the provided arguments. * * @param deployment - The DatapackDeployment object representing the deployment. * @param datapackRecords - An iterable of DatapackDeploymentRecord objects representing the deployed records. * @returns A Promise that resolves when all the tasks are completed. */ private afterDeployRecord; /** * Event handler running before the deployment * @param datapackRecords Datapacks being deployed */ private beforeDeployRecordGroup; /** * Event handler running after the deployment * @param datapackRecords Datapacks that have been deployed */ private afterDeployRecordGroup; /** * Run a datapack spec function and await the result * @param datapackType Datapack type * @param eventType Event/function type to run * @param args Arguments */ private runSpecFunction; private handleSpecFunctionError; private getAffectedRecords; private filterApplicableRecords; private evalFilter; } //# sourceMappingURL=datapackDeployer.d.ts.map