@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,141 @@
|
|
|
1
|
+
import type { IConnectionFacade, QueryResult } from '../connection-facade.js';
|
|
2
|
+
import type { ServiceResult } from '../../models/service-result.js';
|
|
3
|
+
import type { RetryConfig } from '../retry.js';
|
|
4
|
+
import type { ChunkOptions } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Configuration for SoqlQueryAdapter.
|
|
7
|
+
*/
|
|
8
|
+
export type SoqlQueryAdapterConfig = {
|
|
9
|
+
/** Optional logger for debug output */
|
|
10
|
+
logger?: Console;
|
|
11
|
+
/**
|
|
12
|
+
* Whether to emit @salesforce/core Lifecycle events for telemetry.
|
|
13
|
+
* When enabled, emits events like 'adapter:query:start', 'adapter:query:complete'.
|
|
14
|
+
* Default: false
|
|
15
|
+
*/
|
|
16
|
+
emitLifecycleEvents?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Retry configuration for transient failures.
|
|
19
|
+
* If not specified, retries are disabled.
|
|
20
|
+
*/
|
|
21
|
+
retry?: RetryConfig;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Interface for SOQL query operations.
|
|
25
|
+
*
|
|
26
|
+
* Provides methods for executing SOQL queries with pagination
|
|
27
|
+
* and chunking support.
|
|
28
|
+
*/
|
|
29
|
+
export type ISoqlQueryAdapter = {
|
|
30
|
+
/**
|
|
31
|
+
* Executes a SOQL query and returns the first page of results.
|
|
32
|
+
*
|
|
33
|
+
* @template T The type of records being queried
|
|
34
|
+
* @param soql - The SOQL query string
|
|
35
|
+
* @returns ServiceResult containing query results
|
|
36
|
+
*/
|
|
37
|
+
query<T>(soql: string): Promise<ServiceResult<QueryResult<T>>>;
|
|
38
|
+
/**
|
|
39
|
+
* Executes a SOQL query and retrieves all results, handling pagination automatically.
|
|
40
|
+
*
|
|
41
|
+
* @template T The type of records being queried
|
|
42
|
+
* @param soql - The SOQL query string
|
|
43
|
+
* @returns ServiceResult containing all query results
|
|
44
|
+
*/
|
|
45
|
+
queryAll<T>(soql: string): Promise<ServiceResult<QueryResult<T>>>;
|
|
46
|
+
/**
|
|
47
|
+
* Executes a SOQL query and processes results in chunks.
|
|
48
|
+
*
|
|
49
|
+
* @template T The type of records being queried
|
|
50
|
+
* @param soql - The SOQL query string
|
|
51
|
+
* @param options - Chunking options including chunk size and callback
|
|
52
|
+
* @returns ServiceResult containing all query results
|
|
53
|
+
*/
|
|
54
|
+
queryChunked<T>(soql: string, options?: ChunkOptions<T>): Promise<ServiceResult<QueryResult<T>>>;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Adapter for executing SOQL queries against Salesforce.
|
|
58
|
+
*
|
|
59
|
+
* Provides pagination handling and chunked processing for efficient
|
|
60
|
+
* retrieval of large datasets.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* const adapter = new SoqlQueryAdapter(connectionFacade);
|
|
65
|
+
*
|
|
66
|
+
* // Simple query
|
|
67
|
+
* const result = await adapter.query<Account>('SELECT Id, Name FROM Account LIMIT 10');
|
|
68
|
+
*
|
|
69
|
+
* // Query all records with pagination
|
|
70
|
+
* const allAccounts = await adapter.queryAll<Account>('SELECT Id, Name FROM Account');
|
|
71
|
+
*
|
|
72
|
+
* // Process in chunks
|
|
73
|
+
* await adapter.queryChunked<Account>('SELECT Id, Name FROM Account', {
|
|
74
|
+
* chunkSize: 1000,
|
|
75
|
+
* onChunk: (records, index) => console.log(`Processing chunk ${index}`),
|
|
76
|
+
* });
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
export declare class SoqlQueryAdapter implements ISoqlQueryAdapter {
|
|
80
|
+
private readonly connection;
|
|
81
|
+
private readonly logger?;
|
|
82
|
+
private readonly lifecycle;
|
|
83
|
+
private readonly retryConfig?;
|
|
84
|
+
/**
|
|
85
|
+
* Creates a new SoqlQueryAdapter.
|
|
86
|
+
*
|
|
87
|
+
* @param connection - The connection facade to use for API calls
|
|
88
|
+
* @param config - Optional configuration
|
|
89
|
+
*/
|
|
90
|
+
constructor(connection: IConnectionFacade, config?: SoqlQueryAdapterConfig);
|
|
91
|
+
/**
|
|
92
|
+
* Executes a SOQL query and returns the first page of results.
|
|
93
|
+
*
|
|
94
|
+
* @template T The type of records being queried
|
|
95
|
+
* @param soql - The SOQL query string
|
|
96
|
+
* @returns ServiceResult containing query results
|
|
97
|
+
*/
|
|
98
|
+
query<T>(soql: string): Promise<ServiceResult<QueryResult<T>>>;
|
|
99
|
+
/**
|
|
100
|
+
* Executes a SOQL query and retrieves all results, handling pagination automatically.
|
|
101
|
+
*
|
|
102
|
+
* Uses an async generator internally for memory efficiency when dealing
|
|
103
|
+
* with large result sets.
|
|
104
|
+
*
|
|
105
|
+
* @template T The type of records being queried
|
|
106
|
+
* @param soql - The SOQL query string
|
|
107
|
+
* @returns ServiceResult containing all query results
|
|
108
|
+
*/
|
|
109
|
+
queryAll<T>(soql: string): Promise<ServiceResult<QueryResult<T>>>;
|
|
110
|
+
/**
|
|
111
|
+
* Executes a SOQL query and processes results in chunks.
|
|
112
|
+
*
|
|
113
|
+
* @template T The type of records being queried
|
|
114
|
+
* @param soql - The SOQL query string
|
|
115
|
+
* @param options - Chunking options
|
|
116
|
+
* @returns ServiceResult containing all query results
|
|
117
|
+
*/
|
|
118
|
+
queryChunked<T>(soql: string, options?: ChunkOptions<T>): Promise<ServiceResult<QueryResult<T>>>;
|
|
119
|
+
/**
|
|
120
|
+
* Async generator that fetches all pages of a query result.
|
|
121
|
+
*
|
|
122
|
+
* Uses retry logic for both initial query and pagination calls to handle
|
|
123
|
+
* transient failures during large result set retrieval.
|
|
124
|
+
*
|
|
125
|
+
* @template T The type of records being queried
|
|
126
|
+
* @param soql - The SOQL query string
|
|
127
|
+
* @yields Each page of query results
|
|
128
|
+
*/
|
|
129
|
+
private fetchAllPages;
|
|
130
|
+
/**
|
|
131
|
+
* Handles query errors and maps them to appropriate error codes.
|
|
132
|
+
*
|
|
133
|
+
* Accepts SfError, jsforce errors, or unknown error types. Extracts Salesforce
|
|
134
|
+
* error codes when available and maps them to adapter-specific error codes.
|
|
135
|
+
*
|
|
136
|
+
* @param error - The caught error (SfError, jsforce error, or unknown)
|
|
137
|
+
* @param startTime - The query start time for duration calculation
|
|
138
|
+
* @returns ServiceResult with success=false, empty QueryResult, and mapped error code
|
|
139
|
+
*/
|
|
140
|
+
private handleQueryError;
|
|
141
|
+
}
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026, PeerNova, Inc. All Rights Reserved.
|
|
3
|
+
* PROPRIETARY AND CONFIDENTIAL. Unauthorized copying, modification,
|
|
4
|
+
* or distribution is strictly prohibited. Use is governed by the
|
|
5
|
+
* Master Subscription Agreement (MSA) between PeerNova, Inc. and the
|
|
6
|
+
* licensee. See LICENSE file in the repo root.
|
|
7
|
+
*/
|
|
8
|
+
import { createSuccessResult, createFailureResult } from '../../models/service-result.js';
|
|
9
|
+
import { AdapterErrorCodes, mapSalesforceError, extractSalesforceErrorCode } from '../errors.js';
|
|
10
|
+
import { createLifecycleEmitter } from '../lifecycle.js';
|
|
11
|
+
import { withRetry } from '../retry.js';
|
|
12
|
+
import { warnApiVersion } from '../types.js';
|
|
13
|
+
import { DEFAULT_CHUNK_SIZE } from './types.js';
|
|
14
|
+
/**
|
|
15
|
+
* Adapter for executing SOQL queries against Salesforce.
|
|
16
|
+
*
|
|
17
|
+
* Provides pagination handling and chunked processing for efficient
|
|
18
|
+
* retrieval of large datasets.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const adapter = new SoqlQueryAdapter(connectionFacade);
|
|
23
|
+
*
|
|
24
|
+
* // Simple query
|
|
25
|
+
* const result = await adapter.query<Account>('SELECT Id, Name FROM Account LIMIT 10');
|
|
26
|
+
*
|
|
27
|
+
* // Query all records with pagination
|
|
28
|
+
* const allAccounts = await adapter.queryAll<Account>('SELECT Id, Name FROM Account');
|
|
29
|
+
*
|
|
30
|
+
* // Process in chunks
|
|
31
|
+
* await adapter.queryChunked<Account>('SELECT Id, Name FROM Account', {
|
|
32
|
+
* chunkSize: 1000,
|
|
33
|
+
* onChunk: (records, index) => console.log(`Processing chunk ${index}`),
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export class SoqlQueryAdapter {
|
|
38
|
+
connection;
|
|
39
|
+
logger;
|
|
40
|
+
lifecycle;
|
|
41
|
+
retryConfig;
|
|
42
|
+
/**
|
|
43
|
+
* Creates a new SoqlQueryAdapter.
|
|
44
|
+
*
|
|
45
|
+
* @param connection - The connection facade to use for API calls
|
|
46
|
+
* @param config - Optional configuration
|
|
47
|
+
*/
|
|
48
|
+
constructor(connection, config) {
|
|
49
|
+
this.connection = connection;
|
|
50
|
+
this.logger = config?.logger;
|
|
51
|
+
this.lifecycle = createLifecycleEmitter('query', config?.emitLifecycleEvents ?? false);
|
|
52
|
+
this.retryConfig = config?.retry;
|
|
53
|
+
// Warn if API version is below recommended minimum
|
|
54
|
+
warnApiVersion(connection.version, 'SoqlQueryAdapter', this.logger);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Executes a SOQL query and returns the first page of results.
|
|
58
|
+
*
|
|
59
|
+
* @template T The type of records being queried
|
|
60
|
+
* @param soql - The SOQL query string
|
|
61
|
+
* @returns ServiceResult containing query results
|
|
62
|
+
*/
|
|
63
|
+
async query(soql) {
|
|
64
|
+
const startTime = Date.now();
|
|
65
|
+
try {
|
|
66
|
+
this.logger?.log(`Executing SOQL query: ${soql.substring(0, 100)}...`);
|
|
67
|
+
await this.lifecycle.start('query', { soqlLength: soql.length });
|
|
68
|
+
const executeQuery = () => this.connection.query(soql);
|
|
69
|
+
const result = this.retryConfig ? await withRetry(executeQuery, this.retryConfig) : await executeQuery();
|
|
70
|
+
const duration = Date.now() - startTime;
|
|
71
|
+
this.logger?.log(`Query returned ${result.records.length} of ${result.totalSize} records`);
|
|
72
|
+
await this.lifecycle.complete('query', startTime, { recordCount: result.records.length });
|
|
73
|
+
return createSuccessResult(result, {
|
|
74
|
+
message: `Query returned ${result.records.length} records`,
|
|
75
|
+
metadata: { duration },
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
80
|
+
await this.lifecycle.error('query', startTime, errorMessage);
|
|
81
|
+
return this.handleQueryError(error, startTime);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Executes a SOQL query and retrieves all results, handling pagination automatically.
|
|
86
|
+
*
|
|
87
|
+
* Uses an async generator internally for memory efficiency when dealing
|
|
88
|
+
* with large result sets.
|
|
89
|
+
*
|
|
90
|
+
* @template T The type of records being queried
|
|
91
|
+
* @param soql - The SOQL query string
|
|
92
|
+
* @returns ServiceResult containing all query results
|
|
93
|
+
*/
|
|
94
|
+
async queryAll(soql) {
|
|
95
|
+
const startTime = Date.now();
|
|
96
|
+
try {
|
|
97
|
+
this.logger?.log(`Executing queryAll: ${soql.substring(0, 100)}...`);
|
|
98
|
+
await this.lifecycle.start('queryAll', { soqlLength: soql.length });
|
|
99
|
+
const allRecords = [];
|
|
100
|
+
let totalSize = 0;
|
|
101
|
+
// Use the async generator to fetch all pages
|
|
102
|
+
// eslint-disable-next-line no-await-in-loop -- Intentional: async generator requires sequential iteration
|
|
103
|
+
for await (const page of this.fetchAllPages(soql)) {
|
|
104
|
+
allRecords.push(...page.records);
|
|
105
|
+
totalSize = page.totalSize;
|
|
106
|
+
}
|
|
107
|
+
const duration = Date.now() - startTime;
|
|
108
|
+
this.logger?.log(`QueryAll retrieved ${allRecords.length} total records`);
|
|
109
|
+
await this.lifecycle.complete('queryAll', startTime, { recordCount: allRecords.length });
|
|
110
|
+
const result = {
|
|
111
|
+
done: true,
|
|
112
|
+
totalSize,
|
|
113
|
+
records: allRecords,
|
|
114
|
+
};
|
|
115
|
+
return createSuccessResult(result, {
|
|
116
|
+
message: `Retrieved all ${allRecords.length} records`,
|
|
117
|
+
metadata: { duration },
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
122
|
+
await this.lifecycle.error('queryAll', startTime, errorMessage);
|
|
123
|
+
return this.handleQueryError(error, startTime);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Executes a SOQL query and processes results in chunks.
|
|
128
|
+
*
|
|
129
|
+
* @template T The type of records being queried
|
|
130
|
+
* @param soql - The SOQL query string
|
|
131
|
+
* @param options - Chunking options
|
|
132
|
+
* @returns ServiceResult containing all query results
|
|
133
|
+
*/
|
|
134
|
+
async queryChunked(soql, options) {
|
|
135
|
+
const startTime = Date.now();
|
|
136
|
+
const chunkSize = options?.chunkSize ?? DEFAULT_CHUNK_SIZE;
|
|
137
|
+
const maxRecords = options?.maxRecords;
|
|
138
|
+
try {
|
|
139
|
+
this.logger?.log(`Executing queryChunked with chunkSize=${chunkSize}: ${soql.substring(0, 100)}...`);
|
|
140
|
+
await this.lifecycle.start('queryChunked', { soqlLength: soql.length, chunkSize });
|
|
141
|
+
const allRecords = [];
|
|
142
|
+
let totalSize = 0;
|
|
143
|
+
let chunkIndex = 0;
|
|
144
|
+
let currentChunk = [];
|
|
145
|
+
// Use the async generator to fetch all pages
|
|
146
|
+
// eslint-disable-next-line no-await-in-loop -- Intentional: async generator requires sequential iteration
|
|
147
|
+
for await (const page of this.fetchAllPages(soql)) {
|
|
148
|
+
totalSize = page.totalSize;
|
|
149
|
+
for (const record of page.records) {
|
|
150
|
+
// Check if we've hit maxRecords
|
|
151
|
+
if (maxRecords !== undefined && allRecords.length >= maxRecords) {
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
currentChunk.push(record);
|
|
155
|
+
allRecords.push(record);
|
|
156
|
+
// Process chunk when it reaches chunkSize
|
|
157
|
+
if (currentChunk.length >= chunkSize) {
|
|
158
|
+
if (options?.onChunk) {
|
|
159
|
+
// eslint-disable-next-line no-await-in-loop -- Intentional: chunks must be processed sequentially
|
|
160
|
+
await options.onChunk(currentChunk, chunkIndex);
|
|
161
|
+
}
|
|
162
|
+
chunkIndex++;
|
|
163
|
+
currentChunk = [];
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
// Check if we've hit maxRecords
|
|
167
|
+
if (maxRecords !== undefined && allRecords.length >= maxRecords) {
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
// Process any remaining records in the final chunk
|
|
172
|
+
if (currentChunk.length > 0 && options?.onChunk) {
|
|
173
|
+
await options.onChunk(currentChunk, chunkIndex);
|
|
174
|
+
}
|
|
175
|
+
const duration = Date.now() - startTime;
|
|
176
|
+
const chunksProcessed = chunkIndex + (currentChunk.length > 0 ? 1 : 0);
|
|
177
|
+
this.logger?.log(`QueryChunked processed ${allRecords.length} records in ${chunksProcessed} chunks`);
|
|
178
|
+
await this.lifecycle.complete('queryChunked', startTime, {
|
|
179
|
+
recordCount: allRecords.length,
|
|
180
|
+
chunksProcessed,
|
|
181
|
+
});
|
|
182
|
+
const result = {
|
|
183
|
+
done: true,
|
|
184
|
+
totalSize,
|
|
185
|
+
records: allRecords,
|
|
186
|
+
};
|
|
187
|
+
return createSuccessResult(result, {
|
|
188
|
+
message: `Processed ${allRecords.length} records in chunks`,
|
|
189
|
+
metadata: {
|
|
190
|
+
duration,
|
|
191
|
+
chunksProcessed,
|
|
192
|
+
},
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
catch (error) {
|
|
196
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
197
|
+
await this.lifecycle.error('queryChunked', startTime, errorMessage);
|
|
198
|
+
return this.handleQueryError(error, startTime);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Async generator that fetches all pages of a query result.
|
|
203
|
+
*
|
|
204
|
+
* Uses retry logic for both initial query and pagination calls to handle
|
|
205
|
+
* transient failures during large result set retrieval.
|
|
206
|
+
*
|
|
207
|
+
* @template T The type of records being queried
|
|
208
|
+
* @param soql - The SOQL query string
|
|
209
|
+
* @yields Each page of query results
|
|
210
|
+
*/
|
|
211
|
+
async *fetchAllPages(soql) {
|
|
212
|
+
// Initial query with retry
|
|
213
|
+
const executeInitialQuery = () => this.connection.query(soql);
|
|
214
|
+
let result = this.retryConfig
|
|
215
|
+
? await withRetry(executeInitialQuery, this.retryConfig)
|
|
216
|
+
: await executeInitialQuery();
|
|
217
|
+
yield result;
|
|
218
|
+
/* eslint-disable no-await-in-loop -- Intentional: pagination requires sequential API calls */
|
|
219
|
+
while (!result.done && result.nextRecordsUrl) {
|
|
220
|
+
// Capture locator for closure
|
|
221
|
+
const locator = result.nextRecordsUrl;
|
|
222
|
+
const executeQueryMore = () => this.connection.queryMore(locator);
|
|
223
|
+
result = this.retryConfig ? await withRetry(executeQueryMore, this.retryConfig) : await executeQueryMore();
|
|
224
|
+
yield result;
|
|
225
|
+
}
|
|
226
|
+
/* eslint-enable no-await-in-loop */
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Handles query errors and maps them to appropriate error codes.
|
|
230
|
+
*
|
|
231
|
+
* Accepts SfError, jsforce errors, or unknown error types. Extracts Salesforce
|
|
232
|
+
* error codes when available and maps them to adapter-specific error codes.
|
|
233
|
+
*
|
|
234
|
+
* @param error - The caught error (SfError, jsforce error, or unknown)
|
|
235
|
+
* @param startTime - The query start time for duration calculation
|
|
236
|
+
* @returns ServiceResult with success=false, empty QueryResult, and mapped error code
|
|
237
|
+
*/
|
|
238
|
+
handleQueryError(error, startTime) {
|
|
239
|
+
const duration = Date.now() - startTime;
|
|
240
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
241
|
+
// Extract Salesforce error code if present
|
|
242
|
+
const sfErrorCode = extractSalesforceErrorCode(error);
|
|
243
|
+
const adapterErrorCode = sfErrorCode ? mapSalesforceError(sfErrorCode, 'soql') : AdapterErrorCodes.QUERY_FAILED;
|
|
244
|
+
this.logger?.log(`Query failed: ${errorMessage}`);
|
|
245
|
+
// Create empty QueryResult - type-safe since T is the record type
|
|
246
|
+
const emptyResult = {
|
|
247
|
+
done: true,
|
|
248
|
+
totalSize: 0,
|
|
249
|
+
records: [],
|
|
250
|
+
};
|
|
251
|
+
return createFailureResult(emptyResult, adapterErrorCode, errorMessage, {
|
|
252
|
+
metadata: {
|
|
253
|
+
duration,
|
|
254
|
+
sfErrorCode,
|
|
255
|
+
},
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
//# sourceMappingURL=soql-query-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"soql-query-adapter.js","sourceRoot":"","sources":["../../../src/adapters/soql/soql-query-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAC1F,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AACjG,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAyDhD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAO,gBAAgB;IACV,UAAU,CAAoB;IAC9B,MAAM,CAAW;IACjB,SAAS,CAA4C;IACrD,WAAW,CAAe;IAE3C;;;;;OAKG;IACH,YAAmB,UAA6B,EAAE,MAA+B;QAC/E,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,mBAAmB,IAAI,KAAK,CAAC,CAAC;QACvF,IAAI,CAAC,WAAW,GAAG,MAAM,EAAE,KAAK,CAAC;QAEjC,mDAAmD;QACnD,cAAc,CAAC,UAAU,CAAC,OAAO,EAAE,kBAAkB,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACtE,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,KAAK,CAAI,IAAY;QAChC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAE7B,I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processing.
|
|
4
|
+
*
|
|
5
|
+
* @template T The type of records being queried
|
|
6
|
+
*/
|
|
7
|
+
export type ChunkOptions<T> = {
|
|
8
|
+
/**
|
|
9
|
+
* Number of records per chunk.
|
|
10
|
+
* Defaults to 2000.
|
|
11
|
+
*/
|
|
12
|
+
chunkSize?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Callback invoked for each chunk of records.
|
|
15
|
+
* Can be async for processing operations.
|
|
16
|
+
*
|
|
17
|
+
* @param records - The records in this chunk
|
|
18
|
+
* @param chunkIndex - Zero-based index of this chunk
|
|
19
|
+
*/
|
|
20
|
+
onChunk?: (records: T[], chunkIndex: number) => void | Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Maximum total records to retrieve.
|
|
23
|
+
* If not specified, retrieves all matching records.
|
|
24
|
+
*/
|
|
25
|
+
maxRecords?: number;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Default chunk size for queryChunked operations.
|
|
29
|
+
*
|
|
30
|
+
* The value of 2000 is chosen to balance:
|
|
31
|
+
* - Memory efficiency: Small enough to process without excessive memory use
|
|
32
|
+
* - Performance: Large enough to minimize callback overhead
|
|
33
|
+
* - Salesforce alignment: Within typical Salesforce API batch limits
|
|
34
|
+
*
|
|
35
|
+
* Override via `chunkSize` option in queryChunked() for different use cases.
|
|
36
|
+
*/
|
|
37
|
+
export declare const DEFAULT_CHUNK_SIZE = 2000;
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
* Default chunk size for queryChunked operations.
|
|
10
|
+
*
|
|
11
|
+
* The value of 2000 is chosen to balance:
|
|
12
|
+
* - Memory efficiency: Small enough to process without excessive memory use
|
|
13
|
+
* - Performance: Large enough to minimize callback overhead
|
|
14
|
+
* - Salesforce alignment: Within typical Salesforce API batch limits
|
|
15
|
+
*
|
|
16
|
+
* Override via `chunkSize` option in queryChunked() for different use cases.
|
|
17
|
+
*/
|
|
18
|
+
export const DEFAULT_CHUNK_SIZE = 2000;
|
|
19
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/adapters/soql/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAiCH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test utilities for Salesforce API adapters.
|
|
3
|
+
*
|
|
4
|
+
* This module provides mock factories for all adapters, enabling isolated
|
|
5
|
+
* unit testing without making real Salesforce API calls.
|
|
6
|
+
*
|
|
7
|
+
* @module adapters/testing
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { createMockConnection, createMockSoqlQueryAdapter } from './adapters/testing';
|
|
12
|
+
*
|
|
13
|
+
* // Using mock connection with real adapter
|
|
14
|
+
* const { connection } = createMockConnection();
|
|
15
|
+
* const adapter = new SoqlQueryAdapter(connection);
|
|
16
|
+
*
|
|
17
|
+
* // Using mock adapter directly
|
|
18
|
+
* const { adapter: mockAdapter, calls } = createMockSoqlQueryAdapter();
|
|
19
|
+
* myService.setAdapter(mockAdapter);
|
|
20
|
+
*
|
|
21
|
+
* // After test, verify calls
|
|
22
|
+
* expect(calls).to.have.lengthOf(1);
|
|
23
|
+
* expect(calls[0].method).to.equal('query');
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export type { CallRecord, MockAdapterConfig, MockAdapter, MockConnectionConfig } from './types.js';
|
|
27
|
+
export { createMockConnection, type MockConnectionFacade } from './mock-connection.js';
|
|
28
|
+
export { createMockSoqlQueryAdapter } from './mock-soql-adapter.js';
|
|
29
|
+
export { createMockRestApiAdapter } from './mock-rest-adapter.js';
|
|
30
|
+
export { createMockToolingApiAdapter } from './mock-tooling-adapter.js';
|
|
31
|
+
export { createMockLogger, type MockLogger } from './mock-logger.js';
|
|
32
|
+
export { createStubConnection, type StubConnection, type StubTooling } from './stub-connection.js';
|
|
33
|
+
export { createStubSoqlAdapter, type StubSoqlAdapter } from './stub-soql-adapter.js';
|
|
34
|
+
export { createStubRestAdapter, type StubRestAdapter } from './stub-rest-adapter.js';
|
|
35
|
+
export { createMockSalesforceConnection, type MockSalesforceConnectionConfig } from './mock-salesforce-connection.js';
|
|
36
|
+
export { createMockAdapters, type MockMcpAdaptersConfig } from './mock-mcp-adapters.js';
|
|
37
|
+
export { createMockOclifConfig } from './mock-oclif-config.js';
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
// Mock factories
|
|
9
|
+
export { createMockConnection } from './mock-connection.js';
|
|
10
|
+
export { createMockSoqlQueryAdapter } from './mock-soql-adapter.js';
|
|
11
|
+
export { createMockRestApiAdapter } from './mock-rest-adapter.js';
|
|
12
|
+
export { createMockToolingApiAdapter } from './mock-tooling-adapter.js';
|
|
13
|
+
export { createMockLogger } from './mock-logger.js';
|
|
14
|
+
export { createStubConnection } from './stub-connection.js';
|
|
15
|
+
export { createStubSoqlAdapter } from './stub-soql-adapter.js';
|
|
16
|
+
export { createStubRestAdapter } from './stub-rest-adapter.js';
|
|
17
|
+
export { createMockSalesforceConnection } from './mock-salesforce-connection.js';
|
|
18
|
+
export { createMockAdapters } from './mock-mcp-adapters.js';
|
|
19
|
+
export { createMockOclifConfig } from './mock-oclif-config.js';
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA+BH,iBAAiB;AACjB,OAAO,EAAE,oBAAoB,EAA6B,MAAM,sBAAsB,CAAC;AACvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAmB,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAyC,MAAM,sBAAsB,CAAC;AACnG,OAAO,EAAE,qBAAqB,EAAwB,MAAM,wBAAwB,CAAC;AACrF,OAAO,EAAE,qBAAqB,EAAwB,MAAM,wBAAwB,CAAC;AACrF,OAAO,EAAE,8BAA8B,EAAuC,MAAM,iCAAiC,CAAC;AACtH,OAAO,EAAE,kBAAkB,EAA8B,MAAM,wBAAwB,CAAC;AACxF,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { IConnectionFacade, DescribeSObjectResult, ExecuteAnonymousResult } from '../connection-facade.js';
|
|
2
|
+
import type { CallRecord, MockConnectionConfig } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Mock connection facade with call recording.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* const { connection, calls, setQueryResult, setError } = createMockConnection();
|
|
9
|
+
*
|
|
10
|
+
* // Configure response
|
|
11
|
+
* setQueryResult('SELECT Id FROM Account', {
|
|
12
|
+
* done: true,
|
|
13
|
+
* totalSize: 1,
|
|
14
|
+
* records: [{ Id: '001xx000001ABC' }]
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* // Use in adapter
|
|
18
|
+
* const adapter = new SoqlQueryAdapter(connection);
|
|
19
|
+
* const result = await adapter.query('SELECT Id FROM Account');
|
|
20
|
+
*
|
|
21
|
+
* // Assert calls were made
|
|
22
|
+
* expect(calls).to.have.lengthOf(1);
|
|
23
|
+
* expect(calls[0].method).to.equal('query');
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export type MockConnectionFacade = {
|
|
27
|
+
/** The mock connection instance */
|
|
28
|
+
connection: IConnectionFacade;
|
|
29
|
+
/** Recorded method calls */
|
|
30
|
+
calls: CallRecord[];
|
|
31
|
+
/** Reset call history */
|
|
32
|
+
resetCalls(): void;
|
|
33
|
+
/** Set a query result for a specific SOQL query */
|
|
34
|
+
setQueryResult(soql: string, result: unknown): void;
|
|
35
|
+
/** Set a describe result for a specific object */
|
|
36
|
+
setDescribeResult(objectName: string, result: DescribeSObjectResult): void;
|
|
37
|
+
/** Set an error for a specific method call (returns error via checkError) */
|
|
38
|
+
setError(method: string, key: string, error: Error): void;
|
|
39
|
+
/** Set the identity result */
|
|
40
|
+
setIdentity(identity: {
|
|
41
|
+
user_id: string;
|
|
42
|
+
organization_id: string;
|
|
43
|
+
username: string;
|
|
44
|
+
}): void;
|
|
45
|
+
/** Set an execute anonymous result */
|
|
46
|
+
setExecuteAnonymousResult(apex: string, result: ExecuteAnonymousResult): void;
|
|
47
|
+
/** Set a request result for a specific URL */
|
|
48
|
+
setRequestResult(url: string, result: unknown): void;
|
|
49
|
+
/**
|
|
50
|
+
* Set an exception to throw for a specific method/key combination.
|
|
51
|
+
* Unlike setError (which throws via checkError internally), setThrow allows
|
|
52
|
+
* testing of code that catches exceptions at a higher level.
|
|
53
|
+
*/
|
|
54
|
+
setThrow(method: string, key: string, error: Error): void;
|
|
55
|
+
/** Clear a previously configured exception */
|
|
56
|
+
clearThrow(method: string, key: string): void;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Creates a mock connection facade for testing adapters.
|
|
60
|
+
*
|
|
61
|
+
* @param config - Optional configuration
|
|
62
|
+
* @returns Mock connection facade with call recording
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```typescript
|
|
66
|
+
* // Basic usage
|
|
67
|
+
* const { connection } = createMockConnection();
|
|
68
|
+
* const adapter = new SoqlQueryAdapter(connection);
|
|
69
|
+
*
|
|
70
|
+
* // With configuration
|
|
71
|
+
* const { connection, calls } = createMockConnection({
|
|
72
|
+
* version: '58.0',
|
|
73
|
+
* defaultQueryResult: { done: true, totalSize: 0, records: [] }
|
|
74
|
+
* });
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
export declare function createMockConnection(config?: MockConnectionConfig): MockConnectionFacade;
|