@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,685 @@
|
|
|
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 { CuneiformQueryBuilder } from '../adapters/soql/cuneiform-query-builder.js';
|
|
9
|
+
import { createSuccessResult, createFailureResult } from '../models/service-result.js';
|
|
10
|
+
import { IN_PROGRESS_SUMMARY_STATUSES, REPROFILABLE_SUMMARY_STATUSES } from '../models/summary-bulk-types.js';
|
|
11
|
+
import { ServiceErrorCodes } from '../adapters/errors.js';
|
|
12
|
+
import { validateSalesforceId, validatePagination, validateNonEmptyArray } from './validation.js';
|
|
13
|
+
import { DEFAULT_PAGINATION_LIMIT, MAX_PAGINATION_LIMIT, PROFILING_REST_BASE } from './constants.js';
|
|
14
|
+
/**
|
|
15
|
+
* SOQL field list for Profiling_SObject_Results__c queries (summary-level aggregates).
|
|
16
|
+
* Used for both list/get queries and purge/stop/reprofile workflows.
|
|
17
|
+
* Includes parent definition relationship query for the definition key.
|
|
18
|
+
*/
|
|
19
|
+
const PURGE_SUMMARY_FIELDS = [
|
|
20
|
+
'Id',
|
|
21
|
+
'Name',
|
|
22
|
+
'pnova__ProfilingDef__c',
|
|
23
|
+
'pnova__ProfilingDef__r.Name',
|
|
24
|
+
'pnova__PDef_SObjectApiName__c',
|
|
25
|
+
'pnova__PFx_TotalRecords_Profiled__c',
|
|
26
|
+
'pnova__AggFields_Profiled__c',
|
|
27
|
+
'pnova__Prf_LastDate__c',
|
|
28
|
+
'pnova__Prf_IsLatest__c',
|
|
29
|
+
'pnova__Agg_OverallStatus__c',
|
|
30
|
+
];
|
|
31
|
+
/**
|
|
32
|
+
* Terminal overall statuses for `pnova__Agg_OverallStatus__c` — used by purge SOQL filters.
|
|
33
|
+
*
|
|
34
|
+
* The ISV populates this field from Custom Labels with exactly 3 values:
|
|
35
|
+
* IN PROGRESS, COMPLETED, FAILED. Terminal = profiling work is done.
|
|
36
|
+
*
|
|
37
|
+
* NOTE: This is NOT the same as PFx_Status__c (which has SUCCESS, CANCELED, etc.).
|
|
38
|
+
* See docs/knowledge/cuneiform/profiling-request-status-reference.md Section 2.4.
|
|
39
|
+
*/
|
|
40
|
+
export const TERMINAL_SUMMARY_STATUSES = ['COMPLETED', 'FAILED'];
|
|
41
|
+
/**
|
|
42
|
+
* SOQL field list for summary list queries (getSummaries / getSummaryById).
|
|
43
|
+
* Independent of PURGE_SUMMARY_FIELDS — changes here do not affect purge workflows.
|
|
44
|
+
*/
|
|
45
|
+
const SUMMARY_LIST_FIELDS = [
|
|
46
|
+
'Id',
|
|
47
|
+
'Name',
|
|
48
|
+
'pnova__ProfilingDef__c',
|
|
49
|
+
'pnova__ProfilingDef__r.Name',
|
|
50
|
+
'pnova__PDef_SObjectApiName__c',
|
|
51
|
+
'pnova__PFx_TotalRecords_Profiled__c',
|
|
52
|
+
'pnova__AggFields_Profiled__c',
|
|
53
|
+
'CreatedDate',
|
|
54
|
+
'pnova__Prf_IsLatest__c',
|
|
55
|
+
'pnova__Agg_OverallStatus__c',
|
|
56
|
+
];
|
|
57
|
+
/**
|
|
58
|
+
* Domain service for querying Profiling_SObject_Results__c records.
|
|
59
|
+
*
|
|
60
|
+
* Provides methods to retrieve profiling summary data by definition ID
|
|
61
|
+
* or by individual summary ID, with support for pagination.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* const service = new ProfilingSummaryService({ soqlAdapter });
|
|
66
|
+
* const result = await service.getSummaries({ definitionId: '001000000000001AAA' });
|
|
67
|
+
* if (result.success) {
|
|
68
|
+
* result.data.forEach(s => console.log(`${s.fieldName}: ${s.populatedPercent}%`));
|
|
69
|
+
* }
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
export class ProfilingSummaryService {
|
|
73
|
+
soqlAdapter;
|
|
74
|
+
restAdapter;
|
|
75
|
+
logger;
|
|
76
|
+
constructor(config) {
|
|
77
|
+
this.soqlAdapter = config.soqlAdapter;
|
|
78
|
+
this.restAdapter = config.restAdapter;
|
|
79
|
+
this.logger = config.logger;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Maps a raw Salesforce list query record to a SummaryRecord.
|
|
83
|
+
*/
|
|
84
|
+
static mapToSummaryRecord(record) {
|
|
85
|
+
return {
|
|
86
|
+
id: record.Id,
|
|
87
|
+
summaryKey: record.Name,
|
|
88
|
+
definitionId: record.pnova__ProfilingDef__c,
|
|
89
|
+
definitionKey: record.pnova__ProfilingDef__r?.Name ?? '',
|
|
90
|
+
objectName: record.pnova__PDef_SObjectApiName__c ?? '',
|
|
91
|
+
totalRecordsProfiled: record.pnova__PFx_TotalRecords_Profiled__c ?? 0,
|
|
92
|
+
profiledFields: record.pnova__AggFields_Profiled__c ?? 0,
|
|
93
|
+
createdDate: record.CreatedDate,
|
|
94
|
+
isLatest: record.pnova__Prf_IsLatest__c ?? false,
|
|
95
|
+
overallStatus: record.pnova__Agg_OverallStatus__c ?? '',
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Maps a raw Salesforce purge query record to a PurgeSummaryRecord.
|
|
100
|
+
*/
|
|
101
|
+
static mapToPurgeSummaryRecord(record) {
|
|
102
|
+
return {
|
|
103
|
+
id: record.Id,
|
|
104
|
+
summaryKey: record.Name,
|
|
105
|
+
definitionId: record.pnova__ProfilingDef__c,
|
|
106
|
+
definitionKey: record.pnova__ProfilingDef__r?.Name ?? '',
|
|
107
|
+
objectName: record.pnova__PDef_SObjectApiName__c ?? '',
|
|
108
|
+
totalRecordsProfiled: record.pnova__PFx_TotalRecords_Profiled__c ?? 0,
|
|
109
|
+
profiledFields: record.pnova__AggFields_Profiled__c ?? 0,
|
|
110
|
+
lastProfiledDate: record.pnova__Prf_LastDate__c ?? null,
|
|
111
|
+
isLatest: record.pnova__Prf_IsLatest__c ?? false,
|
|
112
|
+
overallStatus: record.pnova__Agg_OverallStatus__c ?? '',
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Parses the bulk API response into a typed BulkSummaryResult.
|
|
117
|
+
*
|
|
118
|
+
* Shared by stopSummaries and reprofileSummaries to reduce duplication.
|
|
119
|
+
*
|
|
120
|
+
* @param response - The raw API response
|
|
121
|
+
* @param failureCode - The error code to use on complete failure
|
|
122
|
+
* @param startTime - Operation start time for duration calculation
|
|
123
|
+
* @returns ServiceResult with parsed BulkSummaryResult
|
|
124
|
+
*/
|
|
125
|
+
static parseBulkResponse(response, failureCode, startTime) {
|
|
126
|
+
const emptyResult = { results: [], summary: { total: 0, succeeded: 0, failed: 0 } };
|
|
127
|
+
// Handle top-level API error
|
|
128
|
+
if (!response.success && response.errors) {
|
|
129
|
+
const errorMsg = response.errors.join('; ');
|
|
130
|
+
return createFailureResult(emptyResult, failureCode, errorMsg, {
|
|
131
|
+
metadata: { duration: Date.now() - startTime },
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
// Handle null results
|
|
135
|
+
if (!response.results) {
|
|
136
|
+
return createFailureResult(emptyResult, failureCode, 'API returned no results', {
|
|
137
|
+
metadata: { duration: Date.now() - startTime },
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
// Map API results to typed items
|
|
141
|
+
const results = response.results.map((item) => ({
|
|
142
|
+
id: item.id,
|
|
143
|
+
success: item.success,
|
|
144
|
+
errorCode: item.errorCode,
|
|
145
|
+
message: item.message,
|
|
146
|
+
requestId: item.requestId,
|
|
147
|
+
}));
|
|
148
|
+
const succeeded = results.filter((r) => r.success).length;
|
|
149
|
+
const failed = results.length - succeeded;
|
|
150
|
+
const duration = Date.now() - startTime;
|
|
151
|
+
const bulkResult = {
|
|
152
|
+
results,
|
|
153
|
+
summary: { total: results.length, succeeded, failed },
|
|
154
|
+
};
|
|
155
|
+
// All failed -> failure result
|
|
156
|
+
if (succeeded === 0 && results.length > 0) {
|
|
157
|
+
return createFailureResult(bulkResult, failureCode, 'All operations failed', {
|
|
158
|
+
metadata: { duration },
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
// Partial or full success
|
|
162
|
+
const warnings = failed > 0 ? [`${failed} item(s) could not be processed`] : undefined;
|
|
163
|
+
return createSuccessResult(bulkResult, {
|
|
164
|
+
message: `Processed ${succeeded}/${results.length} item(s)`,
|
|
165
|
+
warnings,
|
|
166
|
+
metadata: { duration },
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Retrieves profiling summaries for a given definition ID.
|
|
171
|
+
*
|
|
172
|
+
* @param options - Query options including definitionId, limit, and offset
|
|
173
|
+
* @returns ServiceResult containing an array of SummaryRecord
|
|
174
|
+
*/
|
|
175
|
+
async getSummaries(options) {
|
|
176
|
+
const startTime = Date.now();
|
|
177
|
+
const emptyResult = [];
|
|
178
|
+
// Validate definition ID
|
|
179
|
+
const idError = validateSalesforceId(options.definitionId);
|
|
180
|
+
if (idError) {
|
|
181
|
+
return createFailureResult(emptyResult, ServiceErrorCodes.SUMMARY_INVALID_DEFINITION_ID, idError, {
|
|
182
|
+
metadata: { duration: Date.now() - startTime },
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
// Validate pagination
|
|
186
|
+
const paginationError = validatePagination(options.limit, options.offset, MAX_PAGINATION_LIMIT);
|
|
187
|
+
if (paginationError) {
|
|
188
|
+
return createFailureResult(emptyResult, ServiceErrorCodes.INVALID_PAGINATION, paginationError, {
|
|
189
|
+
metadata: { duration: Date.now() - startTime },
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
const limit = options.limit ?? DEFAULT_PAGINATION_LIMIT;
|
|
193
|
+
const offset = options.offset ?? 0;
|
|
194
|
+
try {
|
|
195
|
+
// Most recent first — latest summary is most relevant to the caller
|
|
196
|
+
const soql = new CuneiformQueryBuilder()
|
|
197
|
+
.select(SUMMARY_LIST_FIELDS)
|
|
198
|
+
.from('pnova__Profiling_SObject_Results__c')
|
|
199
|
+
.where('pnova__ProfilingDef__c', '=', options.definitionId)
|
|
200
|
+
.orderBy('CreatedDate', 'DESC')
|
|
201
|
+
.limit(limit)
|
|
202
|
+
.offset(offset)
|
|
203
|
+
.toSOQL();
|
|
204
|
+
this.logger?.log(`Querying profiling summaries for definition: ${options.definitionId}`);
|
|
205
|
+
const queryResult = await this.soqlAdapter.query(soql);
|
|
206
|
+
if (!queryResult.success) {
|
|
207
|
+
return createFailureResult(emptyResult, ServiceErrorCodes.SUMMARY_QUERY_FAILED, queryResult.message ?? 'Summary query failed', { metadata: { duration: Date.now() - startTime } });
|
|
208
|
+
}
|
|
209
|
+
const summaries = queryResult.data.records.map((record) => ProfilingSummaryService.mapToSummaryRecord(record));
|
|
210
|
+
const duration = Date.now() - startTime;
|
|
211
|
+
this.logger?.log(`Found ${summaries.length} profiling summaries for definition ${options.definitionId}`);
|
|
212
|
+
return createSuccessResult(summaries, {
|
|
213
|
+
message: `Found ${summaries.length} profiling summaries`,
|
|
214
|
+
metadata: { duration },
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
catch (error) {
|
|
218
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
219
|
+
this.logger?.log(`Summary query failed: ${errorMessage}`);
|
|
220
|
+
return createFailureResult(emptyResult, ServiceErrorCodes.SUMMARY_QUERY_FAILED, errorMessage, {
|
|
221
|
+
metadata: { duration: Date.now() - startTime },
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Retrieves a single profiling summary by its ID.
|
|
227
|
+
*
|
|
228
|
+
* @param id - The Salesforce ID of the Profiling_SObject_Results__c record
|
|
229
|
+
* @returns ServiceResult containing the SummaryRecord or null if not found
|
|
230
|
+
*/
|
|
231
|
+
async getSummaryById(id) {
|
|
232
|
+
const startTime = Date.now();
|
|
233
|
+
const emptyResult = null;
|
|
234
|
+
// Validate summary ID format (not definition ID - this is the summary's own record ID)
|
|
235
|
+
const idError = validateSalesforceId(id);
|
|
236
|
+
if (idError) {
|
|
237
|
+
return createFailureResult(emptyResult, ServiceErrorCodes.SUMMARY_INVALID_ID, idError, {
|
|
238
|
+
metadata: { duration: Date.now() - startTime },
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
try {
|
|
242
|
+
const soql = new CuneiformQueryBuilder()
|
|
243
|
+
.select(SUMMARY_LIST_FIELDS)
|
|
244
|
+
.from('pnova__Profiling_SObject_Results__c')
|
|
245
|
+
.where('Id', '=', id)
|
|
246
|
+
.toSOQL();
|
|
247
|
+
this.logger?.log(`Querying profiling summary by ID: ${id}`);
|
|
248
|
+
const queryResult = await this.soqlAdapter.query(soql);
|
|
249
|
+
if (!queryResult.success) {
|
|
250
|
+
return createFailureResult(emptyResult, ServiceErrorCodes.SUMMARY_QUERY_FAILED, queryResult.message ?? 'Summary query failed', { metadata: { duration: Date.now() - startTime } });
|
|
251
|
+
}
|
|
252
|
+
const duration = Date.now() - startTime;
|
|
253
|
+
if (queryResult.data.records.length === 0) {
|
|
254
|
+
this.logger?.log(`Profiling summary not found: ${id}`);
|
|
255
|
+
return createSuccessResult(emptyResult, {
|
|
256
|
+
message: `Profiling summary not found: ${id}`,
|
|
257
|
+
metadata: { duration },
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
const summary = ProfilingSummaryService.mapToSummaryRecord(queryResult.data.records[0]);
|
|
261
|
+
this.logger?.log(`Found profiling summary: ${id}`);
|
|
262
|
+
return createSuccessResult(summary, {
|
|
263
|
+
message: `Found profiling summary: ${id}`,
|
|
264
|
+
metadata: { duration },
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
catch (error) {
|
|
268
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
269
|
+
this.logger?.log(`Summary query failed: ${errorMessage}`);
|
|
270
|
+
return createFailureResult(emptyResult, ServiceErrorCodes.SUMMARY_QUERY_FAILED, errorMessage, {
|
|
271
|
+
metadata: { duration: Date.now() - startTime },
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Retrieves profiling summaries eligible for purge, filtered by parent definition IDs.
|
|
277
|
+
*
|
|
278
|
+
* Queries summary-level aggregate fields for display in the purge confirmation table.
|
|
279
|
+
* Only returns summaries with terminal profiling statuses (COMPLETED, FAILED).
|
|
280
|
+
* When pruneOnly is true, additionally filters to non-latest summaries only.
|
|
281
|
+
*
|
|
282
|
+
* @param options - Query options including definitionIds and optional pruneOnly flag
|
|
283
|
+
* @returns ServiceResult containing an array of PurgeSummaryRecord
|
|
284
|
+
*/
|
|
285
|
+
async getSummariesForPurge(options) {
|
|
286
|
+
const startTime = Date.now();
|
|
287
|
+
const emptyResult = [];
|
|
288
|
+
// Validate definition IDs
|
|
289
|
+
const idsError = validateNonEmptyArray(options.definitionIds, 'definitionIds', 200);
|
|
290
|
+
if (idsError) {
|
|
291
|
+
return createFailureResult(emptyResult, ServiceErrorCodes.SUMMARY_INVALID_IDS, idsError, {
|
|
292
|
+
metadata: { duration: Date.now() - startTime },
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
for (const id of options.definitionIds) {
|
|
296
|
+
const idError = validateSalesforceId(id);
|
|
297
|
+
if (idError) {
|
|
298
|
+
return createFailureResult(emptyResult, ServiceErrorCodes.SUMMARY_INVALID_DEFINITION_ID, idError, {
|
|
299
|
+
metadata: { duration: Date.now() - startTime },
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
try {
|
|
304
|
+
const builder = new CuneiformQueryBuilder()
|
|
305
|
+
.select(PURGE_SUMMARY_FIELDS)
|
|
306
|
+
.from('pnova__Profiling_SObject_Results__c')
|
|
307
|
+
.andWhereIn('pnova__ProfilingDef__c', options.definitionIds)
|
|
308
|
+
.andWhereIn('pnova__Agg_OverallStatus__c', [...TERMINAL_SUMMARY_STATUSES]);
|
|
309
|
+
if (options.pruneOnly) {
|
|
310
|
+
builder.andWhere('pnova__Prf_IsLatest__c', '=', false);
|
|
311
|
+
}
|
|
312
|
+
builder.orderBy('pnova__ProfilingDef__r.Name', 'ASC');
|
|
313
|
+
const soql = builder.toSOQL();
|
|
314
|
+
this.logger?.log(`Querying summaries for purge: ${soql}`);
|
|
315
|
+
const queryResult = await this.soqlAdapter.query(soql);
|
|
316
|
+
if (!queryResult.success) {
|
|
317
|
+
return createFailureResult(emptyResult, ServiceErrorCodes.SUMMARY_QUERY_FAILED, queryResult.message ?? 'Summary purge query failed', { metadata: { duration: Date.now() - startTime } });
|
|
318
|
+
}
|
|
319
|
+
const summaries = queryResult.data.records.map((record) => ProfilingSummaryService.mapToPurgeSummaryRecord(record));
|
|
320
|
+
const duration = Date.now() - startTime;
|
|
321
|
+
this.logger?.log(`Found ${summaries.length} summaries for purge`);
|
|
322
|
+
return createSuccessResult(summaries, {
|
|
323
|
+
message: `Found ${summaries.length} summaries for purge`,
|
|
324
|
+
metadata: { duration },
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
catch (error) {
|
|
328
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
329
|
+
this.logger?.log(`Summary purge query failed: ${errorMessage}`);
|
|
330
|
+
return createFailureResult(emptyResult, ServiceErrorCodes.SUMMARY_QUERY_FAILED, errorMessage, {
|
|
331
|
+
metadata: { duration: Date.now() - startTime },
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Retrieves specific profiling summaries by their IDs.
|
|
337
|
+
*
|
|
338
|
+
* Queries summaries directly by ID with terminal status filter.
|
|
339
|
+
* More efficient than getSummariesForPurge when specific IDs are known,
|
|
340
|
+
* as it avoids fetching all definitions first.
|
|
341
|
+
*
|
|
342
|
+
* @param ids - Array of Salesforce summary record IDs
|
|
343
|
+
* @returns ServiceResult containing matching PurgeSummaryRecord array
|
|
344
|
+
*/
|
|
345
|
+
async getSummariesByIds(ids) {
|
|
346
|
+
const startTime = Date.now();
|
|
347
|
+
const emptyResult = [];
|
|
348
|
+
const idsError = validateNonEmptyArray(ids, 'ids', 200);
|
|
349
|
+
if (idsError) {
|
|
350
|
+
return createFailureResult(emptyResult, ServiceErrorCodes.SUMMARY_INVALID_IDS, idsError, {
|
|
351
|
+
metadata: { duration: Date.now() - startTime },
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
for (const id of ids) {
|
|
355
|
+
const idError = validateSalesforceId(id);
|
|
356
|
+
if (idError) {
|
|
357
|
+
return createFailureResult(emptyResult, ServiceErrorCodes.SUMMARY_INVALID_ID, idError, {
|
|
358
|
+
metadata: { duration: Date.now() - startTime },
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
try {
|
|
363
|
+
const soql = new CuneiformQueryBuilder()
|
|
364
|
+
.select(PURGE_SUMMARY_FIELDS)
|
|
365
|
+
.from('pnova__Profiling_SObject_Results__c')
|
|
366
|
+
.andWhereIn('Id', ids)
|
|
367
|
+
.andWhereIn('pnova__Agg_OverallStatus__c', [...TERMINAL_SUMMARY_STATUSES])
|
|
368
|
+
.orderBy('pnova__ProfilingDef__r.Name', 'ASC')
|
|
369
|
+
.toSOQL();
|
|
370
|
+
this.logger?.log(`Querying summaries by IDs: ${ids.join(', ')}`);
|
|
371
|
+
const queryResult = await this.soqlAdapter.query(soql);
|
|
372
|
+
if (!queryResult.success) {
|
|
373
|
+
return createFailureResult(emptyResult, ServiceErrorCodes.SUMMARY_QUERY_FAILED, queryResult.message ?? 'Summary query by IDs failed', { metadata: { duration: Date.now() - startTime } });
|
|
374
|
+
}
|
|
375
|
+
const summaries = queryResult.data.records.map((record) => ProfilingSummaryService.mapToPurgeSummaryRecord(record));
|
|
376
|
+
return createSuccessResult(summaries, {
|
|
377
|
+
message: `Found ${summaries.length} of ${ids.length} requested summaries`,
|
|
378
|
+
metadata: { duration: Date.now() - startTime },
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
catch (error) {
|
|
382
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
383
|
+
return createFailureResult(emptyResult, ServiceErrorCodes.SUMMARY_QUERY_FAILED, errorMessage, {
|
|
384
|
+
metadata: { duration: Date.now() - startTime },
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Deletes a single profiling summary record.
|
|
390
|
+
*
|
|
391
|
+
* Requires the restAdapter to be configured.
|
|
392
|
+
*
|
|
393
|
+
* @param id - The Salesforce ID of the summary to delete
|
|
394
|
+
* @returns ServiceResult containing the delete result
|
|
395
|
+
*/
|
|
396
|
+
async deleteSummary(id) {
|
|
397
|
+
const startTime = Date.now();
|
|
398
|
+
const emptyResult = { id, success: false };
|
|
399
|
+
if (!this.restAdapter) {
|
|
400
|
+
return createFailureResult(emptyResult, ServiceErrorCodes.SUMMARY_DELETE_FAILED, 'REST adapter not configured for delete operations', { metadata: { duration: Date.now() - startTime } });
|
|
401
|
+
}
|
|
402
|
+
const idError = validateSalesforceId(id);
|
|
403
|
+
if (idError) {
|
|
404
|
+
return createFailureResult(emptyResult, ServiceErrorCodes.SUMMARY_INVALID_ID, idError, {
|
|
405
|
+
metadata: { duration: Date.now() - startTime },
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
try {
|
|
409
|
+
this.logger?.log(`Deleting profiling summary: ${id}`);
|
|
410
|
+
const result = await this.restAdapter.deleteRecord('pnova__Profiling_SObject_Results__c', id);
|
|
411
|
+
if (!result.success) {
|
|
412
|
+
return createFailureResult(emptyResult, ServiceErrorCodes.SUMMARY_DELETE_FAILED, result.message ?? `Failed to delete summary: ${id}`, { metadata: { duration: Date.now() - startTime } });
|
|
413
|
+
}
|
|
414
|
+
return createSuccessResult(result.data, {
|
|
415
|
+
message: `Deleted profiling summary: ${id}`,
|
|
416
|
+
metadata: { duration: Date.now() - startTime },
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
catch (error) {
|
|
420
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
421
|
+
this.logger?.log(`Summary delete failed: ${errorMessage}`);
|
|
422
|
+
return createFailureResult(emptyResult, ServiceErrorCodes.SUMMARY_DELETE_FAILED, errorMessage, {
|
|
423
|
+
metadata: { duration: Date.now() - startTime },
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Deletes multiple profiling summaries sequentially.
|
|
429
|
+
*
|
|
430
|
+
* Processes one summary at a time for reliability and progress tracking.
|
|
431
|
+
* Continues on individual failures, reporting results per summary.
|
|
432
|
+
*
|
|
433
|
+
* @param summaries - The summary records to delete
|
|
434
|
+
* @param onProgress - Optional progress callback
|
|
435
|
+
* @returns ServiceResult containing deletion statistics
|
|
436
|
+
*/
|
|
437
|
+
async deleteSummaries(summaries, onProgress) {
|
|
438
|
+
const startTime = Date.now();
|
|
439
|
+
const result = {
|
|
440
|
+
deleted: 0,
|
|
441
|
+
skipped: 0,
|
|
442
|
+
failed: 0,
|
|
443
|
+
skipReasons: [],
|
|
444
|
+
failures: [],
|
|
445
|
+
};
|
|
446
|
+
// Sequential deletion is intentional — one-at-a-time to respect Salesforce API limits
|
|
447
|
+
// eslint-disable-next-line no-await-in-loop
|
|
448
|
+
for (let i = 0; i < summaries.length; i++) {
|
|
449
|
+
const summary = summaries[i];
|
|
450
|
+
const deleteResult = await this.deleteSummary(summary.id); // eslint-disable-line no-await-in-loop
|
|
451
|
+
if (deleteResult.success) {
|
|
452
|
+
result.deleted++;
|
|
453
|
+
onProgress?.({
|
|
454
|
+
id: summary.id,
|
|
455
|
+
summaryKey: summary.summaryKey,
|
|
456
|
+
definitionKey: summary.definitionKey,
|
|
457
|
+
objectName: summary.objectName,
|
|
458
|
+
status: 'deleted',
|
|
459
|
+
current: i + 1,
|
|
460
|
+
total: summaries.length,
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
else {
|
|
464
|
+
result.failed++;
|
|
465
|
+
result.failures.push({
|
|
466
|
+
id: summary.id,
|
|
467
|
+
summaryKey: summary.summaryKey,
|
|
468
|
+
error: deleteResult.message ?? 'Unknown error',
|
|
469
|
+
});
|
|
470
|
+
onProgress?.({
|
|
471
|
+
id: summary.id,
|
|
472
|
+
summaryKey: summary.summaryKey,
|
|
473
|
+
definitionKey: summary.definitionKey,
|
|
474
|
+
objectName: summary.objectName,
|
|
475
|
+
status: 'failed',
|
|
476
|
+
reason: deleteResult.message,
|
|
477
|
+
current: i + 1,
|
|
478
|
+
total: summaries.length,
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
// Return failure when all deletions failed
|
|
483
|
+
if (result.deleted === 0 && result.failed > 0) {
|
|
484
|
+
return createFailureResult(result, ServiceErrorCodes.SUMMARY_DELETE_FAILED, `All ${result.failed} deletion(s) failed`, { metadata: { duration: Date.now() - startTime } });
|
|
485
|
+
}
|
|
486
|
+
return createSuccessResult(result, {
|
|
487
|
+
message: `Deleted ${result.deleted} summaries, ${result.failed} failed`,
|
|
488
|
+
metadata: { duration: Date.now() - startTime },
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* Queries which Salesforce objects have successful metadata profiling results.
|
|
493
|
+
*
|
|
494
|
+
* Returns unique object API names from Profiling_SObject_Results__c where
|
|
495
|
+
* metadata-only profiling has been completed with records profiled.
|
|
496
|
+
*
|
|
497
|
+
* @returns ServiceResult containing an array of unique object API names
|
|
498
|
+
*/
|
|
499
|
+
async queryProfiledObjects() {
|
|
500
|
+
const startTime = Date.now();
|
|
501
|
+
const emptyResult = [];
|
|
502
|
+
try {
|
|
503
|
+
const soql = new CuneiformQueryBuilder()
|
|
504
|
+
.select(['pnova__PDef_SObjectApiName__c'])
|
|
505
|
+
.from('pnova__Profiling_SObject_Results__c')
|
|
506
|
+
.where('pnova__Prop_IsMetadataProfilingOnly__c', '=', true)
|
|
507
|
+
.andWhere('pnova__PFx_TotalRecords_Profiled__c', '>', 0)
|
|
508
|
+
.groupBy(['pnova__PDef_SObjectApiName__c'])
|
|
509
|
+
.toSOQL();
|
|
510
|
+
this.logger?.log('Querying profiled objects from Profiling_SObject_Results__c');
|
|
511
|
+
const queryResult = await this.soqlAdapter.query(soql);
|
|
512
|
+
if (!queryResult.success) {
|
|
513
|
+
return createFailureResult(emptyResult, ServiceErrorCodes.PROFILED_OBJECTS_QUERY_FAILED, queryResult.message ?? 'Profiled objects query failed', { metadata: { duration: Date.now() - startTime } });
|
|
514
|
+
}
|
|
515
|
+
const objectNames = queryResult.data.records.map((record) => record.pnova__PDef_SObjectApiName__c);
|
|
516
|
+
const duration = Date.now() - startTime;
|
|
517
|
+
this.logger?.log(`Found ${objectNames.length} profiled objects`);
|
|
518
|
+
return createSuccessResult(objectNames, {
|
|
519
|
+
message: `Found ${objectNames.length} profiled objects`,
|
|
520
|
+
metadata: { duration },
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
catch (error) {
|
|
524
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
525
|
+
this.logger?.log(`Profiled objects query failed: ${errorMessage}`);
|
|
526
|
+
return createFailureResult(emptyResult, ServiceErrorCodes.PROFILED_OBJECTS_QUERY_FAILED, errorMessage, {
|
|
527
|
+
metadata: { duration: Date.now() - startTime },
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Retrieves in-progress profiling summaries eligible for stopping.
|
|
533
|
+
*
|
|
534
|
+
* Queries summaries with IN_PROGRESS_SUMMARY_STATUSES (IN PROGRESS).
|
|
535
|
+
* Optionally filters by object name.
|
|
536
|
+
*
|
|
537
|
+
* @param options - Optional filter by object names
|
|
538
|
+
* @returns ServiceResult containing matching PurgeSummaryRecord array
|
|
539
|
+
*/
|
|
540
|
+
async getInProgressSummaries(options) {
|
|
541
|
+
const startTime = Date.now();
|
|
542
|
+
const emptyResult = [];
|
|
543
|
+
try {
|
|
544
|
+
const builder = new CuneiformQueryBuilder()
|
|
545
|
+
.select(PURGE_SUMMARY_FIELDS)
|
|
546
|
+
.from('pnova__Profiling_SObject_Results__c')
|
|
547
|
+
.andWhereIn('pnova__Agg_OverallStatus__c', [...IN_PROGRESS_SUMMARY_STATUSES]);
|
|
548
|
+
if (options?.objectNames && options.objectNames.length > 0) {
|
|
549
|
+
builder.andWhereIn('pnova__PDef_SObjectApiName__c', options.objectNames);
|
|
550
|
+
}
|
|
551
|
+
builder.orderBy('pnova__ProfilingDef__r.Name', 'ASC');
|
|
552
|
+
const soql = builder.toSOQL();
|
|
553
|
+
this.logger?.log(`Querying in-progress summaries: ${soql}`);
|
|
554
|
+
const queryResult = await this.soqlAdapter.query(soql);
|
|
555
|
+
if (!queryResult.success) {
|
|
556
|
+
return createFailureResult(emptyResult, ServiceErrorCodes.SUMMARY_QUERY_FAILED, queryResult.message ?? 'In-progress summary query failed', { metadata: { duration: Date.now() - startTime } });
|
|
557
|
+
}
|
|
558
|
+
const summaries = queryResult.data.records.map((record) => ProfilingSummaryService.mapToPurgeSummaryRecord(record));
|
|
559
|
+
return createSuccessResult(summaries, {
|
|
560
|
+
message: `Found ${summaries.length} in-progress summaries`,
|
|
561
|
+
metadata: { duration: Date.now() - startTime },
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
catch (error) {
|
|
565
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
566
|
+
return createFailureResult(emptyResult, ServiceErrorCodes.SUMMARY_QUERY_FAILED, errorMessage, {
|
|
567
|
+
metadata: { duration: Date.now() - startTime },
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Retrieves failed or stopped profiling summaries eligible for re-profiling.
|
|
573
|
+
*
|
|
574
|
+
* Queries summaries with REPROFILABLE_SUMMARY_STATUSES (FAILED).
|
|
575
|
+
* Optionally filters by object name.
|
|
576
|
+
*
|
|
577
|
+
* @param options - Optional filter by object names
|
|
578
|
+
* @returns ServiceResult containing matching PurgeSummaryRecord array
|
|
579
|
+
*/
|
|
580
|
+
async getReprofilableSummaries(options) {
|
|
581
|
+
const startTime = Date.now();
|
|
582
|
+
const emptyResult = [];
|
|
583
|
+
try {
|
|
584
|
+
const builder = new CuneiformQueryBuilder()
|
|
585
|
+
.select(PURGE_SUMMARY_FIELDS)
|
|
586
|
+
.from('pnova__Profiling_SObject_Results__c')
|
|
587
|
+
.andWhereIn('pnova__Agg_OverallStatus__c', [...REPROFILABLE_SUMMARY_STATUSES]);
|
|
588
|
+
if (options?.objectNames && options.objectNames.length > 0) {
|
|
589
|
+
builder.andWhereIn('pnova__PDef_SObjectApiName__c', options.objectNames);
|
|
590
|
+
}
|
|
591
|
+
builder.orderBy('pnova__ProfilingDef__r.Name', 'ASC');
|
|
592
|
+
const soql = builder.toSOQL();
|
|
593
|
+
this.logger?.log(`Querying reprofilable summaries: ${soql}`);
|
|
594
|
+
const queryResult = await this.soqlAdapter.query(soql);
|
|
595
|
+
if (!queryResult.success) {
|
|
596
|
+
return createFailureResult(emptyResult, ServiceErrorCodes.SUMMARY_QUERY_FAILED, queryResult.message ?? 'Reprofilable summary query failed', { metadata: { duration: Date.now() - startTime } });
|
|
597
|
+
}
|
|
598
|
+
const summaries = queryResult.data.records.map((record) => ProfilingSummaryService.mapToPurgeSummaryRecord(record));
|
|
599
|
+
return createSuccessResult(summaries, {
|
|
600
|
+
message: `Found ${summaries.length} reprofilable summaries`,
|
|
601
|
+
metadata: { duration: Date.now() - startTime },
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
catch (error) {
|
|
605
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
606
|
+
return createFailureResult(emptyResult, ServiceErrorCodes.SUMMARY_QUERY_FAILED, errorMessage, {
|
|
607
|
+
metadata: { duration: Date.now() - startTime },
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Stops in-progress profiling summaries via the ISV REST API.
|
|
613
|
+
*
|
|
614
|
+
* Sends a PATCH request to `/services/apexrest/pnova/v1/profiling/summaries`
|
|
615
|
+
* with `{ summariesToStop: [...ids] }`. Deduplicates IDs before sending.
|
|
616
|
+
*
|
|
617
|
+
* @param summaryIds - Array of summary record IDs to stop
|
|
618
|
+
* @returns ServiceResult containing per-item results with summary counts
|
|
619
|
+
*/
|
|
620
|
+
async stopSummaries(summaryIds) {
|
|
621
|
+
const startTime = Date.now();
|
|
622
|
+
const emptyResult = { results: [], summary: { total: 0, succeeded: 0, failed: 0 } };
|
|
623
|
+
if (!this.restAdapter) {
|
|
624
|
+
return createFailureResult(emptyResult, ServiceErrorCodes.SUMMARY_STOP_FAILED, 'REST adapter not configured for stop operations', { metadata: { duration: Date.now() - startTime } });
|
|
625
|
+
}
|
|
626
|
+
const uniqueIds = [...new Set(summaryIds)];
|
|
627
|
+
try {
|
|
628
|
+
this.logger?.log(`Stopping ${uniqueIds.length} profiling summary(ies)`);
|
|
629
|
+
const restResult = await this.restAdapter.request({
|
|
630
|
+
url: `${PROFILING_REST_BASE}/summaries`,
|
|
631
|
+
method: 'PATCH',
|
|
632
|
+
body: { summariesToStop: uniqueIds },
|
|
633
|
+
});
|
|
634
|
+
if (!restResult.success) {
|
|
635
|
+
return createFailureResult(emptyResult, ServiceErrorCodes.SUMMARY_STOP_FAILED, restResult.message ?? 'Stop operation failed', { metadata: { duration: Date.now() - startTime } });
|
|
636
|
+
}
|
|
637
|
+
return ProfilingSummaryService.parseBulkResponse(restResult.data, ServiceErrorCodes.SUMMARY_STOP_FAILED, startTime);
|
|
638
|
+
}
|
|
639
|
+
catch (error) {
|
|
640
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
641
|
+
this.logger?.log(`Bulk stop failed: ${errorMessage}`);
|
|
642
|
+
return createFailureResult(emptyResult, ServiceErrorCodes.SUMMARY_STOP_FAILED, errorMessage, {
|
|
643
|
+
metadata: { duration: Date.now() - startTime },
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* Reprofiles failed or stopped profiling summaries via the ISV REST API.
|
|
649
|
+
*
|
|
650
|
+
* Sends a POST request to `/services/apexrest/pnova/v1/profiling/summaries/reprofile`
|
|
651
|
+
* with `{ summariesToReprofile: [...ids] }`. Deduplicates IDs before sending.
|
|
652
|
+
* Response includes a `requestId` per item on success (HTTP 201).
|
|
653
|
+
*
|
|
654
|
+
* @param summaryIds - Array of summary record IDs to reprofile
|
|
655
|
+
* @returns ServiceResult containing per-item results with summary counts
|
|
656
|
+
*/
|
|
657
|
+
async reprofileSummaries(summaryIds) {
|
|
658
|
+
const startTime = Date.now();
|
|
659
|
+
const emptyResult = { results: [], summary: { total: 0, succeeded: 0, failed: 0 } };
|
|
660
|
+
if (!this.restAdapter) {
|
|
661
|
+
return createFailureResult(emptyResult, ServiceErrorCodes.SUMMARY_REPROFILE_FAILED, 'REST adapter not configured for reprofile operations', { metadata: { duration: Date.now() - startTime } });
|
|
662
|
+
}
|
|
663
|
+
const uniqueIds = [...new Set(summaryIds)];
|
|
664
|
+
try {
|
|
665
|
+
this.logger?.log(`Re-profiling ${uniqueIds.length} profiling summary(ies)`);
|
|
666
|
+
const restResult = await this.restAdapter.request({
|
|
667
|
+
url: `${PROFILING_REST_BASE}/summaries/reprofile`,
|
|
668
|
+
method: 'POST',
|
|
669
|
+
body: { summariesToReprofile: uniqueIds },
|
|
670
|
+
});
|
|
671
|
+
if (!restResult.success) {
|
|
672
|
+
return createFailureResult(emptyResult, ServiceErrorCodes.SUMMARY_REPROFILE_FAILED, restResult.message ?? 'Reprofile operation failed', { metadata: { duration: Date.now() - startTime } });
|
|
673
|
+
}
|
|
674
|
+
return ProfilingSummaryService.parseBulkResponse(restResult.data, ServiceErrorCodes.SUMMARY_REPROFILE_FAILED, startTime);
|
|
675
|
+
}
|
|
676
|
+
catch (error) {
|
|
677
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
678
|
+
this.logger?.log(`Bulk reprofile failed: ${errorMessage}`);
|
|
679
|
+
return createFailureResult(emptyResult, ServiceErrorCodes.SUMMARY_REPROFILE_FAILED, errorMessage, {
|
|
680
|
+
metadata: { duration: Date.now() - startTime },
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
//# sourceMappingURL=ProfilingSummaryService.js.map
|