@types/webappsec-credential-management
Advanced tools
Comparing version 0.0.1 to 0.1.0
@@ -1,9 +0,149 @@ | ||
// Type definitions for W3C (WebAppSec) Credential Management API, Level 1, 0.0 | ||
// Type definitions for W3C (WebAppSec) Credential Management API Level 1, 0.1 | ||
// Project: https://github.com/w3c/webappsec-credential-management | ||
// Definitions by: Iain McGinniss <https://github.com/iainmcgin> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// Spec: http://www.w3.org/TR/2016/WD-credential-management-1-20160425/ | ||
/// <reference types="whatwg-fetch" /> | ||
/* ************************ FETCH API DEFINITIONS ****************************** | ||
* TS 2.2 introduced definitions for the fetch API in the dom library, but | ||
* prior to that it was necessary to use the types defined in | ||
* @types/whatwg-fetch. In order to support all versions of TS 2.x, the | ||
* definitions for fetch from TS 2.2 dom are duplicated here. As long as these | ||
* remain identical to the definitions in dom 2.2+, they cause no issues. | ||
* | ||
* One caveat to "identical" here is that type definitions cannot be duplicated, | ||
* and so the "RequestInfo" type has been substituted for its expansion in | ||
* the below definitions: | ||
* | ||
* type RequestInfo = Request|string; | ||
* ************************************************************************** */ | ||
interface Request extends Object, Body { | ||
readonly cache: string; | ||
readonly credentials: string; | ||
readonly destination: string; | ||
readonly headers: Headers; | ||
readonly integrity: string; | ||
readonly keepalive: boolean; | ||
readonly method: string; | ||
readonly mode: string; | ||
readonly redirect: string; | ||
readonly referrer: string; | ||
readonly referrerPolicy: string; | ||
readonly type: string; | ||
readonly url: string; | ||
clone(): Request; | ||
} | ||
declare var Request: { | ||
prototype: Request; | ||
new(input: Request | string, init?: RequestInit): Request; | ||
}; | ||
interface Headers { | ||
append(name: string, value: string): void; | ||
delete(name: string): void; | ||
forEach(callback: ForEachCallback): void; | ||
get(name: string): string | null; | ||
has(name: string): boolean; | ||
set(name: string, value: string): void; | ||
} | ||
declare var Headers: { | ||
prototype: Headers; | ||
new(init?: any): Headers; | ||
}; | ||
interface Response extends Object, Body { | ||
readonly body: ReadableStream | null; | ||
readonly headers: Headers; | ||
readonly ok: boolean; | ||
readonly status: number; | ||
readonly statusText: string; | ||
readonly type: string; | ||
readonly url: string; | ||
clone(): Response; | ||
} | ||
declare var Response: { | ||
prototype: Response; | ||
new(body?: any, init?: ResponseInit): Response; | ||
}; | ||
interface ResponseInit { | ||
status?: number; | ||
statusText?: string; | ||
headers?: any; | ||
} | ||
interface ReadableStream { | ||
readonly locked: boolean; | ||
cancel(): Promise<void>; | ||
getReader(): ReadableStreamReader; | ||
} | ||
declare var ReadableStream: { | ||
prototype: ReadableStream; | ||
new(): ReadableStream; | ||
}; | ||
interface ReadableStreamReader { | ||
cancel(): Promise<void>; | ||
read(): Promise<any>; | ||
releaseLock(): void; | ||
} | ||
declare var ReadableStreamReader: { | ||
prototype: ReadableStreamReader; | ||
new(): ReadableStreamReader; | ||
}; | ||
interface Body { | ||
readonly bodyUsed: boolean; | ||
arrayBuffer(): Promise<ArrayBuffer>; | ||
blob(): Promise<Blob>; | ||
json(): Promise<any>; | ||
text(): Promise<string>; | ||
} | ||
interface URLSearchParams { | ||
/** | ||
* Appends a specified key/value pair as a new search parameter. | ||
*/ | ||
append(name: string, value: string): void; | ||
/** | ||
* Deletes the given search parameter, and its associated value, from the list of all search parameters. | ||
*/ | ||
delete(name: string): void; | ||
/** | ||
* Returns the first value associated to the given search parameter. | ||
*/ | ||
get(name: string): string | null; | ||
/** | ||
* Returns all the values association with a given search parameter. | ||
*/ | ||
getAll(name: string): string[]; | ||
/** | ||
* Returns a Boolean indicating if such a search parameter exists. | ||
*/ | ||
has(name: string): boolean; | ||
/** | ||
* Sets the value associated to a given search parameter to the given value. If there were several values, delete the others. | ||
*/ | ||
set(name: string, value: string): void; | ||
} | ||
declare var URLSearchParams: { | ||
prototype: URLSearchParams; | ||
/** | ||
* Constructor returning a URLSearchParams object. | ||
*/ | ||
new (init?: string | URLSearchParams): URLSearchParams; | ||
}; | ||
interface GlobalFetch { | ||
fetch(input: Request|string, init?: RequestInit): Promise<Response>; | ||
} | ||
/* ************************* FETCH MODIFICATIONS ******************************* | ||
@@ -19,35 +159,30 @@ * The credential management spec modifies fetch(), by adding a new | ||
interface Window { | ||
fetch(url: CMRequestInfo, init?: CMRequestInit): Promise<Response>; | ||
declare function fetch( | ||
input: Request|string, | ||
init?: RequestInit|CMRequestInit): | ||
Promise<Response>; | ||
interface GlobalFetch { | ||
// variant for navigator.credentials monkey patching | ||
fetch(url: Request|string, init?: CMRequestInit): Promise<Response>; | ||
} | ||
type CMRequestInfo = CMRequest|string; | ||
/** | ||
* Variant of {@link Request} that permits a {@code 'password'} value in the | ||
* {@code credentials} property. | ||
* Original definition from TS 2.2 dom. | ||
*/ | ||
interface CMRequest extends Body { | ||
// the only modified property from RequestCredentials: | ||
credentials: CMRequestCredentials; | ||
method: string; | ||
url: string; | ||
headers: Headers; | ||
type: RequestType; | ||
destination: RequestDestination; | ||
referrer: string; | ||
referrerPolicy: ReferrerPolicy; | ||
mode: RequestMode; | ||
cache: RequestCache; | ||
redirect: RequestRedirect; | ||
integrity: string; | ||
clone(): Request; | ||
interface RequestInit { | ||
method?: string; | ||
headers?: any; | ||
body?: any; | ||
referrer?: string; | ||
referrerPolicy?: string; | ||
mode?: string; | ||
credentials?: string; | ||
cache?: string; | ||
redirect?: string; | ||
integrity?: string; | ||
keepalive?: boolean; | ||
window?: any; | ||
} | ||
type CMRequestCredentials = RequestCredentials|'password'; | ||
/** | ||
@@ -59,35 +194,16 @@ * Variant of {@link RequestInit} that permits a {@link PasswordCredential} to | ||
interface CMRequestInit { | ||
credentials?: PasswordCredential|CMRequestCredentials; | ||
method?: string; | ||
headers?: HeadersInit; | ||
body?: BodyInit; | ||
headers?: any; | ||
body?: any; | ||
referrer?: string; | ||
referrerPolicy?: ReferrerPolicy; | ||
mode?: RequestMode; | ||
cache?: RequestCache; | ||
redirect?: RequestRedirect; | ||
referrerPolicy?: string; | ||
mode?: string; | ||
credentials?: PasswordCredential|string; | ||
cache?: string; | ||
redirect?: string; | ||
integrity?: string; | ||
keepalive?: boolean; | ||
window?: any; | ||
} | ||
/** | ||
* URLSearchParams is not yet included in the core lib.d.ts declarations, so we | ||
* include it here. | ||
* The official definition should be included in TypeScript 2.2, at which point | ||
* this can be removed. | ||
* | ||
* @see {@link https://github.com/Microsoft/TypeScript/issues/12517} | ||
*/ | ||
declare class URLSearchParams { | ||
constructor(init?: string|URLSearchParams); | ||
append(name: string, value: string): void; | ||
delete(name: string): void; | ||
get(name: string): string|null; | ||
getAll(name: string): string[]; | ||
has(name: string): boolean; | ||
set(name: string, value: string): void; | ||
} | ||
/* ***************** CREDENTIAL MANAGEMENT API DEFINITONS ******************* */ | ||
@@ -94,0 +210,0 @@ |
{ | ||
"name": "@types/webappsec-credential-management", | ||
"version": "0.0.1", | ||
"description": "TypeScript definitions for W3C (WebAppSec) Credential Management API, Level 1,", | ||
"version": "0.1.0", | ||
"description": "TypeScript definitions for W3C (WebAppSec) Credential Management API Level 1,", | ||
"license": "MIT", | ||
"author": "Iain McGinniss <https://github.com/iainmcgin>", | ||
"contributors": [ | ||
{ | ||
"name": "Iain McGinniss", | ||
"url": "https://github.com/iainmcgin" | ||
} | ||
], | ||
"main": "", | ||
@@ -13,8 +18,6 @@ "repository": { | ||
"scripts": {}, | ||
"dependencies": { | ||
"@types/whatwg-fetch": "*" | ||
}, | ||
"dependencies": {}, | ||
"peerDependencies": {}, | ||
"typesPublisherContentHash": "d1811ae4a175aa10568a833815756cc216e112e57092d41ef2c3ca94a7d3a960", | ||
"typesPublisherContentHash": "c6f5c8ae2ad5e3ab8bb0947c2d782258c077c1be163178b3c1c70efb29d19731", | ||
"typeScriptVersion": "2.0" | ||
} |
@@ -5,3 +5,3 @@ # Installation | ||
# Summary | ||
This package contains type definitions for W3C (WebAppSec) Credential Management API, Level 1, (https://github.com/w3c/webappsec-credential-management). | ||
This package contains type definitions for W3C (WebAppSec) Credential Management API Level 1, (https://github.com/w3c/webappsec-credential-management). | ||
@@ -12,7 +12,7 @@ # Details | ||
Additional Details | ||
* Last updated: Fri, 13 Jan 2017 15:10:29 GMT | ||
* Dependencies: whatwg-fetch | ||
* Global values: CredentialBase, FederatedCredential, PasswordCredential, SiteBoundCredential, URLSearchParams | ||
* Last updated: Sat, 11 Mar 2017 00:22:02 GMT | ||
* Dependencies: none | ||
* Global values: CredentialBase, FederatedCredential, Headers, PasswordCredential, ReadableStream, ReadableStreamReader, Request, Response, SiteBoundCredential, URLSearchParams, fetch | ||
# Credits | ||
These definitions were written by Iain McGinniss <https://github.com/iainmcgin>. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15871
0
394
3
- Removed@types/whatwg-fetch@*
- Removed@types/whatwg-fetch@0.0.33(transitive)
- Removed@types/whatwg-streams@3.2.1(transitive)
- Removedbluebird@1.0.8(transitive)
- Removeddeep-equal@0.1.2(transitive)
- Removeddefined@0.0.0(transitive)
- Removedinherits@2.0.4(transitive)
- Removedjsonify@0.0.1(transitive)
- Removedresumer@0.0.0(transitive)
- Removedtape@2.3.3(transitive)
- Removedthrough@2.3.8(transitive)
- Removedwhatwg-streams@0.1.1(transitive)