From 090ab9739282756989e9930cba57aee1099b17a1 Mon Sep 17 00:00:00 2001 From: Diogo Biazus Date: Tue, 9 Jan 2024 15:03:40 -0500 Subject: [PATCH 1/3] Add back toErrorWithMessage --- deno.json | 2 +- src/index.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/deno.json b/deno.json index 35a7ba67..66333d99 100644 --- a/deno.json +++ b/deno.json @@ -1,5 +1,5 @@ { - "version": "2.5.2-rc.1", + "version": "2.5.2-rc.2", "tasks": { "test": "deno test --allow-env --allow-net --unstable src", "publish": "deno task build-npm && cd npm/ && npm publish", diff --git a/src/index.ts b/src/index.ts index 122800ec..4c6d8b7f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -10,6 +10,7 @@ export * from './errors.ts' export { mergeObjects } from './composable/composable.ts' export type { Composable } from './composable/index.ts' import * as composable from './composable/index.ts' +export { toErrorWithMessage } from './composable/errors.ts' export { composable } export type { AtLeastOne, From a08cf3906f8581fb703791cb299cb9a3c9f23dda Mon Sep 17 00:00:00 2001 From: Diogo Biazus Date: Tue, 9 Jan 2024 17:10:19 -0500 Subject: [PATCH 2/3] rename composable for cf so namespace and constructor have different names --- src/composable/composable.ts | 12 ++++++------ src/index.ts | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/composable/composable.ts b/src/composable/composable.ts index 73ddfdf0..65e53fc6 100644 --- a/src/composable/composable.ts +++ b/src/composable/composable.ts @@ -60,7 +60,7 @@ function composable(fn: T): Composable { /** * Creates a single function out of a chain of multiple Composables. It will pass the output of a function as the next function's input in left-to-right order. The resulting data will be the output of the rightmost function. * @example - * import { composable as C } from 'domain-functions' + * import { cf as C } from 'domain-functions' * * const a = C.composable( * ({ aNumber }: { aNumber: number }) => ({ aString: String(aNumber) }), @@ -86,7 +86,7 @@ function pipe( /** * Creates a single function out of multiple Composables. It will pass the same input to each provided function. The functions will run in parallel. If all constituent functions are successful, The data field will be a tuple containing each function's output. * @example - * import { composable as C } from 'domain-functions' + * import { cf as C } from 'domain-functions' * * const a = C.composable((id: number) => id + 1) * const b = C.composable(String) @@ -115,7 +115,7 @@ function all( /** * Receives a Record of Composables, runs them all in parallel and preserves the shape of this record for the data property in successful results. * @example - * import { composable as C } from 'domain-functions' + * import { cf as C } from 'domain-functions' * * const a = C.composable(() => '1') * const b = C.composable(() => 2) @@ -138,7 +138,7 @@ function collect>( /** * Works like `pipe` but it will collect the output of every function in a tuple. * @example - * import { composable as C } from 'domain-functions' + * import { cf as C } from 'domain-functions' * * const a = C.compose((aNumber: number) => String(aNumber)) * const b = C.compose((aString: string) => aString === '1') @@ -169,7 +169,7 @@ function sequence( /** * It takes a Composable and a predicate to apply a transformation over the resulting `data`. It only runs if the function was successfull. When the given function fails, its error is returned wihout changes. * @example - * import { composable as C } from 'domain-functions' + * import { cf as C } from 'domain-functions' * * const increment = C.composable(({ id }: { id: number }) => id + 1) * const incrementToString = C.map(increment, String) @@ -191,7 +191,7 @@ function map( /** * Creates a new function that will apply a transformation over a resulting Failure from the given function. When the given function succeeds, its result is returned without changes. * @example - * import { composable as C } from 'domain-functions' + * import { cf as C } from 'domain-functions' * * const increment = C.composable(({ id }: { id: number }) => id + 1) * const incrementWithErrorSummary = C.mapError(increment, (result) => ({ diff --git a/src/index.ts b/src/index.ts index 4c6d8b7f..134dd00f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -11,7 +11,7 @@ export { mergeObjects } from './composable/composable.ts' export type { Composable } from './composable/index.ts' import * as composable from './composable/index.ts' export { toErrorWithMessage } from './composable/errors.ts' -export { composable } +export { composable as cf } export type { AtLeastOne, DomainFunction, From 97c45a36812a3ceab582e1227a4acc86a9277722 Mon Sep 17 00:00:00 2001 From: Diogo Biazus Date: Tue, 9 Jan 2024 17:10:38 -0500 Subject: [PATCH 3/3] Another rc --- deno.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deno.json b/deno.json index 66333d99..115c591c 100644 --- a/deno.json +++ b/deno.json @@ -1,5 +1,5 @@ { - "version": "2.5.2-rc.2", + "version": "2.5.2-rc.3", "tasks": { "test": "deno test --allow-env --allow-net --unstable src", "publish": "deno task build-npm && cd npm/ && npm publish",