@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,795 @@
|
|
|
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 { buildDateLiteralFilterJson, buildComparativeDateLiteralFilterJson, buildComparativeYearFilterJson, buildHistoricalYearFilterJson, buildLifetimeComparativeFilterJson, DATE_LITERAL_CONSTANTS, LITERAL_CASCADES, yearBoundaryISO, yearBoundaryDisplay, } from '../models/date-literal.js';
|
|
9
|
+
/**
|
|
10
|
+
* Complete mapping of date literal keys to their expression builder constants
|
|
11
|
+
* and SOQL equivalents. Source: ISV `constantsUtils.js` in `fsc_expressionBuilder3`.
|
|
12
|
+
*/
|
|
13
|
+
const DATE_LITERAL_MAP = {
|
|
14
|
+
TODAY: { constant: '$Constant.Today', soqlLiteral: 'TODAY', displayName: 'Today' },
|
|
15
|
+
YESTERDAY: { constant: '$Constant.Yesterday', soqlLiteral: 'YESTERDAY', displayName: 'Yesterday' },
|
|
16
|
+
THIS_WEEK: { constant: '$Constant.ThisWeek', soqlLiteral: 'THIS_WEEK', displayName: 'This Week' },
|
|
17
|
+
LAST_WEEK: { constant: '$Constant.LastWeek', soqlLiteral: 'LAST_WEEK', displayName: 'Last Week' },
|
|
18
|
+
THIS_MONTH: { constant: '$Constant.ThisMonth', soqlLiteral: 'THIS_MONTH', displayName: 'This Month' },
|
|
19
|
+
LAST_MONTH: { constant: '$Constant.LastMonth', soqlLiteral: 'LAST_MONTH', displayName: 'Last Month' },
|
|
20
|
+
THIS_QUARTER: { constant: '$Constant.ThisQuarter', soqlLiteral: 'THIS_QUARTER', displayName: 'This Quarter' },
|
|
21
|
+
LAST_QUARTER: { constant: '$Constant.LastQuarter', soqlLiteral: 'LAST_QUARTER', displayName: 'Last Quarter' },
|
|
22
|
+
THIS_YEAR: { constant: '$Constant.ThisYear', soqlLiteral: 'THIS_YEAR', displayName: 'This Year' },
|
|
23
|
+
LAST_YEAR: { constant: '$Constant.LastYear', soqlLiteral: 'LAST_YEAR', displayName: 'Last Year' },
|
|
24
|
+
TWO_YEARS_AGO: { constant: '$Constant.TwoYearsAgo', soqlLiteral: 'N_YEARS_AGO:2', displayName: 'Two Years Ago' },
|
|
25
|
+
THREE_YEARS_AGO: {
|
|
26
|
+
constant: '$Constant.ThreeYearsAgo',
|
|
27
|
+
soqlLiteral: 'N_YEARS_AGO:3',
|
|
28
|
+
displayName: 'Three Years Ago',
|
|
29
|
+
},
|
|
30
|
+
LAST_TWO_YEARS: {
|
|
31
|
+
constant: '$Constant.LastTwoYears',
|
|
32
|
+
soqlLiteral: 'LAST_N_YEARS:2',
|
|
33
|
+
displayName: 'Last Two Years',
|
|
34
|
+
},
|
|
35
|
+
LAST_THREE_YEARS: {
|
|
36
|
+
constant: '$Constant.LastThreeYears',
|
|
37
|
+
soqlLiteral: 'LAST_N_YEARS:3',
|
|
38
|
+
displayName: 'Last Three Years',
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Business process outcome field mapping.
|
|
43
|
+
* These boolean fields are system-maintained, universal across all orgs.
|
|
44
|
+
*/
|
|
45
|
+
const OUTCOME_FIELD_MAP = {
|
|
46
|
+
Opportunity: { fieldName: 'IsWon', trueLabel: 'Won', falseLabel: 'Lost' },
|
|
47
|
+
Case: { fieldName: 'IsClosed', trueLabel: 'Closed', falseLabel: 'Open' },
|
|
48
|
+
Lead: { fieldName: 'IsConverted', trueLabel: 'Converted', falseLabel: 'Unconverted' },
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Pure field generation service for profiling definitions.
|
|
52
|
+
*
|
|
53
|
+
* Encapsulates stateless naming, categorisation, description, and candidate-input
|
|
54
|
+
* building logic extracted from DefinitionCreateOperation. Every method is
|
|
55
|
+
* `public static` — no constructor dependencies, no adapters, no connection.
|
|
56
|
+
*
|
|
57
|
+
* The DefinitionCreateOperation delegates to this service for:
|
|
58
|
+
* - Definition name resolution (buildName, resolveDefinitionName)
|
|
59
|
+
* - Category / time-category / segment-category resolution
|
|
60
|
+
* - Description template generation
|
|
61
|
+
* - Candidate input construction for metadata, historical, comparative, record-type, and outcome methods
|
|
62
|
+
* - Outcome field lookup and filter JSON construction
|
|
63
|
+
*/
|
|
64
|
+
export class DefinitionFieldGenerationService {
|
|
65
|
+
/** Exposes the date literal constant map for external consumers and tests. */
|
|
66
|
+
static DATE_LITERAL_MAP = DATE_LITERAL_MAP;
|
|
67
|
+
/** The bullet separator used in definition names. */
|
|
68
|
+
static NAME_SEPARATOR = ' \u2022 ';
|
|
69
|
+
// ── Public API (composition) ──────────────────────────────────────
|
|
70
|
+
/**
|
|
71
|
+
* Resolves the definition name from the method and context.
|
|
72
|
+
* Single source of truth for definition naming across all definition types.
|
|
73
|
+
*
|
|
74
|
+
* @param label - Object label (e.g., 'Account', 'Lead')
|
|
75
|
+
* @param method - ISV method (metadata, historical, comparative)
|
|
76
|
+
* @param context - Optional context: timeLabel, year, recordTypeName, outcomeLabels, unbounded
|
|
77
|
+
* @returns The formatted definition name
|
|
78
|
+
*/
|
|
79
|
+
static resolveDefinitionName(label, method, context) {
|
|
80
|
+
const baseName = DefinitionFieldGenerationService.buildName(label, method, context ?? {});
|
|
81
|
+
const sep = DefinitionFieldGenerationService.NAME_SEPARATOR;
|
|
82
|
+
// namePrefix joins with a plain space (matching REST path ISV behavior).
|
|
83
|
+
// nameSuffix joins with the bullet separator (• ).
|
|
84
|
+
const withSuffix = context?.nameSuffix ? `${baseName}${sep}${context.nameSuffix}` : baseName;
|
|
85
|
+
return context?.namePrefix ? `${context.namePrefix} ${withSuffix}` : withSuffix;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Resolves all definition metadata (category, timeCategory, segmentCategory, description)
|
|
89
|
+
* from the method and context. Single source of truth for definition classification.
|
|
90
|
+
*
|
|
91
|
+
* @param label - Object label (e.g., 'Account', 'Lead')
|
|
92
|
+
* @param method - ISV method (metadata, historical, comparative)
|
|
93
|
+
* @param context - Optional context: timeLabel, year, recordTypeName, outcomeLabels, overrides
|
|
94
|
+
* @returns Resolved metadata for the definition
|
|
95
|
+
*/
|
|
96
|
+
static resolveDefinitionMetadata(label, method, context) {
|
|
97
|
+
const ctx = context ?? {};
|
|
98
|
+
return {
|
|
99
|
+
category: DefinitionFieldGenerationService.resolveCategory(method, ctx),
|
|
100
|
+
timeCategory: DefinitionFieldGenerationService.resolveTimeCategoryFromContext(method, ctx),
|
|
101
|
+
segmentCategory: DefinitionFieldGenerationService.resolveSegmentCategory(method, ctx),
|
|
102
|
+
description: ctx.descriptionOverride ??
|
|
103
|
+
DefinitionFieldGenerationService.resolveDescription(label, method, ctx) + (ctx.origin ? ` ${ctx.origin}` : ''),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Maps Salesforce objects to their outcome boolean fields.
|
|
108
|
+
*
|
|
109
|
+
* @param objectName - Salesforce object API name (e.g., 'Opportunity', 'Case', 'Lead')
|
|
110
|
+
* @returns Outcome field mapping, or undefined if the object has no outcome field
|
|
111
|
+
*/
|
|
112
|
+
static getOutcomeField(objectName) {
|
|
113
|
+
return OUTCOME_FIELD_MAP[objectName];
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Builds a single outcome definition input for a given object, outcome mapping, and optional time/RT context.
|
|
117
|
+
* Consolidates the repeated context + input construction pattern used across buildOutcomeCandidateInputs
|
|
118
|
+
* and buildInputsForRecordType.
|
|
119
|
+
*
|
|
120
|
+
* @param obj - Resolved SObject metadata
|
|
121
|
+
* @param outcome - Outcome field mapping for the object
|
|
122
|
+
* @param options - Field generation options
|
|
123
|
+
* @param timeLabel - Optional time label (e.g., 'This Year')
|
|
124
|
+
* @param recordTypeName - Optional record type developer name
|
|
125
|
+
* @param dateLiteral - Optional date literal key
|
|
126
|
+
* @param dateField - Optional date field API name
|
|
127
|
+
* @returns A single CreateDefinitionInput for the outcome comparison
|
|
128
|
+
*/
|
|
129
|
+
static buildOutcomeInput(obj, outcome, options, timeLabel, recordTypeName, dateLiteral, dateField) {
|
|
130
|
+
const ctx = {
|
|
131
|
+
outcomeLabels: { trueLabel: outcome.trueLabel, falseLabel: outcome.falseLabel },
|
|
132
|
+
timeLabel,
|
|
133
|
+
recordTypeName: recordTypeName ?? options.recordType,
|
|
134
|
+
categoryOverride: options.category,
|
|
135
|
+
timeCategoryOverride: options.timeCategory,
|
|
136
|
+
segmentCategoryOverride: options.segmentCategory,
|
|
137
|
+
descriptionOverride: options.description,
|
|
138
|
+
noValueFrequency: options.noValueFrequency,
|
|
139
|
+
namePrefix: options.namePrefix,
|
|
140
|
+
nameSuffix: options.nameSuffix,
|
|
141
|
+
origin: options.origin,
|
|
142
|
+
};
|
|
143
|
+
return {
|
|
144
|
+
name: DefinitionFieldGenerationService.resolveDefinitionName(obj.label, 'metadata', ctx),
|
|
145
|
+
objectName: obj.name,
|
|
146
|
+
objectLabel: obj.label,
|
|
147
|
+
method: 'metadata',
|
|
148
|
+
...DefinitionFieldGenerationService.resolveDefinitionMetadata(obj.label, 'metadata', ctx),
|
|
149
|
+
isActive: true,
|
|
150
|
+
noValueFrequency: options.noValueFrequency,
|
|
151
|
+
discoverFields: true,
|
|
152
|
+
recordTypeName: recordTypeName ?? options.recordType,
|
|
153
|
+
filterJson: DefinitionFieldGenerationService.buildOutcomeFilterJson(outcome.fieldName, obj.name, dateLiteral, dateField, obj.label),
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Builds an ISV-compatible filterJson string for business process outcome comparisons.
|
|
158
|
+
* SetA filters for the true outcome, SetB filters for the false outcome.
|
|
159
|
+
* Produces the expression builder JSON schema that `fsc_expressionBuilder3` expects.
|
|
160
|
+
*
|
|
161
|
+
* @param fieldName - Boolean field API name (e.g., 'IsWon', 'IsClosed', 'IsConverted')
|
|
162
|
+
* @param objectName - Salesforce object API name (e.g., 'Opportunity', 'Case', 'Lead')
|
|
163
|
+
* @param dateLiteral - Optional date literal key for time-scoped outcome filters
|
|
164
|
+
* @param dateField - Optional date field API name
|
|
165
|
+
* @param objectLabel - Optional object label for display in date expressions
|
|
166
|
+
* @returns JSON string compatible with GlobalProfilingService.createProfilingDefinition()
|
|
167
|
+
*/
|
|
168
|
+
static buildOutcomeFilterJson(fieldName, objectName, dateLiteral, dateField, objectLabel, yearBoundary) {
|
|
169
|
+
const buildExpression = (boolValue) => {
|
|
170
|
+
const expressions = [
|
|
171
|
+
{
|
|
172
|
+
objectType: objectName,
|
|
173
|
+
parameter: boolValue ? '$Constant.TrueValue' : '$Constant.FalseValue',
|
|
174
|
+
parameterValue: String(boolValue),
|
|
175
|
+
dataType: 'BOOLEAN',
|
|
176
|
+
label: `${objectName}: ${fieldName}`,
|
|
177
|
+
type: objectName,
|
|
178
|
+
fieldName,
|
|
179
|
+
operator: 'equals',
|
|
180
|
+
operatorSymbol: '=',
|
|
181
|
+
value: `$${objectName}.${fieldName}`,
|
|
182
|
+
dateLiteral: '',
|
|
183
|
+
},
|
|
184
|
+
];
|
|
185
|
+
if (dateLiteral && dateField) {
|
|
186
|
+
const constantValue = DATE_LITERAL_CONSTANTS[dateLiteral] ?? dateLiteral;
|
|
187
|
+
expressions.push({
|
|
188
|
+
objectType: objectName,
|
|
189
|
+
parameter: constantValue,
|
|
190
|
+
parameterValue: dateLiteral,
|
|
191
|
+
dataType: 'DATETIME',
|
|
192
|
+
label: `${objectLabel ?? objectName}: Created Date`,
|
|
193
|
+
type: objectName,
|
|
194
|
+
fieldName: dateField,
|
|
195
|
+
operator: 'equals',
|
|
196
|
+
operatorSymbol: '=',
|
|
197
|
+
value: `$${objectName}.${dateField}`,
|
|
198
|
+
dateLiteral,
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
// Year boundary expressions: >= Jan 1 YYYY AND < Jan 1 YYYY+1
|
|
202
|
+
if (yearBoundary && dateField) {
|
|
203
|
+
const yField = dateField;
|
|
204
|
+
const yLabel = `${objectLabel ?? objectName}: Created Date`;
|
|
205
|
+
const yValue = `$${objectName}.${yField}`;
|
|
206
|
+
// yearBoundaryISO and yearBoundaryDisplay imported from date-literal.ts
|
|
207
|
+
const yearStart = yearBoundaryISO(yearBoundary.year);
|
|
208
|
+
const yearEnd = yearBoundaryISO(yearBoundary.year + 1);
|
|
209
|
+
const yearStartDisplay = yearBoundaryDisplay(yearBoundary.year);
|
|
210
|
+
const yearEndDisplay = yearBoundaryDisplay(yearBoundary.year + 1);
|
|
211
|
+
expressions.push({
|
|
212
|
+
objectType: objectName,
|
|
213
|
+
parameter: yearStartDisplay,
|
|
214
|
+
parameterValue: yearStart,
|
|
215
|
+
dataType: 'DATETIME',
|
|
216
|
+
label: yLabel,
|
|
217
|
+
type: objectName,
|
|
218
|
+
fieldName: yField,
|
|
219
|
+
operator: 'greater_or_equal',
|
|
220
|
+
operatorSymbol: '>=',
|
|
221
|
+
value: yValue,
|
|
222
|
+
dateLiteral: '',
|
|
223
|
+
});
|
|
224
|
+
expressions.push({
|
|
225
|
+
objectType: objectName,
|
|
226
|
+
parameter: yearEndDisplay,
|
|
227
|
+
parameterValue: yearEnd,
|
|
228
|
+
dataType: 'DATETIME',
|
|
229
|
+
label: yLabel,
|
|
230
|
+
type: objectName,
|
|
231
|
+
fieldName: yField,
|
|
232
|
+
operator: 'less_than',
|
|
233
|
+
operatorSymbol: '<',
|
|
234
|
+
value: yValue,
|
|
235
|
+
dateLiteral: '',
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
return { expressions, logicType: 'AND' };
|
|
239
|
+
};
|
|
240
|
+
let dateClause = '';
|
|
241
|
+
if (dateLiteral && dateField) {
|
|
242
|
+
dateClause = ` AND ${dateField} = ${dateLiteral}`;
|
|
243
|
+
}
|
|
244
|
+
else if (yearBoundary && dateField) {
|
|
245
|
+
// yearBoundaryISO imported from date-literal.ts
|
|
246
|
+
dateClause = ` AND ${dateField} >= ${yearBoundaryISO(yearBoundary.year)} AND ${dateField} < ${yearBoundaryISO(yearBoundary.year + 1)}`;
|
|
247
|
+
}
|
|
248
|
+
const payload = {
|
|
249
|
+
hasFilters: true,
|
|
250
|
+
setA: { json: buildExpression(true), expression: `${fieldName} = true${dateClause}` },
|
|
251
|
+
setB: { json: buildExpression(false), expression: `${fieldName} = false${dateClause}` },
|
|
252
|
+
};
|
|
253
|
+
return JSON.stringify(payload);
|
|
254
|
+
}
|
|
255
|
+
// ── Naming / Metadata Resolution ──────────────────────────────────
|
|
256
|
+
/**
|
|
257
|
+
* Builds the base definition name from an object label, method, and context.
|
|
258
|
+
*
|
|
259
|
+
* @param label - Object label (e.g., 'Account', 'Lead')
|
|
260
|
+
* @param method - ISV method string
|
|
261
|
+
* @param ctx - Definition metadata context
|
|
262
|
+
* @returns Formatted base definition name (without prefix/suffix)
|
|
263
|
+
*/
|
|
264
|
+
static buildName(label, method, ctx) {
|
|
265
|
+
const s = DefinitionFieldGenerationService.NAME_SEPARATOR;
|
|
266
|
+
const prefix = ctx.recordTypeName ? `${label}${s}All Fields${s}${ctx.recordTypeName}` : `${label}${s}All Fields`;
|
|
267
|
+
if (ctx.outcomeLabels) {
|
|
268
|
+
const timeSegment = ctx.timeLabel ?? 'Lifetime';
|
|
269
|
+
// Outcome variants embed the trueLabel vs falseLabel in the name, which already
|
|
270
|
+
// carries the semantic distinction. The noValueFrequency disambiguator is omitted
|
|
271
|
+
// here because outcome definitions never share names with non-outcome definitions
|
|
272
|
+
// of the same object.
|
|
273
|
+
return `${prefix}${s}${timeSegment}${s}${ctx.outcomeLabels.trueLabel} vs ${ctx.outcomeLabels.falseLabel}`;
|
|
274
|
+
}
|
|
275
|
+
if (method === 'metadata') {
|
|
276
|
+
// Metadata-only definitions never capture value frequency, so the disambiguator
|
|
277
|
+
// would be a meaningless name change. Metadata names remain stable.
|
|
278
|
+
return `${prefix}${s}Metadata Only`;
|
|
279
|
+
}
|
|
280
|
+
// Resolve the time segment for non-metadata, non-outcome variants.
|
|
281
|
+
let timeSegment;
|
|
282
|
+
if (ctx.lifetimePrimary) {
|
|
283
|
+
// Lifetime-vs-X comparative variant (CLI-2944) — name's time segment is "Lifetime vs {timeLabel}".
|
|
284
|
+
timeSegment = `Lifetime vs ${DefinitionFieldGenerationService.resolveLifetimeTimeLabel(ctx)}`;
|
|
285
|
+
}
|
|
286
|
+
else if (ctx.timeLabel) {
|
|
287
|
+
// Comparative definitions include "vs Prior" to distinguish from historical with the same time label.
|
|
288
|
+
// Without this, "Account • All Fields • This Year" would collide for both methods in --method full.
|
|
289
|
+
timeSegment = method === 'comparative' ? `${ctx.timeLabel} vs Prior` : ctx.timeLabel;
|
|
290
|
+
}
|
|
291
|
+
else if (method === 'historical') {
|
|
292
|
+
timeSegment = ctx.year !== undefined ? `${ctx.year}` : 'Lifetime';
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
// Comparative with year — include time dimension in name
|
|
296
|
+
const effectiveYear = ctx.year ?? new Date().getFullYear();
|
|
297
|
+
timeSegment = ctx.unbounded ? `${effectiveYear} vs Prior` : `${effectiveYear} vs ${effectiveYear - 1}`;
|
|
298
|
+
}
|
|
299
|
+
// CLI-3064: Append "No Value Frequency" disambiguator when noValueFrequency is set.
|
|
300
|
+
// Mirrors the comparative `vs Prior` disambiguator pattern above — without this,
|
|
301
|
+
// value-frequency and no-value-frequency variants of the same (object, method,
|
|
302
|
+
// time-segment, recordType) collide on the name-keyed dedup gate and the second is
|
|
303
|
+
// silently skipped. The disambiguator becomes part of the base name so user-supplied
|
|
304
|
+
// `--name-prefix` and `--name-suffix` compose cleanly around it in resolveDefinitionName.
|
|
305
|
+
const variantSuffix = ctx.noValueFrequency ? `${s}No Value Frequency` : '';
|
|
306
|
+
return `${prefix}${s}${timeSegment}${variantSuffix}`;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Resolves the time-segment label for the lifetime-vs-X comparative variant. Prefers an explicit
|
|
310
|
+
* timeLabel (set by the operation layer for date literals or year-range spans), then falls back
|
|
311
|
+
* to the year for single-year cascade entries. Used by buildName, resolveTimeCategoryFromContext,
|
|
312
|
+
* and resolveDescription so the lifetime variant renders consistently.
|
|
313
|
+
*/
|
|
314
|
+
static resolveLifetimeTimeLabel(ctx) {
|
|
315
|
+
if (ctx.timeLabel)
|
|
316
|
+
return ctx.timeLabel;
|
|
317
|
+
if (ctx.year !== undefined)
|
|
318
|
+
return String(ctx.year);
|
|
319
|
+
return 'Lifetime';
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Resolves the primary category from method and context.
|
|
323
|
+
*
|
|
324
|
+
* @param method - ISV method string
|
|
325
|
+
* @param ctx - Definition metadata context
|
|
326
|
+
* @returns Category string (e.g., 'Metadata', 'Baseline', 'Comparative', 'Record Types')
|
|
327
|
+
*/
|
|
328
|
+
static resolveCategory(method, ctx) {
|
|
329
|
+
if (ctx.categoryOverride)
|
|
330
|
+
return ctx.categoryOverride;
|
|
331
|
+
if (ctx.outcomeLabels)
|
|
332
|
+
return 'Comparative';
|
|
333
|
+
if (ctx.recordTypeName)
|
|
334
|
+
return 'Record Types';
|
|
335
|
+
if (method === 'metadata')
|
|
336
|
+
return 'Metadata';
|
|
337
|
+
return 'Baseline';
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Resolves the time category from method and context.
|
|
341
|
+
*
|
|
342
|
+
* @param method - ISV method string
|
|
343
|
+
* @param ctx - Definition metadata context
|
|
344
|
+
* @returns Time category string (e.g., 'N/A', 'Lifetime', '2025 vs 2024')
|
|
345
|
+
*/
|
|
346
|
+
static resolveTimeCategoryFromContext(method, ctx) {
|
|
347
|
+
if (ctx.timeCategoryOverride)
|
|
348
|
+
return ctx.timeCategoryOverride;
|
|
349
|
+
if (method === 'metadata' && !ctx.outcomeLabels)
|
|
350
|
+
return 'N/A';
|
|
351
|
+
// Lifetime-vs-X comparative variant (CLI-2944) — timeCategory mirrors the name's time segment.
|
|
352
|
+
if (ctx.lifetimePrimary) {
|
|
353
|
+
return `Lifetime vs ${DefinitionFieldGenerationService.resolveLifetimeTimeLabel(ctx)}`;
|
|
354
|
+
}
|
|
355
|
+
if (ctx.timeLabel) {
|
|
356
|
+
// Match buildName: comparative with time label uses "vs Prior" suffix
|
|
357
|
+
if (method === 'comparative' && !ctx.outcomeLabels)
|
|
358
|
+
return `${ctx.timeLabel} vs Prior`;
|
|
359
|
+
return ctx.timeLabel;
|
|
360
|
+
}
|
|
361
|
+
if (ctx.year !== undefined && method === 'comparative') {
|
|
362
|
+
return ctx.unbounded ? `${ctx.year} vs Prior` : `${ctx.year} vs ${ctx.year - 1}`;
|
|
363
|
+
}
|
|
364
|
+
if (ctx.year !== undefined)
|
|
365
|
+
return String(ctx.year);
|
|
366
|
+
return 'Lifetime';
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Resolves the segment category from method and context.
|
|
370
|
+
*
|
|
371
|
+
* @param method - ISV method string
|
|
372
|
+
* @param ctx - Definition metadata context
|
|
373
|
+
* @returns Segment category string (e.g., 'N/A', 'Historical', 'Comparative', record type name)
|
|
374
|
+
*/
|
|
375
|
+
static resolveSegmentCategory(method, ctx) {
|
|
376
|
+
if (ctx.segmentCategoryOverride)
|
|
377
|
+
return ctx.segmentCategoryOverride;
|
|
378
|
+
// Outcome check must precede metadata check because outcomes use method='metadata' at the ISV boundary
|
|
379
|
+
if (ctx.outcomeLabels)
|
|
380
|
+
return `${ctx.outcomeLabels.trueLabel} vs ${ctx.outcomeLabels.falseLabel}`;
|
|
381
|
+
if (method === 'metadata')
|
|
382
|
+
return 'N/A';
|
|
383
|
+
if (ctx.recordTypeName)
|
|
384
|
+
return ctx.recordTypeName;
|
|
385
|
+
// Lifetime-vs-X comparative variant (CLI-2944) — segmentCategory is "Comparative" regardless of
|
|
386
|
+
// whether the secondary filter is year-based or date-literal-based (AC8).
|
|
387
|
+
if (ctx.lifetimePrimary)
|
|
388
|
+
return 'Comparative';
|
|
389
|
+
if (method === 'comparative' && (ctx.year !== undefined || ctx.timeLabel !== undefined))
|
|
390
|
+
return 'Comparative';
|
|
391
|
+
return 'Historical';
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Generates a human-readable description from label, method, and context.
|
|
395
|
+
*
|
|
396
|
+
* @param label - Object label (e.g., 'Account', 'Lead')
|
|
397
|
+
* @param method - ISV method string
|
|
398
|
+
* @param ctx - Definition metadata context
|
|
399
|
+
* @returns Generated description string
|
|
400
|
+
*/
|
|
401
|
+
static resolveDescription(label, method, ctx) {
|
|
402
|
+
// Metadata-only (CRa) — no field statistics or value frequency
|
|
403
|
+
if (method === 'metadata' && !ctx.outcomeLabels) {
|
|
404
|
+
return (`Metadata profiling for ${label}. Captures Salesforce object and field metadata including ` +
|
|
405
|
+
'data types, namespaces, field descriptions, help text, and custom field dependency counts across ' +
|
|
406
|
+
'layouts, reports, and low-code/pro-code sources. Does not capture field profiling statistics, ' +
|
|
407
|
+
'value frequency results, or KPI results.');
|
|
408
|
+
}
|
|
409
|
+
// Build captures clause based on noValueFrequency
|
|
410
|
+
const captures = ctx.noValueFrequency
|
|
411
|
+
? 'Captures object and field metadata, field utilization rates, and distinctness and default value analysis'
|
|
412
|
+
: 'Captures object and field metadata, field utilization rates, distinctness and default value analysis, and value frequency distributions';
|
|
413
|
+
const boundary = ctx.noValueFrequency
|
|
414
|
+
? ' Does not capture value frequency distributions or KPI results.'
|
|
415
|
+
: ' Does not capture KPI results.';
|
|
416
|
+
// Business process outcome comparison (SetA + SetB)
|
|
417
|
+
if (ctx.outcomeLabels) {
|
|
418
|
+
return (`Business outcome comparison for ${label} \u2014 ${ctx.outcomeLabels.trueLabel} vs ${ctx.outcomeLabels.falseLabel}. ` +
|
|
419
|
+
`${captures} for both ${ctx.outcomeLabels.trueLabel} and ${ctx.outcomeLabels.falseLabel} record sets.${boundary}`);
|
|
420
|
+
}
|
|
421
|
+
// Lifetime-vs-X comparative variant (CLI-2944) \u2014 must precede recordTypeName branch so the
|
|
422
|
+
// lifetime template wins when both lifetimePrimary and recordTypeName are set (AC9 second template).
|
|
423
|
+
if (ctx.lifetimePrimary) {
|
|
424
|
+
const lifetimeLabel = DefinitionFieldGenerationService.resolveLifetimeTimeLabel(ctx);
|
|
425
|
+
if (ctx.recordTypeName) {
|
|
426
|
+
return (`Comparative profiling for ${label} (${ctx.recordTypeName}) \u2014 all records vs records from ${lifetimeLabel}, ` +
|
|
427
|
+
`scoped to the ${ctx.recordTypeName} record type. ${captures} for both record sets.${boundary}`);
|
|
428
|
+
}
|
|
429
|
+
return (`Comparative profiling for ${label} \u2014 all records vs records from ${lifetimeLabel}. ` +
|
|
430
|
+
`${captures} for both the complete record set and the ${lifetimeLabel} record set.${boundary}`);
|
|
431
|
+
}
|
|
432
|
+
// Record type scoped
|
|
433
|
+
if (ctx.recordTypeName) {
|
|
434
|
+
const scope = ctx.timeLabel
|
|
435
|
+
? `filtered to ${ctx.timeLabel}`
|
|
436
|
+
: ctx.year !== undefined
|
|
437
|
+
? `comparing ${ctx.year} vs ${ctx.year - 1}`
|
|
438
|
+
: 'across all records';
|
|
439
|
+
return (`Record type profiling for ${label} \u2014 ${ctx.recordTypeName}. ` +
|
|
440
|
+
`${captures} scoped to the ${ctx.recordTypeName} record type ${scope}.${boundary}`);
|
|
441
|
+
}
|
|
442
|
+
// Historical / comparative with date literal
|
|
443
|
+
if (ctx.timeLabel) {
|
|
444
|
+
return (`Historical profiling for ${label} \u2014 ${ctx.timeLabel}. ` +
|
|
445
|
+
`${captures} across the profiled record set. Records filtered to ${ctx.timeLabel} by Created Date.${boundary}`);
|
|
446
|
+
}
|
|
447
|
+
// Historical lifetime (no filter)
|
|
448
|
+
if (method === 'historical') {
|
|
449
|
+
return (`Historical profiling for ${label} \u2014 all records. ` +
|
|
450
|
+
`${captures} across the complete record set with no time-based filtering.${boundary}`);
|
|
451
|
+
}
|
|
452
|
+
// Year-based comparative
|
|
453
|
+
const y = ctx.year ?? new Date().getFullYear();
|
|
454
|
+
return (`Comparative profiling for ${label} \u2014 ${y} vs ${y - 1}. ` +
|
|
455
|
+
`${captures} across the profiled record set.${boundary}`);
|
|
456
|
+
}
|
|
457
|
+
// ── Candidate Input Builders ──────────────────────────────────────
|
|
458
|
+
/**
|
|
459
|
+
* Selects the comparative filter JSON for a date-literal entry.
|
|
460
|
+
* lifetimePrimary → SetA empty (all records), SetB = supplied literal.
|
|
461
|
+
* regular comparative → SetA = literal, SetB = prior from LITERAL_CASCADES[literal][1]; falls back to SetA-only when no prior exists.
|
|
462
|
+
* historical/metadata → SetA only.
|
|
463
|
+
*/
|
|
464
|
+
static pickDateLiteralComparativeFilter(literal, isLifetimeComparative, dateField, objectName, objectLabel, isRegularComparative) {
|
|
465
|
+
if (isLifetimeComparative) {
|
|
466
|
+
return buildLifetimeComparativeFilterJson(dateField, { kind: 'dateLiteral', literal }, objectName, objectLabel);
|
|
467
|
+
}
|
|
468
|
+
if (isRegularComparative) {
|
|
469
|
+
const priorLiteral = LITERAL_CASCADES[literal][1];
|
|
470
|
+
if (priorLiteral) {
|
|
471
|
+
return buildComparativeDateLiteralFilterJson(dateField, literal, priorLiteral, objectName, objectLabel);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
return buildDateLiteralFilterJson(dateField, literal, objectName, objectLabel);
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Selects the comparative filter JSON for a year-range entry. Returns the lifetime-vs-X
|
|
478
|
+
* variant when in lifetimePrimary mode; otherwise the existing year-vs-prior comparative
|
|
479
|
+
* filter (CLI-2944).
|
|
480
|
+
*/
|
|
481
|
+
static pickYearComparativeFilter(entry, lifetimePrimary, objectName, objectLabel) {
|
|
482
|
+
if (lifetimePrimary) {
|
|
483
|
+
return buildLifetimeComparativeFilterJson('CreatedDate', { kind: 'year', year: entry.year }, objectName, objectLabel);
|
|
484
|
+
}
|
|
485
|
+
return buildComparativeYearFilterJson('CreatedDate', entry.year, !!entry.unbounded, objectName, objectLabel);
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Builds candidate CreateDefinitionInput entries for non-recordtype methods.
|
|
489
|
+
*
|
|
490
|
+
* For comparative method, creates one input per object per YearRange entry.
|
|
491
|
+
* For metadata/historical, creates one input per object (yearRange is ignored).
|
|
492
|
+
*
|
|
493
|
+
* @param objects - Resolved SObject metadata entries
|
|
494
|
+
* @param method - ISV method (metadata, historical, comparative)
|
|
495
|
+
* @param year - Comparative year (default: current year)
|
|
496
|
+
* @param yearRange - Resolved year range entries
|
|
497
|
+
* @param options - Field generation options
|
|
498
|
+
* @returns Array of candidate definition inputs
|
|
499
|
+
*/
|
|
500
|
+
static buildCandidateInputs(objects, method, year, yearRange, options) {
|
|
501
|
+
const inputs = [];
|
|
502
|
+
// Date literal path: iterate over date literal entries instead of year entries
|
|
503
|
+
if (options.dateLiteralRange && options.dateLiteralRange.entries.length > 0) {
|
|
504
|
+
const dateField = options.dateLiteralRange.dateField;
|
|
505
|
+
for (const obj of objects) {
|
|
506
|
+
for (const dlEntry of options.dateLiteralRange.entries) {
|
|
507
|
+
const isLifetimeComparative = method === 'comparative' && options.lifetimePrimary === true;
|
|
508
|
+
const isRegularComparative = method === 'comparative' && options.lifetimePrimary !== true;
|
|
509
|
+
const ctx = {
|
|
510
|
+
timeLabel: dlEntry.label,
|
|
511
|
+
lifetimePrimary: isLifetimeComparative,
|
|
512
|
+
recordTypeName: options.recordType,
|
|
513
|
+
categoryOverride: options.category,
|
|
514
|
+
timeCategoryOverride: options.timeCategory,
|
|
515
|
+
segmentCategoryOverride: options.segmentCategory,
|
|
516
|
+
descriptionOverride: options.description,
|
|
517
|
+
noValueFrequency: options.noValueFrequency,
|
|
518
|
+
namePrefix: options.namePrefix,
|
|
519
|
+
nameSuffix: options.nameSuffix,
|
|
520
|
+
origin: options.origin,
|
|
521
|
+
};
|
|
522
|
+
const filterJson = DefinitionFieldGenerationService.pickDateLiteralComparativeFilter(dlEntry.literal, isLifetimeComparative, dateField, obj.name, obj.label, isRegularComparative);
|
|
523
|
+
inputs.push({
|
|
524
|
+
name: DefinitionFieldGenerationService.resolveDefinitionName(obj.label, method, ctx),
|
|
525
|
+
objectName: obj.name,
|
|
526
|
+
objectLabel: obj.label,
|
|
527
|
+
method,
|
|
528
|
+
...DefinitionFieldGenerationService.resolveDefinitionMetadata(obj.label, method, ctx),
|
|
529
|
+
isActive: true,
|
|
530
|
+
lifetimePrimary: isLifetimeComparative,
|
|
531
|
+
noValueFrequency: options.noValueFrequency,
|
|
532
|
+
recordTypeName: options.recordType,
|
|
533
|
+
discoverFields: true,
|
|
534
|
+
filterJson,
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
return inputs;
|
|
539
|
+
}
|
|
540
|
+
// Year-based path (existing behavior)
|
|
541
|
+
if (method === 'comparative' && yearRange.entries.length > 0) {
|
|
542
|
+
const lifetimePrimary = options.lifetimePrimary === true;
|
|
543
|
+
for (const obj of objects) {
|
|
544
|
+
for (const entry of yearRange.entries) {
|
|
545
|
+
const filterJson = DefinitionFieldGenerationService.pickYearComparativeFilter(entry, lifetimePrimary, obj.name, obj.label);
|
|
546
|
+
const ctx = {
|
|
547
|
+
year: entry.year,
|
|
548
|
+
unbounded: entry.unbounded,
|
|
549
|
+
lifetimePrimary,
|
|
550
|
+
recordTypeName: options.recordType,
|
|
551
|
+
categoryOverride: options.category,
|
|
552
|
+
timeCategoryOverride: options.timeCategory,
|
|
553
|
+
segmentCategoryOverride: options.segmentCategory,
|
|
554
|
+
descriptionOverride: options.description,
|
|
555
|
+
noValueFrequency: options.noValueFrequency,
|
|
556
|
+
namePrefix: options.namePrefix,
|
|
557
|
+
nameSuffix: options.nameSuffix,
|
|
558
|
+
origin: options.origin,
|
|
559
|
+
};
|
|
560
|
+
inputs.push({
|
|
561
|
+
name: DefinitionFieldGenerationService.resolveDefinitionName(obj.label, method, ctx),
|
|
562
|
+
objectName: obj.name,
|
|
563
|
+
objectLabel: obj.label,
|
|
564
|
+
method,
|
|
565
|
+
...DefinitionFieldGenerationService.resolveDefinitionMetadata(obj.label, method, ctx),
|
|
566
|
+
isActive: true,
|
|
567
|
+
lifetimePrimary,
|
|
568
|
+
noValueFrequency: options.noValueFrequency,
|
|
569
|
+
recordTypeName: options.recordType,
|
|
570
|
+
discoverFields: true,
|
|
571
|
+
filterJson,
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
else {
|
|
577
|
+
for (const obj of objects) {
|
|
578
|
+
const isComparative = method === 'comparative';
|
|
579
|
+
// Only apply year to historical when explicitly requested (not as part of --method full)
|
|
580
|
+
const historicalWithYear = method === 'historical' && options.year !== undefined && options.method === 'historical';
|
|
581
|
+
const ctx = {
|
|
582
|
+
year: isComparative || historicalWithYear ? year : undefined,
|
|
583
|
+
unbounded: options.usePrior,
|
|
584
|
+
recordTypeName: options.recordType,
|
|
585
|
+
categoryOverride: options.category,
|
|
586
|
+
timeCategoryOverride: options.timeCategory,
|
|
587
|
+
segmentCategoryOverride: options.segmentCategory,
|
|
588
|
+
descriptionOverride: options.description,
|
|
589
|
+
noValueFrequency: options.noValueFrequency,
|
|
590
|
+
namePrefix: options.namePrefix,
|
|
591
|
+
nameSuffix: options.nameSuffix,
|
|
592
|
+
origin: options.origin,
|
|
593
|
+
};
|
|
594
|
+
// Build filter JSON based on method + year
|
|
595
|
+
let filterJson;
|
|
596
|
+
if (isComparative) {
|
|
597
|
+
filterJson = buildComparativeYearFilterJson('CreatedDate', year, !!options.usePrior, obj.name, obj.label);
|
|
598
|
+
}
|
|
599
|
+
else if (historicalWithYear) {
|
|
600
|
+
filterJson = buildHistoricalYearFilterJson('CreatedDate', year, obj.name, obj.label);
|
|
601
|
+
}
|
|
602
|
+
inputs.push({
|
|
603
|
+
name: DefinitionFieldGenerationService.resolveDefinitionName(obj.label, method, ctx),
|
|
604
|
+
objectName: obj.name,
|
|
605
|
+
objectLabel: obj.label,
|
|
606
|
+
method,
|
|
607
|
+
...DefinitionFieldGenerationService.resolveDefinitionMetadata(obj.label, method, ctx),
|
|
608
|
+
isActive: true,
|
|
609
|
+
noValueFrequency: options.noValueFrequency,
|
|
610
|
+
recordTypeName: options.recordType,
|
|
611
|
+
discoverFields: true,
|
|
612
|
+
...(filterJson ? { filterJson } : {}),
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
return inputs;
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* Builds candidate inputs for a single record type on a single object.
|
|
620
|
+
*
|
|
621
|
+
* Creates 1 historical + N comparative definitions (one per YearRange entry).
|
|
622
|
+
* For outcome-capable objects in full method, also adds outcome split per RT.
|
|
623
|
+
*
|
|
624
|
+
* @param obj - Resolved SObject metadata
|
|
625
|
+
* @param rtName - Record type developer name
|
|
626
|
+
* @param yearRange - Resolved year range entries
|
|
627
|
+
* @param options - Field generation options
|
|
628
|
+
* @returns Array of candidate definition inputs for this record type
|
|
629
|
+
*/
|
|
630
|
+
static buildInputsForRecordType(obj, rtName, yearRange, options) {
|
|
631
|
+
const inputs = [];
|
|
632
|
+
// Only cross record types with outcomes in full method — standalone --method recordtype should not add outcome variants
|
|
633
|
+
const outcome = options.method === 'full' ? DefinitionFieldGenerationService.getOutcomeField(obj.name) : undefined;
|
|
634
|
+
// Date literal path: create one definition per date literal entry (no lifetime baseline)
|
|
635
|
+
if (options.dateLiteralRange && options.dateLiteralRange.entries.length > 0) {
|
|
636
|
+
const dateField = options.dateLiteralRange.dateField;
|
|
637
|
+
for (const dlEntry of options.dateLiteralRange.entries) {
|
|
638
|
+
const ctx = {
|
|
639
|
+
timeLabel: dlEntry.label,
|
|
640
|
+
recordTypeName: rtName,
|
|
641
|
+
categoryOverride: options.category,
|
|
642
|
+
timeCategoryOverride: options.timeCategory,
|
|
643
|
+
segmentCategoryOverride: options.segmentCategory,
|
|
644
|
+
descriptionOverride: options.description,
|
|
645
|
+
noValueFrequency: options.noValueFrequency,
|
|
646
|
+
namePrefix: options.namePrefix,
|
|
647
|
+
nameSuffix: options.nameSuffix,
|
|
648
|
+
origin: options.origin,
|
|
649
|
+
};
|
|
650
|
+
inputs.push({
|
|
651
|
+
name: DefinitionFieldGenerationService.resolveDefinitionName(obj.label, 'comparative', ctx),
|
|
652
|
+
objectName: obj.name,
|
|
653
|
+
objectLabel: obj.label,
|
|
654
|
+
method: 'comparative',
|
|
655
|
+
...DefinitionFieldGenerationService.resolveDefinitionMetadata(obj.label, 'comparative', ctx),
|
|
656
|
+
isActive: true,
|
|
657
|
+
noValueFrequency: options.noValueFrequency,
|
|
658
|
+
recordTypeName: rtName,
|
|
659
|
+
discoverFields: true,
|
|
660
|
+
filterJson: buildDateLiteralFilterJson(dateField, dlEntry.literal, obj.name, obj.label),
|
|
661
|
+
});
|
|
662
|
+
// Outcome x record type x date literal: for outcome-capable objects, add outcome split per RT per time
|
|
663
|
+
if (outcome) {
|
|
664
|
+
inputs.push(DefinitionFieldGenerationService.buildOutcomeInput(obj, outcome, options, dlEntry.label, rtName, dlEntry.literal, dateField));
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
return inputs;
|
|
668
|
+
}
|
|
669
|
+
// Year-based path (existing behavior)
|
|
670
|
+
// 1. Lifetime historical (no year filter) — shows overall record type usage
|
|
671
|
+
const lifetimeCtx = {
|
|
672
|
+
recordTypeName: rtName,
|
|
673
|
+
categoryOverride: options.category,
|
|
674
|
+
timeCategoryOverride: options.timeCategory,
|
|
675
|
+
segmentCategoryOverride: options.segmentCategory,
|
|
676
|
+
descriptionOverride: options.description,
|
|
677
|
+
noValueFrequency: options.noValueFrequency,
|
|
678
|
+
namePrefix: options.namePrefix,
|
|
679
|
+
nameSuffix: options.nameSuffix,
|
|
680
|
+
origin: options.origin,
|
|
681
|
+
};
|
|
682
|
+
inputs.push({
|
|
683
|
+
name: DefinitionFieldGenerationService.resolveDefinitionName(obj.label, 'historical', lifetimeCtx),
|
|
684
|
+
objectName: obj.name,
|
|
685
|
+
objectLabel: obj.label,
|
|
686
|
+
method: 'historical',
|
|
687
|
+
...DefinitionFieldGenerationService.resolveDefinitionMetadata(obj.label, 'historical', lifetimeCtx),
|
|
688
|
+
isActive: true,
|
|
689
|
+
noValueFrequency: options.noValueFrequency,
|
|
690
|
+
recordTypeName: rtName,
|
|
691
|
+
discoverFields: true,
|
|
692
|
+
});
|
|
693
|
+
// Outcome x record type (Lifetime): for outcome-capable objects, add outcome split per RT
|
|
694
|
+
if (outcome) {
|
|
695
|
+
inputs.push(DefinitionFieldGenerationService.buildOutcomeInput(obj, outcome, options, undefined, rtName));
|
|
696
|
+
}
|
|
697
|
+
// 2+. Comparative definitions from year range entries
|
|
698
|
+
for (const entry of yearRange.entries) {
|
|
699
|
+
const compCtx = {
|
|
700
|
+
year: entry.year,
|
|
701
|
+
unbounded: entry.unbounded,
|
|
702
|
+
recordTypeName: rtName,
|
|
703
|
+
categoryOverride: options.category,
|
|
704
|
+
timeCategoryOverride: options.timeCategory,
|
|
705
|
+
segmentCategoryOverride: options.segmentCategory,
|
|
706
|
+
descriptionOverride: options.description,
|
|
707
|
+
noValueFrequency: options.noValueFrequency,
|
|
708
|
+
namePrefix: options.namePrefix,
|
|
709
|
+
nameSuffix: options.nameSuffix,
|
|
710
|
+
origin: options.origin,
|
|
711
|
+
};
|
|
712
|
+
inputs.push({
|
|
713
|
+
name: DefinitionFieldGenerationService.resolveDefinitionName(obj.label, 'comparative', compCtx),
|
|
714
|
+
objectName: obj.name,
|
|
715
|
+
objectLabel: obj.label,
|
|
716
|
+
method: 'comparative',
|
|
717
|
+
...DefinitionFieldGenerationService.resolveDefinitionMetadata(obj.label, 'comparative', compCtx),
|
|
718
|
+
isActive: true,
|
|
719
|
+
noValueFrequency: options.noValueFrequency,
|
|
720
|
+
recordTypeName: rtName,
|
|
721
|
+
discoverFields: true,
|
|
722
|
+
filterJson: buildComparativeYearFilterJson('CreatedDate', entry.year, !!entry.unbounded, obj.name, obj.label),
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
return inputs;
|
|
726
|
+
}
|
|
727
|
+
/**
|
|
728
|
+
* Builds candidate inputs for business process outcome profiling.
|
|
729
|
+
* Creates one definition per object that has a business process outcome boolean field.
|
|
730
|
+
* Non-outcome objects are skipped with a warning.
|
|
731
|
+
*
|
|
732
|
+
* @param objects - Resolved SObject metadata entries
|
|
733
|
+
* @param options - Field generation options
|
|
734
|
+
* @param warnings - Mutable warnings array to append skip messages
|
|
735
|
+
* @returns Array of candidate definition inputs for outcome-capable objects
|
|
736
|
+
*/
|
|
737
|
+
static buildOutcomeCandidateInputs(objects, options, warnings, yearRange) {
|
|
738
|
+
const inputs = [];
|
|
739
|
+
for (const obj of objects) {
|
|
740
|
+
const outcome = DefinitionFieldGenerationService.getOutcomeField(obj.name);
|
|
741
|
+
if (!outcome) {
|
|
742
|
+
warnings.push(`${obj.name} has no outcome field — skipped for outcome profiling.`);
|
|
743
|
+
continue;
|
|
744
|
+
}
|
|
745
|
+
// Date literal path: create one outcome definition per object x date literal entry
|
|
746
|
+
if (options.dateLiteralRange && options.dateLiteralRange.entries.length > 0) {
|
|
747
|
+
const dateField = options.dateLiteralRange.dateField;
|
|
748
|
+
for (const dlEntry of options.dateLiteralRange.entries) {
|
|
749
|
+
inputs.push(DefinitionFieldGenerationService.buildOutcomeInput(obj, outcome, options, dlEntry.label, undefined, dlEntry.literal, dateField));
|
|
750
|
+
}
|
|
751
|
+
continue;
|
|
752
|
+
}
|
|
753
|
+
// Year path: create one outcome definition per year, scoped to that year.
|
|
754
|
+
// Outcome splits (Won vs Lost) operate within each year — both SetA and SetB
|
|
755
|
+
// are scoped to the same time window. --use-prior (unbounded) is silently
|
|
756
|
+
// ignored — the year is used for scoping regardless.
|
|
757
|
+
if (yearRange && yearRange.entries.length > 0) {
|
|
758
|
+
for (const entry of yearRange.entries) {
|
|
759
|
+
const ctx = {
|
|
760
|
+
outcomeLabels: { trueLabel: outcome.trueLabel, falseLabel: outcome.falseLabel },
|
|
761
|
+
timeLabel: String(entry.year),
|
|
762
|
+
year: entry.year,
|
|
763
|
+
unbounded: false,
|
|
764
|
+
recordTypeName: options.recordType,
|
|
765
|
+
categoryOverride: options.category,
|
|
766
|
+
timeCategoryOverride: options.timeCategory,
|
|
767
|
+
segmentCategoryOverride: options.segmentCategory,
|
|
768
|
+
descriptionOverride: options.description,
|
|
769
|
+
noValueFrequency: options.noValueFrequency,
|
|
770
|
+
namePrefix: options.namePrefix,
|
|
771
|
+
nameSuffix: options.nameSuffix,
|
|
772
|
+
origin: options.origin,
|
|
773
|
+
};
|
|
774
|
+
inputs.push({
|
|
775
|
+
name: DefinitionFieldGenerationService.resolveDefinitionName(obj.label, 'metadata', ctx),
|
|
776
|
+
objectName: obj.name,
|
|
777
|
+
objectLabel: obj.label,
|
|
778
|
+
method: 'metadata',
|
|
779
|
+
...DefinitionFieldGenerationService.resolveDefinitionMetadata(obj.label, 'metadata', ctx),
|
|
780
|
+
isActive: true,
|
|
781
|
+
noValueFrequency: options.noValueFrequency,
|
|
782
|
+
discoverFields: true,
|
|
783
|
+
recordTypeName: options.recordType,
|
|
784
|
+
filterJson: DefinitionFieldGenerationService.buildOutcomeFilterJson(outcome.fieldName, obj.name, undefined, 'CreatedDate', obj.label, { year: entry.year, unbounded: entry.unbounded }),
|
|
785
|
+
});
|
|
786
|
+
}
|
|
787
|
+
continue;
|
|
788
|
+
}
|
|
789
|
+
// Lifetime path (no date literal, no year): original behavior — single definition per object
|
|
790
|
+
inputs.push(DefinitionFieldGenerationService.buildOutcomeInput(obj, outcome, options));
|
|
791
|
+
}
|
|
792
|
+
return inputs;
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
//# sourceMappingURL=DefinitionFieldGenerationService.js.map
|