wot-typescript-definitions
Advanced tools
Comparing version
369
index.d.ts
@@ -1,4 +0,1 @@ | ||
// import { Observable } from 'rxjs/Observable'; | ||
// import { Subscription } from 'rxjs/Subscription'; | ||
export as namespace WoT; | ||
@@ -84,96 +81,5 @@ | ||
*/ | ||
export declare type ThingDescription = object | {[ key: string ]: any; }; | ||
export declare type ThingDescription = object | { [key: string]: any; }; | ||
// /** Carries version information about the TD instance. If required, additional version information such as firmware and hardware version (term definitions outside of the TD namespace) can be extended here. */ | ||
// export interface VersionInfo { | ||
// instance?: string; | ||
// } | ||
// /** | ||
// * The ThingFragment dictionary contains fields to initialize a Thing or to match during discovery | ||
// */ | ||
// export interface ThingFragment { | ||
// /** A hint to gernerate the identifier for the Thing */ | ||
// id?: string; | ||
// /** The title attribute represents the user given name of the Thing */ | ||
// title?: string; | ||
// /** Define the base URI that is valid for all defined local interaction resources */ | ||
// base?: string; | ||
// /** A human-readable description of the Thing */ | ||
// description?: string; | ||
// /** Human-readable descriptions in different languages */ | ||
// descriptions?: MultiLanguage; | ||
// /** Information about the Thing maintainer, e.g., author or contact URI */ | ||
// support?: string; | ||
// /** Provides information when the TD instance was last modified */ | ||
// lastModified?: string; | ||
// /** Provides information when the TD instance was created */ | ||
// created?: string; | ||
// /** Provides version information */ | ||
// version?: VersionInfo; | ||
// /** Set of named security configurations (definitions only). Not actually applied unless names are used in a security section */ | ||
// securityDefinitions?: { [key: string]: Security } | ||
// /** Set of security definition names, chosen from those defined in securityDefinitions. */ | ||
// security?: Array<String>; | ||
// /** A map of PropertyFragments with decriptions only */ | ||
// properties?: { [key: string]: PropertyFragment } | ||
// /** A map of ActionFragments with decriptions only */ | ||
// actions?: { [key: string]: ActionFragment } | ||
// /** A map of EventFragments with decriptions only */ | ||
// events?: { [key: string]: EventFragment } | ||
// /** A list of Web links to other Things or metadata */ | ||
// links?: Array<Link>; | ||
// /** Indicates one or more endpoints at which operation(s) on this resource are accessible */ | ||
// forms?: Array<Form>; | ||
// /** | ||
// * A collection of predicate terms that reference values of any type, | ||
// * e.g., @context, @type, or other terms from the vocabulary defined in @context. | ||
// */ | ||
// [key: string]: any; | ||
// } | ||
// /** Base for representing Thing Interaction descriptions */ | ||
// export interface InteractionFragment { | ||
// /** A human-readable title for the Interaction, e.g., for UIs */ | ||
// title?: string; | ||
// /** Human-readable titles for the Interaction, in different languages */ | ||
// titles?: MultiLanguage; | ||
// /** A human-readable description of the Interaction */ | ||
// description?: string; | ||
// /** Human-readable descriptions in different languages */ | ||
// descriptions?: MultiLanguage; | ||
// /** Set of authorization scope identifiers */ | ||
// scopes?: Array<string>; | ||
// /** URI template variables */ | ||
// uriVariables?: { [key: string]: DataSchema }; | ||
// /** Set of security definition names */ | ||
// security?: Array<string>; | ||
// /** | ||
// * A collection of predicate terms that reference values of any type, | ||
// * e.g., @type, or other terms from the vocabulary defined in @context. | ||
// */ | ||
// [key: string]: any; | ||
// } | ||
// /** Represents a Thing Property description */ | ||
// export interface PropertyFragment extends InteractionFragment, BaseSchema { | ||
// observable?: boolean; | ||
// } | ||
// /** Represents a Thing Action description */ | ||
// export interface ActionFragment extends InteractionFragment { | ||
// input?: DataSchema; | ||
// output?: DataSchema; | ||
// safe?: boolean; | ||
// idempotent?: boolean; | ||
// } | ||
// /** Represents a Thing Event description */ | ||
// export interface EventFragment extends InteractionFragment { | ||
// subscription?: DataSchema; | ||
// data?: DataSchema; | ||
// cancellation?: DataSchema; | ||
// } | ||
/** | ||
@@ -183,70 +89,28 @@ * The ConsumedThing interface instance represents a client API to operate a Thing. | ||
export interface ConsumedThing { | ||
// /** id becomes mandatory for Thing instances */ | ||
// id: string; | ||
// /** title becomes mandatory for Thing instances */ | ||
// title: string; | ||
// /** base becomes available for Thing instances (part of binding metadata) */ | ||
// base?: string; | ||
readProperty(propertyName: string, options?: InteractionOptions): Promise<any>; | ||
readAllProperties(options?: InteractionOptions): Promise<object>; | ||
readMultipleProperties(propertyNames: string[], options?: InteractionOptions): Promise<PropertyValueMap>; | ||
writeProperty(propertyName: string, value: any, options?: InteractionOptions): Promise<void>; | ||
writeMultipleProperties(valueMap: PropertyValueMap, options?: InteractionOptions): Promise<void>; | ||
// /** A map of ThingProperties (PropertyFragment plus mandatory binding metadata (forms)) */ | ||
// properties: { [key: string]: ThingProperty }; | ||
// /** A map of ThingActions (ActionFragment plus mandatory binding metadata (forms)) */ | ||
// actions: { [key: string]: ThingAction }; | ||
// /** A map of ThingEvents (EventFragment plus mandatory binding metadata (forms)) */ | ||
// events: { [key: string]: ThingEvent }; | ||
invokeAction(actionName: string, parameter?: any, options?: InteractionOptions): Promise<any>; | ||
// next API | ||
// XXX add additional 'options' field to allow for uriVariables et cetera | ||
readProperty(propertyName: string): Promise<any>; | ||
readAllProperties(): Promise<object>; | ||
readMultipleProperties(propertyNames: string[]): Promise<object>; | ||
writeProperty(propertyName: string, value: any): Promise<void>; | ||
writeMultipleProperties(valueMap: { [key: string]: any }): Promise<void>; | ||
observeProperty(name: string, listener: WotListener, options?: InteractionOptions): Promise<string>; | ||
unobserveProperty(subscriptionId: string): Promise<void>; | ||
invokeAction(actionName: string, parameter?: any): Promise<any>; | ||
subscribeEvent(name: string, listener: WotListener, options?: InteractionOptions): Promise<string>; | ||
unsubscribeEvent(subscriptionId: string): Promise<void>; | ||
observeProperty(name: string, listener: WotListener): Promise<void>; | ||
unobserveProperty(name: string): Promise<void>; | ||
getThingDescription(): ThingDescription; | ||
} | ||
subscribeEvent(name: string, listener: WotListener): Promise<void>; | ||
unsubscribeEvent(name: string): Promise<void>; | ||
getTD(): ThingDescription; | ||
// replace getTD with attribute? | ||
// td: ThingDescription; | ||
export interface InteractionOptions { | ||
uriVariables: object; | ||
} | ||
export declare type PropertyValueMap = object | { [key: string]: any; }; | ||
export declare type WotListener = (data: any) => void; | ||
// /** | ||
// * The Interaction interface is an abstract class to represent Thing interactions: Properties, Actions and Events. | ||
// */ | ||
// export interface ThingInteraction extends InteractionFragment { | ||
// forms: Array<Form>; | ||
// } | ||
// /** Represents an interactable Thing Property */ | ||
// export interface ThingProperty extends ThingInteraction, PropertyFragment //, Observable<any> | ||
// { | ||
// read(options?: any): Promise<any>; | ||
// write(value: any, options?: any): Promise<void>; | ||
// subscribe(next?: (value: any) => void, error?: (error: any) => void, complete?: () => void): Subscription; | ||
// } | ||
// /** Represents an interactable Thing Action */ | ||
// export interface ThingAction extends ThingInteraction, ActionFragment { | ||
// invoke(parameter?: any, options?: any): Promise<any>; | ||
// } | ||
// /** Represents an interactable Thing Event */ | ||
// // FIXME: Events are different on ConsumendThing and ExposedThing | ||
// export interface ThingEvent extends ThingInteraction, EventFragment { | ||
// subscribe(next?: (data: any) => void, error?: (error: any) => void, complete?: () => void): Subscription; | ||
// // FIXME emit should be only on ExposedThings' ThingEvents - therefore move emit() to ExposedThing? | ||
// emit?(data?: any): void; | ||
// } | ||
// /** Represents a client API object to consume Things and their Properties, Actions, and Events */ | ||
// export interface ConsumedThing extends ThingInstance { | ||
// } | ||
/** | ||
@@ -256,5 +120,2 @@ * The ExposedThing interface is the server API to operate the Thing that allows defining request handlers, Property, Action, and Event interactions. | ||
export interface ExposedThing extends ConsumedThing { | ||
// define how to expose and run the Thing | ||
/** | ||
@@ -270,43 +131,2 @@ * Start serving external requests for the Thing, so that WoT Interactions using Properties, Actions and Events will be possible. | ||
// define Thing Description modifiers | ||
// /** | ||
// * Adds a Property with name defined by the name argument, the data schema provided by the property argument of type PropertyFragment, and optionally an initial value provided in the argument initValue whose type should match the one defined in the type property. | ||
// */ | ||
// addProperty(name: string, property: PropertyFragment, init?: any): ExposedThing; | ||
// /** | ||
// * Removes the Property specified by the name argument and updates the Thing Description. Throws on error. Returns a reference to the same object for supporting chaining. | ||
// */ | ||
// removeProperty(name: string): ExposedThing; | ||
// /** | ||
// * Adds to the actions property of a Thing object an Action with name defined by the name argument, defines input and output data format by the action argument of type ActionFragment, and adds the function provided in the handler argument as a handler, then updates the Thing Description. | ||
// * Throws on error. | ||
// * Returns a reference to the same object for supporting chaining. | ||
// */ | ||
// addAction(name: string, action: ActionFragment, handler: ActionHandler): ExposedThing; | ||
// /** | ||
// * Removes the Action specified by the name argument and updates the Thing Description. | ||
// * Throws on error. | ||
// * Returns a reference to the same object for supporting chaining. | ||
// */ | ||
// removeAction(name: string): ExposedThing; | ||
// /** | ||
// * Adds an event with name defined by the name argument and qualifiers and initialization value provided by the event argument of type EventFragmentto the Thing object and updates the Thing Description. | ||
// * Throws on error. | ||
// * Returns a reference to the same object for supporting chaining. | ||
// */ | ||
// addEvent(name: string, event: EventFragment): ExposedThing; | ||
// /** | ||
// * Removes the event specified by the name argument and updates the Thing Description. | ||
// * Returns a reference to the same object for supporting chaining. | ||
// */ | ||
// removeEvent(name: string): ExposedThing; | ||
// define request handlers | ||
/** | ||
@@ -339,161 +159,6 @@ * Takes name as string argument and handler as argument of type PropertyReadHandler. | ||
// TODO: Decide if decorator (with 'internal') or replacement (without 'internal') for get() | ||
// For now decorator in node-wot | ||
export declare type PropertyReadHandler = (internal?: any, options?: any) => Promise<any>; | ||
// TODO: Decide if decorator (return any) or replacement (return void) for set() | ||
// For now decorator in node-wot | ||
export declare type PropertyWriteHandler = (value: any, options?: any) => Promise<any>; | ||
export declare type ActionHandler = (parameters: any, options?: any) => Promise<any>; | ||
// export interface Link { | ||
// href: string; | ||
// rel?: string | Array<string>; | ||
// type?: string; // media type hint, no media type parameters | ||
// anchor?: string; | ||
// } | ||
// export interface ExpectedResponse { | ||
// contentType?: string; | ||
// } | ||
// export interface Form { | ||
// href: string; | ||
// subprotocol?: string; | ||
// op?: string | Array<string>; | ||
// contentType?: string; // media type + parameter(s), e.g., text/plain;charset=utf8 | ||
// security?: Array<string>; // Set of security definition names, chosen from those defined in securityDefinitions // Security; | ||
// scopes?: Array<string>; | ||
// response?: ExpectedResponse; | ||
// } | ||
// export declare type MultiLanguage = any; // object? | ||
// export type DataSchema = BooleanSchema | IntegerSchema | NumberSchema | StringSchema | ObjectSchema | ArraySchema | NullSchema; | ||
// export interface BaseSchema { | ||
// type?: string; | ||
// title?: string; | ||
// titles?: MultiLanguage; | ||
// description?: string; | ||
// descriptions?: MultiLanguage; | ||
// writeOnly?: boolean; | ||
// readOnly?: boolean; | ||
// oneOf?: Array<DataSchema>; | ||
// unit?: string; | ||
// const?: any; | ||
// enum?: Array<any>; | ||
// } | ||
// export interface BooleanSchema extends BaseSchema { | ||
// type: "boolean"; | ||
// } | ||
// export interface IntegerSchema extends BaseSchema { | ||
// type: "integer"; | ||
// minimum?: number; | ||
// maximum?: number; | ||
// } | ||
// export interface NumberSchema extends BaseSchema { | ||
// type: "number"; | ||
// minimum?: number; | ||
// maximum?: number; | ||
// } | ||
// export interface StringSchema extends BaseSchema { | ||
// type: "string"; | ||
// } | ||
// export interface ObjectSchema extends BaseSchema { | ||
// type: "object"; | ||
// properties: { [key: string]: DataSchema }; | ||
// required?: Array<string>; | ||
// } | ||
// export interface ArraySchema extends BaseSchema { | ||
// type: "array"; | ||
// items: DataSchema; | ||
// minItems?: number; | ||
// maxItems?: number; | ||
// } | ||
// export interface NullSchema extends BaseSchema { | ||
// type: "null"; | ||
// } | ||
// export type Security = NoSecurityScheme | BasicSecurityScheme | DigestSecurityScheme | BearerSecurityScheme | CertSecurityScheme | PoPSecurityScheme | APIKeySecurityScheme | OAuth2SecurityScheme | PSKSecurityScheme | PublicSecurityScheme; | ||
// export interface SecurityScheme { | ||
// scheme: string; | ||
// description?: string; | ||
// proxy?: string; | ||
// } | ||
// export interface NoSecurityScheme extends SecurityScheme { | ||
// scheme: "nosec"; | ||
// } | ||
// export interface BasicSecurityScheme extends SecurityScheme { | ||
// scheme: "basic"; | ||
// in?: string; | ||
// name?: string; | ||
// } | ||
// export interface DigestSecurityScheme extends SecurityScheme { | ||
// scheme: "digest"; | ||
// name?: string; | ||
// in?: string; | ||
// qop?: string; | ||
// } | ||
// export interface APIKeySecurityScheme extends SecurityScheme { | ||
// scheme: "apikey"; | ||
// in?: string; | ||
// name?: string; | ||
// } | ||
// export interface BearerSecurityScheme extends SecurityScheme { | ||
// scheme: "bearer"; | ||
// in?: string; | ||
// alg?: string; | ||
// format?: string; | ||
// name?: string; | ||
// authorization?: string; | ||
// } | ||
// 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; | ||
// name?: string; | ||
// in?: string; | ||
// } | ||
// export interface OAuth2SecurityScheme extends SecurityScheme { | ||
// scheme: "oauth2"; | ||
// authorization?: string; | ||
// flow?: string; // one of implicit, password, client, or code | ||
// token?: string; | ||
// refresh?: string; | ||
// scopes?: Array<string>; | ||
// } | ||
{ | ||
"name": "wot-typescript-definitions", | ||
"version": "0.7.0-NEXT-SNAPSHOT.12", | ||
"version": "0.7.0-NEXT-SNAPSHOT.13", | ||
"description": "TypeScript definitions for the W3C WoT Scripting API", | ||
@@ -5,0 +5,0 @@ "author": "W3C Web of Things Working Group", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
7941
-61.42%149
-65.9%1
Infinity%