UNPKG

service-model

Version:

An object oriented web service framework inspired by Windows Communication Foundation.

59 lines (58 loc) 2.17 kB
import { ContractDescription, ContractBehavior, BehaviorAnnotation } from "../description/contractDescription"; import { EndpointDescription, EndpointBehavior } from "../description/endpointDescription"; import { DispatchEndpoint } from "../dispatcher/dispatchEndpoint"; /** * Contract and endpoint behavior that allows an endpoint to be selected by version number as specified by the client. * The version of the contract must be provided in [semver](http://semver.org/) format. The behavior can be applied to * a contract using the [[Versioning]] decorator or to a specific endpoint by adding an instance of VersioningBehavior * to the list of behaviors for the endpoint. * * <uml> * hide members * hide circle * ContractBehavior <|.. VersioningBehavior * EndpointBehavior <|.. VersioningBehavior * </uml> * * ### Example * * ```typescript *  @Contract("Calculator") *  @Versioning({ version: "1.0.0" }) * export class CalculatorService { *   ... *  } * ``` */ export declare class VersioningBehavior implements ContractBehavior, EndpointBehavior, BehaviorAnnotation { /** * The name of the contract that is the target of the versioning behavior. This is required when the service has * more than one contract defined. */ contract: string; /** * The version of the service contract in [semver](http://semver.org/) format. */ version: string; /** * Constructs a VersioningBehavior object. * @param options Options for the behvaior. */ constructor(options: VersioningOptions); applyContractBehavior(description: ContractDescription, endpoint: DispatchEndpoint): void; applyEndpointBehavior(description: EndpointDescription, endpoint: DispatchEndpoint): void; } /** * Options for a [[VersioningBehavior]]. */ export interface VersioningOptions { /** * The version of the service contract in [semver](http://semver.org/) format. */ version: string; /** * The name of the contract that is the target of the versioning behavior. This is required for when the service has * more than one contract defined. */ contract?: string; }