@contactlab/appy
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -17,6 +17,6 @@ import { Decoder, ValidationError } from 'io-ts'; | ||
export interface ApiRequest { | ||
<A>(m: Method, u: USVString, o: ApiOptions<A>): ApiTask<A>; | ||
<A>(m: Method, u: string, o: ApiOptions<A>): ApiTask<A>; | ||
} | ||
export interface ApiRequestNoMethod { | ||
<A>(u: USVString, o: ApiOptions<A>): ApiTask<A>; | ||
<A>(u: string, o: ApiOptions<A>): ApiTask<A>; | ||
} | ||
@@ -23,0 +23,0 @@ export interface ApiOptions<A> extends RequestInit { |
@@ -10,6 +10,6 @@ import { TaskEither } from 'fp-ts/lib/TaskEither'; | ||
export interface AppyRequest { | ||
(m: Method, u: USVString, o?: RequestInit): AppyTask<AppyError, Mixed>; | ||
(m: Method, u: string, o?: RequestInit): AppyTask<AppyError, Mixed>; | ||
} | ||
export interface AppyRequestNoMethod { | ||
(u: USVString, o?: RequestInit): AppyTask<AppyError, Mixed>; | ||
(u: string, o?: RequestInit): AppyTask<AppyError, Mixed>; | ||
} | ||
@@ -27,5 +27,5 @@ export declare type AppyTask<E, A> = TaskEither<E, AppyResponse<A>>; | ||
readonly message: string; | ||
readonly uri: USVString; | ||
readonly uri: string; | ||
readonly type: 'NetworkError'; | ||
constructor(message: string, uri: USVString); | ||
constructor(message: string, uri: string); | ||
} | ||
@@ -32,0 +32,0 @@ export declare class BadUrl { |
@@ -21,3 +21,2 @@ "use strict"; | ||
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch|Using fetch} | ||
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/USVString|USVString} | ||
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Request|Request} | ||
@@ -24,0 +23,0 @@ * @see {@link https://gcanti.github.io/fp-ts/Task.html|Task} |
{ | ||
"name": "@contactlab/appy", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "Fetch API the Contactlab way", | ||
@@ -12,2 +12,12 @@ "main": "lib/index.js", | ||
"repository": "contactlab/appy", | ||
"keywords": [ | ||
"contactlab", | ||
"clab", | ||
"appy", | ||
"fetch", | ||
"fp", | ||
"fp-ts", | ||
"functional programming", | ||
"task" | ||
], | ||
"engines": { | ||
@@ -27,23 +37,26 @@ "node": ">= 8.10", | ||
"build": "tsc -p ./tsconfig-compile.json", | ||
"prepublishOnly": "npm test && npm run build" | ||
"prepublishOnly": "npm test && npm run build", | ||
"changelog": "standard-changelog -i CHANGELOG.md -r 0 && git add CHANGELOG.md", | ||
"postversion": "npm run changelog" | ||
}, | ||
"dependencies": { | ||
"fp-ts": "1.9.0", | ||
"io-ts": "1.3.0" | ||
"io-ts": "1.3.1" | ||
}, | ||
"devDependencies": { | ||
"@contactlab/tslint-config": "1.2.0", | ||
"@types/jest": "23.3.2", | ||
"@types/node": "10.11.0", | ||
"husky": "1.0.0", | ||
"@types/jest": "23.3.5", | ||
"@types/node": "10.11.7", | ||
"husky": "1.1.2", | ||
"jest": "23.6.0", | ||
"jest-fetch-mock": "1.6.6", | ||
"prettier": "1.14.3", | ||
"pretty-quick": "1.7.0", | ||
"pretty-quick": "1.8.0", | ||
"rimraf": "2.6.2", | ||
"ts-jest": "23.10.1", | ||
"standard-changelog": "2.0.1", | ||
"ts-jest": "23.10.4", | ||
"ts-node": "7.0.1", | ||
"tslint": "5.11.0", | ||
"tslint-config-prettier": "1.15.0", | ||
"typescript": "3.0.3" | ||
"typescript": "3.1.3" | ||
}, | ||
@@ -63,17 +76,16 @@ "jest": { | ||
], | ||
"transform": { | ||
"^.+\\.ts$": "ts-jest" | ||
}, | ||
"testRegex": "(\\.|/)spec\\.(js|ts)$", | ||
"moduleFileExtensions": [ | ||
"ts", | ||
"js", | ||
"json", | ||
"node" | ||
"node", | ||
"ts" | ||
], | ||
"globals": { | ||
"ts-jest": { | ||
"enableTsDiagnostics": true | ||
"diagnostics": true | ||
} | ||
} | ||
}, | ||
"preset": "ts-jest", | ||
"testMatch": null | ||
}, | ||
@@ -80,0 +92,0 @@ "husky": { |
@@ -65,3 +65,3 @@ # Appy | ||
- accepted methods are definened by the `Method` union type; | ||
- `fetch`'s input is always a `USVString` (no `Request` objects allowed); | ||
- `fetch`'s input is always a `string` (no `Request` objects allowed); | ||
- `Response` is mapped into a specific `AppyResponse<Mixed>` interface; | ||
@@ -78,5 +78,5 @@ - `AppyResponse` `headers` property is always a `HeadersMap` (alias for a map of string); | ||
```typescript | ||
function request( | ||
declare function request( | ||
m: Method, | ||
u: USVString, | ||
u: string, | ||
o?: RequestInit | ||
@@ -87,4 +87,4 @@ ): TaskEither<AppyError, AppyResponse<Mixed>>; | ||
```typescript | ||
function get( | ||
u: USVString, | ||
declare function get( | ||
u: string, | ||
o?: RequestInit | ||
@@ -95,4 +95,4 @@ ): TaskEither<AppyError, AppyResponse<Mixed>>; | ||
```typescript | ||
function post( | ||
u: USVString, | ||
declare function post( | ||
u: string, | ||
o?: RequestInit | ||
@@ -103,4 +103,4 @@ ): TaskEither<AppyError, AppyResponse<Mixed>>; | ||
```typescript | ||
function put( | ||
u: USVString, | ||
declare function put( | ||
u: string, | ||
o?: RequestInit | ||
@@ -111,4 +111,4 @@ ): TaskEither<AppyError, AppyResponse<Mixed>>; | ||
```typescript | ||
function patch( | ||
u: USVString, | ||
declare function patch( | ||
u: string, | ||
o?: RequestInit | ||
@@ -119,4 +119,4 @@ ): TaskEither<AppyError, AppyResponse<Mixed>>; | ||
```typescript | ||
function del( | ||
u: USVString, | ||
declare function del( | ||
u: string, | ||
o?: RequestInit | ||
@@ -180,16 +180,16 @@ ): TaskEither<AppyError, AppyResponse<Mixed>>; | ||
interface ApiMethods { | ||
request: <A>(m: Method, u: USVString, o: ApiOptions<A>): TaskEither<ApiError, AppyResponse<A>>; | ||
request: <A>(m: Method, u: string, o: ApiOptions<A>): TaskEither<ApiError, AppyResponse<A>>; | ||
get: <A>(u: USVString, o: ApiOptions<A>): TaskEither<ApiError, AppyResponse<A>>; | ||
get: <A>(u: string, o: ApiOptions<A>): TaskEither<ApiError, AppyResponse<A>>; | ||
post: <A>(u: USVString, o: ApiOptions<A>): TaskEither<ApiError, AppyResponse<A>>; | ||
post: <A>(u: string, o: ApiOptions<A>): TaskEither<ApiError, AppyResponse<A>>; | ||
put: <A>(u: USVString, o: ApiOptions<A>): TaskEither<ApiError, AppyResponse<A>>; | ||
put: <A>(u: string, o: ApiOptions<A>): TaskEither<ApiError, AppyResponse<A>>; | ||
patch: <A>(u: USVString, o: ApiOptions<A>): TaskEither<ApiError, AppyResponse<A>>; | ||
patch: <A>(u: string, o: ApiOptions<A>): TaskEither<ApiError, AppyResponse<A>>; | ||
del: <A>(u: USVString, o: ApiOptions<A>): TaskEither<ApiError, AppyResponse<A>>; | ||
del: <A>(u: string, o: ApiOptions<A>): TaskEither<ApiError, AppyResponse<A>>; | ||
} | ||
function api(c: ApiConfig): ApiMethods | ||
declare function api(c: ApiConfig): ApiMethods | ||
``` | ||
@@ -196,0 +196,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
39726
16
15
339
+ Addedio-ts@1.3.1(transitive)
- Removedio-ts@1.3.0(transitive)
Updatedio-ts@1.3.1