fix: public api surface fixes + stability markers

- ts-api-guardian will now error if a new public symbol is added with a stability marker (`@stable`, `@experimental`, `@deprecated`)
- DomEventsPlugin and KeyEventsPlugin were removed from public api surface - these classes is an implementation detail
- deprecated BROWSER_PROVIDERS was removed completely
- `@angular/compiler` was removed from the ts-api-guardian check since this package shouldn't contain anything that users need to directly import
- the rest of the api surface was conservatively marked as stable or experimental

BREAKING CHANGES: DomEventsPlugin and KeyEventsPlugin previously exported from core are no longer public - these classes are implementation detail.

Previously deprecated BROWSER_PROVIDERS was completely removed from platform-browser.

Closes #9236
Closes #9235
Ref #9234
This commit is contained in:
Igor Minar
2016-06-27 12:27:23 -07:00
parent fcfddbf79c
commit 24eb8389d2
102 changed files with 685 additions and 103 deletions

View File

@ -179,6 +179,8 @@ export {URLSearchParams} from './src/url_search_params';
* useValue: new CookieXSRFStrategy('MY-XSRF-COOKIE-NAME', 'X-MY-XSRF-HEADER-NAME')}])
* .catch(err => console.error(err));
* ```
*
* @experimental
*/
export const HTTP_PROVIDERS: any[] = [
// TODO(pascal): use factory type annotations once supported in DI
@ -191,6 +193,10 @@ export const HTTP_PROVIDERS: any[] = [
{provide: XSRFStrategy, useValue: new CookieXSRFStrategy()},
];
/**
* @experimental
*/
export function httpFactory(xhrBackend: XHRBackend, requestOptions: RequestOptions): Http {
return new Http(xhrBackend, requestOptions);
}
@ -308,6 +314,8 @@ export const HTTP_BINDINGS = HTTP_PROVIDERS;
* }
* });
* ```
*
* @experimental
*/
export const JSONP_PROVIDERS: any[] = [
// TODO(pascal): use factory type annotations once supported in DI

View File

@ -12,6 +12,8 @@ import {Injectable} from '@angular/core';
* A backend for http that uses the `XMLHttpRequest` browser API.
*
* Take care not to evaluate this in non-browser contexts.
*
* @experimental
*/
@Injectable()
export class BrowserXhr {

View File

@ -25,6 +25,8 @@ const JSONP_ERR_WRONG_METHOD = 'JSONP requests must use GET request method.';
/**
* Abstract base class for an in-flight JSONP request.
*
* @experimental
*/
export abstract class JSONPConnection implements Connection {
/**
@ -143,6 +145,8 @@ export class JSONPConnection_ extends JSONPConnection {
/**
* A {@link ConnectionBackend} that uses the JSONP strategy of making requests.
*
* @experimental
*/
export abstract class JSONPBackend extends ConnectionBackend {}

View File

@ -31,6 +31,8 @@ const XSSI_PREFIX = /^\)\]\}',?\n/;
*
* This class would typically not be created or interacted with directly inside applications, though
* the {@link MockConnection} may be interacted with in tests.
*
* @experimental
*/
export class XHRConnection implements Connection {
request: Request;
@ -156,6 +158,8 @@ export class XHRConnection implements Connection {
* Applications can configure custom cookie and header names by binding an instance of this class
* with different `cookieName` and `headerName` values. See the main HTTP documentation for more
* details.
*
* @experimental
*/
export class CookieXSRFStrategy implements XSRFStrategy {
constructor(
@ -193,7 +197,8 @@ export class CookieXSRFStrategy implements XSRFStrategy {
* }
* }
* ```
**/
* @experimental
*/
@Injectable()
export class XHRBackend implements ConnectionBackend {
constructor(

View File

@ -40,6 +40,8 @@ import {URLSearchParams} from './url_search_params';
* console.log('req.method:', RequestMethod[req.method]); // Post
* console.log('options.url:', options.url); // https://google.com
* ```
*
* @experimental
*/
export class RequestOptions {
/**
@ -164,6 +166,8 @@ export class RequestOptions {
* console.log('options.url:', options.url); // null
* console.log('req.url:', req.url); // https://google.com
* ```
*
* @experimental
*/
@Injectable()
export class BaseRequestOptions extends RequestOptions {

View File

@ -40,6 +40,8 @@ import {ResponseOptionsArgs} from './interfaces';
*
* console.log('res.json():', res.json()); // Object {name: "Jeff"}
* ```
*
* @experimental
*/
export class ResponseOptions {
// TODO: ArrayBuffer | FormData | Blob
@ -155,6 +157,8 @@ export class ResponseOptions {
* console.log('res.headers.get("framework"):', res.headers.get('framework')); // angular
* console.log('res.text():', res.text()); // Angular;
* ```
*
* @experimental
*/
@Injectable()
export class BaseResponseOptions extends ResponseOptions {

View File

@ -8,6 +8,7 @@
/**
* Supported http methods.
* @experimental
*/
export enum RequestMethod {
Get,
@ -23,6 +24,7 @@ export enum RequestMethod {
* All possible states in which a connection can be, based on
* [States](http://www.w3.org/TR/XMLHttpRequest/#states) from the `XMLHttpRequest` spec, but with an
* additional "CANCELLED" state.
* @experimental
*/
export enum ReadyState {
Unsent,
@ -36,6 +38,7 @@ export enum ReadyState {
/**
* Acceptable response types to be associated with a {@link Response}, based on
* [ResponseType](https://fetch.spec.whatwg.org/#responsetype) from the Fetch spec.
* @experimental
*/
export enum ResponseType {
Basic,
@ -47,6 +50,7 @@ export enum ResponseType {
/**
* Supported content type to be automatically associated with a {@link Request}.
* @experimental
*/
export enum ContentType {
NONE,

View File

@ -36,6 +36,8 @@ import {isListLikeIterable, iterateListLike, Map, MapWrapper, StringMapWrapper,
* var thirdHeaders = new Headers(secondHeaders);
* console.log(thirdHeaders.get('X-My-Custom-Header')); //'Angular'
* ```
*
* @experimental
*/
export class Headers {
/** @internal */

View File

@ -103,7 +103,8 @@ function mergeOptions(
* http.get('request-from-mock-backend.json').subscribe((res:Response) => doSomething(res));
* ```
*
**/
* @experimental
*/
@Injectable()
export class Http {
constructor(protected _backend: ConnectionBackend, protected _defaultOptions: RequestOptions) {}
@ -186,6 +187,10 @@ export class Http {
}
}
/**
* @experimental
*/
@Injectable()
export class Jsonp extends Http {
constructor(backend: ConnectionBackend, defaultOptions: RequestOptions) {

View File

@ -16,11 +16,15 @@ import {URLSearchParams} from './url_search_params';
*
* The primary purpose of a `ConnectionBackend` is to create new connections to fulfill a given
* {@link Request}.
*
* @experimental
*/
export abstract class ConnectionBackend { abstract createConnection(request: any): Connection; }
/**
* Abstract class from which real connections are derived.
*
* @experimental
*/
export abstract class Connection {
readyState: ReadyState;
@ -28,12 +32,18 @@ export abstract class Connection {
response: any; // TODO: generic of <Response>;
}
/** An XSRFStrategy configures XSRF protection (e.g. via headers) on an HTTP request. */
/**
* An XSRFStrategy configures XSRF protection (e.g. via headers) on an HTTP request.
*
* @experimental
*/
export abstract class XSRFStrategy { abstract configureRequest(req: Request): void; }
/**
* Interface for options to construct a RequestOptions, based on
* [RequestInit](https://fetch.spec.whatwg.org/#requestinit) from the Fetch spec.
*
* @experimental
*/
export interface RequestOptionsArgs {
url?: string;
@ -52,6 +62,8 @@ export interface RequestArgs extends RequestOptionsArgs { url: string; }
/**
* Interface for options to construct a Response, based on
* [ResponseInit](https://fetch.spec.whatwg.org/#responseinit) from the Fetch spec.
*
* @experimental
*/
export type ResponseOptionsArgs = {
// TODO: Support Blob, ArrayBuffer, JSON

View File

@ -52,6 +52,8 @@ import {URLSearchParams} from './url_search_params';
* console.log('people', res.json());
* });
* ```
*
* @experimental
*/
export class Request {
/**

View File

@ -32,6 +32,8 @@ import {isJsObject} from './http_utils';
* Spec](https://fetch.spec.whatwg.org/#response-class), but is considered a static value whose body
* can be accessed many times. There are other differences in the implementation, but this is the
* most significant.
*
* @experimental
*/
export class Response {
/**

View File

@ -32,6 +32,8 @@ function paramParser(rawParams: string = ''): Map<string, string[]> {
* - setAll()
* - appendAll()
* - replaceAll()
*
* @experimental
*/
export class URLSearchParams {
paramsMap: Map<string, string[]>;

View File

@ -23,7 +23,8 @@ import {Response} from '../src/static_response';
*
* Mock Connection to represent a {@link Connection} for tests.
*
**/
* @experimental
*/
export class MockConnection implements Connection {
// TODO Name `readyState` should change to be more generic, and states could be made to be more
// descriptive than XHR states.
@ -141,7 +142,9 @@ export class MockConnection implements Connection {
* ```
*
* This method only exists in the mock implementation, not in real Backends.
**/
*
* @experimental
*/
@Injectable()
export class MockBackend implements ConnectionBackend {
/**