Skip to content

Commit

Permalink
chore(all): prepare release 0.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Aug 14, 2015
1 parent 7d68909 commit 4b5937c
Show file tree
Hide file tree
Showing 14 changed files with 132 additions and 142 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aurelia-fetch-client",
"version": "0.1.1",
"version": "0.1.2",
"description": "A simple client based on the Fetch standard.",
"keywords": [
"aurelia",
Expand Down
21 changes: 10 additions & 11 deletions dist/amd/aurelia-fetch-client.d.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
declare module 'aurelia-fetch-client' {
import from 'core-js';
import from 'core-js';

/* eslint-disable */
export interface IInterceptor {
export interface Interceptor {
request(request: Request): undefined;
requestError(error: any): undefined;
response(response: Response): undefined;
responseError(error: any): undefined;
}
export interface IRequestInit {
export interface RequestInit {
method?: string;
headers?: Headers;
body?: Blob | BufferSource | FormData | URLSearchParams | string;
Expand Down Expand Up @@ -48,13 +47,13 @@ declare module 'aurelia-fetch-client' {
* See also https://developer.mozilla.org/en-US/docs/Web/API/Request/Request
* @type {Object}
*/
defaults: IRequestInit;
defaults: RequestInit;

/**
* Interceptors to be added to the HttpClient.
* @type {Array}
*/
interceptors: IInterceptor[];
interceptors: Interceptor[];

/**
* Sets the baseUrl.
Expand All @@ -72,7 +71,7 @@ declare module 'aurelia-fetch-client' {
* @returns {HttpClientConfiguration}
* @chainable
*/
withDefaults(defaults: IRequestInit): HttpClientConfiguration;
withDefaults(defaults: RequestInit): HttpClientConfiguration;

/**
* Adds an interceptor to be run on all requests or responses.
Expand All @@ -85,7 +84,7 @@ declare module 'aurelia-fetch-client' {
* @returns {HttpClientConfiguration}
* @chainable
*/
withInterceptor(interceptor: IInterceptor): HttpClientConfiguration;
withInterceptor(interceptor: Interceptor): HttpClientConfiguration;

/**
* Applies a configuration that addresses common application needs, including
Expand Down Expand Up @@ -119,10 +118,10 @@ declare module 'aurelia-fetch-client' {
export class HttpClient {
activeRequestCount: number;
isRequesting: boolean;
interceptors: IInterceptor[];
interceptors: Interceptor[];
isConfigured: boolean;
baseUrl: string;
defaults: IRequestInit;
defaults: RequestInit;

/**
* Configure this client with default settings to be used by all requests.
Expand All @@ -132,7 +131,7 @@ declare module 'aurelia-fetch-client' {
* @returns {HttpClient}
* @chainable
*/
configure(config: ConfigOrCallback): HttpClient;
configure(config: string | RequestInit | ((config: HttpClientConfiguration) => void)): HttpClient;

/**
* Starts the process of fetching a resource. Default configuration parameters
Expand All @@ -148,6 +147,6 @@ declare module 'aurelia-fetch-client' {
* the Request.
* @return {Promise} - A Promise that resolves with the Response.
*/
fetch(input: Request | string, init?: IRequestInit): Promise<Response>;
fetch(input: Request | string, init?: RequestInit): Promise<Response>;
}
}
2 changes: 1 addition & 1 deletion dist/amd/aurelia-fetch-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ define(['exports', 'core-js'], function (exports, _coreJs) {
}

function buildRequest(input) {
var init = arguments[1] === undefined ? {} : arguments[1];
var init = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];

var defaults = this.defaults || {};
var source = undefined;
Expand Down
21 changes: 10 additions & 11 deletions dist/aurelia-fetch-client.d.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
declare module 'aurelia-fetch-client' {
import from 'core-js';
import from 'core-js';

/* eslint-disable */
export interface IInterceptor {
export interface Interceptor {
request(request: Request): undefined;
requestError(error: any): undefined;
response(response: Response): undefined;
responseError(error: any): undefined;
}
export interface IRequestInit {
export interface RequestInit {
method?: string;
headers?: Headers;
body?: Blob | BufferSource | FormData | URLSearchParams | string;
Expand Down Expand Up @@ -48,13 +47,13 @@ declare module 'aurelia-fetch-client' {
* See also https://developer.mozilla.org/en-US/docs/Web/API/Request/Request
* @type {Object}
*/
defaults: IRequestInit;
defaults: RequestInit;

/**
* Interceptors to be added to the HttpClient.
* @type {Array}
*/
interceptors: IInterceptor[];
interceptors: Interceptor[];

/**
* Sets the baseUrl.
Expand All @@ -72,7 +71,7 @@ declare module 'aurelia-fetch-client' {
* @returns {HttpClientConfiguration}
* @chainable
*/
withDefaults(defaults: IRequestInit): HttpClientConfiguration;
withDefaults(defaults: RequestInit): HttpClientConfiguration;

/**
* Adds an interceptor to be run on all requests or responses.
Expand All @@ -85,7 +84,7 @@ declare module 'aurelia-fetch-client' {
* @returns {HttpClientConfiguration}
* @chainable
*/
withInterceptor(interceptor: IInterceptor): HttpClientConfiguration;
withInterceptor(interceptor: Interceptor): HttpClientConfiguration;

/**
* Applies a configuration that addresses common application needs, including
Expand Down Expand Up @@ -119,10 +118,10 @@ declare module 'aurelia-fetch-client' {
export class HttpClient {
activeRequestCount: number;
isRequesting: boolean;
interceptors: IInterceptor[];
interceptors: Interceptor[];
isConfigured: boolean;
baseUrl: string;
defaults: IRequestInit;
defaults: RequestInit;

/**
* Configure this client with default settings to be used by all requests.
Expand All @@ -132,7 +131,7 @@ declare module 'aurelia-fetch-client' {
* @returns {HttpClient}
* @chainable
*/
configure(config: ConfigOrCallback): HttpClient;
configure(config: string | RequestInit | ((config: HttpClientConfiguration) => void)): HttpClient;

/**
* Starts the process of fetching a resource. Default configuration parameters
Expand All @@ -148,6 +147,6 @@ declare module 'aurelia-fetch-client' {
* the Request.
* @return {Promise} - A Promise that resolves with the Response.
*/
fetch(input: Request | string, init?: IRequestInit): Promise<Response>;
fetch(input: Request | string, init?: RequestInit): Promise<Response>;
}
}
73 changes: 34 additions & 39 deletions dist/aurelia-fetch-client.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'core-js';

/**
* Create a Blob containing JSON-serialized data.
Expand All @@ -11,7 +12,31 @@ export function json(body: any): Blob {
}


import 'core-js';
/* eslint-disable */

interface Interceptor {
request?: (request: Request) => Request|Response|Promise<Request|Response>;

requestError?: (error: any) => Request|Response|Promise<Request|Response>;

response?: (response: Response) => Response|Promise<Response>;

responseError?: (error: any) => Response|Promise<Response>;
}

interface RequestInit {
method?: string;

headers?: Headers;

body?: Blob|BufferSource|FormData|URLSearchParams|string;

mode?: string;

credentials?: string;

cache?: string;
}

/**
* A class for configuring HttpClients.
Expand All @@ -33,13 +58,13 @@ export class HttpClientConfiguration {
* See also https://developer.mozilla.org/en-US/docs/Web/API/Request/Request
* @type {Object}
*/
defaults: IRequestInit = {};
defaults: RequestInit = {};

/**
* Interceptors to be added to the HttpClient.
* @type {Array}
*/
interceptors: IInterceptor[] = [];
interceptors: Interceptor[] = [];

/**
* Sets the baseUrl.
Expand All @@ -60,7 +85,7 @@ export class HttpClientConfiguration {
* @returns {HttpClientConfiguration}
* @chainable
*/
withDefaults(defaults: IRequestInit): HttpClientConfiguration {
withDefaults(defaults: RequestInit): HttpClientConfiguration {
this.defaults = defaults;
return this;
}
Expand All @@ -76,7 +101,7 @@ export class HttpClientConfiguration {
* @returns {HttpClientConfiguration}
* @chainable
*/
withInterceptor(interceptor: IInterceptor): HttpClientConfiguration {
withInterceptor(interceptor: Interceptor): HttpClientConfiguration {
this.interceptors.push(interceptor);
return this;
}
Expand Down Expand Up @@ -118,10 +143,6 @@ function rejectOnError(response) {
return response;
}

import 'core-js';

type ConfigOrCallback = IRequestInit|(config: HttpClientConfiguration) => void|string;

/**
* An HTTP client based on the Fetch API.
*
Expand All @@ -133,13 +154,13 @@ export class HttpClient {

isRequesting: boolean = false;

interceptors: IInterceptor[] = [];
interceptors: Interceptor[] = [];

isConfigured: boolean = false;

baseUrl: string = '';

defaults: IRequestInit = null;
defaults: RequestInit = null;

/**
* Configure this client with default settings to be used by all requests.
Expand All @@ -149,7 +170,7 @@ export class HttpClient {
* @returns {HttpClient}
* @chainable
*/
configure(config: ConfigOrCallback): HttpClient {
configure(config: string|RequestInit|(config: HttpClientConfiguration) => void): HttpClient {
let normalizedConfig;

if (typeof config === 'string') {
Expand Down Expand Up @@ -192,7 +213,7 @@ export class HttpClient {
* the Request.
* @return {Promise} - A Promise that resolves with the Response.
*/
fetch(input: Request|string, init?: IRequestInit): Promise<Response> {
fetch(input: Request|string, init?: RequestInit): Promise<Response> {
this::trackRequestStart();

let request = Promise.resolve().then(() => this::buildRequest(input, init, this.defaults));
Expand Down Expand Up @@ -284,29 +305,3 @@ function applyInterceptors(input, interceptors, successName, errorName) {
errorHandler && interceptor::errorHandler);
}, Promise.resolve(input));
}

/* eslint-disable */

interface IInterceptor {
request?: (request: Request) => Request|Response|Promise<Request|Response>;

requestError?: (error: any) => Request|Response|Promise<Request|Response>;

response?: (response: Response) => Response|Promise<Response>;

responseError?: (error: any) => Response|Promise<Response>;
}

interface IRequestInit {
method?: string;

headers?: Headers;

body?: Blob|BufferSource|FormData|URLSearchParams|string;

mode?: string;

credentials?: string;

cache?: string;
}
Loading

0 comments on commit 4b5937c

Please sign in to comment.