@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,112 @@
|
|
|
1
|
+
export type { QueryResult, DescribeSObjectResult, DescribeFieldResult, DescribeGlobalResult, DescribeGlobalSObjectResult, ExecuteAnonymousResult, PicklistEntry, ChildRelationship, RecordTypeInfo, IConnectionFacade, IToolingApi, ISObjectApi, ISObjectQueryBuilder, HttpRequest, } from './connection-facade.js';
|
|
2
|
+
export type { ServiceResult, ServiceResultMetadata } from '../models/service-result.js';
|
|
3
|
+
export { createSuccessResult, createFailureResult } from '../models/service-result.js';
|
|
4
|
+
export { AdapterErrorCodes, mapSalesforceError, ErrorCodeDescriptions, type AdapterErrorCode } from './errors.js';
|
|
5
|
+
/**
|
|
6
|
+
* Default cache TTL value (5 minutes in milliseconds).
|
|
7
|
+
*
|
|
8
|
+
* The 5-minute default balances freshness with performance:
|
|
9
|
+
* - Short enough to reflect metadata changes within a typical development session
|
|
10
|
+
* - Long enough to avoid redundant API calls during iterative operations
|
|
11
|
+
* - Configurable via `CUNEIFORM_CACHE_TTL` environment variable for different use cases
|
|
12
|
+
*/
|
|
13
|
+
export declare const DEFAULT_CACHE_TTL = 300000;
|
|
14
|
+
/**
|
|
15
|
+
* Minimum API version required for adapter operations.
|
|
16
|
+
*
|
|
17
|
+
* This is set to API version 50.0 (Winter '21) which includes:
|
|
18
|
+
* - Enhanced Tooling API support for custom fields and validation rules
|
|
19
|
+
* - Improved SOQL query capabilities
|
|
20
|
+
* - ExecuteAnonymous improvements
|
|
21
|
+
*/
|
|
22
|
+
export declare const MINIMUM_API_VERSION = 50;
|
|
23
|
+
/**
|
|
24
|
+
* Parses an API version string to a numeric value.
|
|
25
|
+
*
|
|
26
|
+
* @param version - Version string (e.g., "50.0", "v50.0", "50")
|
|
27
|
+
* @returns Numeric version or undefined if invalid
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* parseApiVersion('50.0'); // Returns 50.0
|
|
32
|
+
* parseApiVersion('v52.0'); // Returns 52.0
|
|
33
|
+
* parseApiVersion('invalid'); // Returns undefined
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function parseApiVersion(version: string | undefined): number | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Checks if an API version meets the minimum requirement.
|
|
39
|
+
*
|
|
40
|
+
* @param version - Version string or number to check
|
|
41
|
+
* @param minimum - Minimum required version (default: MINIMUM_API_VERSION)
|
|
42
|
+
* @returns true if version meets or exceeds minimum, false otherwise
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* isApiVersionSupported('52.0'); // Returns true
|
|
47
|
+
* isApiVersionSupported('48.0'); // Returns false
|
|
48
|
+
* isApiVersionSupported('52.0', 55); // Returns false
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare function isApiVersionSupported(version: string | number | undefined, minimum?: number): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Asserts that an API version meets the minimum requirement.
|
|
54
|
+
*
|
|
55
|
+
* @param version - Version string or number to check
|
|
56
|
+
* @param operation - Operation name for error message
|
|
57
|
+
* @param minimum - Minimum required version (default: MINIMUM_API_VERSION)
|
|
58
|
+
* @throws Error if version is below minimum
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* assertApiVersion('52.0', 'queryCustomFields'); // No error
|
|
63
|
+
* assertApiVersion('48.0', 'queryCustomFields'); // Throws Error
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export declare function assertApiVersion(version: string | number | undefined, operation: string, minimum?: number): void;
|
|
67
|
+
/**
|
|
68
|
+
* Logs a warning if the API version is below minimum.
|
|
69
|
+
*
|
|
70
|
+
* Unlike assertApiVersion, this doesn't throw an error but logs a warning
|
|
71
|
+
* to the provided logger. This is useful for adapters that should work
|
|
72
|
+
* with older API versions but may have degraded functionality.
|
|
73
|
+
*
|
|
74
|
+
* If no logger is provided, falls back to console.warn to ensure
|
|
75
|
+
* version warnings are always visible.
|
|
76
|
+
*
|
|
77
|
+
* @param version - Version string or number to check
|
|
78
|
+
* @param operation - Operation name for the warning message
|
|
79
|
+
* @param logger - Logger to use for the warning (falls back to console.warn)
|
|
80
|
+
* @param minimum - Minimum required version (default: MINIMUM_API_VERSION)
|
|
81
|
+
* @returns true if version is supported, false if warning was logged
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* warnApiVersion('48.0', 'RestApiAdapter', console); // Logs warning, returns false
|
|
86
|
+
* warnApiVersion('52.0', 'RestApiAdapter', console); // No warning, returns true
|
|
87
|
+
* warnApiVersion('48.0', 'RestApiAdapter'); // Logs to console.warn, returns false
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
export declare function warnApiVersion(version: string | number | undefined, operation: string, logger?: Console, minimum?: number): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Gets the cache TTL from config or environment.
|
|
93
|
+
*
|
|
94
|
+
* TTL priority (highest to lowest):
|
|
95
|
+
* 1. `configTtl` parameter (programmatic override)
|
|
96
|
+
* 2. `CUNEIFORM_CACHE_TTL` environment variable (in milliseconds)
|
|
97
|
+
* 3. `DEFAULT_CACHE_TTL` constant (300,000ms = 5 minutes)
|
|
98
|
+
*
|
|
99
|
+
* @param configTtl - Optional TTL from adapter config (in milliseconds)
|
|
100
|
+
* @returns TTL in milliseconds
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```typescript
|
|
104
|
+
* // Use environment variable
|
|
105
|
+
* process.env.CUNEIFORM_CACHE_TTL = '60000'; // 1 minute
|
|
106
|
+
* const ttl = getCacheTtl(); // Returns 60000
|
|
107
|
+
*
|
|
108
|
+
* // Override with config
|
|
109
|
+
* const ttl = getCacheTtl(120000); // Returns 120000 (2 minutes)
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
export declare function getCacheTtl(configTtl?: number): number;
|
|
@@ -0,0 +1,169 @@
|
|
|
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 { SfError } from '@salesforce/core';
|
|
9
|
+
export { createSuccessResult, createFailureResult } from '../models/service-result.js';
|
|
10
|
+
// Re-export error codes
|
|
11
|
+
export { AdapterErrorCodes, mapSalesforceError, ErrorCodeDescriptions } from './errors.js';
|
|
12
|
+
/**
|
|
13
|
+
* Default cache TTL value (5 minutes in milliseconds).
|
|
14
|
+
*
|
|
15
|
+
* The 5-minute default balances freshness with performance:
|
|
16
|
+
* - Short enough to reflect metadata changes within a typical development session
|
|
17
|
+
* - Long enough to avoid redundant API calls during iterative operations
|
|
18
|
+
* - Configurable via `CUNEIFORM_CACHE_TTL` environment variable for different use cases
|
|
19
|
+
*/
|
|
20
|
+
export const DEFAULT_CACHE_TTL = 300_000;
|
|
21
|
+
/**
|
|
22
|
+
* Minimum API version required for adapter operations.
|
|
23
|
+
*
|
|
24
|
+
* This is set to API version 50.0 (Winter '21) which includes:
|
|
25
|
+
* - Enhanced Tooling API support for custom fields and validation rules
|
|
26
|
+
* - Improved SOQL query capabilities
|
|
27
|
+
* - ExecuteAnonymous improvements
|
|
28
|
+
*/
|
|
29
|
+
export const MINIMUM_API_VERSION = 50.0;
|
|
30
|
+
/**
|
|
31
|
+
* Parses an API version string to a numeric value.
|
|
32
|
+
*
|
|
33
|
+
* @param version - Version string (e.g., "50.0", "v50.0", "50")
|
|
34
|
+
* @returns Numeric version or undefined if invalid
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* parseApiVersion('50.0'); // Returns 50.0
|
|
39
|
+
* parseApiVersion('v52.0'); // Returns 52.0
|
|
40
|
+
* parseApiVersion('invalid'); // Returns undefined
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export function parseApiVersion(version) {
|
|
44
|
+
if (!version) {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
// Remove leading 'v' if present
|
|
48
|
+
const cleanVersion = version.toLowerCase().startsWith('v') ? version.slice(1) : version;
|
|
49
|
+
const parsed = parseFloat(cleanVersion);
|
|
50
|
+
return isNaN(parsed) ? undefined : parsed;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Checks if an API version meets the minimum requirement.
|
|
54
|
+
*
|
|
55
|
+
* @param version - Version string or number to check
|
|
56
|
+
* @param minimum - Minimum required version (default: MINIMUM_API_VERSION)
|
|
57
|
+
* @returns true if version meets or exceeds minimum, false otherwise
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* isApiVersionSupported('52.0'); // Returns true
|
|
62
|
+
* isApiVersionSupported('48.0'); // Returns false
|
|
63
|
+
* isApiVersionSupported('52.0', 55); // Returns false
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export function isApiVersionSupported(version, minimum = MINIMUM_API_VERSION) {
|
|
67
|
+
const numericVersion = typeof version === 'number' ? version : parseApiVersion(version);
|
|
68
|
+
if (numericVersion === undefined) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
return numericVersion >= minimum;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Asserts that an API version meets the minimum requirement.
|
|
75
|
+
*
|
|
76
|
+
* @param version - Version string or number to check
|
|
77
|
+
* @param operation - Operation name for error message
|
|
78
|
+
* @param minimum - Minimum required version (default: MINIMUM_API_VERSION)
|
|
79
|
+
* @throws Error if version is below minimum
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```typescript
|
|
83
|
+
* assertApiVersion('52.0', 'queryCustomFields'); // No error
|
|
84
|
+
* assertApiVersion('48.0', 'queryCustomFields'); // Throws Error
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
export function assertApiVersion(version, operation, minimum = MINIMUM_API_VERSION) {
|
|
88
|
+
if (!isApiVersionSupported(version, minimum)) {
|
|
89
|
+
const versionStr = version ?? 'unknown';
|
|
90
|
+
throw new SfError(`API version ${versionStr} is below minimum required version ${minimum} for ${operation}. ` +
|
|
91
|
+
`Please upgrade to API version ${minimum} or higher.`, 'UnsupportedApiVersion');
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Logs a warning if the API version is below minimum.
|
|
96
|
+
*
|
|
97
|
+
* Unlike assertApiVersion, this doesn't throw an error but logs a warning
|
|
98
|
+
* to the provided logger. This is useful for adapters that should work
|
|
99
|
+
* with older API versions but may have degraded functionality.
|
|
100
|
+
*
|
|
101
|
+
* If no logger is provided, falls back to console.warn to ensure
|
|
102
|
+
* version warnings are always visible.
|
|
103
|
+
*
|
|
104
|
+
* @param version - Version string or number to check
|
|
105
|
+
* @param operation - Operation name for the warning message
|
|
106
|
+
* @param logger - Logger to use for the warning (falls back to console.warn)
|
|
107
|
+
* @param minimum - Minimum required version (default: MINIMUM_API_VERSION)
|
|
108
|
+
* @returns true if version is supported, false if warning was logged
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```typescript
|
|
112
|
+
* warnApiVersion('48.0', 'RestApiAdapter', console); // Logs warning, returns false
|
|
113
|
+
* warnApiVersion('52.0', 'RestApiAdapter', console); // No warning, returns true
|
|
114
|
+
* warnApiVersion('48.0', 'RestApiAdapter'); // Logs to console.warn, returns false
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
export function warnApiVersion(version, operation, logger, minimum = MINIMUM_API_VERSION) {
|
|
118
|
+
if (!isApiVersionSupported(version, minimum)) {
|
|
119
|
+
const versionStr = version ?? 'unknown';
|
|
120
|
+
const message = `Warning: API version ${versionStr} is below recommended minimum ${minimum} for ${operation}. ` +
|
|
121
|
+
'Some features may not work as expected.';
|
|
122
|
+
// Use provided logger if available, otherwise fall back to console.warn
|
|
123
|
+
// to ensure version warnings are always visible
|
|
124
|
+
if (logger?.warn) {
|
|
125
|
+
logger.warn(message);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
// eslint-disable-next-line no-console -- Fallback when no logger provided
|
|
129
|
+
console.warn(message);
|
|
130
|
+
}
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Gets the cache TTL from config or environment.
|
|
137
|
+
*
|
|
138
|
+
* TTL priority (highest to lowest):
|
|
139
|
+
* 1. `configTtl` parameter (programmatic override)
|
|
140
|
+
* 2. `CUNEIFORM_CACHE_TTL` environment variable (in milliseconds)
|
|
141
|
+
* 3. `DEFAULT_CACHE_TTL` constant (300,000ms = 5 minutes)
|
|
142
|
+
*
|
|
143
|
+
* @param configTtl - Optional TTL from adapter config (in milliseconds)
|
|
144
|
+
* @returns TTL in milliseconds
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* ```typescript
|
|
148
|
+
* // Use environment variable
|
|
149
|
+
* process.env.CUNEIFORM_CACHE_TTL = '60000'; // 1 minute
|
|
150
|
+
* const ttl = getCacheTtl(); // Returns 60000
|
|
151
|
+
*
|
|
152
|
+
* // Override with config
|
|
153
|
+
* const ttl = getCacheTtl(120000); // Returns 120000 (2 minutes)
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
export function getCacheTtl(configTtl) {
|
|
157
|
+
if (configTtl !== undefined) {
|
|
158
|
+
return configTtl;
|
|
159
|
+
}
|
|
160
|
+
const envTtl = process.env.CUNEIFORM_CACHE_TTL;
|
|
161
|
+
if (envTtl) {
|
|
162
|
+
const parsed = parseInt(envTtl, 10);
|
|
163
|
+
if (!isNaN(parsed) && parsed > 0) {
|
|
164
|
+
return parsed;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return DEFAULT_CACHE_TTL;
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/adapters/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAsB3C,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAEvF,wBAAwB;AACxB,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,qBAAqB,EAAyB,MAAM,aAAa,CAAC;AAElH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAC;AAEzC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAExC;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,eAAe,CAAC,OAA2B;IACzD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,gCAAgC;IAChC,MAAM,YAAY,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IAExF,MAAM,MAAM,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IACxC,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;AAC5C,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,qBAAqB,CACnC,OAAoC,EACpC,UAAkB,mBAAmB;IAErC,MAAM,cAAc,GAAG,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IAExF,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;QACjC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,cAAc,IAAI,OAAO,CAAC;AACnC,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAoC,EACpC,SAAiB,EACjB,UAAkB,mBAAmB;IAErC,IAAI,CAAC,qBAAqB,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC;QAC7C,MAAM,UAAU,GAAG,OAAO,IAAI,SAAS,CAAC;QACxC,MAAM,IAAI,OAAO,CACf,eAAe,UAAU,sCAAsC,OAAO,QAAQ,SAAS,IAAI;YACzF,iCAAiC,OAAO,aAAa,EACvD,uBAAuB,CACxB,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,cAAc,CAC5B,OAAoC,EACpC,SAAiB,EACjB,MAAgB,EAChB,UAAkB,mBAAmB;IAErC,IAAI,CAAC,qBAAqB,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC;QAC7C,MAAM,UAAU,GAAG,OAAO,IAAI,SAAS,CAAC;QACxC,MAAM,OAAO,GACX,wBAAwB,UAAU,iCAAiC,OAAO,QAAQ,SAAS,IAAI;YAC/F,yCAAyC,CAAC;QAE5C,wEAAwE;QACxE,gDAAgD;QAChD,IAAI,MAAM,EAAE,IAAI,EAAE,CAAC;YACjB,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;aAAM,CAAC;YACN,0EAA0E;YAC1E,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxB,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,WAAW,CAAC,SAAkB;IAC5C,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC;IAC/C,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACpC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;YACjC,OAAO,MAAM,CAAC;QAChB,CAAC;IACH,CAAC;IAED,OAAO,iBAAiB,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
import { Messages } from '@salesforce/core';
|
|
3
|
+
import type { Connection } from '@salesforce/core';
|
|
4
|
+
import { type IConnectionFacade } from '../adapters/connection-facade.js';
|
|
5
|
+
import { SoqlQueryAdapter } from '../adapters/soql/soql-query-adapter.js';
|
|
6
|
+
import { RestApiAdapter } from '../adapters/rest/rest-api-adapter.js';
|
|
7
|
+
import { ToolingApiAdapter } from '../adapters/tooling/tooling-api-adapter.js';
|
|
8
|
+
/**
|
|
9
|
+
* Connection context returned by {@link CuneiformCommand.initConnection}.
|
|
10
|
+
*
|
|
11
|
+
* Contains the connection facade and pre-built adapters that most commands need.
|
|
12
|
+
*/
|
|
13
|
+
export type ConnectionContext = {
|
|
14
|
+
/** The connection facade for the target org */
|
|
15
|
+
facade: IConnectionFacade;
|
|
16
|
+
/** SOQL query adapter wrapping the facade */
|
|
17
|
+
soqlAdapter: SoqlQueryAdapter;
|
|
18
|
+
/** REST API adapter wrapping the facade */
|
|
19
|
+
restAdapter: RestApiAdapter;
|
|
20
|
+
/** Tooling API adapter wrapping the facade */
|
|
21
|
+
toolingAdapter: ToolingApiAdapter;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Creates the standard adapter stack from a connection facade.
|
|
25
|
+
*
|
|
26
|
+
* Single source of truth for adapter instantiation. All commands, operations,
|
|
27
|
+
* and MCP tools should use this instead of constructing adapters inline.
|
|
28
|
+
*
|
|
29
|
+
* @param facade - The connection facade for the target org
|
|
30
|
+
* @returns Object containing all three adapter instances
|
|
31
|
+
*/
|
|
32
|
+
export declare function createAdapterStack(facade: IConnectionFacade): {
|
|
33
|
+
soqlAdapter: SoqlQueryAdapter;
|
|
34
|
+
restAdapter: RestApiAdapter;
|
|
35
|
+
toolingAdapter: ToolingApiAdapter;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Abstract base class for all Cuneiform CLI commands.
|
|
39
|
+
*
|
|
40
|
+
* Provides a shared access gate that validates the authenticated user has
|
|
41
|
+
* the required Cuneiform permission sets and that Global Profiling is enabled
|
|
42
|
+
* before allowing command execution.
|
|
43
|
+
*
|
|
44
|
+
* Subclasses call `this.enforceAccessGate(facade)` at the start of their
|
|
45
|
+
* `run()` method after obtaining the connection facade. Commands that should
|
|
46
|
+
* bypass the gate (e.g., `user details`, which IS the diagnostic tool) simply
|
|
47
|
+
* omit the `enforceAccessGate()` call.
|
|
48
|
+
*
|
|
49
|
+
* The `skipAccessGate` static property is used by the UX snapshot test
|
|
50
|
+
* harness to auto-stub the gate for non-access-gate test scenarios.
|
|
51
|
+
*
|
|
52
|
+
* @template T The command result type
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```typescript
|
|
56
|
+
* export default class MyCommand extends CuneiformCommand<MyResult> {
|
|
57
|
+
* public async run(): Promise<MyResult> {
|
|
58
|
+
* const { flags } = await this.parse(MyCommand);
|
|
59
|
+
* const { facade, soqlAdapter, restAdapter } = await this.initConnection(flags);
|
|
60
|
+
*
|
|
61
|
+
* // Business logic follows — adapters and access gate already handled
|
|
62
|
+
* const service = new MyService({ soqlAdapter, restAdapter });
|
|
63
|
+
* }
|
|
64
|
+
* }
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export declare abstract class CuneiformCommand<T> extends SfCommand<T> {
|
|
68
|
+
/**
|
|
69
|
+
* Set to `true` in subclasses that should bypass the access gate.
|
|
70
|
+
* Example: `user details` is exempt because it IS the diagnostic tool.
|
|
71
|
+
*/
|
|
72
|
+
protected static skipAccessGate: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Resolves an error code to an i18n message using a command-specific error code map.
|
|
75
|
+
*
|
|
76
|
+
* Looks up the error code in the provided map, retrieves the corresponding i18n
|
|
77
|
+
* message, and returns it. If the message contains a `%s` placeholder, interpolates
|
|
78
|
+
* the fallback string. Messages with `%d` placeholders return the fallback directly
|
|
79
|
+
* since numeric interpolation requires context the caller must provide.
|
|
80
|
+
*
|
|
81
|
+
* Returns the fallback directly when errorCode is undefined or not in the map.
|
|
82
|
+
*
|
|
83
|
+
* @param errorCodeMap - Command-specific mapping of error codes to message bundle keys
|
|
84
|
+
* @param errorCode - The error code from the operation result
|
|
85
|
+
* @param fallback - The pre-formatted message from the operation layer
|
|
86
|
+
* @param msgs - The command's Messages instance for i18n lookup
|
|
87
|
+
* @returns The resolved user-facing error message
|
|
88
|
+
*/
|
|
89
|
+
protected static resolveErrorMessage(errorCodeMap: Record<string, string>, errorCode: string | undefined, fallback: string, msgs: Messages<string>): string;
|
|
90
|
+
/**
|
|
91
|
+
* Normalizes a multi-value string flag: splits on commas, trims whitespace, and
|
|
92
|
+
* deduplicates. Used by commands that accept comma-separated values in flags
|
|
93
|
+
* (e.g., `--request-ids`, `--definition-names`).
|
|
94
|
+
*
|
|
95
|
+
* @param raw - The raw flag value array from oclif flag parsing
|
|
96
|
+
* @param options - Optional configuration
|
|
97
|
+
* @param options.caseInsensitive - When true, deduplicates case-insensitively while preserving the casing of the first occurrence
|
|
98
|
+
* @returns Deduplicated array of trimmed values, or undefined if input is empty
|
|
99
|
+
*/
|
|
100
|
+
protected static parseMultiValueFlag(raw: string[] | undefined, options?: {
|
|
101
|
+
caseInsensitive?: boolean;
|
|
102
|
+
}): string[] | undefined;
|
|
103
|
+
/**
|
|
104
|
+
* Resolves the user-facing error message for an access gate failure.
|
|
105
|
+
*
|
|
106
|
+
* Maps service error codes to message bundle keys for actionable
|
|
107
|
+
* error messages that guide the user toward resolution.
|
|
108
|
+
*/
|
|
109
|
+
private static resolveAccessGateMessage;
|
|
110
|
+
/**
|
|
111
|
+
* Sanitizes JSON output by stripping stack traces and error causes.
|
|
112
|
+
*
|
|
113
|
+
* Prevents exposing Node.js stack traces and absolute filesystem paths
|
|
114
|
+
* in `--json` error output. Success JSON output is unaffected since it
|
|
115
|
+
* never contains `stack` or `cause` properties.
|
|
116
|
+
*/
|
|
117
|
+
logJson(json: unknown): void;
|
|
118
|
+
/**
|
|
119
|
+
* Enforces the Cuneiform profiling access gate.
|
|
120
|
+
*
|
|
121
|
+
* Validates that the authenticated user has:
|
|
122
|
+
* 1. Cuneiform for Salesforce installed in the org
|
|
123
|
+
* 2. Required permission sets assigned
|
|
124
|
+
* 3. Global Profiling enabled
|
|
125
|
+
*
|
|
126
|
+
* Throws an SfError with an actionable, user-friendly error message
|
|
127
|
+
* from the `cuneiform.access` message bundle if any check fails.
|
|
128
|
+
*
|
|
129
|
+
* @param facade - The connection facade for the target org
|
|
130
|
+
* @throws {SfError} If the user cannot use Cuneiform commands
|
|
131
|
+
*/
|
|
132
|
+
enforceAccessGate(facade: IConnectionFacade): Promise<void>;
|
|
133
|
+
/**
|
|
134
|
+
* Initializes the connection facade and standard adapters for a command.
|
|
135
|
+
*
|
|
136
|
+
* Encapsulates the common 5-line boilerplate shared by 16 of 18 commands:
|
|
137
|
+
* get connection, create facade, enforce access gate, create adapters.
|
|
138
|
+
*
|
|
139
|
+
* Commands that bypass the access gate (e.g., `user details` with
|
|
140
|
+
* `skipAccessGate = true`) will skip the gate check automatically.
|
|
141
|
+
*
|
|
142
|
+
* @param flags - The parsed command flags containing target-org and api-version
|
|
143
|
+
* @returns Connection context with facade and pre-built adapters
|
|
144
|
+
* @throws {SfError} If the access gate check fails
|
|
145
|
+
*/
|
|
146
|
+
protected initConnection(flags: {
|
|
147
|
+
'target-org': {
|
|
148
|
+
getConnection(apiVersion?: string): Connection;
|
|
149
|
+
};
|
|
150
|
+
'api-version'?: string;
|
|
151
|
+
}): Promise<ConnectionContext>;
|
|
152
|
+
}
|
|
@@ -0,0 +1,243 @@
|
|
|
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 { SfCommand } from '@salesforce/sf-plugins-core';
|
|
9
|
+
import { Messages, SfError } from '@salesforce/core';
|
|
10
|
+
import { createConnectionFacade } from '../adapters/connection-facade.js';
|
|
11
|
+
import { SoqlQueryAdapter } from '../adapters/soql/soql-query-adapter.js';
|
|
12
|
+
import { RestApiAdapter } from '../adapters/rest/rest-api-adapter.js';
|
|
13
|
+
import { ToolingApiAdapter } from '../adapters/tooling/tooling-api-adapter.js';
|
|
14
|
+
import { UserReadinessService } from '../services/UserReadinessService.js';
|
|
15
|
+
import { ServiceErrorCodes } from '../adapters/errors.js';
|
|
16
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
17
|
+
const accessMessages = Messages.loadMessages('@peernova/cuneiform-sf', 'cuneiform.access');
|
|
18
|
+
/**
|
|
19
|
+
* Creates the standard adapter stack from a connection facade.
|
|
20
|
+
*
|
|
21
|
+
* Single source of truth for adapter instantiation. All commands, operations,
|
|
22
|
+
* and MCP tools should use this instead of constructing adapters inline.
|
|
23
|
+
*
|
|
24
|
+
* @param facade - The connection facade for the target org
|
|
25
|
+
* @returns Object containing all three adapter instances
|
|
26
|
+
*/
|
|
27
|
+
export function createAdapterStack(facade) {
|
|
28
|
+
return {
|
|
29
|
+
soqlAdapter: new SoqlQueryAdapter(facade),
|
|
30
|
+
restAdapter: new RestApiAdapter(facade),
|
|
31
|
+
toolingAdapter: new ToolingApiAdapter(facade),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Abstract base class for all Cuneiform CLI commands.
|
|
36
|
+
*
|
|
37
|
+
* Provides a shared access gate that validates the authenticated user has
|
|
38
|
+
* the required Cuneiform permission sets and that Global Profiling is enabled
|
|
39
|
+
* before allowing command execution.
|
|
40
|
+
*
|
|
41
|
+
* Subclasses call `this.enforceAccessGate(facade)` at the start of their
|
|
42
|
+
* `run()` method after obtaining the connection facade. Commands that should
|
|
43
|
+
* bypass the gate (e.g., `user details`, which IS the diagnostic tool) simply
|
|
44
|
+
* omit the `enforceAccessGate()` call.
|
|
45
|
+
*
|
|
46
|
+
* The `skipAccessGate` static property is used by the UX snapshot test
|
|
47
|
+
* harness to auto-stub the gate for non-access-gate test scenarios.
|
|
48
|
+
*
|
|
49
|
+
* @template T The command result type
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* export default class MyCommand extends CuneiformCommand<MyResult> {
|
|
54
|
+
* public async run(): Promise<MyResult> {
|
|
55
|
+
* const { flags } = await this.parse(MyCommand);
|
|
56
|
+
* const { facade, soqlAdapter, restAdapter } = await this.initConnection(flags);
|
|
57
|
+
*
|
|
58
|
+
* // Business logic follows — adapters and access gate already handled
|
|
59
|
+
* const service = new MyService({ soqlAdapter, restAdapter });
|
|
60
|
+
* }
|
|
61
|
+
* }
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
// eslint-disable-next-line sf-plugin/command-summary, sf-plugin/command-example -- abstract base class has no summary or examples; subclasses provide these
|
|
65
|
+
export class CuneiformCommand extends SfCommand {
|
|
66
|
+
/**
|
|
67
|
+
* Set to `true` in subclasses that should bypass the access gate.
|
|
68
|
+
* Example: `user details` is exempt because it IS the diagnostic tool.
|
|
69
|
+
*/
|
|
70
|
+
static skipAccessGate = false;
|
|
71
|
+
/**
|
|
72
|
+
* Resolves an error code to an i18n message using a command-specific error code map.
|
|
73
|
+
*
|
|
74
|
+
* Looks up the error code in the provided map, retrieves the corresponding i18n
|
|
75
|
+
* message, and returns it. If the message contains a `%s` placeholder, interpolates
|
|
76
|
+
* the fallback string. Messages with `%d` placeholders return the fallback directly
|
|
77
|
+
* since numeric interpolation requires context the caller must provide.
|
|
78
|
+
*
|
|
79
|
+
* Returns the fallback directly when errorCode is undefined or not in the map.
|
|
80
|
+
*
|
|
81
|
+
* @param errorCodeMap - Command-specific mapping of error codes to message bundle keys
|
|
82
|
+
* @param errorCode - The error code from the operation result
|
|
83
|
+
* @param fallback - The pre-formatted message from the operation layer
|
|
84
|
+
* @param msgs - The command's Messages instance for i18n lookup
|
|
85
|
+
* @returns The resolved user-facing error message
|
|
86
|
+
*/
|
|
87
|
+
static resolveErrorMessage(errorCodeMap, errorCode, fallback, msgs) {
|
|
88
|
+
if (!errorCode || !(errorCode in errorCodeMap))
|
|
89
|
+
return fallback;
|
|
90
|
+
try {
|
|
91
|
+
const messageKey = errorCodeMap[errorCode];
|
|
92
|
+
const i18nMessage = msgs.getMessage(messageKey);
|
|
93
|
+
if (i18nMessage.includes('%s'))
|
|
94
|
+
return msgs.getMessage(messageKey, [fallback]);
|
|
95
|
+
if (i18nMessage.includes('%d'))
|
|
96
|
+
return fallback;
|
|
97
|
+
return i18nMessage;
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
return fallback;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Normalizes a multi-value string flag: splits on commas, trims whitespace, and
|
|
105
|
+
* deduplicates. Used by commands that accept comma-separated values in flags
|
|
106
|
+
* (e.g., `--request-ids`, `--definition-names`).
|
|
107
|
+
*
|
|
108
|
+
* @param raw - The raw flag value array from oclif flag parsing
|
|
109
|
+
* @param options - Optional configuration
|
|
110
|
+
* @param options.caseInsensitive - When true, deduplicates case-insensitively while preserving the casing of the first occurrence
|
|
111
|
+
* @returns Deduplicated array of trimmed values, or undefined if input is empty
|
|
112
|
+
*/
|
|
113
|
+
static parseMultiValueFlag(raw, options) {
|
|
114
|
+
if (!raw || raw.length === 0)
|
|
115
|
+
return undefined;
|
|
116
|
+
const caseInsensitive = options?.caseInsensitive ?? false;
|
|
117
|
+
const seen = new Set();
|
|
118
|
+
const parsed = raw
|
|
119
|
+
.flatMap((v) => v.split(','))
|
|
120
|
+
.map((v) => v.trim())
|
|
121
|
+
.filter((v) => {
|
|
122
|
+
if (v.length === 0)
|
|
123
|
+
return false;
|
|
124
|
+
const key = caseInsensitive ? v.toLowerCase() : v;
|
|
125
|
+
if (seen.has(key))
|
|
126
|
+
return false;
|
|
127
|
+
seen.add(key);
|
|
128
|
+
return true;
|
|
129
|
+
});
|
|
130
|
+
return parsed.length === 0 ? undefined : parsed;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Resolves the user-facing error message for an access gate failure.
|
|
134
|
+
*
|
|
135
|
+
* Maps service error codes to message bundle keys for actionable
|
|
136
|
+
* error messages that guide the user toward resolution.
|
|
137
|
+
*/
|
|
138
|
+
static resolveAccessGateMessage(errorCode, serviceMessage) {
|
|
139
|
+
switch (errorCode) {
|
|
140
|
+
case ServiceErrorCodes.FEATURE_NOT_ENABLED:
|
|
141
|
+
return accessMessages.getMessage('error.featureNotEnabled');
|
|
142
|
+
case ServiceErrorCodes.PROFILING_ACCESS_DENIED:
|
|
143
|
+
return accessMessages.getMessage('error.profilingAccessDenied');
|
|
144
|
+
case ServiceErrorCodes.GLOBAL_PROFILING_NOT_ENABLED:
|
|
145
|
+
return accessMessages.getMessage('error.globalProfilingNotEnabled');
|
|
146
|
+
case ServiceErrorCodes.SELF_REGISTRATION_NOT_ENABLED:
|
|
147
|
+
return accessMessages.getMessage('error.selfRegistrationNotEnabled');
|
|
148
|
+
case ServiceErrorCodes.USER_CUNEIFORM_NAMESPACE_NOT_FOUND:
|
|
149
|
+
return accessMessages.getMessage('error.cuneiformNotInstalled');
|
|
150
|
+
default:
|
|
151
|
+
return accessMessages.getMessage('error.accessCheckFailed', [serviceMessage]);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Sanitizes JSON output by stripping stack traces and error causes.
|
|
156
|
+
*
|
|
157
|
+
* Prevents exposing Node.js stack traces and absolute filesystem paths
|
|
158
|
+
* in `--json` error output. Success JSON output is unaffected since it
|
|
159
|
+
* never contains `stack` or `cause` properties.
|
|
160
|
+
*/
|
|
161
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- oclif logJson signature uses AnyJson | unknown
|
|
162
|
+
logJson(json) {
|
|
163
|
+
if (json && typeof json === 'object') {
|
|
164
|
+
const sanitized = { ...json };
|
|
165
|
+
delete sanitized.stack;
|
|
166
|
+
delete sanitized.cause;
|
|
167
|
+
super.logJson(sanitized);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
super.logJson(json);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Enforces the Cuneiform profiling access gate.
|
|
174
|
+
*
|
|
175
|
+
* Validates that the authenticated user has:
|
|
176
|
+
* 1. Cuneiform for Salesforce installed in the org
|
|
177
|
+
* 2. Required permission sets assigned
|
|
178
|
+
* 3. Global Profiling enabled
|
|
179
|
+
*
|
|
180
|
+
* Throws an SfError with an actionable, user-friendly error message
|
|
181
|
+
* from the `cuneiform.access` message bundle if any check fails.
|
|
182
|
+
*
|
|
183
|
+
* @param facade - The connection facade for the target org
|
|
184
|
+
* @throws {SfError} If the user cannot use Cuneiform commands
|
|
185
|
+
*/
|
|
186
|
+
// eslint-disable-next-line class-methods-use-this -- instance method so subclasses can call this.enforceAccessGate()
|
|
187
|
+
async enforceAccessGate(facade) {
|
|
188
|
+
let userId;
|
|
189
|
+
try {
|
|
190
|
+
const identity = await facade.identity();
|
|
191
|
+
userId = identity.user_id;
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
195
|
+
const sfError = new SfError(accessMessages.getMessage('error.connectionFailed', [detail]));
|
|
196
|
+
sfError.code = 'E2001';
|
|
197
|
+
throw sfError;
|
|
198
|
+
}
|
|
199
|
+
// Gate 0: Check feature status via ISV REST endpoint
|
|
200
|
+
const { restAdapter, soqlAdapter } = createAdapterStack(facade);
|
|
201
|
+
const service = new UserReadinessService({ soqlAdapter });
|
|
202
|
+
const featureResult = await service.checkFeatureStatus(restAdapter);
|
|
203
|
+
if (featureResult.success && !featureResult.data.featureEnabled) {
|
|
204
|
+
const message = CuneiformCommand.resolveAccessGateMessage(ServiceErrorCodes.FEATURE_NOT_ENABLED, '');
|
|
205
|
+
const sfError = new SfError(message);
|
|
206
|
+
sfError.code = ServiceErrorCodes.FEATURE_NOT_ENABLED;
|
|
207
|
+
throw sfError;
|
|
208
|
+
}
|
|
209
|
+
// If the feature status check fails (non-404), log warning but don't block (graceful degradation)
|
|
210
|
+
// Gates 1-3: Validate profiling access (installed, permissions, global profiling)
|
|
211
|
+
const result = await service.validateProfilingAccess(userId);
|
|
212
|
+
if (!result.success) {
|
|
213
|
+
const errorCode = result.errorCode ?? ServiceErrorCodes.USER_READINESS_QUERY_FAILED;
|
|
214
|
+
const message = CuneiformCommand.resolveAccessGateMessage(errorCode, result.message ?? '');
|
|
215
|
+
const sfError = new SfError(message);
|
|
216
|
+
sfError.code = errorCode;
|
|
217
|
+
throw sfError;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Initializes the connection facade and standard adapters for a command.
|
|
222
|
+
*
|
|
223
|
+
* Encapsulates the common 5-line boilerplate shared by 16 of 18 commands:
|
|
224
|
+
* get connection, create facade, enforce access gate, create adapters.
|
|
225
|
+
*
|
|
226
|
+
* Commands that bypass the access gate (e.g., `user details` with
|
|
227
|
+
* `skipAccessGate = true`) will skip the gate check automatically.
|
|
228
|
+
*
|
|
229
|
+
* @param flags - The parsed command flags containing target-org and api-version
|
|
230
|
+
* @returns Connection context with facade and pre-built adapters
|
|
231
|
+
* @throws {SfError} If the access gate check fails
|
|
232
|
+
*/
|
|
233
|
+
async initConnection(flags) {
|
|
234
|
+
const connection = flags['target-org'].getConnection(flags['api-version']);
|
|
235
|
+
const facade = createConnectionFacade(connection);
|
|
236
|
+
if (!this.constructor.skipAccessGate) {
|
|
237
|
+
await this.enforceAccessGate(facade);
|
|
238
|
+
}
|
|
239
|
+
const adapters = createAdapterStack(facade);
|
|
240
|
+
return { facade, ...adapters };
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
//# sourceMappingURL=cuneiform-command.js.map
|