fortepiano 0.1.1 → 0.1.4
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/AsyncYield/package.json +6 -0
- package/AsyncYield.d.ts +104 -0
- package/Buffer.d.ts +0 -1
- package/CHANGELOG.md +123 -0
- package/CONTRIBUTING.md +51 -0
- package/Console.d.ts +3 -3
- package/Crypto.d.ts +0 -1
- package/Error.d.ts +8 -1
- package/GeneratorL.d.ts +524 -18
- package/Has/package.json +6 -0
- package/Has.d.ts +16 -0
- package/Http.d.ts +1 -2
- package/LICENSE.md +21 -0
- package/README.md +55 -3
- package/ReaderTaskEither.d.ts +49 -0
- package/Storage.d.ts +0 -1
- package/Stream.d.ts +0 -1
- package/Type.d.ts +4 -2
- package/Yield/package.json +6 -0
- package/Yield.d.ts +210 -0
- package/cache/Storage.d.ts +1 -1
- package/esm/{IOAsyncGenerator.js → AsyncYield.js} +9 -8
- package/esm/Error.js +17 -4
- package/esm/GeneratorL.js +404 -4
- package/esm/Has.js +5 -0
- package/esm/Http.js +1 -1
- package/esm/Mock.js +5 -4
- package/esm/ReaderTaskEither.js +48 -1
- package/esm/Type.js +3 -0
- package/esm/Yield.js +401 -0
- package/esm/cache/Redis.js +1 -1
- package/esm/http/Got.js +3 -0
- package/esm/index.js +8 -2
- package/http/Got.d.ts +3 -0
- package/index.d.ts +9 -2
- package/lib/AsyncYield.d.ts +104 -0
- package/lib/{IOAsyncGenerator.js → AsyncYield.js} +36 -31
- package/lib/Buffer.d.ts +0 -1
- package/lib/Buffer.js +5 -1
- package/lib/Cache.js +13 -9
- package/lib/Console.d.ts +3 -3
- package/lib/Crypto.d.ts +0 -1
- package/lib/Crypto.js +8 -4
- package/lib/Date.js +7 -3
- package/lib/Eq.js +7 -3
- package/lib/Error.d.ts +8 -1
- package/lib/Error.js +26 -8
- package/lib/GeneratorL.d.ts +524 -18
- package/lib/GeneratorL.js +480 -76
- package/lib/Has.d.ts +16 -0
- package/lib/Has.js +13 -0
- package/lib/Http.d.ts +1 -2
- package/lib/Http.js +10 -6
- package/lib/Magma.js +6 -2
- package/lib/Matrix.js +8 -4
- package/lib/Mock.js +29 -24
- package/lib/Option.js +5 -1
- package/lib/Reader.js +7 -3
- package/lib/ReaderEither.js +9 -5
- package/lib/ReaderTask.js +9 -5
- package/lib/ReaderTaskEither.d.ts +49 -0
- package/lib/ReaderTaskEither.js +106 -10
- package/lib/ReadonlyArray.js +9 -5
- package/lib/ReadonlyRecord.js +6 -2
- package/lib/ReadonlyTuple.js +7 -3
- package/lib/Storage.d.ts +0 -1
- package/lib/Storage.js +11 -7
- package/lib/Stream.d.ts +0 -1
- package/lib/Stream.js +5 -1
- package/lib/TaskEither.js +5 -1
- package/lib/Type.d.ts +4 -2
- package/lib/Type.js +13 -5
- package/lib/Validation.js +6 -2
- package/lib/Yield.d.ts +210 -0
- package/lib/Yield.js +504 -0
- package/lib/cache/Memcached.js +11 -7
- package/lib/cache/Memory.js +6 -2
- package/lib/cache/Redis.js +11 -7
- package/lib/cache/Storage.d.ts +1 -1
- package/lib/cache/Storage.js +10 -6
- package/lib/http/Axios.js +6 -2
- package/lib/http/Fetch.js +9 -5
- package/lib/http/Got.d.ts +3 -0
- package/lib/http/Got.js +10 -3
- package/lib/http/Mock.js +6 -2
- package/lib/index.d.ts +9 -2
- package/lib/index.js +16 -4
- package/lib/number.js +1 -1
- package/lib/storage/Flydrive.js +7 -3
- package/lib/storage/Fs.js +5 -1
- package/lib/string.js +5 -1
- package/lib/struct.d.ts +4 -0
- package/lib/struct.js +11 -7
- package/package.json +30 -22
- package/struct.d.ts +4 -0
- package/IOAsyncGenerator/package.json +0 -6
- package/IOAsyncGenerator.d.ts +0 -102
- package/lib/IOAsyncGenerator.d.ts +0 -102
package/AsyncYield.d.ts
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import * as Appli from 'fp-ts/Applicative';
|
|
2
|
+
import * as _Apply from 'fp-ts/Apply';
|
|
3
|
+
import * as Ch from 'fp-ts/Chain';
|
|
4
|
+
import * as Co from 'fp-ts/Compactable';
|
|
5
|
+
import * as Ei from 'fp-ts/Either';
|
|
6
|
+
import * as Eq from 'fp-ts/Eq';
|
|
7
|
+
import * as Fi from 'fp-ts/Filterable';
|
|
8
|
+
import * as FiWI from 'fp-ts/FilterableWithIndex';
|
|
9
|
+
import * as FIO from 'fp-ts/FromIO';
|
|
10
|
+
import { Lazy } from 'fp-ts/function';
|
|
11
|
+
import * as Fu from 'fp-ts/Functor';
|
|
12
|
+
import * as FuWI from 'fp-ts/FunctorWithIndex';
|
|
13
|
+
import * as IO from 'fp-ts/IO';
|
|
14
|
+
import * as Mona from 'fp-ts/Monad';
|
|
15
|
+
import * as MIO from 'fp-ts/MonadIO';
|
|
16
|
+
import * as Mono from 'fp-ts/Monoid';
|
|
17
|
+
import * as O from 'fp-ts/Option';
|
|
18
|
+
import * as P from 'fp-ts/Pointed';
|
|
19
|
+
import * as Pr from 'fp-ts/Predicate';
|
|
20
|
+
import * as Re from 'fp-ts/Refinement';
|
|
21
|
+
import * as S from 'fp-ts/Separated';
|
|
22
|
+
import * as T from 'fp-ts/Task';
|
|
23
|
+
import * as $Y from './Yield';
|
|
24
|
+
export declare const URI = "AsyncYield";
|
|
25
|
+
export declare type URI = typeof URI;
|
|
26
|
+
declare module 'fp-ts/HKT' {
|
|
27
|
+
interface URItoKind<A> {
|
|
28
|
+
[URI]: AsyncYield<A>;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export declare type AsyncYield<A> = IO.IO<AsyncGenerator<A>>;
|
|
32
|
+
export declare const getMonoid: <A>() => Mono.Monoid<AsyncYield<A>>;
|
|
33
|
+
export declare const fromIOGenerator: <A>(as: $Y.Yield<A>) => AsyncYield<A>;
|
|
34
|
+
export declare const Functor: Fu.Functor1<URI>;
|
|
35
|
+
export declare const map: <A, B>(a: (a: A) => B) => (b: AsyncYield<A>) => AsyncYield<B>;
|
|
36
|
+
export declare const flap: <A>(a: A) => <B>(fab: AsyncYield<(a: A) => B>) => AsyncYield<B>;
|
|
37
|
+
export declare const bindTo: <N extends string>(name: N) => <A>(fa: AsyncYield<A>) => AsyncYield<{ readonly [K in N]: A; }>;
|
|
38
|
+
export declare const FunctorWithIndex: FuWI.FunctorWithIndex1<URI, number>;
|
|
39
|
+
export declare const Pointed: P.Pointed1<URI>;
|
|
40
|
+
export declare const of: <A>(a: A) => AsyncYield<A>;
|
|
41
|
+
export declare const Do: AsyncYield<{}>;
|
|
42
|
+
export declare const ApplyPar: _Apply.Apply1<URI>;
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
*/
|
|
46
|
+
export declare const ApplySeq: _Apply.Apply1<URI>;
|
|
47
|
+
export declare const ap: <A, B>(a: AsyncYield<A>) => (b: AsyncYield<(a: A) => B>) => AsyncYield<B>;
|
|
48
|
+
export declare const apFirst: <B>(second: AsyncYield<B>) => <A>(first: AsyncYield<A>) => AsyncYield<A>;
|
|
49
|
+
export declare const apSecond: <B>(second: AsyncYield<B>) => <A>(first: AsyncYield<A>) => AsyncYield<B>;
|
|
50
|
+
export declare const apS: <N extends string, A, B>(name: Exclude<N, keyof A>, fb: AsyncYield<B>) => (fa: AsyncYield<A>) => AsyncYield<{ readonly [K in N | keyof A]: K extends keyof A ? A[K] : B; }>;
|
|
51
|
+
export declare const ApplicativePar: Appli.Applicative1<URI>;
|
|
52
|
+
export declare const ApplicativeSeq: Appli.Applicative1<URI>;
|
|
53
|
+
export declare const Chain: Ch.Chain1<URI>;
|
|
54
|
+
export declare const chain: <A, B>(a: (a: A) => AsyncYield<B>) => (b: AsyncYield<A>) => AsyncYield<B>;
|
|
55
|
+
export declare const chainFirst: <A, B>(f: (a: A) => AsyncYield<B>) => (first: AsyncYield<A>) => AsyncYield<A>;
|
|
56
|
+
export declare const bind: <N extends string, A, B>(name: Exclude<N, keyof A>, f: (a: A) => AsyncYield<B>) => (ma: AsyncYield<A>) => AsyncYield<{ readonly [K in N | keyof A]: K extends keyof A ? A[K] : B; }>;
|
|
57
|
+
export declare const Monad: Mona.Monad1<URI>;
|
|
58
|
+
export declare const FromIO: FIO.FromIO1<URI>;
|
|
59
|
+
export declare const fromIO: import("fp-ts/lib/NaturalTransformation").NaturalTransformation11<"IO", "AsyncYield">;
|
|
60
|
+
export declare const fromIOK: <A extends readonly unknown[], B>(f: (...a: A) => IO.IO<B>) => (...a: A) => AsyncYield<B>;
|
|
61
|
+
export declare const chainIOK: <A, B>(f: (a: A) => IO.IO<B>) => (first: AsyncYield<A>) => AsyncYield<B>;
|
|
62
|
+
export declare const chainFirstIOK: <A, B>(f: (a: A) => IO.IO<B>) => (first: AsyncYield<A>) => AsyncYield<A>;
|
|
63
|
+
export declare const fromIOReadonlyArray: <A>(fa: IO.IO<readonly A[]>) => AsyncYield<A>;
|
|
64
|
+
export declare const fromIOReadonlyArrayK: <A extends readonly unknown[], B>(f: (...a: A) => IO.IO<readonly B[]>) => (...a: A) => AsyncYield<B>;
|
|
65
|
+
export declare const chainIOReadonlyArrayK: <A, B>(f: (a: A) => IO.IO<readonly B[]>) => (b: AsyncYield<A>) => AsyncYield<B>;
|
|
66
|
+
export declare const MonadIO: MIO.MonadIO1<URI>;
|
|
67
|
+
export declare const Compactable: Co.Compactable1<URI>;
|
|
68
|
+
export declare const compact: <A>(fa: AsyncYield<O.Option<A>>) => AsyncYield<A>;
|
|
69
|
+
export declare const separate: <A, B>(fa: AsyncYield<Ei.Either<A, B>>) => S.Separated<AsyncYield<A>, AsyncYield<B>>;
|
|
70
|
+
export declare const Filterable: Fi.Filterable1<URI>;
|
|
71
|
+
export declare function filter<A, B extends A>(refinement: Re.Refinement<A, B>): (fa: AsyncYield<A>) => AsyncYield<B>;
|
|
72
|
+
export declare function filter<A>(predicate: Pr.Predicate<A>): (fa: AsyncYield<A>) => AsyncYield<A>;
|
|
73
|
+
export declare const filterMap: <A, B>(a: (a: A) => O.Option<B>) => (b: AsyncYield<A>) => AsyncYield<B>;
|
|
74
|
+
export declare function partition<A, B extends A>(refinement: Re.Refinement<A, B>): (fa: AsyncYield<A>) => S.Separated<AsyncYield<A>, AsyncYield<B>>;
|
|
75
|
+
export declare function partition<A>(predicate: Pr.Predicate<A>): (fa: AsyncYield<A>) => S.Separated<AsyncYield<A>, AsyncYield<A>>;
|
|
76
|
+
export declare const partitionMap: <A, B, C>(a: (a: A) => Ei.Either<B, C>) => (b: AsyncYield<A>) => S.Separated<AsyncYield<B>, AsyncYield<C>>;
|
|
77
|
+
export declare const FilterableWithIndex: FiWI.FilterableWithIndex1<URI, number>;
|
|
78
|
+
export declare function filterWithIndex<A, B extends A>(refinementWithIndex: (i: number, a: A) => a is B): (fa: AsyncYield<A>) => AsyncYield<B>;
|
|
79
|
+
export declare function filterWithIndex<A>(predicateWithIndex: (i: number, a: A) => boolean): (fa: AsyncYield<A>) => AsyncYield<A>;
|
|
80
|
+
export declare const filterMapWithIndex: <A, B>(a: (i: number, a: A) => O.Option<B>) => (b: AsyncYield<A>) => AsyncYield<B>;
|
|
81
|
+
export declare function partitionWithIndex<A, B extends A>(refinementWithIndex: (i: number, a: A) => a is B): (fa: AsyncYield<A>) => S.Separated<AsyncYield<A>, AsyncYield<B>>;
|
|
82
|
+
export declare function partitionWithIndex<A>(predicateWithIndex: (i: number, a: A) => boolean): (fa: AsyncYield<A>) => S.Separated<AsyncYield<A>, AsyncYield<A>>;
|
|
83
|
+
export declare const partitionMapWithIndex: <A, B, C>(a: (i: number, a: A) => Ei.Either<B, C>) => (b: AsyncYield<A>) => S.Separated<AsyncYield<B>, AsyncYield<C>>;
|
|
84
|
+
export declare const range: (start: number, end?: number | undefined) => AsyncYield<number>;
|
|
85
|
+
export declare const replicate: <A>(a: A) => AsyncYield<A>;
|
|
86
|
+
export declare const fromReadonlyArray: <A>(x: readonly A[]) => AsyncYield<A>;
|
|
87
|
+
export declare const sieve: <A>(f: (init: readonly A[], a: A) => boolean) => (as: AsyncYield<A>) => AsyncYield<A>;
|
|
88
|
+
export declare const prime: AsyncYield<number>;
|
|
89
|
+
export declare const exp: AsyncYield<number>;
|
|
90
|
+
export declare const fibonacci: AsyncYield<number>;
|
|
91
|
+
export declare const flatten: <A>(as: AsyncYield<AsyncYield<A>>) => AsyncYield<A>;
|
|
92
|
+
export declare const take: <A>(n: number) => (as: AsyncYield<A>) => AsyncYield<A>;
|
|
93
|
+
export declare const drop: <A>(n: number) => (as: AsyncYield<A>) => AsyncYield<A>;
|
|
94
|
+
export declare const zip: <A, B>(bs: AsyncYield<B>) => (as: AsyncYield<A>) => AsyncYield<readonly [A, B]>;
|
|
95
|
+
export declare const uniq: <A>(E: Eq.Eq<A>) => (as: AsyncYield<A>) => AsyncYield<A>;
|
|
96
|
+
export declare const match: <A, B>(onEmpty: Lazy<B>, onNonEmpty: (head: A, tail: AsyncYield<A>) => B) => (as: AsyncYield<A>) => T.Task<B>;
|
|
97
|
+
export declare const toTask: <A>(as: AsyncYield<A>) => T.Task<readonly A[]>;
|
|
98
|
+
export declare const isEmpty: (as: AsyncYield<unknown>) => T.Task<boolean>;
|
|
99
|
+
export declare const isNonEmpty: (as: AsyncYield<unknown>) => T.Task<boolean>;
|
|
100
|
+
export declare const lookup: <A>(i: number) => (as: AsyncYield<A>) => T.Task<O.Option<A>>;
|
|
101
|
+
export declare const head: <A>(as: AsyncYield<A>) => T.Task<O.Option<A>>;
|
|
102
|
+
export declare function find<A, B extends A>(refinement: Re.Refinement<A, B>): (as: AsyncYield<A>) => T.Task<O.Option<B>>;
|
|
103
|
+
export declare function find<A>(predicate: Pr.Predicate<A>): (as: AsyncYield<A>) => T.Task<O.Option<A>>;
|
|
104
|
+
export declare const elem: <A>(Eq: Eq.Eq<A>) => (a: A) => (as: AsyncYield<A>) => T.Task<O.Option<A>>;
|
package/Buffer.d.ts
CHANGED
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [0.1.4](https://github.com/facile-it/fortepiano/compare/v0.1.3...v0.1.4) - 2022-06-24
|
|
8
|
+
|
|
9
|
+
### Security
|
|
10
|
+
|
|
11
|
+
- Fix CVE-2022-33987.
|
|
12
|
+
|
|
13
|
+
## [0.1.3](https://github.com/facile-it/fortepiano/compare/v0.1.2...v0.1.3) - 2022-05-31
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- Add `AggregateError` inspired from TC39.
|
|
18
|
+
- Add `decode` method to `Type` module to help wrapping `io-ts` `Errors` into an `Error` subclass.
|
|
19
|
+
- Add unit tests for the `set` function of the `Redis` module.
|
|
20
|
+
- Add `Has` module and enhance `ReaderTaskEither` for smart dependencies management (inspired by [Effect-TS](https://www.matechs.com/open-source)):
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
// Foo.ts
|
|
24
|
+
import { TaskEither } from 'fp-ts/TaskEither'
|
|
25
|
+
import { $has, $readerTaskEither } from 'fortepiano'
|
|
26
|
+
|
|
27
|
+
export interface Foo {
|
|
28
|
+
bar(a: number): TaskEither<Error, string>
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const TagFoo = $has.tag<Foo>()
|
|
32
|
+
|
|
33
|
+
export const $foo = {
|
|
34
|
+
bar: $readerTaskEither.derivesTaskEither(TagFoo, 'bar'),
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
// Bar.ts
|
|
40
|
+
import { IOEither } from 'fp-ts/IOEither'
|
|
41
|
+
import { $has, $readerTaskEither } from 'fortepiano'
|
|
42
|
+
|
|
43
|
+
export interface Bar {
|
|
44
|
+
(a: string): IOEither<Error, boolean>
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const TagBar = $has.tag<Bar>()
|
|
48
|
+
|
|
49
|
+
export const bar = $readerTaskEither.deriveIOEither(TagBar)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
// index.ts
|
|
54
|
+
import { $has } from 'fortepiano'
|
|
55
|
+
import { ioEither, readerTaskEither, taskEither } from 'fp-ts'
|
|
56
|
+
import { pipe } from 'fp-ts/function'
|
|
57
|
+
import { TagBar, bar } from './Bar'
|
|
58
|
+
import { $foo, TagFoo } from './Foo'
|
|
59
|
+
|
|
60
|
+
// const a: ReaderTaskEither<Has<Foo> & Has<Bar>, Error, boolean>
|
|
61
|
+
const a = pipe($foo.bar(42), readerTaskEither.chainW(bar))
|
|
62
|
+
|
|
63
|
+
// const b: TaskEither<Error, boolean>
|
|
64
|
+
const b = a(
|
|
65
|
+
// Let's mock our dependencies.
|
|
66
|
+
pipe(
|
|
67
|
+
$has.singleton(TagFoo, { bar: () => taskEither.of('foobar') }),
|
|
68
|
+
$has.upsertAt(TagBar, () => ioEither.of(true)),
|
|
69
|
+
),
|
|
70
|
+
)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Changed
|
|
74
|
+
|
|
75
|
+
- Replace `struct` type with `Struct`.
|
|
76
|
+
- Rename `GeneratorL` module to `Yield`.
|
|
77
|
+
- Use `cause` property to record wrapped errors (inspired by TC39).
|
|
78
|
+
|
|
79
|
+
### Deprecated
|
|
80
|
+
|
|
81
|
+
- Deprecate `struct` (use `Struct` instead).
|
|
82
|
+
- Deprecate `GeneratorL` module (use `Yield` instead).
|
|
83
|
+
|
|
84
|
+
### Fixed
|
|
85
|
+
|
|
86
|
+
- Decode from Json and then from the given codec in the `get` function of the `Redis` module.
|
|
87
|
+
|
|
88
|
+
## [0.1.2](https://github.com/facile-it/fortepiano/compare/v0.1.1...v0.1.2) - 2022-04-29
|
|
89
|
+
|
|
90
|
+
### Added
|
|
91
|
+
|
|
92
|
+
- Add `LICENSE.md`.
|
|
93
|
+
- Add `CONTRIBUTING.md`.
|
|
94
|
+
- Add `CHANGELOG.md`.
|
|
95
|
+
|
|
96
|
+
### Changed
|
|
97
|
+
|
|
98
|
+
- Relicense as MIT.
|
|
99
|
+
- Update `README.md`.
|
|
100
|
+
|
|
101
|
+
### Deprecated
|
|
102
|
+
|
|
103
|
+
- Deprecate `$got` (use `$axios` instead).
|
|
104
|
+
|
|
105
|
+
## [0.1.1](https://github.com/facile-it/fortepiano/compare/v0.1.0...v0.1.1) - 2022-04-26
|
|
106
|
+
|
|
107
|
+
### Added
|
|
108
|
+
|
|
109
|
+
- Support [tree shaking](https://webpack.js.org/guides/tree-shaking/) via top-level imports:
|
|
110
|
+
```typescript
|
|
111
|
+
import { curry } from 'fortepiano/function'
|
|
112
|
+
// ...instead of `import { curry } from 'fortepiano/lib/function'`
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Deprecated
|
|
116
|
+
|
|
117
|
+
- Discourage imports from `fortepiano/lib/*` as they break tree shaking.
|
|
118
|
+
|
|
119
|
+
## [0.1.0](https://github.com/facile-it/fortepiano/releases/tag/v0.1.0) - 2022-04-20
|
|
120
|
+
|
|
121
|
+
### Added
|
|
122
|
+
|
|
123
|
+
- First public release of `fortepiano`.
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Any relevant modification to this project should be duly noted in `CHANGELOG.md`. Changelog entries should come along code patches via pull requests.
|
|
4
|
+
|
|
5
|
+
## Style Guide
|
|
6
|
+
|
|
7
|
+
`fortepiano` modules should mymic `fp-ts` as best as they can regarding scope, naming and structure (see [`fp-ts` code conventions](https://gcanti.github.io/fp-ts/guides/code-conventions.html)). A custom convention should be used instead for imports and exports.
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
/**
|
|
11
|
+
* Import whole modules (i.e., values) from package index, and types
|
|
12
|
+
* from specific modules. "Function" modules are an exception.
|
|
13
|
+
*/
|
|
14
|
+
import { option } from 'fp-ts'
|
|
15
|
+
import { Option } from 'fp-ts/Option'
|
|
16
|
+
import { pipe } from 'fp-ts/function'
|
|
17
|
+
import { curry } from './function'
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Use namespace imports for local modules; don't import from index,
|
|
21
|
+
* it creates circular dependencies. Local modules must be spelled in
|
|
22
|
+
* camel case to stand out from types, and are prefixed with a `$` to
|
|
23
|
+
* avoid collisions.
|
|
24
|
+
*/
|
|
25
|
+
import * as $type from './Type'
|
|
26
|
+
// ...instead of `import { $type } from '.'`
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Use namespace imports for `io-ts` and friends, to avoid collisions
|
|
30
|
+
* and enforce consistency.
|
|
31
|
+
*/
|
|
32
|
+
import * as t from 'io-ts'
|
|
33
|
+
import * as tt from 'io-ts-types'
|
|
34
|
+
import * as nt from 'newtype-ts'
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Types must be spelled in Pascal case. Prefix them with a `$` if
|
|
38
|
+
* they collide with an internal type (e.g., `$Record`).
|
|
39
|
+
*/
|
|
40
|
+
export interface FooBar {}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Export functions directly, and don't forget to export the whole
|
|
44
|
+
* module as a namespace from index.
|
|
45
|
+
*/
|
|
46
|
+
export const fooBar = () => undefined
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### _A Fistful of `$`s_
|
|
50
|
+
|
|
51
|
+
We're in no way fans of prefixing stuff with `$`, but it's the best way we've found so far to avoid name collisions with internal TypeScript types, `fp-ts` exports, and generic variables.
|
package/Console.d.ts
CHANGED
|
@@ -6,14 +6,14 @@ export declare const info: (...as: ReadonlyArray<unknown>) => IO.IO<void>;
|
|
|
6
6
|
export declare const log: (...as: ReadonlyArray<unknown>) => IO.IO<void>;
|
|
7
7
|
export declare const trace: (...as: ReadonlyArray<unknown>) => IO.IO<void>;
|
|
8
8
|
export declare const warn: (...as: ReadonlyArray<unknown>) => IO.IO<void>;
|
|
9
|
-
export declare const assert: (condition?: boolean
|
|
9
|
+
export declare const assert: (condition?: boolean, ...as: ReadonlyArray<unknown>) => IO.IO<void>;
|
|
10
10
|
export declare const count: (a?: unknown) => IO.IO<void>;
|
|
11
11
|
export declare const countReset: (a?: unknown) => IO.IO<void>;
|
|
12
12
|
export declare const group: (...as: ReadonlyArray<unknown>) => IO.IO<void>;
|
|
13
13
|
export declare const groupCollapsed: (...as: ReadonlyArray<unknown>) => IO.IO<void>;
|
|
14
14
|
export declare const groupEnd: IO.IO<void>;
|
|
15
|
-
export declare function table<A extends $S.
|
|
16
|
-
export declare function table(data: $S.
|
|
15
|
+
export declare function table<A extends $S.Struct, K extends keyof A>(data: ReadonlyArray<A> | RR.ReadonlyRecord<string, A>, columns?: ReadonlyArray<K>): IO.IO<void>;
|
|
16
|
+
export declare function table(data: $S.Struct | ReadonlyArray<unknown>): IO.IO<void>;
|
|
17
17
|
export declare function table(a?: undefined | boolean | number | string, ...as: ReadonlyArray<unknown>): IO.IO<void>;
|
|
18
18
|
export declare const time: (a?: unknown) => IO.IO<void>;
|
|
19
19
|
export declare const timeEnd: (a?: unknown) => IO.IO<void>;
|
package/Crypto.d.ts
CHANGED
package/Error.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import * as t from 'io-ts';
|
|
2
|
+
/**
|
|
3
|
+
* @see https://tc39.es/proposal-promise-any/#sec-aggregate-error-objects
|
|
4
|
+
*/
|
|
5
|
+
export declare class AggregateError extends Error {
|
|
6
|
+
readonly errors: ReadonlyArray<Error>;
|
|
7
|
+
constructor(errors: ReadonlyArray<Error>, message?: string);
|
|
8
|
+
}
|
|
2
9
|
export declare const ErrorC: t.Type<Error, string, unknown>;
|
|
3
10
|
export declare const fromUnknown: (e: Error) => (u: unknown) => Error;
|
|
4
11
|
export declare const wrap: (e: Error) => (u: unknown) => Error & {
|
|
5
|
-
readonly
|
|
12
|
+
readonly cause?: Error;
|
|
6
13
|
};
|