liminal 0.4.0 → 0.5.1
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/Action.ts +29 -0
- package/Actor.ts +20 -0
- package/CHANGELOG.md +14 -0
- package/Exec.ts +63 -0
- package/L.ts +27 -0
- package/LiminalAssertionError.ts +3 -0
- package/LiminalConfig.ts +7 -0
- package/Message.ts +94 -0
- package/Model.ts +20 -0
- package/PathLike.ts +19 -0
- package/Scope.ts +133 -0
- package/Spec.ts +29 -0
- package/Tool.ts +58 -0
- package/_.ts +11 -0
- package/actions/abort.ts +23 -0
- package/actions/actions_common/updateModels.ts +23 -0
- package/actions/actions_derived/__snapshots__/declareModel.test.ts.snap +89 -0
- package/actions/actions_derived/clear.ts +6 -0
- package/actions/actions_derived/declareModel.test.ts +33 -0
- package/actions/actions_derived/declareModel.ts +9 -0
- package/actions/actions_derived/declareModel.type-test.ts +70 -0
- package/actions/actions_derived/getMessages.ts +9 -0
- package/actions/actions_derived/messages.test.ts +88 -0
- package/actions/actions_derived/messages.ts +19 -0
- package/actions/actions_derived/metatype.ts +9 -0
- package/actions/appendMessage.ts +30 -0
- package/actions/await.ts +13 -0
- package/actions/branch.ts +108 -0
- package/actions/catch.ts +42 -0
- package/actions/declareArg.ts +14 -0
- package/actions/disableTool.ts +26 -0
- package/actions/embed.ts +28 -0
- package/actions/emit.ts +21 -0
- package/actions/enableTool.ts +75 -0
- package/actions/enableTool.type-test.ts +118 -0
- package/actions/getScope.ts +11 -0
- package/actions/getSignal.ts +10 -0
- package/actions/getTools.ts +11 -0
- package/actions/infer.ts +37 -0
- package/actions/pushModel.ts +32 -0
- package/actions/removeMessage.ts +22 -0
- package/actions/removeModel.ts +31 -0
- package/actions/setMessages.ts +66 -0
- package/actions/throw.ts +18 -0
- package/cli/WriteHandler.ts +35 -0
- package/cli/cli_common.ts +3 -0
- package/cli/main.ts +19 -0
- package/cli/runExec.ts +68 -0
- package/dist/Action.d.ts +15 -0
- package/dist/Action.js +13 -0
- package/dist/Action.js.map +1 -0
- package/dist/Actor.d.ts +14 -0
- package/dist/Actor.js +2 -0
- package/dist/Actor.js.map +1 -0
- package/dist/Exec.d.ts +27 -0
- package/dist/Exec.js +22 -0
- package/dist/Exec.js.map +1 -0
- package/dist/L.d.ts +26 -0
- package/dist/L.js +27 -0
- package/dist/L.js.map +1 -0
- package/dist/LiminalAssertionError.d.ts +3 -0
- package/dist/LiminalAssertionError.js +4 -0
- package/dist/LiminalAssertionError.js.map +1 -0
- package/dist/LiminalConfig.d.ts +6 -0
- package/dist/LiminalConfig.js +2 -0
- package/dist/LiminalConfig.js.map +1 -0
- package/dist/Message.d.ts +82 -0
- package/dist/Message.js +2 -0
- package/dist/Message.js.map +1 -0
- package/dist/Model.d.ts +16 -0
- package/dist/Model.js +2 -0
- package/dist/Model.js.map +1 -0
- package/dist/PathLike.d.ts +14 -0
- package/dist/PathLike.js +2 -0
- package/dist/PathLike.js.map +1 -0
- package/dist/Scope.d.ts +36 -0
- package/dist/Scope.js +90 -0
- package/dist/Scope.js.map +1 -0
- package/dist/Spec.d.ts +20 -0
- package/dist/Spec.js +2 -0
- package/dist/Spec.js.map +1 -0
- package/dist/Tool.d.ts +21 -0
- package/dist/Tool.js +32 -0
- package/dist/Tool.js.map +1 -0
- package/dist/_.d.ts +5 -0
- package/dist/_.js +7 -0
- package/dist/_.js.map +1 -0
- package/dist/actions/abort.d.ts +9 -0
- package/dist/actions/abort.js +15 -0
- package/dist/actions/abort.js.map +1 -0
- package/dist/actions/actions_common/updateModels.d.ts +3 -0
- package/dist/actions/actions_common/updateModels.js +17 -0
- package/dist/actions/actions_common/updateModels.js.map +1 -0
- package/dist/actions/actions_derived/clear.d.ts +8 -0
- package/dist/actions/actions_derived/clear.js +5 -0
- package/dist/actions/actions_derived/clear.js.map +1 -0
- package/dist/actions/actions_derived/declareModel.d.ts +5 -0
- package/dist/actions/actions_derived/declareModel.js +7 -0
- package/dist/actions/actions_derived/declareModel.js.map +1 -0
- package/dist/actions/actions_derived/declareModel.test.d.ts +1 -0
- package/dist/actions/actions_derived/declareModel.test.js +32 -0
- package/dist/actions/actions_derived/declareModel.test.js.map +1 -0
- package/dist/actions/actions_derived/declareModel.type-test.d.ts +1 -0
- package/dist/actions/actions_derived/declareModel.type-test.js +66 -0
- package/dist/actions/actions_derived/declareModel.type-test.js.map +1 -0
- package/dist/actions/actions_derived/getMessages.d.ts +3 -0
- package/dist/actions/actions_derived/getMessages.js +8 -0
- package/dist/actions/actions_derived/getMessages.js.map +1 -0
- package/dist/actions/actions_derived/messages.d.ts +6 -0
- package/dist/actions/actions_derived/messages.js +15 -0
- package/dist/actions/actions_derived/messages.js.map +1 -0
- package/dist/actions/actions_derived/messages.test.d.ts +1 -0
- package/dist/actions/actions_derived/messages.test.js +72 -0
- package/dist/actions/actions_derived/messages.test.js.map +1 -0
- package/dist/actions/actions_derived/metatype.d.ts +9 -0
- package/dist/actions/actions_derived/metatype.js +7 -0
- package/dist/actions/actions_derived/metatype.js.map +1 -0
- package/dist/actions/appendMessage.d.ts +10 -0
- package/dist/actions/appendMessage.js +20 -0
- package/dist/actions/appendMessage.js.map +1 -0
- package/dist/actions/await.d.ts +5 -0
- package/dist/actions/await.js +10 -0
- package/dist/actions/await.js.map +1 -0
- package/dist/actions/branch.d.ts +35 -0
- package/dist/actions/branch.js +40 -0
- package/dist/actions/branch.js.map +1 -0
- package/dist/actions/catch.d.ts +10 -0
- package/dist/actions/catch.js +27 -0
- package/dist/actions/catch.js.map +1 -0
- package/dist/actions/declareArg.d.ts +8 -0
- package/dist/actions/declareArg.js +10 -0
- package/dist/actions/declareArg.js.map +1 -0
- package/dist/actions/disableTool.d.ts +10 -0
- package/dist/actions/disableTool.js +17 -0
- package/dist/actions/disableTool.js.map +1 -0
- package/dist/actions/embed.d.ts +9 -0
- package/dist/actions/embed.js +23 -0
- package/dist/actions/embed.js.map +1 -0
- package/dist/actions/emit.d.ts +9 -0
- package/dist/actions/emit.js +14 -0
- package/dist/actions/emit.js.map +1 -0
- package/dist/actions/enableTool.d.ts +20 -0
- package/dist/actions/enableTool.js +26 -0
- package/dist/actions/enableTool.js.map +1 -0
- package/dist/actions/enableTool.type-test.d.ts +1 -0
- package/dist/actions/enableTool.type-test.js +30 -0
- package/dist/actions/enableTool.type-test.js.map +1 -0
- package/dist/actions/getScope.d.ts +5 -0
- package/dist/actions/getScope.js +8 -0
- package/dist/actions/getScope.js.map +1 -0
- package/dist/actions/getSignal.d.ts +4 -0
- package/dist/actions/getSignal.js +8 -0
- package/dist/actions/getSignal.js.map +1 -0
- package/dist/actions/getTools.d.ts +5 -0
- package/dist/actions/getTools.js +8 -0
- package/dist/actions/getTools.js.map +1 -0
- package/dist/actions/infer.d.ts +13 -0
- package/dist/actions/infer.js +21 -0
- package/dist/actions/infer.js.map +1 -0
- package/dist/actions/pushModel.d.ts +11 -0
- package/dist/actions/pushModel.js +21 -0
- package/dist/actions/pushModel.js.map +1 -0
- package/dist/actions/removeMessage.d.ts +9 -0
- package/dist/actions/removeMessage.js +17 -0
- package/dist/actions/removeMessage.js.map +1 -0
- package/dist/actions/removeModel.d.ts +10 -0
- package/dist/actions/removeModel.js +20 -0
- package/dist/actions/removeModel.js.map +1 -0
- package/dist/actions/setMessages.d.ts +16 -0
- package/dist/actions/setMessages.js +31 -0
- package/dist/actions/setMessages.js.map +1 -0
- package/dist/actions/throw.d.ts +9 -0
- package/dist/actions/throw.js +13 -0
- package/dist/actions/throw.js.map +1 -0
- package/dist/cli/WriteHandler.d.ts +9 -0
- package/dist/cli/WriteHandler.js +24 -0
- package/dist/cli/WriteHandler.js.map +1 -0
- package/dist/cli/cli_common.d.ts +3 -0
- package/dist/cli/cli_common.js +2 -0
- package/dist/cli/cli_common.js.map +1 -0
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.js +15 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/runExec.d.ts +2 -0
- package/dist/cli/runExec.js +69 -0
- package/dist/cli/runExec.js.map +1 -0
- package/dist/events/Aborted.d.ts +4 -0
- package/dist/events/Aborted.js +2 -0
- package/dist/events/Aborted.js.map +1 -0
- package/dist/events/Embedded.d.ts +5 -0
- package/dist/events/Embedded.js +2 -0
- package/dist/events/Embedded.js.map +1 -0
- package/dist/events/EmbeddingRequested.d.ts +4 -0
- package/dist/events/EmbeddingRequested.js +2 -0
- package/dist/events/EmbeddingRequested.js.map +1 -0
- package/dist/events/Emitted.d.ts +4 -0
- package/dist/events/Emitted.js +2 -0
- package/dist/events/Emitted.js.map +1 -0
- package/dist/events/EventBase.d.ts +3 -0
- package/dist/events/EventBase.js +2 -0
- package/dist/events/EventBase.js.map +1 -0
- package/dist/events/EventHandler.d.ts +2 -0
- package/dist/events/EventHandler.js +2 -0
- package/dist/events/EventHandler.js.map +1 -0
- package/dist/events/EventResolved.d.ts +19 -0
- package/dist/events/EventResolved.js +2 -0
- package/dist/events/EventResolved.js.map +1 -0
- package/dist/events/Forked.d.ts +3 -0
- package/dist/events/Forked.js +2 -0
- package/dist/events/Forked.js.map +1 -0
- package/dist/events/InferenceRequested.d.ts +3 -0
- package/dist/events/InferenceRequested.js +2 -0
- package/dist/events/InferenceRequested.js.map +1 -0
- package/dist/events/Inferred.d.ts +5 -0
- package/dist/events/Inferred.js +2 -0
- package/dist/events/Inferred.js.map +1 -0
- package/dist/events/LEvent.d.ts +18 -0
- package/dist/events/LEvent.js +2 -0
- package/dist/events/LEvent.js.map +1 -0
- package/dist/events/MessageAppended.d.ts +5 -0
- package/dist/events/MessageAppended.js +2 -0
- package/dist/events/MessageAppended.js.map +1 -0
- package/dist/events/MessageRemoved.d.ts +5 -0
- package/dist/events/MessageRemoved.js +2 -0
- package/dist/events/MessageRemoved.js.map +1 -0
- package/dist/events/MessagesSet.d.ts +5 -0
- package/dist/events/MessagesSet.js +2 -0
- package/dist/events/MessagesSet.js.map +1 -0
- package/dist/events/ModelPushed.d.ts +7 -0
- package/dist/events/ModelPushed.js +2 -0
- package/dist/events/ModelPushed.js.map +1 -0
- package/dist/events/ModelRemoved.d.ts +7 -0
- package/dist/events/ModelRemoved.js +2 -0
- package/dist/events/ModelRemoved.js.map +1 -0
- package/dist/events/Returned.d.ts +4 -0
- package/dist/events/Returned.js +2 -0
- package/dist/events/Returned.js.map +1 -0
- package/dist/events/Threw.d.ts +4 -0
- package/dist/events/Threw.js +2 -0
- package/dist/events/Threw.js.map +1 -0
- package/dist/events/ToolCalled.d.ts +6 -0
- package/dist/events/ToolCalled.js +2 -0
- package/dist/events/ToolCalled.js.map +1 -0
- package/dist/events/ToolDisabled.d.ts +5 -0
- package/dist/events/ToolDisabled.js +2 -0
- package/dist/events/ToolDisabled.js.map +1 -0
- package/dist/events/ToolEnabled.d.ts +7 -0
- package/dist/events/ToolEnabled.js +2 -0
- package/dist/events/ToolEnabled.js.map +1 -0
- package/dist/events/isScopeChildEvent.d.ts +6 -0
- package/dist/events/isScopeChildEvent.js +9 -0
- package/dist/events/isScopeChildEvent.js.map +1 -0
- package/dist/events/isScopeDescendantEvent.d.ts +14 -0
- package/dist/events/isScopeDescendantEvent.js +12 -0
- package/dist/events/isScopeDescendantEvent.js.map +1 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -0
- package/dist/testing/ActorAssertions.d.ts +9 -0
- package/dist/testing/ActorAssertions.js +6 -0
- package/dist/testing/ActorAssertions.js.map +1 -0
- package/dist/testing/TestEmbeddingModel.d.ts +6 -0
- package/dist/testing/TestEmbeddingModel.js +10 -0
- package/dist/testing/TestEmbeddingModel.js.map +1 -0
- package/dist/testing/TestLanguageModel.d.ts +8 -0
- package/dist/testing/TestLanguageModel.js +21 -0
- package/dist/testing/TestLanguageModel.js.map +1 -0
- package/dist/testing/index.d.ts +4 -0
- package/dist/testing/index.js +5 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/takeFirstAction.d.ts +3 -0
- package/dist/testing/takeFirstAction.js +6 -0
- package/dist/testing/takeFirstAction.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/AssertDiagnostics.d.ts +18 -0
- package/dist/types/AssertDiagnostics.js +152 -0
- package/dist/types/AssertDiagnostics.js.map +1 -0
- package/dist/types/JSONRootType.d.ts +6 -0
- package/dist/types/JSONRootType.js +2 -0
- package/dist/types/JSONRootType.js.map +1 -0
- package/dist/types/JSONType.d.ts +16 -0
- package/dist/types/JSONType.js +2 -0
- package/dist/types/JSONType.js.map +1 -0
- package/dist/types/JSONTypeBase.d.ts +3 -0
- package/dist/types/JSONTypeBase.js +2 -0
- package/dist/types/JSONTypeBase.js.map +1 -0
- package/dist/types/Metatype/MetatypeDescriptor.d.ts +41 -0
- package/dist/types/Metatype/MetatypeDescriptor.js +38 -0
- package/dist/types/Metatype/MetatypeDescriptor.js.map +1 -0
- package/dist/types/Metatype/fromMetatypeDescriptor.d.ts +6 -0
- package/dist/types/Metatype/fromMetatypeDescriptor.js +43 -0
- package/dist/types/Metatype/fromMetatypeDescriptor.js.map +1 -0
- package/dist/types/Type.d.ts +30 -0
- package/dist/types/Type.js +5 -0
- package/dist/types/Type.js.map +1 -0
- package/dist/types/TypeContext.d.ts +7 -0
- package/dist/types/TypeContext.js +17 -0
- package/dist/types/TypeContext.js.map +1 -0
- package/dist/types/TypeLike.d.ts +23 -0
- package/dist/types/TypeLike.js +23 -0
- package/dist/types/TypeLike.js.map +1 -0
- package/dist/types/TypeVisitor.d.ts +14 -0
- package/dist/types/TypeVisitor.js +12 -0
- package/dist/types/TypeVisitor.js.map +1 -0
- package/dist/types/array.d.ts +10 -0
- package/dist/types/array.js +9 -0
- package/dist/types/array.js.map +1 -0
- package/dist/types/boolean.d.ts +6 -0
- package/dist/types/boolean.js +3 -0
- package/dist/types/boolean.js.map +1 -0
- package/dist/types/const.d.ts +8 -0
- package/dist/types/const.js +7 -0
- package/dist/types/const.js.map +1 -0
- package/dist/types/declareType.d.ts +2 -0
- package/dist/types/declareType.js +57 -0
- package/dist/types/declareType.js.map +1 -0
- package/dist/types/enum.d.ts +8 -0
- package/dist/types/enum.js +7 -0
- package/dist/types/enum.js.map +1 -0
- package/dist/types/factories.d.ts +8 -0
- package/dist/types/factories.js +9 -0
- package/dist/types/factories.js.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/integer.d.ts +6 -0
- package/dist/types/integer.js +3 -0
- package/dist/types/integer.js.map +1 -0
- package/dist/types/intrinsics.d.ts +11 -0
- package/dist/types/intrinsics.js +12 -0
- package/dist/types/intrinsics.js.map +1 -0
- package/dist/types/match.d.ts +3 -0
- package/dist/types/match.js +11 -0
- package/dist/types/match.js.map +1 -0
- package/dist/types/non_factories.d.ts +21 -0
- package/dist/types/non_factories.js +9 -0
- package/dist/types/non_factories.js.map +1 -0
- package/dist/types/null.d.ts +7 -0
- package/dist/types/null.js +4 -0
- package/dist/types/null.js.map +1 -0
- package/dist/types/number.d.ts +6 -0
- package/dist/types/number.js +3 -0
- package/dist/types/number.js.map +1 -0
- package/dist/types/object.d.ts +16 -0
- package/dist/types/object.js +10 -0
- package/dist/types/object.js.map +1 -0
- package/dist/types/ref.d.ts +7 -0
- package/dist/types/ref.js +5 -0
- package/dist/types/ref.js.map +1 -0
- package/dist/types/string.d.ts +6 -0
- package/dist/types/string.js +3 -0
- package/dist/types/string.js.map +1 -0
- package/dist/types/toJSON.d.ts +5 -0
- package/dist/types/toJSON.js +97 -0
- package/dist/types/toJSON.js.map +1 -0
- package/dist/types/type_common.d.ts +10 -0
- package/dist/types/type_common.js +12 -0
- package/dist/types/type_common.js.map +1 -0
- package/dist/types/types_derived/option.d.ts +5 -0
- package/dist/types/types_derived/option.js +6 -0
- package/dist/types/types_derived/option.js.map +1 -0
- package/dist/types/types_derived/taggedUnion.d.ts +19 -0
- package/dist/types/types_derived/taggedUnion.js +8 -0
- package/dist/types/types_derived/taggedUnion.js.map +1 -0
- package/dist/types/types_derived/wrapper.d.ts +8 -0
- package/dist/types/types_derived/wrapper.js +5 -0
- package/dist/types/types_derived/wrapper.js.map +1 -0
- package/dist/types/union.d.ts +9 -0
- package/dist/types/union.js +9 -0
- package/dist/types/union.js.map +1 -0
- package/dist/util/ArrayOfLength.d.ts +1 -0
- package/dist/util/ArrayOfLength.js +2 -0
- package/dist/util/ArrayOfLength.js.map +1 -0
- package/dist/util/DeferredOr.d.ts +1 -0
- package/dist/util/DeferredOr.js +2 -0
- package/dist/util/DeferredOr.js.map +1 -0
- package/dist/util/EnsureNarrow.d.ts +2 -0
- package/dist/util/EnsureNarrow.js +2 -0
- package/dist/util/EnsureNarrow.js.map +1 -0
- package/dist/util/EnsureRecord.d.ts +2 -0
- package/dist/util/EnsureRecord.js +2 -0
- package/dist/util/EnsureRecord.js.map +1 -0
- package/dist/util/Expand.d.ts +3 -0
- package/dist/util/Expand.js +2 -0
- package/dist/util/Expand.js.map +1 -0
- package/dist/util/Falsy.d.ts +1 -0
- package/dist/util/Falsy.js +2 -0
- package/dist/util/Falsy.js.map +1 -0
- package/dist/util/FromEntries.d.ts +3 -0
- package/dist/util/FromEntries.js +2 -0
- package/dist/util/FromEntries.js.map +1 -0
- package/dist/util/IteratorLike.d.ts +1 -0
- package/dist/util/IteratorLike.js +2 -0
- package/dist/util/IteratorLike.js.map +1 -0
- package/dist/util/JSONEntry.d.ts +2 -0
- package/dist/util/JSONEntry.js +2 -0
- package/dist/util/JSONEntry.js.map +1 -0
- package/dist/util/JSONKey.d.ts +1 -0
- package/dist/util/JSONKey.js +2 -0
- package/dist/util/JSONKey.js.map +1 -0
- package/dist/util/JSONObject.d.ts +5 -0
- package/dist/util/JSONObject.js +2 -0
- package/dist/util/JSONObject.js.map +1 -0
- package/dist/util/JSONSchemaMemo.d.ts +2 -0
- package/dist/util/JSONSchemaMemo.js +13 -0
- package/dist/util/JSONSchemaMemo.js.map +1 -0
- package/dist/util/JSONValue.d.ts +2 -0
- package/dist/util/JSONValue.js +2 -0
- package/dist/util/JSONValue.js.map +1 -0
- package/dist/util/PromiseOr.d.ts +1 -0
- package/dist/util/PromiseOr.js +2 -0
- package/dist/util/PromiseOr.js.map +1 -0
- package/dist/util/Result.d.ts +7 -0
- package/dist/util/Result.js +2 -0
- package/dist/util/Result.js.map +1 -0
- package/dist/util/Taggable.d.ts +9 -0
- package/dist/util/Taggable.js +8 -0
- package/dist/util/Taggable.js.map +1 -0
- package/dist/util/TupleToRecord.d.ts +5 -0
- package/dist/util/TupleToRecord.js +2 -0
- package/dist/util/TupleToRecord.js.map +1 -0
- package/dist/util/assert.d.ts +1 -0
- package/dist/util/assert.js +7 -0
- package/dist/util/assert.js.map +1 -0
- package/dist/util/dedent.d.ts +1 -0
- package/dist/util/dedent.js +5 -0
- package/dist/util/dedent.js.map +1 -0
- package/dist/util/fixTemplateStrings.d.ts +11 -0
- package/dist/util/fixTemplateStrings.js +83 -0
- package/dist/util/fixTemplateStrings.js.map +1 -0
- package/dist/util/fixTemplateStrings.test.d.ts +1 -0
- package/dist/util/fixTemplateStrings.test.js +221 -0
- package/dist/util/fixTemplateStrings.test.js.map +1 -0
- package/dist/util/isAsyncIterator.d.ts +1 -0
- package/dist/util/isAsyncIterator.js +7 -0
- package/dist/util/isAsyncIterator.js.map +1 -0
- package/dist/util/isIterator.d.ts +1 -0
- package/dist/util/isIterator.js +7 -0
- package/dist/util/isIterator.js.map +1 -0
- package/dist/util/isJSONValue.d.ts +2 -0
- package/dist/util/isJSONValue.js +16 -0
- package/dist/util/isJSONValue.js.map +1 -0
- package/dist/util/isPropertyKey.d.ts +1 -0
- package/dist/util/isPropertyKey.js +4 -0
- package/dist/util/isPropertyKey.js.map +1 -0
- package/dist/util/isTemplateStringsArray.d.ts +1 -0
- package/dist/util/isTemplateStringsArray.js +4 -0
- package/dist/util/isTemplateStringsArray.js.map +1 -0
- package/dist/util/jsonEquals.d.ts +2 -0
- package/dist/util/jsonEquals.js +33 -0
- package/dist/util/jsonEquals.js.map +1 -0
- package/dist/util/nullaryMemo.d.ts +1 -0
- package/dist/util/nullaryMemo.js +12 -0
- package/dist/util/nullaryMemo.js.map +1 -0
- package/dist/util/unimplemented.d.ts +1 -0
- package/dist/util/unimplemented.js +5 -0
- package/dist/util/unimplemented.js.map +1 -0
- package/dist/util/unreachable.d.ts +1 -0
- package/dist/util/unreachable.js +5 -0
- package/dist/util/unreachable.js.map +1 -0
- package/dist/util/unwrapDeferred.d.ts +2 -0
- package/dist/util/unwrapDeferred.js +4 -0
- package/dist/util/unwrapDeferred.js.map +1 -0
- package/dist/util/util.d.ts +10 -0
- package/dist/util/util.js +11 -0
- package/dist/util/util.js.map +1 -0
- package/events/Aborted.ts +5 -0
- package/events/Embedded.ts +6 -0
- package/events/EmbeddingRequested.ts +5 -0
- package/events/Emitted.ts +5 -0
- package/events/EventBase.ts +3 -0
- package/events/EventHandler.ts +3 -0
- package/events/EventResolved.ts +30 -0
- package/events/Forked.ts +3 -0
- package/events/InferenceRequested.ts +3 -0
- package/events/Inferred.ts +6 -0
- package/events/LEvent.ts +36 -0
- package/events/MessageAppended.ts +6 -0
- package/events/MessageRemoved.ts +6 -0
- package/events/MessagesSet.ts +6 -0
- package/events/ModelPushed.ts +10 -0
- package/events/ModelRemoved.ts +10 -0
- package/events/Returned.ts +5 -0
- package/events/Threw.ts +5 -0
- package/events/ToolCalled.ts +7 -0
- package/events/ToolDisabled.ts +6 -0
- package/events/ToolEnabled.ts +8 -0
- package/events/isScopeChildEvent.ts +15 -0
- package/events/isScopeDescendantEvent.ts +30 -0
- package/index.ts +41 -0
- package/package.json +28 -19
- package/testing/ActorAssertions.ts +19 -0
- package/testing/TestEmbeddingModel.ts +18 -0
- package/testing/TestLanguageModel.ts +32 -0
- package/testing/index.ts +4 -0
- package/testing/takeFirstAction.ts +8 -0
- package/tsconfig.json +4 -8
- package/types/AssertDiagnostics.ts +183 -0
- package/types/JSONRootType.ts +8 -0
- package/types/JSONType.ts +27 -0
- package/types/JSONTypeBase.ts +3 -0
- package/types/Metatype/MetatypeDescriptor.ts +80 -0
- package/types/Metatype/fromMetatypeDescriptor.ts +52 -0
- package/types/Type.ts +46 -0
- package/types/TypeContext.ts +19 -0
- package/types/TypeLike.ts +60 -0
- package/types/TypeVisitor.ts +49 -0
- package/types/array.ts +20 -0
- package/types/boolean.ts +9 -0
- package/types/const.ts +17 -0
- package/types/declareType.ts +71 -0
- package/types/enum.ts +14 -0
- package/types/factories.ts +8 -0
- package/types/index.ts +2 -0
- package/types/integer.ts +9 -0
- package/types/intrinsics.ts +11 -0
- package/types/match.ts +13 -0
- package/types/non_factories.ts +26 -0
- package/types/null.ts +10 -0
- package/types/number.ts +9 -0
- package/types/object.ts +27 -0
- package/types/ref.ts +12 -0
- package/types/string.ts +9 -0
- package/types/toJSON.ts +111 -0
- package/types/type_common.ts +21 -0
- package/types/types_derived/option.ts +10 -0
- package/types/types_derived/taggedUnion.ts +30 -0
- package/types/types_derived/wrapper.ts +10 -0
- package/types/union.ts +19 -0
- package/util/ArrayOfLength.ts +5 -0
- package/util/DeferredOr.ts +1 -0
- package/util/EnsureNarrow.ts +5 -0
- package/util/EnsureRecord.ts +3 -0
- package/util/Expand.ts +1 -0
- package/util/Falsy.ts +1 -0
- package/util/FromEntries.ts +3 -0
- package/util/IteratorLike.ts +1 -0
- package/util/JSONEntry.ts +3 -0
- package/util/JSONKey.ts +1 -0
- package/util/JSONObject.ts +6 -0
- package/util/JSONSchemaMemo.ts +15 -0
- package/util/JSONValue.ts +3 -0
- package/util/PromiseOr.ts +1 -0
- package/util/Result.ts +7 -0
- package/util/Taggable.ts +18 -0
- package/util/TupleToRecord.ts +5 -0
- package/util/assert.ts +7 -0
- package/util/dedent.ts +5 -0
- package/util/fixTemplateStrings.test.ts +250 -0
- package/util/fixTemplateStrings.ts +99 -0
- package/util/isAsyncIterator.ts +6 -0
- package/util/isIterator.ts +6 -0
- package/util/isJSONValue.ts +20 -0
- package/util/isPropertyKey.ts +3 -0
- package/util/isTemplateStringsArray.ts +3 -0
- package/util/jsonEquals.ts +41 -0
- package/util/nullaryMemo.ts +11 -0
- package/util/unimplemented.ts +5 -0
- package/util/unreachable.ts +5 -0
- package/util/unwrapDeferred.ts +5 -0
- package/util/util.ts +10 -0
- package/LICENSE +0 -15
- package/README.md +0 -94
- package/jest.config.js +0 -4
- package/lib/array/array.d.ts +0 -6
- package/lib/array/array.js +0 -21
- package/lib/array/index.d.ts +0 -11
- package/lib/array/index.js +0 -17
- package/lib/composition/composition.d.ts +0 -6
- package/lib/composition/composition.js +0 -37
- package/lib/composition/index.d.ts +0 -9
- package/lib/composition/index.js +0 -13
- package/lib/composition/types.d.ts +0 -2
- package/lib/composition/types.js +0 -2
- package/lib/dispatch/getType.d.ts +0 -2
- package/lib/dispatch/getType.js +0 -15
- package/lib/dispatch/identity.d.ts +0 -2
- package/lib/dispatch/identity.js +0 -4
- package/lib/dispatch/index.d.ts +0 -22
- package/lib/dispatch/index.js +0 -13
- package/lib/dispatch/types.d.ts +0 -14
- package/lib/dispatch/types.js +0 -16
- package/lib/error/error.d.ts +0 -24
- package/lib/error/error.js +0 -25
- package/lib/error/index.d.ts +0 -2
- package/lib/error/index.js +0 -4
- package/lib/index.d.ts +0 -67
- package/lib/index.js +0 -19
- package/lib/multimethod/index.d.ts +0 -7
- package/lib/multimethod/index.js +0 -9
- package/lib/multimethod/multimethod.d.ts +0 -3
- package/lib/multimethod/multimethod.js +0 -101
- package/src/array/array.ts +0 -29
- package/src/array/index.ts +0 -12
- package/src/composition/composition.ts +0 -45
- package/src/composition/index.ts +0 -10
- package/src/composition/types.ts +0 -6
- package/src/dispatch/getType.ts +0 -17
- package/src/dispatch/identity.ts +0 -3
- package/src/dispatch/index.ts +0 -11
- package/src/dispatch/types.ts +0 -15
- package/src/error/error.ts +0 -26
- package/src/error/index.ts +0 -3
- package/src/index.ts +0 -15
- package/src/multimethod/index.ts +0 -8
- package/src/multimethod/multimethod.test.ts +0 -10
- package/src/multimethod/multimethod.ts +0 -148
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
const INDENTATION_RE = /^\n([ \t]+)/
|
|
2
|
+
const ESCAPE_SEQ_RE = /\\([`${\\]|\n)/g
|
|
3
|
+
const LAST_INDENTATION_RE = /\n[ \t]+$/
|
|
4
|
+
|
|
5
|
+
export function fixTemplateStrings(template: TemplateStringsArray): { readonly raw: readonly string[] } {
|
|
6
|
+
const firstSegment = template.raw[0]!
|
|
7
|
+
const leadingIndentMatch = INDENTATION_RE.exec(firstSegment)
|
|
8
|
+
const indentation = leadingIndentMatch?.[1]
|
|
9
|
+
|
|
10
|
+
const rawLength = template.raw.length
|
|
11
|
+
const result = new Array(rawLength)
|
|
12
|
+
|
|
13
|
+
for (let i = 0; i < rawLength; i++) {
|
|
14
|
+
let str = template.raw[i]!
|
|
15
|
+
// Only perform common indentation replacements if needed
|
|
16
|
+
if (indentation) {
|
|
17
|
+
// Remove leading newline and indentation in the first segment
|
|
18
|
+
if (i === 0) {
|
|
19
|
+
str = str.slice(indentation.length + 1)
|
|
20
|
+
}
|
|
21
|
+
// Use a simple string replacement with a regular expression for better performance
|
|
22
|
+
str = str.replaceAll(`\n${indentation}`, "\n")
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Replace common escape sequences in a single pass
|
|
26
|
+
str = str.replace(ESCAPE_SEQ_RE, (_match, char) => {
|
|
27
|
+
// Keep the escaped newline replacement separate for clarity
|
|
28
|
+
return char === "\n" ? "" : char
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
// Handle trailing spaces only for the last segment
|
|
32
|
+
if (indentation && i === rawLength - 1) {
|
|
33
|
+
str = str.replace(LAST_INDENTATION_RE, "")
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
result[i] = str
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return { raw: result }
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const LEADING_SPACE_RE = /^([ \t]*)/
|
|
43
|
+
/**
|
|
44
|
+
* Applies template string indentation to substituted values with line breaks
|
|
45
|
+
*
|
|
46
|
+
* @param strings - The template strings array (processed through fixTemplateStrings)
|
|
47
|
+
* @param values - The substitution values
|
|
48
|
+
* @returns - The formatted string with properly indented substitutions
|
|
49
|
+
*/
|
|
50
|
+
export function applyTemplateWithIndentation(strings: TemplateStringsArray, ...values: any[]): string {
|
|
51
|
+
const fixedStrings = fixTemplateStrings(strings)
|
|
52
|
+
const rawArr = fixedStrings.raw
|
|
53
|
+
const valuesLength = values.length
|
|
54
|
+
|
|
55
|
+
const resultParts = new Array(Math.max(1, rawArr.length * 2 - 1))
|
|
56
|
+
let resultIndex = 0
|
|
57
|
+
|
|
58
|
+
for (let i = 0; i < rawArr.length; i++) {
|
|
59
|
+
const str = rawArr[i] || ""
|
|
60
|
+
resultParts[resultIndex++] = str
|
|
61
|
+
|
|
62
|
+
// Only process values for non-final segments
|
|
63
|
+
if (i < valuesLength) {
|
|
64
|
+
const value = String(values[i])
|
|
65
|
+
|
|
66
|
+
// If value has line breaks, we should indent it
|
|
67
|
+
if (value.includes("\n")) {
|
|
68
|
+
const lastNewlineIndex = str.lastIndexOf("\n")
|
|
69
|
+
|
|
70
|
+
if (lastNewlineIndex !== -1) {
|
|
71
|
+
// Extract the indentation after the last newline
|
|
72
|
+
const textAfterLastNewline = str.substring(lastNewlineIndex + 1)
|
|
73
|
+
const leadingSpaceMatch = LEADING_SPACE_RE.exec(textAfterLastNewline)
|
|
74
|
+
const indentationToApply = leadingSpaceMatch && leadingSpaceMatch[1] ? leadingSpaceMatch[1] : ""
|
|
75
|
+
|
|
76
|
+
if (indentationToApply) {
|
|
77
|
+
// Split the value into lines once
|
|
78
|
+
const lines = value.split("\n")
|
|
79
|
+
const linesLength = lines.length
|
|
80
|
+
|
|
81
|
+
// First line doesn't need indentation
|
|
82
|
+
resultParts[resultIndex++] = lines[0]
|
|
83
|
+
|
|
84
|
+
// Apply indentation to subsequent lines
|
|
85
|
+
for (let j = 1; j < linesLength; j++) {
|
|
86
|
+
resultParts[resultIndex++] = "\n" + indentationToApply + lines[j]
|
|
87
|
+
}
|
|
88
|
+
continue
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
// For simple values or when no indentation is needed
|
|
93
|
+
resultParts[resultIndex++] = value
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Combine all parts at once
|
|
98
|
+
return resultParts.slice(0, resultIndex).join("")
|
|
99
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { JSONValue } from "./JSONValue.ts"
|
|
2
|
+
|
|
3
|
+
export function isJSONValue(value: unknown): value is JSONValue {
|
|
4
|
+
if (value === null) {
|
|
5
|
+
return true
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
if (Array.isArray(value)) {
|
|
9
|
+
return value.every((item) => isJSONValue(item))
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if (typeof value === "object") {
|
|
13
|
+
if (value === null) {
|
|
14
|
+
return true
|
|
15
|
+
}
|
|
16
|
+
return Object.values(value).every((v) => isJSONValue(v))
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return typeof value === "string" || typeof value === "number" || typeof value === "boolean"
|
|
20
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { JSONValue } from "./JSONValue"
|
|
2
|
+
|
|
3
|
+
export function jsonEquals(actual: JSONValue, expected: JSONValue): boolean {
|
|
4
|
+
if (actual === expected) {
|
|
5
|
+
return true
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
if (typeof actual !== typeof expected) {
|
|
9
|
+
return false
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if (actual === null || expected === null) {
|
|
13
|
+
return actual === expected
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (Array.isArray(actual)) {
|
|
17
|
+
if (!Array.isArray(expected)) {
|
|
18
|
+
return false
|
|
19
|
+
}
|
|
20
|
+
if (actual.length !== expected.length) {
|
|
21
|
+
return false
|
|
22
|
+
}
|
|
23
|
+
return actual.every((e, i) => jsonEquals(e, expected[i]!))
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (typeof actual === "object") {
|
|
27
|
+
if (typeof expected !== "object" || Array.isArray(expected)) {
|
|
28
|
+
return false
|
|
29
|
+
}
|
|
30
|
+
const keys = Object.keys(actual)
|
|
31
|
+
if (keys.length !== Object.keys(expected).length) {
|
|
32
|
+
return false
|
|
33
|
+
}
|
|
34
|
+
return keys.every((key) =>
|
|
35
|
+
Object.prototype.hasOwnProperty.call(expected, key)
|
|
36
|
+
&& jsonEquals(actual[key]!, expected[key]!)
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return actual === expected
|
|
41
|
+
}
|
package/util/util.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./assert.ts"
|
|
2
|
+
export * from "./dedent.ts"
|
|
3
|
+
export * from "./DeferredOr.ts"
|
|
4
|
+
export * from "./isAsyncIterator.ts"
|
|
5
|
+
export * from "./isIterator.ts"
|
|
6
|
+
export * from "./JSONKey.ts"
|
|
7
|
+
export * from "./JSONSchemaMemo.ts"
|
|
8
|
+
export * from "./JSONValue.ts"
|
|
9
|
+
export * from "./unimplemented.ts"
|
|
10
|
+
export * from "./unwrapDeferred.ts"
|
package/LICENSE
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
Copyright 2019 Maciej Cąderek
|
|
2
|
-
|
|
3
|
-
Permission to use, copy, modify, and/or distribute this software
|
|
4
|
-
for any purpose with or without fee is hereby granted,
|
|
5
|
-
provided that the above copyright notice
|
|
6
|
-
and this permission notice appear in all copies.
|
|
7
|
-
|
|
8
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
9
|
-
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
|
10
|
-
OF MERCHANTABILITY AND FITNESS.
|
|
11
|
-
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT,
|
|
12
|
-
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
13
|
-
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
|
14
|
-
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
15
|
-
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
# Liminal - functional tools for composing applications
|
|
2
|
-
|
|
3
|
-
## Notes
|
|
4
|
-
|
|
5
|
-
Projects is in a POC stage. Stay tuned!
|
|
6
|
-
|
|
7
|
-
## API
|
|
8
|
-
|
|
9
|
-
### Functional composition
|
|
10
|
-
|
|
11
|
-
#### pipe
|
|
12
|
-
|
|
13
|
-
Executes functions in provided order, starting with initial value.
|
|
14
|
-
|
|
15
|
-
```js
|
|
16
|
-
import { pipe } from 'liminal'
|
|
17
|
-
|
|
18
|
-
const doubleSquare = pipe(
|
|
19
|
-
(x) => x * 2,
|
|
20
|
-
(x) => x ** 2,
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
const result = doubleSquare(2) // -> 16
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
#### compose
|
|
27
|
-
|
|
28
|
-
Executes functions in reversed order, starting with initial value.
|
|
29
|
-
|
|
30
|
-
```js
|
|
31
|
-
import { compose } from 'liminal'
|
|
32
|
-
|
|
33
|
-
const doubleSquare = compose(
|
|
34
|
-
(x) => x ** 2,
|
|
35
|
-
(x) => x * 2,
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
const result = doubleSquare(2) // -> 16
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
#### railSync
|
|
42
|
-
|
|
43
|
-
Works similar to `pipe`, but additionally catches errors and pipes them downstream as a value.
|
|
44
|
-
|
|
45
|
-
Errors can be thrown or returned.
|
|
46
|
-
|
|
47
|
-
```js
|
|
48
|
-
import { compose } from 'liminal'
|
|
49
|
-
|
|
50
|
-
const doubleSquare = compose(
|
|
51
|
-
(x) => x ** 2,
|
|
52
|
-
(x) => x * 2,
|
|
53
|
-
)
|
|
54
|
-
|
|
55
|
-
const result = doubleSquare(2) // -> 16
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
```js
|
|
59
|
-
import { compose } from 'liminal'
|
|
60
|
-
|
|
61
|
-
const doubleSquare = compose(
|
|
62
|
-
(x) => {
|
|
63
|
-
if (typeof x !== 'number') {
|
|
64
|
-
return new Error('Number expected')
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return x ** 2
|
|
68
|
-
},
|
|
69
|
-
(x) => x * 2,
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
const result = doubleSquare('foo') // -> Error object
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
#### rail
|
|
76
|
-
|
|
77
|
-
Works similar to `rail`, but additionally waits for promises if are returned and passes result values between functions.
|
|
78
|
-
|
|
79
|
-
Errors can be thrown or returned.
|
|
80
|
-
|
|
81
|
-
```js
|
|
82
|
-
import { compose } from 'liminal'
|
|
83
|
-
|
|
84
|
-
const doubleSquare = compose(
|
|
85
|
-
(x) => x ** 2,
|
|
86
|
-
(x) => x * 2,
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
const main = async () => {
|
|
90
|
-
const result = await doubleSquare(Promise.resolve(2)) // -> 16
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
main()
|
|
94
|
-
```
|
package/jest.config.js
DELETED
package/lib/array/array.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare const filter: (fn: any) => (arr: any) => any;
|
|
2
|
-
export declare const map: (fn: any) => (arr: any) => any;
|
|
3
|
-
export declare const reduce: (fn: any, initialValue: any) => (arr: any) => any;
|
|
4
|
-
export declare const reduceRight: (fn: any, initialValue: any) => (arr: any) => any;
|
|
5
|
-
export declare const reverse: (arr: any) => any;
|
|
6
|
-
export declare const sort: (fn: any) => (arr: any) => any[];
|
package/lib/array/array.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.filter = (fn) => (arr) => arr.filter(fn);
|
|
4
|
-
exports.map = (fn) => (arr) => arr.map(fn);
|
|
5
|
-
exports.reduce = (fn, initialValue) => (arr) => arr.reduce(fn, initialValue);
|
|
6
|
-
exports.reduceRight = (fn, initialValue) => (arr) => arr.reduceRight(fn, initialValue);
|
|
7
|
-
exports.reverse = (arr) => arr.reverse();
|
|
8
|
-
exports.sort = (fn) => (arr) => {
|
|
9
|
-
if (fn) {
|
|
10
|
-
return [...arr].sort(fn);
|
|
11
|
-
}
|
|
12
|
-
if (typeof arr[0] === 'number') {
|
|
13
|
-
return [...arr].sort((a, b) => a - b);
|
|
14
|
-
}
|
|
15
|
-
if (typeof arr[0] === 'bigint') {
|
|
16
|
-
return [...arr].sort((a, b) => {
|
|
17
|
-
return 1;
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
return [...arr].sort();
|
|
21
|
-
};
|
package/lib/array/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { filter, map, reduce, reduceRight, reverse, sort } from './array';
|
|
2
|
-
export { filter, map, reduce, reduceRight, reverse, sort };
|
|
3
|
-
declare const _default: {
|
|
4
|
-
filter: (fn: any) => (arr: any) => any;
|
|
5
|
-
map: (fn: any) => (arr: any) => any;
|
|
6
|
-
reduce: (fn: any, initialValue: any) => (arr: any) => any;
|
|
7
|
-
reduceRight: (fn: any, initialValue: any) => (arr: any) => any;
|
|
8
|
-
reverse: (arr: any) => any;
|
|
9
|
-
sort: (fn: any) => (arr: any) => any[];
|
|
10
|
-
};
|
|
11
|
-
export default _default;
|
package/lib/array/index.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const array_1 = require("./array");
|
|
4
|
-
exports.filter = array_1.filter;
|
|
5
|
-
exports.map = array_1.map;
|
|
6
|
-
exports.reduce = array_1.reduce;
|
|
7
|
-
exports.reduceRight = array_1.reduceRight;
|
|
8
|
-
exports.reverse = array_1.reverse;
|
|
9
|
-
exports.sort = array_1.sort;
|
|
10
|
-
exports.default = {
|
|
11
|
-
filter: array_1.filter,
|
|
12
|
-
map: array_1.map,
|
|
13
|
-
reduce: array_1.reduce,
|
|
14
|
-
reduceRight: array_1.reduceRight,
|
|
15
|
-
reverse: array_1.reverse,
|
|
16
|
-
sort: array_1.sort,
|
|
17
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const array_1 = require("../array");
|
|
4
|
-
const wrapSync = (fn) => (input) => {
|
|
5
|
-
if (input instanceof Error) {
|
|
6
|
-
return input;
|
|
7
|
-
}
|
|
8
|
-
let result;
|
|
9
|
-
try {
|
|
10
|
-
result = fn(input);
|
|
11
|
-
}
|
|
12
|
-
catch (error) {
|
|
13
|
-
result = error;
|
|
14
|
-
}
|
|
15
|
-
return typeof result === 'undefined' ? input : result;
|
|
16
|
-
};
|
|
17
|
-
const wrap = (fn) => (input) => {
|
|
18
|
-
if (input instanceof Promise) {
|
|
19
|
-
return input.then((rawInput) => {
|
|
20
|
-
return wrapSync(fn)(rawInput);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
return wrapSync(fn)(input);
|
|
24
|
-
};
|
|
25
|
-
const chain = (reducingFn, wrappingFn = null) => (...fns) => (initialArg) => {
|
|
26
|
-
return wrappingFn
|
|
27
|
-
? reducingFn((arg, fn) => wrappingFn(fn)(arg), initialArg)(fns)
|
|
28
|
-
: reducingFn((arg, fn) => fn(arg), initialArg)(fns);
|
|
29
|
-
};
|
|
30
|
-
const compose = chain(array_1.reduceRight);
|
|
31
|
-
exports.compose = compose;
|
|
32
|
-
const pipe = chain(array_1.reduce);
|
|
33
|
-
exports.pipe = pipe;
|
|
34
|
-
const rail = chain(array_1.reduce, wrap);
|
|
35
|
-
exports.rail = rail;
|
|
36
|
-
const railSync = chain(array_1.reduce, wrapSync);
|
|
37
|
-
exports.railSync = railSync;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { compose, pipe, rail, railSync } from './composition';
|
|
2
|
-
export { compose, pipe, rail, railSync };
|
|
3
|
-
declare const _default: {
|
|
4
|
-
compose: import("./types").ChainFunctions;
|
|
5
|
-
pipe: import("./types").ChainFunctions;
|
|
6
|
-
rail: import("./types").ChainFunctions;
|
|
7
|
-
railSync: import("./types").ChainFunctions;
|
|
8
|
-
};
|
|
9
|
-
export default _default;
|
package/lib/composition/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const composition_1 = require("./composition");
|
|
4
|
-
exports.compose = composition_1.compose;
|
|
5
|
-
exports.pipe = composition_1.pipe;
|
|
6
|
-
exports.rail = composition_1.rail;
|
|
7
|
-
exports.railSync = composition_1.railSync;
|
|
8
|
-
exports.default = {
|
|
9
|
-
compose: composition_1.compose,
|
|
10
|
-
pipe: composition_1.pipe,
|
|
11
|
-
rail: composition_1.rail,
|
|
12
|
-
railSync: composition_1.railSync,
|
|
13
|
-
};
|
package/lib/composition/types.js
DELETED
package/lib/dispatch/getType.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const getType = (val) => {
|
|
4
|
-
if (Array.isArray(val)) {
|
|
5
|
-
return 'array';
|
|
6
|
-
}
|
|
7
|
-
if (val === null) {
|
|
8
|
-
return 'null';
|
|
9
|
-
}
|
|
10
|
-
if (val instanceof RegExp) {
|
|
11
|
-
return 'regexp';
|
|
12
|
-
}
|
|
13
|
-
return typeof val;
|
|
14
|
-
};
|
|
15
|
-
exports.default = getType;
|
package/lib/dispatch/identity.js
DELETED
package/lib/dispatch/index.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import getType from './getType';
|
|
2
|
-
import identity from './identity';
|
|
3
|
-
import types from './types';
|
|
4
|
-
export { getType, identity, types };
|
|
5
|
-
declare const _default: {
|
|
6
|
-
getType: (val: any) => "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" | "array" | "null" | "regexp";
|
|
7
|
-
identity: (x: any) => any;
|
|
8
|
-
types: {
|
|
9
|
-
array: string;
|
|
10
|
-
object: string;
|
|
11
|
-
function: string;
|
|
12
|
-
string: string;
|
|
13
|
-
number: string;
|
|
14
|
-
bigint: string;
|
|
15
|
-
symbol: string;
|
|
16
|
-
regexp: string;
|
|
17
|
-
null: string;
|
|
18
|
-
undefined: string;
|
|
19
|
-
boolean: string;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
export default _default;
|
package/lib/dispatch/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const getType_1 = require("./getType");
|
|
4
|
-
exports.getType = getType_1.default;
|
|
5
|
-
const identity_1 = require("./identity");
|
|
6
|
-
exports.identity = identity_1.default;
|
|
7
|
-
const types_1 = require("./types");
|
|
8
|
-
exports.types = types_1.default;
|
|
9
|
-
exports.default = {
|
|
10
|
-
getType: getType_1.default,
|
|
11
|
-
identity: identity_1.default,
|
|
12
|
-
types: types_1.default,
|
|
13
|
-
};
|
package/lib/dispatch/types.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
declare const types: {
|
|
2
|
-
array: string;
|
|
3
|
-
object: string;
|
|
4
|
-
function: string;
|
|
5
|
-
string: string;
|
|
6
|
-
number: string;
|
|
7
|
-
bigint: string;
|
|
8
|
-
symbol: string;
|
|
9
|
-
regexp: string;
|
|
10
|
-
null: string;
|
|
11
|
-
undefined: string;
|
|
12
|
-
boolean: string;
|
|
13
|
-
};
|
|
14
|
-
export default types;
|
package/lib/dispatch/types.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const types = {
|
|
4
|
-
array: 'array',
|
|
5
|
-
object: 'object',
|
|
6
|
-
function: 'function',
|
|
7
|
-
string: 'string',
|
|
8
|
-
number: 'number',
|
|
9
|
-
bigint: 'bigint',
|
|
10
|
-
symbol: 'symbol',
|
|
11
|
-
regexp: 'regexp',
|
|
12
|
-
null: 'null',
|
|
13
|
-
undefined: 'undefined',
|
|
14
|
-
boolean: 'boolean',
|
|
15
|
-
};
|
|
16
|
-
exports.default = types;
|
package/lib/error/error.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
declare const _default: {
|
|
3
|
-
create: ({ name, defaultMessage }: {
|
|
4
|
-
name: any;
|
|
5
|
-
defaultMessage?: string;
|
|
6
|
-
}) => {
|
|
7
|
-
new (message?: string): {
|
|
8
|
-
name: string;
|
|
9
|
-
message: string;
|
|
10
|
-
stack?: string;
|
|
11
|
-
};
|
|
12
|
-
captureStackTrace(targetObject: Object, constructorOpt?: Function): void;
|
|
13
|
-
prepareStackTrace?: (err: Error, stackTraces: NodeJS.CallSite[]) => any;
|
|
14
|
-
stackTraceLimit: number;
|
|
15
|
-
};
|
|
16
|
-
toJSON: (error: any) => {
|
|
17
|
-
error: {
|
|
18
|
-
name: any;
|
|
19
|
-
message: any;
|
|
20
|
-
stacktrace: any;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
export default _default;
|
package/lib/error/error.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const create = ({ name, defaultMessage = '' }) => {
|
|
4
|
-
const err = class extends Error {
|
|
5
|
-
constructor(message = defaultMessage) {
|
|
6
|
-
super(message);
|
|
7
|
-
this.name = name;
|
|
8
|
-
this.message = message;
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
return err;
|
|
12
|
-
};
|
|
13
|
-
const toJSON = (error) => {
|
|
14
|
-
return {
|
|
15
|
-
error: {
|
|
16
|
-
name: error.name,
|
|
17
|
-
message: error.message,
|
|
18
|
-
stacktrace: error.stack,
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
exports.default = {
|
|
23
|
-
create,
|
|
24
|
-
toJSON,
|
|
25
|
-
};
|
package/lib/error/index.d.ts
DELETED
package/lib/error/index.js
DELETED