wot-typescript-definitions
Advanced tools
Comparing version
@@ -22,3 +22,3 @@ import { Observable } from 'rxjs/Observable'; | ||
*/ | ||
fetch(url: USVString): Promise<ThingDescription>; | ||
fetch(url: string): Promise<ThingDescription>; | ||
@@ -41,7 +41,7 @@ /** | ||
*/ | ||
register(directory: USVString, thing: ExposedThing): Promise<void>; | ||
register(directory: string, thing: ExposedThing): Promise<void>; | ||
/** | ||
* Makes a request to unregister the thing from the given WoT Thing Directory. */ | ||
unregister(directory: USVString, thing: ExposedThing): Promise<void>; | ||
unregister(directory: string, thing: ExposedThing): Promise<void>; | ||
} | ||
@@ -60,7 +60,7 @@ | ||
*/ | ||
url?: USVString; | ||
url?: string; | ||
/** | ||
* The query field represents a query string accepted by the implementation, for instance a SPARQL query. | ||
*/ | ||
query?: USVString; | ||
query?: string; | ||
/** | ||
@@ -88,3 +88,3 @@ * The fragment field represents a ThingFragment dictionary used for matching against discovered Things. | ||
*/ | ||
export declare type ThingDescription = USVString; | ||
export declare type ThingDescription = string; | ||
@@ -299,13 +299,13 @@ /** | ||
export interface Link { | ||
href: USVString; | ||
rel?: USVString | Array<USVString>; | ||
type?: USVString; // media type hint, no media type parameters | ||
anchor?: USVString; | ||
href: string; | ||
rel?: string | Array<string>; | ||
type?: string; // media type hint, no media type parameters | ||
anchor?: string; | ||
} | ||
export interface Form { | ||
href: USVString; | ||
subprotocol?: USVString; | ||
op?: USVString | Array<USVString>; | ||
contentType?: USVString; // media type + parameter(s), e.g., text/plain;charset=utf8 | ||
href: string; | ||
subprotocol?: string; | ||
op?: string | Array<string>; | ||
contentType?: string; // media type + parameter(s), e.g., text/plain;charset=utf8 | ||
security?: Security; | ||
@@ -359,3 +359,3 @@ } | ||
export type Security = NoSecurityScheme | BasicSecurityScheme | DigestSecurityScheme | BearerSecurityScheme | PopSecurityScheme | ApikeySecurityScheme | OAuth2SecurityScheme | PskScheme; | ||
export type Security = NoSecurityScheme | BasicSecurityScheme | DigestSecurityScheme | BearerSecurityScheme | CertSecurityScheme | PoPSecurityScheme | APIKeySecurityScheme | OAuth2SecurityScheme | PSKSecurityScheme | PublicSecurityScheme; | ||
@@ -366,3 +366,3 @@ | ||
description?: string; | ||
proxyURI?: any; | ||
proxy?: string; | ||
} | ||
@@ -382,3 +382,9 @@ | ||
scheme: "digest"; | ||
name?: string; | ||
in?: string; | ||
qop?: string; | ||
} | ||
export interface APIKeySecurityScheme extends SecurityScheme { | ||
scheme: "apikey"; | ||
in?: string; | ||
@@ -390,32 +396,41 @@ name?: string; | ||
scheme: "bearer"; | ||
in?: string; | ||
alg?: string; | ||
format?: string; | ||
in?: string; | ||
name?: string; | ||
authorization?: string; | ||
} | ||
export interface PopSecurityScheme extends SecurityScheme { | ||
export interface CertSecurityScheme extends SecurityScheme { | ||
scheme: "cert"; | ||
identity?: string; | ||
} | ||
export interface PSKSecurityScheme extends SecurityScheme { | ||
scheme: "psk"; | ||
identity?: string; | ||
} | ||
export interface PublicSecurityScheme extends SecurityScheme { | ||
scheme: "public"; | ||
identity?: string; | ||
} | ||
export interface PoPSecurityScheme extends SecurityScheme { | ||
scheme: "pop"; | ||
format?: string; | ||
authorization?: string; | ||
alg?: string; | ||
format?: string; | ||
name?: string; | ||
in?: string; | ||
name?: string; | ||
} | ||
export interface ApikeySecurityScheme extends SecurityScheme { | ||
scheme: "apikey"; | ||
in: string; | ||
name?: string; | ||
} | ||
export interface OAuth2SecurityScheme extends SecurityScheme { | ||
scheme: "oauth2"; | ||
authorizationUrl: string; | ||
authorization?: string; | ||
flow?: string; // one of implicit, password, client, or code | ||
token?: string; | ||
refresh?: string; | ||
scopes?: Array<string>; | ||
// one of implicit, password, client, or code | ||
flow: string; | ||
} | ||
export interface PskScheme extends SecurityScheme { | ||
scheme: "psk"; | ||
} |
{ | ||
"name": "wot-typescript-definitions", | ||
"version": "0.6.0-SNAPSHOT.2", | ||
"version": "0.6.0-SNAPSHOT.3", | ||
"description": "TypeScript definitions for the W3C WoT Scripting API", | ||
@@ -5,0 +5,0 @@ "author": "W3C Web of Things Working Group", |
# wot-typescript-definitions | ||
A typescript definition file for the WoT scripting API as used in thingweb node-wot. | ||
A TypeScript definition file for the WoT Scripting API to be used by implementations such as [Eclipse Thingweb](https://projects.eclipse.org/projects/iot.thingweb). | ||
## WARNING | ||
The current definitions and work are still done on https://github.com/thingweb/wot-typescript-definitions and will be moved to this repository in the near future. | ||
## Notes on usage | ||
These definitions are imported using npm. Once we reach conclusion on the API in the W3C Web of Things task force, we will add this to definatelytyped. | ||
These definitions are imported using npm. | ||
Once we reach conclusion on the API in the W3C Web of Things Working Group, it is planned to add them to DefinitelyTyped. | ||
## ES5 targets | ||
As consumers are using typescript we target ES6. | ||
When implementing for ES5 targets, be sure to provide a polyfill for ES6 Promises, either ``es6-promise`` from npm or add the lib ``es2015.promise`` to your tsc command when transpiling typescript. | ||
As consumers are using TypeScript we target ES6. | ||
When implementing for ES5 targets, be sure to provide a polyfill for ES6 Promises, either ``es6-promise`` from npm or add the lib ``es2015.promise`` to your tsc command when transpiling TypeScript. |
17191
1.64%379
3.27%14
-12.5%