@cleanslate/sdk 0.1.0
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 +22 -0
- package/NOTICE +48 -0
- package/README.md +103 -0
- package/VENDOR.md +60 -0
- package/dist/agent/cleanSlateAgentExecutionPhase.d.ts +55 -0
- package/dist/agent/cleanSlateAgentExecutionPhase.d.ts.map +1 -0
- package/dist/agent/cleanSlateAgentExecutionPhase.js +474 -0
- package/dist/agent/cleanSlateAgentExecutionPhase.js.map +1 -0
- package/dist/agent/cleanSlateAgentExecutionSupport.d.ts +22 -0
- package/dist/agent/cleanSlateAgentExecutionSupport.d.ts.map +1 -0
- package/dist/agent/cleanSlateAgentExecutionSupport.js +205 -0
- package/dist/agent/cleanSlateAgentExecutionSupport.js.map +1 -0
- package/dist/agent/cleanSlateAgentParsing.d.ts +21 -0
- package/dist/agent/cleanSlateAgentParsing.d.ts.map +1 -0
- package/dist/agent/cleanSlateAgentParsing.js +106 -0
- package/dist/agent/cleanSlateAgentParsing.js.map +1 -0
- package/dist/agent/cleanSlateAgentSession.d.ts +44 -0
- package/dist/agent/cleanSlateAgentSession.d.ts.map +1 -0
- package/dist/agent/cleanSlateAgentSession.js +205 -0
- package/dist/agent/cleanSlateAgentSession.js.map +1 -0
- package/dist/agent/cleanSlateAgentTypes.d.ts +91 -0
- package/dist/agent/cleanSlateAgentTypes.d.ts.map +1 -0
- package/dist/agent/cleanSlateAgentTypes.js +27 -0
- package/dist/agent/cleanSlateAgentTypes.js.map +1 -0
- package/dist/agent/cleanSlateCommandPolicy.d.ts +12 -0
- package/dist/agent/cleanSlateCommandPolicy.d.ts.map +1 -0
- package/dist/agent/cleanSlateCommandPolicy.js +30 -0
- package/dist/agent/cleanSlateCommandPolicy.js.map +1 -0
- package/dist/agent/cleanSlateContextBudgetManager.d.ts +82 -0
- package/dist/agent/cleanSlateContextBudgetManager.d.ts.map +1 -0
- package/dist/agent/cleanSlateContextBudgetManager.js +419 -0
- package/dist/agent/cleanSlateContextBudgetManager.js.map +1 -0
- package/dist/agent/cleanSlateDomainProfile.d.ts +71 -0
- package/dist/agent/cleanSlateDomainProfile.d.ts.map +1 -0
- package/dist/agent/cleanSlateDomainProfile.js +124 -0
- package/dist/agent/cleanSlateDomainProfile.js.map +1 -0
- package/dist/agent/cleanSlateExecutionBudget.d.ts +19 -0
- package/dist/agent/cleanSlateExecutionBudget.d.ts.map +1 -0
- package/dist/agent/cleanSlateExecutionBudget.js +28 -0
- package/dist/agent/cleanSlateExecutionBudget.js.map +1 -0
- package/dist/agent/cleanSlateExecutionEditPolicy.d.ts +15 -0
- package/dist/agent/cleanSlateExecutionEditPolicy.d.ts.map +1 -0
- package/dist/agent/cleanSlateExecutionEditPolicy.js +148 -0
- package/dist/agent/cleanSlateExecutionEditPolicy.js.map +1 -0
- package/dist/agent/cleanSlateExecutionEvidenceLedger.d.ts +23 -0
- package/dist/agent/cleanSlateExecutionEvidenceLedger.d.ts.map +1 -0
- package/dist/agent/cleanSlateExecutionEvidenceLedger.js +121 -0
- package/dist/agent/cleanSlateExecutionEvidenceLedger.js.map +1 -0
- package/dist/agent/cleanSlateExecutionLoopPrompts.d.ts +5 -0
- package/dist/agent/cleanSlateExecutionLoopPrompts.d.ts.map +1 -0
- package/dist/agent/cleanSlateExecutionLoopPrompts.js +41 -0
- package/dist/agent/cleanSlateExecutionLoopPrompts.js.map +1 -0
- package/dist/agent/cleanSlateExecutionQuery.d.ts +162 -0
- package/dist/agent/cleanSlateExecutionQuery.d.ts.map +1 -0
- package/dist/agent/cleanSlateExecutionQuery.js +1448 -0
- package/dist/agent/cleanSlateExecutionQuery.js.map +1 -0
- package/dist/agent/cleanSlateFilesModifiedService.d.ts +96 -0
- package/dist/agent/cleanSlateFilesModifiedService.d.ts.map +1 -0
- package/dist/agent/cleanSlateFilesModifiedService.js +581 -0
- package/dist/agent/cleanSlateFilesModifiedService.js.map +1 -0
- package/dist/agent/cleanSlateNativeToolTranscript.d.ts +22 -0
- package/dist/agent/cleanSlateNativeToolTranscript.d.ts.map +1 -0
- package/dist/agent/cleanSlateNativeToolTranscript.js +77 -0
- package/dist/agent/cleanSlateNativeToolTranscript.js.map +1 -0
- package/dist/agent/cleanSlatePrompts.d.ts +30 -0
- package/dist/agent/cleanSlatePrompts.d.ts.map +1 -0
- package/dist/agent/cleanSlatePrompts.js +65 -0
- package/dist/agent/cleanSlatePrompts.js.map +1 -0
- package/dist/agent/cleanSlateQueryRunner.d.ts +56 -0
- package/dist/agent/cleanSlateQueryRunner.d.ts.map +1 -0
- package/dist/agent/cleanSlateQueryRunner.js +69 -0
- package/dist/agent/cleanSlateQueryRunner.js.map +1 -0
- package/dist/agent/cleanSlateRuntimePromptBuilder.d.ts +30 -0
- package/dist/agent/cleanSlateRuntimePromptBuilder.d.ts.map +1 -0
- package/dist/agent/cleanSlateRuntimePromptBuilder.js +99 -0
- package/dist/agent/cleanSlateRuntimePromptBuilder.js.map +1 -0
- package/dist/agent/cleanSlateStreamingToolExecutor.d.ts +55 -0
- package/dist/agent/cleanSlateStreamingToolExecutor.d.ts.map +1 -0
- package/dist/agent/cleanSlateStreamingToolExecutor.js +214 -0
- package/dist/agent/cleanSlateStreamingToolExecutor.js.map +1 -0
- package/dist/agent/cleanSlateToolCallLedger.d.ts +32 -0
- package/dist/agent/cleanSlateToolCallLedger.d.ts.map +1 -0
- package/dist/agent/cleanSlateToolCallLedger.js +164 -0
- package/dist/agent/cleanSlateToolCallLedger.js.map +1 -0
- package/dist/agent/cleanSlateToolResultPromptSerializer.d.ts +9 -0
- package/dist/agent/cleanSlateToolResultPromptSerializer.d.ts.map +1 -0
- package/dist/agent/cleanSlateToolResultPromptSerializer.js +184 -0
- package/dist/agent/cleanSlateToolResultPromptSerializer.js.map +1 -0
- package/dist/composer/commands/slashCommands.d.ts +8 -0
- package/dist/composer/commands/slashCommands.d.ts.map +1 -0
- package/dist/composer/commands/slashCommands.js +46 -0
- package/dist/composer/commands/slashCommands.js.map +1 -0
- package/dist/composer/instructions/baseInstructions.d.ts +3 -0
- package/dist/composer/instructions/baseInstructions.d.ts.map +1 -0
- package/dist/composer/instructions/baseInstructions.js +35 -0
- package/dist/composer/instructions/baseInstructions.js.map +1 -0
- package/dist/composer/instructions/runtimeInstructions.d.ts +11 -0
- package/dist/composer/instructions/runtimeInstructions.d.ts.map +1 -0
- package/dist/composer/instructions/runtimeInstructions.js +31 -0
- package/dist/composer/instructions/runtimeInstructions.js.map +1 -0
- package/dist/composer/kernel/coreKernel.d.ts +3 -0
- package/dist/composer/kernel/coreKernel.d.ts.map +1 -0
- package/dist/composer/kernel/coreKernel.js +11 -0
- package/dist/composer/kernel/coreKernel.js.map +1 -0
- package/dist/composer/kernel/editingRules.d.ts +3 -0
- package/dist/composer/kernel/editingRules.d.ts.map +1 -0
- package/dist/composer/kernel/editingRules.js +24 -0
- package/dist/composer/kernel/editingRules.js.map +1 -0
- package/dist/composer/kernel/toolProtocols.d.ts +2 -0
- package/dist/composer/kernel/toolProtocols.d.ts.map +1 -0
- package/dist/composer/kernel/toolProtocols.js +32 -0
- package/dist/composer/kernel/toolProtocols.js.map +1 -0
- package/dist/composer/modes/execution.mode.d.ts +2 -0
- package/dist/composer/modes/execution.mode.d.ts.map +1 -0
- package/dist/composer/modes/execution.mode.js +21 -0
- package/dist/composer/modes/execution.mode.js.map +1 -0
- package/dist/composer/modes/planning.mode.d.ts +2 -0
- package/dist/composer/modes/planning.mode.d.ts.map +1 -0
- package/dist/composer/modes/planning.mode.js +23 -0
- package/dist/composer/modes/planning.mode.js.map +1 -0
- package/dist/composer/promptComposer.d.ts +22 -0
- package/dist/composer/promptComposer.d.ts.map +1 -0
- package/dist/composer/promptComposer.js +62 -0
- package/dist/composer/promptComposer.js.map +1 -0
- package/dist/composer/registry/agentSchema.d.ts +16 -0
- package/dist/composer/registry/agentSchema.d.ts.map +1 -0
- package/dist/composer/registry/agentSchema.js +6 -0
- package/dist/composer/registry/agentSchema.js.map +1 -0
- package/dist/core/arrays.d.ts +311 -0
- package/dist/core/arrays.d.ts.map +1 -0
- package/dist/core/arrays.js +811 -0
- package/dist/core/arrays.js.map +1 -0
- package/dist/core/arraysFind.d.ts +72 -0
- package/dist/core/arraysFind.d.ts.map +1 -0
- package/dist/core/arraysFind.js +200 -0
- package/dist/core/arraysFind.js.map +1 -0
- package/dist/core/assert.d.ts +36 -0
- package/dist/core/assert.d.ts.map +1 -0
- package/dist/core/assert.js +84 -0
- package/dist/core/assert.js.map +1 -0
- package/dist/core/async.d.ts +11 -0
- package/dist/core/async.d.ts.map +1 -0
- package/dist/core/async.js +6 -0
- package/dist/core/async.js.map +1 -0
- package/dist/core/buffer.d.ts +23 -0
- package/dist/core/buffer.d.ts.map +1 -0
- package/dist/core/buffer.js +40 -0
- package/dist/core/buffer.js.map +1 -0
- package/dist/core/cancellation.d.ts +52 -0
- package/dist/core/cancellation.d.ts.map +1 -0
- package/dist/core/cancellation.js +169 -0
- package/dist/core/cancellation.js.map +1 -0
- package/dist/core/charCode.d.ts +428 -0
- package/dist/core/charCode.d.ts.map +1 -0
- package/dist/core/charCode.js +439 -0
- package/dist/core/charCode.js.map +1 -0
- package/dist/core/collections.d.ts +49 -0
- package/dist/core/collections.d.ts.map +1 -0
- package/dist/core/collections.js +132 -0
- package/dist/core/collections.js.map +1 -0
- package/dist/core/diff/diff.d.ts +151 -0
- package/dist/core/diff/diff.d.ts.map +1 -0
- package/dist/core/diff/diff.js +1076 -0
- package/dist/core/diff/diff.js.map +1 -0
- package/dist/core/diff/diffChange.d.ts +39 -0
- package/dist/core/diff/diffChange.d.ts.map +1 -0
- package/dist/core/diff/diffChange.js +37 -0
- package/dist/core/diff/diffChange.js.map +1 -0
- package/dist/core/errors.d.ts +114 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +258 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/event.d.ts +595 -0
- package/dist/core/event.d.ts.map +1 -0
- package/dist/core/event.js +1479 -0
- package/dist/core/event.js.map +1 -0
- package/dist/core/functional.d.ts +5 -0
- package/dist/core/functional.d.ts.map +1 -0
- package/dist/core/functional.js +35 -0
- package/dist/core/functional.js.map +1 -0
- package/dist/core/hash.d.ts +15 -0
- package/dist/core/hash.d.ts.map +1 -0
- package/dist/core/hash.js +27 -0
- package/dist/core/hash.js.map +1 -0
- package/dist/core/iterator.d.ts +33 -0
- package/dist/core/iterator.d.ts.map +1 -0
- package/dist/core/iterator.js +188 -0
- package/dist/core/iterator.js.map +1 -0
- package/dist/core/lifecycle.d.ts +313 -0
- package/dist/core/lifecycle.d.ts.map +1 -0
- package/dist/core/lifecycle.js +789 -0
- package/dist/core/lifecycle.js.map +1 -0
- package/dist/core/linkedList.d.ts +17 -0
- package/dist/core/linkedList.d.ts.map +1 -0
- package/dist/core/linkedList.js +138 -0
- package/dist/core/linkedList.js.map +1 -0
- package/dist/core/map.d.ts +175 -0
- package/dist/core/map.d.ts.map +1 -0
- package/dist/core/map.js +796 -0
- package/dist/core/map.js.map +1 -0
- package/dist/core/marshallingIds.d.ts +29 -0
- package/dist/core/marshallingIds.d.ts.map +1 -0
- package/dist/core/marshallingIds.js +38 -0
- package/dist/core/marshallingIds.js.map +1 -0
- package/dist/core/observable.d.ts +28 -0
- package/dist/core/observable.d.ts.map +1 -0
- package/dist/core/observable.js +6 -0
- package/dist/core/observable.js.map +1 -0
- package/dist/core/platform.d.ts +4 -0
- package/dist/core/platform.d.ts.map +1 -0
- package/dist/core/platform.js +17 -0
- package/dist/core/platform.js.map +1 -0
- package/dist/core/position.d.ts +91 -0
- package/dist/core/position.d.ts.map +1 -0
- package/dist/core/position.js +145 -0
- package/dist/core/position.js.map +1 -0
- package/dist/core/range.d.ts +198 -0
- package/dist/core/range.d.ts.map +1 -0
- package/dist/core/range.js +426 -0
- package/dist/core/range.js.map +1 -0
- package/dist/core/resources.d.ts +10 -0
- package/dist/core/resources.d.ts.map +1 -0
- package/dist/core/resources.js +126 -0
- package/dist/core/resources.js.map +1 -0
- package/dist/core/sequence.d.ts +20 -0
- package/dist/core/sequence.d.ts.map +1 -0
- package/dist/core/sequence.js +21 -0
- package/dist/core/sequence.js.map +1 -0
- package/dist/core/stopwatch.d.ts +11 -0
- package/dist/core/stopwatch.d.ts.map +1 -0
- package/dist/core/stopwatch.js +33 -0
- package/dist/core/stopwatch.js.map +1 -0
- package/dist/core/symbols.d.ts +5 -0
- package/dist/core/symbols.d.ts.map +1 -0
- package/dist/core/symbols.js +13 -0
- package/dist/core/symbols.js.map +1 -0
- package/dist/core/types.d.ts +229 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +278 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/uint.d.ts +32 -0
- package/dist/core/uint.d.ts.map +1 -0
- package/dist/core/uint.js +57 -0
- package/dist/core/uint.js.map +1 -0
- package/dist/core/uri.d.ts +172 -0
- package/dist/core/uri.d.ts.map +1 -0
- package/dist/core/uri.js +623 -0
- package/dist/core/uri.js.map +1 -0
- package/dist/host/browserAutomation.d.ts +276 -0
- package/dist/host/browserAutomation.d.ts.map +1 -0
- package/dist/host/browserAutomation.js +6 -0
- package/dist/host/browserAutomation.js.map +1 -0
- package/dist/host/diagnostics.d.ts +68 -0
- package/dist/host/diagnostics.d.ts.map +1 -0
- package/dist/host/diagnostics.js +41 -0
- package/dist/host/diagnostics.js.map +1 -0
- package/dist/host/files.d.ts +70 -0
- package/dist/host/files.d.ts.map +1 -0
- package/dist/host/files.js +54 -0
- package/dist/host/files.js.map +1 -0
- package/dist/host/services.d.ts +106 -0
- package/dist/host/services.d.ts.map +1 -0
- package/dist/host/services.js +6 -0
- package/dist/host/services.js.map +1 -0
- package/dist/host/symbols.d.ts +45 -0
- package/dist/host/symbols.d.ts.map +1 -0
- package/dist/host/symbols.js +43 -0
- package/dist/host/symbols.js.map +1 -0
- package/dist/host/textModel.d.ts +83 -0
- package/dist/host/textModel.d.ts.map +1 -0
- package/dist/host/textModel.js +6 -0
- package/dist/host/textModel.js.map +1 -0
- package/dist/host/workspace.d.ts +123 -0
- package/dist/host/workspace.d.ts.map +1 -0
- package/dist/host/workspace.js +32 -0
- package/dist/host/workspace.js.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/node/cleanSlateAnthropicMessageAdapter.d.ts +12 -0
- package/dist/node/cleanSlateAnthropicMessageAdapter.d.ts.map +1 -0
- package/dist/node/cleanSlateAnthropicMessageAdapter.js +130 -0
- package/dist/node/cleanSlateAnthropicMessageAdapter.js.map +1 -0
- package/dist/node/cleanSlateHeadlessRunner.d.ts +63 -0
- package/dist/node/cleanSlateHeadlessRunner.d.ts.map +1 -0
- package/dist/node/cleanSlateHeadlessRunner.js +84 -0
- package/dist/node/cleanSlateHeadlessRunner.js.map +1 -0
- package/dist/node/cleanSlateNodeAgentRuntime.d.ts +94 -0
- package/dist/node/cleanSlateNodeAgentRuntime.d.ts.map +1 -0
- package/dist/node/cleanSlateNodeAgentRuntime.js +339 -0
- package/dist/node/cleanSlateNodeAgentRuntime.js.map +1 -0
- package/dist/node/cleanSlateNodeBrowserAutomation.d.ts +279 -0
- package/dist/node/cleanSlateNodeBrowserAutomation.d.ts.map +1 -0
- package/dist/node/cleanSlateNodeBrowserAutomation.js +470 -0
- package/dist/node/cleanSlateNodeBrowserAutomation.js.map +1 -0
- package/dist/node/cleanSlateNodeCommandService.d.ts +40 -0
- package/dist/node/cleanSlateNodeCommandService.d.ts.map +1 -0
- package/dist/node/cleanSlateNodeCommandService.js +435 -0
- package/dist/node/cleanSlateNodeCommandService.js.map +1 -0
- package/dist/node/cleanSlateNodeFileServices.d.ts +68 -0
- package/dist/node/cleanSlateNodeFileServices.d.ts.map +1 -0
- package/dist/node/cleanSlateNodeFileServices.js +138 -0
- package/dist/node/cleanSlateNodeFileServices.js.map +1 -0
- package/dist/node/cleanSlateNodeIndexService.d.ts +17 -0
- package/dist/node/cleanSlateNodeIndexService.d.ts.map +1 -0
- package/dist/node/cleanSlateNodeIndexService.js +128 -0
- package/dist/node/cleanSlateNodeIndexService.js.map +1 -0
- package/dist/node/cleanSlateNodeLanguageCommands.d.ts +11 -0
- package/dist/node/cleanSlateNodeLanguageCommands.d.ts.map +1 -0
- package/dist/node/cleanSlateNodeLanguageCommands.js +146 -0
- package/dist/node/cleanSlateNodeLanguageCommands.js.map +1 -0
- package/dist/node/cleanSlateNodeMainService.d.ts +87 -0
- package/dist/node/cleanSlateNodeMainService.d.ts.map +1 -0
- package/dist/node/cleanSlateNodeMainService.js +1304 -0
- package/dist/node/cleanSlateNodeMainService.js.map +1 -0
- package/dist/node/cleanSlateNodeMcpClient.d.ts +20 -0
- package/dist/node/cleanSlateNodeMcpClient.d.ts.map +1 -0
- package/dist/node/cleanSlateNodeMcpClient.js +184 -0
- package/dist/node/cleanSlateNodeMcpClient.js.map +1 -0
- package/dist/node/cleanSlateNodeSearchService.d.ts +14 -0
- package/dist/node/cleanSlateNodeSearchService.d.ts.map +1 -0
- package/dist/node/cleanSlateNodeSearchService.js +180 -0
- package/dist/node/cleanSlateNodeSearchService.js.map +1 -0
- package/dist/node/cleanSlateNodeTextModel.d.ts +56 -0
- package/dist/node/cleanSlateNodeTextModel.d.ts.map +1 -0
- package/dist/node/cleanSlateNodeTextModel.js +127 -0
- package/dist/node/cleanSlateNodeTextModel.js.map +1 -0
- package/dist/node/cleanSlateNodeToolContext.d.ts +50 -0
- package/dist/node/cleanSlateNodeToolContext.d.ts.map +1 -0
- package/dist/node/cleanSlateNodeToolContext.js +134 -0
- package/dist/node/cleanSlateNodeToolContext.js.map +1 -0
- package/dist/node/cleanSlateNodeWebRetrieval.d.ts +20 -0
- package/dist/node/cleanSlateNodeWebRetrieval.d.ts.map +1 -0
- package/dist/node/cleanSlateNodeWebRetrieval.js +379 -0
- package/dist/node/cleanSlateNodeWebRetrieval.js.map +1 -0
- package/dist/node/cleanSlateOpenAIMessageAdapter.d.ts +8 -0
- package/dist/node/cleanSlateOpenAIMessageAdapter.d.ts.map +1 -0
- package/dist/node/cleanSlateOpenAIMessageAdapter.js +111 -0
- package/dist/node/cleanSlateOpenAIMessageAdapter.js.map +1 -0
- package/dist/node/cleanSlateProviderSchemaNormalizer.d.ts +18 -0
- package/dist/node/cleanSlateProviderSchemaNormalizer.d.ts.map +1 -0
- package/dist/node/cleanSlateProviderSchemaNormalizer.js +175 -0
- package/dist/node/cleanSlateProviderSchemaNormalizer.js.map +1 -0
- package/dist/node/index.d.ts +25 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +28 -0
- package/dist/node/index.js.map +1 -0
- package/dist/protocol/cleanSlateAI.d.ts +964 -0
- package/dist/protocol/cleanSlateAI.d.ts.map +1 -0
- package/dist/protocol/cleanSlateAI.js +35 -0
- package/dist/protocol/cleanSlateAI.js.map +1 -0
- package/dist/protocol/cleanSlateModelCapabilities.d.ts +86 -0
- package/dist/protocol/cleanSlateModelCapabilities.d.ts.map +1 -0
- package/dist/protocol/cleanSlateModelCapabilities.js +1104 -0
- package/dist/protocol/cleanSlateModelCapabilities.js.map +1 -0
- package/dist/protocol/cleanSlateProviderMessageTransforms.d.ts +11 -0
- package/dist/protocol/cleanSlateProviderMessageTransforms.d.ts.map +1 -0
- package/dist/protocol/cleanSlateProviderMessageTransforms.js +178 -0
- package/dist/protocol/cleanSlateProviderMessageTransforms.js.map +1 -0
- package/dist/protocol/cleanSlateService.d.ts +68 -0
- package/dist/protocol/cleanSlateService.d.ts.map +1 -0
- package/dist/protocol/cleanSlateService.js +1149 -0
- package/dist/protocol/cleanSlateService.js.map +1 -0
- package/dist/services/cleanSlateCancellation.d.ts +7 -0
- package/dist/services/cleanSlateCancellation.d.ts.map +1 -0
- package/dist/services/cleanSlateCancellation.js +56 -0
- package/dist/services/cleanSlateCancellation.js.map +1 -0
- package/dist/services/cleanSlateCommandExecutionService.d.ts +25 -0
- package/dist/services/cleanSlateCommandExecutionService.d.ts.map +1 -0
- package/dist/services/cleanSlateCommandExecutionService.js +31 -0
- package/dist/services/cleanSlateCommandExecutionService.js.map +1 -0
- package/dist/services/cleanSlateDiffService.d.ts +62 -0
- package/dist/services/cleanSlateDiffService.d.ts.map +1 -0
- package/dist/services/cleanSlateDiffService.js +428 -0
- package/dist/services/cleanSlateDiffService.js.map +1 -0
- package/dist/services/cleanSlateEditMatchValidator.d.ts +63 -0
- package/dist/services/cleanSlateEditMatchValidator.d.ts.map +1 -0
- package/dist/services/cleanSlateEditMatchValidator.js +341 -0
- package/dist/services/cleanSlateEditMatchValidator.js.map +1 -0
- package/dist/services/cleanSlateEditService.d.ts +155 -0
- package/dist/services/cleanSlateEditService.d.ts.map +1 -0
- package/dist/services/cleanSlateEditService.js +848 -0
- package/dist/services/cleanSlateEditService.js.map +1 -0
- package/dist/services/cleanSlateFileHistory.d.ts +56 -0
- package/dist/services/cleanSlateFileHistory.d.ts.map +1 -0
- package/dist/services/cleanSlateFileHistory.js +157 -0
- package/dist/services/cleanSlateFileHistory.js.map +1 -0
- package/dist/services/cleanSlateTaskEvidenceCodec.d.ts +15 -0
- package/dist/services/cleanSlateTaskEvidenceCodec.d.ts.map +1 -0
- package/dist/services/cleanSlateTaskEvidenceCodec.js +151 -0
- package/dist/services/cleanSlateTaskEvidenceCodec.js.map +1 -0
- package/dist/services/cleanSlateTaskSessionService.d.ts +258 -0
- package/dist/services/cleanSlateTaskSessionService.d.ts.map +1 -0
- package/dist/services/cleanSlateTaskSessionService.js +1079 -0
- package/dist/services/cleanSlateTaskSessionService.js.map +1 -0
- package/dist/services/cleanSlateTaskState.d.ts +32 -0
- package/dist/services/cleanSlateTaskState.d.ts.map +1 -0
- package/dist/services/cleanSlateTaskState.js +40 -0
- package/dist/services/cleanSlateTaskState.js.map +1 -0
- package/dist/services/cleanSlateThreadService.d.ts +64 -0
- package/dist/services/cleanSlateThreadService.d.ts.map +1 -0
- package/dist/services/cleanSlateThreadService.js +188 -0
- package/dist/services/cleanSlateThreadService.js.map +1 -0
- package/dist/services/cleanSlateTools.d.ts +29 -0
- package/dist/services/cleanSlateTools.d.ts.map +1 -0
- package/dist/services/cleanSlateTools.js +38 -0
- package/dist/services/cleanSlateTools.js.map +1 -0
- package/dist/services/cleanSlateVerificationTargetTracker.d.ts +23 -0
- package/dist/services/cleanSlateVerificationTargetTracker.d.ts.map +1 -0
- package/dist/services/cleanSlateVerificationTargetTracker.js +214 -0
- package/dist/services/cleanSlateVerificationTargetTracker.js.map +1 -0
- package/dist/skills/cleanSlateSkillCatalog.d.ts +29 -0
- package/dist/skills/cleanSlateSkillCatalog.d.ts.map +1 -0
- package/dist/skills/cleanSlateSkillCatalog.js +225 -0
- package/dist/skills/cleanSlateSkillCatalog.js.map +1 -0
- package/dist/tools/ApplyEditTool.d.ts +73 -0
- package/dist/tools/ApplyEditTool.d.ts.map +1 -0
- package/dist/tools/ApplyEditTool.js +741 -0
- package/dist/tools/ApplyEditTool.js.map +1 -0
- package/dist/tools/AskQuestionTool.d.ts +3 -0
- package/dist/tools/AskQuestionTool.d.ts.map +1 -0
- package/dist/tools/AskQuestionTool.js +113 -0
- package/dist/tools/AskQuestionTool.js.map +1 -0
- package/dist/tools/BrowserAutomationTools.d.ts +28 -0
- package/dist/tools/BrowserAutomationTools.d.ts.map +1 -0
- package/dist/tools/BrowserAutomationTools.js +639 -0
- package/dist/tools/BrowserAutomationTools.js.map +1 -0
- package/dist/tools/CreateMultipleFilesTool.d.ts +6 -0
- package/dist/tools/CreateMultipleFilesTool.d.ts.map +1 -0
- package/dist/tools/CreateMultipleFilesTool.js +115 -0
- package/dist/tools/CreateMultipleFilesTool.js.map +1 -0
- package/dist/tools/ExecuteCommandTool.d.ts +12 -0
- package/dist/tools/ExecuteCommandTool.d.ts.map +1 -0
- package/dist/tools/ExecuteCommandTool.js +378 -0
- package/dist/tools/ExecuteCommandTool.js.map +1 -0
- package/dist/tools/FileHistoryRewindTool.d.ts +3 -0
- package/dist/tools/FileHistoryRewindTool.d.ts.map +1 -0
- package/dist/tools/FileHistoryRewindTool.js +45 -0
- package/dist/tools/FileHistoryRewindTool.js.map +1 -0
- package/dist/tools/FindByNameTool.d.ts +6 -0
- package/dist/tools/FindByNameTool.d.ts.map +1 -0
- package/dist/tools/FindByNameTool.js +80 -0
- package/dist/tools/FindByNameTool.js.map +1 -0
- package/dist/tools/FindReferencesTool.d.ts +3 -0
- package/dist/tools/FindReferencesTool.d.ts.map +1 -0
- package/dist/tools/FindReferencesTool.js +128 -0
- package/dist/tools/FindReferencesTool.js.map +1 -0
- package/dist/tools/GetDefinitionsTool.d.ts +3 -0
- package/dist/tools/GetDefinitionsTool.d.ts.map +1 -0
- package/dist/tools/GetDefinitionsTool.js +136 -0
- package/dist/tools/GetDefinitionsTool.js.map +1 -0
- package/dist/tools/GetOpenFilesTool.d.ts +6 -0
- package/dist/tools/GetOpenFilesTool.d.ts.map +1 -0
- package/dist/tools/GetOpenFilesTool.js +21 -0
- package/dist/tools/GetOpenFilesTool.js.map +1 -0
- package/dist/tools/GrepSearchTool.d.ts +7 -0
- package/dist/tools/GrepSearchTool.d.ts.map +1 -0
- package/dist/tools/GrepSearchTool.js +95 -0
- package/dist/tools/GrepSearchTool.js.map +1 -0
- package/dist/tools/ListDirTool.d.ts +6 -0
- package/dist/tools/ListDirTool.d.ts.map +1 -0
- package/dist/tools/ListDirTool.js +39 -0
- package/dist/tools/ListDirTool.js.map +1 -0
- package/dist/tools/MCPTools.d.ts +6 -0
- package/dist/tools/MCPTools.d.ts.map +1 -0
- package/dist/tools/MCPTools.js +103 -0
- package/dist/tools/MCPTools.js.map +1 -0
- package/dist/tools/MultiFileReplaceTool.d.ts +6 -0
- package/dist/tools/MultiFileReplaceTool.d.ts.map +1 -0
- package/dist/tools/MultiFileReplaceTool.js +345 -0
- package/dist/tools/MultiFileReplaceTool.js.map +1 -0
- package/dist/tools/ReadFileRangeTool.d.ts +6 -0
- package/dist/tools/ReadFileRangeTool.d.ts.map +1 -0
- package/dist/tools/ReadFileRangeTool.js +150 -0
- package/dist/tools/ReadFileRangeTool.js.map +1 -0
- package/dist/tools/ReadFileTool.d.ts +6 -0
- package/dist/tools/ReadFileTool.d.ts.map +1 -0
- package/dist/tools/ReadFileTool.js +183 -0
- package/dist/tools/ReadFileTool.js.map +1 -0
- package/dist/tools/ReadLintsTool.d.ts +6 -0
- package/dist/tools/ReadLintsTool.d.ts.map +1 -0
- package/dist/tools/ReadLintsTool.js +83 -0
- package/dist/tools/ReadLintsTool.js.map +1 -0
- package/dist/tools/ReadReferenceTool.d.ts +6 -0
- package/dist/tools/ReadReferenceTool.d.ts.map +1 -0
- package/dist/tools/ReadReferenceTool.js +24 -0
- package/dist/tools/ReadReferenceTool.js.map +1 -0
- package/dist/tools/ReadSymbolsTool.d.ts +3 -0
- package/dist/tools/ReadSymbolsTool.d.ts.map +1 -0
- package/dist/tools/ReadSymbolsTool.js +100 -0
- package/dist/tools/ReadSymbolsTool.js.map +1 -0
- package/dist/tools/SearchCodebaseTool.d.ts +6 -0
- package/dist/tools/SearchCodebaseTool.d.ts.map +1 -0
- package/dist/tools/SearchCodebaseTool.js +30 -0
- package/dist/tools/SearchCodebaseTool.js.map +1 -0
- package/dist/tools/SearchWorkspaceTool.d.ts +7 -0
- package/dist/tools/SearchWorkspaceTool.d.ts.map +1 -0
- package/dist/tools/SearchWorkspaceTool.js +21 -0
- package/dist/tools/SearchWorkspaceTool.js.map +1 -0
- package/dist/tools/SemanticSearchTool.d.ts +12 -0
- package/dist/tools/SemanticSearchTool.d.ts.map +1 -0
- package/dist/tools/SemanticSearchTool.js +46 -0
- package/dist/tools/SemanticSearchTool.js.map +1 -0
- package/dist/tools/SkillTools.d.ts +3 -0
- package/dist/tools/SkillTools.d.ts.map +1 -0
- package/dist/tools/SkillTools.js +108 -0
- package/dist/tools/SkillTools.js.map +1 -0
- package/dist/tools/SpawnWorkerTool.d.ts +6 -0
- package/dist/tools/SpawnWorkerTool.d.ts.map +1 -0
- package/dist/tools/SpawnWorkerTool.js +28 -0
- package/dist/tools/SpawnWorkerTool.js.map +1 -0
- package/dist/tools/SubmitArtifactTool.d.ts +3 -0
- package/dist/tools/SubmitArtifactTool.d.ts.map +1 -0
- package/dist/tools/SubmitArtifactTool.js +121 -0
- package/dist/tools/SubmitArtifactTool.js.map +1 -0
- package/dist/tools/UndoEditTool.d.ts +3 -0
- package/dist/tools/UndoEditTool.d.ts.map +1 -0
- package/dist/tools/UndoEditTool.js +66 -0
- package/dist/tools/UndoEditTool.js.map +1 -0
- package/dist/tools/UpdateTodoTool.d.ts +6 -0
- package/dist/tools/UpdateTodoTool.d.ts.map +1 -0
- package/dist/tools/UpdateTodoTool.js +116 -0
- package/dist/tools/UpdateTodoTool.js.map +1 -0
- package/dist/tools/WebRetrievalTools.d.ts +4 -0
- package/dist/tools/WebRetrievalTools.d.ts.map +1 -0
- package/dist/tools/WebRetrievalTools.js +169 -0
- package/dist/tools/WebRetrievalTools.js.map +1 -0
- package/dist/tools/WriteFileTool.d.ts +6 -0
- package/dist/tools/WriteFileTool.d.ts.map +1 -0
- package/dist/tools/WriteFileTool.js +145 -0
- package/dist/tools/WriteFileTool.js.map +1 -0
- package/dist/tools/cleanSlateFileReadPolicy.d.ts +33 -0
- package/dist/tools/cleanSlateFileReadPolicy.d.ts.map +1 -0
- package/dist/tools/cleanSlateFileReadPolicy.js +84 -0
- package/dist/tools/cleanSlateFileReadPolicy.js.map +1 -0
- package/dist/tools/cleanSlateHostTypes.d.ts +100 -0
- package/dist/tools/cleanSlateHostTypes.d.ts.map +1 -0
- package/dist/tools/cleanSlateHostTypes.js +6 -0
- package/dist/tools/cleanSlateHostTypes.js.map +1 -0
- package/dist/tools/cleanSlatePlanArtifactPolicy.d.ts +47 -0
- package/dist/tools/cleanSlatePlanArtifactPolicy.d.ts.map +1 -0
- package/dist/tools/cleanSlatePlanArtifactPolicy.js +126 -0
- package/dist/tools/cleanSlatePlanArtifactPolicy.js.map +1 -0
- package/dist/tools/cleanSlateStaleDiagnosticPolicy.d.ts +3 -0
- package/dist/tools/cleanSlateStaleDiagnosticPolicy.d.ts.map +1 -0
- package/dist/tools/cleanSlateStaleDiagnosticPolicy.js +13 -0
- package/dist/tools/cleanSlateStaleDiagnosticPolicy.js.map +1 -0
- package/dist/tools/languageFeatureActivation.d.ts +13 -0
- package/dist/tools/languageFeatureActivation.d.ts.map +1 -0
- package/dist/tools/languageFeatureActivation.js +95 -0
- package/dist/tools/languageFeatureActivation.js.map +1 -0
- package/dist/tools/registry.d.ts +5 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +104 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/structuredEditCanonicalizer.d.ts +11 -0
- package/dist/tools/structuredEditCanonicalizer.d.ts.map +1 -0
- package/dist/tools/structuredEditCanonicalizer.js +44 -0
- package/dist/tools/structuredEditCanonicalizer.js.map +1 -0
- package/dist/tools/symbolContext.d.ts +36 -0
- package/dist/tools/symbolContext.d.ts.map +1 -0
- package/dist/tools/symbolContext.js +146 -0
- package/dist/tools/symbolContext.js.map +1 -0
- package/dist/tools/symbolEditResolver.d.ts +11 -0
- package/dist/tools/symbolEditResolver.d.ts.map +1 -0
- package/dist/tools/symbolEditResolver.js +259 -0
- package/dist/tools/symbolEditResolver.js.map +1 -0
- package/dist/tools/symbolIndex.d.ts +18 -0
- package/dist/tools/symbolIndex.d.ts.map +1 -0
- package/dist/tools/symbolIndex.js +235 -0
- package/dist/tools/symbolIndex.js.map +1 -0
- package/dist/tools/types.d.ts +108 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +6 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tools/utils.d.ts +56 -0
- package/dist/tools/utils.d.ts.map +1 -0
- package/dist/tools/utils.js +205 -0
- package/dist/tools/utils.js.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare class StopWatch {
|
|
2
|
+
private _startTime;
|
|
3
|
+
private _stopTime;
|
|
4
|
+
private readonly _now;
|
|
5
|
+
static create(highResolution?: boolean): StopWatch;
|
|
6
|
+
constructor(highResolution?: boolean);
|
|
7
|
+
stop(): void;
|
|
8
|
+
reset(): void;
|
|
9
|
+
elapsed(): number;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=stopwatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stopwatch.d.ts","sourceRoot":"","sources":["../../src/core/stopwatch.ts"],"names":[],"mappings":"AAYA,qBAAa,SAAS;IAErB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,SAAS,CAAS;IAE1B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAe;WAEtB,MAAM,CAAC,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS;gBAI7C,cAAc,CAAC,EAAE,OAAO;IAM7B,IAAI,IAAI,IAAI;IAIZ,KAAK,IAAI,IAAI;IAKb,OAAO,IAAI,MAAM;CAMxB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/*
|
|
6
|
+
* Vendored from microsoft/vscode (vs/base/common/stopwatch.ts) for @cleanslate/sdk.
|
|
7
|
+
* Changes: see packages/cleanslate-sdk/VENDOR.md.
|
|
8
|
+
*/
|
|
9
|
+
const performanceNow = globalThis.performance.now.bind(globalThis.performance);
|
|
10
|
+
export class StopWatch {
|
|
11
|
+
static create(highResolution) {
|
|
12
|
+
return new StopWatch(highResolution);
|
|
13
|
+
}
|
|
14
|
+
constructor(highResolution) {
|
|
15
|
+
this._now = highResolution === false ? Date.now : performanceNow;
|
|
16
|
+
this._startTime = this._now();
|
|
17
|
+
this._stopTime = -1;
|
|
18
|
+
}
|
|
19
|
+
stop() {
|
|
20
|
+
this._stopTime = this._now();
|
|
21
|
+
}
|
|
22
|
+
reset() {
|
|
23
|
+
this._startTime = this._now();
|
|
24
|
+
this._stopTime = -1;
|
|
25
|
+
}
|
|
26
|
+
elapsed() {
|
|
27
|
+
if (this._stopTime !== -1) {
|
|
28
|
+
return this._stopTime - this._startTime;
|
|
29
|
+
}
|
|
30
|
+
return this._now() - this._startTime;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=stopwatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stopwatch.js","sourceRoot":"","sources":["../../src/core/stopwatch.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;;GAGG;AAGH,MAAM,cAAc,GAAG,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;AAE/E,MAAM,OAAO,SAAS;IAOd,MAAM,CAAC,MAAM,CAAC,cAAwB;QAC5C,OAAO,IAAI,SAAS,CAAC,cAAc,CAAC,CAAC;IACtC,CAAC;IAED,YAAY,cAAwB;QACnC,IAAI,CAAC,IAAI,GAAG,cAAc,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,cAAc,CAAC;QACjE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAC9B,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;IACrB,CAAC;IAEM,IAAI;QACV,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC9B,CAAC;IAEM,KAAK;QACX,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAC9B,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;IACrB,CAAC;IAEM,OAAO;QACb,IAAI,IAAI,CAAC,SAAS,KAAK,CAAC,CAAC,EAAE,CAAC;YAC3B,OAAO,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC;QACzC,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC;IACtC,CAAC;CACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symbols.d.ts","sourceRoot":"","sources":["../../src/core/symbols.ts"],"names":[],"mappings":"AASA;;KAEK;AACL,eAAO,MAAM,cAAc,eAA2B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/*
|
|
6
|
+
* Vendored from microsoft/vscode (vs/base/common/symbols.ts) for @cleanslate/sdk.
|
|
7
|
+
* Changes: see packages/cleanslate-sdk/VENDOR.md.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Can be passed into the Delayed to defer using a microtask
|
|
11
|
+
* */
|
|
12
|
+
export const MicrotaskDelay = Symbol('MicrotaskDelay');
|
|
13
|
+
//# sourceMappingURL=symbols.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symbols.js","sourceRoot":"","sources":["../../src/core/symbols.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;;GAGG;AAEH;;KAEK;AACL,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @returns whether the provided parameter is a JavaScript String or not.
|
|
3
|
+
*/
|
|
4
|
+
export declare function isString(str: unknown): str is string;
|
|
5
|
+
/**
|
|
6
|
+
* @returns whether the provided parameter is a JavaScript Array and each element in the array is a string.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isStringArray(value: unknown): value is string[];
|
|
9
|
+
/**
|
|
10
|
+
* @returns whether the provided parameter is a JavaScript Array and each element in the array satisfies the provided type guard.
|
|
11
|
+
*/
|
|
12
|
+
export declare function isArrayOf<T>(value: unknown, check: (item: unknown) => item is T): value is T[];
|
|
13
|
+
/**
|
|
14
|
+
* @returns whether the provided parameter is of type `object` but **not**
|
|
15
|
+
* `null`, an `array`, a `regexp`, nor a `date`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function isObject(obj: unknown): obj is Object;
|
|
18
|
+
/**
|
|
19
|
+
* @returns whether the provided parameter is of type `Buffer` or Uint8Array dervived type
|
|
20
|
+
*/
|
|
21
|
+
export declare function isTypedArray(obj: unknown): obj is Object;
|
|
22
|
+
/**
|
|
23
|
+
* In **contrast** to just checking `typeof` this will return `false` for `NaN`.
|
|
24
|
+
* @returns whether the provided parameter is a JavaScript Number or not.
|
|
25
|
+
*/
|
|
26
|
+
export declare function isNumber(obj: unknown): obj is number;
|
|
27
|
+
/**
|
|
28
|
+
* @returns whether the provided parameter is an Iterable, casting to the given generic
|
|
29
|
+
*/
|
|
30
|
+
export declare function isIterable<T>(obj: unknown): obj is Iterable<T>;
|
|
31
|
+
/**
|
|
32
|
+
* @returns whether the provided parameter is an Iterable, casting to the given generic
|
|
33
|
+
*/
|
|
34
|
+
export declare function isAsyncIterable<T>(obj: unknown): obj is AsyncIterable<T>;
|
|
35
|
+
/**
|
|
36
|
+
* @returns whether the provided parameter is a JavaScript Boolean or not.
|
|
37
|
+
*/
|
|
38
|
+
export declare function isBoolean(obj: unknown): obj is boolean;
|
|
39
|
+
/**
|
|
40
|
+
* @returns whether the provided parameter is undefined.
|
|
41
|
+
*/
|
|
42
|
+
export declare function isUndefined(obj: unknown): obj is undefined;
|
|
43
|
+
/**
|
|
44
|
+
* @returns whether the provided parameter is defined.
|
|
45
|
+
*/
|
|
46
|
+
export declare function isDefined<T>(arg: T | null | undefined): arg is T;
|
|
47
|
+
/**
|
|
48
|
+
* @returns whether the provided parameter is undefined or null.
|
|
49
|
+
*/
|
|
50
|
+
export declare function isUndefinedOrNull(obj: unknown): obj is undefined | null;
|
|
51
|
+
export declare function assertType(condition: unknown, type?: string): asserts condition;
|
|
52
|
+
/**
|
|
53
|
+
* Asserts that the argument passed in is neither undefined nor null.
|
|
54
|
+
*
|
|
55
|
+
* @see {@link assertDefined} for a similar utility that leverages TS assertion functions to narrow down the type of `arg` to be non-nullable.
|
|
56
|
+
*/
|
|
57
|
+
export declare function assertReturnsDefined<T>(arg: T | null | undefined): NonNullable<T>;
|
|
58
|
+
/**
|
|
59
|
+
* Asserts that a provided `value` is `defined` - not `null` or `undefined`,
|
|
60
|
+
* throwing an error with the provided error or error message, while also
|
|
61
|
+
* narrowing down the type of the `value` to be `NonNullable` using TS
|
|
62
|
+
* assertion functions.
|
|
63
|
+
*
|
|
64
|
+
* @throws if the provided `value` is `null` or `undefined`.
|
|
65
|
+
*
|
|
66
|
+
* ## Examples
|
|
67
|
+
*
|
|
68
|
+
* ```typescript
|
|
69
|
+
* // an assert with an error message
|
|
70
|
+
* assertDefined('some value', 'String constant is not defined o_O.');
|
|
71
|
+
*
|
|
72
|
+
* // `throws!` the provided error
|
|
73
|
+
* assertDefined(null, new Error('Should throw this error.'));
|
|
74
|
+
*
|
|
75
|
+
* // narrows down the type of `someValue` to be non-nullable
|
|
76
|
+
* const someValue: string | undefined | null = blackbox();
|
|
77
|
+
* assertDefined(someValue, 'Some value must be defined.');
|
|
78
|
+
* console.log(someValue.length); // now type of `someValue` is `string`
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* @see {@link assertReturnsDefined} for a similar utility but without assertion.
|
|
82
|
+
* @see {@link https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#assertion-functions typescript-3-7.html#assertion-functions}
|
|
83
|
+
*/
|
|
84
|
+
export declare function assertDefined<T>(value: T, error: string | NonNullable<Error>): asserts value is NonNullable<T>;
|
|
85
|
+
/**
|
|
86
|
+
* Asserts that each argument passed in is neither undefined nor null.
|
|
87
|
+
*/
|
|
88
|
+
export declare function assertReturnsAllDefined<T1, T2>(t1: T1 | null | undefined, t2: T2 | null | undefined): [T1, T2];
|
|
89
|
+
export declare function assertReturnsAllDefined<T1, T2, T3>(t1: T1 | null | undefined, t2: T2 | null | undefined, t3: T3 | null | undefined): [T1, T2, T3];
|
|
90
|
+
export declare function assertReturnsAllDefined<T1, T2, T3, T4>(t1: T1 | null | undefined, t2: T2 | null | undefined, t3: T3 | null | undefined, t4: T4 | null | undefined): [T1, T2, T3, T4];
|
|
91
|
+
/**
|
|
92
|
+
* Checks if the provided value is one of the vales in the provided list.
|
|
93
|
+
*
|
|
94
|
+
* ## Examples
|
|
95
|
+
*
|
|
96
|
+
* ```typescript
|
|
97
|
+
* // note! item type is a `subset of string`
|
|
98
|
+
* type TItem = ':' | '.' | '/';
|
|
99
|
+
*
|
|
100
|
+
* // note! item is type of `string` here
|
|
101
|
+
* const item: string = ':';
|
|
102
|
+
* // list of the items to check against
|
|
103
|
+
* const list: TItem[] = [':', '.'];
|
|
104
|
+
*
|
|
105
|
+
* // ok
|
|
106
|
+
* assert(
|
|
107
|
+
* isOneOf(item, list),
|
|
108
|
+
* 'Must succeed.',
|
|
109
|
+
* );
|
|
110
|
+
*
|
|
111
|
+
* // `item` is of `TItem` type now
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
export declare const isOneOf: <TType, TSubtype extends TType>(value: TType, validValues: readonly TSubtype[]) => value is TSubtype;
|
|
115
|
+
/**
|
|
116
|
+
* Compile-time type check of a variable.
|
|
117
|
+
*/
|
|
118
|
+
export declare function typeCheck<T = never>(_thing: NoInfer<T>): void;
|
|
119
|
+
/**
|
|
120
|
+
* @returns whether the provided parameter is an empty JavaScript Object or not.
|
|
121
|
+
*/
|
|
122
|
+
export declare function isEmptyObject(obj: unknown): obj is object;
|
|
123
|
+
/**
|
|
124
|
+
* @returns whether the provided parameter is a JavaScript Function or not.
|
|
125
|
+
*/
|
|
126
|
+
export declare function isFunction(obj: unknown): obj is Function;
|
|
127
|
+
/**
|
|
128
|
+
* @returns whether the provided parameters is are JavaScript Function or not.
|
|
129
|
+
*/
|
|
130
|
+
export declare function areFunctions(...objects: unknown[]): boolean;
|
|
131
|
+
export type TypeConstraint = string | Function;
|
|
132
|
+
export declare function validateConstraints(args: unknown[], constraints: Array<TypeConstraint | undefined>): void;
|
|
133
|
+
export declare function validateConstraint(arg: unknown, constraint: TypeConstraint | undefined): void;
|
|
134
|
+
/**
|
|
135
|
+
* Helper type assertion that safely upcasts a type to a supertype.
|
|
136
|
+
*
|
|
137
|
+
* This can be used to make sure the argument correctly conforms to the subtype while still being able to pass it
|
|
138
|
+
* to contexts that expects the supertype.
|
|
139
|
+
*/
|
|
140
|
+
export declare function upcast<Base, Sub extends Base = Base>(x: Sub): Base;
|
|
141
|
+
type AddFirstParameterToFunction<T, TargetFunctionsReturnType, FirstParameter> = T extends (...args: any[]) => TargetFunctionsReturnType ? (firstArg: FirstParameter, ...args: Parameters<T>) => ReturnType<T> : T;
|
|
142
|
+
/**
|
|
143
|
+
* Allows to add a first parameter to functions of a type.
|
|
144
|
+
*/
|
|
145
|
+
export type AddFirstParameterToFunctions<Target, TargetFunctionsReturnType, FirstParameter> = {
|
|
146
|
+
[K in keyof Target]: AddFirstParameterToFunction<Target[K], TargetFunctionsReturnType, FirstParameter>;
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* Given an object with all optional properties, requires at least one to be defined.
|
|
150
|
+
* i.e. AtLeastOne<MyObject>;
|
|
151
|
+
*/
|
|
152
|
+
export type AtLeastOne<T, U = {
|
|
153
|
+
[K in keyof T]: Pick<T, K>;
|
|
154
|
+
}> = Partial<T> & U[keyof U];
|
|
155
|
+
/**
|
|
156
|
+
* Only picks the non-optional properties of a type.
|
|
157
|
+
*/
|
|
158
|
+
export type OmitOptional<T> = {
|
|
159
|
+
[K in keyof T as T[K] extends Required<T>[K] ? K : never]: T[K];
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* A type that removed readonly-less from all properties of `T`
|
|
163
|
+
*/
|
|
164
|
+
export type Mutable<T> = {
|
|
165
|
+
-readonly [P in keyof T]: T[P];
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* A type that adds readonly to all properties of T, recursively.
|
|
169
|
+
*/
|
|
170
|
+
export type DeepImmutable<T> = T extends (infer U)[] ? ReadonlyArray<DeepImmutable<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepImmutable<U>> : T extends Map<infer K, infer V> ? ReadonlyMap<K, DeepImmutable<V>> : T extends Set<infer U> ? ReadonlySet<DeepImmutable<U>> : T extends object ? {
|
|
171
|
+
readonly [K in keyof T]: DeepImmutable<T[K]>;
|
|
172
|
+
} : T;
|
|
173
|
+
/**
|
|
174
|
+
* A single object or an array of the objects.
|
|
175
|
+
*/
|
|
176
|
+
export type SingleOrMany<T> = T | T[];
|
|
177
|
+
/**
|
|
178
|
+
* Given a `type X = { foo?: string }` checking that an object `satisfies X`
|
|
179
|
+
* will ensure each property was explicitly defined, ensuring no properties
|
|
180
|
+
* are omitted or forgotten.
|
|
181
|
+
*/
|
|
182
|
+
export type WithDefinedProps<T> = {
|
|
183
|
+
[K in keyof Required<T>]: T[K];
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* A type that recursively makes all properties of `T` required
|
|
187
|
+
*/
|
|
188
|
+
export type DeepRequiredNonNullable<T> = {
|
|
189
|
+
[P in keyof T]-?: T[P] extends object ? DeepRequiredNonNullable<T[P]> : Required<NonNullable<T[P]>>;
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* Represents a type that is a partial version of a given type `T`, where all properties are optional and can be deeply nested.
|
|
193
|
+
*/
|
|
194
|
+
export type DeepPartial<T> = {
|
|
195
|
+
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : Partial<T[P]>;
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* Represents a type that is a partial version of a given type `T`, except a subset.
|
|
199
|
+
*/
|
|
200
|
+
export type PartialExcept<T, K extends keyof T> = Partial<Omit<T, K>> & Pick<T, K>;
|
|
201
|
+
type KeysOfUnionType<T> = T extends T ? keyof T : never;
|
|
202
|
+
type FilterType<T, TTest> = T extends TTest ? T : never;
|
|
203
|
+
type MakeOptionalAndTrue<T extends object> = {
|
|
204
|
+
[K in keyof T]?: true;
|
|
205
|
+
};
|
|
206
|
+
/**
|
|
207
|
+
* Type guard that checks if an object has specific keys and narrows the type accordingly.
|
|
208
|
+
*
|
|
209
|
+
* @param x - The object to check
|
|
210
|
+
* @param key - An object with boolean values indicating which keys to check for
|
|
211
|
+
* @returns true if all specified keys exist in the object, false otherwise
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* ```typescript
|
|
215
|
+
* type A = { a: string };
|
|
216
|
+
* type B = { b: number };
|
|
217
|
+
* const obj: A | B = getObject();
|
|
218
|
+
*
|
|
219
|
+
* if (hasKey(obj, { a: true })) {
|
|
220
|
+
* // obj is now narrowed to type A
|
|
221
|
+
* console.log(obj.a);
|
|
222
|
+
* }
|
|
223
|
+
* ```
|
|
224
|
+
*/
|
|
225
|
+
export declare function hasKey<T extends object, TKeys extends MakeOptionalAndTrue<T>>(x: T, key: TKeys): x is FilterType<T, {
|
|
226
|
+
[K in KeysOfUnionType<T> & keyof TKeys]: unknown;
|
|
227
|
+
}>;
|
|
228
|
+
export {};
|
|
229
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAWA;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,MAAM,CAEpD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,EAAE,CAE/D;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK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H,wBAAgB,MAAM,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,SAAS,mBAAmB,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,IAAI,UAAU,CAAC,CAAC,EAAE;KAAG,CAAC,IAAI,eAAe,CAAC,CAAC,CAAC,GAAG,MAAM,KAAK,GAAG,OAAO;CAAE,CAAC,CAOzK"}
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/*
|
|
6
|
+
* Vendored from microsoft/vscode (vs/base/common/types.ts) for @cleanslate/sdk.
|
|
7
|
+
* Changes: see packages/cleanslate-sdk/VENDOR.md.
|
|
8
|
+
*/
|
|
9
|
+
import { assert } from './assert.js';
|
|
10
|
+
/**
|
|
11
|
+
* @returns whether the provided parameter is a JavaScript String or not.
|
|
12
|
+
*/
|
|
13
|
+
export function isString(str) {
|
|
14
|
+
return (typeof str === 'string');
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @returns whether the provided parameter is a JavaScript Array and each element in the array is a string.
|
|
18
|
+
*/
|
|
19
|
+
export function isStringArray(value) {
|
|
20
|
+
return isArrayOf(value, isString);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @returns whether the provided parameter is a JavaScript Array and each element in the array satisfies the provided type guard.
|
|
24
|
+
*/
|
|
25
|
+
export function isArrayOf(value, check) {
|
|
26
|
+
return Array.isArray(value) && value.every(check);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @returns whether the provided parameter is of type `object` but **not**
|
|
30
|
+
* `null`, an `array`, a `regexp`, nor a `date`.
|
|
31
|
+
*/
|
|
32
|
+
export function isObject(obj) {
|
|
33
|
+
// The method can't do a type cast since there are type (like strings) which
|
|
34
|
+
// are subclasses of any put not positvely matched by the function. Hence type
|
|
35
|
+
// narrowing results in wrong results.
|
|
36
|
+
return typeof obj === 'object'
|
|
37
|
+
&& obj !== null
|
|
38
|
+
&& !Array.isArray(obj)
|
|
39
|
+
&& !(obj instanceof RegExp)
|
|
40
|
+
&& !(obj instanceof Date);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* @returns whether the provided parameter is of type `Buffer` or Uint8Array dervived type
|
|
44
|
+
*/
|
|
45
|
+
export function isTypedArray(obj) {
|
|
46
|
+
const TypedArray = Object.getPrototypeOf(Uint8Array);
|
|
47
|
+
return typeof obj === 'object'
|
|
48
|
+
&& obj instanceof TypedArray;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* In **contrast** to just checking `typeof` this will return `false` for `NaN`.
|
|
52
|
+
* @returns whether the provided parameter is a JavaScript Number or not.
|
|
53
|
+
*/
|
|
54
|
+
export function isNumber(obj) {
|
|
55
|
+
return (typeof obj === 'number' && !isNaN(obj));
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* @returns whether the provided parameter is an Iterable, casting to the given generic
|
|
59
|
+
*/
|
|
60
|
+
export function isIterable(obj) {
|
|
61
|
+
// eslint-disable-next-line local/code-no-any-casts
|
|
62
|
+
return !!obj && typeof obj[Symbol.iterator] === 'function';
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* @returns whether the provided parameter is an Iterable, casting to the given generic
|
|
66
|
+
*/
|
|
67
|
+
export function isAsyncIterable(obj) {
|
|
68
|
+
// eslint-disable-next-line local/code-no-any-casts
|
|
69
|
+
return !!obj && typeof obj[Symbol.asyncIterator] === 'function';
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* @returns whether the provided parameter is a JavaScript Boolean or not.
|
|
73
|
+
*/
|
|
74
|
+
export function isBoolean(obj) {
|
|
75
|
+
return (obj === true || obj === false);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* @returns whether the provided parameter is undefined.
|
|
79
|
+
*/
|
|
80
|
+
export function isUndefined(obj) {
|
|
81
|
+
return (typeof obj === 'undefined');
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* @returns whether the provided parameter is defined.
|
|
85
|
+
*/
|
|
86
|
+
export function isDefined(arg) {
|
|
87
|
+
return !isUndefinedOrNull(arg);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* @returns whether the provided parameter is undefined or null.
|
|
91
|
+
*/
|
|
92
|
+
export function isUndefinedOrNull(obj) {
|
|
93
|
+
return (isUndefined(obj) || obj === null);
|
|
94
|
+
}
|
|
95
|
+
export function assertType(condition, type) {
|
|
96
|
+
if (!condition) {
|
|
97
|
+
throw new Error(type ? `Unexpected type, expected '${type}'` : 'Unexpected type');
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Asserts that the argument passed in is neither undefined nor null.
|
|
102
|
+
*
|
|
103
|
+
* @see {@link assertDefined} for a similar utility that leverages TS assertion functions to narrow down the type of `arg` to be non-nullable.
|
|
104
|
+
*/
|
|
105
|
+
export function assertReturnsDefined(arg) {
|
|
106
|
+
assert(arg !== null && arg !== undefined, 'Argument is `undefined` or `null`.');
|
|
107
|
+
return arg;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Asserts that a provided `value` is `defined` - not `null` or `undefined`,
|
|
111
|
+
* throwing an error with the provided error or error message, while also
|
|
112
|
+
* narrowing down the type of the `value` to be `NonNullable` using TS
|
|
113
|
+
* assertion functions.
|
|
114
|
+
*
|
|
115
|
+
* @throws if the provided `value` is `null` or `undefined`.
|
|
116
|
+
*
|
|
117
|
+
* ## Examples
|
|
118
|
+
*
|
|
119
|
+
* ```typescript
|
|
120
|
+
* // an assert with an error message
|
|
121
|
+
* assertDefined('some value', 'String constant is not defined o_O.');
|
|
122
|
+
*
|
|
123
|
+
* // `throws!` the provided error
|
|
124
|
+
* assertDefined(null, new Error('Should throw this error.'));
|
|
125
|
+
*
|
|
126
|
+
* // narrows down the type of `someValue` to be non-nullable
|
|
127
|
+
* const someValue: string | undefined | null = blackbox();
|
|
128
|
+
* assertDefined(someValue, 'Some value must be defined.');
|
|
129
|
+
* console.log(someValue.length); // now type of `someValue` is `string`
|
|
130
|
+
* ```
|
|
131
|
+
*
|
|
132
|
+
* @see {@link assertReturnsDefined} for a similar utility but without assertion.
|
|
133
|
+
* @see {@link https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#assertion-functions typescript-3-7.html#assertion-functions}
|
|
134
|
+
*/
|
|
135
|
+
export function assertDefined(value, error) {
|
|
136
|
+
if (value === null || value === undefined) {
|
|
137
|
+
const errorToThrow = typeof error === 'string' ? new Error(error) : error;
|
|
138
|
+
throw errorToThrow;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
export function assertReturnsAllDefined(...args) {
|
|
142
|
+
const result = [];
|
|
143
|
+
for (let i = 0; i < args.length; i++) {
|
|
144
|
+
const arg = args[i];
|
|
145
|
+
if (isUndefinedOrNull(arg)) {
|
|
146
|
+
throw new Error(`Assertion Failed: argument at index ${i} is undefined or null`);
|
|
147
|
+
}
|
|
148
|
+
result.push(arg);
|
|
149
|
+
}
|
|
150
|
+
return result;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Checks if the provided value is one of the vales in the provided list.
|
|
154
|
+
*
|
|
155
|
+
* ## Examples
|
|
156
|
+
*
|
|
157
|
+
* ```typescript
|
|
158
|
+
* // note! item type is a `subset of string`
|
|
159
|
+
* type TItem = ':' | '.' | '/';
|
|
160
|
+
*
|
|
161
|
+
* // note! item is type of `string` here
|
|
162
|
+
* const item: string = ':';
|
|
163
|
+
* // list of the items to check against
|
|
164
|
+
* const list: TItem[] = [':', '.'];
|
|
165
|
+
*
|
|
166
|
+
* // ok
|
|
167
|
+
* assert(
|
|
168
|
+
* isOneOf(item, list),
|
|
169
|
+
* 'Must succeed.',
|
|
170
|
+
* );
|
|
171
|
+
*
|
|
172
|
+
* // `item` is of `TItem` type now
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
export const isOneOf = (value, validValues) => {
|
|
176
|
+
// note! it is OK to type cast here, because we rely on the includes
|
|
177
|
+
// utility to check if the value is present in the provided list
|
|
178
|
+
return validValues.includes(value);
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* Compile-time type check of a variable.
|
|
182
|
+
*/
|
|
183
|
+
export function typeCheck(_thing) { }
|
|
184
|
+
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
185
|
+
/**
|
|
186
|
+
* @returns whether the provided parameter is an empty JavaScript Object or not.
|
|
187
|
+
*/
|
|
188
|
+
export function isEmptyObject(obj) {
|
|
189
|
+
if (!isObject(obj)) {
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
for (const key in obj) {
|
|
193
|
+
if (hasOwnProperty.call(obj, key)) {
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return true;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* @returns whether the provided parameter is a JavaScript Function or not.
|
|
201
|
+
*/
|
|
202
|
+
export function isFunction(obj) {
|
|
203
|
+
return (typeof obj === 'function');
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* @returns whether the provided parameters is are JavaScript Function or not.
|
|
207
|
+
*/
|
|
208
|
+
export function areFunctions(...objects) {
|
|
209
|
+
return objects.length > 0 && objects.every(isFunction);
|
|
210
|
+
}
|
|
211
|
+
export function validateConstraints(args, constraints) {
|
|
212
|
+
const len = Math.min(args.length, constraints.length);
|
|
213
|
+
for (let i = 0; i < len; i++) {
|
|
214
|
+
validateConstraint(args[i], constraints[i]);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
export function validateConstraint(arg, constraint) {
|
|
218
|
+
if (isString(constraint)) {
|
|
219
|
+
if (typeof arg !== constraint) {
|
|
220
|
+
throw new Error(`argument does not match constraint: typeof ${constraint}`);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
else if (isFunction(constraint)) {
|
|
224
|
+
try {
|
|
225
|
+
if (arg instanceof constraint) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
catch {
|
|
230
|
+
// ignore
|
|
231
|
+
}
|
|
232
|
+
// eslint-disable-next-line local/code-no-any-casts
|
|
233
|
+
if (!isUndefinedOrNull(arg) && arg.constructor === constraint) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
if (constraint.length === 1 && constraint.call(undefined, arg) === true) {
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
throw new Error(`argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true`);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Helper type assertion that safely upcasts a type to a supertype.
|
|
244
|
+
*
|
|
245
|
+
* This can be used to make sure the argument correctly conforms to the subtype while still being able to pass it
|
|
246
|
+
* to contexts that expects the supertype.
|
|
247
|
+
*/
|
|
248
|
+
export function upcast(x) {
|
|
249
|
+
return x;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Type guard that checks if an object has specific keys and narrows the type accordingly.
|
|
253
|
+
*
|
|
254
|
+
* @param x - The object to check
|
|
255
|
+
* @param key - An object with boolean values indicating which keys to check for
|
|
256
|
+
* @returns true if all specified keys exist in the object, false otherwise
|
|
257
|
+
*
|
|
258
|
+
* @example
|
|
259
|
+
* ```typescript
|
|
260
|
+
* type A = { a: string };
|
|
261
|
+
* type B = { b: number };
|
|
262
|
+
* const obj: A | B = getObject();
|
|
263
|
+
*
|
|
264
|
+
* if (hasKey(obj, { a: true })) {
|
|
265
|
+
* // obj is now narrowed to type A
|
|
266
|
+
* console.log(obj.a);
|
|
267
|
+
* }
|
|
268
|
+
* ```
|
|
269
|
+
*/
|
|
270
|
+
export function hasKey(x, key) {
|
|
271
|
+
for (const k in key) {
|
|
272
|
+
if (!(k in x)) {
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return true;
|
|
277
|
+
}
|
|
278
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAY;IACpC,OAAO,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC3C,OAAO,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAI,KAAc,EAAE,KAAmC;IAC/E,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACnD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAY;IACpC,4EAA4E;IAC5E,8EAA8E;IAC9E,sCAAsC;IACtC,OAAO,OAAO,GAAG,KAAK,QAAQ;WAC1B,GAAG,KAAK,IAAI;WACZ,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;WACnB,CAAC,CAAC,GAAG,YAAY,MAAM,CAAC;WACxB,CAAC,CAAC,GAAG,YAAY,IAAI,CAAC,CAAC;AAC5B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,GAAY;IACxC,MAAM,UAAU,GAAG,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IACrD,OAAO,OAAO,GAAG,KAAK,QAAQ;WAC1B,GAAG,YAAY,UAAU,CA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U,EAAE,CAAC,CAAC;QAC7E,CAAC;IACF,CAAC;SAAM,IAAI,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QACnC,IAAI,CAAC;YACJ,IAAI,GAAG,YAAY,UAAU,EAAE,CAAC;gBAC/B,OAAO;YACR,CAAC;QACF,CAAC;QAAC,MAAM,CAAC;YACR,SAAS;QACV,CAAC;QACD,mDAAmD;QACnD,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAK,GAAW,CAAC,WAAW,KAAK,UAAU,EAAE,CAAC;YACxE,OAAO;QACR,CAAC;QACD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC;YACzE,OAAO;QACR,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,2IAA2I,CAAC,CAAC;IAC9J,CAAC;AACF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,MAAM,CAAgC,CAAM;IAC3D,OAAO,CAAC,CAAC;AACV,CAAC;AA0FD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,MAAM,CAAyD,CAAI,EAAE,GAAU;IAC9F,KAAK,MAAM,CAAC,IAAI,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;YACf,OAAO,KAAK,CAAC;QACd,CAAC;IACF,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare enum Constants {
|
|
2
|
+
/**
|
|
3
|
+
* MAX SMI (SMall Integer) as defined in v8.
|
|
4
|
+
* one bit is lost for boxing/unboxing flag.
|
|
5
|
+
* one bit is lost for sign flag.
|
|
6
|
+
* See https://thibaultlaurens.github.io/javascript/2013/04/29/how-the-v8-engine-works/#tagged-values
|
|
7
|
+
*/
|
|
8
|
+
MAX_SAFE_SMALL_INTEGER = 1073741824,
|
|
9
|
+
/**
|
|
10
|
+
* MIN SMI (SMall Integer) as defined in v8.
|
|
11
|
+
* one bit is lost for boxing/unboxing flag.
|
|
12
|
+
* one bit is lost for sign flag.
|
|
13
|
+
* See https://thibaultlaurens.github.io/javascript/2013/04/29/how-the-v8-engine-works/#tagged-values
|
|
14
|
+
*/
|
|
15
|
+
MIN_SAFE_SMALL_INTEGER = -1073741824,
|
|
16
|
+
/**
|
|
17
|
+
* Max unsigned integer that fits on 8 bits.
|
|
18
|
+
*/
|
|
19
|
+
MAX_UINT_8 = 255,// 2^8 - 1
|
|
20
|
+
/**
|
|
21
|
+
* Max unsigned integer that fits on 16 bits.
|
|
22
|
+
*/
|
|
23
|
+
MAX_UINT_16 = 65535,// 2^16 - 1
|
|
24
|
+
/**
|
|
25
|
+
* Max unsigned integer that fits on 32 bits.
|
|
26
|
+
*/
|
|
27
|
+
MAX_UINT_32 = 4294967295,// 2^32 - 1
|
|
28
|
+
UNICODE_SUPPLEMENTARY_PLANE_BEGIN = 65536
|
|
29
|
+
}
|
|
30
|
+
export declare function toUint8(v: number): number;
|
|
31
|
+
export declare function toUint32(v: number): number;
|
|
32
|
+
//# sourceMappingURL=uint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uint.d.ts","sourceRoot":"","sources":["../../src/core/uint.ts"],"names":[],"mappings":"AASA,oBAAY,SAAS;IACpB;;;;;OAKG;IACH,sBAAsB,aAAU;IAEhC;;;;;OAKG;IACH,sBAAsB,cAAa;IAEnC;;OAEG;IACH,UAAU,MAAM,CAAE,UAAU;IAE5B;;OAEG;IACH,WAAW,QAAQ,CAAE,WAAW;IAEhC;;OAEG;IACH,WAAW,aAAa,CAAE,WAAW;IAErC,iCAAiC,QAAW;CAC5C;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAQzC;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAQ1C"}
|