@peernova/cuneiform-sf 1.0.2 → 1.0.4-beta.10
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 +168 -134
- 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/lifecycle.d.ts +112 -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 +393 -0
- package/lib/adapters/rest/rest-api-adapter.js +764 -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 +418 -0
- package/lib/adapters/soql/cuneiform-query-builder.js +606 -0
- package/lib/adapters/soql/cuneiform-query-builder.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 +175 -0
- package/lib/base/cuneiform-command.js +326 -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 +120 -0
- package/lib/commands/cuneiform/definition/create.js +737 -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 +277 -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 +351 -0
- package/lib/commands/cuneiform/definition/list.js.map +1 -0
- package/lib/commands/cuneiform/definition/purge.d.ts +109 -0
- package/lib/commands/cuneiform/definition/purge.js +578 -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 +209 -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 +123 -0
- package/lib/commands/cuneiform/object/list.js +264 -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 +93 -0
- package/lib/commands/cuneiform/profile.js +353 -0
- package/lib/commands/cuneiform/profile.js.map +1 -0
- package/lib/commands/cuneiform/summary/purge.d.ts +80 -0
- package/lib/commands/cuneiform/summary/purge.js +467 -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 +77 -0
- package/lib/commands/cuneiform/user/details.js +414 -0
- package/lib/commands/cuneiform/user/details.js.map +1 -0
- package/lib/constants/namespace-constants.d.ts +102 -0
- package/lib/constants/namespace-constants.js +225 -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/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 +310 -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 +220 -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 +327 -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/cascade-skip-accumulator.d.ts +25 -0
- package/lib/models/cascade-skip-accumulator.js +9 -0
- package/lib/models/cascade-skip-accumulator.js.map +1 -0
- package/lib/models/date-literal.d.ts +280 -0
- package/lib/models/date-literal.js +1164 -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/portability-recipe.d.ts +35 -0
- package/lib/models/portability-recipe.js +113 -0
- package/lib/models/portability-recipe.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 +49 -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 +188 -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 +427 -0
- package/lib/operations/DefinitionCreateOperation.js +1270 -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 +203 -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 +192 -0
- package/lib/operations/ProfileOperation.js +371 -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 +98 -0
- package/lib/services/ConfigureMode.js +413 -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 +357 -0
- package/lib/services/DefinitionFieldGenerationService.js +899 -0
- package/lib/services/DefinitionFieldGenerationService.js.map +1 -0
- package/lib/services/DefinitionQueryBuilder.d.ts +92 -0
- package/lib/services/DefinitionQueryBuilder.js +328 -0
- package/lib/services/DefinitionQueryBuilder.js.map +1 -0
- package/lib/services/ObjectDescribeService.d.ts +436 -0
- package/lib/services/ObjectDescribeService.js +881 -0
- package/lib/services/ObjectDescribeService.js.map +1 -0
- package/lib/services/ObjectFilteringService.d.ts +484 -0
- package/lib/services/ObjectFilteringService.js +1080 -0
- package/lib/services/ObjectFilteringService.js.map +1 -0
- package/lib/services/ObjectListCommandService.d.ts +467 -0
- package/lib/services/ObjectListCommandService.js +904 -0
- package/lib/services/ObjectListCommandService.js.map +1 -0
- package/lib/services/ObjectListService.d.ts +201 -0
- package/lib/services/ObjectListService.js +350 -0
- package/lib/services/ObjectListService.js.map +1 -0
- package/lib/services/OrgInfoService.d.ts +493 -0
- package/lib/services/OrgInfoService.js +1142 -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 +575 -0
- package/lib/services/ProfilingDefinitionService.js +1029 -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 +688 -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 +146 -0
- package/lib/services/SFDMUService.js +323 -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 +158 -0
- package/lib/services/UserConfigurationService.js +574 -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 +347 -0
- package/lib/services/UserReadinessService.js +891 -0
- package/lib/services/UserReadinessService.js.map +1 -0
- package/lib/services/constants.d.ts +54 -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/namespace-filter.d.ts +36 -0
- package/lib/services/namespace-filter.js +109 -0
- package/lib/services/namespace-filter.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 +230 -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 +117 -0
- package/lib/utils/formatting/object-describe-display.js +447 -0
- package/lib/utils/formatting/object-describe-display.js.map +1 -0
- package/lib/utils/formatting/object-list-display.d.ts +225 -0
- package/lib/utils/formatting/object-list-display.js +718 -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/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 +525 -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 +330 -0
- package/messages/definition.update.md +118 -0
- package/messages/mcp.serve.md +66 -0
- package/messages/object.describe.md +205 -0
- package/messages/object.list.md +463 -0
- package/messages/org.details.md +386 -0
- package/messages/org.reset.md +71 -0
- package/messages/profile.md +243 -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 +3267 -2148
- package/oclif.manifest.json +2829 -31
- package/package.json +104 -18
- 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,1164 @@
|
|
|
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
|
+
/**
|
|
9
|
+
* The 52 date literals supported by the ISV DateLiteral.cls (after CLI-3419).
|
|
10
|
+
* These are the ONLY literals the CLI should generate — they correspond 1:1
|
|
11
|
+
* to the constants in the ISV product's DateLiteral class.
|
|
12
|
+
*
|
|
13
|
+
* Pre-CLI-3419 vocabulary was 14 entries (year-tier cap of 4 + 4 base
|
|
14
|
+
* non-year-tier + 2 span). CLI-3419 raises the cap to 10 across all
|
|
15
|
+
* non-span tiers, extending the cascade vocabulary to N_X_AGO:2..9 for
|
|
16
|
+
* day/week/month/quarter and N_YEARS_AGO:4..9 for year.
|
|
17
|
+
*/
|
|
18
|
+
export const SUPPORTED_DATE_LITERALS = [
|
|
19
|
+
// Day tier
|
|
20
|
+
'TODAY',
|
|
21
|
+
'YESTERDAY',
|
|
22
|
+
'N_DAYS_AGO:2',
|
|
23
|
+
'N_DAYS_AGO:3',
|
|
24
|
+
'N_DAYS_AGO:4',
|
|
25
|
+
'N_DAYS_AGO:5',
|
|
26
|
+
'N_DAYS_AGO:6',
|
|
27
|
+
'N_DAYS_AGO:7',
|
|
28
|
+
'N_DAYS_AGO:8',
|
|
29
|
+
'N_DAYS_AGO:9',
|
|
30
|
+
// Week tier
|
|
31
|
+
'THIS_WEEK',
|
|
32
|
+
'LAST_WEEK',
|
|
33
|
+
'N_WEEKS_AGO:2',
|
|
34
|
+
'N_WEEKS_AGO:3',
|
|
35
|
+
'N_WEEKS_AGO:4',
|
|
36
|
+
'N_WEEKS_AGO:5',
|
|
37
|
+
'N_WEEKS_AGO:6',
|
|
38
|
+
'N_WEEKS_AGO:7',
|
|
39
|
+
'N_WEEKS_AGO:8',
|
|
40
|
+
'N_WEEKS_AGO:9',
|
|
41
|
+
// Month tier
|
|
42
|
+
'THIS_MONTH',
|
|
43
|
+
'LAST_MONTH',
|
|
44
|
+
'N_MONTHS_AGO:2',
|
|
45
|
+
'N_MONTHS_AGO:3',
|
|
46
|
+
'N_MONTHS_AGO:4',
|
|
47
|
+
'N_MONTHS_AGO:5',
|
|
48
|
+
'N_MONTHS_AGO:6',
|
|
49
|
+
'N_MONTHS_AGO:7',
|
|
50
|
+
'N_MONTHS_AGO:8',
|
|
51
|
+
'N_MONTHS_AGO:9',
|
|
52
|
+
// Quarter tier
|
|
53
|
+
'THIS_QUARTER',
|
|
54
|
+
'LAST_QUARTER',
|
|
55
|
+
'N_QUARTERS_AGO:2',
|
|
56
|
+
'N_QUARTERS_AGO:3',
|
|
57
|
+
'N_QUARTERS_AGO:4',
|
|
58
|
+
'N_QUARTERS_AGO:5',
|
|
59
|
+
'N_QUARTERS_AGO:6',
|
|
60
|
+
'N_QUARTERS_AGO:7',
|
|
61
|
+
'N_QUARTERS_AGO:8',
|
|
62
|
+
'N_QUARTERS_AGO:9',
|
|
63
|
+
// Year tier
|
|
64
|
+
'THIS_YEAR',
|
|
65
|
+
'LAST_YEAR',
|
|
66
|
+
'N_YEARS_AGO:2',
|
|
67
|
+
'N_YEARS_AGO:3',
|
|
68
|
+
'N_YEARS_AGO:4',
|
|
69
|
+
'N_YEARS_AGO:5',
|
|
70
|
+
'N_YEARS_AGO:6',
|
|
71
|
+
'N_YEARS_AGO:7',
|
|
72
|
+
'N_YEARS_AGO:8',
|
|
73
|
+
'N_YEARS_AGO:9',
|
|
74
|
+
// Span tier (out of scope for cascade — single-period aggregate)
|
|
75
|
+
'LAST_N_YEARS:2',
|
|
76
|
+
'LAST_N_YEARS:3',
|
|
77
|
+
];
|
|
78
|
+
/**
|
|
79
|
+
* Customer-facing labels for each date literal.
|
|
80
|
+
* Used in definition names, descriptions, and time category display.
|
|
81
|
+
*
|
|
82
|
+
* Word-form convention for N≥2 mirrors the existing year-tier labels
|
|
83
|
+
* ("Two Years Ago", "Three Years Ago") — see CLI-3419 Decision #3.
|
|
84
|
+
*/
|
|
85
|
+
export const DATE_LITERAL_LABELS = {
|
|
86
|
+
// Day tier
|
|
87
|
+
TODAY: 'Today',
|
|
88
|
+
YESTERDAY: 'Yesterday',
|
|
89
|
+
'N_DAYS_AGO:2': 'Two Days Ago',
|
|
90
|
+
'N_DAYS_AGO:3': 'Three Days Ago',
|
|
91
|
+
'N_DAYS_AGO:4': 'Four Days Ago',
|
|
92
|
+
'N_DAYS_AGO:5': 'Five Days Ago',
|
|
93
|
+
'N_DAYS_AGO:6': 'Six Days Ago',
|
|
94
|
+
'N_DAYS_AGO:7': 'Seven Days Ago',
|
|
95
|
+
'N_DAYS_AGO:8': 'Eight Days Ago',
|
|
96
|
+
'N_DAYS_AGO:9': 'Nine Days Ago',
|
|
97
|
+
// Week tier
|
|
98
|
+
THIS_WEEK: 'This Week',
|
|
99
|
+
LAST_WEEK: 'Last Week',
|
|
100
|
+
'N_WEEKS_AGO:2': 'Two Weeks Ago',
|
|
101
|
+
'N_WEEKS_AGO:3': 'Three Weeks Ago',
|
|
102
|
+
'N_WEEKS_AGO:4': 'Four Weeks Ago',
|
|
103
|
+
'N_WEEKS_AGO:5': 'Five Weeks Ago',
|
|
104
|
+
'N_WEEKS_AGO:6': 'Six Weeks Ago',
|
|
105
|
+
'N_WEEKS_AGO:7': 'Seven Weeks Ago',
|
|
106
|
+
'N_WEEKS_AGO:8': 'Eight Weeks Ago',
|
|
107
|
+
'N_WEEKS_AGO:9': 'Nine Weeks Ago',
|
|
108
|
+
// Month tier
|
|
109
|
+
THIS_MONTH: 'This Month',
|
|
110
|
+
LAST_MONTH: 'Last Month',
|
|
111
|
+
'N_MONTHS_AGO:2': 'Two Months Ago',
|
|
112
|
+
'N_MONTHS_AGO:3': 'Three Months Ago',
|
|
113
|
+
'N_MONTHS_AGO:4': 'Four Months Ago',
|
|
114
|
+
'N_MONTHS_AGO:5': 'Five Months Ago',
|
|
115
|
+
'N_MONTHS_AGO:6': 'Six Months Ago',
|
|
116
|
+
'N_MONTHS_AGO:7': 'Seven Months Ago',
|
|
117
|
+
'N_MONTHS_AGO:8': 'Eight Months Ago',
|
|
118
|
+
'N_MONTHS_AGO:9': 'Nine Months Ago',
|
|
119
|
+
// Quarter tier
|
|
120
|
+
THIS_QUARTER: 'This Quarter',
|
|
121
|
+
LAST_QUARTER: 'Last Quarter',
|
|
122
|
+
'N_QUARTERS_AGO:2': 'Two Quarters Ago',
|
|
123
|
+
'N_QUARTERS_AGO:3': 'Three Quarters Ago',
|
|
124
|
+
'N_QUARTERS_AGO:4': 'Four Quarters Ago',
|
|
125
|
+
'N_QUARTERS_AGO:5': 'Five Quarters Ago',
|
|
126
|
+
'N_QUARTERS_AGO:6': 'Six Quarters Ago',
|
|
127
|
+
'N_QUARTERS_AGO:7': 'Seven Quarters Ago',
|
|
128
|
+
'N_QUARTERS_AGO:8': 'Eight Quarters Ago',
|
|
129
|
+
'N_QUARTERS_AGO:9': 'Nine Quarters Ago',
|
|
130
|
+
// Year tier
|
|
131
|
+
THIS_YEAR: 'This Year',
|
|
132
|
+
LAST_YEAR: 'Last Year',
|
|
133
|
+
'N_YEARS_AGO:2': 'Two Years Ago',
|
|
134
|
+
'N_YEARS_AGO:3': 'Three Years Ago',
|
|
135
|
+
'N_YEARS_AGO:4': 'Four Years Ago',
|
|
136
|
+
'N_YEARS_AGO:5': 'Five Years Ago',
|
|
137
|
+
'N_YEARS_AGO:6': 'Six Years Ago',
|
|
138
|
+
'N_YEARS_AGO:7': 'Seven Years Ago',
|
|
139
|
+
'N_YEARS_AGO:8': 'Eight Years Ago',
|
|
140
|
+
'N_YEARS_AGO:9': 'Nine Years Ago',
|
|
141
|
+
// Span tier
|
|
142
|
+
'LAST_N_YEARS:2': 'Last Two Years',
|
|
143
|
+
'LAST_N_YEARS:3': 'Last Three Years',
|
|
144
|
+
};
|
|
145
|
+
/** Maps each literal to its tier */
|
|
146
|
+
export const LITERAL_TIERS = {
|
|
147
|
+
// Day tier
|
|
148
|
+
TODAY: 'day',
|
|
149
|
+
YESTERDAY: 'day',
|
|
150
|
+
'N_DAYS_AGO:2': 'day',
|
|
151
|
+
'N_DAYS_AGO:3': 'day',
|
|
152
|
+
'N_DAYS_AGO:4': 'day',
|
|
153
|
+
'N_DAYS_AGO:5': 'day',
|
|
154
|
+
'N_DAYS_AGO:6': 'day',
|
|
155
|
+
'N_DAYS_AGO:7': 'day',
|
|
156
|
+
'N_DAYS_AGO:8': 'day',
|
|
157
|
+
'N_DAYS_AGO:9': 'day',
|
|
158
|
+
// Week tier
|
|
159
|
+
THIS_WEEK: 'week',
|
|
160
|
+
LAST_WEEK: 'week',
|
|
161
|
+
'N_WEEKS_AGO:2': 'week',
|
|
162
|
+
'N_WEEKS_AGO:3': 'week',
|
|
163
|
+
'N_WEEKS_AGO:4': 'week',
|
|
164
|
+
'N_WEEKS_AGO:5': 'week',
|
|
165
|
+
'N_WEEKS_AGO:6': 'week',
|
|
166
|
+
'N_WEEKS_AGO:7': 'week',
|
|
167
|
+
'N_WEEKS_AGO:8': 'week',
|
|
168
|
+
'N_WEEKS_AGO:9': 'week',
|
|
169
|
+
// Month tier
|
|
170
|
+
THIS_MONTH: 'month',
|
|
171
|
+
LAST_MONTH: 'month',
|
|
172
|
+
'N_MONTHS_AGO:2': 'month',
|
|
173
|
+
'N_MONTHS_AGO:3': 'month',
|
|
174
|
+
'N_MONTHS_AGO:4': 'month',
|
|
175
|
+
'N_MONTHS_AGO:5': 'month',
|
|
176
|
+
'N_MONTHS_AGO:6': 'month',
|
|
177
|
+
'N_MONTHS_AGO:7': 'month',
|
|
178
|
+
'N_MONTHS_AGO:8': 'month',
|
|
179
|
+
'N_MONTHS_AGO:9': 'month',
|
|
180
|
+
// Quarter tier
|
|
181
|
+
THIS_QUARTER: 'quarter',
|
|
182
|
+
LAST_QUARTER: 'quarter',
|
|
183
|
+
'N_QUARTERS_AGO:2': 'quarter',
|
|
184
|
+
'N_QUARTERS_AGO:3': 'quarter',
|
|
185
|
+
'N_QUARTERS_AGO:4': 'quarter',
|
|
186
|
+
'N_QUARTERS_AGO:5': 'quarter',
|
|
187
|
+
'N_QUARTERS_AGO:6': 'quarter',
|
|
188
|
+
'N_QUARTERS_AGO:7': 'quarter',
|
|
189
|
+
'N_QUARTERS_AGO:8': 'quarter',
|
|
190
|
+
'N_QUARTERS_AGO:9': 'quarter',
|
|
191
|
+
// Year tier
|
|
192
|
+
THIS_YEAR: 'year',
|
|
193
|
+
LAST_YEAR: 'year',
|
|
194
|
+
'N_YEARS_AGO:2': 'year',
|
|
195
|
+
'N_YEARS_AGO:3': 'year',
|
|
196
|
+
'N_YEARS_AGO:4': 'year',
|
|
197
|
+
'N_YEARS_AGO:5': 'year',
|
|
198
|
+
'N_YEARS_AGO:6': 'year',
|
|
199
|
+
'N_YEARS_AGO:7': 'year',
|
|
200
|
+
'N_YEARS_AGO:8': 'year',
|
|
201
|
+
'N_YEARS_AGO:9': 'year',
|
|
202
|
+
// Span tier (out of scope for cascade)
|
|
203
|
+
'LAST_N_YEARS:2': 'span',
|
|
204
|
+
'LAST_N_YEARS:3': 'span',
|
|
205
|
+
};
|
|
206
|
+
/**
|
|
207
|
+
* Maximum cascade depth per tier — interpreted as max absolute offset from
|
|
208
|
+
* the current period plus one (offsets 0..MAX-1 are valid).
|
|
209
|
+
*
|
|
210
|
+
* CLI-3419 raised the cap from 4 (year-tier only) to 10 across all non-span
|
|
211
|
+
* tiers. The cascade vocabulary now covers offsets 0..9 — labels "This X"
|
|
212
|
+
* through "Nine X Ago" — at every non-span tier. Span literals
|
|
213
|
+
* (LAST_N_YEARS:2/3) stay at depth 1 because they already aggregate multiple
|
|
214
|
+
* periods (AC4).
|
|
215
|
+
*/
|
|
216
|
+
export const TIER_MAX_DEPTH = {
|
|
217
|
+
year: 10,
|
|
218
|
+
quarter: 10,
|
|
219
|
+
month: 10,
|
|
220
|
+
week: 10,
|
|
221
|
+
day: 10,
|
|
222
|
+
span: 1,
|
|
223
|
+
};
|
|
224
|
+
/**
|
|
225
|
+
* Depth cascade arrays per literal.
|
|
226
|
+
*
|
|
227
|
+
* Starting from a given literal at depth 0, each subsequent depth level
|
|
228
|
+
* adds the next literal in the cascade. Cascades always move backward in time.
|
|
229
|
+
*
|
|
230
|
+
* Cap interpretation (CLI-3419): cap=10 means max absolute offset is 9.
|
|
231
|
+
* Each base's cascade contains the literals from its own offset down to the
|
|
232
|
+
* tier max. E.g., LAST_QUARTER (offset 1) cascade has 9 entries
|
|
233
|
+
* (offsets 1..9); N_QUARTERS_AGO:9 cascade has 1 entry.
|
|
234
|
+
*
|
|
235
|
+
* Examples:
|
|
236
|
+
* - THIS_YEAR with depth 3 → [THIS_YEAR, LAST_YEAR, N_YEARS_AGO:2]
|
|
237
|
+
* - THIS_QUARTER with depth 4 → [THIS_QUARTER, LAST_QUARTER, N_QUARTERS_AGO:2, N_QUARTERS_AGO:3]
|
|
238
|
+
*/
|
|
239
|
+
export const LITERAL_CASCADES = {
|
|
240
|
+
// Day tier (offsets 0..9 = TODAY, YESTERDAY, N_DAYS_AGO:2..9)
|
|
241
|
+
TODAY: [
|
|
242
|
+
'TODAY',
|
|
243
|
+
'YESTERDAY',
|
|
244
|
+
'N_DAYS_AGO:2',
|
|
245
|
+
'N_DAYS_AGO:3',
|
|
246
|
+
'N_DAYS_AGO:4',
|
|
247
|
+
'N_DAYS_AGO:5',
|
|
248
|
+
'N_DAYS_AGO:6',
|
|
249
|
+
'N_DAYS_AGO:7',
|
|
250
|
+
'N_DAYS_AGO:8',
|
|
251
|
+
'N_DAYS_AGO:9',
|
|
252
|
+
],
|
|
253
|
+
YESTERDAY: [
|
|
254
|
+
'YESTERDAY',
|
|
255
|
+
'N_DAYS_AGO:2',
|
|
256
|
+
'N_DAYS_AGO:3',
|
|
257
|
+
'N_DAYS_AGO:4',
|
|
258
|
+
'N_DAYS_AGO:5',
|
|
259
|
+
'N_DAYS_AGO:6',
|
|
260
|
+
'N_DAYS_AGO:7',
|
|
261
|
+
'N_DAYS_AGO:8',
|
|
262
|
+
'N_DAYS_AGO:9',
|
|
263
|
+
],
|
|
264
|
+
'N_DAYS_AGO:2': [
|
|
265
|
+
'N_DAYS_AGO:2',
|
|
266
|
+
'N_DAYS_AGO:3',
|
|
267
|
+
'N_DAYS_AGO:4',
|
|
268
|
+
'N_DAYS_AGO:5',
|
|
269
|
+
'N_DAYS_AGO:6',
|
|
270
|
+
'N_DAYS_AGO:7',
|
|
271
|
+
'N_DAYS_AGO:8',
|
|
272
|
+
'N_DAYS_AGO:9',
|
|
273
|
+
],
|
|
274
|
+
'N_DAYS_AGO:3': [
|
|
275
|
+
'N_DAYS_AGO:3',
|
|
276
|
+
'N_DAYS_AGO:4',
|
|
277
|
+
'N_DAYS_AGO:5',
|
|
278
|
+
'N_DAYS_AGO:6',
|
|
279
|
+
'N_DAYS_AGO:7',
|
|
280
|
+
'N_DAYS_AGO:8',
|
|
281
|
+
'N_DAYS_AGO:9',
|
|
282
|
+
],
|
|
283
|
+
'N_DAYS_AGO:4': ['N_DAYS_AGO:4', 'N_DAYS_AGO:5', 'N_DAYS_AGO:6', 'N_DAYS_AGO:7', 'N_DAYS_AGO:8', 'N_DAYS_AGO:9'],
|
|
284
|
+
'N_DAYS_AGO:5': ['N_DAYS_AGO:5', 'N_DAYS_AGO:6', 'N_DAYS_AGO:7', 'N_DAYS_AGO:8', 'N_DAYS_AGO:9'],
|
|
285
|
+
'N_DAYS_AGO:6': ['N_DAYS_AGO:6', 'N_DAYS_AGO:7', 'N_DAYS_AGO:8', 'N_DAYS_AGO:9'],
|
|
286
|
+
'N_DAYS_AGO:7': ['N_DAYS_AGO:7', 'N_DAYS_AGO:8', 'N_DAYS_AGO:9'],
|
|
287
|
+
'N_DAYS_AGO:8': ['N_DAYS_AGO:8', 'N_DAYS_AGO:9'],
|
|
288
|
+
'N_DAYS_AGO:9': ['N_DAYS_AGO:9'],
|
|
289
|
+
// Week tier (offsets 0..9 = THIS_WEEK, LAST_WEEK, N_WEEKS_AGO:2..9)
|
|
290
|
+
THIS_WEEK: [
|
|
291
|
+
'THIS_WEEK',
|
|
292
|
+
'LAST_WEEK',
|
|
293
|
+
'N_WEEKS_AGO:2',
|
|
294
|
+
'N_WEEKS_AGO:3',
|
|
295
|
+
'N_WEEKS_AGO:4',
|
|
296
|
+
'N_WEEKS_AGO:5',
|
|
297
|
+
'N_WEEKS_AGO:6',
|
|
298
|
+
'N_WEEKS_AGO:7',
|
|
299
|
+
'N_WEEKS_AGO:8',
|
|
300
|
+
'N_WEEKS_AGO:9',
|
|
301
|
+
],
|
|
302
|
+
LAST_WEEK: [
|
|
303
|
+
'LAST_WEEK',
|
|
304
|
+
'N_WEEKS_AGO:2',
|
|
305
|
+
'N_WEEKS_AGO:3',
|
|
306
|
+
'N_WEEKS_AGO:4',
|
|
307
|
+
'N_WEEKS_AGO:5',
|
|
308
|
+
'N_WEEKS_AGO:6',
|
|
309
|
+
'N_WEEKS_AGO:7',
|
|
310
|
+
'N_WEEKS_AGO:8',
|
|
311
|
+
'N_WEEKS_AGO:9',
|
|
312
|
+
],
|
|
313
|
+
'N_WEEKS_AGO:2': [
|
|
314
|
+
'N_WEEKS_AGO:2',
|
|
315
|
+
'N_WEEKS_AGO:3',
|
|
316
|
+
'N_WEEKS_AGO:4',
|
|
317
|
+
'N_WEEKS_AGO:5',
|
|
318
|
+
'N_WEEKS_AGO:6',
|
|
319
|
+
'N_WEEKS_AGO:7',
|
|
320
|
+
'N_WEEKS_AGO:8',
|
|
321
|
+
'N_WEEKS_AGO:9',
|
|
322
|
+
],
|
|
323
|
+
'N_WEEKS_AGO:3': [
|
|
324
|
+
'N_WEEKS_AGO:3',
|
|
325
|
+
'N_WEEKS_AGO:4',
|
|
326
|
+
'N_WEEKS_AGO:5',
|
|
327
|
+
'N_WEEKS_AGO:6',
|
|
328
|
+
'N_WEEKS_AGO:7',
|
|
329
|
+
'N_WEEKS_AGO:8',
|
|
330
|
+
'N_WEEKS_AGO:9',
|
|
331
|
+
],
|
|
332
|
+
'N_WEEKS_AGO:4': [
|
|
333
|
+
'N_WEEKS_AGO:4',
|
|
334
|
+
'N_WEEKS_AGO:5',
|
|
335
|
+
'N_WEEKS_AGO:6',
|
|
336
|
+
'N_WEEKS_AGO:7',
|
|
337
|
+
'N_WEEKS_AGO:8',
|
|
338
|
+
'N_WEEKS_AGO:9',
|
|
339
|
+
],
|
|
340
|
+
'N_WEEKS_AGO:5': ['N_WEEKS_AGO:5', 'N_WEEKS_AGO:6', 'N_WEEKS_AGO:7', 'N_WEEKS_AGO:8', 'N_WEEKS_AGO:9'],
|
|
341
|
+
'N_WEEKS_AGO:6': ['N_WEEKS_AGO:6', 'N_WEEKS_AGO:7', 'N_WEEKS_AGO:8', 'N_WEEKS_AGO:9'],
|
|
342
|
+
'N_WEEKS_AGO:7': ['N_WEEKS_AGO:7', 'N_WEEKS_AGO:8', 'N_WEEKS_AGO:9'],
|
|
343
|
+
'N_WEEKS_AGO:8': ['N_WEEKS_AGO:8', 'N_WEEKS_AGO:9'],
|
|
344
|
+
'N_WEEKS_AGO:9': ['N_WEEKS_AGO:9'],
|
|
345
|
+
// Month tier (offsets 0..9 = THIS_MONTH, LAST_MONTH, N_MONTHS_AGO:2..9)
|
|
346
|
+
THIS_MONTH: [
|
|
347
|
+
'THIS_MONTH',
|
|
348
|
+
'LAST_MONTH',
|
|
349
|
+
'N_MONTHS_AGO:2',
|
|
350
|
+
'N_MONTHS_AGO:3',
|
|
351
|
+
'N_MONTHS_AGO:4',
|
|
352
|
+
'N_MONTHS_AGO:5',
|
|
353
|
+
'N_MONTHS_AGO:6',
|
|
354
|
+
'N_MONTHS_AGO:7',
|
|
355
|
+
'N_MONTHS_AGO:8',
|
|
356
|
+
'N_MONTHS_AGO:9',
|
|
357
|
+
],
|
|
358
|
+
LAST_MONTH: [
|
|
359
|
+
'LAST_MONTH',
|
|
360
|
+
'N_MONTHS_AGO:2',
|
|
361
|
+
'N_MONTHS_AGO:3',
|
|
362
|
+
'N_MONTHS_AGO:4',
|
|
363
|
+
'N_MONTHS_AGO:5',
|
|
364
|
+
'N_MONTHS_AGO:6',
|
|
365
|
+
'N_MONTHS_AGO:7',
|
|
366
|
+
'N_MONTHS_AGO:8',
|
|
367
|
+
'N_MONTHS_AGO:9',
|
|
368
|
+
],
|
|
369
|
+
'N_MONTHS_AGO:2': [
|
|
370
|
+
'N_MONTHS_AGO:2',
|
|
371
|
+
'N_MONTHS_AGO:3',
|
|
372
|
+
'N_MONTHS_AGO:4',
|
|
373
|
+
'N_MONTHS_AGO:5',
|
|
374
|
+
'N_MONTHS_AGO:6',
|
|
375
|
+
'N_MONTHS_AGO:7',
|
|
376
|
+
'N_MONTHS_AGO:8',
|
|
377
|
+
'N_MONTHS_AGO:9',
|
|
378
|
+
],
|
|
379
|
+
'N_MONTHS_AGO:3': [
|
|
380
|
+
'N_MONTHS_AGO:3',
|
|
381
|
+
'N_MONTHS_AGO:4',
|
|
382
|
+
'N_MONTHS_AGO:5',
|
|
383
|
+
'N_MONTHS_AGO:6',
|
|
384
|
+
'N_MONTHS_AGO:7',
|
|
385
|
+
'N_MONTHS_AGO:8',
|
|
386
|
+
'N_MONTHS_AGO:9',
|
|
387
|
+
],
|
|
388
|
+
'N_MONTHS_AGO:4': [
|
|
389
|
+
'N_MONTHS_AGO:4',
|
|
390
|
+
'N_MONTHS_AGO:5',
|
|
391
|
+
'N_MONTHS_AGO:6',
|
|
392
|
+
'N_MONTHS_AGO:7',
|
|
393
|
+
'N_MONTHS_AGO:8',
|
|
394
|
+
'N_MONTHS_AGO:9',
|
|
395
|
+
],
|
|
396
|
+
'N_MONTHS_AGO:5': ['N_MONTHS_AGO:5', 'N_MONTHS_AGO:6', 'N_MONTHS_AGO:7', 'N_MONTHS_AGO:8', 'N_MONTHS_AGO:9'],
|
|
397
|
+
'N_MONTHS_AGO:6': ['N_MONTHS_AGO:6', 'N_MONTHS_AGO:7', 'N_MONTHS_AGO:8', 'N_MONTHS_AGO:9'],
|
|
398
|
+
'N_MONTHS_AGO:7': ['N_MONTHS_AGO:7', 'N_MONTHS_AGO:8', 'N_MONTHS_AGO:9'],
|
|
399
|
+
'N_MONTHS_AGO:8': ['N_MONTHS_AGO:8', 'N_MONTHS_AGO:9'],
|
|
400
|
+
'N_MONTHS_AGO:9': ['N_MONTHS_AGO:9'],
|
|
401
|
+
// Quarter tier (offsets 0..9 = THIS_QUARTER, LAST_QUARTER, N_QUARTERS_AGO:2..9)
|
|
402
|
+
THIS_QUARTER: [
|
|
403
|
+
'THIS_QUARTER',
|
|
404
|
+
'LAST_QUARTER',
|
|
405
|
+
'N_QUARTERS_AGO:2',
|
|
406
|
+
'N_QUARTERS_AGO:3',
|
|
407
|
+
'N_QUARTERS_AGO:4',
|
|
408
|
+
'N_QUARTERS_AGO:5',
|
|
409
|
+
'N_QUARTERS_AGO:6',
|
|
410
|
+
'N_QUARTERS_AGO:7',
|
|
411
|
+
'N_QUARTERS_AGO:8',
|
|
412
|
+
'N_QUARTERS_AGO:9',
|
|
413
|
+
],
|
|
414
|
+
LAST_QUARTER: [
|
|
415
|
+
'LAST_QUARTER',
|
|
416
|
+
'N_QUARTERS_AGO:2',
|
|
417
|
+
'N_QUARTERS_AGO:3',
|
|
418
|
+
'N_QUARTERS_AGO:4',
|
|
419
|
+
'N_QUARTERS_AGO:5',
|
|
420
|
+
'N_QUARTERS_AGO:6',
|
|
421
|
+
'N_QUARTERS_AGO:7',
|
|
422
|
+
'N_QUARTERS_AGO:8',
|
|
423
|
+
'N_QUARTERS_AGO:9',
|
|
424
|
+
],
|
|
425
|
+
'N_QUARTERS_AGO:2': [
|
|
426
|
+
'N_QUARTERS_AGO:2',
|
|
427
|
+
'N_QUARTERS_AGO:3',
|
|
428
|
+
'N_QUARTERS_AGO:4',
|
|
429
|
+
'N_QUARTERS_AGO:5',
|
|
430
|
+
'N_QUARTERS_AGO:6',
|
|
431
|
+
'N_QUARTERS_AGO:7',
|
|
432
|
+
'N_QUARTERS_AGO:8',
|
|
433
|
+
'N_QUARTERS_AGO:9',
|
|
434
|
+
],
|
|
435
|
+
'N_QUARTERS_AGO:3': [
|
|
436
|
+
'N_QUARTERS_AGO:3',
|
|
437
|
+
'N_QUARTERS_AGO:4',
|
|
438
|
+
'N_QUARTERS_AGO:5',
|
|
439
|
+
'N_QUARTERS_AGO:6',
|
|
440
|
+
'N_QUARTERS_AGO:7',
|
|
441
|
+
'N_QUARTERS_AGO:8',
|
|
442
|
+
'N_QUARTERS_AGO:9',
|
|
443
|
+
],
|
|
444
|
+
'N_QUARTERS_AGO:4': [
|
|
445
|
+
'N_QUARTERS_AGO:4',
|
|
446
|
+
'N_QUARTERS_AGO:5',
|
|
447
|
+
'N_QUARTERS_AGO:6',
|
|
448
|
+
'N_QUARTERS_AGO:7',
|
|
449
|
+
'N_QUARTERS_AGO:8',
|
|
450
|
+
'N_QUARTERS_AGO:9',
|
|
451
|
+
],
|
|
452
|
+
'N_QUARTERS_AGO:5': [
|
|
453
|
+
'N_QUARTERS_AGO:5',
|
|
454
|
+
'N_QUARTERS_AGO:6',
|
|
455
|
+
'N_QUARTERS_AGO:7',
|
|
456
|
+
'N_QUARTERS_AGO:8',
|
|
457
|
+
'N_QUARTERS_AGO:9',
|
|
458
|
+
],
|
|
459
|
+
'N_QUARTERS_AGO:6': ['N_QUARTERS_AGO:6', 'N_QUARTERS_AGO:7', 'N_QUARTERS_AGO:8', 'N_QUARTERS_AGO:9'],
|
|
460
|
+
'N_QUARTERS_AGO:7': ['N_QUARTERS_AGO:7', 'N_QUARTERS_AGO:8', 'N_QUARTERS_AGO:9'],
|
|
461
|
+
'N_QUARTERS_AGO:8': ['N_QUARTERS_AGO:8', 'N_QUARTERS_AGO:9'],
|
|
462
|
+
'N_QUARTERS_AGO:9': ['N_QUARTERS_AGO:9'],
|
|
463
|
+
// Year tier (offsets 0..9 = THIS_YEAR, LAST_YEAR, N_YEARS_AGO:2..9)
|
|
464
|
+
THIS_YEAR: [
|
|
465
|
+
'THIS_YEAR',
|
|
466
|
+
'LAST_YEAR',
|
|
467
|
+
'N_YEARS_AGO:2',
|
|
468
|
+
'N_YEARS_AGO:3',
|
|
469
|
+
'N_YEARS_AGO:4',
|
|
470
|
+
'N_YEARS_AGO:5',
|
|
471
|
+
'N_YEARS_AGO:6',
|
|
472
|
+
'N_YEARS_AGO:7',
|
|
473
|
+
'N_YEARS_AGO:8',
|
|
474
|
+
'N_YEARS_AGO:9',
|
|
475
|
+
],
|
|
476
|
+
LAST_YEAR: [
|
|
477
|
+
'LAST_YEAR',
|
|
478
|
+
'N_YEARS_AGO:2',
|
|
479
|
+
'N_YEARS_AGO:3',
|
|
480
|
+
'N_YEARS_AGO:4',
|
|
481
|
+
'N_YEARS_AGO:5',
|
|
482
|
+
'N_YEARS_AGO:6',
|
|
483
|
+
'N_YEARS_AGO:7',
|
|
484
|
+
'N_YEARS_AGO:8',
|
|
485
|
+
'N_YEARS_AGO:9',
|
|
486
|
+
],
|
|
487
|
+
'N_YEARS_AGO:2': [
|
|
488
|
+
'N_YEARS_AGO:2',
|
|
489
|
+
'N_YEARS_AGO:3',
|
|
490
|
+
'N_YEARS_AGO:4',
|
|
491
|
+
'N_YEARS_AGO:5',
|
|
492
|
+
'N_YEARS_AGO:6',
|
|
493
|
+
'N_YEARS_AGO:7',
|
|
494
|
+
'N_YEARS_AGO:8',
|
|
495
|
+
'N_YEARS_AGO:9',
|
|
496
|
+
],
|
|
497
|
+
'N_YEARS_AGO:3': [
|
|
498
|
+
'N_YEARS_AGO:3',
|
|
499
|
+
'N_YEARS_AGO:4',
|
|
500
|
+
'N_YEARS_AGO:5',
|
|
501
|
+
'N_YEARS_AGO:6',
|
|
502
|
+
'N_YEARS_AGO:7',
|
|
503
|
+
'N_YEARS_AGO:8',
|
|
504
|
+
'N_YEARS_AGO:9',
|
|
505
|
+
],
|
|
506
|
+
'N_YEARS_AGO:4': [
|
|
507
|
+
'N_YEARS_AGO:4',
|
|
508
|
+
'N_YEARS_AGO:5',
|
|
509
|
+
'N_YEARS_AGO:6',
|
|
510
|
+
'N_YEARS_AGO:7',
|
|
511
|
+
'N_YEARS_AGO:8',
|
|
512
|
+
'N_YEARS_AGO:9',
|
|
513
|
+
],
|
|
514
|
+
'N_YEARS_AGO:5': ['N_YEARS_AGO:5', 'N_YEARS_AGO:6', 'N_YEARS_AGO:7', 'N_YEARS_AGO:8', 'N_YEARS_AGO:9'],
|
|
515
|
+
'N_YEARS_AGO:6': ['N_YEARS_AGO:6', 'N_YEARS_AGO:7', 'N_YEARS_AGO:8', 'N_YEARS_AGO:9'],
|
|
516
|
+
'N_YEARS_AGO:7': ['N_YEARS_AGO:7', 'N_YEARS_AGO:8', 'N_YEARS_AGO:9'],
|
|
517
|
+
'N_YEARS_AGO:8': ['N_YEARS_AGO:8', 'N_YEARS_AGO:9'],
|
|
518
|
+
'N_YEARS_AGO:9': ['N_YEARS_AGO:9'],
|
|
519
|
+
// Span literals: no cascade (they already combine multiple periods)
|
|
520
|
+
'LAST_N_YEARS:2': ['LAST_N_YEARS:2'],
|
|
521
|
+
'LAST_N_YEARS:3': ['LAST_N_YEARS:3'],
|
|
522
|
+
};
|
|
523
|
+
/**
|
|
524
|
+
* Validates a date literal value against the ISV-supported set.
|
|
525
|
+
*
|
|
526
|
+
* @param value - The date literal string to validate
|
|
527
|
+
* @returns undefined if valid, error message string if invalid
|
|
528
|
+
*/
|
|
529
|
+
export function validateDateLiteral(value) {
|
|
530
|
+
const upper = value.toUpperCase();
|
|
531
|
+
if (!SUPPORTED_DATE_LITERALS.includes(upper)) {
|
|
532
|
+
return `Invalid date literal "${value}". Supported values: ${SUPPORTED_DATE_LITERALS.join(', ')}`;
|
|
533
|
+
}
|
|
534
|
+
return undefined;
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Resolves CLI flag inputs into a validated DateLiteralRange.
|
|
538
|
+
*
|
|
539
|
+
* @param input - Raw flag inputs
|
|
540
|
+
* @returns Resolved DateLiteralRange
|
|
541
|
+
* @throws Error if inputs are invalid
|
|
542
|
+
*/
|
|
543
|
+
export function resolveDateLiteralRange(input) {
|
|
544
|
+
const upper = input.dateLiteral.toUpperCase();
|
|
545
|
+
const validationError = validateDateLiteral(upper);
|
|
546
|
+
if (validationError) {
|
|
547
|
+
throw new Error(validationError);
|
|
548
|
+
}
|
|
549
|
+
const tier = LITERAL_TIERS[upper];
|
|
550
|
+
const maxDepth = TIER_MAX_DEPTH[tier];
|
|
551
|
+
const cascade = LITERAL_CASCADES[upper];
|
|
552
|
+
const depth = input.depth ?? 1;
|
|
553
|
+
if (depth < 1) {
|
|
554
|
+
throw new Error(`--depth must be at least 1, got ${depth}`);
|
|
555
|
+
}
|
|
556
|
+
const effectiveMax = Math.min(cascade.length, maxDepth);
|
|
557
|
+
if (depth > effectiveMax) {
|
|
558
|
+
const hint = tier === 'span'
|
|
559
|
+
? '--depth is not supported for span-tier date literals. Span literals already aggregate multiple periods.'
|
|
560
|
+
: cascade.length < maxDepth
|
|
561
|
+
? `"${upper}" supports a maximum depth of ${cascade.length}. Use an earlier ${tier}-tier literal for deeper cascading (max: ${maxDepth}).`
|
|
562
|
+
: `Maximum depth for ${tier} tier: ${maxDepth}.`;
|
|
563
|
+
throw new Error(`--depth ${depth} exceeds maximum of ${effectiveMax} for "${upper}". ${hint}`);
|
|
564
|
+
}
|
|
565
|
+
const entries = cascade.slice(0, depth).map((literal) => ({
|
|
566
|
+
literal,
|
|
567
|
+
label: DATE_LITERAL_LABELS[literal],
|
|
568
|
+
}));
|
|
569
|
+
return {
|
|
570
|
+
entries,
|
|
571
|
+
dateField: input.dateField ?? 'CreatedDate',
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* Returns the customer-facing label for a date literal.
|
|
576
|
+
*
|
|
577
|
+
* @param literal - A supported date literal value
|
|
578
|
+
* @returns The label string, or the raw literal if not found
|
|
579
|
+
*/
|
|
580
|
+
export function getDateLiteralLabel(literal) {
|
|
581
|
+
const upper = literal.toUpperCase();
|
|
582
|
+
return DATE_LITERAL_LABELS[upper] ?? literal;
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Customer-facing labels for known date-field API names.
|
|
586
|
+
* Used by humanizeDateField() to render filter labels and description text.
|
|
587
|
+
*/
|
|
588
|
+
export const DATE_FIELD_LABELS = {
|
|
589
|
+
CreatedDate: 'Created Date',
|
|
590
|
+
LastModifiedDate: 'Last Modified Date',
|
|
591
|
+
};
|
|
592
|
+
/**
|
|
593
|
+
* Converts a date-field API name into a customer-facing label.
|
|
594
|
+
*
|
|
595
|
+
* Examples:
|
|
596
|
+
* - `humanizeDateField('CreatedDate')` returns `'Created Date'`
|
|
597
|
+
* - `humanizeDateField('LastModifiedDate')` returns `'Last Modified Date'`
|
|
598
|
+
* - `humanizeDateField('SomeCustomDate__c')` returns `'Some Custom Date'`
|
|
599
|
+
* - `humanizeDateField('')` returns `''`
|
|
600
|
+
*
|
|
601
|
+
* Known field names return their canonical label from DATE_FIELD_LABELS.
|
|
602
|
+
* Unknown PascalCase identifiers are split into space-separated words
|
|
603
|
+
* with custom-field `__c` suffix stripped. Falsy input is returned
|
|
604
|
+
* as-is so caller-side `label ? ... : dateField` truthy guards continue
|
|
605
|
+
* to work unchanged.
|
|
606
|
+
*
|
|
607
|
+
* @param dateField - The date-field API name (e.g., 'CreatedDate')
|
|
608
|
+
* @returns The customer-facing label
|
|
609
|
+
*/
|
|
610
|
+
export function humanizeDateField(dateField) {
|
|
611
|
+
if (!dateField)
|
|
612
|
+
return dateField;
|
|
613
|
+
const known = DATE_FIELD_LABELS[dateField];
|
|
614
|
+
if (known)
|
|
615
|
+
return known;
|
|
616
|
+
const withoutCustomSuffix = dateField.replace(/__c$/i, '').replace(/__/g, ' ');
|
|
617
|
+
return withoutCustomSuffix
|
|
618
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1 $2')
|
|
619
|
+
.replace(/_/g, ' ')
|
|
620
|
+
.trim();
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* Maps each date literal to its `$Constant.*` display value for the expression builder.
|
|
624
|
+
* These are the values that `fsc_expressionBuilder3` renders in the Value field.
|
|
625
|
+
*
|
|
626
|
+
* Naming mirrors the existing year-tier convention ($Constant.TwoYearsAgo,
|
|
627
|
+
* $Constant.ThreeYearsAgo) — CLI-3419 extends to all non-span tiers.
|
|
628
|
+
*/
|
|
629
|
+
export const DATE_LITERAL_CONSTANTS = {
|
|
630
|
+
// Day tier
|
|
631
|
+
TODAY: '$Constant.Today',
|
|
632
|
+
YESTERDAY: '$Constant.Yesterday',
|
|
633
|
+
'N_DAYS_AGO:2': '$Constant.TwoDaysAgo',
|
|
634
|
+
'N_DAYS_AGO:3': '$Constant.ThreeDaysAgo',
|
|
635
|
+
'N_DAYS_AGO:4': '$Constant.FourDaysAgo',
|
|
636
|
+
'N_DAYS_AGO:5': '$Constant.FiveDaysAgo',
|
|
637
|
+
'N_DAYS_AGO:6': '$Constant.SixDaysAgo',
|
|
638
|
+
'N_DAYS_AGO:7': '$Constant.SevenDaysAgo',
|
|
639
|
+
'N_DAYS_AGO:8': '$Constant.EightDaysAgo',
|
|
640
|
+
'N_DAYS_AGO:9': '$Constant.NineDaysAgo',
|
|
641
|
+
// Week tier
|
|
642
|
+
THIS_WEEK: '$Constant.ThisWeek',
|
|
643
|
+
LAST_WEEK: '$Constant.LastWeek',
|
|
644
|
+
'N_WEEKS_AGO:2': '$Constant.TwoWeeksAgo',
|
|
645
|
+
'N_WEEKS_AGO:3': '$Constant.ThreeWeeksAgo',
|
|
646
|
+
'N_WEEKS_AGO:4': '$Constant.FourWeeksAgo',
|
|
647
|
+
'N_WEEKS_AGO:5': '$Constant.FiveWeeksAgo',
|
|
648
|
+
'N_WEEKS_AGO:6': '$Constant.SixWeeksAgo',
|
|
649
|
+
'N_WEEKS_AGO:7': '$Constant.SevenWeeksAgo',
|
|
650
|
+
'N_WEEKS_AGO:8': '$Constant.EightWeeksAgo',
|
|
651
|
+
'N_WEEKS_AGO:9': '$Constant.NineWeeksAgo',
|
|
652
|
+
// Month tier
|
|
653
|
+
THIS_MONTH: '$Constant.ThisMonth',
|
|
654
|
+
LAST_MONTH: '$Constant.LastMonth',
|
|
655
|
+
'N_MONTHS_AGO:2': '$Constant.TwoMonthsAgo',
|
|
656
|
+
'N_MONTHS_AGO:3': '$Constant.ThreeMonthsAgo',
|
|
657
|
+
'N_MONTHS_AGO:4': '$Constant.FourMonthsAgo',
|
|
658
|
+
'N_MONTHS_AGO:5': '$Constant.FiveMonthsAgo',
|
|
659
|
+
'N_MONTHS_AGO:6': '$Constant.SixMonthsAgo',
|
|
660
|
+
'N_MONTHS_AGO:7': '$Constant.SevenMonthsAgo',
|
|
661
|
+
'N_MONTHS_AGO:8': '$Constant.EightMonthsAgo',
|
|
662
|
+
'N_MONTHS_AGO:9': '$Constant.NineMonthsAgo',
|
|
663
|
+
// Quarter tier
|
|
664
|
+
THIS_QUARTER: '$Constant.ThisQuarter',
|
|
665
|
+
LAST_QUARTER: '$Constant.LastQuarter',
|
|
666
|
+
'N_QUARTERS_AGO:2': '$Constant.TwoQuartersAgo',
|
|
667
|
+
'N_QUARTERS_AGO:3': '$Constant.ThreeQuartersAgo',
|
|
668
|
+
'N_QUARTERS_AGO:4': '$Constant.FourQuartersAgo',
|
|
669
|
+
'N_QUARTERS_AGO:5': '$Constant.FiveQuartersAgo',
|
|
670
|
+
'N_QUARTERS_AGO:6': '$Constant.SixQuartersAgo',
|
|
671
|
+
'N_QUARTERS_AGO:7': '$Constant.SevenQuartersAgo',
|
|
672
|
+
'N_QUARTERS_AGO:8': '$Constant.EightQuartersAgo',
|
|
673
|
+
'N_QUARTERS_AGO:9': '$Constant.NineQuartersAgo',
|
|
674
|
+
// Year tier
|
|
675
|
+
THIS_YEAR: '$Constant.ThisYear',
|
|
676
|
+
LAST_YEAR: '$Constant.LastYear',
|
|
677
|
+
'N_YEARS_AGO:2': '$Constant.TwoYearsAgo',
|
|
678
|
+
'N_YEARS_AGO:3': '$Constant.ThreeYearsAgo',
|
|
679
|
+
'N_YEARS_AGO:4': '$Constant.FourYearsAgo',
|
|
680
|
+
'N_YEARS_AGO:5': '$Constant.FiveYearsAgo',
|
|
681
|
+
'N_YEARS_AGO:6': '$Constant.SixYearsAgo',
|
|
682
|
+
'N_YEARS_AGO:7': '$Constant.SevenYearsAgo',
|
|
683
|
+
'N_YEARS_AGO:8': '$Constant.EightYearsAgo',
|
|
684
|
+
'N_YEARS_AGO:9': '$Constant.NineYearsAgo',
|
|
685
|
+
// Span tier
|
|
686
|
+
'LAST_N_YEARS:2': '$Constant.LastTwoYears',
|
|
687
|
+
'LAST_N_YEARS:3': '$Constant.LastThreeYears',
|
|
688
|
+
};
|
|
689
|
+
/**
|
|
690
|
+
* Builds an ISV-compatible filterJson string for date literal filtering.
|
|
691
|
+
*
|
|
692
|
+
* Produces the full expression builder JSON schema that `fsc_expressionBuilder3` expects,
|
|
693
|
+
* including all 12 required fields per expression line. The `parameter` field uses `$Constant.*`
|
|
694
|
+
* display values and `parameterValue` / `dateLiteral` use the SOQL literal.
|
|
695
|
+
*
|
|
696
|
+
* The outer envelope (hasFilters, setA) is required by ProfilingDefinitionApiService.resolveFilterClause()
|
|
697
|
+
* to enable WHERE clause filtering. setA.json must be an object (not a string) — the API
|
|
698
|
+
* does JSON.serialize() on it.
|
|
699
|
+
*
|
|
700
|
+
* @param dateField - The date/datetime field to filter on (e.g., 'CreatedDate')
|
|
701
|
+
* @param dateLiteral - The date literal value (e.g., 'THIS_YEAR', 'N_YEARS_AGO:2')
|
|
702
|
+
* @param objectName - The Salesforce object API name (e.g., 'Account', 'Lead'). Defaults to empty string for backward compatibility.
|
|
703
|
+
* @param objectLabel - The Salesforce object label (e.g., 'Account', 'Lead'). Defaults to objectName.
|
|
704
|
+
* @returns JSON string compatible with GlobalProfilingService.createProfilingDefinition()
|
|
705
|
+
*/
|
|
706
|
+
export function buildDateLiteralFilterJson(dateField, dateLiteral, objectName = '', objectLabel) {
|
|
707
|
+
const label = objectLabel ?? objectName;
|
|
708
|
+
const constantValue = DATE_LITERAL_CONSTANTS[dateLiteral] ?? dateLiteral;
|
|
709
|
+
const expressionJson = {
|
|
710
|
+
expressions: [
|
|
711
|
+
{
|
|
712
|
+
objectType: objectName,
|
|
713
|
+
parameter: constantValue,
|
|
714
|
+
parameterValue: dateLiteral,
|
|
715
|
+
dataType: 'DATETIME',
|
|
716
|
+
label: label ? `${label}: ${humanizeDateField(dateField)}` : dateField,
|
|
717
|
+
type: objectName,
|
|
718
|
+
fieldName: dateField,
|
|
719
|
+
operator: 'equals',
|
|
720
|
+
operatorSymbol: '=',
|
|
721
|
+
value: objectName ? `$${objectName}.${dateField}` : dateField,
|
|
722
|
+
dateLiteral,
|
|
723
|
+
},
|
|
724
|
+
],
|
|
725
|
+
logicType: 'AND',
|
|
726
|
+
};
|
|
727
|
+
return JSON.stringify({
|
|
728
|
+
hasFilters: true,
|
|
729
|
+
setA: {
|
|
730
|
+
json: expressionJson,
|
|
731
|
+
expression: `${dateField} = ${dateLiteral}`,
|
|
732
|
+
},
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
736
|
+
* Builds an ISV-compatible filterJson string for date-literal comparative definitions.
|
|
737
|
+
* Creates SetA (primary period) and SetB (prior period), both using SOQL date literals.
|
|
738
|
+
*
|
|
739
|
+
* Used when method='comparative' with a date literal that has a prior period in its cascade.
|
|
740
|
+
* The prior literal is derived from LITERAL_CASCADES[setALiteral][1] by the caller.
|
|
741
|
+
*
|
|
742
|
+
* @param dateField - The date/datetime field to filter on (e.g., 'CreatedDate', 'LastModifiedDate')
|
|
743
|
+
* @param setALiteral - The primary (current) date literal for SetA
|
|
744
|
+
* @param setBLiteral - The prior period date literal for SetB
|
|
745
|
+
* @param objectName - The Salesforce object API name
|
|
746
|
+
* @param objectLabel - The Salesforce object label
|
|
747
|
+
* @returns JSON string with hasFilters, setA, and setB
|
|
748
|
+
*/
|
|
749
|
+
export function buildComparativeDateLiteralFilterJson(dateField, setALiteral, setBLiteral, objectName = '', objectLabel) {
|
|
750
|
+
const label = objectLabel ?? objectName;
|
|
751
|
+
const fieldLabel = label ? `${label}: ${humanizeDateField(dateField)}` : dateField;
|
|
752
|
+
const fieldValue = objectName ? `$${objectName}.${dateField}` : dateField;
|
|
753
|
+
const buildExpression = (literal) => {
|
|
754
|
+
const constantValue = DATE_LITERAL_CONSTANTS[literal] ?? literal;
|
|
755
|
+
return {
|
|
756
|
+
expressions: [
|
|
757
|
+
{
|
|
758
|
+
objectType: objectName,
|
|
759
|
+
parameter: constantValue,
|
|
760
|
+
parameterValue: literal,
|
|
761
|
+
dataType: 'DATETIME',
|
|
762
|
+
label: fieldLabel,
|
|
763
|
+
type: objectName,
|
|
764
|
+
fieldName: dateField,
|
|
765
|
+
operator: 'equals',
|
|
766
|
+
operatorSymbol: '=',
|
|
767
|
+
value: fieldValue,
|
|
768
|
+
dateLiteral: literal,
|
|
769
|
+
},
|
|
770
|
+
],
|
|
771
|
+
logicType: 'AND',
|
|
772
|
+
};
|
|
773
|
+
};
|
|
774
|
+
return JSON.stringify({
|
|
775
|
+
hasFilters: true,
|
|
776
|
+
setA: {
|
|
777
|
+
json: buildExpression(setALiteral),
|
|
778
|
+
expression: `${dateField} = ${setALiteral}`,
|
|
779
|
+
},
|
|
780
|
+
setB: {
|
|
781
|
+
json: buildExpression(setBLiteral),
|
|
782
|
+
expression: `${dateField} = ${setBLiteral}`,
|
|
783
|
+
},
|
|
784
|
+
});
|
|
785
|
+
}
|
|
786
|
+
/**
|
|
787
|
+
* Formats a year boundary as an ISO 8601 UTC midnight string.
|
|
788
|
+
* Used for explicit date range expressions in year-based comparisons.
|
|
789
|
+
*/
|
|
790
|
+
export function yearBoundaryISO(year) {
|
|
791
|
+
return `${year}-01-01T00:00:00.000Z`;
|
|
792
|
+
}
|
|
793
|
+
/**
|
|
794
|
+
* Formats a year boundary as a human-readable display string (M/d/yyyy, h:mm a).
|
|
795
|
+
* Used for the `parameter` display value in expression builder JSON.
|
|
796
|
+
*/
|
|
797
|
+
export function yearBoundaryDisplay(year) {
|
|
798
|
+
return `1/1/${year}, 12:00 AM`;
|
|
799
|
+
}
|
|
800
|
+
/**
|
|
801
|
+
* Builds an ISV-compatible filterJson string for a single year (SetA only, no SetB).
|
|
802
|
+
* Used for historical definitions scoped to a specific year via --year flag.
|
|
803
|
+
*
|
|
804
|
+
* @param dateField - The date/datetime field to filter on (e.g., 'CreatedDate')
|
|
805
|
+
* @param year - The target year
|
|
806
|
+
* @param objectName - The Salesforce object API name
|
|
807
|
+
* @param objectLabel - The Salesforce object label
|
|
808
|
+
* @returns JSON string with hasFilters and setA (no setB)
|
|
809
|
+
*/
|
|
810
|
+
export function buildHistoricalYearFilterJson(dateField, year, objectName = '', objectLabel) {
|
|
811
|
+
const label = objectLabel ?? objectName;
|
|
812
|
+
const fieldLabel = label ? `${label}: ${humanizeDateField(dateField)}` : dateField;
|
|
813
|
+
const fieldValue = objectName ? `$${objectName}.${dateField}` : dateField;
|
|
814
|
+
const yearStart = yearBoundaryISO(year);
|
|
815
|
+
const yearEnd = yearBoundaryISO(year + 1);
|
|
816
|
+
const yearStartDisplay = yearBoundaryDisplay(year);
|
|
817
|
+
const yearEndDisplay = yearBoundaryDisplay(year + 1);
|
|
818
|
+
return JSON.stringify({
|
|
819
|
+
hasFilters: true,
|
|
820
|
+
setA: {
|
|
821
|
+
json: {
|
|
822
|
+
expressions: [
|
|
823
|
+
{
|
|
824
|
+
objectType: objectName,
|
|
825
|
+
parameter: yearStartDisplay,
|
|
826
|
+
parameterValue: yearStart,
|
|
827
|
+
dataType: 'DATETIME',
|
|
828
|
+
label: fieldLabel,
|
|
829
|
+
type: objectName,
|
|
830
|
+
fieldName: dateField,
|
|
831
|
+
operator: 'greater_or_equal',
|
|
832
|
+
operatorSymbol: '>=',
|
|
833
|
+
value: fieldValue,
|
|
834
|
+
dateLiteral: '',
|
|
835
|
+
},
|
|
836
|
+
{
|
|
837
|
+
objectType: objectName,
|
|
838
|
+
parameter: yearEndDisplay,
|
|
839
|
+
parameterValue: yearEnd,
|
|
840
|
+
dataType: 'DATETIME',
|
|
841
|
+
label: fieldLabel,
|
|
842
|
+
type: objectName,
|
|
843
|
+
fieldName: dateField,
|
|
844
|
+
operator: 'less_than',
|
|
845
|
+
operatorSymbol: '<',
|
|
846
|
+
value: fieldValue,
|
|
847
|
+
dateLiteral: '',
|
|
848
|
+
},
|
|
849
|
+
],
|
|
850
|
+
logicType: 'AND',
|
|
851
|
+
},
|
|
852
|
+
expression: `${dateField} >= ${yearStart} AND ${dateField} < ${yearEnd}`,
|
|
853
|
+
},
|
|
854
|
+
});
|
|
855
|
+
}
|
|
856
|
+
/**
|
|
857
|
+
* Builds an ISV-compatible filterJson string for year-based comparative definitions.
|
|
858
|
+
* Creates SetA (target year) and SetB (prior year or all prior years) using explicit
|
|
859
|
+
* date range expressions (>= start AND < end), not date literals.
|
|
860
|
+
*
|
|
861
|
+
* This approach supports arbitrary years with no lookback limitation.
|
|
862
|
+
*
|
|
863
|
+
* @param dateField - The date/datetime field to filter on (e.g., 'CreatedDate', 'LastModifiedDate')
|
|
864
|
+
* @param year - The target year for SetA
|
|
865
|
+
* @param usePrior - When true, SetB is all records before the target year. When false, SetB is the prior year.
|
|
866
|
+
* @param objectName - The Salesforce object API name
|
|
867
|
+
* @param objectLabel - The Salesforce object label
|
|
868
|
+
* @returns JSON string with hasFilters, setA, and setB
|
|
869
|
+
*/
|
|
870
|
+
export function buildComparativeYearFilterJson(dateField, year, usePrior, objectName = '', objectLabel) {
|
|
871
|
+
const label = objectLabel ?? objectName;
|
|
872
|
+
const fieldLabel = label ? `${label}: ${humanizeDateField(dateField)}` : dateField;
|
|
873
|
+
const fieldValue = objectName ? `$${objectName}.${dateField}` : dateField;
|
|
874
|
+
const yearStart = yearBoundaryISO(year);
|
|
875
|
+
const yearEnd = yearBoundaryISO(year + 1);
|
|
876
|
+
const yearStartDisplay = yearBoundaryDisplay(year);
|
|
877
|
+
const yearEndDisplay = yearBoundaryDisplay(year + 1);
|
|
878
|
+
// SetA: target year (>= Jan 1 year AND < Jan 1 year+1)
|
|
879
|
+
const setAJson = {
|
|
880
|
+
expressions: [
|
|
881
|
+
{
|
|
882
|
+
objectType: objectName,
|
|
883
|
+
parameter: yearStartDisplay,
|
|
884
|
+
parameterValue: yearStart,
|
|
885
|
+
dataType: 'DATETIME',
|
|
886
|
+
label: fieldLabel,
|
|
887
|
+
type: objectName,
|
|
888
|
+
fieldName: dateField,
|
|
889
|
+
operator: 'greater_or_equal',
|
|
890
|
+
operatorSymbol: '>=',
|
|
891
|
+
value: fieldValue,
|
|
892
|
+
dateLiteral: '',
|
|
893
|
+
},
|
|
894
|
+
{
|
|
895
|
+
objectType: objectName,
|
|
896
|
+
parameter: yearEndDisplay,
|
|
897
|
+
parameterValue: yearEnd,
|
|
898
|
+
dataType: 'DATETIME',
|
|
899
|
+
label: fieldLabel,
|
|
900
|
+
type: objectName,
|
|
901
|
+
fieldName: dateField,
|
|
902
|
+
operator: 'less_than',
|
|
903
|
+
operatorSymbol: '<',
|
|
904
|
+
value: fieldValue,
|
|
905
|
+
dateLiteral: '',
|
|
906
|
+
},
|
|
907
|
+
],
|
|
908
|
+
logicType: 'AND',
|
|
909
|
+
};
|
|
910
|
+
// SetB: prior year or all prior
|
|
911
|
+
let setBJson;
|
|
912
|
+
let setBExpression;
|
|
913
|
+
if (usePrior) {
|
|
914
|
+
// All records before the target year
|
|
915
|
+
setBJson = {
|
|
916
|
+
expressions: [
|
|
917
|
+
{
|
|
918
|
+
objectType: objectName,
|
|
919
|
+
parameter: yearStartDisplay,
|
|
920
|
+
parameterValue: yearStart,
|
|
921
|
+
dataType: 'DATETIME',
|
|
922
|
+
label: fieldLabel,
|
|
923
|
+
type: objectName,
|
|
924
|
+
fieldName: dateField,
|
|
925
|
+
operator: 'less_than',
|
|
926
|
+
operatorSymbol: '<',
|
|
927
|
+
value: fieldValue,
|
|
928
|
+
dateLiteral: '',
|
|
929
|
+
},
|
|
930
|
+
],
|
|
931
|
+
logicType: 'AND',
|
|
932
|
+
};
|
|
933
|
+
setBExpression = `${dateField} < ${yearStart}`;
|
|
934
|
+
}
|
|
935
|
+
else {
|
|
936
|
+
// Prior year only (>= Jan 1 year-1 AND < Jan 1 year)
|
|
937
|
+
const priorStart = yearBoundaryISO(year - 1);
|
|
938
|
+
const priorStartDisplay = yearBoundaryDisplay(year - 1);
|
|
939
|
+
setBJson = {
|
|
940
|
+
expressions: [
|
|
941
|
+
{
|
|
942
|
+
objectType: objectName,
|
|
943
|
+
parameter: priorStartDisplay,
|
|
944
|
+
parameterValue: priorStart,
|
|
945
|
+
dataType: 'DATETIME',
|
|
946
|
+
label: fieldLabel,
|
|
947
|
+
type: objectName,
|
|
948
|
+
fieldName: dateField,
|
|
949
|
+
operator: 'greater_or_equal',
|
|
950
|
+
operatorSymbol: '>=',
|
|
951
|
+
value: fieldValue,
|
|
952
|
+
dateLiteral: '',
|
|
953
|
+
},
|
|
954
|
+
{
|
|
955
|
+
objectType: objectName,
|
|
956
|
+
parameter: yearStartDisplay,
|
|
957
|
+
parameterValue: yearStart,
|
|
958
|
+
dataType: 'DATETIME',
|
|
959
|
+
label: fieldLabel,
|
|
960
|
+
type: objectName,
|
|
961
|
+
fieldName: dateField,
|
|
962
|
+
operator: 'less_than',
|
|
963
|
+
operatorSymbol: '<',
|
|
964
|
+
value: fieldValue,
|
|
965
|
+
dateLiteral: '',
|
|
966
|
+
},
|
|
967
|
+
],
|
|
968
|
+
logicType: 'AND',
|
|
969
|
+
};
|
|
970
|
+
setBExpression = `${dateField} >= ${priorStart} AND ${dateField} < ${yearStart}`;
|
|
971
|
+
}
|
|
972
|
+
return JSON.stringify({
|
|
973
|
+
hasFilters: true,
|
|
974
|
+
setA: {
|
|
975
|
+
json: setAJson,
|
|
976
|
+
expression: `${dateField} >= ${yearStart} AND ${dateField} < ${yearEnd}`,
|
|
977
|
+
},
|
|
978
|
+
setB: {
|
|
979
|
+
json: setBJson,
|
|
980
|
+
expression: setBExpression,
|
|
981
|
+
},
|
|
982
|
+
});
|
|
983
|
+
}
|
|
984
|
+
/**
|
|
985
|
+
* Builds an ISV-compatible filterJson string for the lifetime-vs-X comparative variant.
|
|
986
|
+
*
|
|
987
|
+
* SetA is unfiltered (empty expressions array — represents "all records / lifetime"); SetB carries the supplied
|
|
988
|
+
* secondary filter. This is the inverse of `buildComparativeYearFilterJson`, where SetA is the year-scoped set and
|
|
989
|
+
* SetB is the prior-year (or unbounded) set.
|
|
990
|
+
*
|
|
991
|
+
* @param dateField - The date/datetime field to filter on (e.g., 'CreatedDate', 'LastModifiedDate')
|
|
992
|
+
* @param secondary - The secondary filter spec applied to SetB. Accepts `{ kind: 'year', year }` for a year-bounded SetB,
|
|
993
|
+
* or `{ kind: 'dateLiteral', literal }` for a SOQL date-literal SetB.
|
|
994
|
+
* @param objectName - The Salesforce object API name
|
|
995
|
+
* @param objectLabel - The Salesforce object label (defaults to objectName)
|
|
996
|
+
* @returns JSON string with hasFilters, setA (empty), and setB (filtered)
|
|
997
|
+
*/
|
|
998
|
+
export function buildLifetimeComparativeFilterJson(dateField, secondary, objectName = '', objectLabel) {
|
|
999
|
+
const label = objectLabel ?? objectName;
|
|
1000
|
+
const fieldLabel = label ? `${label}: ${humanizeDateField(dateField)}` : dateField;
|
|
1001
|
+
const fieldValue = objectName ? `$${objectName}.${dateField}` : dateField;
|
|
1002
|
+
// SetA — empty expressions array represents "lifetime / all records" at the ISV layer.
|
|
1003
|
+
const setAJson = {
|
|
1004
|
+
expressions: [],
|
|
1005
|
+
logicType: 'AND',
|
|
1006
|
+
};
|
|
1007
|
+
let setBJson;
|
|
1008
|
+
let setBExpression;
|
|
1009
|
+
if (secondary.kind === 'year') {
|
|
1010
|
+
const yearStart = yearBoundaryISO(secondary.year);
|
|
1011
|
+
const yearEnd = yearBoundaryISO(secondary.year + 1);
|
|
1012
|
+
const yearStartDisplay = yearBoundaryDisplay(secondary.year);
|
|
1013
|
+
const yearEndDisplay = yearBoundaryDisplay(secondary.year + 1);
|
|
1014
|
+
setBJson = {
|
|
1015
|
+
expressions: [
|
|
1016
|
+
{
|
|
1017
|
+
objectType: objectName,
|
|
1018
|
+
parameter: yearStartDisplay,
|
|
1019
|
+
parameterValue: yearStart,
|
|
1020
|
+
dataType: 'DATETIME',
|
|
1021
|
+
label: fieldLabel,
|
|
1022
|
+
type: objectName,
|
|
1023
|
+
fieldName: dateField,
|
|
1024
|
+
operator: 'greater_or_equal',
|
|
1025
|
+
operatorSymbol: '>=',
|
|
1026
|
+
value: fieldValue,
|
|
1027
|
+
dateLiteral: '',
|
|
1028
|
+
},
|
|
1029
|
+
{
|
|
1030
|
+
objectType: objectName,
|
|
1031
|
+
parameter: yearEndDisplay,
|
|
1032
|
+
parameterValue: yearEnd,
|
|
1033
|
+
dataType: 'DATETIME',
|
|
1034
|
+
label: fieldLabel,
|
|
1035
|
+
type: objectName,
|
|
1036
|
+
fieldName: dateField,
|
|
1037
|
+
operator: 'less_than',
|
|
1038
|
+
operatorSymbol: '<',
|
|
1039
|
+
value: fieldValue,
|
|
1040
|
+
dateLiteral: '',
|
|
1041
|
+
},
|
|
1042
|
+
],
|
|
1043
|
+
logicType: 'AND',
|
|
1044
|
+
};
|
|
1045
|
+
setBExpression = `${dateField} >= ${yearStart} AND ${dateField} < ${yearEnd}`;
|
|
1046
|
+
}
|
|
1047
|
+
else {
|
|
1048
|
+
const constantValue = DATE_LITERAL_CONSTANTS[secondary.literal] ?? secondary.literal;
|
|
1049
|
+
setBJson = {
|
|
1050
|
+
expressions: [
|
|
1051
|
+
{
|
|
1052
|
+
objectType: objectName,
|
|
1053
|
+
parameter: constantValue,
|
|
1054
|
+
parameterValue: secondary.literal,
|
|
1055
|
+
dataType: 'DATETIME',
|
|
1056
|
+
label: fieldLabel,
|
|
1057
|
+
type: objectName,
|
|
1058
|
+
fieldName: dateField,
|
|
1059
|
+
operator: 'equals',
|
|
1060
|
+
operatorSymbol: '=',
|
|
1061
|
+
value: fieldValue,
|
|
1062
|
+
dateLiteral: secondary.literal,
|
|
1063
|
+
},
|
|
1064
|
+
],
|
|
1065
|
+
logicType: 'AND',
|
|
1066
|
+
};
|
|
1067
|
+
setBExpression = `${dateField} = ${secondary.literal}`;
|
|
1068
|
+
}
|
|
1069
|
+
return JSON.stringify({
|
|
1070
|
+
hasFilters: true,
|
|
1071
|
+
setA: {
|
|
1072
|
+
json: setAJson,
|
|
1073
|
+
expression: '',
|
|
1074
|
+
},
|
|
1075
|
+
setB: {
|
|
1076
|
+
json: setBJson,
|
|
1077
|
+
expression: setBExpression,
|
|
1078
|
+
},
|
|
1079
|
+
});
|
|
1080
|
+
}
|
|
1081
|
+
/**
|
|
1082
|
+
* Single expression-builder JSON line representing a `RecordTypeId = <rtId>` condition.
|
|
1083
|
+
* Matches the 11-field schema (12 with optional `id`) that `fsc_expressionBuilder3` expects,
|
|
1084
|
+
* used when scoping a profiling definition to a specific record type.
|
|
1085
|
+
*
|
|
1086
|
+
* @param rtId - The RecordType Salesforce ID (15 or 18 chars)
|
|
1087
|
+
* @param objectName - The Salesforce object API name (e.g., 'Case')
|
|
1088
|
+
* @param objectLabel - The Salesforce object label (defaults to objectName)
|
|
1089
|
+
* @returns Expression line ready to embed in `setA.json.expressions` / `setB.json.expressions`
|
|
1090
|
+
*/
|
|
1091
|
+
export function buildRecordTypeFilterExpression(rtId, objectName = '', objectLabel) {
|
|
1092
|
+
const label = objectLabel ?? objectName;
|
|
1093
|
+
// parameterValue must be SOQL-ready: server-side ExpressionBuilder concatenates it raw into
|
|
1094
|
+
// the WHERE clause for non-DATETIME types (open-source/classes/ExpressionBuilder.cls:572), and
|
|
1095
|
+
// RecordTypeId is an Id reference field — without the surrounding single quotes the emitted
|
|
1096
|
+
// SOQL is "RecordTypeId = 012ABC..." and Salesforce returns MALFORMED_QUERY 400.
|
|
1097
|
+
return {
|
|
1098
|
+
objectType: objectName,
|
|
1099
|
+
parameter: rtId,
|
|
1100
|
+
parameterValue: `'${rtId}'`,
|
|
1101
|
+
dataType: 'STRING',
|
|
1102
|
+
label: label ? `${label}: Record Type ID` : 'Record Type ID',
|
|
1103
|
+
type: objectName,
|
|
1104
|
+
fieldName: 'RecordTypeId',
|
|
1105
|
+
operator: 'equals',
|
|
1106
|
+
operatorSymbol: '=',
|
|
1107
|
+
value: objectName ? `$${objectName}.RecordTypeId` : 'RecordTypeId',
|
|
1108
|
+
dateLiteral: '',
|
|
1109
|
+
};
|
|
1110
|
+
}
|
|
1111
|
+
/**
|
|
1112
|
+
* Composes a RecordTypeId scope filter into an existing ISV filterJson envelope so the server
|
|
1113
|
+
* restricts profiling SOQL to a single record type. CLI-3834: `--method recordtype` was writing
|
|
1114
|
+
* the RT name to `Prop_SegmentCategory__c` (label only) without populating the filter/RT-scope
|
|
1115
|
+
* fields. This helper appends the RT condition to `setA` (and `setB` when present) preserving
|
|
1116
|
+
* the source `logicType` (defaults to `'AND'` for the legacy canonical builders).
|
|
1117
|
+
*
|
|
1118
|
+
* When `filterJson` is `undefined`/`null` (Lifetime path), returns a fresh envelope with
|
|
1119
|
+
* `setA.json.expressions = [rtExpression]` and `hasFilters: true`.
|
|
1120
|
+
*
|
|
1121
|
+
* @param filterJson - Existing filterJson string from a `buildXxxFilterJson` helper, or undefined
|
|
1122
|
+
* @param rtId - The RecordType Salesforce ID
|
|
1123
|
+
* @param objectName - The Salesforce object API name
|
|
1124
|
+
* @param objectLabel - The Salesforce object label (defaults to objectName)
|
|
1125
|
+
* @returns Updated filterJson string carrying the RT scope on every existing filter side
|
|
1126
|
+
*/
|
|
1127
|
+
export function composeRecordTypeFilter(filterJson, rtId, objectName = '', objectLabel) {
|
|
1128
|
+
const rtExpression = buildRecordTypeFilterExpression(rtId, objectName, objectLabel);
|
|
1129
|
+
const rtExpressionText = `RecordTypeId = '${rtId}'`;
|
|
1130
|
+
if (!filterJson) {
|
|
1131
|
+
return JSON.stringify({
|
|
1132
|
+
hasFilters: true,
|
|
1133
|
+
setA: {
|
|
1134
|
+
json: {
|
|
1135
|
+
expressions: [rtExpression],
|
|
1136
|
+
logicType: 'AND',
|
|
1137
|
+
},
|
|
1138
|
+
expression: rtExpressionText,
|
|
1139
|
+
},
|
|
1140
|
+
});
|
|
1141
|
+
}
|
|
1142
|
+
const parsed = JSON.parse(filterJson);
|
|
1143
|
+
const append = (set) => {
|
|
1144
|
+
if (!set)
|
|
1145
|
+
return undefined;
|
|
1146
|
+
const updatedExpressions = [...set.json.expressions, rtExpression];
|
|
1147
|
+
const composedExpression = set.expression ? `${set.expression} AND ${rtExpressionText}` : rtExpressionText;
|
|
1148
|
+
return {
|
|
1149
|
+
...set,
|
|
1150
|
+
json: {
|
|
1151
|
+
...set.json,
|
|
1152
|
+
expressions: updatedExpressions,
|
|
1153
|
+
logicType: set.json.logicType ?? 'AND',
|
|
1154
|
+
},
|
|
1155
|
+
expression: composedExpression,
|
|
1156
|
+
};
|
|
1157
|
+
};
|
|
1158
|
+
return JSON.stringify({
|
|
1159
|
+
hasFilters: true,
|
|
1160
|
+
...(parsed.setA ? { setA: append(parsed.setA) } : {}),
|
|
1161
|
+
...(parsed.setB ? { setB: append(parsed.setB) } : {}),
|
|
1162
|
+
});
|
|
1163
|
+
}
|
|
1164
|
+
//# sourceMappingURL=date-literal.js.map
|