@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,74 @@
|
|
|
1
|
+
import type { ServiceResult } from '../models/service-result.js';
|
|
2
|
+
import { type UserConfigurationResult, type IConfigurationServiceDeps } from './UserConfigurationTypes.js';
|
|
3
|
+
/**
|
|
4
|
+
* Handles the unconfigure workflow for UserConfigurationService.
|
|
5
|
+
*
|
|
6
|
+
* Reverses the actions of configure: unassigns permission sets and
|
|
7
|
+
* disables API-only profiling. Supports idempotent operation — running
|
|
8
|
+
* unconfigure on an already-unconfigured user produces skip results.
|
|
9
|
+
*
|
|
10
|
+
* This class is instantiated by UserConfigurationService and should not be
|
|
11
|
+
* used directly by consumers.
|
|
12
|
+
*/
|
|
13
|
+
export declare class UnconfigureMode {
|
|
14
|
+
private readonly deps;
|
|
15
|
+
constructor(deps: IConfigurationServiceDeps);
|
|
16
|
+
/**
|
|
17
|
+
* Creates an empty UserConfigurationResult for error cases.
|
|
18
|
+
*/
|
|
19
|
+
private static createEmptyConfigurationResult;
|
|
20
|
+
/**
|
|
21
|
+
* Builds the configuration state from readiness check.
|
|
22
|
+
*/
|
|
23
|
+
private static buildConfigurationState;
|
|
24
|
+
/**
|
|
25
|
+
* Builds the list of unconfiguration actions (reverse of configure actions).
|
|
26
|
+
*/
|
|
27
|
+
private static buildUnconfigurationActions;
|
|
28
|
+
/**
|
|
29
|
+
* Creates the result when Cuneiform is not installed.
|
|
30
|
+
*/
|
|
31
|
+
private static createCuneiformNotInstalledResult;
|
|
32
|
+
/**
|
|
33
|
+
* Orchestrates user unconfiguration — reverses the actions of configure().
|
|
34
|
+
*
|
|
35
|
+
* Checks the current user state, identifies configuration items to reverse
|
|
36
|
+
* (permission set unassignment, API-only profiling disable), and applies them.
|
|
37
|
+
*
|
|
38
|
+
* **Idempotency**: Skips already-unconfigured items. Re-running unconfigure() on
|
|
39
|
+
* an unconfigured user will report all actions as 'skipped'.
|
|
40
|
+
*
|
|
41
|
+
* @param userId - The Salesforce user ID to unconfigure
|
|
42
|
+
* @returns ServiceResult containing UserConfigurationResult with actions taken/skipped/failed
|
|
43
|
+
*/
|
|
44
|
+
execute(userId: string): Promise<ServiceResult<UserConfigurationResult>>;
|
|
45
|
+
/**
|
|
46
|
+
* Executes a single permission set unassignment action.
|
|
47
|
+
* Queries for the PermissionSetAssignment record and deletes it.
|
|
48
|
+
*/
|
|
49
|
+
private executePermissionSetUnassignAction;
|
|
50
|
+
/**
|
|
51
|
+
* Executes a single disable API-only profiling action.
|
|
52
|
+
*/
|
|
53
|
+
private executeDisableApiOnlyProfilingAction;
|
|
54
|
+
/**
|
|
55
|
+
* Executes all unconfiguration actions sequentially.
|
|
56
|
+
*/
|
|
57
|
+
private executeUnconfigurationActions;
|
|
58
|
+
/**
|
|
59
|
+
* Fetches user readiness state and user info in parallel.
|
|
60
|
+
*/
|
|
61
|
+
private fetchUserReadinessState;
|
|
62
|
+
/**
|
|
63
|
+
* Fetches the updated configuration state after applying changes.
|
|
64
|
+
*/
|
|
65
|
+
private fetchUpdatedState;
|
|
66
|
+
/**
|
|
67
|
+
* Builds the final configuration result based on execution outcomes.
|
|
68
|
+
*/
|
|
69
|
+
private buildConfigurationResult;
|
|
70
|
+
/**
|
|
71
|
+
* Creates the result when no changes are needed.
|
|
72
|
+
*/
|
|
73
|
+
private createNoChangesResult;
|
|
74
|
+
}
|
|
@@ -0,0 +1,378 @@
|
|
|
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 { CuneiformQueryBuilder } from '../adapters/soql/cuneiform-query-builder.js';
|
|
11
|
+
import { CUNEIFORM_NAMESPACE } from './namespace-constants.js';
|
|
12
|
+
import { validateRequiredString } from './validation.js';
|
|
13
|
+
import { REQUIRED_PERMISSION_SETS, REQUIRED_PERMISSION_SET_LABELS } from './UserReadinessService.js';
|
|
14
|
+
import { CONFIGURABLE_PERMISSION_SETS, } from './UserConfigurationTypes.js';
|
|
15
|
+
/**
|
|
16
|
+
* Handles the unconfigure workflow for UserConfigurationService.
|
|
17
|
+
*
|
|
18
|
+
* Reverses the actions of configure: unassigns permission sets and
|
|
19
|
+
* disables API-only profiling. Supports idempotent operation — running
|
|
20
|
+
* unconfigure on an already-unconfigured user produces skip results.
|
|
21
|
+
*
|
|
22
|
+
* This class is instantiated by UserConfigurationService and should not be
|
|
23
|
+
* used directly by consumers.
|
|
24
|
+
*/
|
|
25
|
+
export class UnconfigureMode {
|
|
26
|
+
deps;
|
|
27
|
+
constructor(deps) {
|
|
28
|
+
this.deps = deps;
|
|
29
|
+
}
|
|
30
|
+
// ============================================================================
|
|
31
|
+
// Static helpers
|
|
32
|
+
// ============================================================================
|
|
33
|
+
/**
|
|
34
|
+
* Creates an empty UserConfigurationResult for error cases.
|
|
35
|
+
*/
|
|
36
|
+
static createEmptyConfigurationResult(userId, username = '') {
|
|
37
|
+
return {
|
|
38
|
+
user: { id: userId, username },
|
|
39
|
+
dryRun: false,
|
|
40
|
+
previousState: {
|
|
41
|
+
userId,
|
|
42
|
+
username,
|
|
43
|
+
hasRequiredPermissionSets: false,
|
|
44
|
+
missingPermissionSets: [...REQUIRED_PERMISSION_SETS],
|
|
45
|
+
apiOnlyProfilingEnabled: false,
|
|
46
|
+
},
|
|
47
|
+
actions: [],
|
|
48
|
+
currentState: null,
|
|
49
|
+
summary: {
|
|
50
|
+
changesRequired: 0,
|
|
51
|
+
changesApplied: 0,
|
|
52
|
+
changesFailed: 0,
|
|
53
|
+
isReady: false,
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Builds the configuration state from readiness check.
|
|
59
|
+
*/
|
|
60
|
+
static buildConfigurationState(userId, username, readiness) {
|
|
61
|
+
return {
|
|
62
|
+
userId,
|
|
63
|
+
username,
|
|
64
|
+
hasRequiredPermissionSets: readiness.permissionSets.hasAllRequired,
|
|
65
|
+
missingPermissionSets: readiness.permissionSets.missingRequired,
|
|
66
|
+
apiOnlyProfilingEnabled: readiness.configProfile.apiOnlyProfilingEnabled ?? false,
|
|
67
|
+
profileDeveloperName: readiness.configProfile.profileDeveloperName,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Builds the list of unconfiguration actions (reverse of configure actions).
|
|
72
|
+
*/
|
|
73
|
+
static buildUnconfigurationActions(currentState) {
|
|
74
|
+
const actions = [];
|
|
75
|
+
// Find configurable permission sets that ARE assigned (reverse: unassign them)
|
|
76
|
+
const assignedConfigurable = CONFIGURABLE_PERMISSION_SETS.filter((ps) => !currentState.missingPermissionSets.includes(ps));
|
|
77
|
+
for (const assignedPerm of assignedConfigurable) {
|
|
78
|
+
actions.push({
|
|
79
|
+
type: 'unassignPermissionSet',
|
|
80
|
+
target: assignedPerm,
|
|
81
|
+
targetLabel: REQUIRED_PERMISSION_SET_LABELS[assignedPerm],
|
|
82
|
+
status: 'applied',
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
// If API-only profiling IS enabled, add disable action
|
|
86
|
+
if (currentState.apiOnlyProfilingEnabled && currentState.profileDeveloperName) {
|
|
87
|
+
actions.push({
|
|
88
|
+
type: 'disableApiOnlyProfiling',
|
|
89
|
+
target: currentState.profileDeveloperName,
|
|
90
|
+
status: 'applied',
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
return actions;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Creates the result when Cuneiform is not installed.
|
|
97
|
+
*/
|
|
98
|
+
static createCuneiformNotInstalledResult(userId, username, previousState, startTime) {
|
|
99
|
+
return createFailureResult({
|
|
100
|
+
user: { id: userId, username },
|
|
101
|
+
dryRun: false,
|
|
102
|
+
previousState,
|
|
103
|
+
actions: [],
|
|
104
|
+
currentState: null,
|
|
105
|
+
summary: { changesRequired: 0, changesApplied: 0, changesFailed: 0, isReady: false },
|
|
106
|
+
}, ServiceErrorCodes.USER_CUNEIFORM_NAMESPACE_NOT_FOUND, 'Cuneiform for Salesforce is not installed in this org', { metadata: { duration: Date.now() - startTime } });
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Orchestrates user unconfiguration — reverses the actions of configure().
|
|
110
|
+
*
|
|
111
|
+
* Checks the current user state, identifies configuration items to reverse
|
|
112
|
+
* (permission set unassignment, API-only profiling disable), and applies them.
|
|
113
|
+
*
|
|
114
|
+
* **Idempotency**: Skips already-unconfigured items. Re-running unconfigure() on
|
|
115
|
+
* an unconfigured user will report all actions as 'skipped'.
|
|
116
|
+
*
|
|
117
|
+
* @param userId - The Salesforce user ID to unconfigure
|
|
118
|
+
* @returns ServiceResult containing UserConfigurationResult with actions taken/skipped/failed
|
|
119
|
+
*/
|
|
120
|
+
async execute(userId) {
|
|
121
|
+
const startTime = Date.now();
|
|
122
|
+
// Validate userId
|
|
123
|
+
const validationError = validateRequiredString(userId, 'User ID');
|
|
124
|
+
if (validationError) {
|
|
125
|
+
return createFailureResult(UnconfigureMode.createEmptyConfigurationResult(userId), ServiceErrorCodes.USER_CONFIG_USER_ID_REQUIRED, validationError, { metadata: { duration: Date.now() - startTime } });
|
|
126
|
+
}
|
|
127
|
+
try {
|
|
128
|
+
this.deps.logger?.log(`Unconfiguring user: ${userId}`);
|
|
129
|
+
// Step 1: Get current user readiness state
|
|
130
|
+
const { readiness: rawReadiness, username, errorResult } = await this.fetchUserReadinessState(userId, startTime);
|
|
131
|
+
if (errorResult)
|
|
132
|
+
return errorResult;
|
|
133
|
+
// readiness is guaranteed non-undefined when errorResult is null
|
|
134
|
+
const readiness = rawReadiness;
|
|
135
|
+
const previousState = UnconfigureMode.buildConfigurationState(userId, username, readiness);
|
|
136
|
+
// Check if Cuneiform is installed
|
|
137
|
+
if (!readiness.isCuneiformInstalled) {
|
|
138
|
+
return UnconfigureMode.createCuneiformNotInstalledResult(userId, username, previousState, startTime);
|
|
139
|
+
}
|
|
140
|
+
// Step 2: Identify unconfiguration actions
|
|
141
|
+
const actions = UnconfigureMode.buildUnconfigurationActions(previousState);
|
|
142
|
+
const changesRequired = actions.length;
|
|
143
|
+
// No changes needed — already unconfigured
|
|
144
|
+
if (changesRequired === 0) {
|
|
145
|
+
return this.createNoChangesResult(userId, username, previousState, actions, changesRequired, readiness.isReady, startTime);
|
|
146
|
+
}
|
|
147
|
+
// Step 3: Execute unconfiguration actions
|
|
148
|
+
const { changesApplied, changesFailed } = await this.executeUnconfigurationActions(actions, userId);
|
|
149
|
+
// Step 4: Get updated state
|
|
150
|
+
const currentState = await this.fetchUpdatedState(userId, username, changesApplied);
|
|
151
|
+
return this.buildConfigurationResult(userId, username, previousState, actions, currentState, changesRequired, changesApplied, changesFailed, Date.now() - startTime);
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
155
|
+
this.deps.logger?.log(`Unconfiguration failed: ${errorMessage}`);
|
|
156
|
+
return createFailureResult(UnconfigureMode.createEmptyConfigurationResult(userId), ServiceErrorCodes.USER_CONFIG_QUERY_FAILED, errorMessage, { metadata: { duration: Date.now() - startTime } });
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
// ============================================================================
|
|
160
|
+
// Private instance helpers
|
|
161
|
+
// ============================================================================
|
|
162
|
+
/**
|
|
163
|
+
* Executes a single permission set unassignment action.
|
|
164
|
+
* Queries for the PermissionSetAssignment record and deletes it.
|
|
165
|
+
*/
|
|
166
|
+
async executePermissionSetUnassignAction(action, userId) {
|
|
167
|
+
// First, find the permission set ID
|
|
168
|
+
const permSetIdResult = await this.deps.getPermissionSetId(action.target, CUNEIFORM_NAMESPACE);
|
|
169
|
+
if (!permSetIdResult.success || !permSetIdResult.data) {
|
|
170
|
+
return {
|
|
171
|
+
applied: false,
|
|
172
|
+
failed: true,
|
|
173
|
+
update: {
|
|
174
|
+
status: 'failed',
|
|
175
|
+
message: permSetIdResult.message ?? 'Permission set not found',
|
|
176
|
+
},
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
// Query for the PermissionSetAssignment record
|
|
180
|
+
try {
|
|
181
|
+
const soql = new CuneiformQueryBuilder()
|
|
182
|
+
.select(['Id'])
|
|
183
|
+
.from('PermissionSetAssignment')
|
|
184
|
+
.where('AssigneeId', '=', userId)
|
|
185
|
+
.andWhere('PermissionSetId', '=', permSetIdResult.data)
|
|
186
|
+
.limit(1)
|
|
187
|
+
.toSOQL();
|
|
188
|
+
const queryResult = await this.deps.soqlAdapter.query(soql);
|
|
189
|
+
if (!queryResult.success || queryResult.data.records.length === 0) {
|
|
190
|
+
// Already unassigned — idempotent skip
|
|
191
|
+
return {
|
|
192
|
+
applied: false,
|
|
193
|
+
failed: false,
|
|
194
|
+
update: { status: 'skipped', message: 'Permission set already unassigned' },
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
const assignmentId = queryResult.data.records[0].Id;
|
|
198
|
+
const deleteResult = await this.deps.restApiAdapter.deleteRecord('PermissionSetAssignment', assignmentId);
|
|
199
|
+
if (!deleteResult.success) {
|
|
200
|
+
return {
|
|
201
|
+
applied: false,
|
|
202
|
+
failed: true,
|
|
203
|
+
update: {
|
|
204
|
+
status: 'failed',
|
|
205
|
+
message: deleteResult.message ?? 'Failed to delete permission set assignment',
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
return {
|
|
210
|
+
applied: true,
|
|
211
|
+
failed: false,
|
|
212
|
+
update: {
|
|
213
|
+
status: 'applied',
|
|
214
|
+
message: 'Permission set unassigned',
|
|
215
|
+
details: { permissionSetAssignmentId: assignmentId },
|
|
216
|
+
},
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
catch (error) {
|
|
220
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
221
|
+
return {
|
|
222
|
+
applied: false,
|
|
223
|
+
failed: true,
|
|
224
|
+
update: { status: 'failed', message: errorMessage },
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Executes a single disable API-only profiling action.
|
|
230
|
+
*/
|
|
231
|
+
async executeDisableApiOnlyProfilingAction(action) {
|
|
232
|
+
const deployResult = await this.deps.disableApiOnlyProfiling(action.target);
|
|
233
|
+
if (!deployResult.success) {
|
|
234
|
+
return {
|
|
235
|
+
applied: false,
|
|
236
|
+
failed: true,
|
|
237
|
+
update: {
|
|
238
|
+
status: 'failed',
|
|
239
|
+
message: deployResult.message ?? 'Failed to disable API-only profiling',
|
|
240
|
+
},
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
const update = {
|
|
244
|
+
status: 'applied',
|
|
245
|
+
message: 'API-only profiling disable deployment triggered',
|
|
246
|
+
};
|
|
247
|
+
if (deployResult.data.jobId) {
|
|
248
|
+
update.details = { deploymentJobId: deployResult.data.jobId };
|
|
249
|
+
// Wait for deployment to complete so state is consistent for subsequent operations
|
|
250
|
+
const completionResult = await this.deps.waitForDeploymentCompletion(deployResult.data.jobId);
|
|
251
|
+
if (completionResult.success && completionResult.data.status === 'Failed') {
|
|
252
|
+
return {
|
|
253
|
+
applied: false,
|
|
254
|
+
failed: true,
|
|
255
|
+
update: {
|
|
256
|
+
status: 'failed',
|
|
257
|
+
message: completionResult.data.errorMessage ?? 'CMT disable deployment failed',
|
|
258
|
+
details: { deploymentJobId: deployResult.data.jobId },
|
|
259
|
+
},
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
update.message = `API-only profiling disable deployment ${completionResult.data.status.toLowerCase()}`;
|
|
263
|
+
}
|
|
264
|
+
return { applied: true, failed: false, update };
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Executes all unconfiguration actions sequentially.
|
|
268
|
+
*/
|
|
269
|
+
async executeUnconfigurationActions(actions, userId) {
|
|
270
|
+
let changesApplied = 0;
|
|
271
|
+
let changesFailed = 0;
|
|
272
|
+
/* eslint-disable no-await-in-loop -- Sequential execution required for unconfiguration */
|
|
273
|
+
for (const [i, action] of actions.entries()) {
|
|
274
|
+
const result = action.type === 'unassignPermissionSet'
|
|
275
|
+
? await this.executePermissionSetUnassignAction(action, userId)
|
|
276
|
+
: await this.executeDisableApiOnlyProfilingAction(action);
|
|
277
|
+
Object.assign(actions[i], result.update);
|
|
278
|
+
if (result.applied)
|
|
279
|
+
changesApplied++;
|
|
280
|
+
if (result.failed)
|
|
281
|
+
changesFailed++;
|
|
282
|
+
}
|
|
283
|
+
/* eslint-enable no-await-in-loop */
|
|
284
|
+
return { changesApplied, changesFailed };
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Fetches user readiness state and user info in parallel.
|
|
288
|
+
*/
|
|
289
|
+
async fetchUserReadinessState(userId, startTime) {
|
|
290
|
+
const [readinessResult, userInfoResult] = await Promise.all([
|
|
291
|
+
this.deps.userReadinessService.checkReadiness(userId),
|
|
292
|
+
this.deps.userReadinessService.getUserInfo(userId),
|
|
293
|
+
]);
|
|
294
|
+
if (!readinessResult.success) {
|
|
295
|
+
return {
|
|
296
|
+
readiness: undefined,
|
|
297
|
+
username: '',
|
|
298
|
+
errorResult: createFailureResult(UnconfigureMode.createEmptyConfigurationResult(userId), readinessResult.errorCode ?? ServiceErrorCodes.USER_CONFIG_QUERY_FAILED, readinessResult.message ?? 'Failed to check user readiness', { metadata: { duration: Date.now() - startTime } }),
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
return {
|
|
302
|
+
readiness: readinessResult.data,
|
|
303
|
+
username: userInfoResult.success ? userInfoResult.data.username : '',
|
|
304
|
+
errorResult: null,
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Fetches the updated configuration state after applying changes.
|
|
309
|
+
*/
|
|
310
|
+
async fetchUpdatedState(userId, username, changesApplied) {
|
|
311
|
+
if (changesApplied === 0)
|
|
312
|
+
return null;
|
|
313
|
+
const updatedReadinessResult = await this.deps.userReadinessService.checkReadiness(userId);
|
|
314
|
+
if (!updatedReadinessResult.success)
|
|
315
|
+
return null;
|
|
316
|
+
return UnconfigureMode.buildConfigurationState(userId, username, updatedReadinessResult.data);
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Builds the final configuration result based on execution outcomes.
|
|
320
|
+
*/
|
|
321
|
+
buildConfigurationResult(userId, username, previousState, actions, currentState, changesRequired, changesApplied, changesFailed, duration) {
|
|
322
|
+
const isReady = currentState?.hasRequiredPermissionSets === true && currentState?.apiOnlyProfilingEnabled === true;
|
|
323
|
+
const result = {
|
|
324
|
+
user: { id: userId, username },
|
|
325
|
+
dryRun: false,
|
|
326
|
+
previousState,
|
|
327
|
+
actions,
|
|
328
|
+
currentState,
|
|
329
|
+
summary: { changesRequired, changesApplied, changesFailed, isReady },
|
|
330
|
+
};
|
|
331
|
+
// All changes failed
|
|
332
|
+
if (changesFailed > 0 && changesApplied === 0) {
|
|
333
|
+
this.deps.logger?.log(`Configuration failed: all ${changesFailed} change(s) failed`);
|
|
334
|
+
return createFailureResult(result, ServiceErrorCodes.USER_CONFIG_PERMISSION_SET_ASSIGN_FAILED, `Configuration failed: all ${changesFailed} change(s) failed`, { metadata: { duration } });
|
|
335
|
+
}
|
|
336
|
+
// Partial failure
|
|
337
|
+
if (changesFailed > 0) {
|
|
338
|
+
this.deps.logger?.log(`Configuration partially complete: ${changesApplied} applied, ${changesFailed} failed`);
|
|
339
|
+
return createSuccessResult(result, {
|
|
340
|
+
message: `Configuration partially complete: ${changesApplied} applied, ${changesFailed} failed`,
|
|
341
|
+
warnings: [`${changesFailed} configuration action(s) failed`],
|
|
342
|
+
metadata: { duration },
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
// All changes applied successfully
|
|
346
|
+
this.deps.logger?.log(`Configuration complete: ${changesApplied} change(s) applied`);
|
|
347
|
+
return createSuccessResult(result, {
|
|
348
|
+
message: `Configuration complete: ${changesApplied} change(s) applied`,
|
|
349
|
+
metadata: { duration },
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Creates the result when no changes are needed.
|
|
354
|
+
*/
|
|
355
|
+
createNoChangesResult(userId, username, previousState, actions, changesRequired, isReadinessReady, startTime) {
|
|
356
|
+
const duration = Date.now() - startTime;
|
|
357
|
+
const isReady = changesRequired === 0 && isReadinessReady;
|
|
358
|
+
const message = 'This user is already fully configured; no changes are necessary';
|
|
359
|
+
this.deps.logger?.log(message);
|
|
360
|
+
return createSuccessResult({
|
|
361
|
+
user: { id: userId, username },
|
|
362
|
+
dryRun: false,
|
|
363
|
+
previousState,
|
|
364
|
+
actions: actions.map((a) => ({ ...a, message: 'Already configured' })),
|
|
365
|
+
currentState: previousState,
|
|
366
|
+
summary: {
|
|
367
|
+
changesRequired,
|
|
368
|
+
changesApplied: 0,
|
|
369
|
+
changesFailed: 0,
|
|
370
|
+
isReady,
|
|
371
|
+
},
|
|
372
|
+
}, {
|
|
373
|
+
message,
|
|
374
|
+
metadata: { duration },
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
//# sourceMappingURL=UnconfigureMode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnconfigureMode.js","sourceRoot":"","sources":["../../src/services/UnconfigureMode.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EAAE,wBAAwB,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AACrG,OAAO,EACL,4BAA4B,GAK7B,MAAM,6BAA6B,CAAC;AAErC;;;;;;;;;GASG;AACH,MAAM,OAAO,eAAe;IACT,IAAI,CAA4B;IAEjD,YAAmB,IAA+B;QAChD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,+EAA+E;IAC/E,iBAAiB;IACjB,+EAA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E;SACvB,CACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import type { ServiceResult } from '../models/service-result.js';
|
|
2
|
+
import type { UserConfig, DeploymentResult, DeploymentStatus, UserConfigurationResult, IUserConfigurationServiceConfig } from './UserConfigurationTypes.js';
|
|
3
|
+
export { CONFIGURABLE_PERMISSION_SETS } from './UserConfigurationTypes.js';
|
|
4
|
+
export type { UserConfig, DeploymentResult, DeploymentStatus, ConfigurationState, ConfigurationAction, UserConfigurationResult, IUserConfigurationServiceConfig, } from './UserConfigurationTypes.js';
|
|
5
|
+
/**
|
|
6
|
+
* Service for checking and updating user-level Cuneiform configuration.
|
|
7
|
+
*
|
|
8
|
+
* Provides methods to query current configuration profiles and trigger
|
|
9
|
+
* CMT updates via the ISV REST endpoint. Permission set assignment is
|
|
10
|
+
* handled via REST sObject insert.
|
|
11
|
+
*
|
|
12
|
+
* Configure and unconfigure workflows are delegated to {@link ConfigureMode}
|
|
13
|
+
* and {@link UnconfigureMode} respectively.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const service = new UserConfigurationService({
|
|
18
|
+
* soqlAdapter,
|
|
19
|
+
* restApiAdapter,
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* // Check current config
|
|
23
|
+
* const config = await service.getCurrentConfig(userId);
|
|
24
|
+
* if (config.success && !config.data.apiOnlyProfilingEnabled) {
|
|
25
|
+
* // Enable API-only profiling
|
|
26
|
+
* const result = await service.enableApiOnlyProfiling('Production');
|
|
27
|
+
* if (result.success && result.data.jobId) {
|
|
28
|
+
* // Check deployment status
|
|
29
|
+
* const status = await service.getDeploymentStatus(result.data.jobId);
|
|
30
|
+
* }
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare class UserConfigurationService {
|
|
35
|
+
private readonly soqlAdapter;
|
|
36
|
+
private readonly restApiAdapter;
|
|
37
|
+
private readonly userReadinessService?;
|
|
38
|
+
private readonly logger?;
|
|
39
|
+
/** Configure mode handler (lazy-initialized when userReadinessService is available) */
|
|
40
|
+
private configureMode?;
|
|
41
|
+
/** Unconfigure mode handler (lazy-initialized when userReadinessService is available) */
|
|
42
|
+
private unconfigureMode?;
|
|
43
|
+
constructor(config: IUserConfigurationServiceConfig);
|
|
44
|
+
/**
|
|
45
|
+
* Checks if an error message indicates Cuneiform namespace is not found.
|
|
46
|
+
*
|
|
47
|
+
* This typically means the Cuneiform for Salesforce package is not installed in the org.
|
|
48
|
+
*/
|
|
49
|
+
private static isCuneiformNamespaceNotFoundError;
|
|
50
|
+
/**
|
|
51
|
+
* Creates an empty UserConfig result for error cases.
|
|
52
|
+
*/
|
|
53
|
+
private static createEmptyConfig;
|
|
54
|
+
/**
|
|
55
|
+
* Retrieves the current Cuneiform configuration for a user.
|
|
56
|
+
*
|
|
57
|
+
* Queries the Active Configuration CMT to get the linked Configuration Profile
|
|
58
|
+
* and its settings. Returns empty config if Cuneiform is not installed.
|
|
59
|
+
*
|
|
60
|
+
* @param userId - The Salesforce user ID (for context, not filtered)
|
|
61
|
+
* @returns ServiceResult containing UserConfig
|
|
62
|
+
*/
|
|
63
|
+
getCurrentConfig(userId: string): Promise<ServiceResult<UserConfig>>;
|
|
64
|
+
/**
|
|
65
|
+
* Enables API-only profiling for a configuration profile.
|
|
66
|
+
*
|
|
67
|
+
* Triggers a CMT configuration update via the ISV REST endpoint.
|
|
68
|
+
* Returns the deployment job ID for status tracking.
|
|
69
|
+
*
|
|
70
|
+
* @param profileDeveloperName - The developer name of the Configuration Profile to update
|
|
71
|
+
* @returns ServiceResult containing DeploymentResult with job ID
|
|
72
|
+
*/
|
|
73
|
+
enableApiOnlyProfiling(profileDeveloperName: string): Promise<ServiceResult<DeploymentResult>>;
|
|
74
|
+
/**
|
|
75
|
+
* Retrieves the status of a CMT deployment job.
|
|
76
|
+
*
|
|
77
|
+
* Queries the DeployRequest object to check deployment progress.
|
|
78
|
+
*
|
|
79
|
+
* @param jobId - The deployment job ID to check
|
|
80
|
+
* @returns ServiceResult containing DeploymentStatus
|
|
81
|
+
*/
|
|
82
|
+
getDeploymentStatus(jobId: string): Promise<ServiceResult<DeploymentStatus>>;
|
|
83
|
+
/**
|
|
84
|
+
* Polls for CMT deployment completion with exponential backoff.
|
|
85
|
+
*
|
|
86
|
+
* Waits for a metadata deployment to reach a terminal state (Succeeded, Failed, or Canceled).
|
|
87
|
+
* Uses exponential backoff starting at 1s, capped at 5s, with a maximum total wait of 30s.
|
|
88
|
+
*
|
|
89
|
+
* @param jobId - The deployment job ID to monitor
|
|
90
|
+
* @returns ServiceResult containing the final DeploymentStatus
|
|
91
|
+
*/
|
|
92
|
+
waitForDeploymentCompletion(jobId: string): Promise<ServiceResult<DeploymentStatus>>;
|
|
93
|
+
/**
|
|
94
|
+
* Retrieves the ID of a permission set by name and namespace.
|
|
95
|
+
*
|
|
96
|
+
* Queries the PermissionSet object to find the permission set ID. This is
|
|
97
|
+
* needed before assigning a permission set to a user via PermissionSetAssignment.
|
|
98
|
+
*
|
|
99
|
+
* @param name - The permission set API name (e.g., 'Cuneiform_for_CRM_Global_Profiling_Support')
|
|
100
|
+
* @param namespace - The namespace prefix (e.g., 'pnova')
|
|
101
|
+
* @returns ServiceResult containing the permission set ID or null if not found
|
|
102
|
+
*/
|
|
103
|
+
getPermissionSetId(name: string, namespace: string): Promise<ServiceResult<string | null>>;
|
|
104
|
+
/**
|
|
105
|
+
* Orchestrates user configuration for Cuneiform operations.
|
|
106
|
+
*
|
|
107
|
+
* Delegates to {@link ConfigureMode} for the full configure workflow.
|
|
108
|
+
* See ConfigureMode for implementation details.
|
|
109
|
+
*
|
|
110
|
+
* @param userId - The Salesforce user ID to configure
|
|
111
|
+
* @param options - Configuration options
|
|
112
|
+
* @param options.dryRun - If true, reports planned changes without applying them (default: false)
|
|
113
|
+
* @returns ServiceResult containing UserConfigurationResult with actions taken/skipped/failed
|
|
114
|
+
*/
|
|
115
|
+
configure(userId: string, options?: {
|
|
116
|
+
dryRun?: boolean;
|
|
117
|
+
}): Promise<ServiceResult<UserConfigurationResult>>;
|
|
118
|
+
/**
|
|
119
|
+
* Orchestrates user unconfiguration — reverses the actions of configure().
|
|
120
|
+
*
|
|
121
|
+
* Delegates to {@link UnconfigureMode} for the full unconfigure workflow.
|
|
122
|
+
* See UnconfigureMode for implementation details.
|
|
123
|
+
*
|
|
124
|
+
* @param userId - The Salesforce user ID to unconfigure
|
|
125
|
+
* @returns ServiceResult containing UserConfigurationResult with actions taken/skipped/failed
|
|
126
|
+
*/
|
|
127
|
+
unconfigure(userId: string): Promise<ServiceResult<UserConfigurationResult>>;
|
|
128
|
+
/**
|
|
129
|
+
* Disables API-only profiling for a configuration profile.
|
|
130
|
+
*
|
|
131
|
+
* Triggers a CMT configuration update via the ISV REST endpoint to set
|
|
132
|
+
* Enable_API_Only_Profiling__c to false. Uses the same deployment
|
|
133
|
+
* pattern as enableApiOnlyProfiling().
|
|
134
|
+
*
|
|
135
|
+
* @param profileDeveloperName - The developer name of the Configuration Profile to update
|
|
136
|
+
* @returns ServiceResult containing DeploymentResult with job ID
|
|
137
|
+
*/
|
|
138
|
+
disableApiOnlyProfiling(profileDeveloperName: string): Promise<ServiceResult<DeploymentResult>>;
|
|
139
|
+
/**
|
|
140
|
+
* Deploys a CMT configuration update via the ISV REST endpoint and returns
|
|
141
|
+
* the result including any jobId from the response.
|
|
142
|
+
*
|
|
143
|
+
* On 404 (endpoint not available), returns a graceful error explaining that
|
|
144
|
+
* an ISV upgrade is needed.
|
|
145
|
+
*
|
|
146
|
+
* @param profileDeveloperName - The developer name of the Configuration Profile to update
|
|
147
|
+
* @param enableApiOnlyProfiling - Whether to enable (true) or disable (false) API-only profiling
|
|
148
|
+
* @returns ServiceResult containing DeploymentResult with job ID
|
|
149
|
+
*/
|
|
150
|
+
private deployCmtViaRest;
|
|
151
|
+
/**
|
|
152
|
+
* Validates dependencies required for configure()/unconfigure() methods.
|
|
153
|
+
*/
|
|
154
|
+
private validateConfigureDependencies;
|
|
155
|
+
}
|