@effect/cli
Advanced tools
Comparing version 0.25.2 to 0.25.3
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.wizard = exports.withSubcommands = exports.withHandler = exports.withDescription = exports.transformHandler = exports.run = exports.provideEffectDiscard = exports.provide = exports.prompt = exports.make = exports.getZshCompletions = exports.getUsage = exports.getSubcommands = exports.getNames = exports.getHelp = exports.getFishCompletions = exports.getBashCompletions = exports.fromDescriptor = exports.TypeId = void 0; | ||
exports.wizard = exports.withSubcommands = exports.withHandler = exports.withDescription = exports.transformHandler = exports.run = exports.provideSync = exports.provideEffectDiscard = exports.provideEffect = exports.provide = exports.prompt = exports.make = exports.getZshCompletions = exports.getUsage = exports.getSubcommands = exports.getNames = exports.getHelp = exports.getFishCompletions = exports.getBashCompletions = exports.fromDescriptor = exports.TypeId = void 0; | ||
var Internal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("./internal/command.js")); | ||
@@ -98,2 +98,7 @@ function _getRequireWildcardCache(e) { | ||
*/ | ||
const provideEffect = exports.provideEffect = Internal.provideEffect; | ||
/** | ||
* @since 1.0.0 | ||
* @category combinators | ||
*/ | ||
const provideEffectDiscard = exports.provideEffectDiscard = Internal.provideEffectDiscard; | ||
@@ -104,2 +109,7 @@ /** | ||
*/ | ||
const provideSync = exports.provideSync = Internal.provideSync; | ||
/** | ||
* @since 1.0.0 | ||
* @category combinators | ||
*/ | ||
const transformHandler = exports.transformHandler = Internal.transformHandler; | ||
@@ -106,0 +116,0 @@ /** |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.wizard = exports.withSubcommands = exports.withHandler = exports.withDescription = exports.transformHandler = exports.run = exports.provideEffectDiscard = exports.provide = exports.prompt = exports.make = exports.getZshCompletions = exports.getUsage = exports.getSubcommands = exports.getNames = exports.getHelp = exports.getFishCompletions = exports.getBashCompletions = exports.fromDescriptor = exports.TypeId = void 0; | ||
exports.wizard = exports.withSubcommands = exports.withHandler = exports.withDescription = exports.transformHandler = exports.run = exports.provideSync = exports.provideEffectDiscard = exports.provideEffect = exports.provide = exports.prompt = exports.make = exports.getZshCompletions = exports.getUsage = exports.getSubcommands = exports.getNames = exports.getHelp = exports.getFishCompletions = exports.getBashCompletions = exports.fromDescriptor = exports.TypeId = void 0; | ||
var Context = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("effect/Context")); | ||
@@ -197,2 +197,9 @@ var Effect = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("effect/Effect")); | ||
/** @internal */ | ||
const provideEffect = exports.provideEffect = /*#__PURE__*/(0, _Function.dual)(3, (self, tag, effect_) => makeDerive(self, { | ||
transform: (self, config) => { | ||
const effect = typeof effect_ === "function" ? effect_(config) : effect_; | ||
return Effect.provideServiceEffect(self, tag, effect); | ||
} | ||
})); | ||
/** @internal */ | ||
const provideEffectDiscard = exports.provideEffectDiscard = /*#__PURE__*/(0, _Function.dual)(2, (self, effect_) => makeDerive(self, { | ||
@@ -205,2 +212,9 @@ transform: (self, config) => { | ||
/** @internal */ | ||
const provideSync = exports.provideSync = /*#__PURE__*/(0, _Function.dual)(3, (self, tag, f) => makeDerive(self, { | ||
transform: (self, config) => { | ||
const service = typeof f === "function" ? f(config) : f; | ||
return Effect.provideService(self, tag, service); | ||
} | ||
})); | ||
/** @internal */ | ||
const withDescription = exports.withDescription = /*#__PURE__*/(0, _Function.dual)(2, (self, help) => mapDescriptor(self, InternalDescriptor.withDescription(help))); | ||
@@ -207,0 +221,0 @@ /** @internal */ |
@@ -185,2 +185,10 @@ /** | ||
*/ | ||
export declare const provideEffect: { | ||
<I, S, A, R2, E2>(tag: Tag<I, S>, effect: Effect<R2, E2, S> | ((_: A) => Effect<R2, E2, S>)): <Name extends string, R, E>(self: Command<Name, R, E, A>) => Command<Name, R2 | Exclude<R, I>, E2 | E, A>; | ||
<Name extends string, R, E, A, I, S, R2, E2>(self: Command<Name, R, E, A>, tag: Tag<I, S>, effect: Effect<R2, E2, S> | ((_: A) => Effect<R2, E2, S>)): Command<Name, R2 | Exclude<R, I>, E | E2, A>; | ||
}; | ||
/** | ||
* @since 1.0.0 | ||
* @category combinators | ||
*/ | ||
export declare const provideEffectDiscard: { | ||
@@ -194,2 +202,10 @@ <A, R2, E2, _>(effect: Effect<R2, E2, _> | ((_: A) => Effect<R2, E2, _>)): <Name extends string, R, E>(self: Command<Name, R, E, A>) => Command<Name, R2 | R, E2 | E, A>; | ||
*/ | ||
export declare const provideSync: { | ||
<I, S, A>(tag: Tag<I, S>, service: S | ((_: A) => S)): <Name extends string, R, E>(self: Command<Name, R, E, A>) => Command<Name, Exclude<R, I>, E, A>; | ||
<Name extends string, R, E, A, I, S>(self: Command<Name, R, E, A>, tag: Tag<I, S>, service: S | ((_: A) => S)): Command<Name, Exclude<R, I>, E, A>; | ||
}; | ||
/** | ||
* @since 1.0.0 | ||
* @category combinators | ||
*/ | ||
export declare const transformHandler: { | ||
@@ -196,0 +212,0 @@ <R, E, A, R2, E2>(f: (effect: Effect<R, E, void>, config: A) => Effect<R2, E2, void>): <Name extends string>(self: Command<Name, R, E, A>) => Command<Name, R | R2, E | E2, A>; |
@@ -66,2 +66,7 @@ import * as Internal from "./internal/command.js"; | ||
*/ | ||
export const provideEffect = Internal.provideEffect; | ||
/** | ||
* @since 1.0.0 | ||
* @category combinators | ||
*/ | ||
export const provideEffectDiscard = Internal.provideEffectDiscard; | ||
@@ -72,2 +77,7 @@ /** | ||
*/ | ||
export const provideSync = Internal.provideSync; | ||
/** | ||
* @since 1.0.0 | ||
* @category combinators | ||
*/ | ||
export const transformHandler = Internal.transformHandler; | ||
@@ -74,0 +84,0 @@ /** |
@@ -156,2 +156,9 @@ import * as Context from "effect/Context"; | ||
/** @internal */ | ||
export const provideEffect = /*#__PURE__*/dual(3, (self, tag, effect_) => makeDerive(self, { | ||
transform: (self, config) => { | ||
const effect = typeof effect_ === "function" ? effect_(config) : effect_; | ||
return Effect.provideServiceEffect(self, tag, effect); | ||
} | ||
})); | ||
/** @internal */ | ||
export const provideEffectDiscard = /*#__PURE__*/dual(2, (self, effect_) => makeDerive(self, { | ||
@@ -164,2 +171,9 @@ transform: (self, config) => { | ||
/** @internal */ | ||
export const provideSync = /*#__PURE__*/dual(3, (self, tag, f) => makeDerive(self, { | ||
transform: (self, config) => { | ||
const service = typeof f === "function" ? f(config) : f; | ||
return Effect.provideService(self, tag, service); | ||
} | ||
})); | ||
/** @internal */ | ||
export const withDescription = /*#__PURE__*/dual(2, (self, help) => mapDescriptor(self, InternalDescriptor.withDescription(help))); | ||
@@ -166,0 +180,0 @@ /** @internal */ |
{ | ||
"name": "@effect/cli", | ||
"version": "0.25.2", | ||
"version": "0.25.3", | ||
"description": "Functional programming in TypeScript", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -274,2 +274,20 @@ /** | ||
*/ | ||
export const provideEffect: { | ||
<I, S, A, R2, E2>( | ||
tag: Tag<I, S>, | ||
effect: Effect<R2, E2, S> | ((_: A) => Effect<R2, E2, S>) | ||
): <Name extends string, R, E>( | ||
self: Command<Name, R, E, A> | ||
) => Command<Name, R2 | Exclude<R, I>, E2 | E, A> | ||
<Name extends string, R, E, A, I, S, R2, E2>( | ||
self: Command<Name, R, E, A>, | ||
tag: Tag<I, S>, | ||
effect: Effect<R2, E2, S> | ((_: A) => Effect<R2, E2, S>) | ||
): Command<Name, R2 | Exclude<R, I>, E | E2, A> | ||
} = Internal.provideEffect | ||
/** | ||
* @since 1.0.0 | ||
* @category combinators | ||
*/ | ||
export const provideEffectDiscard: { | ||
@@ -289,2 +307,18 @@ <A, R2, E2, _>( | ||
*/ | ||
export const provideSync: { | ||
<I, S, A>( | ||
tag: Tag<I, S>, | ||
service: S | ((_: A) => S) | ||
): <Name extends string, R, E>(self: Command<Name, R, E, A>) => Command<Name, Exclude<R, I>, E, A> | ||
<Name extends string, R, E, A, I, S>( | ||
self: Command<Name, R, E, A>, | ||
tag: Tag<I, S>, | ||
service: S | ((_: A) => S) | ||
): Command<Name, Exclude<R, I>, E, A> | ||
} = Internal.provideSync | ||
/** | ||
* @since 1.0.0 | ||
* @category combinators | ||
*/ | ||
export const transformHandler: { | ||
@@ -291,0 +325,0 @@ <R, E, A, R2, E2>( |
@@ -354,2 +354,23 @@ import type * as FileSystem from "@effect/platform/FileSystem" | ||
/** @internal */ | ||
export const provideEffect = dual< | ||
<I, S, A, R2, E2>( | ||
tag: Context.Tag<I, S>, | ||
effect: Effect.Effect<R2, E2, S> | ((_: A) => Effect.Effect<R2, E2, S>) | ||
) => <Name extends string, R, E>( | ||
self: Command.Command<Name, R, E, A> | ||
) => Command.Command<Name, Exclude<R, I> | R2, E | E2, A>, | ||
<Name extends string, R, E, A, I, S, R2, E2>( | ||
self: Command.Command<Name, R, E, A>, | ||
tag: Context.Tag<I, S>, | ||
effect: Effect.Effect<R2, E2, S> | ((_: A) => Effect.Effect<R2, E2, S>) | ||
) => Command.Command<Name, Exclude<R, I> | R2, E | E2, A> | ||
>(3, (self, tag, effect_) => | ||
makeDerive(self, { | ||
transform: (self, config) => { | ||
const effect = typeof effect_ === "function" ? effect_(config) : effect_ | ||
return Effect.provideServiceEffect(self, tag, effect) | ||
} | ||
})) | ||
/** @internal */ | ||
export const provideEffectDiscard = dual< | ||
@@ -374,2 +395,23 @@ <A, R2, E2, _>( | ||
/** @internal */ | ||
export const provideSync = dual< | ||
<I, S, A>( | ||
tag: Context.Tag<I, S>, | ||
service: S | ((_: A) => S) | ||
) => <Name extends string, R, E>( | ||
self: Command.Command<Name, R, E, A> | ||
) => Command.Command<Name, Exclude<R, I>, E, A>, | ||
<Name extends string, R, E, A, I, S>( | ||
self: Command.Command<Name, R, E, A>, | ||
tag: Context.Tag<I, S>, | ||
service: S | ((_: A) => S) | ||
) => Command.Command<Name, Exclude<R, I>, E, A> | ||
>(3, (self, tag, f) => | ||
makeDerive(self, { | ||
transform: (self, config) => { | ||
const service = typeof f === "function" ? (f as any)(config) : f | ||
return Effect.provideService(self, tag, service) | ||
} | ||
})) | ||
/** @internal */ | ||
export const withDescription = dual< | ||
@@ -376,0 +418,0 @@ ( |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1828488
30590