@peernova/cuneiform-sf 1.0.2 → 1.0.3-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,48 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ /**
3
+ * Command result type for JSON output.
4
+ */
5
+ export type DefinitionExportResult = {
6
+ /** Whether the export was successful */
7
+ success: boolean;
8
+ /** Number of definitions exported */
9
+ definitionsExported: number;
10
+ /** Path to the output directory */
11
+ outputPath: string;
12
+ /** List of files created */
13
+ files: string[];
14
+ /** Error message if failed */
15
+ error?: string;
16
+ };
17
+ /**
18
+ * Exports profiling definitions to SFDMU-compatible CSV files.
19
+ *
20
+ * Use this command to:
21
+ * - Back up profiling definitions before major changes
22
+ * - Migrate definitions between environments (sandbox → production)
23
+ * - Version control profiling configuration in Git
24
+ * - Share definition templates across multiple orgs
25
+ *
26
+ * @example
27
+ * ```bash
28
+ * # Export all definitions from the target org
29
+ * sf cuneiform definition export --target-org myOrg
30
+ *
31
+ * # Export to a specific directory
32
+ * sf cuneiform definition export --target-org myOrg --output ./backup
33
+ *
34
+ * # Export with VCS-friendly mode (excludes Salesforce IDs)
35
+ * sf cuneiform definition export --target-org myOrg --exclude-ids
36
+ * ```
37
+ */
38
+ export default class DefinitionExport extends SfCommand<DefinitionExportResult> {
39
+ static readonly summary: string;
40
+ static readonly description: string;
41
+ static readonly examples: string[];
42
+ static readonly flags: {
43
+ 'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
44
+ output: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
45
+ 'exclude-ids': import("@oclif/core/interfaces").BooleanFlag<boolean>;
46
+ };
47
+ run(): Promise<DefinitionExportResult>;
48
+ }
@@ -0,0 +1,97 @@
1
+ /*
2
+ * Copyright (c) 2026, PeerNova Inc. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
5
+ */
6
+ import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
7
+ import { Messages } from '@salesforce/core';
8
+ import { SFDMUService } from '../../../services/SFDMUService.js';
9
+ import { DefinitionExportOperation } from '../../../operations/DefinitionExportOperation.js';
10
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
11
+ const messages = Messages.loadMessages('@peernova/cuneiform-sf', 'definition.export');
12
+ /**
13
+ * Exports profiling definitions to SFDMU-compatible CSV files.
14
+ *
15
+ * Use this command to:
16
+ * - Back up profiling definitions before major changes
17
+ * - Migrate definitions between environments (sandbox → production)
18
+ * - Version control profiling configuration in Git
19
+ * - Share definition templates across multiple orgs
20
+ *
21
+ * @example
22
+ * ```bash
23
+ * # Export all definitions from the target org
24
+ * sf cuneiform definition export --target-org myOrg
25
+ *
26
+ * # Export to a specific directory
27
+ * sf cuneiform definition export --target-org myOrg --output ./backup
28
+ *
29
+ * # Export with VCS-friendly mode (excludes Salesforce IDs)
30
+ * sf cuneiform definition export --target-org myOrg --exclude-ids
31
+ * ```
32
+ */
33
+ export default class DefinitionExport extends SfCommand {
34
+ static summary = messages.getMessage('summary');
35
+ static description = messages.getMessage('description');
36
+ static examples = messages.getMessages('examples');
37
+ static flags = {
38
+ 'target-org': Flags.requiredOrg({
39
+ summary: messages.getMessage('flags.target-org.summary'),
40
+ char: 'o',
41
+ required: true,
42
+ }),
43
+ output: Flags.directory({
44
+ summary: messages.getMessage('flags.output.summary'),
45
+ char: 'd',
46
+ exists: false,
47
+ }),
48
+ 'exclude-ids': Flags.boolean({
49
+ summary: messages.getMessage('flags.exclude-ids.summary'),
50
+ default: false,
51
+ }),
52
+ };
53
+ async run() {
54
+ const { flags } = await this.parse(DefinitionExport);
55
+ const targetOrg = flags['target-org'].getUsername();
56
+ if (!targetOrg) {
57
+ this.error('Could not determine target org username');
58
+ }
59
+ // Initialize service and operation
60
+ const sfdmuService = new SFDMUService();
61
+ const exportOperation = new DefinitionExportOperation(sfdmuService);
62
+ // Display start message
63
+ this.log(`Exporting profiling definitions from ${targetOrg}...`);
64
+ // Execute export
65
+ const result = await exportOperation.execute({
66
+ targetOrg,
67
+ outputDir: flags.output,
68
+ excludeIds: flags['exclude-ids'],
69
+ });
70
+ if (!result.success) {
71
+ this.error(result.message ?? 'Export failed', { code: result.errorCode });
72
+ }
73
+ // Display success output
74
+ this.log('');
75
+ this.log('Export completed successfully!');
76
+ this.log(` Definitions exported: ${result.data.definitionsExported}`);
77
+ this.log(` Output directory: ${result.data.outputPath}`);
78
+ this.log(' Files created:');
79
+ for (const file of result.data.files) {
80
+ this.log(` - ${file}`);
81
+ }
82
+ if (result.warnings && result.warnings.length > 0) {
83
+ this.log('');
84
+ this.warn('Warnings:');
85
+ for (const warning of result.warnings) {
86
+ this.warn(` ${warning}`);
87
+ }
88
+ }
89
+ return {
90
+ success: true,
91
+ definitionsExported: result.data.definitionsExported,
92
+ outputPath: result.data.outputPath,
93
+ files: result.data.files,
94
+ };
95
+ }
96
+ }
97
+ //# sourceMappingURL=export.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export.js","sourceRoot":"","sources":["../../../../src/commands/cuneiform/definition/export.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,kDAAkD,CAAC;AAE7F,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,wBAAwB,EAAE,mBAAmB,CAAC,CAAC;AAkBtF;;;;;;;;;;;;;;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EAAE,IAAI;YACb,mBAAmB,EAAE,MAAM,CAAC,IAAI,CAAC,mBAAmB;YACpD,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU;YAClC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK;SACzB,CAAC;IACJ,CAAC"}
@@ -0,0 +1,49 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ /**
3
+ * Command result type for JSON output.
4
+ */
5
+ export type DefinitionImportResult = {
6
+ /** Whether the import was successful */
7
+ success: boolean;
8
+ /** Number of definitions imported */
9
+ definitionsImported: number;
10
+ /** Source directory used */
11
+ sourceDir: string;
12
+ /** Whether this was a dry run */
13
+ dryRun: boolean;
14
+ /** Error message if failed */
15
+ error?: string;
16
+ };
17
+ /**
18
+ * Imports profiling definitions from SFDMU-compatible CSV files.
19
+ *
20
+ * Use this command to:
21
+ * - Restore definitions from backup
22
+ * - Migrate definitions to a new environment
23
+ * - Deploy standardized definition templates
24
+ * - Sync definitions across orgs
25
+ *
26
+ * @example
27
+ * ```bash
28
+ * # Import definitions from a backup directory
29
+ * sf cuneiform definition import --target-org myOrg --source ./backup
30
+ *
31
+ * # Import with upsert (update existing, insert new)
32
+ * sf cuneiform definition import --target-org myOrg --source ./backup --operation Upsert
33
+ *
34
+ * # Preview import (dry-run mode)
35
+ * sf cuneiform definition import --target-org myOrg --source ./backup --dry-run
36
+ * ```
37
+ */
38
+ export default class DefinitionImport extends SfCommand<DefinitionImportResult> {
39
+ static readonly summary: string;
40
+ static readonly description: string;
41
+ static readonly examples: string[];
42
+ static readonly flags: {
43
+ 'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
44
+ source: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
45
+ operation: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
46
+ 'dry-run': import("@oclif/core/interfaces").BooleanFlag<boolean>;
47
+ };
48
+ run(): Promise<DefinitionImportResult>;
49
+ }
@@ -0,0 +1,107 @@
1
+ /*
2
+ * Copyright (c) 2026, PeerNova Inc. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
5
+ */
6
+ import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
7
+ import { Messages } from '@salesforce/core';
8
+ import { SFDMUService } from '../../../services/SFDMUService.js';
9
+ import { DefinitionImportOperation } from '../../../operations/DefinitionImportOperation.js';
10
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
11
+ const messages = Messages.loadMessages('@peernova/cuneiform-sf', 'definition.import');
12
+ /**
13
+ * Imports profiling definitions from SFDMU-compatible CSV files.
14
+ *
15
+ * Use this command to:
16
+ * - Restore definitions from backup
17
+ * - Migrate definitions to a new environment
18
+ * - Deploy standardized definition templates
19
+ * - Sync definitions across orgs
20
+ *
21
+ * @example
22
+ * ```bash
23
+ * # Import definitions from a backup directory
24
+ * sf cuneiform definition import --target-org myOrg --source ./backup
25
+ *
26
+ * # Import with upsert (update existing, insert new)
27
+ * sf cuneiform definition import --target-org myOrg --source ./backup --operation Upsert
28
+ *
29
+ * # Preview import (dry-run mode)
30
+ * sf cuneiform definition import --target-org myOrg --source ./backup --dry-run
31
+ * ```
32
+ */
33
+ export default class DefinitionImport extends SfCommand {
34
+ static summary = messages.getMessage('summary');
35
+ static description = messages.getMessage('description');
36
+ static examples = messages.getMessages('examples');
37
+ static flags = {
38
+ 'target-org': Flags.requiredOrg({
39
+ summary: messages.getMessage('flags.target-org.summary'),
40
+ char: 'o',
41
+ required: true,
42
+ }),
43
+ source: Flags.directory({
44
+ summary: messages.getMessage('flags.source.summary'),
45
+ char: 's',
46
+ required: true,
47
+ exists: true,
48
+ }),
49
+ operation: Flags.string({
50
+ summary: messages.getMessage('flags.operation.summary'),
51
+ options: ['Insert', 'Upsert'],
52
+ default: 'Insert',
53
+ }),
54
+ 'dry-run': Flags.boolean({
55
+ summary: messages.getMessage('flags.dry-run.summary'),
56
+ default: false,
57
+ }),
58
+ };
59
+ async run() {
60
+ const { flags } = await this.parse(DefinitionImport);
61
+ const targetOrg = flags['target-org'].getUsername();
62
+ if (!targetOrg) {
63
+ this.error('Could not determine target org username');
64
+ }
65
+ // Initialize service and operation
66
+ const sfdmuService = new SFDMUService();
67
+ const importOperation = new DefinitionImportOperation(sfdmuService);
68
+ // Display start message
69
+ const dryRunLabel = flags['dry-run'] ? ' (DRY RUN)' : '';
70
+ this.log(`Importing profiling definitions to ${targetOrg}${dryRunLabel}...`);
71
+ this.log(` Source: ${flags.source}`);
72
+ this.log(` Operation: ${flags.operation}`);
73
+ // Execute import
74
+ const result = await importOperation.execute({
75
+ targetOrg,
76
+ sourceDir: flags.source,
77
+ operation: flags.operation,
78
+ dryRun: flags['dry-run'],
79
+ });
80
+ if (!result.success) {
81
+ this.error(result.message ?? 'Import failed', { code: result.errorCode });
82
+ }
83
+ // Display success output
84
+ this.log('');
85
+ if (flags['dry-run']) {
86
+ this.log('Dry run completed - no changes were made.');
87
+ }
88
+ else {
89
+ this.log('Import completed successfully!');
90
+ }
91
+ this.log(` Definitions imported: ${result.data.definitionsImported}`);
92
+ if (result.warnings && result.warnings.length > 0) {
93
+ this.log('');
94
+ this.warn('Warnings:');
95
+ for (const warning of result.warnings) {
96
+ this.warn(` ${warning}`);
97
+ }
98
+ }
99
+ return {
100
+ success: true,
101
+ definitionsImported: result.data.definitionsImported,
102
+ sourceDir: result.data.sourceDir,
103
+ dryRun: result.data.dryRun,
104
+ };
105
+ }
106
+ }
107
+ //# sourceMappingURL=import.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import.js","sourceRoot":"","sources":["../../../../src/commands/cuneiform/definition/import.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,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;QAED,yBAAyB;QACzB,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACb,IAAI,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;YACrB,IAAI,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAC;QACxD,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;QAC7C,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,2BAA2B,MAAM,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC,CAAC;QAEvE,IAAI,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAClD,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACb,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACvB,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACtC,IAAI,CAAC,IAAI,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC;YAC5B,CAAC;QACH,CAAC;QAED,OAAO;YACL,OAAO,EAAE,IAAI;YACb,mBAAmB,EAAE,MAAM,CAAC,IAAI,CAAC,mBAAmB;YACpD,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS;YAChC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM;SAC3B,CAAC;IACJ,CAAC"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Options for SFDMU execution operations.
3
+ */
4
+ export type ISFDMUOptions = {
5
+ /** Source org username or alias for export operations */
6
+ sourceOrg?: string;
7
+ /** Target org username or alias for import operations */
8
+ targetOrg?: string;
9
+ /** Path to the export.json configuration file */
10
+ configPath: string;
11
+ /** Whether to use Bulk API for operations (default: true) */
12
+ useBulkAPI?: boolean;
13
+ /** Execution timeout in milliseconds (default: 300000 = 5 minutes) */
14
+ timeout?: number;
15
+ /** Maximum buffer size in bytes for stdout/stderr (default: 10MB) */
16
+ maxBuffer?: number;
17
+ };
18
+ /**
19
+ * Raw result from SFDMU CLI execution.
20
+ */
21
+ export type ISFDMUResult = {
22
+ /** Exit code from the SFDMU process (0 = success) */
23
+ exitCode: number;
24
+ /** Standard output from SFDMU */
25
+ stdout: string;
26
+ /** Standard error from SFDMU */
27
+ stderr: string;
28
+ /** Number of records processed (parsed from stdout) */
29
+ recordsProcessed?: number;
30
+ /** Error messages extracted from the output */
31
+ errors?: string[];
32
+ };
33
+ /**
34
+ * Generic service result wrapper following CLAUDE.md ServiceResult pattern.
35
+ * All service methods should return this type for consistent handling.
36
+ */
37
+ export type ServiceResult<T> = {
38
+ /** Whether the operation was successful */
39
+ success: boolean;
40
+ /** The operation result data */
41
+ data: T;
42
+ /** Error code for categorizing failures (see error code ranges in CLAUDE.md) */
43
+ errorCode?: string;
44
+ /** Human-readable message (error or success) */
45
+ message?: string;
46
+ /** Non-fatal warnings encountered during execution */
47
+ warnings?: string[];
48
+ /** Additional metadata about the operation */
49
+ metadata?: {
50
+ /** Time taken for the operation in milliseconds */
51
+ duration?: number;
52
+ /** Strategy used (if multiple available) */
53
+ strategyUsed?: string;
54
+ /** Whether a fallback was used */
55
+ fallbackUsed?: boolean;
56
+ };
57
+ };
58
+ /**
59
+ * SFDMU-specific error codes (5000 range for system/internal errors).
60
+ */
61
+ export declare const SFDMUErrorCodes: {
62
+ /** SFDMU plugin is not installed */
63
+ readonly NOT_INSTALLED: "SFDMU_NOT_INSTALLED";
64
+ /** SFDMU execution timed out */
65
+ readonly TIMEOUT: "SFDMU_TIMEOUT";
66
+ /** SFDMU execution failed with non-zero exit code */
67
+ readonly EXECUTION_FAILED: "SFDMU_EXECUTION_FAILED";
68
+ /** Invalid configuration file path */
69
+ readonly CONFIG_INVALID: "SFDMU_CONFIG_INVALID";
70
+ };
71
+ /**
72
+ * Type alias for SFDMU error code values.
73
+ */
74
+ export type SFDMUErrorCode = (typeof SFDMUErrorCodes)[keyof typeof SFDMUErrorCodes];
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Copyright (c) 2026, PeerNova Inc. All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
5
+ */
6
+ /**
7
+ * SFDMU-specific error codes (5000 range for system/internal errors).
8
+ */
9
+ export const SFDMUErrorCodes = {
10
+ /** SFDMU plugin is not installed */
11
+ NOT_INSTALLED: 'SFDMU_NOT_INSTALLED',
12
+ /** SFDMU execution timed out */
13
+ TIMEOUT: 'SFDMU_TIMEOUT',
14
+ /** SFDMU execution failed with non-zero exit code */
15
+ EXECUTION_FAILED: 'SFDMU_EXECUTION_FAILED',
16
+ /** Invalid configuration file path */
17
+ CONFIG_INVALID: 'SFDMU_CONFIG_INVALID',
18
+ };
19
+ //# sourceMappingURL=sfdmu-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sfdmu-types.js","sourceRoot":"","sources":["../../src/models/sfdmu-types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA4EH;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,oCAAoC;IACpC,aAAa,EAAE,qBAAqB;IACpC,gCAAgC;IAChC,OAAO,EAAE,eAAe;IACxB,qDAAqD;IACrD,gBAAgB,EAAE,wBAAwB;IAC1C,sCAAsC;IACtC,cAAc,EAAE,sBAAsB;CAC9B,CAAC"}
@@ -0,0 +1,92 @@
1
+ import { type ServiceResult } from '../models/sfdmu-types.js';
2
+ import { SFDMUService } from '../services/SFDMUService.js';
3
+ /**
4
+ * Options for the definition export operation.
5
+ */
6
+ export type ExportOptions = {
7
+ /** Target org username or alias to export from */
8
+ targetOrg: string;
9
+ /** Output directory path (defaults to ./data/exports/definitions/{timestamp}) */
10
+ outputDir?: string;
11
+ /** Exclude Salesforce IDs for VCS-friendly output */
12
+ excludeIds?: boolean;
13
+ /** Optional logger for debug output */
14
+ logger?: Console;
15
+ };
16
+ /**
17
+ * Result of a definition export operation.
18
+ */
19
+ export type ExportResult = {
20
+ /** Number of definitions exported */
21
+ definitionsExported: number;
22
+ /** Path to the output directory */
23
+ outputPath: string;
24
+ /** List of files created */
25
+ files: string[];
26
+ /** Raw SFDMU output for debugging */
27
+ sfdmuOutput?: string;
28
+ };
29
+ /**
30
+ * Error codes specific to export operations.
31
+ */
32
+ export declare const ExportErrorCodes: {
33
+ /** Output directory already exists */
34
+ readonly OUTPUT_DIR_EXISTS: "EXPORT_OUTPUT_DIR_EXISTS";
35
+ /** No definitions found in org */
36
+ readonly NO_DEFINITIONS_FOUND: "EXPORT_NO_DEFINITIONS_FOUND";
37
+ /** Failed to create output directory */
38
+ readonly DIR_CREATION_FAILED: "EXPORT_DIR_CREATION_FAILED";
39
+ /** Failed to write config file */
40
+ readonly CONFIG_WRITE_FAILED: "EXPORT_CONFIG_WRITE_FAILED";
41
+ };
42
+ /**
43
+ * Orchestrates the export of profiling definitions using SFDMU.
44
+ *
45
+ * Follows the 4-layer architecture: Command → Operation → Service → API
46
+ * This operation layer handles business logic orchestration while delegating
47
+ * the actual SFDMU execution to SFDMUService.
48
+ *
49
+ * @example
50
+ * ```typescript
51
+ * const operation = new DefinitionExportOperation(sfdmuService);
52
+ * const result = await operation.execute({
53
+ * targetOrg: 'myOrg',
54
+ * outputDir: './exports',
55
+ * excludeIds: true
56
+ * });
57
+ * ```
58
+ */
59
+ export declare class DefinitionExportOperation {
60
+ /** Default base path for exports */
61
+ private static readonly DEFAULT_EXPORT_BASE;
62
+ /** SFDMU query for profiling definitions */
63
+ private static readonly DEFINITION_QUERY;
64
+ private readonly sfdmuService;
65
+ private readonly logger?;
66
+ /**
67
+ * Creates a new DefinitionExportOperation.
68
+ *
69
+ * @param sfdmuService - The SFDMU service instance for executing operations
70
+ * @param logger - Optional logger for debug output
71
+ */
72
+ constructor(sfdmuService: SFDMUService, logger?: Console);
73
+ /**
74
+ * Resolves the output path, generating a timestamped directory if needed.
75
+ */
76
+ private static resolveOutputPath;
77
+ /**
78
+ * Builds the SFDMU export configuration.
79
+ */
80
+ private static buildSFDMUConfig;
81
+ /**
82
+ * Collects the list of files created by SFDMU export.
83
+ */
84
+ private static collectExportedFiles;
85
+ /**
86
+ * Executes the export operation.
87
+ *
88
+ * @param options - Export options
89
+ * @returns ServiceResult containing export results or error details
90
+ */
91
+ execute(options: ExportOptions): Promise<ServiceResult<ExportResult>>;
92
+ }