fortepiano 0.1.8 → 1.0.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.
Files changed (243) hide show
  1. package/README.md +31 -18
  2. package/package.json +19 -57
  3. package/Aggregate/package.json +0 -6
  4. package/Aggregate.d.ts +0 -4
  5. package/AsyncYield/package.json +0 -6
  6. package/AsyncYield.d.ts +0 -104
  7. package/Binary/package.json +0 -6
  8. package/Binary.d.ts +0 -5
  9. package/Buffer/package.json +0 -6
  10. package/Buffer.d.ts +0 -4
  11. package/CHANGELOG.md +0 -160
  12. package/CONTRIBUTING.md +0 -51
  13. package/Cache/package.json +0 -6
  14. package/Cache.d.ts +0 -18
  15. package/Console/package.json +0 -6
  16. package/Console.d.ts +0 -20
  17. package/Crypto/package.json +0 -6
  18. package/Crypto.d.ts +0 -4
  19. package/Date/package.json +0 -6
  20. package/Date.d.ts +0 -4
  21. package/Eq/package.json +0 -6
  22. package/Eq.d.ts +0 -4
  23. package/Error/package.json +0 -6
  24. package/Error.d.ts +0 -13
  25. package/GeneratorL/package.json +0 -6
  26. package/GeneratorL.d.ts +0 -714
  27. package/Has/package.json +0 -6
  28. package/Has.d.ts +0 -16
  29. package/Http/package.json +0 -6
  30. package/Http.d.ts +0 -59
  31. package/Log/package.json +0 -6
  32. package/Log.d.ts +0 -4
  33. package/Magma/package.json +0 -6
  34. package/Magma.d.ts +0 -2
  35. package/Matrix/package.json +0 -6
  36. package/Matrix.d.ts +0 -9
  37. package/Mock/package.json +0 -6
  38. package/Mock.d.ts +0 -81
  39. package/Option/package.json +0 -6
  40. package/Option.d.ts +0 -2
  41. package/Random/package.json +0 -6
  42. package/Random.d.ts +0 -7
  43. package/Reader/package.json +0 -6
  44. package/Reader.d.ts +0 -4
  45. package/ReaderEither/package.json +0 -6
  46. package/ReaderEither.d.ts +0 -9
  47. package/ReaderTask/package.json +0 -6
  48. package/ReaderTask.d.ts +0 -8
  49. package/ReaderTaskEither/package.json +0 -6
  50. package/ReaderTaskEither.d.ts +0 -66
  51. package/ReadonlyArray/package.json +0 -6
  52. package/ReadonlyArray.d.ts +0 -75
  53. package/ReadonlyRecord/package.json +0 -6
  54. package/ReadonlyRecord.d.ts +0 -5
  55. package/ReadonlyTuple/package.json +0 -6
  56. package/ReadonlyTuple.d.ts +0 -14
  57. package/Storage/package.json +0 -6
  58. package/Storage.d.ts +0 -14
  59. package/Stream/package.json +0 -6
  60. package/Stream.d.ts +0 -4
  61. package/TaskEither/package.json +0 -6
  62. package/TaskEither.d.ts +0 -2
  63. package/Type/package.json +0 -6
  64. package/Type.d.ts +0 -13
  65. package/Validation/package.json +0 -6
  66. package/Validation.d.ts +0 -4
  67. package/Yield/package.json +0 -6
  68. package/Yield.d.ts +0 -210
  69. package/cache/Memcached/package.json +0 -6
  70. package/cache/Memcached.d.ts +0 -4
  71. package/cache/Memory/package.json +0 -6
  72. package/cache/Memory.d.ts +0 -2
  73. package/cache/Redis/package.json +0 -6
  74. package/cache/Redis.d.ts +0 -4
  75. package/cache/Storage/package.json +0 -6
  76. package/cache/Storage.d.ts +0 -4
  77. package/esm/Aggregate.js +0 -1
  78. package/esm/AsyncYield.js +0 -411
  79. package/esm/Binary.js +0 -12
  80. package/esm/Buffer.js +0 -22
  81. package/esm/Cache.js +0 -25
  82. package/esm/Console.js +0 -20
  83. package/esm/Crypto.js +0 -12
  84. package/esm/Date.js +0 -5
  85. package/esm/Eq.js +0 -6
  86. package/esm/Error.js +0 -45
  87. package/esm/GeneratorL.js +0 -802
  88. package/esm/Has.js +0 -5
  89. package/esm/Http.js +0 -138
  90. package/esm/Log.js +0 -2
  91. package/esm/Magma.js +0 -3
  92. package/esm/Matrix.js +0 -12
  93. package/esm/Mock.js +0 -79
  94. package/esm/Option.js +0 -3
  95. package/esm/Random.js +0 -3
  96. package/esm/Reader.js +0 -6
  97. package/esm/ReaderEither.js +0 -7
  98. package/esm/ReaderTask.js +0 -8
  99. package/esm/ReaderTaskEither.js +0 -58
  100. package/esm/ReadonlyArray.js +0 -44
  101. package/esm/ReadonlyRecord.js +0 -5
  102. package/esm/ReadonlyTuple.js +0 -10
  103. package/esm/Storage.js +0 -34
  104. package/esm/Stream.js +0 -9
  105. package/esm/TaskEither.js +0 -9
  106. package/esm/Type.js +0 -29
  107. package/esm/Validation.js +0 -6
  108. package/esm/Yield.js +0 -401
  109. package/esm/cache/Memcached.js +0 -27
  110. package/esm/cache/Memory.js +0 -43
  111. package/esm/cache/Redis.js +0 -35
  112. package/esm/cache/Storage.js +0 -40
  113. package/esm/function.js +0 -92
  114. package/esm/http/Axios.js +0 -36
  115. package/esm/http/Fetch.js +0 -48
  116. package/esm/http/Got.js +0 -40
  117. package/esm/http/Mock.js +0 -30
  118. package/esm/index.js +0 -39
  119. package/esm/log/Void.js +0 -3
  120. package/esm/number.js +0 -5
  121. package/esm/storage/Flydrive.js +0 -44
  122. package/esm/storage/Fs.js +0 -27
  123. package/esm/string.js +0 -9
  124. package/esm/struct.js +0 -19
  125. package/function/package.json +0 -6
  126. package/function.d.ts +0 -52
  127. package/http/Axios/package.json +0 -6
  128. package/http/Axios.d.ts +0 -3
  129. package/http/Fetch/package.json +0 -6
  130. package/http/Fetch.d.ts +0 -2
  131. package/http/Got/package.json +0 -6
  132. package/http/Got.d.ts +0 -6
  133. package/http/Mock/package.json +0 -6
  134. package/http/Mock.d.ts +0 -2
  135. package/index.d.ts +0 -55
  136. package/lib/Aggregate.d.ts +0 -4
  137. package/lib/Aggregate.js +0 -2
  138. package/lib/AsyncYield.d.ts +0 -104
  139. package/lib/AsyncYield.js +0 -461
  140. package/lib/Binary.d.ts +0 -5
  141. package/lib/Binary.js +0 -15
  142. package/lib/Buffer.d.ts +0 -4
  143. package/lib/Buffer.js +0 -49
  144. package/lib/Cache.d.ts +0 -18
  145. package/lib/Cache.js +0 -54
  146. package/lib/Console.d.ts +0 -20
  147. package/lib/Console.js +0 -25
  148. package/lib/Crypto.d.ts +0 -4
  149. package/lib/Crypto.js +0 -43
  150. package/lib/Date.d.ts +0 -4
  151. package/lib/Date.js +0 -34
  152. package/lib/Eq.d.ts +0 -4
  153. package/lib/Eq.js +0 -33
  154. package/lib/Error.d.ts +0 -13
  155. package/lib/Error.js +0 -74
  156. package/lib/GeneratorL.d.ts +0 -714
  157. package/lib/GeneratorL.js +0 -905
  158. package/lib/Has.d.ts +0 -16
  159. package/lib/Has.js +0 -13
  160. package/lib/Http.d.ts +0 -59
  161. package/lib/Http.js +0 -172
  162. package/lib/Log.d.ts +0 -4
  163. package/lib/Log.js +0 -5
  164. package/lib/Magma.d.ts +0 -2
  165. package/lib/Magma.js +0 -30
  166. package/lib/Matrix.d.ts +0 -9
  167. package/lib/Matrix.js +0 -40
  168. package/lib/Mock.d.ts +0 -81
  169. package/lib/Mock.js +0 -118
  170. package/lib/Option.d.ts +0 -2
  171. package/lib/Option.js +0 -30
  172. package/lib/Random.d.ts +0 -7
  173. package/lib/Random.js +0 -7
  174. package/lib/Reader.d.ts +0 -4
  175. package/lib/Reader.js +0 -35
  176. package/lib/ReaderEither.d.ts +0 -9
  177. package/lib/ReaderEither.js +0 -38
  178. package/lib/ReaderTask.d.ts +0 -8
  179. package/lib/ReaderTask.js +0 -39
  180. package/lib/ReaderTaskEither.d.ts +0 -66
  181. package/lib/ReaderTaskEither.js +0 -138
  182. package/lib/ReadonlyArray.d.ts +0 -75
  183. package/lib/ReadonlyArray.js +0 -74
  184. package/lib/ReadonlyRecord.d.ts +0 -5
  185. package/lib/ReadonlyRecord.js +0 -34
  186. package/lib/ReadonlyTuple.d.ts +0 -14
  187. package/lib/ReadonlyTuple.js +0 -38
  188. package/lib/Storage.d.ts +0 -14
  189. package/lib/Storage.js +0 -61
  190. package/lib/Stream.d.ts +0 -4
  191. package/lib/Stream.js +0 -35
  192. package/lib/TaskEither.d.ts +0 -2
  193. package/lib/TaskEither.js +0 -36
  194. package/lib/Type.d.ts +0 -13
  195. package/lib/Type.js +0 -61
  196. package/lib/Validation.d.ts +0 -4
  197. package/lib/Validation.js +0 -34
  198. package/lib/Yield.d.ts +0 -210
  199. package/lib/Yield.js +0 -504
  200. package/lib/cache/Memcached.d.ts +0 -4
  201. package/lib/cache/Memcached.js +0 -54
  202. package/lib/cache/Memory.d.ts +0 -2
  203. package/lib/cache/Memory.js +0 -70
  204. package/lib/cache/Redis.d.ts +0 -4
  205. package/lib/cache/Redis.js +0 -62
  206. package/lib/cache/Storage.d.ts +0 -4
  207. package/lib/cache/Storage.js +0 -66
  208. package/lib/function.d.ts +0 -52
  209. package/lib/function.js +0 -101
  210. package/lib/http/Axios.d.ts +0 -3
  211. package/lib/http/Axios.js +0 -63
  212. package/lib/http/Fetch.d.ts +0 -2
  213. package/lib/http/Fetch.js +0 -75
  214. package/lib/http/Got.d.ts +0 -6
  215. package/lib/http/Got.js +0 -67
  216. package/lib/http/Mock.d.ts +0 -2
  217. package/lib/http/Mock.js +0 -56
  218. package/lib/index.d.ts +0 -55
  219. package/lib/index.js +0 -98
  220. package/lib/log/Void.d.ts +0 -3
  221. package/lib/log/Void.js +0 -6
  222. package/lib/number.d.ts +0 -3
  223. package/lib/number.js +0 -8
  224. package/lib/storage/Flydrive.d.ts +0 -4
  225. package/lib/storage/Flydrive.js +0 -71
  226. package/lib/storage/Fs.d.ts +0 -3
  227. package/lib/storage/Fs.js +0 -57
  228. package/lib/string.d.ts +0 -8
  229. package/lib/string.js +0 -43
  230. package/lib/struct.d.ts +0 -13
  231. package/lib/struct.js +0 -51
  232. package/log/Void/package.json +0 -6
  233. package/log/Void.d.ts +0 -3
  234. package/number/package.json +0 -6
  235. package/number.d.ts +0 -3
  236. package/storage/Flydrive/package.json +0 -6
  237. package/storage/Flydrive.d.ts +0 -4
  238. package/storage/Fs/package.json +0 -6
  239. package/storage/Fs.d.ts +0 -3
  240. package/string/package.json +0 -6
  241. package/string.d.ts +0 -8
  242. package/struct/package.json +0 -6
  243. package/struct.d.ts +0 -13
