fortepiano 0.1.1 → 0.1.2

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/CHANGELOG.md ADDED
@@ -0,0 +1,42 @@
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.2](https://github.com/facile-it/fortepiano/compare/v0.1.1...v0.1.2) - 2022-04-29
8
+
9
+ ### Added
10
+
11
+ - Add `LICENSE.md`.
12
+ - Add `CONTRIBUTING.md`.
13
+ - Add `CHANGELOG.md`.
14
+
15
+ ### Changed
16
+
17
+ - Relicense as MIT.
18
+ - Update `README.md`.
19
+
20
+ ### Deprecated
21
+
22
+ - Deprecate `$got` (use `$axios` instead).
23
+
24
+ ## [0.1.1](https://github.com/facile-it/fortepiano/compare/v0.1.0...v0.1.1) - 2022-04-26
25
+
26
+ ### Added
27
+
28
+ - Support [tree shaking](https://webpack.js.org/guides/tree-shaking/) via top-level imports:
29
+ ```
30
+ import { curry } from 'fortepiano/function'
31
+ // ...instead of `import { curry } from 'fortepiano/lib/function'`
32
+ ```
33
+
34
+ ### Deprecated
35
+
36
+ - Discourage imports from `fortepiano/lib/*` as they break tree shaking.
37
+
38
+ ## [0.1.0](https://github.com/facile-it/fortepiano/releases/tag/v0.1.0) - 2022-04-20
39
+
40
+ ### Added
41
+
42
+ - First public release of `fortepiano`.
@@ -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/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Facile.it
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,4 +1,56 @@
1
- # fortepiano
1
+ # fortepiano [ˌfɔrteˈpjaːno]
2
2
 
3
- [![main](https://github.com/facile-it/fortepiano/actions/workflows/main.yaml/badge.svg)](https://github.com/facile-it/fortepiano/actions/workflows/main.yaml)
4
- [![codecov](https://codecov.io/gh/facile-it/fortepiano/branch/master/graph/badge.svg?token=GRJ7ANG8WS)](https://codecov.io/gh/facile-it/fortepiano)
3
+ _Playing actual music over `fp-ts` notes_
4
+
5
+ [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/facile-it/fortepiano/main)](https://github.com/facile-it/fortepiano/actions)
6
+ [![Codecov](https://img.shields.io/codecov/c/gh/facile-it/fortepiano)](https://app.codecov.io/gh/facile-it/fortepiano)
7
+ [![GitHub](https://img.shields.io/github/license/facile-it/fortepiano)](LICENSE.md)
8
+ [![npm](https://img.shields.io/npm/v/fortepiano)](https://www.npmjs.com/package/fortepiano)
9
+
10
+ ## Description
11
+
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).
13
+
14
+ ## Getting Started
15
+
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
+ ### Installation
19
+
20
+ The package is available via [npm](https://www.npmjs.com/package/fortepiano), and must be installed along with its peer dependencies:
21
+
22
+ ```
23
+ npm install fortepiano fp-ts io-ts io-ts-types
24
+ ```
25
+
26
+ Additional packages are required, shall you want to use specific abstractions:
27
+
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`)
32
+
33
+ ### Usage
34
+
35
+ Import modules (e.g., values) from package index and types from specific modules. "Function" module and abstraction implementations are an exception:
36
+
37
+ ```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'
42
+ ```
43
+
44
+ ## Contributing
45
+
46
+ See the [CONTRIBUTING.md](CONTRIBUTING.md) file for details.
47
+
48
+ ## Authors
49
+
50
+ - [Davide Caruso](https://github.com/davidecaruso)
51
+ - [Pier Roberto Lucisano](https://github.com/pierroberto)
52
+ - [Alberto Villa](https://github.com/xzhavilla)
53
+
54
+ ## License
55
+
56
+ This project is licensed under the MIT License. See the [LICENSE.md](LICENSE.md) file for details.
package/esm/http/Got.js CHANGED
@@ -26,6 +26,9 @@ const request = (_got, method, url, options = {}) => $TE.tryCatch(() => _got(url
26
26
  body: error.response.body,
27
27
  }, `Cannot make HTTP request "${$S.uppercase(method)} ${url}": ${error.message}`))(error);
28
28
  }), $E.fromUnknown(Error(`Cannot make HTTP request "${$S.uppercase(method)} ${url}"`)));
29
+ /**
30
+ * @deprecated Use `$axios` instead
31
+ */
29
32
  export const $got = (_got) => ({
30
33
  delete: (url, options) => request(_got, 'delete', url, options),
31
34
  get: (url, options) => request(_got, 'get', url, options),
package/http/Got.d.ts CHANGED
@@ -1,3 +1,6 @@
1
1
  import { Got } from 'got';
2
2
  import * as $H from '../Http';
3
+ /**
4
+ * @deprecated Use `$axios` instead
5
+ */
3
6
  export declare const $got: (_got: Got) => $H.Http;
package/lib/http/Got.d.ts CHANGED
@@ -1,3 +1,6 @@
1
1
  import { Got } from 'got';
2
2
  import * as $H from '../Http';
3
+ /**
4
+ * @deprecated Use `$axios` instead
5
+ */
3
6
  export declare const $got: (_got: Got) => $H.Http;
package/lib/http/Got.js CHANGED
@@ -48,6 +48,9 @@ const request = (_got, method, url, options = {}) => $TE.tryCatch(() => _got(url
48
48
  body: error.response.body,
49
49
  }, `Cannot make HTTP request "${$S.uppercase(method)} ${url}": ${error.message}`))(error);
50
50
  }), $E.fromUnknown(Error(`Cannot make HTTP request "${$S.uppercase(method)} ${url}"`)));
51
+ /**
52
+ * @deprecated Use `$axios` instead
53
+ */
51
54
  const $got = (_got) => ({
52
55
  delete: (url, options) => request(_got, 'delete', url, options),
53
56
  get: (url, options) => request(_got, 'get', url, options),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "fortepiano",
3
- "version": "0.1.1",
4
- "description": "",
3
+ "version": "0.1.2",
4
+ "description": "Playing actual music over fp-ts notes",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./esm/index.js",
7
7
  "types": "./index.d.ts",
@@ -26,11 +26,17 @@
26
26
  "url": "git+https://github.com/facile-it/fortepiano.git"
27
27
  },
28
28
  "author": "Alberto Villa <villa.alberto@gmail.com>",
29
- "license": "ISC",
29
+ "license": "MIT",
30
30
  "bugs": {
31
31
  "url": "https://github.com/facile-it/fortepiano/issues"
32
32
  },
33
33
  "homepage": "https://github.com/facile-it/fortepiano#readme",
34
+ "keywords": [
35
+ "typescript",
36
+ "functional-programming",
37
+ "fp-ts",
38
+ "io-ts"
39
+ ],
34
40
  "devDependencies": {
35
41
  "@slynova/flydrive": "^1.0.0",
36
42
  "@types/jest": "^26.0.24",