@peernova/cuneiform-sf 1.0.2 → 1.0.4-beta.8
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.
- package/LICENSE +81 -30
- package/README.md +59 -95
- package/lib/adapters/connection-facade.d.ts +458 -0
- package/lib/adapters/connection-facade.js +379 -0
- package/lib/adapters/connection-facade.js.map +1 -0
- package/lib/adapters/errors.d.ts +547 -0
- package/lib/adapters/errors.js +937 -0
- package/lib/adapters/errors.js.map +1 -0
- package/lib/adapters/index.d.ts +33 -0
- package/lib/adapters/index.js +50 -0
- package/lib/adapters/index.js.map +1 -0
- package/lib/adapters/lifecycle.d.ts +119 -0
- package/lib/adapters/lifecycle.js +94 -0
- package/lib/adapters/lifecycle.js.map +1 -0
- package/lib/adapters/rest/cache.d.ts +69 -0
- package/lib/adapters/rest/cache.js +133 -0
- package/lib/adapters/rest/cache.js.map +1 -0
- package/lib/adapters/rest/index.d.ts +11 -0
- package/lib/adapters/rest/index.js +18 -0
- package/lib/adapters/rest/index.js.map +1 -0
- package/lib/adapters/rest/profiling-rest-client.d.ts +137 -0
- package/lib/adapters/rest/profiling-rest-client.js +115 -0
- package/lib/adapters/rest/profiling-rest-client.js.map +1 -0
- package/lib/adapters/rest/rest-api-adapter.d.ts +389 -0
- package/lib/adapters/rest/rest-api-adapter.js +747 -0
- package/lib/adapters/rest/rest-api-adapter.js.map +1 -0
- package/lib/adapters/rest/types.d.ts +34 -0
- package/lib/adapters/rest/types.js +9 -0
- package/lib/adapters/rest/types.js.map +1 -0
- package/lib/adapters/retry.d.ts +91 -0
- package/lib/adapters/retry.js +215 -0
- package/lib/adapters/retry.js.map +1 -0
- package/lib/adapters/soql/cuneiform-query-builder.d.ts +391 -0
- package/lib/adapters/soql/cuneiform-query-builder.js +559 -0
- package/lib/adapters/soql/cuneiform-query-builder.js.map +1 -0
- package/lib/adapters/soql/index.d.ts +13 -0
- package/lib/adapters/soql/index.js +21 -0
- package/lib/adapters/soql/index.js.map +1 -0
- package/lib/adapters/soql/soql-query-adapter.d.ts +141 -0
- package/lib/adapters/soql/soql-query-adapter.js +259 -0
- package/lib/adapters/soql/soql-query-adapter.js.map +1 -0
- package/lib/adapters/soql/types.d.ts +37 -0
- package/lib/adapters/soql/types.js +19 -0
- package/lib/adapters/soql/types.js.map +1 -0
- package/lib/adapters/testing/index.d.ts +37 -0
- package/lib/adapters/testing/index.js +20 -0
- package/lib/adapters/testing/index.js.map +1 -0
- package/lib/adapters/testing/mock-connection.d.ts +77 -0
- package/lib/adapters/testing/mock-connection.js +207 -0
- package/lib/adapters/testing/mock-connection.js.map +1 -0
- package/lib/adapters/testing/mock-logger.d.ts +29 -0
- package/lib/adapters/testing/mock-logger.js +57 -0
- package/lib/adapters/testing/mock-logger.js.map +1 -0
- package/lib/adapters/testing/mock-mcp-adapters.d.ts +32 -0
- package/lib/adapters/testing/mock-mcp-adapters.js +52 -0
- package/lib/adapters/testing/mock-mcp-adapters.js.map +1 -0
- package/lib/adapters/testing/mock-oclif-config.d.ts +22 -0
- package/lib/adapters/testing/mock-oclif-config.js +90 -0
- package/lib/adapters/testing/mock-oclif-config.js.map +1 -0
- package/lib/adapters/testing/mock-rest-adapter.d.ts +26 -0
- package/lib/adapters/testing/mock-rest-adapter.js +243 -0
- package/lib/adapters/testing/mock-rest-adapter.js.map +1 -0
- package/lib/adapters/testing/mock-salesforce-connection.d.ts +40 -0
- package/lib/adapters/testing/mock-salesforce-connection.js +61 -0
- package/lib/adapters/testing/mock-salesforce-connection.js.map +1 -0
- package/lib/adapters/testing/mock-soql-adapter.d.ts +30 -0
- package/lib/adapters/testing/mock-soql-adapter.js +120 -0
- package/lib/adapters/testing/mock-soql-adapter.js.map +1 -0
- package/lib/adapters/testing/mock-tooling-adapter.d.ts +24 -0
- package/lib/adapters/testing/mock-tooling-adapter.js +163 -0
- package/lib/adapters/testing/mock-tooling-adapter.js.map +1 -0
- package/lib/adapters/testing/stub-connection.d.ts +93 -0
- package/lib/adapters/testing/stub-connection.js +97 -0
- package/lib/adapters/testing/stub-connection.js.map +1 -0
- package/lib/adapters/testing/stub-rest-adapter.d.ts +52 -0
- package/lib/adapters/testing/stub-rest-adapter.js +58 -0
- package/lib/adapters/testing/stub-rest-adapter.js.map +1 -0
- package/lib/adapters/testing/stub-soql-adapter.d.ts +56 -0
- package/lib/adapters/testing/stub-soql-adapter.js +50 -0
- package/lib/adapters/testing/stub-soql-adapter.js.map +1 -0
- package/lib/adapters/testing/types.d.ts +71 -0
- package/lib/adapters/testing/types.js +9 -0
- package/lib/adapters/testing/types.js.map +1 -0
- package/lib/adapters/tooling/index.d.ts +10 -0
- package/lib/adapters/tooling/index.js +17 -0
- package/lib/adapters/tooling/index.js.map +1 -0
- package/lib/adapters/tooling/tooling-api-adapter.d.ts +157 -0
- package/lib/adapters/tooling/tooling-api-adapter.js +339 -0
- package/lib/adapters/tooling/tooling-api-adapter.js.map +1 -0
- package/lib/adapters/tooling/types.d.ts +81 -0
- package/lib/adapters/tooling/types.js +9 -0
- package/lib/adapters/tooling/types.js.map +1 -0
- package/lib/adapters/types.d.ts +112 -0
- package/lib/adapters/types.js +169 -0
- package/lib/adapters/types.js.map +1 -0
- package/lib/base/cuneiform-command.d.ts +152 -0
- package/lib/base/cuneiform-command.js +243 -0
- package/lib/base/cuneiform-command.js.map +1 -0
- package/lib/commands/cuneiform/compatibility/check.d.ts +43 -0
- package/lib/commands/cuneiform/compatibility/check.js +114 -0
- package/lib/commands/cuneiform/compatibility/check.js.map +1 -0
- package/lib/commands/cuneiform/definition/create.d.ts +119 -0
- package/lib/commands/cuneiform/definition/create.js +693 -0
- package/lib/commands/cuneiform/definition/create.js.map +1 -0
- package/lib/commands/cuneiform/definition/export.d.ts +57 -0
- package/lib/commands/cuneiform/definition/export.js +133 -0
- package/lib/commands/cuneiform/definition/export.js.map +1 -0
- package/lib/commands/cuneiform/definition/get.d.ts +86 -0
- package/lib/commands/cuneiform/definition/get.js +270 -0
- package/lib/commands/cuneiform/definition/get.js.map +1 -0
- package/lib/commands/cuneiform/definition/import.d.ts +54 -0
- package/lib/commands/cuneiform/definition/import.js +118 -0
- package/lib/commands/cuneiform/definition/import.js.map +1 -0
- package/lib/commands/cuneiform/definition/list.d.ts +110 -0
- package/lib/commands/cuneiform/definition/list.js +344 -0
- package/lib/commands/cuneiform/definition/list.js.map +1 -0
- package/lib/commands/cuneiform/definition/purge.d.ts +105 -0
- package/lib/commands/cuneiform/definition/purge.js +533 -0
- package/lib/commands/cuneiform/definition/purge.js.map +1 -0
- package/lib/commands/cuneiform/definition/update.d.ts +58 -0
- package/lib/commands/cuneiform/definition/update.js +206 -0
- package/lib/commands/cuneiform/definition/update.js.map +1 -0
- package/lib/commands/cuneiform/mcp/serve.d.ts +56 -0
- package/lib/commands/cuneiform/mcp/serve.js +109 -0
- package/lib/commands/cuneiform/mcp/serve.js.map +1 -0
- package/lib/commands/cuneiform/object/describe.d.ts +61 -0
- package/lib/commands/cuneiform/object/describe.js +461 -0
- package/lib/commands/cuneiform/object/describe.js.map +1 -0
- package/lib/commands/cuneiform/object/list.d.ts +111 -0
- package/lib/commands/cuneiform/object/list.js +239 -0
- package/lib/commands/cuneiform/object/list.js.map +1 -0
- package/lib/commands/cuneiform/org/details.d.ts +99 -0
- package/lib/commands/cuneiform/org/details.js +521 -0
- package/lib/commands/cuneiform/org/details.js.map +1 -0
- package/lib/commands/cuneiform/org/reset.d.ts +46 -0
- package/lib/commands/cuneiform/org/reset.js +135 -0
- package/lib/commands/cuneiform/org/reset.js.map +1 -0
- package/lib/commands/cuneiform/profile/request/cancel.d.ts +59 -0
- package/lib/commands/cuneiform/profile/request/cancel.js +202 -0
- package/lib/commands/cuneiform/profile/request/cancel.js.map +1 -0
- package/lib/commands/cuneiform/profile/request/delete.d.ts +59 -0
- package/lib/commands/cuneiform/profile/request/delete.js +223 -0
- package/lib/commands/cuneiform/profile/request/delete.js.map +1 -0
- package/lib/commands/cuneiform/profile/request/list.d.ts +35 -0
- package/lib/commands/cuneiform/profile/request/list.js +102 -0
- package/lib/commands/cuneiform/profile/request/list.js.map +1 -0
- package/lib/commands/cuneiform/profile.d.ts +90 -0
- package/lib/commands/cuneiform/profile.js +322 -0
- package/lib/commands/cuneiform/profile.js.map +1 -0
- package/lib/commands/cuneiform/summary/purge.d.ts +77 -0
- package/lib/commands/cuneiform/summary/purge.js +429 -0
- package/lib/commands/cuneiform/summary/purge.js.map +1 -0
- package/lib/commands/cuneiform/summary/reprofile.d.ts +60 -0
- package/lib/commands/cuneiform/summary/reprofile.js +236 -0
- package/lib/commands/cuneiform/summary/reprofile.js.map +1 -0
- package/lib/commands/cuneiform/summary/stop.d.ts +59 -0
- package/lib/commands/cuneiform/summary/stop.js +234 -0
- package/lib/commands/cuneiform/summary/stop.js.map +1 -0
- package/lib/commands/cuneiform/user/details.d.ts +73 -0
- package/lib/commands/cuneiform/user/details.js +391 -0
- package/lib/commands/cuneiform/user/details.js.map +1 -0
- package/lib/constants/index.d.ts +8 -0
- package/lib/constants/index.js +16 -0
- package/lib/constants/index.js.map +1 -0
- package/lib/constants/namespace-constants.d.ts +91 -0
- package/lib/constants/namespace-constants.js +211 -0
- package/lib/constants/namespace-constants.js.map +1 -0
- package/lib/debug/command-debug-proxy.d.ts +101 -0
- package/lib/debug/command-debug-proxy.js +171 -0
- package/lib/debug/command-debug-proxy.js.map +1 -0
- package/lib/debug/debug-logger.d.ts +85 -0
- package/lib/debug/debug-logger.js +133 -0
- package/lib/debug/debug-logger.js.map +1 -0
- package/lib/debug/index.d.ts +12 -0
- package/lib/debug/index.js +20 -0
- package/lib/debug/index.js.map +1 -0
- package/lib/debug/service-debug-proxy.d.ts +30 -0
- package/lib/debug/service-debug-proxy.js +102 -0
- package/lib/debug/service-debug-proxy.js.map +1 -0
- package/lib/hooks/prerun.d.ts +25 -0
- package/lib/hooks/prerun.js +47 -0
- package/lib/hooks/prerun.js.map +1 -0
- package/lib/mcp/config/mcp-config.d.ts +55 -0
- package/lib/mcp/config/mcp-config.js +51 -0
- package/lib/mcp/config/mcp-config.js.map +1 -0
- package/lib/mcp/config/pagination.d.ts +96 -0
- package/lib/mcp/config/pagination.js +108 -0
- package/lib/mcp/config/pagination.js.map +1 -0
- package/lib/mcp/config/system-prompts.d.ts +18 -0
- package/lib/mcp/config/system-prompts.js +92 -0
- package/lib/mcp/config/system-prompts.js.map +1 -0
- package/lib/mcp/errors.d.ts +23 -0
- package/lib/mcp/errors.js +27 -0
- package/lib/mcp/errors.js.map +1 -0
- package/lib/mcp/schemas/input-schemas.d.ts +327 -0
- package/lib/mcp/schemas/input-schemas.js +302 -0
- package/lib/mcp/schemas/input-schemas.js.map +1 -0
- package/lib/mcp/server.d.ts +40 -0
- package/lib/mcp/server.js +316 -0
- package/lib/mcp/server.js.map +1 -0
- package/lib/mcp/tools/contactpoint-tools.d.ts +14 -0
- package/lib/mcp/tools/contactpoint-tools.js +34 -0
- package/lib/mcp/tools/contactpoint-tools.js.map +1 -0
- package/lib/mcp/tools/definition-io-tools.d.ts +19 -0
- package/lib/mcp/tools/definition-io-tools.js +152 -0
- package/lib/mcp/tools/definition-io-tools.js.map +1 -0
- package/lib/mcp/tools/definition-tools.d.ts +51 -0
- package/lib/mcp/tools/definition-tools.js +199 -0
- package/lib/mcp/tools/definition-tools.js.map +1 -0
- package/lib/mcp/tools/index.d.ts +37 -0
- package/lib/mcp/tools/index.js +88 -0
- package/lib/mcp/tools/index.js.map +1 -0
- package/lib/mcp/tools/object-tools.d.ts +22 -0
- package/lib/mcp/tools/object-tools.js +306 -0
- package/lib/mcp/tools/object-tools.js.map +1 -0
- package/lib/mcp/tools/org-tools.d.ts +14 -0
- package/lib/mcp/tools/org-tools.js +177 -0
- package/lib/mcp/tools/org-tools.js.map +1 -0
- package/lib/mcp/tools/profile-tools.d.ts +59 -0
- package/lib/mcp/tools/profile-tools.js +213 -0
- package/lib/mcp/tools/profile-tools.js.map +1 -0
- package/lib/mcp/tools/summary-tools.d.ts +14 -0
- package/lib/mcp/tools/summary-tools.js +38 -0
- package/lib/mcp/tools/summary-tools.js.map +1 -0
- package/lib/mcp/tools/tool-factory.d.ts +63 -0
- package/lib/mcp/tools/tool-factory.js +146 -0
- package/lib/mcp/tools/tool-factory.js.map +1 -0
- package/lib/mcp/tools/user-tools.d.ts +25 -0
- package/lib/mcp/tools/user-tools.js +167 -0
- package/lib/mcp/tools/user-tools.js.map +1 -0
- package/lib/models/date-literal.d.ts +211 -0
- package/lib/models/date-literal.js +615 -0
- package/lib/models/date-literal.js.map +1 -0
- package/lib/models/object-describe-types.d.ts +173 -0
- package/lib/models/object-describe-types.js +9 -0
- package/lib/models/object-describe-types.js.map +1 -0
- package/lib/models/profile-request-types.d.ts +118 -0
- package/lib/models/profile-request-types.js +23 -0
- package/lib/models/profile-request-types.js.map +1 -0
- package/lib/models/profiling-execution-types.d.ts +154 -0
- package/lib/models/profiling-execution-types.js +14 -0
- package/lib/models/profiling-execution-types.js.map +1 -0
- package/lib/models/service-result.d.ts +114 -0
- package/lib/models/service-result.js +81 -0
- package/lib/models/service-result.js.map +1 -0
- package/lib/models/sfdmu-types.d.ts +53 -0
- package/lib/models/sfdmu-types.js +23 -0
- package/lib/models/sfdmu-types.js.map +1 -0
- package/lib/models/status-types.d.ts +38 -0
- package/lib/models/status-types.js +12 -0
- package/lib/models/status-types.js.map +1 -0
- package/lib/models/summary-bulk-types.d.ts +61 -0
- package/lib/models/summary-bulk-types.js +23 -0
- package/lib/models/summary-bulk-types.js.map +1 -0
- package/lib/models/user-details-types.d.ts +163 -0
- package/lib/models/user-details-types.js +9 -0
- package/lib/models/user-details-types.js.map +1 -0
- package/lib/models/year-range.d.ts +78 -0
- package/lib/models/year-range.js +153 -0
- package/lib/models/year-range.js.map +1 -0
- package/lib/operations/CompatibilityCheckOperation.d.ts +62 -0
- package/lib/operations/CompatibilityCheckOperation.js +102 -0
- package/lib/operations/CompatibilityCheckOperation.js.map +1 -0
- package/lib/operations/DefinitionCreateOperation.d.ts +411 -0
- package/lib/operations/DefinitionCreateOperation.js +1121 -0
- package/lib/operations/DefinitionCreateOperation.js.map +1 -0
- package/lib/operations/DefinitionExportOperation.d.ts +155 -0
- package/lib/operations/DefinitionExportOperation.js +281 -0
- package/lib/operations/DefinitionExportOperation.js.map +1 -0
- package/lib/operations/DefinitionImportOperation.d.ts +144 -0
- package/lib/operations/DefinitionImportOperation.js +357 -0
- package/lib/operations/DefinitionImportOperation.js.map +1 -0
- package/lib/operations/DefinitionListOperation.d.ts +66 -0
- package/lib/operations/DefinitionListOperation.js +108 -0
- package/lib/operations/DefinitionListOperation.js.map +1 -0
- package/lib/operations/DefinitionPurgeOperation.d.ts +199 -0
- package/lib/operations/DefinitionPurgeOperation.js +465 -0
- package/lib/operations/DefinitionPurgeOperation.js.map +1 -0
- package/lib/operations/DefinitionUpdateOperation.d.ts +78 -0
- package/lib/operations/DefinitionUpdateOperation.js +142 -0
- package/lib/operations/DefinitionUpdateOperation.js.map +1 -0
- package/lib/operations/OrgDetailsOperation.d.ts +253 -0
- package/lib/operations/OrgDetailsOperation.js +456 -0
- package/lib/operations/OrgDetailsOperation.js.map +1 -0
- package/lib/operations/OrgResetOperation.d.ts +114 -0
- package/lib/operations/OrgResetOperation.js +209 -0
- package/lib/operations/OrgResetOperation.js.map +1 -0
- package/lib/operations/ProfileOperation.d.ts +187 -0
- package/lib/operations/ProfileOperation.js +373 -0
- package/lib/operations/ProfileOperation.js.map +1 -0
- package/lib/operations/ProfileRequestCancelOperation.d.ts +59 -0
- package/lib/operations/ProfileRequestCancelOperation.js +137 -0
- package/lib/operations/ProfileRequestCancelOperation.js.map +1 -0
- package/lib/operations/ProfileRequestDeleteOperation.d.ts +64 -0
- package/lib/operations/ProfileRequestDeleteOperation.js +134 -0
- package/lib/operations/ProfileRequestDeleteOperation.js.map +1 -0
- package/lib/operations/ProfileRequestListOperation.d.ts +39 -0
- package/lib/operations/ProfileRequestListOperation.js +61 -0
- package/lib/operations/ProfileRequestListOperation.js.map +1 -0
- package/lib/operations/SummaryPurgeOperation.d.ts +134 -0
- package/lib/operations/SummaryPurgeOperation.js +257 -0
- package/lib/operations/SummaryPurgeOperation.js.map +1 -0
- package/lib/operations/SummaryReprofileOperation.d.ts +88 -0
- package/lib/operations/SummaryReprofileOperation.js +174 -0
- package/lib/operations/SummaryReprofileOperation.js.map +1 -0
- package/lib/operations/SummaryStopOperation.d.ts +87 -0
- package/lib/operations/SummaryStopOperation.js +175 -0
- package/lib/operations/SummaryStopOperation.js.map +1 -0
- package/lib/services/BulkExecutionService.d.ts +120 -0
- package/lib/services/BulkExecutionService.js +535 -0
- package/lib/services/BulkExecutionService.js.map +1 -0
- package/lib/services/CompatibilityService.d.ts +81 -0
- package/lib/services/CompatibilityService.js +118 -0
- package/lib/services/CompatibilityService.js.map +1 -0
- package/lib/services/ConfigureMode.d.ts +85 -0
- package/lib/services/ConfigureMode.js +390 -0
- package/lib/services/ConfigureMode.js.map +1 -0
- package/lib/services/ContactPointService.d.ts +111 -0
- package/lib/services/ContactPointService.js +286 -0
- package/lib/services/ContactPointService.js.map +1 -0
- package/lib/services/DataAvailabilityService.d.ts +81 -0
- package/lib/services/DataAvailabilityService.js +128 -0
- package/lib/services/DataAvailabilityService.js.map +1 -0
- package/lib/services/DefinitionFieldGenerationService.d.ts +309 -0
- package/lib/services/DefinitionFieldGenerationService.js +795 -0
- package/lib/services/DefinitionFieldGenerationService.js.map +1 -0
- package/lib/services/DefinitionQueryBuilder.d.ts +59 -0
- package/lib/services/DefinitionQueryBuilder.js +234 -0
- package/lib/services/DefinitionQueryBuilder.js.map +1 -0
- package/lib/services/ObjectDescribeService.d.ts +436 -0
- package/lib/services/ObjectDescribeService.js +869 -0
- package/lib/services/ObjectDescribeService.js.map +1 -0
- package/lib/services/ObjectFilteringService.d.ts +400 -0
- package/lib/services/ObjectFilteringService.js +878 -0
- package/lib/services/ObjectFilteringService.js.map +1 -0
- package/lib/services/ObjectListCommandService.d.ts +429 -0
- package/lib/services/ObjectListCommandService.js +873 -0
- package/lib/services/ObjectListCommandService.js.map +1 -0
- package/lib/services/ObjectListService.d.ts +201 -0
- package/lib/services/ObjectListService.js +345 -0
- package/lib/services/ObjectListService.js.map +1 -0
- package/lib/services/OrgInfoService.d.ts +485 -0
- package/lib/services/OrgInfoService.js +1122 -0
- package/lib/services/OrgInfoService.js.map +1 -0
- package/lib/services/PollingService.d.ts +105 -0
- package/lib/services/PollingService.js +117 -0
- package/lib/services/PollingService.js.map +1 -0
- package/lib/services/ProfileRequestService.d.ts +186 -0
- package/lib/services/ProfileRequestService.js +555 -0
- package/lib/services/ProfileRequestService.js.map +1 -0
- package/lib/services/ProfilingDefinitionService.d.ts +535 -0
- package/lib/services/ProfilingDefinitionService.js +981 -0
- package/lib/services/ProfilingDefinitionService.js.map +1 -0
- package/lib/services/ProfilingExecutionService.d.ts +122 -0
- package/lib/services/ProfilingExecutionService.js +320 -0
- package/lib/services/ProfilingExecutionService.js.map +1 -0
- package/lib/services/ProfilingSummaryService.d.ts +292 -0
- package/lib/services/ProfilingSummaryService.js +685 -0
- package/lib/services/ProfilingSummaryService.js.map +1 -0
- package/lib/services/RecordTypeService.d.ts +129 -0
- package/lib/services/RecordTypeService.js +284 -0
- package/lib/services/RecordTypeService.js.map +1 -0
- package/lib/services/SFDMUService.d.ts +133 -0
- package/lib/services/SFDMUService.js +295 -0
- package/lib/services/SFDMUService.js.map +1 -0
- package/lib/services/TabDetectionService.d.ts +105 -0
- package/lib/services/TabDetectionService.js +206 -0
- package/lib/services/TabDetectionService.js.map +1 -0
- package/lib/services/UnconfigureMode.d.ts +74 -0
- package/lib/services/UnconfigureMode.js +378 -0
- package/lib/services/UnconfigureMode.js.map +1 -0
- package/lib/services/UserConfigurationService.d.ts +155 -0
- package/lib/services/UserConfigurationService.js +573 -0
- package/lib/services/UserConfigurationService.js.map +1 -0
- package/lib/services/UserConfigurationTypes.d.ts +181 -0
- package/lib/services/UserConfigurationTypes.js +14 -0
- package/lib/services/UserConfigurationTypes.js.map +1 -0
- package/lib/services/UserReadinessService.d.ts +330 -0
- package/lib/services/UserReadinessService.js +831 -0
- package/lib/services/UserReadinessService.js.map +1 -0
- package/lib/services/constants.d.ts +53 -0
- package/lib/services/constants.js +71 -0
- package/lib/services/constants.js.map +1 -0
- package/lib/services/namespace-constants.d.ts +1 -0
- package/lib/services/namespace-constants.js +11 -0
- package/lib/services/namespace-constants.js.map +1 -0
- package/lib/services/validation.d.ts +47 -0
- package/lib/services/validation.js +119 -0
- package/lib/services/validation.js.map +1 -0
- package/lib/utils/batch-processor.d.ts +13 -0
- package/lib/utils/batch-processor.js +39 -0
- package/lib/utils/batch-processor.js.map +1 -0
- package/lib/utils/formatting/availability-grid.d.ts +81 -0
- package/lib/utils/formatting/availability-grid.js +94 -0
- package/lib/utils/formatting/availability-grid.js.map +1 -0
- package/lib/utils/formatting/business-process-grid.d.ts +51 -0
- package/lib/utils/formatting/business-process-grid.js +58 -0
- package/lib/utils/formatting/business-process-grid.js.map +1 -0
- package/lib/utils/formatting/command-display.d.ts +154 -0
- package/lib/utils/formatting/command-display.js +154 -0
- package/lib/utils/formatting/command-display.js.map +1 -0
- package/lib/utils/formatting/definition-create-display.d.ts +118 -0
- package/lib/utils/formatting/definition-create-display.js +231 -0
- package/lib/utils/formatting/definition-create-display.js.map +1 -0
- package/lib/utils/formatting/empty-states.d.ts +35 -0
- package/lib/utils/formatting/empty-states.js +70 -0
- package/lib/utils/formatting/empty-states.js.map +1 -0
- package/lib/utils/formatting/errors.d.ts +33 -0
- package/lib/utils/formatting/errors.js +72 -0
- package/lib/utils/formatting/errors.js.map +1 -0
- package/lib/utils/formatting/field-types.d.ts +32 -0
- package/lib/utils/formatting/field-types.js +88 -0
- package/lib/utils/formatting/field-types.js.map +1 -0
- package/lib/utils/formatting/index.d.ts +29 -0
- package/lib/utils/formatting/index.js +28 -0
- package/lib/utils/formatting/index.js.map +1 -0
- package/lib/utils/formatting/indicators.d.ts +113 -0
- package/lib/utils/formatting/indicators.js +161 -0
- package/lib/utils/formatting/indicators.js.map +1 -0
- package/lib/utils/formatting/loading-messages.d.ts +37 -0
- package/lib/utils/formatting/loading-messages.js +50 -0
- package/lib/utils/formatting/loading-messages.js.map +1 -0
- package/lib/utils/formatting/namespace-display.d.ts +31 -0
- package/lib/utils/formatting/namespace-display.js +64 -0
- package/lib/utils/formatting/namespace-display.js.map +1 -0
- package/lib/utils/formatting/numbers.d.ts +73 -0
- package/lib/utils/formatting/numbers.js +187 -0
- package/lib/utils/formatting/numbers.js.map +1 -0
- package/lib/utils/formatting/object-describe-display.d.ts +114 -0
- package/lib/utils/formatting/object-describe-display.js +440 -0
- package/lib/utils/formatting/object-describe-display.js.map +1 -0
- package/lib/utils/formatting/object-list-display.d.ts +213 -0
- package/lib/utils/formatting/object-list-display.js +672 -0
- package/lib/utils/formatting/object-list-display.js.map +1 -0
- package/lib/utils/formatting/org-identity.d.ts +15 -0
- package/lib/utils/formatting/org-identity.js +28 -0
- package/lib/utils/formatting/org-identity.js.map +1 -0
- package/lib/utils/formatting/record-age-grid.d.ts +41 -0
- package/lib/utils/formatting/record-age-grid.js +56 -0
- package/lib/utils/formatting/record-age-grid.js.map +1 -0
- package/lib/utils/formatting/sections.d.ts +108 -0
- package/lib/utils/formatting/sections.js +150 -0
- package/lib/utils/formatting/sections.js.map +1 -0
- package/lib/utils/formatting/tables.d.ts +90 -0
- package/lib/utils/formatting/tables.js +113 -0
- package/lib/utils/formatting/tables.js.map +1 -0
- package/lib/utils/formatting/user-details-display.d.ts +101 -0
- package/lib/utils/formatting/user-details-display.js +425 -0
- package/lib/utils/formatting/user-details-display.js.map +1 -0
- package/lib/utils/pagination/index.d.ts +11 -0
- package/lib/utils/pagination/index.js +18 -0
- package/lib/utils/pagination/index.js.map +1 -0
- package/lib/utils/pagination/keypress-reader.d.ts +20 -0
- package/lib/utils/pagination/keypress-reader.js +63 -0
- package/lib/utils/pagination/keypress-reader.js.map +1 -0
- package/lib/utils/pagination/paginate-output.d.ts +48 -0
- package/lib/utils/pagination/paginate-output.js +136 -0
- package/lib/utils/pagination/paginate-output.js.map +1 -0
- package/messages/compatibility.check.md +71 -0
- package/messages/cuneiform.access.md +138 -0
- package/messages/definition.create.md +511 -0
- package/messages/definition.export.md +84 -0
- package/messages/definition.get.md +147 -0
- package/messages/definition.import.md +65 -0
- package/messages/definition.list.md +264 -0
- package/messages/definition.purge.md +318 -0
- package/messages/definition.update.md +118 -0
- package/messages/mcp.serve.md +66 -0
- package/messages/object.describe.md +201 -0
- package/messages/object.list.md +443 -0
- package/messages/org.details.md +386 -0
- package/messages/org.reset.md +71 -0
- package/messages/profile.md +231 -0
- package/messages/profile.request.cancel.md +143 -0
- package/messages/profile.request.delete.md +139 -0
- package/messages/profile.request.list.md +89 -0
- package/messages/summary.purge.md +218 -0
- package/messages/summary.reprofile.md +150 -0
- package/messages/summary.stop.md +157 -0
- package/messages/user.details.md +501 -0
- package/oclif.lock +2887 -2149
- package/oclif.manifest.json +2813 -31
- package/package.json +94 -19
- package/lib/commands/cuneiform/about.d.ts +0 -13
- package/lib/commands/cuneiform/about.js +0 -26
- package/lib/commands/cuneiform/about.js.map +0 -1
- package/lib/commands/hello/world.d.ts +0 -14
- package/lib/commands/hello/world.js +0 -27
- package/lib/commands/hello/world.js.map +0 -1
- package/lib/index.d.ts +0 -2
- package/lib/index.js +0 -2
- package/lib/index.js.map +0 -1
- package/messages/cuneiform.about.md +0 -19
- package/messages/hello.world.md +0 -29
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026, PeerNova, Inc. All Rights Reserved.
|
|
3
|
+
* PROPRIETARY AND CONFIDENTIAL. Unauthorized copying, modification,
|
|
4
|
+
* or distribution is strictly prohibited. Use is governed by the
|
|
5
|
+
* Master Subscription Agreement (MSA) between PeerNova, Inc. and the
|
|
6
|
+
* licensee. See LICENSE file in the repo root.
|
|
7
|
+
*/
|
|
8
|
+
import { execFile } from 'node:child_process';
|
|
9
|
+
import { promisify } from 'node:util';
|
|
10
|
+
import { SfError } from '@salesforce/core';
|
|
11
|
+
import { SFDMUErrorCodes } from '../models/sfdmu-types.js';
|
|
12
|
+
/** Default promisified execFile */
|
|
13
|
+
const defaultExecFileAsync = promisify(execFile);
|
|
14
|
+
/**
|
|
15
|
+
* Service for executing SFDMU (Salesforce Data Move Utility) operations.
|
|
16
|
+
*
|
|
17
|
+
* This service provides:
|
|
18
|
+
* - Runtime verification that SFDMU is installed
|
|
19
|
+
* - Secure shell execution using execFile (prevents command injection)
|
|
20
|
+
* - Cross-platform support (Windows/Unix)
|
|
21
|
+
* - Configurable timeout and buffer sizes
|
|
22
|
+
* - Result parsing for record counts and errors
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const service = new SFDMUService();
|
|
27
|
+
* await service.verifyInstallation();
|
|
28
|
+
* const result = await service.runExport({
|
|
29
|
+
* configPath: './export.json',
|
|
30
|
+
* sourceOrg: 'myOrg'
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export class SFDMUService {
|
|
35
|
+
/** Default timeout for SFDMU operations (5 minutes) */
|
|
36
|
+
static DEFAULT_TIMEOUT = 300_000;
|
|
37
|
+
/** Default max buffer size for stdout/stderr (10MB) */
|
|
38
|
+
static DEFAULT_MAX_BUFFER = 10 * 1024 * 1024;
|
|
39
|
+
/** The sf CLI binary name (platform-specific) */
|
|
40
|
+
sfBinary;
|
|
41
|
+
/** Logger instance */
|
|
42
|
+
logger;
|
|
43
|
+
/** Injected execFile function */
|
|
44
|
+
execFileAsync;
|
|
45
|
+
/**
|
|
46
|
+
* Creates a new SFDMUService instance.
|
|
47
|
+
*
|
|
48
|
+
* @param config - Optional configuration including logger and test dependencies
|
|
49
|
+
*/
|
|
50
|
+
constructor(config) {
|
|
51
|
+
const platform = config?.platform ?? process.platform;
|
|
52
|
+
this.sfBinary = platform === 'win32' ? 'sf.cmd' : 'sf';
|
|
53
|
+
this.logger = config?.logger;
|
|
54
|
+
this.execFileAsync = config?.execFileAsync ?? defaultExecFileAsync;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Builds command line arguments for SFDMU execution.
|
|
58
|
+
*
|
|
59
|
+
* @param options - Operation options
|
|
60
|
+
* @param operation - The operation type
|
|
61
|
+
* @returns Array of command line arguments
|
|
62
|
+
*/
|
|
63
|
+
static buildArgs(options, operation) {
|
|
64
|
+
// --noprompt: skip the interactive "Continue the job (y/n)?" prompt SFDMU raises
|
|
65
|
+
// when source CSV columns don't match the export.json query (CSVIssuesReport
|
|
66
|
+
// entries). In CI's non-TTY stdin, the abandoned prompt makes the sfdmu:run
|
|
67
|
+
// oclif command exit non-zero even when the migration itself completes — see
|
|
68
|
+
// CLI-3039 run 25355904571 where SFDMU logged "Exit code 0 (SUCCESS)" yet the
|
|
69
|
+
// child process exit was 1.
|
|
70
|
+
const args = ['sfdmu:run', '--path', options.configPath, '--noprompt'];
|
|
71
|
+
// For export: source=org, target=csvfile (writes CSV files)
|
|
72
|
+
// For import: source=csvfile, target=org (reads CSV files)
|
|
73
|
+
if (operation === 'export' && options.sourceOrg) {
|
|
74
|
+
args.push('--sourceusername', options.sourceOrg);
|
|
75
|
+
args.push('--targetusername', 'csvfile');
|
|
76
|
+
}
|
|
77
|
+
else if (operation === 'import' && options.targetOrg) {
|
|
78
|
+
args.push('--sourceusername', 'csvfile');
|
|
79
|
+
args.push('--targetusername', options.targetOrg);
|
|
80
|
+
}
|
|
81
|
+
// REST API is preferred for small datasets (<10k records) — lower overhead than Bulk.
|
|
82
|
+
// Bulk API is the default for large datasets — optimized for throughput.
|
|
83
|
+
if (options.useBulkAPI === false) {
|
|
84
|
+
args.push('--apiversion', 'rest');
|
|
85
|
+
}
|
|
86
|
+
// Note: SFDMU does not support a --simulation flag. Simulation mode is handled
|
|
87
|
+
// at the operation layer (DefinitionImportOperation) by skipping the SFDMU call
|
|
88
|
+
// entirely. The simulation field on ISFDMUOptions is retained for callers to
|
|
89
|
+
// indicate intent, but it is NOT passed as a CLI argument.
|
|
90
|
+
return args;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Parses record count from SFDMU stdout output.
|
|
94
|
+
*
|
|
95
|
+
* SFDMU (Salesforce Data Move Utility) outputs record counts in several formats
|
|
96
|
+
* depending on the operation type and verbosity level:
|
|
97
|
+
* - Summary lines: "Total: 100 records" — single authoritative count, checked first
|
|
98
|
+
* - Per-batch lines: "Processed 8 records" repeated per batch — summed to get total
|
|
99
|
+
* - Alternate phrasing: "100 records processed"
|
|
100
|
+
*
|
|
101
|
+
* Per-batch counts must be summed: SFDMU emits "Processed N records" once per batch
|
|
102
|
+
* (CLI-3140), so taking only the first match caps the reported count at the batch size.
|
|
103
|
+
*
|
|
104
|
+
* Tested against SFDMU v4.x output. If patterns fail to match, returns undefined
|
|
105
|
+
* (graceful degradation — record count is informational, not required).
|
|
106
|
+
*
|
|
107
|
+
* @param stdout - Standard output from SFDMU execution
|
|
108
|
+
* @returns Parsed record count or undefined if no pattern matched
|
|
109
|
+
*/
|
|
110
|
+
static parseRecordCount(stdout) {
|
|
111
|
+
// Check for a single authoritative total first (avoids summing batches when a summary exists)
|
|
112
|
+
const totalMatch = stdout.match(/Total[:\s]+(\d+)\s+records?/i);
|
|
113
|
+
if (totalMatch?.[1]) {
|
|
114
|
+
return parseInt(totalMatch[1], 10);
|
|
115
|
+
}
|
|
116
|
+
// Sum all "Processed N records" occurrences — SFDMU emits one per batch
|
|
117
|
+
const processedMatches = [...stdout.matchAll(/Processed\s+(\d+)\s+records?/gi)];
|
|
118
|
+
if (processedMatches.length > 0) {
|
|
119
|
+
return processedMatches.reduce((sum, m) => sum + parseInt(m[1], 10), 0);
|
|
120
|
+
}
|
|
121
|
+
// Alternate word order: "N records processed"
|
|
122
|
+
const altMatch = stdout.match(/(\d+)\s+records?\s+processed/i);
|
|
123
|
+
if (altMatch?.[1]) {
|
|
124
|
+
return parseInt(altMatch[1], 10);
|
|
125
|
+
}
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Parses error messages from SFDMU stderr output.
|
|
130
|
+
*
|
|
131
|
+
* @param stderr - Standard error from SFDMU
|
|
132
|
+
* @returns Array of error messages
|
|
133
|
+
*/
|
|
134
|
+
static parseErrors(stderr) {
|
|
135
|
+
if (!stderr.trim()) {
|
|
136
|
+
return [];
|
|
137
|
+
}
|
|
138
|
+
// Split stderr into lines and filter for error messages
|
|
139
|
+
return stderr
|
|
140
|
+
.split('\n')
|
|
141
|
+
.map((line) => line.trim())
|
|
142
|
+
.filter((line) => line.length > 0 && (line.toLowerCase().includes('error') || line.startsWith('Error:')));
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Parses warning messages from SFDMU stderr output.
|
|
146
|
+
*
|
|
147
|
+
* @param stderr - Standard error from SFDMU
|
|
148
|
+
* @returns Array of warning messages
|
|
149
|
+
*/
|
|
150
|
+
static parseWarnings(stderr) {
|
|
151
|
+
if (!stderr.trim()) {
|
|
152
|
+
return [];
|
|
153
|
+
}
|
|
154
|
+
// Split stderr into lines and filter for warnings
|
|
155
|
+
return stderr
|
|
156
|
+
.split('\n')
|
|
157
|
+
.map((line) => line.trim())
|
|
158
|
+
.filter((line) => line.length > 0 && line.toLowerCase().includes('warning'));
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Returns the sf binary name being used (for testing/debugging).
|
|
162
|
+
*/
|
|
163
|
+
getSfBinary() {
|
|
164
|
+
return this.sfBinary;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Verifies that SFDMU is installed and available.
|
|
168
|
+
*
|
|
169
|
+
* @returns Promise that resolves when SFDMU installation is verified
|
|
170
|
+
* @throws SfError with code 'SFCLINotFound' if Salesforce CLI is not installed
|
|
171
|
+
* @throws SfError with code from SFDMUErrorCodes.NOT_INSTALLED if SFDMU plugin is missing
|
|
172
|
+
*/
|
|
173
|
+
async verifyInstallation() {
|
|
174
|
+
try {
|
|
175
|
+
await this.execFileAsync(this.sfBinary, ['sfdmu', '--help'], {
|
|
176
|
+
timeout: 30_000, // 30 second timeout for help command
|
|
177
|
+
maxBuffer: 1024 * 1024, // 1MB buffer for help output
|
|
178
|
+
});
|
|
179
|
+
this.logger?.log('SFDMU installation verified');
|
|
180
|
+
}
|
|
181
|
+
catch (error) {
|
|
182
|
+
const execError = error;
|
|
183
|
+
// Check if this is a "command not found" type error
|
|
184
|
+
if (execError.code === 'ENOENT' || execError.message?.includes('not found')) {
|
|
185
|
+
throw new SfError('Salesforce CLI (sf) is not installed or not in PATH.', 'SFCLINotFound', [
|
|
186
|
+
'Install Salesforce CLI: https://developer.salesforce.com/tools/salesforcecli',
|
|
187
|
+
'Ensure sf is in your PATH',
|
|
188
|
+
]);
|
|
189
|
+
}
|
|
190
|
+
// SFDMU plugin not installed (sf found but sfdmu command failed)
|
|
191
|
+
throw new SfError('SFDMU plugin is not installed.', SFDMUErrorCodes.NOT_INSTALLED, [
|
|
192
|
+
'Install SFDMU: sf plugins install sfdmu',
|
|
193
|
+
'Documentation: https://help.sfdmu.com',
|
|
194
|
+
]);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Executes an SFDMU export operation.
|
|
199
|
+
*
|
|
200
|
+
* @param options - Export options including config path and source org
|
|
201
|
+
* @returns ServiceResult containing the execution result
|
|
202
|
+
*/
|
|
203
|
+
async runExport(options) {
|
|
204
|
+
return this.executeOperation(options, 'export');
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Executes an SFDMU import operation.
|
|
208
|
+
*
|
|
209
|
+
* @param options - Import options including config path and target org
|
|
210
|
+
* @returns ServiceResult containing the execution result
|
|
211
|
+
*/
|
|
212
|
+
async runImport(options) {
|
|
213
|
+
return this.executeOperation(options, 'import');
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Executes an SFDMU operation (export or import).
|
|
217
|
+
*
|
|
218
|
+
* @param options - Operation options
|
|
219
|
+
* @param operation - The operation type ('export' or 'import')
|
|
220
|
+
* @returns ServiceResult containing the execution result
|
|
221
|
+
*/
|
|
222
|
+
async executeOperation(options, operation) {
|
|
223
|
+
const startTime = Date.now();
|
|
224
|
+
// Verify SFDMU is installed before attempting operation
|
|
225
|
+
await this.verifyInstallation();
|
|
226
|
+
// Build command arguments
|
|
227
|
+
const args = SFDMUService.buildArgs(options, operation);
|
|
228
|
+
const timeout = options.timeout ?? SFDMUService.DEFAULT_TIMEOUT;
|
|
229
|
+
const maxBuffer = options.maxBuffer ?? SFDMUService.DEFAULT_MAX_BUFFER;
|
|
230
|
+
this.logger?.log(`Executing SFDMU ${operation}: ${this.sfBinary} ${args.join(' ')}`);
|
|
231
|
+
try {
|
|
232
|
+
const { stdout, stderr } = await this.execFileAsync(this.sfBinary, args, {
|
|
233
|
+
timeout,
|
|
234
|
+
maxBuffer,
|
|
235
|
+
});
|
|
236
|
+
const duration = Date.now() - startTime;
|
|
237
|
+
const recordsProcessed = SFDMUService.parseRecordCount(stdout);
|
|
238
|
+
const warnings = SFDMUService.parseWarnings(stderr);
|
|
239
|
+
return {
|
|
240
|
+
success: true,
|
|
241
|
+
data: {
|
|
242
|
+
exitCode: 0,
|
|
243
|
+
stdout,
|
|
244
|
+
stderr,
|
|
245
|
+
recordsProcessed,
|
|
246
|
+
errors: [],
|
|
247
|
+
},
|
|
248
|
+
message: `SFDMU ${operation} completed successfully`,
|
|
249
|
+
warnings: warnings.length > 0 ? warnings : undefined,
|
|
250
|
+
metadata: {
|
|
251
|
+
duration,
|
|
252
|
+
},
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
catch (error) {
|
|
256
|
+
const duration = Date.now() - startTime;
|
|
257
|
+
const execError = error;
|
|
258
|
+
// Handle timeout
|
|
259
|
+
if (execError.killed && execError.signal === 'SIGTERM') {
|
|
260
|
+
return {
|
|
261
|
+
success: false,
|
|
262
|
+
data: {
|
|
263
|
+
exitCode: -1,
|
|
264
|
+
stdout: execError.stdout ?? '',
|
|
265
|
+
stderr: execError.stderr ?? '',
|
|
266
|
+
errors: [`Operation timed out after ${timeout}ms`],
|
|
267
|
+
},
|
|
268
|
+
errorCode: SFDMUErrorCodes.TIMEOUT,
|
|
269
|
+
message: `SFDMU ${operation} timed out after ${timeout}ms`,
|
|
270
|
+
metadata: {
|
|
271
|
+
duration,
|
|
272
|
+
},
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
// Handle execution failure
|
|
276
|
+
const exitCode = execError.code ?? 1;
|
|
277
|
+
const errors = SFDMUService.parseErrors(execError.stderr ?? '');
|
|
278
|
+
return {
|
|
279
|
+
success: false,
|
|
280
|
+
data: {
|
|
281
|
+
exitCode: typeof exitCode === 'number' ? exitCode : 1,
|
|
282
|
+
stdout: execError.stdout ?? '',
|
|
283
|
+
stderr: execError.stderr ?? '',
|
|
284
|
+
errors,
|
|
285
|
+
},
|
|
286
|
+
errorCode: SFDMUErrorCodes.EXECUTION_FAILED,
|
|
287
|
+
message: `SFDMU ${operation} failed with exit code ${exitCode}`,
|
|
288
|
+
metadata: {
|
|
289
|
+
duration,
|
|
290
|
+
},
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
//# sourceMappingURL=SFDMUService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SFDMUService.js","sourceRoot":"","sources":["../../src/services/SFDMUService.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAgD,MAAM,oBAAoB,CAAC;AAC5F,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAA6D,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAWtH,mCAAmC;AACnC,MAAM,oBAAoB,GAAoB,SAAS,CAAC,QAAQ,CAAoB,CAAC;AAcrF;;;;;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ACL,OAAO,EAAE,KAAK;oBACd,IAAI,EAAE;wBACJ,QAAQ,EAAE,CAAC,CAAC;wBACZ,MAAM,EAAE,SAAS,CAAC,MAAM,IAAI,EAAE;wBAC9B,MAAM,EAAE,SAAS,CAAC,MAAM,IAAI,EAAE;wBAC9B,MAAM,EAAE,CAAC,6BAA6B,OAAO,IAAI,CAAC;qBACnD;oBACD,SAAS,EAAE,eAAe,CAAC,OAAO;oBAClC,OAAO,EAAE,SAAS,SAAS,oBAAoB,OAAO,IAAI;oBAC1D,QAAQ,EAAE;wBACR,QAAQ;qBACT;iBACF,CAAC;YACJ,CAAC;YAED,2BAA2B;YAC3B,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,IAAI,CAAC,CAAC;YACrC,MAAM,MAAM,GAAG,YAAY,CAAC,WAAW,CAAC,SAAS,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;YAEhE,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE;oBACJ,QAAQ,EAAE,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;oBACrD,MAAM,EAAE,SAAS,CAAC,MAAM,IAAI,EAAE;oBAC9B,MAAM,EAAE,SAAS,CAAC,MAAM,IAAI,EAAE;oBAC9B,MAAM;iBACP;gBACD,SAAS,EAAE,eAAe,CAAC,gBAAgB;gBAC3C,OAAO,EAAE,SAAS,SAAS,0BAA0B,QAAQ,EAAE;gBAC/D,QAAQ,EAAE;oBACR,QAAQ;iBACT;aACF,CAAC;QACJ,CAAC;IACH,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { ServiceResult } from '../models/service-result.js';
|
|
2
|
+
import type { IToolingApiAdapter } from '../adapters/tooling/tooling-api-adapter.js';
|
|
3
|
+
/**
|
|
4
|
+
* Information about a Salesforce tab associated with an object.
|
|
5
|
+
*/
|
|
6
|
+
export type TabInfo = {
|
|
7
|
+
/** Salesforce ID of the tab */
|
|
8
|
+
id: string;
|
|
9
|
+
/** Name of the tab */
|
|
10
|
+
name: string;
|
|
11
|
+
/** API name of the associated SObject */
|
|
12
|
+
sobjectName: string;
|
|
13
|
+
/** Whether this is a custom tab */
|
|
14
|
+
isCustom: boolean;
|
|
15
|
+
/** Display label for the tab */
|
|
16
|
+
label: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Configuration for TabDetectionService.
|
|
20
|
+
*/
|
|
21
|
+
export type ITabDetectionServiceConfig = {
|
|
22
|
+
/** Tooling API adapter for querying tab definitions */
|
|
23
|
+
toolingAdapter: IToolingApiAdapter;
|
|
24
|
+
/** Optional logger for debug output */
|
|
25
|
+
logger?: Console;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Service for detecting which Salesforce objects have tabs.
|
|
29
|
+
*
|
|
30
|
+
* Uses the Tooling API to query TabDefinition records and provides
|
|
31
|
+
* methods for checking tab existence, retrieving tab information,
|
|
32
|
+
* and filtering object lists by tab availability.
|
|
33
|
+
*
|
|
34
|
+
* @design
|
|
35
|
+
* **API Choice**: Uses Tooling API (TabDefinition) rather than REST API
|
|
36
|
+
* because tab metadata is not exposed through standard REST endpoints.
|
|
37
|
+
* TabDefinition provides accurate tab-to-object mappings including custom tabs.
|
|
38
|
+
*
|
|
39
|
+
* @design
|
|
40
|
+
* **Query Strategy**: Single-object lookups use `queryTabByObject()` for
|
|
41
|
+
* efficiency (targeted query). Bulk operations use `getAllTabs()` and
|
|
42
|
+
* filter in memory to minimize API calls.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* const service = new TabDetectionService({
|
|
47
|
+
* toolingAdapter: myToolingAdapter,
|
|
48
|
+
* logger: console,
|
|
49
|
+
* });
|
|
50
|
+
*
|
|
51
|
+
* // Check if an object has a tab
|
|
52
|
+
* const result = await service.hasTab('Account');
|
|
53
|
+
* if (result.success && result.data) {
|
|
54
|
+
* console.log('Account has a tab');
|
|
55
|
+
* }
|
|
56
|
+
*
|
|
57
|
+
* // Filter a list of objects to only those with tabs
|
|
58
|
+
* const filtered = await service.filterObjectsWithTabs(['Account', 'Contact', 'Custom__c']);
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export declare class TabDetectionService {
|
|
62
|
+
private readonly toolingAdapter;
|
|
63
|
+
private readonly logger?;
|
|
64
|
+
/**
|
|
65
|
+
* Creates a new TabDetectionService.
|
|
66
|
+
*
|
|
67
|
+
* @param config - Service configuration with tooling adapter and optional logger
|
|
68
|
+
*/
|
|
69
|
+
constructor(config: ITabDetectionServiceConfig);
|
|
70
|
+
/**
|
|
71
|
+
* Retrieves all tab definitions from the org, mapped to TabInfo objects.
|
|
72
|
+
*
|
|
73
|
+
* Only includes tabs that have a non-null, non-empty SobjectName (object tabs).
|
|
74
|
+
*
|
|
75
|
+
* @returns ServiceResult containing an array of TabInfo objects
|
|
76
|
+
*/
|
|
77
|
+
getAllTabs(): Promise<ServiceResult<TabInfo[]>>;
|
|
78
|
+
/**
|
|
79
|
+
* Checks whether a specific object has a tab defined.
|
|
80
|
+
*
|
|
81
|
+
* Uses targeted query (queryTabByObject) for efficiency — only fetches
|
|
82
|
+
* the specific object's tab rather than all tabs in the org.
|
|
83
|
+
*
|
|
84
|
+
* @param objectName - The API name of the object to check
|
|
85
|
+
* @returns ServiceResult containing true if the object has a tab, false otherwise
|
|
86
|
+
*/
|
|
87
|
+
hasTab(objectName: string): Promise<ServiceResult<boolean>>;
|
|
88
|
+
/**
|
|
89
|
+
* Retrieves tab information for a specific object.
|
|
90
|
+
*
|
|
91
|
+
* Uses targeted query (queryTabByObject) for efficiency — only fetches
|
|
92
|
+
* the specific object's tab rather than all tabs in the org.
|
|
93
|
+
*
|
|
94
|
+
* @param objectName - The API name of the object to look up
|
|
95
|
+
* @returns ServiceResult containing the TabInfo if found, or null if no tab exists
|
|
96
|
+
*/
|
|
97
|
+
getTab(objectName: string): Promise<ServiceResult<TabInfo | null>>;
|
|
98
|
+
/**
|
|
99
|
+
* Filters a list of object names to only those that have tabs.
|
|
100
|
+
*
|
|
101
|
+
* @param objectNames - Array of object API names to check
|
|
102
|
+
* @returns ServiceResult containing the subset of object names that have tabs
|
|
103
|
+
*/
|
|
104
|
+
filterObjectsWithTabs(objectNames: string[]): Promise<ServiceResult<string[]>>;
|
|
105
|
+
}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026, PeerNova, Inc. All Rights Reserved.
|
|
3
|
+
* PROPRIETARY AND CONFIDENTIAL. Unauthorized copying, modification,
|
|
4
|
+
* or distribution is strictly prohibited. Use is governed by the
|
|
5
|
+
* Master Subscription Agreement (MSA) between PeerNova, Inc. and the
|
|
6
|
+
* licensee. See LICENSE file in the repo root.
|
|
7
|
+
*/
|
|
8
|
+
import { createSuccessResult, createFailureResult } from '../models/service-result.js';
|
|
9
|
+
import { ServiceErrorCodes } from '../adapters/errors.js';
|
|
10
|
+
import { validateRequiredString, validateNonEmptyArray } from './validation.js';
|
|
11
|
+
import { MAX_TAB_OBJECT_NAMES } from './constants.js';
|
|
12
|
+
/**
|
|
13
|
+
* Service for detecting which Salesforce objects have tabs.
|
|
14
|
+
*
|
|
15
|
+
* Uses the Tooling API to query TabDefinition records and provides
|
|
16
|
+
* methods for checking tab existence, retrieving tab information,
|
|
17
|
+
* and filtering object lists by tab availability.
|
|
18
|
+
*
|
|
19
|
+
* @design
|
|
20
|
+
* **API Choice**: Uses Tooling API (TabDefinition) rather than REST API
|
|
21
|
+
* because tab metadata is not exposed through standard REST endpoints.
|
|
22
|
+
* TabDefinition provides accurate tab-to-object mappings including custom tabs.
|
|
23
|
+
*
|
|
24
|
+
* @design
|
|
25
|
+
* **Query Strategy**: Single-object lookups use `queryTabByObject()` for
|
|
26
|
+
* efficiency (targeted query). Bulk operations use `getAllTabs()` and
|
|
27
|
+
* filter in memory to minimize API calls.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const service = new TabDetectionService({
|
|
32
|
+
* toolingAdapter: myToolingAdapter,
|
|
33
|
+
* logger: console,
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* // Check if an object has a tab
|
|
37
|
+
* const result = await service.hasTab('Account');
|
|
38
|
+
* if (result.success && result.data) {
|
|
39
|
+
* console.log('Account has a tab');
|
|
40
|
+
* }
|
|
41
|
+
*
|
|
42
|
+
* // Filter a list of objects to only those with tabs
|
|
43
|
+
* const filtered = await service.filterObjectsWithTabs(['Account', 'Contact', 'Custom__c']);
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export class TabDetectionService {
|
|
47
|
+
toolingAdapter;
|
|
48
|
+
logger;
|
|
49
|
+
/**
|
|
50
|
+
* Creates a new TabDetectionService.
|
|
51
|
+
*
|
|
52
|
+
* @param config - Service configuration with tooling adapter and optional logger
|
|
53
|
+
*/
|
|
54
|
+
constructor(config) {
|
|
55
|
+
this.toolingAdapter = config.toolingAdapter;
|
|
56
|
+
this.logger = config.logger;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Retrieves all tab definitions from the org, mapped to TabInfo objects.
|
|
60
|
+
*
|
|
61
|
+
* Only includes tabs that have a non-null, non-empty SobjectName (object tabs).
|
|
62
|
+
*
|
|
63
|
+
* @returns ServiceResult containing an array of TabInfo objects
|
|
64
|
+
*/
|
|
65
|
+
async getAllTabs() {
|
|
66
|
+
const startTime = Date.now();
|
|
67
|
+
const emptyResult = [];
|
|
68
|
+
try {
|
|
69
|
+
this.logger?.log('Querying all tab definitions');
|
|
70
|
+
const queryResult = await this.toolingAdapter.queryTabs();
|
|
71
|
+
if (!queryResult.success) {
|
|
72
|
+
return createFailureResult(emptyResult, ServiceErrorCodes.TAB_QUERY_FAILED, queryResult.message ?? 'Tab query failed', {
|
|
73
|
+
metadata: { duration: Date.now() - startTime },
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
const tabs = queryResult.data
|
|
77
|
+
.filter((tab) => tab.SobjectName !== null && tab.SobjectName !== undefined && tab.SobjectName.trim().length > 0)
|
|
78
|
+
.map((tab) => ({
|
|
79
|
+
id: tab.Id,
|
|
80
|
+
name: tab.Name,
|
|
81
|
+
sobjectName: tab.SobjectName,
|
|
82
|
+
isCustom: tab.IsCustom,
|
|
83
|
+
// TabDefinition doesn't expose a separate label field; Name serves as display text
|
|
84
|
+
label: tab.Name,
|
|
85
|
+
}));
|
|
86
|
+
const duration = Date.now() - startTime;
|
|
87
|
+
this.logger?.log(`Found ${tabs.length} object tabs`);
|
|
88
|
+
return createSuccessResult(tabs, {
|
|
89
|
+
message: `Found ${tabs.length} object tabs`,
|
|
90
|
+
metadata: { duration },
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
const duration = Date.now() - startTime;
|
|
95
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
96
|
+
this.logger?.log(`Tab query failed: ${errorMessage}`);
|
|
97
|
+
return createFailureResult(emptyResult, ServiceErrorCodes.TAB_QUERY_FAILED, errorMessage, {
|
|
98
|
+
metadata: { duration },
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Checks whether a specific object has a tab defined.
|
|
104
|
+
*
|
|
105
|
+
* Uses targeted query (queryTabByObject) for efficiency — only fetches
|
|
106
|
+
* the specific object's tab rather than all tabs in the org.
|
|
107
|
+
*
|
|
108
|
+
* @param objectName - The API name of the object to check
|
|
109
|
+
* @returns ServiceResult containing true if the object has a tab, false otherwise
|
|
110
|
+
*/
|
|
111
|
+
async hasTab(objectName) {
|
|
112
|
+
const startTime = Date.now();
|
|
113
|
+
const validationError = validateRequiredString(objectName, 'Object name');
|
|
114
|
+
if (validationError) {
|
|
115
|
+
return createFailureResult(false, ServiceErrorCodes.TAB_OBJECT_NAME_REQUIRED, validationError, {
|
|
116
|
+
metadata: { duration: Date.now() - startTime },
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
// Use targeted query for efficiency (single object lookup)
|
|
120
|
+
const tabResult = await this.toolingAdapter.queryTabByObject(objectName);
|
|
121
|
+
if (!tabResult.success) {
|
|
122
|
+
return createFailureResult(false, ServiceErrorCodes.TAB_QUERY_FAILED, tabResult.message, {
|
|
123
|
+
metadata: { duration: Date.now() - startTime },
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
const hasMatch = tabResult.data !== null;
|
|
127
|
+
const duration = Date.now() - startTime;
|
|
128
|
+
return createSuccessResult(hasMatch, {
|
|
129
|
+
message: hasMatch ? `Object '${objectName}' has a tab` : `Object '${objectName}' does not have a tab`,
|
|
130
|
+
metadata: { duration },
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Retrieves tab information for a specific object.
|
|
135
|
+
*
|
|
136
|
+
* Uses targeted query (queryTabByObject) for efficiency — only fetches
|
|
137
|
+
* the specific object's tab rather than all tabs in the org.
|
|
138
|
+
*
|
|
139
|
+
* @param objectName - The API name of the object to look up
|
|
140
|
+
* @returns ServiceResult containing the TabInfo if found, or null if no tab exists
|
|
141
|
+
*/
|
|
142
|
+
async getTab(objectName) {
|
|
143
|
+
const startTime = Date.now();
|
|
144
|
+
const validationError = validateRequiredString(objectName, 'Object name');
|
|
145
|
+
if (validationError) {
|
|
146
|
+
return createFailureResult(null, ServiceErrorCodes.TAB_OBJECT_NAME_REQUIRED, validationError, {
|
|
147
|
+
metadata: { duration: Date.now() - startTime },
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
// Use targeted query for efficiency (single object lookup)
|
|
151
|
+
const tabResult = await this.toolingAdapter.queryTabByObject(objectName);
|
|
152
|
+
if (!tabResult.success) {
|
|
153
|
+
return createFailureResult(null, ServiceErrorCodes.TAB_QUERY_FAILED, tabResult.message, {
|
|
154
|
+
metadata: { duration: Date.now() - startTime },
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
const duration = Date.now() - startTime;
|
|
158
|
+
if (tabResult.data === null) {
|
|
159
|
+
return createSuccessResult(null, {
|
|
160
|
+
message: `No tab found for '${objectName}'`,
|
|
161
|
+
metadata: { duration },
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
const tab = tabResult.data;
|
|
165
|
+
const tabInfo = {
|
|
166
|
+
id: tab.Id,
|
|
167
|
+
name: tab.Name,
|
|
168
|
+
sobjectName: tab.SobjectName,
|
|
169
|
+
isCustom: tab.IsCustom,
|
|
170
|
+
// TabDefinition doesn't expose a separate label field; Name serves as display text
|
|
171
|
+
label: tab.Name,
|
|
172
|
+
};
|
|
173
|
+
return createSuccessResult(tabInfo, {
|
|
174
|
+
message: `Found tab for '${objectName}'`,
|
|
175
|
+
metadata: { duration },
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Filters a list of object names to only those that have tabs.
|
|
180
|
+
*
|
|
181
|
+
* @param objectNames - Array of object API names to check
|
|
182
|
+
* @returns ServiceResult containing the subset of object names that have tabs
|
|
183
|
+
*/
|
|
184
|
+
async filterObjectsWithTabs(objectNames) {
|
|
185
|
+
const startTime = Date.now();
|
|
186
|
+
const validationError = validateNonEmptyArray(objectNames, 'Object names', MAX_TAB_OBJECT_NAMES);
|
|
187
|
+
if (validationError) {
|
|
188
|
+
return createFailureResult([], ServiceErrorCodes.TAB_INVALID_OBJECT_NAMES, validationError, {
|
|
189
|
+
metadata: { duration: Date.now() - startTime },
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
const allTabsResult = await this.getAllTabs();
|
|
193
|
+
if (!allTabsResult.success) {
|
|
194
|
+
return createFailureResult([], allTabsResult.errorCode, allTabsResult.message, {
|
|
195
|
+
metadata: { duration: Date.now() - startTime },
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
const tabObjectNames = new Set(allTabsResult.data.map((tab) => tab.sobjectName));
|
|
199
|
+
const filtered = objectNames.filter((name) => tabObjectNames.has(name));
|
|
200
|
+
return createSuccessResult(filtered, {
|
|
201
|
+
message: `${filtered.length} of ${objectNames.length} objects have tabs`,
|
|
202
|
+
metadata: allTabsResult.metadata,
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
//# sourceMappingURL=TabDetectionService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TabDetectionService.js","sourceRoot":"","sources":["../../src/services/TabDetectionService.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AA4BtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,OAAO,mBAAmB;IACb,cAAc,CAAqB;IACnC,MAAM,CAAW;IAElC;;;;OAIG;IACH,YAAmB,MAAkC;QACnD,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;QAC5C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9B,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,UAAU;QACrB,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,MAAM,WAAW,GAAc,EAAE,CAAC;QAElC,IAAI,CAAC;YACH,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,8BAA8B,CAAC,CAAC;YAEjD,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC;YAE1D,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;gBACzB,OAAO,mBAAmB,CACxB,WAAW,EACX,iBAAiB,CAAC,gBAAgB,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