package/README.md CHANGED
@@ -1,6 +1,10 @@
1
+ <p align="center">
2
+ <img src="./logo.png" width=150px" height="auto"/>
3
+ </p>
4
+
1
5
  # fortepiano [ˌfɔrteˈpjaːno]
2
6
 
3
- _Playing actual music over `fp-ts` notes_
7
+ _Playing actual music over `fp-ts` notes_ 🎶
4
8
 
5
9
  [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/facile-it/fortepiano/main)](https://github.com/facile-it/fortepiano/actions)
6
10
  [![Codecov](https://img.shields.io/codecov/c/gh/facile-it/fortepiano)](https://app.codecov.io/gh/facile-it/fortepiano)
@@ -9,36 +13,45 @@ _Playing actual music over `fp-ts` notes_
9
13
 
10
14
  ## Description
11
15
 
12
- `fortepiano` provides a set of common abstractions for functional application development (e.g., `Http`, `Storage`...), while extending [`fp-ts`](https://github.com/gcanti/fp-ts) with useful modules _à la_ [`fp-ts-contrib`](https://github.com/gcanti/fp-ts-contrib).
16
+ Fortepiano is a mocking library for TypeScript. It promotes immutability, composability and purity, making it ideal for projects that embrace functional programming principles.
13
17
 
14
18
  ## Getting Started
15
19
 
16
- `fortepiano` stands on the shoulders of the giant `fp-ts`. As such, a good understanding of its [concepts](https://gcanti.github.io/fp-ts/) is suggested.
17
-
18
20
  ### Installation
19
21
 
20
- The package is available via [npm](https://www.npmjs.com/package/fortepiano), and must be installed along with its peer dependencies:
22
+ To install the stable version:
21
23
 
22
- ```
23
- npm install fortepiano fp-ts io-ts io-ts-types
24
+ ```bash
25
+ npm install fortepiano
24
26
  ```
25
27
 
26
- Additional packages are required, shall you want to use specific abstractions:
28
+ or using yarn:
27
29
 
28
- - [`memcached`](https://www.npmjs.com/package/memcached) and [`@types/memcached`](https://www.npmjs.com/package/@types/memcached) (`cache/Memcached`)
29
- - [`redis`](https://www.npmjs.com/package/redis) and [`@types/redis`](https://www.npmjs.com/package/@types/redis) (`cache/Redis`)
30
- - [`axios`](https://www.npmjs.com/package/axios) (`http/Axios`)
31
- - [`@slynova/flydrive`](https://www.npmjs.com/package/@slynova/flydrive) (`storage/Flydrive`)
30
+ ```bash
31
+ yarn add fortepiano
32
+ ```
32
33
 
33
34
  ### Usage
34
35
 
35
- Import modules (e.g., values) from package index and types from specific modules. "Function" module and abstraction implementations are an exception:
36
+ Fortepiano uses a functional API to create and configure mocks, encouraging pure function usage and immutable mock objects.
37
+
38
+ Here's an example:
36
39
 
37
40
  ```typescript
38
- import { $type } from 'fortepiano'
39
- import { Struct } from 'fortepiano/struct'
40
- import { curry } from 'fortepiano/function'
41
- import { $axios } from 'fortepiano/http/Axios'
41
+ import { $mock } from 'fortepiano'
42
+
43
+ interface User {
44
+ firstName: string
45
+ lastName: string
46
+ }
47
+
48
+ export const UserMock = (): $mock.Mock<User> =>
49
+ $mock.struct({
50
+ firstName: $mock.string,
51
+ lastName: $mock.string,
52
+ })
53
+
54
+ console.log(UserMock()()()) // Output: { firstName: 'randomString', lastName: 'randomString' }
42
55
  ```
43
56
 
44
57
  ## Contributing
@@ -49,7 +62,7 @@ See the [CONTRIBUTING.md](CONTRIBUTING.md) file for details.
49
62
 
50
63
  - [Davide Caruso](https://github.com/davidecaruso)
51
64
  - [Pier Roberto Lucisano](https://github.com/pierroberto)
52
- - [Alberto Villa](https://github.com/xzhavilla)
65
+ - [Alberto Villa](https://github.com/xzhayon)
53
66
 
54
67
  ## License
55
68
 
package/package.json CHANGED
@@ -1,12 +1,22 @@
1
1
  {
2
2
  "name": "fortepiano",
3
- "version": "0.1.8",
3
+ "version": "1.0.0",
4
4
  "description": "Playing actual music over fp-ts notes",
5
5
  "keywords": [
6
6
  "typescript",
7
7
  "functional-programming",
8
8
  "fp-ts",
9
- "io-ts"
9
+ "testing"
10
+ ],
11
+ "exports": {
12
+ ".": {
13
+ "require": "./dist/cjs/index.js",
14
+ "import": "./dist/esm/index.js"
15
+ }
16
+ },
17
+ "files": [
18
+ "./dist/cjs/**",
19
+ "./dist/esm/**"
10
20
  ],
11
21
  "homepage": "https://github.com/facile-it/fortepiano#readme",
12
22
  "bugs": {
@@ -19,9 +29,9 @@
19
29
  "license": "MIT",
20
30
  "author": "Alberto Villa <villa.alberto@gmail.com>",
21
31
  "sideEffects": false,
22
- "main": "./lib/index.js",
23
- "module": "./esm/index.js",
24
- "types": "./index.d.ts",
32
+ "main": "./dist/cjs/index.js",
33
+ "module": "./dist/esm/index.js",
34
+ "types": "./dist/esm/index.d.ts",
25
35
  "scripts": {
26
36
  "prebuild": "yarn clean",
27
37
  "build": "yarn prebuild && yarn build:esm && yarn build:cjs",
@@ -32,73 +42,25 @@
32
42
  "eslint:fix": "eslint --fix ./",
33
43
  "prettier": "prettier --check ./",
34
44
  "prettier:fix": "prettier --write ./",
35
- "prerelease": "yarn build && ./scripts/hybridize.sh && cp ./package.json ./*.md ./dist/",
45
+ "prerelease": "yarn build && cp ./package.json ./*.md ./dist/",
36
46
  "release": "yarn prerelease && npm publish ./dist/",
37
47
  "test": "jest",
48
+ "test:watch": "jest --watchAll",
38
49
  "test:coverage": "jest --coverage"
39
50
  },
40
51
  "devDependencies": {
41
52
  "@rushstack/eslint-patch": "^1.1.3",
42
- "@slynova/flydrive": "^1.0.0",
43
53
  "@types/jest": "^26.0.24",
44
- "@types/memcached": "^2.0.0",
45
- "@types/node-fetch": "^2.5.12",
46
- "@types/redis": "^2.0.0",
47
- "@types/redis-mock": "^0.17.0",
48
- "axios": "^0.21.2",
54
+ "@types/node": "^22.8.7",
49
55
  "eslint": "^8.16.0",
50
56
  "eslint-config-facile": "^0.5.0",
51
57
  "fp-ts": "^2.0.0",
52
- "got": "^11.0.0",
53
58
  "io-ts": "^2.0.0",
54
- "io-ts-types": "^0.5.0",
55
59
  "jest": "^26.6.3",
56
- "memcached": "^2.0.0",
57
- "memcached-mock": "^0.1.0",
58
- "monocle-ts": "^2.3.10",
59
- "newtype-ts": "^0.3.4",
60
- "node-fetch": "^2.6.7",
61
60
  "prettier": "^2.6.2",
62
- "redis": "^3.0.0",
63
- "redis-mock": "^0.56.3",
64
61
  "ts-jest": "^26.5.6",
65
- "ts-node": "^9.1.1",
62
+ "ts-node": "^10.9.2",
66
63
  "typescript": "^4.6.4"
67
64
  },
68
- "peerDependencies": {
69
- "@slynova/flydrive": "^1.0.0",
70
- "@types/memcached": "^2.0.0",
71
- "@types/redis": "^2.0.0",
72
- "axios": "^0.21.2",
73
- "fp-ts": "^2.0.0",
74
- "got": "^11.0.0",
75
- "io-ts": "^2.0.0",
76
- "io-ts-types": "^0.5.0",
77
- "memcached": "^2.0.0",
78
- "redis": "^3.0.0"
79
- },
80
- "peerDependenciesMeta": {
81
- "@slynova/flydrive": {
82
- "optional": true
83
- },
84
- "@types/memcached": {
85
- "optional": true
86
- },
87
- "@types/redis": {
88
- "optional": true
89
- },
90
- "axios": {
91
- "optional": true
92
- },
93
- "got": {
94
- "optional": true
95
- },
96
- "memcached": {
97
- "optional": true
98
- },
99
- "redis": {
100
- "optional": true
101
- }
102
- },
103
65
  "packageManager": "yarn@3.2.3"
104
66
  }
@@ -1,6 +0,0 @@
1
- {
2
- "main": "../lib/Aggregate.js",
3
- "module": "../esm/Aggregate.js",
4
- "types": "../Aggregate.d.ts",
5
- "sideEffects": false
6
- }
package/Aggregate.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export interface Aggregate<A> {
2
- isEmpty: (a: A) => boolean;
3
- size: (a: A) => number;
4
- }
@@ -1,6 +0,0 @@
1
- {
2
- "main": "../lib/AsyncYield.js",
3
- "module": "../esm/AsyncYield.js",
4
- "types": "../AsyncYield.d.ts",
5
- "sideEffects": false
6
- }
package/AsyncYield.d.ts DELETED
@@ -1,104 +0,0 @@
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>>;
@@ -1,6 +0,0 @@
1
- {
2
- "main": "../lib/Binary.js",
3
- "module": "../esm/Binary.js",
4
- "types": "../Binary.d.ts",
5
- "sideEffects": false
6
- }
package/Binary.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import * as M from 'fp-ts/Monoid';
2
- export declare type Binary = 0 | 1;
3
- export declare const MonoidAnd: M.Monoid<Binary>;
4
- export declare const MonoidOr: M.Monoid<Binary>;
5
- export declare const MonoidXor: M.Monoid<Binary>;
@@ -1,6 +0,0 @@
1
- {
2
- "main": "../lib/Buffer.js",
3
- "module": "../esm/Buffer.js",
4
- "types": "../Buffer.d.ts",
5
- "sideEffects": false
6
- }
package/Buffer.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import * as t from 'io-ts';
2
- export declare const BufferC: t.Type<Buffer, string, unknown>;
3
- export declare const BufferFromStringC: t.Type<Buffer, string, unknown>;
4
- export declare const fromStream: (stream: NodeJS.ReadableStream) => import("fp-ts/lib/TaskEither").TaskEither<Error, Buffer>;
package/CHANGELOG.md DELETED
@@ -1,160 +0,0 @@
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.8](https://github.com/facile-it/fortepiano/compare/v0.1.7...v0.1.8) - 2023-07-10
8
-
9
- ### Added
10
-
11
- - Complete the list of `Http` errors.
12
-
13
- ### Security
14
-
15
- - Fix CVE-2023-26136.
16
-
17
- ## [0.1.7](https://github.com/facile-it/fortepiano/compare/v0.1.6...v0.1.7) - 2023-01-02
18
-
19
- ### Added
20
-
21
- - Add `infix` to `string` module.
22
-
23
- ## [0.1.6](https://github.com/facile-it/fortepiano/compare/v0.1.5...v0.1.6) - 2022-09-30
24
-
25
- ### Added
26
-
27
- - Add `collectWithIndex` function to `ReadonlyRecord` module.
28
-
29
- ## [0.1.5](https://github.com/facile-it/fortepiano/compare/v0.1.4...v0.1.5) - 2022-09-22
30
-
31
- ### Added
32
-
33
- - Add `prefix` to `string` module.
34
- - Add `suffix` to `string` module.
35
-
36
- ### Changed
37
-
38
- - Changed overloads of `$mock.union` function.
39
-
40
- ### Fixed
41
-
42
- - Update `yarn.lock` in order to fix "typescript (18.x)" and "jest (18.x)" jobs in CI.
43
-
44
- ## [0.1.4](https://github.com/facile-it/fortepiano/compare/v0.1.3...v0.1.4) - 2022-06-24
45
-
46
- ### Security
47
-
48
- - Fix CVE-2022-33987.
49
-
50
- ## [0.1.3](https://github.com/facile-it/fortepiano/compare/v0.1.2...v0.1.3) - 2022-05-31
51
-
52
- ### Added
53
-
54
- - Add `AggregateError` inspired from TC39.
55
- - Add `decode` method to `Type` module to help wrapping `io-ts` `Errors` into an `Error` subclass.
56
- - Add unit tests for the `set` function of the `Redis` module.
57
- - Add `Has` module and enhance `ReaderTaskEither` for smart dependencies management (inspired by [Effect-TS](https://www.matechs.com/open-source)):
58
-
59
- ```typescript
60
- // Foo.ts
61
- import { TaskEither } from 'fp-ts/TaskEither'
62
- import { $has, $readerTaskEither } from 'fortepiano'
63
-
64
- export interface Foo {
65
- bar(a: number): TaskEither<Error, string>
66
- }
67
-
68
- export const TagFoo = $has.tag<Foo>()
69
-
70
- export const $foo = {
71
- bar: $readerTaskEither.derivesTaskEither(TagFoo, 'bar'),
72
- }
73
- ```
74
-
75
- ```typescript
76
- // Bar.ts
77
- import { IOEither } from 'fp-ts/IOEither'
78
- import { $has, $readerTaskEither } from 'fortepiano'
79
-
80
- export interface Bar {
81
- (a: string): IOEither<Error, boolean>
82
- }
83
-
84
- export const TagBar = $has.tag<Bar>()
85
-
86
- export const bar = $readerTaskEither.deriveIOEither(TagBar)
87
- ```
88
-
89
- ```typescript
90
- // index.ts
91
- import { $has } from 'fortepiano'
92
- import { ioEither, readerTaskEither, taskEither } from 'fp-ts'
93
- import { pipe } from 'fp-ts/function'
94
- import { TagBar, bar } from './Bar'
95
- import { $foo, TagFoo } from './Foo'
96
-
97
- // const a: ReaderTaskEither<Has<Foo> & Has<Bar>, Error, boolean>
98
- const a = pipe($foo.bar(42), readerTaskEither.chainW(bar))
99
-
100
- // const b: TaskEither<Error, boolean>
101
- const b = a(
102
- // Let's mock our dependencies.
103
- pipe(
104
- $has.singleton(TagFoo, { bar: () => taskEither.of('foobar') }),
105
- $has.upsertAt(TagBar, () => ioEither.of(true)),
106
- ),
107
- )
108
- ```
109
-
110
- ### Changed
111
-
112
- - Replace `struct` type with `Struct`.
113
- - Rename `GeneratorL` module to `Yield`.
114
- - Use `cause` property to record wrapped errors (inspired by TC39).
115
-
116
- ### Deprecated
117
-
118
- - Deprecate `struct` (use `Struct` instead).
119
- - Deprecate `GeneratorL` module (use `Yield` instead).
120
-
121
- ### Fixed
122
-
123
- - Decode from Json and then from the given codec in the `get` function of the `Redis` module.
124
-
125
- ## [0.1.2](https://github.com/facile-it/fortepiano/compare/v0.1.1...v0.1.2) - 2022-04-29
126
-
127
- ### Added
128
-
129
- - Add `LICENSE.md`.
130
- - Add `CONTRIBUTING.md`.
131
- - Add `CHANGELOG.md`.
132
-
133
- ### Changed
134
-
135
- - Relicense as MIT.
136
- - Update `README.md`.
137
-
138
- ### Deprecated
139
-
140
- - Deprecate `$got` (use `$axios` instead).
141
-
142
- ## [0.1.1](https://github.com/facile-it/fortepiano/compare/v0.1.0...v0.1.1) - 2022-04-26
143
-
144
- ### Added
145
-
146
- - Support [tree shaking](https://webpack.js.org/guides/tree-shaking/) via top-level imports:
147
- ```typescript
148
- import { curry } from 'fortepiano/function'
149
- // ...instead of `import { curry } from 'fortepiano/lib/function'`
150
- ```
151
-
152
- ### Deprecated
153
-
154
- - Discourage imports from `fortepiano/lib/*` as they break tree shaking.
155
-
156
- ## [0.1.0](https://github.com/facile-it/fortepiano/releases/tag/v0.1.0) - 2022-04-20
157
-
158
- ### Added
159
-
160
- - First public release of `fortepiano`.
package/CONTRIBUTING.md DELETED
@@ -1,51 +0,0 @@
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.
@@ -1,6 +0,0 @@
1
- {
2
- "main": "../lib/Cache.js",
3
- "module": "../esm/Cache.js",
4
- "types": "../Cache.d.ts",
5
- "sideEffects": false
6
- }
package/Cache.d.ts DELETED
@@ -1,18 +0,0 @@
1
- import { Endomorphism } from 'fp-ts/function';
2
- import * as J from 'fp-ts/Json';
3
- import * as RNEA from 'fp-ts/ReadonlyNonEmptyArray';
4
- import * as TE from 'fp-ts/TaskEither';
5
- import * as t from 'io-ts';
6
- import { memory } from './cache/Memory';
7
- import { storage } from './cache/Storage';
8
- import * as $L from './Log';
9
- export interface Cache {
10
- readonly get: <A>(key: string, codec: t.Type<A, unknown>) => TE.TaskEither<Error, A>;
11
- readonly set: <A>(key: string, codec: t.Type<A, J.Json>, ttl?: number) => (value: A) => TE.TaskEither<Error, void>;
12
- readonly delete: (key: string) => TE.TaskEither<Error, void>;
13
- readonly clear: TE.TaskEither<Error, void>;
14
- }
15
- export declare const chain: (...caches: RNEA.ReadonlyNonEmptyArray<Cache>) => Cache;
16
- export declare function log(logStart: $L.Logger, logEnd: $L.Logger): Endomorphism<Cache>;
17
- export declare function log(log: $L.Logger): Endomorphism<Cache>;
18
- export { memory, storage };
@@ -1,6 +0,0 @@
1
- {
2
- "main": "../lib/Console.js",
3
- "module": "../esm/Console.js",
4
- "types": "../Console.d.ts",
5
- "sideEffects": false
6
- }
package/Console.d.ts DELETED
@@ -1,20 +0,0 @@
1
- import * as IO from 'fp-ts/IO';
2
- import * as RR from 'fp-ts/ReadonlyRecord';
3
- import * as $S from './struct';
4
- export declare const error: (...as: ReadonlyArray<unknown>) => IO.IO<void>;
5
- export declare const info: (...as: ReadonlyArray<unknown>) => IO.IO<void>;
6
- export declare const log: (...as: ReadonlyArray<unknown>) => IO.IO<void>;
7
- export declare const trace: (...as: ReadonlyArray<unknown>) => IO.IO<void>;
8
- export declare const warn: (...as: ReadonlyArray<unknown>) => IO.IO<void>;
9
- export declare const assert: (condition?: boolean, ...as: ReadonlyArray<unknown>) => IO.IO<void>;
10
- export declare const count: (a?: unknown) => IO.IO<void>;
11
- export declare const countReset: (a?: unknown) => IO.IO<void>;
12
- export declare const group: (...as: ReadonlyArray<unknown>) => IO.IO<void>;
13
- export declare const groupCollapsed: (...as: ReadonlyArray<unknown>) => IO.IO<void>;
14
- export declare const groupEnd: IO.IO<void>;
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
- export declare function table(a?: undefined | boolean | number | string, ...as: ReadonlyArray<unknown>): IO.IO<void>;
18
- export declare const time: (a?: unknown) => IO.IO<void>;
19
- export declare const timeEnd: (a?: unknown) => IO.IO<void>;
20
- export declare const timeLog: (a?: unknown) => IO.IO<void>;
@@ -1,6 +0,0 @@
1
- {
2
- "main": "../lib/Crypto.js",
3
- "module": "../esm/Crypto.js",
4
- "types": "../Crypto.d.ts",
5
- "sideEffects": false
6
- }
package/Crypto.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import * as TE from 'fp-ts/TaskEither';
2
- export declare const randomBytes: (size: number) => TE.TaskEither<Error, Buffer>;
3
- export declare const hash: (size: number, encoding?: BufferEncoding) => TE.TaskEither<Error, string>;
4
- export declare const uuid4: TE.TaskEither<Error, string>;
package/Date/package.json DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "main": "../lib/Date.js",
3
- "module": "../esm/Date.js",
4
- "types": "../Date.d.ts",
5
- "sideEffects": false
6
- }
package/Date.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import * as O from 'fp-ts/Option';
2
- export declare const fromDate: (date: Date) => O.Option<Date>;
3
- export declare const fromString: (date: string) => O.Option<Date>;
4
- export declare const parse: (date: string) => O.Option<number>;
package/Eq/package.json DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "main": "../lib/Eq.js",
3
- "module": "../esm/Eq.js",
4
- "types": "../Eq.d.ts",
5
- "sideEffects": false
6
- }