fortepiano 0.1.6 → 0.1.8
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 +16 -0
- package/Http.d.ts +1 -1
- package/esm/Http.js +37 -0
- package/esm/string.js +1 -0
- package/lib/Http.d.ts +1 -1
- package/lib/Http.js +37 -0
- package/lib/string.d.ts +1 -0
- package/lib/string.js +3 -1
- package/package.json +1 -1
- package/string.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,22 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
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
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
|
+
|
|
7
23
|
## [0.1.6](https://github.com/facile-it/fortepiano/compare/v0.1.5...v0.1.6) - 2022-09-30
|
|
8
24
|
|
|
9
25
|
### Added
|
package/Http.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ export declare const HttpResponseC: <C extends t.Mixed>(codec: C) => t.TypeC<{
|
|
|
50
50
|
headers: t.ReadonlyC<t.RecordC<t.StringC, t.UnionC<[t.StringC, t.ReadonlyArrayC<t.StringC>]>>>;
|
|
51
51
|
body: C;
|
|
52
52
|
}>;
|
|
53
|
-
export declare const HttpErrorC: <A extends "BadRequest" | "Unauthorized" | "Forbidden" | "NotFound" | "UnprocessableEntity">(type?: A | undefined) => t.Type<HttpError, HttpError, unknown>;
|
|
53
|
+
export declare const HttpErrorC: <A extends "BadRequest" | "Unauthorized" | "PaymentRequired" | "Forbidden" | "NotFound" | "MethodNotAllowed" | "NotAcceptable" | "ProxyAuthenticationRequired" | "RequestTimeout" | "Conflict" | "Gone" | "LengthRequired" | "PreconditionFailed" | "PayloadTooLarge" | "RequestUriTooLong" | "UnsupportedMediaType" | "RequestedRangeNotSatisfiable" | "ExpectationFailed" | "ImATeapot" | "MisdirectedRequest" | "UnprocessableEntity" | "Locked" | "FailedDependency" | "UpgradeRequired" | "PreconditionRequired" | "TooManyRequests" | "RequestHeaderFieldsTooLarge" | "ConnectionClosedWithoutResponse" | "UnavailableForLegalReasons" | "ClientClosedRequest" | "InternalServerError" | "NotImplemented" | "BadGateway" | "ServiceUnavailable" | "GatewayTimeout" | "HttpVersionNotSupported" | "VariantAlsoNegotiates" | "InsufficientStorage" | "LoopDetected" | "NotExtended" | "NetworkAuthenticationRequired" | "NetworkConnectTimeoutError">(type?: A | undefined) => t.Type<HttpError, HttpError, unknown>;
|
|
54
54
|
export declare const json: (http: Http) => Http;
|
|
55
55
|
export declare const buffer: (http: Http) => Http;
|
|
56
56
|
export declare const cache: (cache: $C.Cache) => (http: Http) => Http;
|
package/esm/Http.js
CHANGED
|
@@ -15,9 +15,46 @@ import * as $T from './Type';
|
|
|
15
15
|
const ERRORS = {
|
|
16
16
|
BadRequest: 400,
|
|
17
17
|
Unauthorized: 401,
|
|
18
|
+
PaymentRequired: 402,
|
|
18
19
|
Forbidden: 403,
|
|
19
20
|
NotFound: 404,
|
|
21
|
+
MethodNotAllowed: 405,
|
|
22
|
+
NotAcceptable: 406,
|
|
23
|
+
ProxyAuthenticationRequired: 407,
|
|
24
|
+
RequestTimeout: 408,
|
|
25
|
+
Conflict: 409,
|
|
26
|
+
Gone: 410,
|
|
27
|
+
LengthRequired: 411,
|
|
28
|
+
PreconditionFailed: 412,
|
|
29
|
+
PayloadTooLarge: 413,
|
|
30
|
+
RequestUriTooLong: 414,
|
|
31
|
+
UnsupportedMediaType: 415,
|
|
32
|
+
RequestedRangeNotSatisfiable: 416,
|
|
33
|
+
ExpectationFailed: 417,
|
|
34
|
+
ImATeapot: 418,
|
|
35
|
+
MisdirectedRequest: 421,
|
|
20
36
|
UnprocessableEntity: 422,
|
|
37
|
+
Locked: 423,
|
|
38
|
+
FailedDependency: 424,
|
|
39
|
+
UpgradeRequired: 426,
|
|
40
|
+
PreconditionRequired: 428,
|
|
41
|
+
TooManyRequests: 429,
|
|
42
|
+
RequestHeaderFieldsTooLarge: 431,
|
|
43
|
+
ConnectionClosedWithoutResponse: 444,
|
|
44
|
+
UnavailableForLegalReasons: 451,
|
|
45
|
+
ClientClosedRequest: 499,
|
|
46
|
+
InternalServerError: 500,
|
|
47
|
+
NotImplemented: 501,
|
|
48
|
+
BadGateway: 502,
|
|
49
|
+
ServiceUnavailable: 503,
|
|
50
|
+
GatewayTimeout: 504,
|
|
51
|
+
HttpVersionNotSupported: 505,
|
|
52
|
+
VariantAlsoNegotiates: 506,
|
|
53
|
+
InsufficientStorage: 507,
|
|
54
|
+
LoopDetected: 508,
|
|
55
|
+
NotExtended: 510,
|
|
56
|
+
NetworkAuthenticationRequired: 511,
|
|
57
|
+
NetworkConnectTimeoutError: 599,
|
|
21
58
|
};
|
|
22
59
|
export class HttpError extends Error {
|
|
23
60
|
constructor(response, message) {
|
package/esm/string.js
CHANGED
|
@@ -5,4 +5,5 @@ export const capitalize = (s) => (S.isEmpty(s) ? s : s[0].toUpperCase() + s.slic
|
|
|
5
5
|
export const uncapitalize = (s) => (S.isEmpty(s) ? s : s[0].toLowerCase() + s.slice(1));
|
|
6
6
|
export const prefix = (prefix) => (s) => `${prefix}${s}`;
|
|
7
7
|
export const suffix = (suffix) => (s) => `${s}${suffix}`;
|
|
8
|
+
export const infix = (middle) => (s0, s1) => `${s0}${middle}${s1}`;
|
|
8
9
|
export const test = (re) => (s) => re.test(s);
|
package/lib/Http.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ export declare const HttpResponseC: <C extends t.Mixed>(codec: C) => t.TypeC<{
|
|
|
50
50
|
headers: t.ReadonlyC<t.RecordC<t.StringC, t.UnionC<[t.StringC, t.ReadonlyArrayC<t.StringC>]>>>;
|
|
51
51
|
body: C;
|
|
52
52
|
}>;
|
|
53
|
-
export declare const HttpErrorC: <A extends "BadRequest" | "Unauthorized" | "Forbidden" | "NotFound" | "UnprocessableEntity">(type?: A | undefined) => t.Type<HttpError, HttpError, unknown>;
|
|
53
|
+
export declare const HttpErrorC: <A extends "BadRequest" | "Unauthorized" | "PaymentRequired" | "Forbidden" | "NotFound" | "MethodNotAllowed" | "NotAcceptable" | "ProxyAuthenticationRequired" | "RequestTimeout" | "Conflict" | "Gone" | "LengthRequired" | "PreconditionFailed" | "PayloadTooLarge" | "RequestUriTooLong" | "UnsupportedMediaType" | "RequestedRangeNotSatisfiable" | "ExpectationFailed" | "ImATeapot" | "MisdirectedRequest" | "UnprocessableEntity" | "Locked" | "FailedDependency" | "UpgradeRequired" | "PreconditionRequired" | "TooManyRequests" | "RequestHeaderFieldsTooLarge" | "ConnectionClosedWithoutResponse" | "UnavailableForLegalReasons" | "ClientClosedRequest" | "InternalServerError" | "NotImplemented" | "BadGateway" | "ServiceUnavailable" | "GatewayTimeout" | "HttpVersionNotSupported" | "VariantAlsoNegotiates" | "InsufficientStorage" | "LoopDetected" | "NotExtended" | "NetworkAuthenticationRequired" | "NetworkConnectTimeoutError">(type?: A | undefined) => t.Type<HttpError, HttpError, unknown>;
|
|
54
54
|
export declare const json: (http: Http) => Http;
|
|
55
55
|
export declare const buffer: (http: Http) => Http;
|
|
56
56
|
export declare const cache: (cache: $C.Cache) => (http: Http) => Http;
|
package/lib/Http.js
CHANGED
|
@@ -42,9 +42,46 @@ const $T = __importStar(require("./Type"));
|
|
|
42
42
|
const ERRORS = {
|
|
43
43
|
BadRequest: 400,
|
|
44
44
|
Unauthorized: 401,
|
|
45
|
+
PaymentRequired: 402,
|
|
45
46
|
Forbidden: 403,
|
|
46
47
|
NotFound: 404,
|
|
48
|
+
MethodNotAllowed: 405,
|
|
49
|
+
NotAcceptable: 406,
|
|
50
|
+
ProxyAuthenticationRequired: 407,
|
|
51
|
+
RequestTimeout: 408,
|
|
52
|
+
Conflict: 409,
|
|
53
|
+
Gone: 410,
|
|
54
|
+
LengthRequired: 411,
|
|
55
|
+
PreconditionFailed: 412,
|
|
56
|
+
PayloadTooLarge: 413,
|
|
57
|
+
RequestUriTooLong: 414,
|
|
58
|
+
UnsupportedMediaType: 415,
|
|
59
|
+
RequestedRangeNotSatisfiable: 416,
|
|
60
|
+
ExpectationFailed: 417,
|
|
61
|
+
ImATeapot: 418,
|
|
62
|
+
MisdirectedRequest: 421,
|
|
47
63
|
UnprocessableEntity: 422,
|
|
64
|
+
Locked: 423,
|
|
65
|
+
FailedDependency: 424,
|
|
66
|
+
UpgradeRequired: 426,
|
|
67
|
+
PreconditionRequired: 428,
|
|
68
|
+
TooManyRequests: 429,
|
|
69
|
+
RequestHeaderFieldsTooLarge: 431,
|
|
70
|
+
ConnectionClosedWithoutResponse: 444,
|
|
71
|
+
UnavailableForLegalReasons: 451,
|
|
72
|
+
ClientClosedRequest: 499,
|
|
73
|
+
InternalServerError: 500,
|
|
74
|
+
NotImplemented: 501,
|
|
75
|
+
BadGateway: 502,
|
|
76
|
+
ServiceUnavailable: 503,
|
|
77
|
+
GatewayTimeout: 504,
|
|
78
|
+
HttpVersionNotSupported: 505,
|
|
79
|
+
VariantAlsoNegotiates: 506,
|
|
80
|
+
InsufficientStorage: 507,
|
|
81
|
+
LoopDetected: 508,
|
|
82
|
+
NotExtended: 510,
|
|
83
|
+
NetworkAuthenticationRequired: 511,
|
|
84
|
+
NetworkConnectTimeoutError: 599,
|
|
48
85
|
};
|
|
49
86
|
class HttpError extends Error {
|
|
50
87
|
constructor(response, message) {
|
package/lib/string.d.ts
CHANGED
|
@@ -4,4 +4,5 @@ export declare const capitalize: <S extends string>(s: S) => Capitalize<S>;
|
|
|
4
4
|
export declare const uncapitalize: <S extends string>(s: S) => Uncapitalize<S>;
|
|
5
5
|
export declare const prefix: <Prefix extends string>(prefix: Prefix) => <S extends string>(s: S) => `${Prefix}${S}`;
|
|
6
6
|
export declare const suffix: <Suffix extends string>(suffix: Suffix) => <S extends string>(s: S) => `${S}${Suffix}`;
|
|
7
|
+
export declare const infix: <M extends string>(middle: M) => <S0 extends string, S1 extends string>(s0: S0, s1: S1) => `${S0}${M}${S1}`;
|
|
7
8
|
export declare const test: (re: RegExp) => (s: string) => boolean;
|
package/lib/string.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.test = exports.suffix = exports.prefix = exports.uncapitalize = exports.capitalize = exports.lowercase = exports.uppercase = void 0;
|
|
26
|
+
exports.test = exports.infix = exports.suffix = exports.prefix = exports.uncapitalize = exports.capitalize = exports.lowercase = exports.uppercase = void 0;
|
|
27
27
|
const S = __importStar(require("fp-ts/string"));
|
|
28
28
|
const uppercase = (s) => s.toUpperCase();
|
|
29
29
|
exports.uppercase = uppercase;
|
|
@@ -37,5 +37,7 @@ const prefix = (prefix) => (s) => `${prefix}${s}`;
|
|
|
37
37
|
exports.prefix = prefix;
|
|
38
38
|
const suffix = (suffix) => (s) => `${s}${suffix}`;
|
|
39
39
|
exports.suffix = suffix;
|
|
40
|
+
const infix = (middle) => (s0, s1) => `${s0}${middle}${s1}`;
|
|
41
|
+
exports.infix = infix;
|
|
40
42
|
const test = (re) => (s) => re.test(s);
|
|
41
43
|
exports.test = test;
|
package/package.json
CHANGED
package/string.d.ts
CHANGED
|
@@ -4,4 +4,5 @@ export declare const capitalize: <S extends string>(s: S) => Capitalize<S>;
|
|
|
4
4
|
export declare const uncapitalize: <S extends string>(s: S) => Uncapitalize<S>;
|
|
5
5
|
export declare const prefix: <Prefix extends string>(prefix: Prefix) => <S extends string>(s: S) => `${Prefix}${S}`;
|
|
6
6
|
export declare const suffix: <Suffix extends string>(suffix: Suffix) => <S extends string>(s: S) => `${S}${Suffix}`;
|
|
7
|
+
export declare const infix: <M extends string>(middle: M) => <S0 extends string, S1 extends string>(s0: S0, s1: S1) => `${S0}${M}${S1}`;
|
|
7
8
|
export declare const test: (re: RegExp) => (s: string) => boolean;
|