@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,199 @@
|
|
|
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 { ProfilingDefinitionService } from '../../services/ProfilingDefinitionService.js';
|
|
9
|
+
import { ObjectFilteringService } from '../../services/ObjectFilteringService.js';
|
|
10
|
+
import { DefinitionCreateOperation } from '../../operations/DefinitionCreateOperation.js';
|
|
11
|
+
import { DefinitionPurgeOperation } from '../../operations/DefinitionPurgeOperation.js';
|
|
12
|
+
import { McpErrorCodes } from '../errors.js';
|
|
13
|
+
import { serviceResultToMcp, createMcpError, extractErrorMessage } from './tool-factory.js';
|
|
14
|
+
/**
|
|
15
|
+
* Handler for cuneiform_definition_list tool invocation.
|
|
16
|
+
*
|
|
17
|
+
* @param adapters - Session-scoped MCP adapters
|
|
18
|
+
* @param params - Validated input from MCP SDK
|
|
19
|
+
* @returns MCP CallToolResult
|
|
20
|
+
*/
|
|
21
|
+
export async function handleDefinitionList(adapters, params) {
|
|
22
|
+
try {
|
|
23
|
+
const definitionService = new ProfilingDefinitionService({
|
|
24
|
+
soqlAdapter: adapters.soql,
|
|
25
|
+
});
|
|
26
|
+
// Get definitions with filters
|
|
27
|
+
const result = await definitionService.getDefinitions({
|
|
28
|
+
objectName: params.objectName,
|
|
29
|
+
status: params.status,
|
|
30
|
+
isActive: params.isActive,
|
|
31
|
+
limit: params.limit,
|
|
32
|
+
});
|
|
33
|
+
return serviceResultToMcp(result);
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
return createMcpError(McpErrorCodes.TOOL_INVOCATION_FAILED, `Failed to list definitions: ${extractErrorMessage(error, 'handleDefinitionList')}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Handler for cuneiform_definition_get tool invocation.
|
|
41
|
+
*
|
|
42
|
+
* @param adapters - Session-scoped MCP adapters
|
|
43
|
+
* @param params - Validated input from MCP SDK
|
|
44
|
+
* @returns MCP CallToolResult
|
|
45
|
+
*/
|
|
46
|
+
export async function handleDefinitionGet(adapters, params) {
|
|
47
|
+
try {
|
|
48
|
+
const definitionService = new ProfilingDefinitionService({
|
|
49
|
+
soqlAdapter: adapters.soql,
|
|
50
|
+
});
|
|
51
|
+
// Get specific definition
|
|
52
|
+
const result = await definitionService.getDefinitionById(params.definitionId);
|
|
53
|
+
return serviceResultToMcp(result);
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
return createMcpError(McpErrorCodes.TOOL_INVOCATION_FAILED, `Failed to get definition: ${extractErrorMessage(error, 'handleDefinitionGet')}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Handler for cuneiform_definition_get_by_key tool invocation.
|
|
61
|
+
*
|
|
62
|
+
* @param adapters - Session-scoped MCP adapters
|
|
63
|
+
* @param params - Validated input from MCP SDK
|
|
64
|
+
* @returns MCP CallToolResult
|
|
65
|
+
*/
|
|
66
|
+
export async function handleDefinitionGetByKey(adapters, params) {
|
|
67
|
+
try {
|
|
68
|
+
const definitionService = new ProfilingDefinitionService({
|
|
69
|
+
soqlAdapter: adapters.soql,
|
|
70
|
+
});
|
|
71
|
+
// Batch query: single SOQL with WHERE Name IN (...) instead of N separate queries
|
|
72
|
+
const batchResult = await definitionService.getDefinitionsByKeys(params.keys);
|
|
73
|
+
if (!batchResult.success) {
|
|
74
|
+
return createMcpError(McpErrorCodes.TOOL_INVOCATION_FAILED, batchResult.message ?? 'Failed to retrieve definitions');
|
|
75
|
+
}
|
|
76
|
+
// Collect successful definitions and warnings from batch result
|
|
77
|
+
const definitions = [];
|
|
78
|
+
const warnings = [];
|
|
79
|
+
for (const key of params.keys) {
|
|
80
|
+
const definition = batchResult.data.get(key.trim());
|
|
81
|
+
if (definition === null || definition === undefined) {
|
|
82
|
+
warnings.push(`Definition not found: ${key}`);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
definitions.push(definition);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// Return combined result
|
|
89
|
+
return serviceResultToMcp({
|
|
90
|
+
success: true,
|
|
91
|
+
data: {
|
|
92
|
+
definitions,
|
|
93
|
+
definitionsRetrieved: definitions.length,
|
|
94
|
+
warnings: warnings.length > 0 ? warnings : undefined,
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
return createMcpError(McpErrorCodes.TOOL_INVOCATION_FAILED, `Failed to get definitions by key: ${extractErrorMessage(error, 'handleDefinitionGetByKey')}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Handler for cuneiform_definition_create tool invocation.
|
|
104
|
+
*
|
|
105
|
+
* @param adapters - Session-scoped MCP adapters
|
|
106
|
+
* @param params - Validated input from MCP SDK
|
|
107
|
+
* @returns MCP CallToolResult
|
|
108
|
+
*/
|
|
109
|
+
export async function handleDefinitionCreate(adapters, params) {
|
|
110
|
+
try {
|
|
111
|
+
const { soql: soqlAdapter, rest: restAdapter } = adapters;
|
|
112
|
+
const definitionService = new ProfilingDefinitionService({ soqlAdapter, restAdapter });
|
|
113
|
+
const filteringService = new ObjectFilteringService({ restApiAdapter: restAdapter, soqlAdapter });
|
|
114
|
+
// Create operation
|
|
115
|
+
const operation = new DefinitionCreateOperation(definitionService, filteringService);
|
|
116
|
+
// Execute operation
|
|
117
|
+
const result = await operation.execute({
|
|
118
|
+
targetOrg: 'mcp-connection',
|
|
119
|
+
objects: params.objects,
|
|
120
|
+
filter: params.type,
|
|
121
|
+
namespace: params.namespace,
|
|
122
|
+
classification: params.classification,
|
|
123
|
+
withRecords: params.withRecords,
|
|
124
|
+
withoutRecords: params.withoutRecords,
|
|
125
|
+
category: params.category,
|
|
126
|
+
description: params.description,
|
|
127
|
+
dryRun: params.dryRun,
|
|
128
|
+
});
|
|
129
|
+
// Add dry run context to result
|
|
130
|
+
if (params.dryRun && result.success) {
|
|
131
|
+
return serviceResultToMcp({
|
|
132
|
+
success: true,
|
|
133
|
+
data: {
|
|
134
|
+
...result.data,
|
|
135
|
+
dryRun: true,
|
|
136
|
+
message: `[DRY RUN] Would create ${(result.data.total ?? 0) - (result.data.skipped ?? 0)} definitions. Set dryRun=false to execute.`,
|
|
137
|
+
},
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
return serviceResultToMcp(result);
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
return createMcpError(McpErrorCodes.TOOL_INVOCATION_FAILED, `Failed to create definitions: ${extractErrorMessage(error, 'handleDefinitionCreate')}`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Handler for cuneiform_definition_update tool invocation.
|
|
148
|
+
*
|
|
149
|
+
* @param adapters - Session-scoped MCP adapters
|
|
150
|
+
* @param params - Validated input from MCP SDK
|
|
151
|
+
* @returns MCP CallToolResult
|
|
152
|
+
*/
|
|
153
|
+
export async function handleDefinitionUpdate(adapters, params) {
|
|
154
|
+
try {
|
|
155
|
+
const definitionService = new ProfilingDefinitionService({
|
|
156
|
+
soqlAdapter: adapters.soql,
|
|
157
|
+
restAdapter: adapters.rest,
|
|
158
|
+
});
|
|
159
|
+
const { definitionId, name, category, timeCategory, segmentCategory, description } = params;
|
|
160
|
+
const attributes = Object.fromEntries(Object.entries({ name, category, timeCategory, segmentCategory, description }).filter(([, v]) => v !== undefined));
|
|
161
|
+
const result = await definitionService.updateAttributes(definitionId, attributes);
|
|
162
|
+
if (!result.success) {
|
|
163
|
+
return createMcpError(McpErrorCodes.TOOL_INVOCATION_FAILED, result.message ?? 'Failed to update definition');
|
|
164
|
+
}
|
|
165
|
+
return serviceResultToMcp(result);
|
|
166
|
+
}
|
|
167
|
+
catch (error) {
|
|
168
|
+
return createMcpError(McpErrorCodes.TOOL_INVOCATION_FAILED, `Failed to update definition: ${extractErrorMessage(error, 'handleDefinitionUpdate')}`);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Handler for cuneiform_definition_purge tool invocation.
|
|
173
|
+
*
|
|
174
|
+
* @param adapters - Session-scoped MCP adapters
|
|
175
|
+
* @param params - Validated input from MCP SDK
|
|
176
|
+
* @returns MCP CallToolResult
|
|
177
|
+
*/
|
|
178
|
+
export async function handleDefinitionPurge(adapters, params) {
|
|
179
|
+
try {
|
|
180
|
+
const definitionService = new ProfilingDefinitionService({
|
|
181
|
+
soqlAdapter: adapters.soql,
|
|
182
|
+
restAdapter: adapters.rest,
|
|
183
|
+
});
|
|
184
|
+
// Create operation
|
|
185
|
+
const operation = new DefinitionPurgeOperation(definitionService);
|
|
186
|
+
// Execute operation (legacy mapping — MCP schema will be expanded in a future ticket)
|
|
187
|
+
const result = await operation.execute({
|
|
188
|
+
targetOrg: 'mcp-connection',
|
|
189
|
+
objectNames: params.objectName ? [params.objectName] : undefined,
|
|
190
|
+
category: params.category,
|
|
191
|
+
isActive: params.isActive,
|
|
192
|
+
});
|
|
193
|
+
return serviceResultToMcp(result);
|
|
194
|
+
}
|
|
195
|
+
catch (error) {
|
|
196
|
+
return createMcpError(McpErrorCodes.TOOL_INVOCATION_FAILED, `Failed to purge definitions: ${extractErrorMessage(error, 'handleDefinitionPurge')}`);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
//# sourceMappingURL=definition-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition-tools.js","sourceRoot":"","sources":["../../../src/mcp/tools/definition-tools.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AAC1F,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,EAAE,yBAAyB,EAAE,MAAM,+CAA+C,CAAC;AAC1F,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAS7C,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE5F;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,QAA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;IACpC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,cAAc,CACnB,aAAa,CAAC,sBAAsB,EACpC,gCAAgC,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,CAAC,EAAE,CACvF,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,QAAqB,EACrB,MAA4B;IAE5B,IAAI,CAAC;QACH,MAAM,iBAAiB,GAAG,IAAI,0BAA0B,CAAC;YACvD,WAAW,EAAE,QAAQ,CAAC,IAAI;YAC1B,WAAW,EAAE,QAAQ,CAAC,IAAI;SAC3B,CAAC,CAAC;QAEH,mBAAmB;QACnB,MAAM,SAAS,GAAG,IAAI,wBAAwB,CAAC,iBAAiB,CAAC,CAAC;QAElE,sFAAsF;QACtF,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC;YACrC,SAAS,EAAE,gBAAgB;YAC3B,WAAW,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS;YAChE,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;SAC1B,CAAC,CAAC;QAEH,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,cAAc,CACnB,aAAa,CAAC,sBAAsB,EACpC,gCAAgC,mBAAmB,CAAC,KAAK,EAAE,uBAAuB,CAAC,EAAE,CACtF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import type { Connection } from '@salesforce/core';
|
|
3
|
+
import { type McpAdapters } from '../config/mcp-config.js';
|
|
4
|
+
/**
|
|
5
|
+
* Tool handler function type.
|
|
6
|
+
* Accepts session-scoped adapters and pre-validated input.
|
|
7
|
+
*/
|
|
8
|
+
export type ToolHandler = (adapters: McpAdapters, input: unknown) => Promise<CallToolResult>;
|
|
9
|
+
/**
|
|
10
|
+
* Registry of tool handlers mapped by tool name.
|
|
11
|
+
*
|
|
12
|
+
* Derived from the authoritative tool registration in server.ts via getToolRegistrations().
|
|
13
|
+
* Used by invokeTool() for CLI dispatch and by tests for handler verification.
|
|
14
|
+
*/
|
|
15
|
+
export declare const TOOL_HANDLERS: Record<string, ToolHandler>;
|
|
16
|
+
/**
|
|
17
|
+
* Retrieves a tool handler by name.
|
|
18
|
+
*
|
|
19
|
+
* @param toolName - Name of the tool
|
|
20
|
+
* @returns Tool handler function or undefined if not found
|
|
21
|
+
*/
|
|
22
|
+
export declare function getToolHandler(toolName: string): ToolHandler | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Invokes a tool by name with the given input.
|
|
25
|
+
*
|
|
26
|
+
* When debug mode is enabled, logs:
|
|
27
|
+
* - Tool name and input params at start
|
|
28
|
+
* - Result status, timing, and size on completion
|
|
29
|
+
* - Error details on failure
|
|
30
|
+
*
|
|
31
|
+
* @param toolName - Name of the tool to invoke
|
|
32
|
+
* @param connection - Salesforce connection
|
|
33
|
+
* @param input - Tool input parameters
|
|
34
|
+
* @param debug - Enable debug logging (optional)
|
|
35
|
+
* @returns MCP CallToolResult
|
|
36
|
+
*/
|
|
37
|
+
export declare function invokeTool(toolName: string, connection: Connection, input: unknown, debug?: boolean): Promise<CallToolResult>;
|
|
@@ -0,0 +1,88 @@
|
|
|
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 { createMcpAdapters } from '../config/mcp-config.js';
|
|
9
|
+
import { McpErrorCodes } from '../errors.js';
|
|
10
|
+
import { DebugLogger } from '../../debug/debug-logger.js';
|
|
11
|
+
import { getToolRegistrations } from '../server.js';
|
|
12
|
+
import { createMcpError, extractErrorMessage } from './tool-factory.js';
|
|
13
|
+
/**
|
|
14
|
+
* Registry of tool handlers mapped by tool name.
|
|
15
|
+
*
|
|
16
|
+
* Derived from the authoritative tool registration in server.ts via getToolRegistrations().
|
|
17
|
+
* Used by invokeTool() for CLI dispatch and by tests for handler verification.
|
|
18
|
+
*/
|
|
19
|
+
export const TOOL_HANDLERS = Object.fromEntries(getToolRegistrations().map((tool) => [tool.name, tool.handler]));
|
|
20
|
+
/**
|
|
21
|
+
* Retrieves a tool handler by name.
|
|
22
|
+
*
|
|
23
|
+
* @param toolName - Name of the tool
|
|
24
|
+
* @returns Tool handler function or undefined if not found
|
|
25
|
+
*/
|
|
26
|
+
export function getToolHandler(toolName) {
|
|
27
|
+
return TOOL_HANDLERS[toolName];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Invokes a tool by name with the given input.
|
|
31
|
+
*
|
|
32
|
+
* When debug mode is enabled, logs:
|
|
33
|
+
* - Tool name and input params at start
|
|
34
|
+
* - Result status, timing, and size on completion
|
|
35
|
+
* - Error details on failure
|
|
36
|
+
*
|
|
37
|
+
* @param toolName - Name of the tool to invoke
|
|
38
|
+
* @param connection - Salesforce connection
|
|
39
|
+
* @param input - Tool input parameters
|
|
40
|
+
* @param debug - Enable debug logging (optional)
|
|
41
|
+
* @returns MCP CallToolResult
|
|
42
|
+
*/
|
|
43
|
+
export async function invokeTool(toolName, connection, input, debug) {
|
|
44
|
+
// Enable debug logger if requested
|
|
45
|
+
if (debug) {
|
|
46
|
+
DebugLogger.setEnabled(true);
|
|
47
|
+
}
|
|
48
|
+
const handler = getToolHandler(toolName);
|
|
49
|
+
if (!handler) {
|
|
50
|
+
const errorMsg = `Tool '${toolName}' not found`;
|
|
51
|
+
DebugLogger.log('MCP', toolName, 'error', errorMsg);
|
|
52
|
+
return createMcpError(McpErrorCodes.TOOL_NOT_FOUND, errorMsg);
|
|
53
|
+
}
|
|
54
|
+
// Log params at start (only when debug is enabled)
|
|
55
|
+
if (debug) {
|
|
56
|
+
DebugLogger.log('MCP', toolName, 'params', JSON.stringify(input));
|
|
57
|
+
}
|
|
58
|
+
// Construct per-call adapters for the CLI path (no session caching).
|
|
59
|
+
// MCP server path uses createMcpServer() which constructs adapters once.
|
|
60
|
+
const adapters = createMcpAdapters(connection);
|
|
61
|
+
const start = Date.now();
|
|
62
|
+
try {
|
|
63
|
+
const result = await handler(adapters, input);
|
|
64
|
+
const duration = Date.now() - start;
|
|
65
|
+
const success = !result.isError;
|
|
66
|
+
if (debug) {
|
|
67
|
+
try {
|
|
68
|
+
const resultStr = JSON.stringify(result);
|
|
69
|
+
const sizeBytes = new TextEncoder().encode(resultStr).length;
|
|
70
|
+
DebugLogger.logResult('MCP', toolName, success, duration, sizeBytes);
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
// Result not serializable (e.g., circular refs) — log without size
|
|
74
|
+
DebugLogger.logResult('MCP', toolName, success, duration);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
DebugLogger.logResult('MCP', toolName, success, duration);
|
|
79
|
+
}
|
|
80
|
+
return result;
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
const errorMessage = extractErrorMessage(error, `invokeTool:${toolName}`);
|
|
84
|
+
DebugLogger.log('MCP', toolName, 'error', errorMessage);
|
|
85
|
+
return createMcpError(McpErrorCodes.TOOL_INVOCATION_FAILED, errorMessage);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/mcp/tools/index.ts"],"names":[],"mappings":"AAA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QAExD,OAAO,cAAc,CAAC,aAAa,CAAC,sBAAsB,EAAE,YAAY,CAAC,CAAC;IAC5E,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import type { McpAdapters } from '../config/mcp-config.js';
|
|
3
|
+
import { type ObjectListInput, type ObjectDescribeInput } from '../schemas/input-schemas.js';
|
|
4
|
+
/**
|
|
5
|
+
* Handler for cuneiform_object_list tool invocation.
|
|
6
|
+
*
|
|
7
|
+
* @param adapters - Session-scoped MCP adapters
|
|
8
|
+
* @param params - Validated input from MCP SDK
|
|
9
|
+
* @returns MCP CallToolResult
|
|
10
|
+
*/
|
|
11
|
+
export declare function handleObjectList(adapters: McpAdapters, params: ObjectListInput): Promise<CallToolResult>;
|
|
12
|
+
/**
|
|
13
|
+
* Handler for cuneiform_object_describe tool invocation.
|
|
14
|
+
*
|
|
15
|
+
* Routes by section parameter to return one section per call,
|
|
16
|
+
* keeping responses within LLM context budgets (~3 KB max).
|
|
17
|
+
*
|
|
18
|
+
* @param adapters - Session-scoped MCP adapters
|
|
19
|
+
* @param params - Validated input from MCP SDK
|
|
20
|
+
* @returns MCP CallToolResult
|
|
21
|
+
*/
|
|
22
|
+
export declare function handleObjectDescribe(adapters: McpAdapters, params: ObjectDescribeInput): Promise<CallToolResult>;
|
|
@@ -0,0 +1,306 @@
|
|
|
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 { ContactPointService } from '../../services/ContactPointService.js';
|
|
9
|
+
import { ObjectDescribeService } from '../../services/ObjectDescribeService.js';
|
|
10
|
+
import { ObjectFilteringService } from '../../services/ObjectFilteringService.js';
|
|
11
|
+
import { ObjectListService } from '../../services/ObjectListService.js';
|
|
12
|
+
import { RecordTypeService } from '../../services/RecordTypeService.js';
|
|
13
|
+
import { TabDetectionService } from '../../services/TabDetectionService.js';
|
|
14
|
+
import { decodeCursor, clampPageSize, createPaginationMetadata, PAGE_SIZE_DEFAULTS } from '../config/pagination.js';
|
|
15
|
+
import { McpErrorCodes } from '../errors.js';
|
|
16
|
+
import { OBJECT_DESCRIBE_SECTIONS } from '../schemas/input-schemas.js';
|
|
17
|
+
import { serviceResultToMcp, serviceResultToMcpPaginated, createMcpError, extractErrorMessage, } from './tool-factory.js';
|
|
18
|
+
/**
|
|
19
|
+
* Field type mapping from user-friendly categories to Salesforce field types.
|
|
20
|
+
*/
|
|
21
|
+
const FIELD_TYPE_MAP = {
|
|
22
|
+
text: ['string', 'textarea', 'url', 'email', 'phone'],
|
|
23
|
+
picklist: ['picklist', 'multipicklist'],
|
|
24
|
+
lookup: ['reference'],
|
|
25
|
+
number: ['double', 'currency', 'percent', 'int'],
|
|
26
|
+
date: ['date', 'datetime', 'time'],
|
|
27
|
+
formula: ['calculated'],
|
|
28
|
+
checkbox: ['boolean'],
|
|
29
|
+
id: ['id'],
|
|
30
|
+
address: ['address'],
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Handler for cuneiform_object_list tool invocation.
|
|
34
|
+
*
|
|
35
|
+
* @param adapters - Session-scoped MCP adapters
|
|
36
|
+
* @param params - Validated input from MCP SDK
|
|
37
|
+
* @returns MCP CallToolResult
|
|
38
|
+
*/
|
|
39
|
+
export async function handleObjectList(adapters, params) {
|
|
40
|
+
try {
|
|
41
|
+
// Pagination: decode cursor and clamp page size
|
|
42
|
+
const offset = decodeCursor(params.cursor);
|
|
43
|
+
const pageSize = clampPageSize(params.limit, PAGE_SIZE_DEFAULTS.OBJECT_LIST.default, PAGE_SIZE_DEFAULTS.OBJECT_LIST.max);
|
|
44
|
+
const { soql: soqlAdapter, tooling: toolingAdapter, rest: restAdapter } = adapters;
|
|
45
|
+
const filteringService = new ObjectFilteringService({
|
|
46
|
+
restApiAdapter: restAdapter,
|
|
47
|
+
soqlAdapter,
|
|
48
|
+
});
|
|
49
|
+
const tabService = new TabDetectionService({
|
|
50
|
+
toolingAdapter,
|
|
51
|
+
});
|
|
52
|
+
const contactPointService = new ContactPointService({
|
|
53
|
+
restApiAdapter: restAdapter,
|
|
54
|
+
});
|
|
55
|
+
const objectListService = new ObjectListService({
|
|
56
|
+
objectFilteringService: filteringService,
|
|
57
|
+
tabDetectionService: tabService,
|
|
58
|
+
contactPointService,
|
|
59
|
+
});
|
|
60
|
+
// Build filter options with name pattern
|
|
61
|
+
const nameFilter = params.pattern
|
|
62
|
+
? {
|
|
63
|
+
value: params.pattern,
|
|
64
|
+
operator: 'contains',
|
|
65
|
+
}
|
|
66
|
+
: undefined;
|
|
67
|
+
// Execute object list query with pagination
|
|
68
|
+
const result = await objectListService.listObjects({
|
|
69
|
+
type: params.filter,
|
|
70
|
+
namespace: params.namespace,
|
|
71
|
+
nameFilter,
|
|
72
|
+
withRecords: params.withRecords,
|
|
73
|
+
withoutRecords: params.withoutRecords,
|
|
74
|
+
limit: pageSize,
|
|
75
|
+
offset,
|
|
76
|
+
sort: params.sort
|
|
77
|
+
? {
|
|
78
|
+
field: params.sort,
|
|
79
|
+
direction: 'asc',
|
|
80
|
+
}
|
|
81
|
+
: undefined,
|
|
82
|
+
includeTabs: true,
|
|
83
|
+
withContactPoints: params.contactPoints ?? false,
|
|
84
|
+
});
|
|
85
|
+
if (!result.success) {
|
|
86
|
+
return serviceResultToMcp(result);
|
|
87
|
+
}
|
|
88
|
+
// Build pagination metadata from service result
|
|
89
|
+
const pagination = createPaginationMetadata({
|
|
90
|
+
offset,
|
|
91
|
+
pageSize,
|
|
92
|
+
totalItems: result.data.totalCount,
|
|
93
|
+
returnedItems: result.data.returnedCount,
|
|
94
|
+
});
|
|
95
|
+
return serviceResultToMcpPaginated(result, pagination);
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
return createMcpError(McpErrorCodes.TOOL_INVOCATION_FAILED, `Failed to list objects: ${extractErrorMessage(error, 'handleObjectList')}`);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
// ============================================================================
|
|
102
|
+
// Object describe section handlers
|
|
103
|
+
// ============================================================================
|
|
104
|
+
/**
|
|
105
|
+
* Applies field type and pattern filters, then sorts.
|
|
106
|
+
*/
|
|
107
|
+
function filterAndSortFields(fields, fieldType, fieldPattern, sort) {
|
|
108
|
+
let result = fields;
|
|
109
|
+
if (fieldType) {
|
|
110
|
+
const allowedTypes = FIELD_TYPE_MAP[fieldType] || [fieldType];
|
|
111
|
+
result = result.filter((f) => allowedTypes.includes(f.type.toLowerCase()));
|
|
112
|
+
}
|
|
113
|
+
if (fieldPattern) {
|
|
114
|
+
const pattern = fieldPattern.toLowerCase();
|
|
115
|
+
result = result.filter((f) => f.name.toLowerCase().includes(pattern));
|
|
116
|
+
}
|
|
117
|
+
if (sort) {
|
|
118
|
+
result = [...result].sort((a, b) => {
|
|
119
|
+
if (sort === 'type')
|
|
120
|
+
return a.type.localeCompare(b.type);
|
|
121
|
+
if (sort === 'label')
|
|
122
|
+
return a.label.localeCompare(b.label);
|
|
123
|
+
return a.name.localeCompare(b.name);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
return result;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Handles the summary section — object metadata + field classification + availableSections.
|
|
130
|
+
*/
|
|
131
|
+
async function handleDescribeSummary(describeService, objectName) {
|
|
132
|
+
const result = await describeService.describeObject(objectName);
|
|
133
|
+
if (!result.success) {
|
|
134
|
+
return serviceResultToMcp(result);
|
|
135
|
+
}
|
|
136
|
+
const obj = result.data;
|
|
137
|
+
return serviceResultToMcp({
|
|
138
|
+
success: true,
|
|
139
|
+
data: {
|
|
140
|
+
objectName: obj.objectName,
|
|
141
|
+
label: obj.label,
|
|
142
|
+
labelPlural: obj.labelPlural,
|
|
143
|
+
isCustom: obj.isCustom,
|
|
144
|
+
isQueryable: obj.isQueryable,
|
|
145
|
+
isCreateable: obj.isCreateable,
|
|
146
|
+
isUpdateable: obj.isUpdateable,
|
|
147
|
+
isDeletable: obj.isDeletable,
|
|
148
|
+
isSearchable: obj.isSearchable,
|
|
149
|
+
fieldClassification: obj.fieldClassification,
|
|
150
|
+
availableSections: [...OBJECT_DESCRIBE_SECTIONS],
|
|
151
|
+
},
|
|
152
|
+
message: `Summary for ${obj.objectName} (${obj.fieldClassification.totalFields} fields)`,
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Handles the fields section — paginated fields with filtering and sorting.
|
|
157
|
+
*/
|
|
158
|
+
async function handleDescribeFields(describeService, params) {
|
|
159
|
+
const result = await describeService.describeObject(params.objectName);
|
|
160
|
+
if (!result.success) {
|
|
161
|
+
return serviceResultToMcp(result);
|
|
162
|
+
}
|
|
163
|
+
const filtered = filterAndSortFields(result.data.fields, params.fieldType, params.fieldPattern, params.sort);
|
|
164
|
+
const offset = decodeCursor(params.cursor);
|
|
165
|
+
const pageSize = clampPageSize(params.limit, PAGE_SIZE_DEFAULTS.FIELD_LIST.default, PAGE_SIZE_DEFAULTS.FIELD_LIST.max);
|
|
166
|
+
const page = filtered.slice(offset, offset + pageSize);
|
|
167
|
+
const pagination = createPaginationMetadata({
|
|
168
|
+
offset,
|
|
169
|
+
pageSize,
|
|
170
|
+
totalItems: filtered.length,
|
|
171
|
+
returnedItems: page.length,
|
|
172
|
+
});
|
|
173
|
+
return serviceResultToMcpPaginated({
|
|
174
|
+
success: true,
|
|
175
|
+
data: page,
|
|
176
|
+
message: `Fields for ${params.objectName}`,
|
|
177
|
+
}, pagination);
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Handles the fieldDistribution section — field type counts.
|
|
181
|
+
*/
|
|
182
|
+
async function handleDescribeFieldDistribution(describeService, objectName) {
|
|
183
|
+
const result = await describeService.describeObject(objectName);
|
|
184
|
+
if (!result.success) {
|
|
185
|
+
return serviceResultToMcp(result);
|
|
186
|
+
}
|
|
187
|
+
const distResult = ObjectDescribeService.getFieldTypeDistribution(result.data.fields);
|
|
188
|
+
if (!distResult.success) {
|
|
189
|
+
return serviceResultToMcp(distResult);
|
|
190
|
+
}
|
|
191
|
+
return serviceResultToMcp({
|
|
192
|
+
success: true,
|
|
193
|
+
data: {
|
|
194
|
+
objectName,
|
|
195
|
+
totalFields: result.data.fields.length,
|
|
196
|
+
distribution: distResult.data,
|
|
197
|
+
},
|
|
198
|
+
message: `Field distribution for ${objectName}`,
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Handles the recordTypes section — record types with pagination.
|
|
203
|
+
*/
|
|
204
|
+
async function handleDescribeRecordTypes(soqlAdapter, params) {
|
|
205
|
+
const recordTypeService = new RecordTypeService({ soqlAdapter });
|
|
206
|
+
const result = await recordTypeService.getRecordTypes(params.objectName);
|
|
207
|
+
if (!result.success) {
|
|
208
|
+
return serviceResultToMcp(result);
|
|
209
|
+
}
|
|
210
|
+
const offset = decodeCursor(params.cursor);
|
|
211
|
+
const pageSize = clampPageSize(params.limit, PAGE_SIZE_DEFAULTS.RECORD_TYPE_LIST.default, PAGE_SIZE_DEFAULTS.RECORD_TYPE_LIST.max);
|
|
212
|
+
const page = result.data.slice(offset, offset + pageSize);
|
|
213
|
+
const pagination = createPaginationMetadata({
|
|
214
|
+
offset,
|
|
215
|
+
pageSize,
|
|
216
|
+
totalItems: result.data.length,
|
|
217
|
+
returnedItems: page.length,
|
|
218
|
+
});
|
|
219
|
+
return serviceResultToMcpPaginated({
|
|
220
|
+
success: true,
|
|
221
|
+
data: page,
|
|
222
|
+
message: `Record types for ${params.objectName}`,
|
|
223
|
+
}, pagination);
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Handles the relationships section — lookup fields and external references with pagination.
|
|
227
|
+
*/
|
|
228
|
+
async function handleDescribeRelationships(describeService, params) {
|
|
229
|
+
const result = await describeService.describeObject(params.objectName);
|
|
230
|
+
if (!result.success) {
|
|
231
|
+
return serviceResultToMcp(result);
|
|
232
|
+
}
|
|
233
|
+
const relationships = result.data.relationships;
|
|
234
|
+
// If relationship data is unavailable, return success with explicit warning
|
|
235
|
+
// rather than silently synthesizing empty arrays (which masks API/permission issues)
|
|
236
|
+
if (!relationships) {
|
|
237
|
+
return serviceResultToMcpPaginated({
|
|
238
|
+
success: true,
|
|
239
|
+
data: { items: [] },
|
|
240
|
+
warnings: [
|
|
241
|
+
'Relationship metadata was not returned by the describe API. ' +
|
|
242
|
+
'This may indicate insufficient permissions or an API limitation.',
|
|
243
|
+
],
|
|
244
|
+
message: `Relationships for ${params.objectName} (data unavailable)`,
|
|
245
|
+
}, createPaginationMetadata({ offset: 0, pageSize: 1, totalItems: 0, returnedItems: 0 }));
|
|
246
|
+
}
|
|
247
|
+
const allItems = [
|
|
248
|
+
...relationships.lookupFields.map((lf) => ({ kind: 'lookup', ...lf })),
|
|
249
|
+
...relationships.referencedBy.map((rb) => ({ kind: 'referencedBy', ...rb })),
|
|
250
|
+
];
|
|
251
|
+
const offset = decodeCursor(params.cursor);
|
|
252
|
+
const pageSize = clampPageSize(params.limit, PAGE_SIZE_DEFAULTS.RELATIONSHIP_LIST.default, PAGE_SIZE_DEFAULTS.RELATIONSHIP_LIST.max);
|
|
253
|
+
const page = allItems.slice(offset, offset + pageSize);
|
|
254
|
+
const pagination = createPaginationMetadata({
|
|
255
|
+
offset,
|
|
256
|
+
pageSize,
|
|
257
|
+
totalItems: allItems.length,
|
|
258
|
+
returnedItems: page.length,
|
|
259
|
+
});
|
|
260
|
+
return serviceResultToMcpPaginated({
|
|
261
|
+
success: true,
|
|
262
|
+
data: {
|
|
263
|
+
referencedByCount: relationships.referencedByCount,
|
|
264
|
+
lookupFieldCount: relationships.lookupFields.length,
|
|
265
|
+
items: page,
|
|
266
|
+
},
|
|
267
|
+
message: `Relationships for ${params.objectName}`,
|
|
268
|
+
}, pagination);
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Handler for cuneiform_object_describe tool invocation.
|
|
272
|
+
*
|
|
273
|
+
* Routes by section parameter to return one section per call,
|
|
274
|
+
* keeping responses within LLM context budgets (~3 KB max).
|
|
275
|
+
*
|
|
276
|
+
* @param adapters - Session-scoped MCP adapters
|
|
277
|
+
* @param params - Validated input from MCP SDK
|
|
278
|
+
* @returns MCP CallToolResult
|
|
279
|
+
*/
|
|
280
|
+
export async function handleObjectDescribe(adapters, params) {
|
|
281
|
+
try {
|
|
282
|
+
const { soql: soqlAdapter, rest: restAdapter } = adapters;
|
|
283
|
+
const describeService = new ObjectDescribeService({
|
|
284
|
+
restApiAdapter: restAdapter,
|
|
285
|
+
soqlAdapter,
|
|
286
|
+
});
|
|
287
|
+
switch (params.section) {
|
|
288
|
+
case 'summary':
|
|
289
|
+
return await handleDescribeSummary(describeService, params.objectName);
|
|
290
|
+
case 'fields':
|
|
291
|
+
return await handleDescribeFields(describeService, params);
|
|
292
|
+
case 'fieldDistribution':
|
|
293
|
+
return await handleDescribeFieldDistribution(describeService, params.objectName);
|
|
294
|
+
case 'recordTypes':
|
|
295
|
+
return await handleDescribeRecordTypes(soqlAdapter, params);
|
|
296
|
+
case 'relationships':
|
|
297
|
+
return await handleDescribeRelationships(describeService, params);
|
|
298
|
+
default:
|
|
299
|
+
return createMcpError(McpErrorCodes.INVALID_TOOL_INPUT, `Unknown section: ${String(params.section)}`);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
catch (error) {
|
|
303
|
+
return createMcpError(McpErrorCodes.TOOL_INVOCATION_FAILED, `Failed to describe object: ${extractErrorMessage(error, 'handleObjectDescribe')}`);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
//# sourceMappingURL=object-tools.js.map
|