From ee0f8a1460f08087527d18c111fbb19358e5a06f Mon Sep 17 00:00:00 2001 From: "markus.mauch@gmail.com" Date: Fri, 19 Jun 2015 21:15:22 +0200 Subject: [PATCH 001/103] Added type definitions for Sdk.Soap.js --- sdk.soap/sdk.soap-tests.ts | 11 + sdk.soap/sdk.soap.d.ts | 2203 ++++++++++++++++++++++++++++++++++++ 2 files changed, 2214 insertions(+) create mode 100644 sdk.soap/sdk.soap-tests.ts create mode 100644 sdk.soap/sdk.soap.d.ts diff --git a/sdk.soap/sdk.soap-tests.ts b/sdk.soap/sdk.soap-tests.ts new file mode 100644 index 000000000..78deb50fb --- /dev/null +++ b/sdk.soap/sdk.soap-tests.ts @@ -0,0 +1,11 @@ +/// + +var query = new Sdk.Query.QueryByAttribute( "account" ); +query.addColumn( "accountnumber" ); +query.addAttributeValue( new Sdk.String( "name", "acme" ) ); +Sdk.Q.retrieveMultiple( query ).then( entityCollection => +{ + var first = entityCollection.getEntities().getByIndex( 0 ); + var accountNumber = first.getAttributes().getAttributeByName( "accountnumber" ); + console.log( "Account 'acme' has the Account Number '" + accountNumber + "'" ); +} ); \ No newline at end of file diff --git a/sdk.soap/sdk.soap.d.ts b/sdk.soap/sdk.soap.d.ts new file mode 100644 index 000000000..b450fd481 --- /dev/null +++ b/sdk.soap/sdk.soap.d.ts @@ -0,0 +1,2203 @@ +// Type definitions for Sdk.Soap.js +// Project: https://code.msdn.microsoft.com/SdkSoapjs-9b51b99a +// Definitions by: Markus Mauch +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module Sdk +{ + interface IEntityView + { + attributes: AttributeCollection; + entityState: EntityState; + id: string; + logicalName: string; + relatedEntities: RelatedEntityCollection; + } + + interface IEntityCollectionView + { + entityName: string; + entities: Array; + minActiveRowVersion: string; + moreRecords: boolean; + pagingCookie: string; + totalRecordCount: number; + totalRecordCountLimitExceeded: boolean; + } + + interface IEntityReferenceView + { + Id: string; + Type: string; + Name: string; + } + + interface IEntityReferenceCollectionView extends Array + { } + + class ColumnSet + { + /** + * Specifies the attributes for which non- null values are returned from a query. + * @param columns Comma separated string values for attribute logical names. + */ + constructor( ...columns: string[] ); + + /** + * Specifies the attributes for which non- null values are returned from a query. + * @param columns An Array of string values. + */ + constructor( columns: string[] ); + + /** + * Specifies the attributes for which non- null values are returned from a query. + * @param allColumns If Boolean true value is passed as the first parameter all columns will be included. (Not recommended for production code). + */ + constructor( allColumns: boolean ); + + /** + * Gets the collection of column names. + * @returns The collection of column names. + */ + getColumns(): Sdk.Collection; + + /** + * Adds a column to the collection. + * @param column The logical name of the attribute to add. + */ + addColumn( column: string ); + + /** + * Adds a string array of column names. + * @param columns A string array of column names. + */ + addColumns( columns: Array ); + + /** + * Sets the AllColumns property. + * @params allColumns A boolean value. + */ + setAllColumns( allColumns: boolean ); + + /** + * Whether all columns will be returned. + */ + getAllColumns(): boolean; + + /** + * Gets the number of columns. + */ + getCount(): number; + + + /// prototype methods + + /** + * Removes a column from the ColumnSet. + * @param columnName The logical name of an attribute to be removed from the ColumnSet. + * @param errorIfNotFound Whether to throw an error when the column to remove is not found. The default is false + */ + removeColumn( columnName: string, errorIfNotFound?: boolean ): void; + + /** + * The XML node with "" as the root element. + */ + toXml(): string; + + /** + * XML nodes for columnSet properties. + */ + toValueXml(): string; + } + + class ValueType + { + + } + + class Collection + { + /** + * A Collection for a specified type. + * @param type The function that specifies the type. + * @param items An array of items to add to the collection. + */ + constructor( type: T, items?: Array ); + + /** + * Gets the type defined for the collection. + */ + getType(): T; + + /** + * Adds an item to the collection. + * @param item An item to add to the collection. + */ + add( item: T ): void; + + /** + * Adds an array of objects to the collection. + * @param items An array of items to add to the collection. + */ + addRange( items ): void; + + /** + * Removes all items from the collection. + */ + clear(): void; + + /** + * Returns whether an object exists within the collection. + * @param item The item to search in the collection. + */ + contains( item: T ): boolean; + + /** + * Applies the action contained within a delegate function. + * @param fn Delegate function with parameters for item and index. + */ + forEach( fn: ( item: T, index: number ) => any ); + + /** + * Gets the item in the collection at the specified index. + * @param index The index of the item to return. + */ + getByIndex( index: number ): T; + + /** + * Removes an item from the collection. + * @param item The item to be removed. + */ + remove( item: T ): void; + + /** + * Gets a copy of the array of items in the collection. + */ + toArray(): Array; + + /** + * Returns the number of items in the collection. + */ + getCount(): number; + } + + class EntityCollection + { + /** + * Contains a collection of entity instances. + * @param entities Initializes a new instance of the EntityCollection class setting the Sdk.Collection of Sdk.Entity objects. + */ + constructor( entities: Sdk.Collection ); + + /** + * Adds an entity to the collection. + * @param entity + */ + addEntity( entity: Sdk.Entity ): void; + + /** + * Gets the collection of entities. + */ + getEntities(): Sdk.Collection; + + /** + * Gets an entity in the collection. + * @param indexOrId The index or Id of the entity in the collection. + */ + getEntity( indexOrId: string | Sdk.Guid ): Sdk.Entity; + + /** + * Sets an item in the collection. + * @param indexOrId The index or Sdk.Guid id of the entity in the collection. + * @param value The Sdk.Entity value to set. + */ + setEntity( indexOrId: string | Sdk.Guid, value: Sdk.Entity ): void; + + /** + * Gets the logical name of the entity. + */ + getEntityName(): string; + + /** + * Sets the logical name of the entity. + * @param name The logical name of the entity. + */ + setEntityName( name: string ): void; + + /** + * Gets the lowest active row version value. + */ + getMinActiveRowVersion(): string; + + /** + * Sets the lowest active row version value. + * @param minActiveRowVersion The lowest active row version value. + */ + setMinActiveRowVersion( minActiveRowVersion: string ): void; + + /** + * Gets whether there are more records available. + */ + getMoreRecords(): boolean; + + /** + * Sets whether there are more records available. + * @param moreRecords Whether there are more records available. + */ + setMoreRecords( moreRecords: boolean ): void; + + /** + * Gets the current paging information. + */ + getPagingCookie(): string; + + /** + * Sets the current paging information. + * @param pagingCookie The current paging information. + */ + setPagingCookie( pagingCookie: string ): void; + + /** + * Gets the total number of records in the collection if ReturnTotalRecordCount was true when the query was executed. + */ + getTotalRecordCount(): number; + + /** + * Sets the total number of records in the collection if ReturnTotalRecordCount was true when the query was executed. + * @param totalRecordCount The total number of records in the collection if ReturnTotalRecordCount was true when the query was executed. + */ + setTotalRecordCount( totalRecordCount: number ): void; + + /** + * Gets whether the results of the query exceeds the total record count. + */ + getTotalRecordCountLimitExceeded(): boolean; + + /** + * Sets whether the results of the query exceeds the total record count. + * @param totalRecordCountLimitExceeded Whether the results of the query exceeds the total record count. + */ + setTotalRecordCountLimitExceeded( totalRecordCountLimitExceeded: boolean ); + + /** + * XML definition of an the child nodes of an entity. + */ + toValueXml(): string; + + /** + * Returns a view of the entity collection + */ + view(): IEntityCollectionView; + } + + class EntityReferenceCollection + { + /** + * Contains a collection of EntityReference instances. + * @param entityReferences Initializes a new instance of the EntityReferenceCollection class setting the Sdk.Collection of Sdk.EntityReference objects. + */ + constructor( entityReferences?: Sdk.Collection ); + + /** + * Gets the collection of entity references. + */ + getEntityReferences(): Sdk.Collection; + + /** + * Sets the collection of entity references. + * @param entityReferences The entity references + */ + setEntityReferences( entityReferences: Sdk.Collection ); + + + /// prototype methods + + /** + * Removes an entity reference to the collection. + * @param entityReference The entity reference to remove. + */ + remove( entityReference: Sdk.EntityReference ); + + /** + * Returns a view of the data in an entity reference collection instance. + */ + view(): IEntityReferenceCollectionView; + + /** + * Returns the values of serialized entity reference collection as XML nodes. + */ + toValueXml(): string; + } + + class RelatedEntityCollection extends EntityCollection + { + + } + + class AttributeCollection extends Collection + { + /** + * Adds an attribute to the Attribute Collection. + * @param attribute The attribute to add. + * @param isChanged Override the the attribute IsChanged value. + */ + add( attribute: AttributeBase, isChanged?: boolean ): void; + + /** + * Gets the attributes in the collection. + */ + getAttributes(): Collection; + + + /// prototype methods + + /** + * Allows for a delegate function to be applied to each attribute in the collection. + * @param fm The function to be applied. Function should have parameters for the attribute and the iterator i.e.: '(att,i)' + */ + forEach( fn: ( attribute: AttributeBase, index: number ) => any ): void; + + /** + * Returns all attributes in the collection. + */ + get(): Sdk.Collection; + + /** + * Returns the attribute with matching name. + * @param attribuetName + */ + get( attribuetName: string ): AttributeBase; + + /** + * Returns the attribute with matching index. + * @param attribuetName + */ + get( index: number ): AttributeBase; + + /** + * Gets an attribute at a given index. + * @param index The index. + */ + getAttributeByIndex( index: number ): AttributeBase; + + /** + * Gets an attribute with a given name. + * @param name The Logical name of the attribute. + */ + getAttributeByName( name: string ): AttributeBase; + + /** + * Gets an array of the names of attributes in a collection. + */ + getNames(): Array; + /** + * The XML for an attribute collection. + */ + toXml( action: string ): string; + } + + class FormattedValueCollection + { + } + + class RelatedEntitiesCollection + { + } + + class AttributeBase + { + /** + * Gets whether the value of the attribute has changed. + */ + getIsChanged(): boolean; + + /** + * Gets the logical name of the attribute. + */ + getName(): string; + + /** + * Gets the value type of the attribute. + */ + getType(): Sdk.ValueType; + + /** + * Gets the value of the attribute. + * The type of value depends on the type of attribute. + */ + getValue(): any; + + /** + * Whether the value of the attribute is set. + */ + isValueSet(): boolean; + + /** + * Sets whether the value of the attribute has changed. + * @param isChanged Whether the value of the attribute has changed. + */ + setIsChanged( isChanged: boolean ): void; + + /** + * Sets the name of the attribute + * @param name The name of the attribute. + */ + setName( name: string ): void; + + /** + * For internal use only. + * @param type The type of the attribute. + */ + setType( type: Sdk.ValueType ): void; + + /** + * Internal Use Only + */ + setValidValue( value ); + + + /// prototype methods + + /** + * XML node for Attribute. + */ + toXml( action ): string; + } + + class Boolean extends AttributeBase + { + /** + * A Boolean Attribute. + * @param name The logical name of the attribute . + * @param value The value of the managed property. + */ + constructor( name: string, value?: boolean ) + + /** + * Gets the value of a Boolean attribute. + */ + getValue(): boolean; + + /** + * Sets the value of a Boolean attribute. + * @param value + */ + setValue( value: boolean ): void; + } + + class DateTime extends AttributeBase + { + /** + * A DateTime Attribute. + * @param name The logical name of the attribute. + * @param value The value of the attribute. + */ + constructor( name: string, value?: Date ); + + /** + * Gets the value of a DateTime attribute. + */ + getValue(): Date; + + /** + * Sets the value of a DateTime attribute. + * @param value The value to set. + */ + setValue( value: Date ): void; + } + + class Decimal extends AttributeBase + { + /** + * A Decimal Attribute. + * @param name The logical name of the attribute. + * @param value The value of the attribute. + */ + constructor( name: string, value?: number ); + + /** + * Gets the value of a Decimal attribute. + */ + getValue(): number; + + /** + * Sets the value of a Decimal attribute. + * @param value The value to set. + */ + setValue( value: number ): void; + } + + class Double + { + /** + * A Double Attribute. + * @param name The logical name of the attribute. + * @param value The value of the attribute. + */ + constructor( name: string, value?: number ); + + /** + * Gets the value of a Double attribute. + */ + getValue(): number; + + /** + * Sets the value of a Double attribute. + * @param value The value to set. + */ + setValue( value: number ): void; + } + + class Guid extends AttributeBase + { + /** + * A Guid Attribute. + * @param name The logical name of the attribute. + * @param value" The value of the attribute + */ + constructor( name: string, value?: string ); + + /** + * Gets the value of a Guid attribute. + */ + getValue(): string; + + /** + * Sets the value of a Guid attribute. + * @param value The value to set. + */ + setValue( value: string ): void; + } + + class Int extends AttributeBase + { + /** + * An Integer Attribute. + * @param name The logical name of the attribute. + * @param value The value of the attribute. + */ + constructor( name: string, value?: number ); + + /** + * Gets the value of an Integer attribute. + */ + getValue(): number; + + /** + * Sets the value of an Integer attribute. + * @param value The value to set. + */ + setValue( value: number ): void; + } + + class Long extends AttributeBase + { + /** + * A Long Attribute. + * @param name The logical name of the attribute. + * @param value The value of the attribute. + */ + constructor( name: string, value?: number ); + + /** + * Gets the value of a Long attribute. + */ + getValue(): number; + + /** + * Sets the value of a Long attribute. + * @param value The value to set. + */ + setValue( value: number ): void; + } + + class Lookup extends AttributeBase + { + /** + * A Lookup Attribute. + * @param name The logical name of the attribute. + * @param value The value of the attribute. + */ + constructor( name: string, value?: EntityReference ); + + /** + * Gets the value of a Lookup attribute. + */ + getValue(): EntityReference; + + /** + * Sets the value of a Lookup attribute. + * @param value The value to set. + */ + setValue( value: EntityReference ): void; + } + + class Money extends AttributeBase + { + /** + * A Money Attribute. + * @param name The logical name of the attribute. + * @param value The value of the attribute. + */ + constructor( name: string, value?: number ); + + /** + * Gets the value of a Money attribute. + */ + getValue(): number; + + /** + * Sets the value of a Money attribute. + * @param value The value to set. + */ + setValue( value: number ): void; + } + + class OptionSet extends AttributeBase + { + /** + * An OptionSet Attribute. + * @param name The logical name of the attribute. + * @param value The value of the attribute. + */ + constructor( name: string, value?: number ); + + /** + * Gets the value of a OptionSet attribute. + */ + getValue(): number; + + /** + * Sets the value of an OptionSet attribute. + * @param value The value to set. + */ + setValue( value: number ): void; + } + + class PartyList extends AttributeBase + { + /** + * A PartyList Attribute. + * @param name The logical name of the attribute. + * @param value The value of the attribute. + */ + constructor( name: string, value?: EntityCollection ); + + /** + * Gets the value of a PartyList attribute. + */ + getValue(): EntityCollection; + + /** + * Sets the value of a PartyList attribute. + * @param value The value to set. + */ + setValue( value: EntityCollection ): void; + } + + class String extends AttributeBase + { + /** + * A String Attribute. + * @param name The logical name of the attribute. + * @param value The value of the attribute. + */ + constructor( name: string, value?: string ); + + /** + * Gets the value of a String attribute. + */ + getValue(): string; + + /** + * Sets the value of a String attribute. + * @param value The value to set. + */ + setValue( value: string ): void; + } + + class EntityState + { } + + class Entity + { + /** + * Represents an instance of an entity (a record). + * @param type The logical name of the entity. + */ + constructor( type: string ); + + /** + * Gets the collection of attributes for the entity. + */ + getAttributes(): Sdk.AttributeCollection; + + /** + * Gets the collection of attributes for the entity. + * @param attributeName The attribute with matching name is returned. + */ + getAttributes( attributeName: string ): Sdk.AttributeCollection; + + /** + * Gets the collection of attributes for the entity. + * @param index The attribute with matching index is returned. + */ + getAttributes( index: number ): Sdk.AttributeCollection; + + /** + * Sets the collection of attributes for the entity. + * @param attributes The collection of attributes for the entity. + */ + setAttributes( attributes: Sdk.AttributeCollection ); + + /** + * Gets the state of the entity. + */ + getEntityState(): Sdk.EntityState; + + /** + * Sets the state of the entity. + * @param state The state of the entity. + */ + setEntityState( state: Sdk.EntityState ): void; + + /** + * Gets the collection of formatted values for the entity attributes. + */ + getFormattedValues(): Sdk.FormattedValueCollection; + + /** + * Sets the collection of formatted values for the entity attributes. + * @param values" The collection of formatted values for the entity attributes. + */ + setFormattedValues( values: Sdk.FormattedValueCollection ): void; + + /** + * Gets the Id of the record represented by this entity instance. + */ + getId(): string; + + /** + * Sets the Id of the record represented by this entity instance. + * @param id The Id of the record represented by this entity instance. + * @param override Allow setting the Id property, for example when creating a new record from an existing one. + */ + setId( id: string, override?: boolean ): void; + + /** + * Gets the logical name of the entity. + */ + getType(): string; + + /** + * Sets the logical name of the entity. + * @param type The logical name of the entity. + */ + setType( type ): void; + + /** + * Gets a collection of related entities. + */ + getRelatedEntities(): Sdk.RelatedEntitiesCollection; + + /** + * Sets a collection of related entities. + * @param relatedEntities A collection of related entities. + */ + setRelatedEntities( relatedEntities: Sdk.RelatedEntitiesCollection ): void; + + /** + * Adds an attribute with an optional value to a newly instantiated Sdk.Entity + * @param attribute The attribute to add + * @param isChanged Whether the attribute should be considered changed, the default is true. + */ + addAttribute( attribute: Sdk.AttributeBase, isChanged?: boolean ); + + /** + * Adds an entity to the related entities. + * @param relationshipSchemaName The relationship SchemaName. + * @param entity The entity to add. + */ + addRelatedEntity( relationshipSchemaName: string, entity: Sdk.Entity ): void; + + /** + * Gets the value to indicate whether data for the entity has changed. + */ + getIsChanged(): boolean; + + /** + * Sets the value to indicate whether data for the entity has changed. + * @param isChanged The value to indicate whether data for the entity has changed. + */ + setIsChanged( isChanged: boolean ); + + /** + * Gets the value of the specified attribute. + * @param logicalName The logical name of the attribute. + */ + getValue( logicalName: string ): Object; + + /** + * Generates properties for the entity based on metadata. + */ + initializeSubClass( metadata ); + + /** + * Sets the value of the specified attribute. + * @param logicalName The logical name of the attribute. + * @param value The value for the attribute. Simple JavaScript types may be used for most attribute types. Sdk.EntityReference, Sdk.EntityCollection, and Sdk.BooleanManagedPropertyValue cannot use simple JavaScript types. + */ + setValue( logicalName: string, value: Object ): void; + + /** + * Generates an entity reference. + */ + toEntityReference(): Sdk.EntityReference; + + /** + * Overrides the default toString method. + */ + toString(): string; + + /** + * XML definition of an the child nodes of an entity. + * @param action + */ + toValueXml( action ): string; + + /** + * XML definition of an entity where the root node is . + */ + toXml( action ): string; + + /** + * Returns a view of the data in an entity instance + */ + view(): IEntityView; + } + + class EntityReference + { + /** + * Identifies a record. + * @param logicalName The logical name of the entity. + * @param id The id of the record. + * @param name The value of the primary attribute of the entity instance. This property can contain a value or null. This property is not automatically populated unless the EntityReference object has been retrieved from the server. + */ + constructor( logicalName: string, id: string, name?: string ); + + /** + * Gets the logicalName representing the type of referenced entity. + */ + getType(): string; + + /** + * Gets the Id value of the referenced entity. + */ + getId(): string; + + /** + * Gets the primary attribute value of the referenced entity. + */ + getName(): string; + + /** + * Sets the logicalName representing the type of referenced entity. + * @param type The logicalName representing the type of referenced entity. + */ + setType( type: string ): void; + + /** + * Sets the Id value of the entity. + * @param id The Id value of the entity. + */ + setId( id: string ): void; + + /** + * Sets the primary attribute value of the referenced entity. + * @param name The primary attribute value of the referenced entity. + */ + setName( name: string ): void; + + + /// prototype methods + + /** + * Returns a serialized entity reference where the root element is . + */ + toXml(): string; + + /** + * Returns the values of serialized entity reference as XML nodes. + */ + toValueXml(): string; + + /** + * Returns a view of the data in an EntityReference + */ + view(): IEntityReferenceView; + } + + class OrganizationRequest + { } + + class OrganizationResponse + { } + + class Q + { + /** + * Creates a link between records. + * @param entityName The logical name of the entity that is specified in the entityId parameter. + * @param entityId The ID of the record to which the related records are associated. + * @param relationship The name of the relationship to be used to create the link. + * @param relatedEntities A collection of Sdk.EntityReference objects to be associated. + */ + static associate( entityName: string, entityId: string, relationship: string, relatedEntities: Sdk.Collection ): Q.Promise; + /** + * Creates an entity record and returns a string representation of the GUID value that is the Id of the created entity. + * @param entity An entity instance. + */ + static create( entity: Sdk.Entity ): Q.Promise; + + /** + * Deletes an entity record + * @param entityName The LogicalName of the entity to delete. + * @param id An ID of the record to delete. + */ + static del( entityName: string, id: string ): Q.Promise; + + /** + * Removes a link between records. + * @param entityName The logical name of the entity that is specified in the entityId parameter. + * @param entityId The ID of the record to which the related records are disassociated. + * @param relationship The name of the relationship to be used to remove the link. + * @param relatedEntities A collection of Sdk.EntityReference objects to be disassociated. + */ + static disassociate( entityName: string, entityId: string, relationship: string, relatedEntities: Sdk.Collection ): Q.Promise; + + /** + * Executes a SOAP Request using the SOAPAction Execute. + * @param request A request object. + */ + static execute( request: Sdk.OrganizationRequest ): Q.Promise; + + /** + * Retrieves an entity instance. + * @param entityName The logical name of the entity to retrieve. + * @param id The id of the entity to retrieve. + * @param columnSet The columns of the entities to retrieve. + */ + static retrieve( entityName: string, id: string, columnSet: Sdk.ColumnSet ): Q.Promise; + + /** + * Retrieves the results of a query + * @param query Either an Sdk.Query.FetchExpression or Sdk.Query.QueryExpression query + */ + static retrieveMultiple( query: Query.QueryBase ): Q.Promise; + + /** + * Updates an entity instance. + * @param entity An entity instance to update. + */ + static update( entity: Entity ): Q.Promise; + } + + /** + * Contains the data that is needed to convert a query in FetchXML to a QueryExpression. + * @param fetchXml Sets the query to convert. + */ + class FetchXmlToQueryExpressionRequest + { + constructor( fetchXml: string ); + + /** + * Sets the query to convert. + * @param The query to convert. + */ + setFetchXml( value: string ): void; + } + + /** + * Response to FetchXmlToQueryExpressionRequest. + * @param responseXml The response XML to the FetchXmlToQueryExpressionRequest. + */ + class FetchXmlToQueryExpressionResponse + { + constructor( responseXml: string ); + + /** + * Gets the results of the query conversion. + */ + public getQuery(): Query.QueryExpression; + } + + +} + +declare module Sdk.Mdq.ValueEnums +{ + export enum OwnershipType + { + None, + OrganizationOwned, + TeamOwned, + UserOwned, + } + + export enum AttributeTypeCode + { + BigInt, + Boolean, + CalendarRules, + Customer, + DateTime, + Decimal, + Double, + EntityName, + Integer, + Lookup, + ManagedProperty, + Memo, + Money, + Owner, + PartyList, + Picklist, + State, + Status, + String, + Uniqueidentifier, + Virtual, + } + + + export enum AttributeRequiredLevel + { + ApplicationRequired, + None, + Recommended, + SystemRequired, + } + + + export enum DateTimeFormat + { + DateAndTime, + DateOnly, + } + + export enum ImeMode + { + Active, + Auto, + Disabled, + Inactive, + } + + + + export enum IntegerFormat + { + Duration, + Language, + Locale, + None, + TimeZone, + } + + + export enum SecurityTypes + { + Append, + Inheritance, + None, + ParentChild, + Pointer, + } + + export enum StringFormat + { + Email, + PhoneticGuide, + Text, + TextArea, + TickerSymbol, + Url, + VersionNumber, + } +} + +declare module Sdk.Query +{ + class QueryBase + { + /** + * Internal Use Only. + * @param type An Abstract class for different query classes to inherit from. + */ + constructor( type: string ); + + /** + * + */ + getQueryType(): string; + } + + class QueryByAttribute extends QueryBase + { + /** + * Initializes a new instance of the QueryByAttribute class setting the entity name. + * @param entityName The logical name of the entity. + * + */ + constructor( entityName: string ); + + /** + * Gets the columns to include. + */ + getColumnSet(): Sdk.ColumnSet; + + /** + * Sets the columns to include. + * @param columns An Sdk.ColumnSet instance. + */ + setColumnSet( columns: Sdk.ColumnSet ): void; + + /** + * Sets the columns to include. + * @param columns An Array of attribute logical names for the columns to return. + */ + setColumnSet( columns: Array ): void; + + /** + * Sets the columns to include. + * @param columns Pass each attribute logical name as an argument. + */ + setColumnSet( ...columns: string[] ): void; + + /** + * Gets the logical name of the entity. + */ + getEntityName(): string; + + /** + * Sets the logical name of the entity. + * @param name The logical name of the entity + */ + setEntityName( name: string ); + + /** + * Gets An Sdk.Collection of Sdk.AttributeBase attributes. + */ + getAttributeValues(): Sdk.Collection; + + /** + * Gets an Sdk.Collection of Sdk.Query.OrderExpression instances that define the order in which the entity instances are returned from the query. + */ + getOrders(): Sdk.Collection; + + /** + * Sets an Sdk.Collection of Sdk.Query.OrderExpression instances that define the order in which the entity instances are returned from the query. + * @param orders An Sdk.Collection of Sdk.Query.OrderExpression instances that define the order in which the entity instances are returned from the query. + */ + setOrders( orders: Sdk.Collection ); + + /** + * Gets the number of pages and the number of entity instances per page returned from the query. + */ + getPageInfo(): Sdk.Query.PagingInfo; + + /** + * Sets the number of pages and the number of entity instances per page returned from the query. + * @param pageInfo The number of pages and the number of entity instances per page returned from the query. + */ + setPageInfo( pageInfo: Sdk.Query.PagingInfo ); + + /** + * Gets the number of rows to be returned. + */ + getTopCount(): number; + + /** + * Sets the number of rows to be returned. + * @param count The number of rows to be returned. + */ + setTopCount( count: number ); + + + /// prototype methods + + /** + * Adds the attribute with values to include in the query. + * @param attributeValue One of the classes that inherit from Sdk.AttributeBase including the value to use as criteria. + */ + addAttributeValue( attributeValue: Sdk.AttributeBase ): void; + + /** + * Adds a column to the ColumnSet used by the query. + * @param columnName The logical name of an attribute to be returned by the query. + */ + addColumn( columnName: string ): void; + + /** + * Adds an order to apply to the results of the query. + * @param order An order expression. + */ + addOrder( order: Sdk.Query.OrderExpression ): void; + + /** + * Removes an attribute with values to include in the query. + * @param attributeValue One of the classes that inherit from Sdk.AttributeBase including the value to use as criteria. + * @param errorIfNotFound Whether to throw an error when the attribute to remove is not found. The default is false. + */ + removeAttributeValue( attributeValue: Sdk.AttributeBase, errorIfNotFound?: boolean ): void; + + /** + * Removes a column from the ColumnSet used by the query. + * @param columnName The logical name of an attribute to be removed from the ColumnSet. + * @param errorIfNotFound Whether to throw an error when the column to remove is not found. The default is false. + */ + removeColumn( columnName: string, errorIfNotFound?: boolean ): void; + + /** + * Gets the serialized QueryByAttribute. + */ + toXml(): string; + + /** + * Gets the serialized QueryByAttribute values. + */ + toValueXml(): string; + } + + class QueryExpression extends QueryBase + { + /** + * Initializes a new instance of the QueryExpression class setting the entity name. + * @param entityName The name of the entity. + */ + constructor( entityName: string ); + + /** + * Gets the columns to include. + */ + getColumnSet(): Sdk.ColumnSet; + + /** + * Sets the columns to include. + * @param columns An Sdk.ColumnSet instance. + */ + setColumnSet( columns: Sdk.ColumnSet ): void; + + /** + * Sets the columns to include. + * @param columns An Array of attribute logical names for the columns to return. + */ + setColumnSet( columns: Array ): void; + + /** + * Sets the columns to include. + * @param columns Pass each attribute logical name as an argument. + */ + setColumnSet( ...columns: string[] ): void; + + /** + * Gets the complex condition and logical filter expressions that filter the results of the query. + */ + getCriteria: FilterExpression; + + /** + * Sets the complex condition and logical filter expressions that filter the results of the query. + * @param criteria The query condition and filter criteria. + */ + setCriteria( criteria: FilterExpression ): void; + + /** + * Gets whether the results of the query contain duplicate entity instances. + */ + getDistinct(): boolean; + + /** + * Sets whether the results of the query contain duplicate entity instances. + */ + setDistinct( isDistinct: boolean ); + + /** + * Gets the logical name of the entity. + */ + getEntityName(): string; + + /** + * Sets the logical name of the entity. + * @param name The logical name of the entity. + */ + setEntityName( name: string ): void; + + /** + * Gets an Sdk.Collection of Sdk.Query.LinkEntity instances. + */ + getLinkEntities(): LinkEntity; + + /** + * Gets a value that indicates that no shared locks are issued against the data that would prohibit other transactions from modifying the data in the records returned from the query. + */ + getNoLock(): boolean; + + /** + * Sets a value that indicates that no shared locks are issued against the data that would prohibit other transactions from modifying the data in the records returned from the query. + * @param isNoLock True if there are no shared locks are issued against the data that would prohibit other transactions from modifying the data in the records returned from the query; otherwise, false. + */ + setNoLock( isNoLock: boolean ): void; + + /** + * Gets an Sdk.Collection of Sdk.Query.OrderExpression instances that define the order in which the entity instances are returned from the query. + */ + getOrders(): OrderExpression; + + /** + * Gets the number of pages and the number of entity instances per page returned from the query. + */ + getPageInfo(): PagingInfo; + + /** + * Sets the number of pages and the number of entity instances per page returned from the query. + * @param pageInfo The number of pages and the number of entity instances per page returned from the query. + */ + setPageInfo( pageInfo: PagingInfo ): void; + + /** + * Gets the number of rows to be returned. + */ + getTopCount(): number; + + /** + * Sets the number of rows to be returned. + * @param topCount The number of rows to be returned. + */ + setTopCount( topCount: number ): void; + + + /// prototype methods + + /** + * Adds the specified column to the column set. + * @param columnName The logical name of the column to add. + */ + addColumn( columnName: string ): void; + + /** + * Contains a condition expression used to filter the results of the query. + * @param entityName The logical name of the entity in the condition expression. + * @param attributeName The logical name of the attribute in the condition expression. + * @param operator The condition operator. + * @param values The value(s) to compare. Use one of the following classes that inherit from Sdk.Query.ValueBase: + * Sdk.Query.Booleans + * Sdk.Query.BooleanManagedProperties + * Sdk.Query.Dates + * Sdk.Query.Decimals + * Sdk.Query.Doubles + * Sdk.Query.EntityReferences + * Sdk.Query.Guids + * Sdk.Query.Ints + * Sdk.Query.Longs + * Sdk.Query.Money + * Sdk.Query.OptionSets + * Sdk.Query.Strings + */ + addCondition( entityName: string, attributeName: string, conditionOperator: Sdk.Query.ConditionOperator, values: Sdk.Query.ValueBase ): void; + + /** + * Adds the specified link to the query expression setting the entity name to link to, the attribute name to link from and the attribute name to link to. + * @param firstParam An Sdk.Query.LinkEntity instance. + */ + addLink( firstParam: Sdk.Query.LinkEntity ): void; + + /** + * Adds the specified link to the query expression setting the entity name to link to, the attribute name to link from and the attribute name to link to. + * @param firstParam The name of entity to link from. + * @param linkFromAttributeName The name of the attribute to link from. + * @param linkToAttributeName The name of the attribute to link to. + * @param joinOperator The join operator. The default value is Inner + */ + addLink( firstParam: string, linkFromAttributeName: string, linkToAttributeName: string, joinOperator: Sdk.Query.JoinOperator ): void; + + /** + * Adds the specified order expression to the query expression. + * @param attributeName The name of the attribute. + * @param orderType The order, ascending or descending. Ascending is the default if not specified. + */ + addOrder( attributeName: string, orderType: Sdk.Query.OrderType ): void; + + /** + * Gets the serialized QueryExpression. + */ + toXml(): string; + + /** + * Gets the serialized QueryExpression values. + */ + toValueXml(): string; + } + + class OrderExpression + { + } + + class FilterExpression + { + } + + class LinkEntity + { + } + + class PagingInfo + { + /** + * Gets the number of entity instances returned per page. + */ + getCount(): number; + + /** + * Sets the number of entity instances returned per page. + * @param The number of entity instances returned per page + */ + setCount( count: number ): void; + + /** + * Gets the number of pages returned from the query. + */ + getPageNumber(): number; + + /** + * Sets the number of pages returned from the query. + * @param The number of pages returned from the query. + */ + setPageNumber( pages: number ): void; + + /** + * Gets the info used to page large result sets. + */ + getPagingCookie(): string; + + /** + * Sets the info used to page large result sets. + */ + setPagingCookie( cookie: string ): void; + + /** + * Gets whether the total number of records should be returned from the query. + */ + getReturnTotalRecordCount(): boolean; + + /** + * Sets whether the total number of records should be returned from the query. + * @param Specifies whether the TotalRecordCount should be set when the query is executed. + */ + setReturnTotalRecordCount( returnTotalRecordsCount: boolean ): void; + + + /// prototype methods + + /** + * Gets the serialized paging info. + * + toXml():string; + + /** + * Gets the serialized paging info values. + */ + toValueXml(): string; + } + + class Util + { + /** + * Verifies the parameter is a string formatted as a GUID. + * @param value The value to check. + */ + isGuid( value: string ): boolean; + + /** + * Verifies the parameter is a string formatted as a GUID or null. + * @param value The value to check. + */ + isGuidOrNull( value: string ): boolean; + + /** + * Verifies the parameter is a valid enum value. + * @param enumeration The enumeration. + * @param value The value to check. + */ + + /** + * Returns an empty GUID. + */ + getEmptyGuid(): string; + + /** + * Formats a string with the arguments from an array. + * @param string The string containing placeholders for items in the array. + * @param args An array of strings to replace the placeholders. + */ + format( string: string, args: Array ); + + /** + * + */ + getError( resp ): string; + + /** + * Returns the clinent URL. + */ + getClientUrl(): string; + + /** + * Provides a way to override the client Url when a client-side context is not available. + * @param url The client URL to use instead of the default. + */ + setClientUrl( url: string ): void; + + /** + * + */ + getXMLHttpRequest( action, async: boolean ); + + /** + * Creates an entity from XML. + * @param The serialized entity returned from the SOAP service as XML. + */ + createEntityFromNode( node: string ); + } + + class Xml + { + + } + + export enum ConditionOperator + { + Equal, + NotEqual, + GreaterThan, + LessThan, + GreaterEqual, + LessEqual, + Like, + NotLike, + In, + NotIn, + Between, + NotBetween, + Null, + NotNull, + Yesterday, + Today, + Tomorrow, + Last7Days, + Next7Days, + LastWeek, + ThisWeek, + NextWeek, + LastMonth, + ThisMonth, + NextMonth, + On, + OnOrBefore, + OnOrAfter, + LastYear, + ThisYear, + NextYear, + LastXHours, + NextXHours, + LastXDays, + NextXDays, + LastXWeeks, + NextXWeeks, + LastXMonths, + NextXMonths, + LastXYears, + NextXYears, + EqualUserId, + NotEqualUserId, + EqualBusinessId, + NotEqualBusinessId, + Mask, + NotMask, + Contains, + DoesNotContain, + EqualUserLanguage, + NotOn, + OlderThanXMonths, + BeginsWith, + DoesNotBeginWith, + EndsWith, + DoesNotEndWith, + ThisFiscalYear, + ThisFiscalPeriod, + NextFiscalYear, + NextFiscalPeriod, + LastFiscalYear, + LastFiscalPeriod, + LastXFiscalYears, + LastXFiscalPeriods, + NextXFiscalYears, + NextXFiscalPeriods, + InFiscalYear, + InFiscalPeriod, + InFiscalPeriodAndYear, + InOrBeforeFiscalPeriodAndYear, + InOrAfterFiscalPeriodAndYear, + EqualUserOrUserTeams, + EqualUserTeams, + } + + export class JoinOperator + { + constructor(); + } + + export enum OrderType + { + Ascending, + Descending, + } + + export class ValueBase + { } + + /** + * Specifies the Guid values to be compared in the query. + * @param An Array of String values + */ + class Guids extends ValueBase + { + constructor( args: Array ); + } +} + +declare module Sdk +{ + /** + * Request to retrieve metadata and metadata changes. + * @param query The Sdk.Mdq.EntityQueryExpression that defines the query. + * @param clientVersionStamp The Sdk.Mdq.RetrieveMetadataChangesResponse.ServerVersionStamp value from a previous request. When included only the metadata changes since the previous request will be returned. + * @param deletedMetadataFilters An Sdk.Mdq.DeletedMetadataFilters enumeration value. When included the deleted metadata changes will be limited to the types defined by the enumeration. + */ + export class RetrieveMetadataChangesRequest + { + constructor( query: Sdk.Mdq.EntityQueryExpression, clientVersionStamp?: string, deletedMetadataFilters?: Sdk.Mdq.DeletedMetadataFilters ); + getEntityMetadata(): Sdk.Mdq.IEntityMetadata[]; + getServerVersionStamp(): string; + getDeletedMetadata(): Object; + } + + /** + * Response to RetrieveMetadataChangesRequest. + * @param resopnseXml The response XML. + */ + export class RetrieveMetadataChangesResponse + { + constructor( responseXml: string ); + + /*** + * + */ + public getEntityMetadata(): Array; + + /*** + * + */ + public getServerVersionStamp(); + + /*** + * + */ + public getDeletedMetadata(); + } +} + +declare module Sdk.Mdq +{ + /** + * Defines a complex query to retrieve entity metadata. + * @param criteria The filter criteria for the metadata query. + * @param properties The properties to be returned by the query. + * @param attributeQuery A query expression for the entity attribute metadata to return. + * @param relationshipQuery A query expression for the entity relationship metadata to return. + * @param labelQuery A query expression for the labels to return. + */ + export class EntityQueryExpression + { + constructor( + criteria: Sdk.Mdq.MetadataFilterExpression, + properties: Sdk.Mdq.MetadataPropertiesExpression, + attributeQuery?: Sdk.Mdq.AttributeQueryExpression, + relationshipQuery?: Sdk.Mdq.RelationshipQueryExpression, + labelQuery?: Sdk.Mdq.LabelQueryExpression ); + } + + /** + * An enumeration that specifies the type of deleted metadata to retrieve. + */ + export enum DeletedMetadataFilters + { + All, // All deleted metadata + Attribute, // Deleted Attribute metadata + Default, // The value used if not set. Equals Entity + Entity, //Deleted Entity metadata + Label, //Deleted Label metadata + OptionSet, // Deleted OptionSet metadata + Relationship, //Deleted Relationship metadata + } + + /** + * Specifies complex condition and logical filter expressions used for filtering the results of a metadata query. + * @param filterOperator The logical AND/OR filter operator. + */ + export class MetadataFilterExpression + { + constructor( filterOperator: Sdk.Mdq.LogicalOperator ); + + /** + * Adds a condition. This method accepts either the properties to create a new Sdk.Mdq.MetadataConditionExpression or a Sdk.Mdq.MetadataConditionExpression as the first argument. + * @param propertyName The metadata property to evaluate. + * @param conditionOperator The condition operator. + * @param value The metadata value to evaluate. + */ + public addCondition( + propertyName: SearchableEntityMetadataProperties|SearchableAttributeMetadataProperties|SearchableRelationshipMetadataProperties, + conditionOperator: MetadataConditionOperator, + value: Object ); + } + + /** + * Defines a complex query to retrieve attribute metadata for entities retrieved using an Sdk.Mdq.EntityQueryExpression. + * @param criteria The filter criteria for the metadata query. + * @param properties The properties to be returned by the query. + */ + export class AttributeQueryExpression + { + constructor( criteria: MetadataFilterExpression, properties: Sdk.Mdq.MetadataPropertiesExpression ); + } + + /** + * Defines a complex query to retrieve entity relationship metadata for entities retrieved using an EntityQueryExpression. + * @param criteria The filter criteria for the metadata query. + * @param properties The properties to be returned by the query. + */ + export class RelationshipQueryExpression + { + constructor( criteria: MetadataFilterExpression, properties: Sdk.Mdq.MetadataPropertiesExpression ); + } + + /** + * Defines the languages for the labels to be retrieved for metadata items that have labels. + * @param languages An array of LCID number values. + */ + export class LabelQueryExpression + { + constructor( languages: Array ); + } + + /** + * Logical operator. + */ + export enum LogicalOperator + { + And, + Or, + } + + /** + * Specifies the properties for which non-null values are returned from a query. + * @param allProperties Whether to retrieve all the properties of a metadata object. + * @param propertyNames: >An array of strings representing the metadata properties to retrieve. + */ + export class MetadataPropertiesExpression + { + constructor( allProperties: boolean, propertyNames?: Array ); + } + + export enum RelationshipMetadataProperties + { + AssociatedMenuConfiguration, + CascadeConfiguration, + HasChanged, + Entity1AssociatedMenuConfiguration, + Entity1IntersectAttribute, + Entity1LogicalName, + Entity2AssociatedMenuConfiguration, + Entity2IntersectAttribute, + Entity2LogicalName, + IntersectEntityName, + IsCustomizable, + IntroducedVersion, + IsCustomRelationship, + IsManaged, + IsValidForAdvancedFind, + MetadataId, + ReferencedAttribute, + ReferencedEntity, + ReferencingAttribute, + ReferencingEntity, + RelationshipType, + SchemaName, + SecurityTypes, + } + + export enum AttributeMetadataProperties + { + AttributeOf, + AttributeType, + AttributeTypeName, + CalculationOf, + CanBeSecuredForCreate, + CanBeSecuredForRead, + CanBeSecuredForUpdate, + CanModifyAdditionalSettings, + ColumnNumber, + DefaultFormValue, + DefaultValue, + DeprecatedVersion, + Description, + DisplayName, + EntityLogicalName, + Format, + FormatName, + ImeMode, + IntroducedVersion, + IsAuditEnabled, + IsCustomAttribute, + IsCustomizable, + IsManaged, + IsPrimaryId, + IsPrimaryName, + IsRenameable, + IsSecured, + IsValidForAdvancedFind, + IsValidForCreate, + IsValidForRead, + IsValidForUpdate, + LinkedAttributeId, + LogicalName, + MaxLength, + MaxValue, + MetadataId, + MinValue, + OptionSet, + Precision, + PrecisionSource, + RequiredLevel, + SchemaName, + Targets, + YomiOf, + } + + export enum EntityMetadataProperties + { + ActivityTypeMask, + Attributes, + AutoCreateAccessTeams, + AutoRouteToOwnerQueue, + CanBeInManyToMany, + CanBePrimaryEntityInRelationship, + CanBeRelatedEntityInRelationship, + CanCreateAttributes, + CanCreateCharts, + CanCreateForms, + CanCreateViews, + CanModifyAdditionalSettings, + CanTriggerWorkflow, + Description, + DisplayCollectionName, + DisplayName, + IconLargeName, + IconMediumName, + IconSmallName, + IntroducedVersion, + IsActivity, + IsActivityParty, + IsAIRUpdated, + IsAuditEnabled, + IsAvailableOffline, + IsBusinessProcessEnabled, + IsChildEntity, + IsConnectionsEnabled, + IsCustomEntity, + IsCustomizable, + IsDocumentManagementEnabled, + IsDuplicateDetectionEnabled, + IsEnabledForCharts, + IsImportable, + IsIntersect, + IsMailMergeEnabled, + IsManaged, + IsMappable, + IsQuickCreateEnabled, + IsReadingPaneEnabled, + IsRenameable, + IsValidForAdvancedFind, + IsValidForQueue, + IsVisibleInMobile, + IsVisibleInMobileClient, + LogicalName, + ManyToManyRelationships, + ManyToOneRelationships, + MetadataId, + ObjectTypeCode, + OneToManyRelationships, + OwnershipType, + PrimaryIdAttribute, + PrimaryImageAttribute, + PrimaryNameAttribute, + Privileges, + RecurrenceBaseEntityLogicalName, + ReportViewName, + SchemaName, + } + + export enum SearchableEntityMetadataProperties + { + ActivityTypeMask, + AutoCreateAccessTeams, + AutoRouteToOwnerQueue, + CanBeInManyToMany, + CanBePrimaryEntityInRelationship, + CanBeRelatedEntityInRelationship, + CanCreateAttributes, + CanCreateCharts, + CanCreateForms, + CanCreateViews, + CanModifyAdditionalSettings, + CanTriggerWorkflow, + IconLargeName, + IconMediumName, + IconSmallName, + IntroducedVersion, + IsActivity, + IsActivityParty, + IsAIRUpdated, + IsAuditEnabled, + IsAvailableOffline, + IsBusinessProcessEnabled, + IsChildEntity, + IsConnectionsEnabled, + IsCustomEntity, + IsCustomizable, + IsDocumentManagementEnabled, + IsDuplicateDetectionEnabled, + IsEnabledForCharts, + IsImportable, + IsIntersect, + IsMailMergeEnabled, + IsManaged, + IsMappable, + IsQuickCreateEnabled, + IsReadingPaneEnabled, + IsRenameable, + IsValidForAdvancedFind, + IsValidForQueue, + IsVisibleInMobile, + IsVisibleInMobileClient, + LogicalName, + MetadataId, + ObjectTypeCode, + OwnershipType, + PrimaryIdAttribute, + PrimaryImageAttribute, + PrimaryNameAttribute, + RecurrenceBaseEntityLogicalName, + ReportViewName, + SchemaName, + } + + export enum SearchableAttributeMetadataProperties + { + AttributeOf, + AttributeType, + CalculationOf, + CanBeSecuredForCreate, + CanBeSecuredForRead, + CanBeSecuredForUpdate, + CanModifyAdditionalSettings, + ColumnNumber, + DefaultFormValue, + DefaultValue, + DeprecatedVersion, + EntityLogicalName, + Format, + FormatName, + ImeMode, + IntroducedVersion, + IsAuditEnabled, + IsCustomAttribute, + IsCustomizable, + IsManaged, + IsPrimaryId, + IsPrimaryName, + IsRenameable, + IsSecured, + IsValidForAdvancedFind, + IsValidForCreate, + IsValidForRead, + IsValidForUpdate, + LinkedAttributeId, + LogicalName, + MaxLength, + MaxValue, + MetadataId, + MinValue, + Precision, + PrecisionSource, + RequiredLevel, + SchemaName, + YomiOf, + } + + export enum SearchableRelationshipMetadataProperties + { + HasChanged, + Entity1IntersectAttribute, + Entity1LogicalName, + Entity2IntersectAttribute, + Entity2LogicalName, + IntersectEntityName, + IsCustomizable, + IntroducedVersion, + IsCustomRelationship, + IsManaged, + IsValidForAdvancedFind, + MetadataId, + ReferencedAttribute, + ReferencedEntity, + ReferencingAttribute, + ReferencingEntity, + RelationshipType, + SchemaName, + SecurityTypes, + } + + export enum MetadataConditionOperator + { + Equals, + NotEquals, + In, + NotIn, + GreaterThan, + LessThan, + } + + export interface IEntityMetadata + { + ActivityTypeMask; + Attributes: Array; + AutoCreateAccessTeams; + AutoRouteToOwnerQueue: boolean; + CanBeInManyToMany; + CanBePrimaryEntityInRelationship; + CanBeRelatedEntityInRelationship; + CanCreateAttributes; + CanCreateCharts; + CanCreateForms; + CanCreateViews; + CanModifyAdditionalSettings; + CanTriggerWorkflow: boolean; + Description; + DisplayCollectionName; + DisplayName; + IconLargeName; + IconMediumName; + IconSmallName; + IntroducedVersion; + IsActivity: boolean; + IsActivityParty: boolean; + IsAIRUpdated; + IsAuditEnabled; + IsAvailableOffline: boolean; + IsBusinessProcessEnabled; + IsChildEntity: boolean; + IsConnectionsEnabled; + IsCustomEntity: boolean; + IsCustomizable; + IsDocumentManagementEnabled: boolean; + IsDuplicateDetectionEnabled; + IsEnabledForCharts: boolean; + IsImportable: boolean; + IsIntersect: boolean; + IsMailMergeEnabled: boolean; + IsManaged: boolean; + IsMappable: boolean; + IsQuickCreateEnabled: boolean; + IsReadingPaneEnabled: boolean; + IsRenameable: boolean; + IsValidForAdvancedFind: boolean; + IsValidForQueue: boolean; + IsVisibleInMobile: boolean; + IsVisibleInMobileClient: boolean; + LogicalName: string; + ManyToManyRelationships; + ManyToOneRelationships; + MetadataId; + ObjectTypeCode: number; + OneToManyRelationships; + OwnershipType: string; + PrimaryIdAttribute: string; + PrimaryImageAttribute; + PrimaryNameAttribute: string; + Privileges; + RecurrenceBaseEntityLogicalName; + ReportViewName: string; + SchemaName: string; + } + + export interface IAttributeMetadata + { + AttributeOf; + AttributeType; + AttributeTypeName; + CalculationOf; + CanBeSecuredForCreate; + CanBeSecuredForRead; + CanBeSecuredForUpdate; + CanModifyAdditionalSettings; + ColumnNumber; + DefaultFormValue; + DefaultValue; + DeprecatedVersion; + Description; + DisplayName; + EntityLogicalName; + Format; + FormatName; + ImeMode; + IntroducedVersion; + IsAuditEnabled; + IsCustomAttribute; + IsCustomizable; + IsManaged; + IsPrimaryId; + IsPrimaryName; + IsRenameable; + IsSecured; + IsValidForAdvancedFind; + IsValidForCreate; + IsValidForRead; + IsValidForUpdate; + LinkedAttributeId; + LogicalName; + MaxLength; + MaxValue; + MetadataId; + MinValue; + OptionSet; + Precision; + PrecisionSource; + RequiredLevel; + SchemaName; + Targets: string[]; + YomiOf; + } +} From 71e95110ac1d5d0bf814074d66943096edb2128a Mon Sep 17 00:00:00 2001 From: "markus.mauch@gmail.com" Date: Fri, 19 Jun 2015 21:29:16 +0200 Subject: [PATCH 002/103] Added return type to addColumn() --- sdk.soap/sdk.soap.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk.soap/sdk.soap.d.ts b/sdk.soap/sdk.soap.d.ts index b450fd481..2c1aa285f 100644 --- a/sdk.soap/sdk.soap.d.ts +++ b/sdk.soap/sdk.soap.d.ts @@ -67,7 +67,7 @@ declare module Sdk * Adds a column to the collection. * @param column The logical name of the attribute to add. */ - addColumn( column: string ); + addColumn( column: string ): void; /** * Adds a string array of column names. From 7202742943f7d4b2dbf1e2314705c23e33d6a70b Mon Sep 17 00:00:00 2001 From: "markus.mauch@gmail.com" Date: Fri, 19 Jun 2015 21:35:46 +0200 Subject: [PATCH 003/103] Added missing type annotations --- sdk.soap/sdk.soap.d.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sdk.soap/sdk.soap.d.ts b/sdk.soap/sdk.soap.d.ts index 2c1aa285f..a6749acf1 100644 --- a/sdk.soap/sdk.soap.d.ts +++ b/sdk.soap/sdk.soap.d.ts @@ -73,7 +73,7 @@ declare module Sdk * Adds a string array of column names. * @param columns A string array of column names. */ - addColumns( columns: Array ); + addColumns( columns: Array ): void; /** * Sets the AllColumns property. @@ -141,7 +141,7 @@ declare module Sdk * Adds an array of objects to the collection. * @param items An array of items to add to the collection. */ - addRange( items ): void; + addRange( items: T[] ): void; /** * Removes all items from the collection. @@ -158,7 +158,7 @@ declare module Sdk * Applies the action contained within a delegate function. * @param fn Delegate function with parameters for item and index. */ - forEach( fn: ( item: T, index: number ) => any ); + forEach( fn: ( item: T, index: number ) => any ): void; /** * Gets the item in the collection at the specified index. @@ -279,7 +279,7 @@ declare module Sdk * Sets whether the results of the query exceeds the total record count. * @param totalRecordCountLimitExceeded Whether the results of the query exceeds the total record count. */ - setTotalRecordCountLimitExceeded( totalRecordCountLimitExceeded: boolean ); + setTotalRecordCountLimitExceeded( totalRecordCountLimitExceeded: boolean ): void; /** * XML definition of an the child nodes of an entity. @@ -318,7 +318,7 @@ declare module Sdk * Removes an entity reference to the collection. * @param entityReference The entity reference to remove. */ - remove( entityReference: Sdk.EntityReference ); + remove( entityReference: Sdk.EntityReference ): void; /** * Returns a view of the data in an entity reference collection instance. @@ -455,7 +455,7 @@ declare module Sdk /** * Internal Use Only */ - setValidValue( value ); + setValidValue( value: any ): void; /// prototype methods @@ -463,7 +463,7 @@ declare module Sdk /** * XML node for Attribute. */ - toXml( action ): string; + toXml( action: string ): string; } class Boolean extends AttributeBase @@ -750,7 +750,7 @@ declare module Sdk * Sets the collection of attributes for the entity. * @param attributes The collection of attributes for the entity. */ - setAttributes( attributes: Sdk.AttributeCollection ); + setAttributes( attributes: Sdk.AttributeCollection ): void; /** * Gets the state of the entity. @@ -795,7 +795,7 @@ declare module Sdk * Sets the logical name of the entity. * @param type The logical name of the entity. */ - setType( type ): void; + setType( type: string ): void; /** * Gets a collection of related entities. @@ -813,7 +813,7 @@ declare module Sdk * @param attribute The attribute to add * @param isChanged Whether the attribute should be considered changed, the default is true. */ - addAttribute( attribute: Sdk.AttributeBase, isChanged?: boolean ); + addAttribute( attribute: Sdk.AttributeBase, isChanged?: boolean ): void; /** * Adds an entity to the related entities. @@ -831,7 +831,7 @@ declare module Sdk * Sets the value to indicate whether data for the entity has changed. * @param isChanged The value to indicate whether data for the entity has changed. */ - setIsChanged( isChanged: boolean ); + setIsChanged( isChanged: boolean ): void; /** * Gets the value of the specified attribute. @@ -842,7 +842,7 @@ declare module Sdk /** * Generates properties for the entity based on metadata. */ - initializeSubClass( metadata ); + initializeSubClass( metadata ): void; /** * Sets the value of the specified attribute. From 29f5682e04a1539c76dbb96d885987969b8f4479 Mon Sep 17 00:00:00 2001 From: "markus.mauch@gmail.com" Date: Fri, 19 Jun 2015 21:47:02 +0200 Subject: [PATCH 004/103] Added more type definitions --- sdk.soap/sdk.soap.d.ts | 152 ++++++++++++++++++++--------------------- 1 file changed, 76 insertions(+), 76 deletions(-) diff --git a/sdk.soap/sdk.soap.d.ts b/sdk.soap/sdk.soap.d.ts index a6749acf1..df9887802 100644 --- a/sdk.soap/sdk.soap.d.ts +++ b/sdk.soap/sdk.soap.d.ts @@ -79,7 +79,7 @@ declare module Sdk * Sets the AllColumns property. * @params allColumns A boolean value. */ - setAllColumns( allColumns: boolean ); + setAllColumns( allColumns: boolean ): void; /** * Whether all columns will be returned. @@ -309,7 +309,7 @@ declare module Sdk * Sets the collection of entity references. * @param entityReferences The entity references */ - setEntityReferences( entityReferences: Sdk.Collection ); + setEntityReferences( entityReferences: Sdk.Collection ): void; /// prototype methods @@ -842,7 +842,7 @@ declare module Sdk /** * Generates properties for the entity based on metadata. */ - initializeSubClass( metadata ): void; + initializeSubClass( metadata: any ): void; /** * Sets the value of the specified attribute. @@ -2092,38 +2092,38 @@ declare module Sdk.Mdq export interface IEntityMetadata { - ActivityTypeMask; + ActivityTypeMask: any; Attributes: Array; - AutoCreateAccessTeams; + AutoCreateAccessTeams: any; AutoRouteToOwnerQueue: boolean; - CanBeInManyToMany; - CanBePrimaryEntityInRelationship; - CanBeRelatedEntityInRelationship; - CanCreateAttributes; - CanCreateCharts; - CanCreateForms; - CanCreateViews; - CanModifyAdditionalSettings; + CanBeInManyToMany: any; + CanBePrimaryEntityInRelationship: any; + CanBeRelatedEntityInRelationship: any; + CanCreateAttributes: any; + CanCreateCharts: any; + CanCreateForms: any; + CanCreateViews: any; + CanModifyAdditionalSettings: any; CanTriggerWorkflow: boolean; - Description; - DisplayCollectionName; - DisplayName; - IconLargeName; - IconMediumName; - IconSmallName; - IntroducedVersion; + Description: any; + DisplayCollectionName: any; + DisplayName: any; + IconLargeName: any; + IconMediumName: any; + IconSmallName: any; + IntroducedVersion: any; IsActivity: boolean; IsActivityParty: boolean; - IsAIRUpdated; - IsAuditEnabled; + IsAIRUpdated: any; + IsAuditEnabled: any; IsAvailableOffline: boolean; - IsBusinessProcessEnabled; + IsBusinessProcessEnabled: any; IsChildEntity: boolean; - IsConnectionsEnabled; + IsConnectionsEnabled: any; IsCustomEntity: boolean; - IsCustomizable; + IsCustomizable: any; IsDocumentManagementEnabled: boolean; - IsDuplicateDetectionEnabled; + IsDuplicateDetectionEnabled: any; IsEnabledForCharts: boolean; IsImportable: boolean; IsIntersect: boolean; @@ -2138,66 +2138,66 @@ declare module Sdk.Mdq IsVisibleInMobile: boolean; IsVisibleInMobileClient: boolean; LogicalName: string; - ManyToManyRelationships; - ManyToOneRelationships; - MetadataId; + ManyToManyRelationships: any; + ManyToOneRelationships: any; + MetadataId: any; ObjectTypeCode: number; - OneToManyRelationships; + OneToManyRelationships: any; OwnershipType: string; PrimaryIdAttribute: string; - PrimaryImageAttribute; + PrimaryImageAttribute: any; PrimaryNameAttribute: string; - Privileges; - RecurrenceBaseEntityLogicalName; + Privileges: any; + RecurrenceBaseEntityLogicalName: any; ReportViewName: string; SchemaName: string; } export interface IAttributeMetadata { - AttributeOf; - AttributeType; - AttributeTypeName; - CalculationOf; - CanBeSecuredForCreate; - CanBeSecuredForRead; - CanBeSecuredForUpdate; - CanModifyAdditionalSettings; - ColumnNumber; - DefaultFormValue; - DefaultValue; - DeprecatedVersion; - Description; - DisplayName; - EntityLogicalName; - Format; - FormatName; - ImeMode; - IntroducedVersion; - IsAuditEnabled; - IsCustomAttribute; - IsCustomizable; - IsManaged; - IsPrimaryId; - IsPrimaryName; - IsRenameable; - IsSecured; - IsValidForAdvancedFind; - IsValidForCreate; - IsValidForRead; - IsValidForUpdate; - LinkedAttributeId; - LogicalName; - MaxLength; - MaxValue; - MetadataId; - MinValue; - OptionSet; - Precision; - PrecisionSource; - RequiredLevel; - SchemaName; + AttributeOf: any; + AttributeType: any; + AttributeTypeName: any; + CalculationOf: any; + CanBeSecuredForCreate: any; + CanBeSecuredForRead: any; + CanBeSecuredForUpdate: any; + CanModifyAdditionalSettings: any; + ColumnNumber: any; + DefaultFormValue: any; + DefaultValue: any; + DeprecatedVersion: any; + Description: any; + DisplayName: any; + EntityLogicalName: any; + Format: any; + FormatName: any; + ImeMode: any; + IntroducedVersion: any; + IsAuditEnabled: any; + IsCustomAttribute: any; + IsCustomizable: any; + IsManaged: any; + IsPrimaryId: any; + IsPrimaryName: any; + IsRenameable: any; + IsSecured: any; + IsValidForAdvancedFind: any; + IsValidForCreate: any; + IsValidForRead: any; + IsValidForUpdate: any; + LinkedAttributeId: any; + LogicalName: any; + MaxLength: any; + MaxValue: any; + MetadataId: any; + MinValue: any; + OptionSet: any; + Precision: any; + PrecisionSource: any; + RequiredLevel: any; + SchemaName: any; Targets: string[]; - YomiOf; + YomiOf: any; } } From bbe7323503a9af4e3b0b0c813f68882a64310e50 Mon Sep 17 00:00:00 2001 From: Dominik Brack Date: Fri, 6 Nov 2015 08:22:44 +0100 Subject: [PATCH 005/103] Updated typings for version 0.1.19. --- .../react-input-calendar.d.ts | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/react-input-calendar/react-input-calendar.d.ts b/react-input-calendar/react-input-calendar.d.ts index d8c518b83..bd2da99e8 100644 --- a/react-input-calendar/react-input-calendar.d.ts +++ b/react-input-calendar/react-input-calendar.d.ts @@ -32,13 +32,17 @@ declare module reactInputCalendar { */ computableFormat?: string; /** - * Set an function that will be triggered whenever there is a change in the selected date. It will return the date in the props.computableFormat format. + * Set a function that will be triggered whenever there is a change in the selected date. It will return the date in the props.computableFormat format. */ - onChange?:(selectedDate: string)=>any; + onChange?: (computableDate: string) => void; + /** + * Set a function that will be triggered the when input field is blurred. It will return the event and the date in the props.computableFormat format. + */ + onBlur?: (event: __React.SyntheticEvent, computableDate: string) => void; /** * Define state when date picker would close once the user has clicked on a date. */ - closeOnSelect?:boolean; + closeOnSelect?: boolean; /** * Setting this value to true makes the calendar widget open when the iput field is focused. */ @@ -46,14 +50,18 @@ declare module reactInputCalendar { /** * Value to show in the input text box if no date is set. */ - placeholder?:string + placeholder?: string; + /** + * Id that should be applied to the input field. Useful when using it with a label element. + */ + inputFieldId?: string; } interface ReactInputCalendarState { } - export class ReactInputCalendar extends __React.Component{ - render(): __React.DOMElement + export class ReactInputCalendar extends __React.Component { + render(): __React.DOMElement; } } declare var ReactInputCalendar: typeof reactInputCalendar.ReactInputCalendar declare module "react-input-calendar" { - export = ReactInputCalendar + export = ReactInputCalendar; } From 6ea1138ac20038c862465c2bb5066e06b1fe5773 Mon Sep 17 00:00:00 2001 From: use-strict Date: Mon, 15 Feb 2016 16:41:48 +0200 Subject: [PATCH 006/103] jqueryui - optional options for serialize method sortable serialize method supports an optional "options" parameter (defaults to {}). --- jqueryui/jqueryui.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jqueryui/jqueryui.d.ts b/jqueryui/jqueryui.d.ts index a5df2c834..08058cca1 100644 --- a/jqueryui/jqueryui.d.ts +++ b/jqueryui/jqueryui.d.ts @@ -1704,7 +1704,7 @@ interface JQuery { sortable(methodName: string): JQuery; sortable(options: JQueryUI.SortableOptions): JQuery; sortable(optionLiteral: string, optionName: string): any; - sortable(methodName: 'serialize', options: { key?: string; attribute?: string; expression?: RegExp }): string; + sortable(methodName: 'serialize', options?: { key?: string; attribute?: string; expression?: RegExp }): string; sortable(optionLiteral: string, options: JQueryUI.SortableOptions): any; sortable(optionLiteral: string, optionName: string, optionValue: any): JQuery; From e1699c41087960df7678f413312213fb1f980307 Mon Sep 17 00:00:00 2001 From: Andrey Kurdyumov Date: Mon, 22 Feb 2016 01:05:17 +0600 Subject: [PATCH 007/103] Create typed version of reject That is necessary for smooth migration to TypeScript target ES6. --- es6-promise/es6-promise.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/es6-promise/es6-promise.d.ts b/es6-promise/es6-promise.d.ts index c0a77edd8..d5fdc2dbf 100644 --- a/es6-promise/es6-promise.d.ts +++ b/es6-promise/es6-promise.d.ts @@ -51,6 +51,7 @@ declare module Promise { * Make a promise that rejects to obj. For consistency and debugging (eg stack traces), obj should be an instanceof Error */ function reject(error: any): Promise; + function reject(error: T): Promise; /** * Make a promise that fulfills when every item in the array fulfills, and rejects if (and when) any item rejects. From 98f53ca08ec228cba941370b2ebdbb39445261c8 Mon Sep 17 00:00:00 2001 From: Sean Kelley Date: Thu, 25 Feb 2016 14:36:21 -0800 Subject: [PATCH 008/103] redux-logger no longer exports under default. --- redux-logger/redux-logger.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redux-logger/redux-logger.d.ts b/redux-logger/redux-logger.d.ts index b0459e536..bb1346b1f 100644 --- a/redux-logger/redux-logger.d.ts +++ b/redux-logger/redux-logger.d.ts @@ -18,5 +18,5 @@ declare module 'redux-logger' { stateTransformer?: (state: any) => any; } - export default function createLogger(options?: ReduxLoggerOptions): Redux.Middleware; + export function createLogger(options?: ReduxLoggerOptions): Redux.Middleware; } From 81e4e35ea7a366ff6b82e021e0be853659515e58 Mon Sep 17 00:00:00 2001 From: Sean Kelley Date: Thu, 25 Feb 2016 14:44:52 -0800 Subject: [PATCH 009/103] Update typings for redux-logger to 2.6.0. --- redux-logger/redux-logger.d.ts | 39 ++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/redux-logger/redux-logger.d.ts b/redux-logger/redux-logger.d.ts index bb1346b1f..e04064778 100644 --- a/redux-logger/redux-logger.d.ts +++ b/redux-logger/redux-logger.d.ts @@ -1,4 +1,4 @@ -// Type definitions for redux-logger v2.0.0 +// Type definitions for redux-logger v2.6.0 // Project: https://github.com/fcomb/redux-logger // Definitions by: Alexander Rusakov // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -7,16 +7,33 @@ declare module 'redux-logger' { - interface ReduxLoggerOptions { - actionTransformer?: (action: any) => any; - collapsed?: boolean; - duration?: boolean; - level?: string; - logger?: any; - predicate?: (getState: Function, action: any) => boolean; - timestamp?: boolean; - stateTransformer?: (state: any) => any; + type LoggerPredicate = (getState: () => any, action: any) => boolean; + + interface ColorsObject { + title?: (action: any) => string; + prevState?: (prevState: any) => string; + action?: (action: any) => string; + nextState?: (nextState: any) => string; + error?: (error: any, prevState: any) => string; } - export function createLogger(options?: ReduxLoggerOptions): Redux.Middleware; + interface ReduxLoggerOptions { + level?: string; + duration?: boolean; + timestamp?: boolean; + colors?: ColorsObject; + logger?: any; + logErrors?: boolean; + collapsed?: boolean | LoggerPredicate; + predicate?: LoggerPredicate; + stateTransformer?: (state: any) => any; + actionTransformer?: (action: any) => any; + errorTransformer?: (error: any) => any; + } + + // Trickery to get TypeScript to accept that our anonymous, non-default export is a function. + // see https://github.com/Microsoft/TypeScript/issues/3612 for more + namespace createLogger {} + function createLogger(options?: ReduxLoggerOptions): Redux.Middleware; + export = createLogger; } From d6094b87df963609ce46a6dd0cee2999654072d6 Mon Sep 17 00:00:00 2001 From: Sean Kelley Date: Thu, 25 Feb 2016 15:00:44 -0800 Subject: [PATCH 010/103] Update tests for redux-logger 2.6.0. --- redux-logger/redux-logger-tests.ts | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/redux-logger/redux-logger-tests.ts b/redux-logger/redux-logger-tests.ts index 02b1b47a7..530ddb01a 100644 --- a/redux-logger/redux-logger-tests.ts +++ b/redux-logger/redux-logger-tests.ts @@ -1,19 +1,29 @@ /// -import createLogger from 'redux-logger'; +import * as createLogger from 'redux-logger'; import { applyMiddleware, createStore } from 'redux' let logger = createLogger(); let loggerWithOpts = createLogger({ - actionTransformer: actn => actn, - collapsed: true, - duration: true, level: 'error', - logger: console, - predicate: (getState, action) => true, + duration: true, timestamp: true, - stateTransformer: state => state + colors: { + title: (action) => '#000000', + prevState: (prevState) => '#000000', + action: (action) => '#000000', + nextState: (nextState) => '#000000', + error: (error, prevState) => '#000000' + }, + logger: console, + logErrors: true, + collapsed: true, + predicate: (getState, action) => true, + stateTransformer: state => state, + actionTransformer: actn => actn, + errorTransformer: err => err + }); let createStoreWithMiddleware = applyMiddleware( From d89fabadf4f7c556fecefa01d8c6a6b63be136a0 Mon Sep 17 00:00:00 2001 From: Nathan Brown Date: Thu, 25 Feb 2016 16:08:20 -0700 Subject: [PATCH 011/103] Update history to v2.0.0 and add tests. --- react-router/history-tests.ts | 132 ++++++++++++++++++++++++++++++++++ react-router/history.d.ts | 71 ++++++++++++++---- 2 files changed, 188 insertions(+), 15 deletions(-) create mode 100644 react-router/history-tests.ts diff --git a/react-router/history-tests.ts b/react-router/history-tests.ts new file mode 100644 index 000000000..92b3794e1 --- /dev/null +++ b/react-router/history-tests.ts @@ -0,0 +1,132 @@ +/// + +import { createHistory, createLocation, useBeforeUnload, useQueries, useBasename } from 'history' +import { getUserConfirmation } from 'history/lib/DOMUtils' + +interface Promise { + then(onfulfilled?: (value: T) => TResult): Promise; +} + +let doSomethingAsync: () => Promise; +let input = { value: "" }; + +{ + let history = createHistory() + + // Listen for changes to the current location. The + // listener is called once immediately. + let unlisten = history.listen(function(location) { + console.log(location.pathname) + }) + + // When you're finished, stop the listener. + unlisten() + + // Push a new entry onto the history stack. + history.push('/home') + + // Replace the current entry on the history stack. + history.replace('/profile') + + // Push a new entry with state onto the history stack. + history.push({ + pathname: '/about', + search: '?the=search', + state: { some: 'state' } + }); + + // Change just the search on an existing location. + //history.push({ ...location, search: '?the=other+search' }) + + // Go back to the previous history entry. The following + // two lines are synonymous. + history.go(-1) + history.goBack() + + let href = history.createHref('/the/path') +} + +{ + let history = createHistory() + + // Pushing a path string. + history.push('/the/path') + + // Omitting location state when pushing a location descriptor. + history.push({ pathname: '/the/path', search: '?the=search' }) + + // Extending an existing location object. + //history.push({ ...location, search: '?other=search' }) + + let location = createLocation('/a/path?a=query', { the: 'state' }) + + location = history.createLocation('/a/path?a=query', { the: 'state' }) +} + +{ + let history = createHistory() + history.listenBefore(function(location) { + if (input.value !== '') + return 'Are you sure you want to leave this page?' + }) + + history.listenBefore(function(location, callback) { + doSomethingAsync().then(callback) + }) +} + +{ + let history = createHistory({ + getUserConfirmation(message, callback) { + callback(window.confirm(message)) // The default behavior + } + }) +} + +{ + let history = useBeforeUnload(createHistory)() + + history.listenBeforeUnload(function() { + return 'Are you sure you want to leave this page?' + }) +} + +{ + let history = useQueries(createHistory)() + + history.listen(function(location) { + console.log(location.query) + }) +} + +{ + let history = useQueries(createHistory)({ + parseQueryString: function(queryString) { + // TODO: return a parsed version of queryString + return {}; + }, + stringifyQuery: function(query) { + // TODO: return a query string created from query + return ""; + } + }) + + history.createPath({ pathname: '/the/path', query: { the: 'query' } }) + history.push({ pathname: '/the/path', query: { the: 'query' } }) +} + +{ + // Run our app under the /base URL. + let history = useBasename(createHistory)({ + basename: '/base' + }) + + // At the /base/hello/world URL: + history.listen(function(location) { + console.log(location.pathname) // /hello/world + console.log(location.basename) // /base + }) + + history.createPath('/the/path') // /base/the/path + history.push('/the/path') // push /base/the/path +} \ No newline at end of file diff --git a/react-router/history.d.ts b/react-router/history.d.ts index 1b5c6dfad..e22dbb757 100644 --- a/react-router/history.d.ts +++ b/react-router/history.d.ts @@ -1,6 +1,6 @@ -// Type definitions for history v1.13.1 +// Type definitions for history v2.0.0 // Project: https://github.com/rackt/history -// Definitions by: Sergey Buturlakin +// Definitions by: Sergey Buturlakin , Nathan Brown // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -17,21 +17,25 @@ declare namespace HistoryModule { type CreateHistoryEnhancer = (createHistory: CreateHistory) => CreateHistory interface History { - listenBefore(hook: TransitionHook): Function - listen(listener: LocationListener): Function + listenBefore(hook: TransitionHook): () => void + listen(listener: LocationListener): () => void transitionTo(location: Location): void - pushState(state: LocationState, path: Path): void - replaceState(state: LocationState, path: Path): void - push(path: Path): void - replace(path: Path): void + push(path: LocationDescriptor): void + replace(path: LocationDescriptor): void go(n: number): void goBack(): void goForward(): void createKey(): LocationKey - createPath(path: Path): Path - createHref(path: Path): Href - createLocation(path?: Path, state?: LocationState, action?: Action, key?: LocationKey): Location + createPath(path: LocationDescriptor): Path + createHref(path: LocationDescriptor): Href + createLocation(path?: LocationDescriptor, action?: Action, key?: LocationKey): Location + /** @deprecated use a location descriptor instead */ + createLocation(path?: Path, state?: LocationState, action?: Action, key?: LocationKey): Location + /** @deprecated use location.key to save state instead */ + pushState(state: LocationState, path: Path): void + /** @deprecated use location.key to save state instead */ + replaceState(state: LocationState, path: Path): void /** @deprecated use location.key to save state instead */ setState(state: LocationState): void /** @deprecated use listenBefore instead */ @@ -40,19 +44,42 @@ declare namespace HistoryModule { unregisterTransitionHook(hook: TransitionHook): void } - type HistoryOptions = Object + type HistoryOptions = { + getCurrentLocation?: () => Location + finishTransition?: (nextLocation: Location) => boolean + saveState?: (key: LocationKey, state: LocationState) => void + go?: (n: number) => void + getUserConfirmation?: (message: string, callback: (result: boolean) => void) => void + keyLength?: number + queryKey?: string | boolean + stringifyQuery?: (obj: any) => string + parseQueryString?: (str: string) => any + basename?: string + entries?: string | [any] + current?: number + } type Href = string type Location = { pathname: Pathname - search: QueryString + search: Search query: Query state: LocationState action: Action key: LocationKey + basename?: string } + type LocationDescriptorObject = { + pathname?: Pathname + search?: Search + query?: Query + state?: LocationState + } + + type LocationDescriptor = LocationDescriptorObject | Path + type LocationKey = string type LocationListener = (location: Location) => void @@ -67,11 +94,13 @@ declare namespace HistoryModule { type QueryString = string - type TransitionHook = (location: Location, callback: Function) => any + type Search = string + + type TransitionHook = (location: Location, callback: (result: any) => void) => any interface HistoryBeforeUnload { - listenBeforeUnload(hook: BeforeUnloadHook): Function + listenBeforeUnload(hook: BeforeUnloadHook): () => void } interface HistoryQueries { @@ -168,6 +197,18 @@ declare module "history/lib/actions" { } +declare module "history/lib/DOMUtils" { + export function addEventListener(node: EventTarget, event: string, listener: EventListenerOrEventListenerObject): void; + export function removeEventListener(node: EventTarget, event: string, listener: EventListenerOrEventListenerObject): void; + export function getHashPath(): string; + export function replaceHashPath(path: string): void; + export function getWindowPath(): string; + export function go(n: number): void; + export function getUserConfirmation(message: string, callback: (result: boolean) => void): void; + export function supportsHistory(): boolean; + export function supportsGoWithoutReloadUsingHash(): boolean; +} + declare module "history" { From 156aee9c2e092b6e06609a05a900d57aa8da4a55 Mon Sep 17 00:00:00 2001 From: Nathan Brown Date: Thu, 25 Feb 2016 16:10:52 -0700 Subject: [PATCH 012/103] react-router has a new context type in v2.0.0, so added that. Updated tests. --- react-router/react-router-tests.tsx | 14 ++++++++++++++ react-router/react-router.d.ts | 8 ++++++-- react/react.d.ts | 2 +- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/react-router/react-router-tests.tsx b/react-router/react-router-tests.tsx index ab32451a0..a079d49fb 100644 --- a/react-router/react-router-tests.tsx +++ b/react-router/react-router-tests.tsx @@ -12,6 +12,16 @@ import { browserHistory, hashHistory, Router, Route, IndexRoute, Link } from "re class Master extends React.Component, {}> { + navigate() { + var router = this.context["router"] as ReactRouter.RouterOnContext; + router.push("/users"); + router.push({ + pathname: "/users/12", + query: { modal: true }, + state: { fromDashboard: true } + }); + } + render() { return

Master

@@ -22,6 +32,10 @@ class Master extends React.Component, {}> { } +(Master as React.ComponentClass<{}>).contextTypes = { + router: React.PropTypes.object, +}; + class Dashboard extends React.Component<{}, {}> { diff --git a/react-router/react-router.d.ts b/react-router/react-router.d.ts index abed5eb65..76fd7209d 100644 --- a/react-router/react-router.d.ts +++ b/react-router/react-router.d.ts @@ -1,6 +1,6 @@ -// Type definitions for react-router v2.0.0-rc5 +// Type definitions for react-router v2.0.0 // Project: https://github.com/rackt/react-router -// Definitions by: Sergey Buturlakin , Yuichi Murata , Václav Ostrožlík +// Definitions by: Sergey Buturlakin , Yuichi Murata , Václav Ostrožlík , Nathan Brown // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -195,6 +195,10 @@ declare namespace ReactRouter { interface IndexRedirectElement extends React.ReactElement {} const IndexRedirect: IndexRedirect + interface RouterOnContext extends H.History { + setRouteLeaveHook(route: PlainRoute, hook?: RouteHook): () => void; + isActive(pathOrLoc: H.LocationDescriptor, indexOnly?: boolean): boolean; + } /* mixins */ diff --git a/react/react.d.ts b/react/react.d.ts index 5753731b1..f60fba4b1 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -124,7 +124,7 @@ declare namespace __React { render(): JSX.Element; props: P; state: S; - context: {}; + context: { [key: string]: any }; refs: { [key: string]: ReactInstance }; From 28f7cc66d448b384ca84a788f2b2e94c4b2db1ee Mon Sep 17 00:00:00 2001 From: tkqubo Date: Wed, 10 Feb 2016 00:31:04 +0900 Subject: [PATCH 013/103] rename file names to fix the version --- .../{react-redux-tests.tsx => react-redux-2.1.2-tests.tsx} | 0 react-redux/{react-redux.d.ts => react-redux-2.1.2.d.ts} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename react-redux/{react-redux-tests.tsx => react-redux-2.1.2-tests.tsx} (100%) rename react-redux/{react-redux.d.ts => react-redux-2.1.2.d.ts} (100%) diff --git a/react-redux/react-redux-tests.tsx b/react-redux/react-redux-2.1.2-tests.tsx similarity index 100% rename from react-redux/react-redux-tests.tsx rename to react-redux/react-redux-2.1.2-tests.tsx diff --git a/react-redux/react-redux.d.ts b/react-redux/react-redux-2.1.2.d.ts similarity index 100% rename from react-redux/react-redux.d.ts rename to react-redux/react-redux-2.1.2.d.ts From a8eb385780d8b6617a82703c3251c949faec1249 Mon Sep 17 00:00:00 2001 From: tkqubo Date: Wed, 10 Feb 2016 00:33:30 +0900 Subject: [PATCH 014/103] fix: definition file reference --- react-redux/react-redux-2.1.2-tests.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react-redux/react-redux-2.1.2-tests.tsx b/react-redux/react-redux-2.1.2-tests.tsx index 3254e6ec7..cb791a3d8 100644 --- a/react-redux/react-redux-2.1.2-tests.tsx +++ b/react-redux/react-redux-2.1.2-tests.tsx @@ -1,4 +1,4 @@ -/// +/// /// /// /// From 4169370da25a366a4e44090db92916bc0106b443 Mon Sep 17 00:00:00 2001 From: tkqubo Date: Wed, 10 Feb 2016 00:35:35 +0900 Subject: [PATCH 015/103] feat: add react-redux 4.4.0 --- react-redux/react-redux-tests.tsx | 293 ++++++++++++++++++++++++++++++ react-redux/react-redux.d.ts | 68 +++++++ 2 files changed, 361 insertions(+) create mode 100644 react-redux/react-redux-tests.tsx create mode 100644 react-redux/react-redux.d.ts diff --git a/react-redux/react-redux-tests.tsx b/react-redux/react-redux-tests.tsx new file mode 100644 index 000000000..9ba06ac21 --- /dev/null +++ b/react-redux/react-redux-tests.tsx @@ -0,0 +1,293 @@ +/// +/// +/// +/// +/// +/// +/// + +import { Component, ReactElement } from 'react'; +import * as React from 'react'; +import * as ReactDOM from 'react-dom'; +import { Router, RouterState } from 'react-router'; +import { Store, Dispatch, bindActionCreators } from 'redux'; +import { connect, Provider } from 'react-redux'; +import objectAssign = require('object-assign'); + +// +// Quick Start +// https://github.com/rackt/react-redux/blob/master/docs/quick-start.md#quick-start +// + +interface CounterState { + counter: number; +} +declare var increment: Function; + +class Counter extends Component { + render() { + return ( + + ); + } +} + +function mapStateToProps(state: CounterState) { + return { + value: state.counter + }; +} + +// Which action creators does it want to receive by props? +function mapDispatchToProps(dispatch: Dispatch) { + return { + onIncrement: () => dispatch(increment()) + }; +} + +connect( + mapStateToProps, + mapDispatchToProps +)(Counter); + + +@connect(mapStateToProps) +class CounterContainer extends Component { + +} + +class App extends Component { + render(): JSX.Element { + // ... + return null; + } +} + +const targetEl = document.getElementById('root'); + +ReactDOM.render(( + + {() => } + +), targetEl); + +// +// API +// https://github.com/rackt/react-redux/blob/master/docs/api.md +// +declare var store: Store; +declare var routerState: RouterState; +declare var history: HistoryModule.History; +class MyRootComponent extends Component { + +} +class TodoApp extends Component { + +} +interface TodoState { + todos: string[]|string; +} +interface TodoProps { + userId: number; +} +interface DispatchProps { + addTodo(userId: number, text: string): void; +} +declare var actionCreators: () => { + action: Function; +} +declare var addTodo: () => { type: string; }; +declare var todoActionCreators: { [type: string]: (...args: any[]) => any; }; +declare var counterActionCreators: { [type: string]: (...args: any[]) => any; }; + +ReactDOM.render( + + {() => } + , + document.body +); + +//TODO: for React Router 0.13 +////TODO: error TS2339: Property 'run' does not exist on type 'typeof "react-router"'. +////TODO: error TS2339: Property 'HistoryLocation' does not exist on type 'typeof "react-router"'. +//declare var routes: any; +//Router.run(routes, Router.HistoryLocation, (Handler, routerState) => { // note "routerState" here +// ReactDOM.render( +// +// {/* +// //TODO: error TS2339: Property 'routerState' does not exist on type 'RouteProp'. +// {() => } // note "routerState" here: important to pass it down +// */} +// , +// document.getElementById('root') +// ); +//}); + + +//TODO: for React Router 1.0 +ReactDOM.render( + + {() => ...} + , + targetEl +); + +// Inject just dispatch and don't listen to store + +connect()(TodoApp); + +// Inject dispatch and every field in the global state + +connect((state: TodoState) => state)(TodoApp); + +// Inject dispatch and todos + +function mapStateToProps2(state: TodoState) { + return { todos: state.todos }; +} + +export default connect(mapStateToProps2)(TodoApp); + +// Inject todos and all action creators (addTodo, completeTodo, ...) + +//function mapStateToProps(state) { +// return { todos: state.todos }; +//} + +connect(mapStateToProps2, actionCreators)(TodoApp); + +// Inject todos and all action creators (addTodo, completeTodo, ...) as actions + +//function mapStateToProps(state) { +// return { todos: state.todos }; +//} + +function mapDispatchToProps2(dispatch: Dispatch) { + return { actions: bindActionCreators(actionCreators, dispatch) }; +} + +connect(mapStateToProps2, mapDispatchToProps2)(TodoApp); + +// Inject todos and a specific action creator (addTodo) + +//function mapStateToProps(state) { +// return { todos: state.todos }; +//} + +function mapDispatchToProps3(dispatch: Dispatch) { + return bindActionCreators({ addTodo }, dispatch); +} + +connect(mapStateToProps2, mapDispatchToProps3)(TodoApp); + +// Inject todos, todoActionCreators as todoActions, and counterActionCreators as counterActions + +//function mapStateToProps(state) { +// return { todos: state.todos }; +//} + +function mapDispatchToProps4(dispatch: Dispatch) { + return { + todoActions: bindActionCreators(todoActionCreators, dispatch), + counterActions: bindActionCreators(counterActionCreators, dispatch) + }; +} + +connect(mapStateToProps2, mapDispatchToProps4)(TodoApp); + +// Inject todos, and todoActionCreators and counterActionCreators together as actions + +//function mapStateToProps(state) { +// return { todos: state.todos }; +//} + +function mapDispatchToProps5(dispatch: Dispatch) { + return { + actions: bindActionCreators(objectAssign({}, todoActionCreators, counterActionCreators), dispatch) + }; +} + +connect(mapStateToProps2, mapDispatchToProps5)(TodoApp); + +// Inject todos, and all todoActionCreators and counterActionCreators directly as props + +//function mapStateToProps(state) { +// return { todos: state.todos }; +//} + +function mapDispatchToProps6(dispatch: Dispatch) { + return bindActionCreators(objectAssign({}, todoActionCreators, counterActionCreators), dispatch); +} + +connect(mapStateToProps2, mapDispatchToProps6)(TodoApp); + +// Inject todos of a specific user depending on props + +function mapStateToProps3(state: TodoState, ownProps: TodoProps): TodoState { + return { todos: state.todos[ownProps.userId] }; +} + +connect(mapStateToProps3)(TodoApp); + +// Inject todos of a specific user depending on props, and inject props.userId into the action + +//function mapStateToProps(state) { +// return { todos: state.todos }; +//} + +function mergeProps(stateProps: TodoState, dispatchProps: DispatchProps, ownProps: TodoProps): DispatchProps & TodoState { + return objectAssign({}, ownProps, { + todos: stateProps.todos[ownProps.userId], + addTodo: (text: string) => dispatchProps.addTodo(ownProps.userId, text) + }); +} + +connect(mapStateToProps2, actionCreators, mergeProps)(TodoApp); + + + + + +interface TestProp { + property1: number; + someOtherProperty?: string; +} +interface TestState { + isLoaded: boolean; + state1: number; +} +class TestComponent extends Component { } +const WrappedTestComponent = connect()(TestComponent); + +// return value of the connect()(TestComponent) is of the type TestComponent +let ATestComponent: typeof TestComponent = null; +ATestComponent = TestComponent; +ATestComponent = WrappedTestComponent; + +let anElement: ReactElement; +; +; +; + +class NonComponent {} +// this doesn't compile +//connect()(NonComponent); + +// connect()(SomeClass) has the same constructor as SomeClass itself +class SomeClass extends Component { + constructor(public foo: string) { super() } + public bar: number; +} +let bar: number = new (connect()(SomeClass))("foo").bar; + + +// stateless functions +interface HelloMessageProps { name: string; } +function HelloMessage(props: HelloMessageProps) { + return
Hello {props.name}
; +} +let ConnectedHelloMessage = connect()(HelloMessage); +ReactDOM.render(, document.getElementById('content')); +ReactDOM.render(, document.getElementById('content')); diff --git a/react-redux/react-redux.d.ts b/react-redux/react-redux.d.ts new file mode 100644 index 000000000..9c46fd10c --- /dev/null +++ b/react-redux/react-redux.d.ts @@ -0,0 +1,68 @@ +// Type definitions for react-redux 4.4.0 +// Project: https://github.com/rackt/react-redux +// Definitions by: Qubo +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module "react-redux" { + import { ComponentClass, Component, StatelessComponent } from 'react'; + import { Store, Dispatch, ActionCreator } from 'redux'; + + export interface ComponentConstructDecorator

{ + |StatelessComponent

)>(component: TComponentConstruct): TComponentConstruct + } + + /** + * Connects a React component to a Redux store. + * @param mapStateToProps + * @param mapDispatchToProps + * @param mergeProps + * @param options + */ + export function connect

(mapStateToProps?: MapStateToProps, + mapDispatchToProps?: MapDispatchToPropsFunction|MapDispatchToPropsObject, + mergeProps?: MergeProps, + options?: Options): ComponentConstructDecorator

; + + interface MapStateToProps { + (state: any, ownProps?: any): any; + } + + interface MapDispatchToPropsFunction { + (dispatch: Dispatch, ownProps?: any): any; + } + + interface MapDispatchToPropsObject { + [name: string]: ActionCreator; + } + + interface MergeProps { + (stateProps: any, dispatchProps: any, ownProps: any): any; + } + + interface Options { + /** + * If true, implements shouldComponentUpdate and shallowly compares the result of mergeProps, + * preventing unnecessary updates, assuming that the component is a “pure” component + * and does not rely on any input or state other than its props and the selected Redux store’s state. + * Defaults to true. + * @default true + */ + pure: boolean; + } + + export interface Property { + /** + * The single Redux store in your application. + */ + store?: Store; + children?: Function; + } + + /** + * Makes the Redux store available to the connect() calls in the component hierarchy below. + */ + export class Provider extends Component { } +} From 25617b505566804c9139933d75d6a0ee94ed3527 Mon Sep 17 00:00:00 2001 From: Douglas Date: Fri, 26 Feb 2016 10:41:24 -0600 Subject: [PATCH 016/103] Update JQuery UI Layout --- jquery.ui.layout/jquery.ui.layout.d.ts | 499 +++++++++++++++++++++++-- 1 file changed, 472 insertions(+), 27 deletions(-) diff --git a/jquery.ui.layout/jquery.ui.layout.d.ts b/jquery.ui.layout/jquery.ui.layout.d.ts index dae9dc067..846e3644f 100644 --- a/jquery.ui.layout/jquery.ui.layout.d.ts +++ b/jquery.ui.layout/jquery.ui.layout.d.ts @@ -2,39 +2,484 @@ // Project: http://layout.jquery-dev.net/ // Definitions by: Steve Fenton // Definitions: https://github.com/borisyankov/DefinitelyTyped +// Definitions updated by: Douglas Armstrong /// /// -interface JQueryLayoutOptions { - north: any; - east: any; - south: any; - west: any; +declare module JQueryUILayout { + + interface PaneOptions { + applyDefaultStyles?: boolean; + scrollToBookmarkOnLoad?: boolean; + showOverflowOnHover?: boolean; + closable?: boolean; + resizable?: boolean; + slidable?: boolean; + paneSelector?: string; + contentSelector?: string; + contentIgnoreSelector?: string; + paneClass?: string; + resizerClass?: string; + togglerClass?: string; + buttonClass?: string; + size?: string | number; + minSize?: number; + maxSize?: number; + spacing_open?: number; + spacing_closed?: number; + resizerTip?: string; + resizerCursor?: string; + resizerDragOpacity?: number; + maskIframesOnResize?: boolean | string; + sliderTip?: string; + sliderCursor?: string; + slideTrigger_open?: string; + slideTrigger_close?: string; + togglerTip_open?: string; + togglerTip_closed?: string; + togglerLength_open?: number | string; + togglerLength_closed?: number | string; + hideTogglerOnSlide?: boolean; + togglerAlign_open?: string | number; + togglerAlign_closed?: string | number; + togglerContent_open?: string; + togglerContent_closed?: string; + enableCursorHotkey?: boolean; + customHotkeyModifier?: string; + customHotkey?: string | number; + fxName?: string; + fxSpeed?: string | number; + fxSettings?: JQueryAnimationOptions; + initClosed?: boolean; + initHidden?: boolean; + onshow_start?: string | { (name:string, pane:JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + onshow_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + onshow?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + onhide_start?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + onhide_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + onhide?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + onopen_start?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + onopen_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + onopen?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + onclose_start?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + onclose_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + onclose?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + onresize_start?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + onresize_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + onresize?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + } + + interface Options extends PaneOptions { + defaults?: PaneOptions; + north?: PaneOptions; + east?: PaneOptions; + south?: PaneOptions; + west?: PaneOptions; + center?: PaneOptions; + + defaults__applyDefaultStyles?: boolean; + defaults__scrollToBookmarkOnLoad?: boolean; + defaults__showOverflowOnHover?: boolean; + defaults__closable?: boolean; + defaults__resizable?: boolean; + defaults__slidable?: boolean; + defaults__paneSelector?: string; + defaults__contentSelector?: string; + defaults__contentIgnoreSelector?: string; + defaults__paneClass?: string; + defaults__resizerClass?: string; + defaults__togglerClass?: string; + defaults__buttonClass?: string; + defaults__size?: string | number; + defaults__minSize?: number; + defaults__maxSize?: number; + defaults__spacing_open?: number; + defaults__spacing_closed?: number; + defaults__resizerTip?: string; + defaults__resizerCursor?: string; + defaults__resizerDragOpacity?: number; + defaults__maskIframesOnResize?: boolean | string; + defaults__sliderTip?: string; + defaults__sliderCursor?: string; + defaults__slideTrigger_open?: string; + defaults__slideTrigger_close?: string; + defaults__togglerTip_open?: string; + defaults__togglerTip_closed?: string; + defaults__togglerLength_open?: number | string; + defaults__togglerLength_closed?: number | string; + defaults__hideTogglerOnSlide?: boolean; + defaults__togglerAlign_open?: string | number; + defaults__togglerAlign_closed?: string | number; + defaults__togglerContent_open?: string; + defaults__togglerContent_closed?: string; + defaults__enableCursorHotkey?: boolean; + defaults__customHotkeyModifier?: string; + defaults__customHotkey?: string | number; + defaults__fxName?: string; + defaults__fxSpeed?: string | number; + defaults__fxSettings?: JQueryAnimationOptions; + defaults__initClosed?: boolean; + defaults__initHidden?: boolean; + defaults__onshow_start?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + defaults__onshow_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + defaults__onshow?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + defaults__onhide_start?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + defaults__onhide_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + defaults__onhide?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + defaults__onopen_start?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + defaults__onopen_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + defaults__onopen?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + defaults__onclose_start?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + defaults__onclose_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + defaults__onclose?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + defaults__onresize_start?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + defaults__onresize_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + defaults__onresize?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + + north__applyDefaultStyles?: boolean; + north__scrollToBookmarkOnLoad?: boolean; + north__showOverflowOnHover?: boolean; + north__closable?: boolean; + north__resizable?: boolean; + north__slidable?: boolean; + north__paneSelector?: string; + north__contentSelector?: string; + north__contentIgnoreSelector?: string; + north__paneClass?: string; + north__resizerClass?: string; + north__togglerClass?: string; + north__buttonClass?: string; + north__size?: string | number; + north__minSize?: number; + north__maxSize?: number; + north__spacing_open?: number; + north__spacing_closed?: number; + north__resizerTip?: string; + north__resizerCursor?: string; + north__resizerDragOpacity?: number; + north__maskIframesOnResize?: boolean | string; + north__sliderTip?: string; + north__sliderCursor?: string; + north__slideTrigger_open?: string; + north__slideTrigger_close?: string; + north__togglerTip_open?: string; + north__togglerTip_closed?: string; + north__togglerLength_open?: number | string; + north__togglerLength_closed?: number | string; + north__hideTogglerOnSlide?: boolean; + north__togglerAlign_open?: string | number; + north__togglerAlign_closed?: string | number; + north__togglerContent_open?: string; + north__togglerContent_closed?: string; + north__enableCursorHotkey?: boolean; + north__customHotkeyModifier?: string; + north__customHotkey?: string | number; + north__fxName?: string; + north__fxSpeed?: string | number; + north__fxSettings?: JQueryAnimationOptions; + north__initClosed?: boolean; + north__initHidden?: boolean; + north__onshow_start?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + north__onshow_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + north__onshow?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + north__onhide_start?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + north__onhide_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + north__onhide?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + north__onopen_start?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + north__onopen_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + north__onopen?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + north__onclose_start?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + north__onclose_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + north__onclose?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + north__onresize_start?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + north__onresize_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + north__onresize?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + + east__applyDefaultStyles?: boolean; + east__scrollToBookmarkOnLoad?: boolean; + east__showOverflowOnHover?: boolean; + east__closable?: boolean; + east__resizable?: boolean; + east__slidable?: boolean; + east__paneSelector?: string; + east__contentSelector?: string; + east__contentIgnoreSelector?: string; + east__paneClass?: string; + east__resizerClass?: string; + east__togglerClass?: string; + east__buttonClass?: string; + east__size?: string | number; + east__minSize?: number; + east__maxSize?: number; + east__spacing_open?: number; + east__spacing_closed?: number; + east__resizerTip?: string; + east__resizerCursor?: string; + east__resizerDragOpacity?: number; + east__maskIframesOnResize?: boolean | string; + east__sliderTip?: string; + east__sliderCursor?: string; + east__slideTrigger_open?: string; + east__slideTrigger_close?: string; + east__togglerTip_open?: string; + east__togglerTip_closed?: string; + east__togglerLength_open?: number | string; + east__togglerLength_closed?: number | string; + east__hideTogglerOnSlide?: boolean; + east__togglerAlign_open?: string | number; + east__togglerAlign_closed?: string | number; + east__togglerContent_open?: string; + east__togglerContent_closed?: string; + east__enableCursorHotkey?: boolean; + east__customHotkeyModifier?: string; + east__customHotkey?: string | number; + east__fxName?: string; + east__fxSpeed?: string | number; + east__fxSettings?: JQueryAnimationOptions; + east__initClosed?: boolean; + east__initHidden?: boolean; + east__onshow_start?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + east__onshow_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + east__onshow?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + east__onhide_start?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + east__onhide_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + east__onhide?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + east__onopen_start?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + east__onopen_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + east__onopen?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + east__onclose_start?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + east__onclose_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + east__onclose?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + east__onresize_start?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + east__onresize_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + east__onresize?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + + south__applyDefaultStyles?: boolean; + south__scrollToBookmarkOnLoad?: boolean; + south__showOverflowOnHover?: boolean; + south__closable?: boolean; + south__resizable?: boolean; + south__slidable?: boolean; + south__paneSelector?: string; + south__contentSelector?: string; + south__contentIgnoreSelector?: string; + south__paneClass?: string; + south__resizerClass?: string; + south__togglerClass?: string; + south__buttonClass?: string; + south__size?: string | number; + south__minSize?: number; + south__maxSize?: number; + south__spacing_open?: number; + south__spacing_closed?: number; + south__resizerTip?: string; + south__resizerCursor?: string; + south__resizerDragOpacity?: number; + south__maskIframesOnResize?: boolean | string; + south__sliderTip?: string; + south__sliderCursor?: string; + south__slideTrigger_open?: string; + south__slideTrigger_close?: string; + south__togglerTip_open?: string; + south__togglerTip_closed?: string; + south__togglerLength_open?: number | string; + south__togglerLength_closed?: number | string; + south__hideTogglerOnSlide?: boolean; + south__togglerAlign_open?: string | number; + south__togglerAlign_closed?: string | number; + south__togglerContent_open?: string; + south__togglerContent_closed?: string; + south__enableCursorHotkey?: boolean; + south__customHotkeyModifier?: string; + south__customHotkey?: string | number; + south__fxName?: string; + south__fxSpeed?: string | number; + south__fxSettings?: JQueryAnimationOptions; + south__initClosed?: boolean; + south__initHidden?: boolean; + south__onshow_start?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + south__onshow_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + south__onshow?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + south__onhide_start?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + south__onhide_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + south__onhide?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + south__onopen_start?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + south__onopen_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + south__onopen?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + south__onclose_start?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + south__onclose_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + south__onclose?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + south__onresize_start?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + south__onresize_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + south__onresize?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + + west__applyDefaultStyles?: boolean; + west__scrollToBookmarkOnLoad?: boolean; + west__showOverflowOnHover?: boolean; + west__closable?: boolean; + west__resizable?: boolean; + west__slidable?: boolean; + west__paneSelector?: string; + west__contentSelector?: string; + west__contentIgnoreSelector?: string; + west__paneClass?: string; + west__resizerClass?: string; + west__togglerClass?: string; + west__buttonClass?: string; + west__size?: string | number; + west__minSize?: number; + west__maxSize?: number; + west__spacing_open?: number; + west__spacing_closed?: number; + west__resizerTip?: string; + west__resizerCursor?: string; + west__resizerDragOpacity?: number; + west__maskIframesOnResize?: boolean | string; + west__sliderTip?: string; + west__sliderCursor?: string; + west__slideTrigger_open?: string; + west__slideTrigger_close?: string; + west__togglerTip_open?: string; + west__togglerTip_closed?: string; + west__togglerLength_open?: number | string; + west__togglerLength_closed?: number | string; + west__hideTogglerOnSlide?: boolean; + west__togglerAlign_open?: string | number; + west__togglerAlign_closed?: string | number; + west__togglerContent_open?: string; + west__togglerContent_closed?: string; + west__enableCursorHotkey?: boolean; + west__customHotkeyModifier?: string; + west__customHotkey?: string | number; + west__fxName?: string; + west__fxSpeed?: string | number; + west__fxSettings?: JQueryAnimationOptions; + west__initClosed?: boolean; + west__initHidden?: boolean; + west__onshow_start?: string | { (name:string, pane:JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + west__onshow_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + west__onshow?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + west__onhide_start?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + west__onhide_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + west__onhide?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + west__onopen_start?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + west__onopen_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + west__onopen?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + west__onclose_start?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + west__onclose_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + west__onclose?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + west__onresize_start?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + west__onresize_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + west__onresize?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + + center__applyDefaultStyles?: boolean; + center__scrollToBookmarkOnLoad?: boolean; + center__showOverflowOnHover?: boolean; + center__closable?: boolean; + center__resizable?: boolean; + center__slidable?: boolean; + center__paneSelector?: string; + center__contentSelector?: string; + center__contentIgnoreSelector?: string; + center__paneClass?: string; + center__resizerClass?: string; + center__togglerClass?: string; + center__buttonClass?: string; + center__size?: string | number; + center__minSize?: number; + center__maxSize?: number; + center__spacing_open?: number; + center__spacing_closed?: number; + center__resizerTip?: string; + center__resizerCursor?: string; + center__resizerDragOpacity?: number; + center__maskIframesOnResize?: boolean | string; + center__sliderTip?: string; + center__sliderCursor?: string; + center__slideTrigger_open?: string; + center__slideTrigger_close?: string; + center__togglerTip_open?: string; + center__togglerTip_closed?: string; + center__togglerLength_open?: number | string; + center__togglerLength_closed?: number | string; + center__hideTogglerOnSlide?: boolean; + center__togglerAlign_open?: string | number; + center__togglerAlign_closed?: string | number; + center__togglerContent_open?: string; + center__togglerContent_closed?: string; + center__enableCursorHotkey?: boolean; + center__customHotkeyModifier?: string; + center__customHotkey?: string | number; + center__fxName?: string; + center__fxSpeed?: string | number; + center__fxSettings?: JQueryAnimationOptions; + center__initClosed?: boolean; + center__initHidden?: boolean; + center__onshow_start?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + center__onshow_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + center__onshow?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + center__onhide_start?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + center__onhide_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + center__onhide?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + center__onopen_start?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + center__onopen_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + center__onopen?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + center__onclose_start?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + center__onclose_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + center__onclose?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + center__onresize_start?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): (boolean | void) }; + center__onresize_end?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + center__onresize?: string | { (name: string, pane: JQuery, state: PaneState, options: PaneOptions, layout_name: string): void }; + } + + + interface PaneState { + isClosed: boolean; + isSliding: boolean; + isResizing: boolean; + isHidden: boolean; + noRoom: boolean; + size: number; + minSize: number; + maxSize: number; + } + + + interface Layout { + panes: { + north: JQuery | boolean; + east: JQuery | boolean; + south: JQuery | boolean; + west: JQuery | boolean; + }; + options: Options; + state: { + north: PaneState; + east: PaneState; + south: PaneState; + west: PaneState; + } + + toggle(pane: string): JQuery; + open(pane: string): JQuery; + close(pane: string): JQuery; + show(pane: string, openPane?: boolean): JQuery; + hide(pane: string): JQuery; + sizePane(pane: string, sizeInPixels: number): JQuery; + resizeContent(pane: string): JQuery; + resizeAll(): JQuery; + + addToggleBtn(selector: string, pane: string): JQuery; + addCloseBtn(selector: string, pane: string): JQuery; + addOpenBtn(selector: string, pane: string): JQuery; + addPinBtn(selector: string, pane: string): JQuery; + allowOverflow(elemOrPane: HTMLElement | string): JQuery; + resetOverflow(elemOrPane: HTMLElement | string): JQuery; + } } -interface JQueryLayout { - panes: any; - options: JQueryLayoutOptions; - state: any; - - toggle(pane: any): any; - open(pane: any): any; - close(pane: any): any; - show(pane: any, openPane?: boolean): any; - hide(pane: any): any; - sizePane(pane: any, sizeInPixels: number): any; - resizeContent(pane: any): any; - resizeAll(): any; - - addToggleBtn(selector: string, pane: any): any; - addCloseBtn(selector: string, pane: any): any; - addOpenBtn(selector: string, pane: any): any; - addPinBtn(selector: string, pane: any): any; - allowOverflow(elemOrPane: any): any; - resetOverflow(elemOrPane: any): any; -} interface JQuery { - layout(options?: JQueryLayoutOptions): JQueryLayout; + layout(options?: JQueryUILayout.Options): JQueryUILayout.Layout; } From a0aac300ebf740324732d5ddae7d815aac0b7ab7 Mon Sep 17 00:00:00 2001 From: Sean Kelley Date: Fri, 26 Feb 2016 10:51:56 -0800 Subject: [PATCH 017/103] Add complex level options. --- redux-logger/redux-logger.d.ts | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/redux-logger/redux-logger.d.ts b/redux-logger/redux-logger.d.ts index e04064778..8d02c535e 100644 --- a/redux-logger/redux-logger.d.ts +++ b/redux-logger/redux-logger.d.ts @@ -9,16 +9,27 @@ declare module 'redux-logger' { type LoggerPredicate = (getState: () => any, action: any) => boolean; + type StateToString = (state: any) => string; + type ActionToString = (action: any) => string; + type ErrorToString = (error: any, prevState: any) => string; + interface ColorsObject { - title?: (action: any) => string; - prevState?: (prevState: any) => string; - action?: (action: any) => string; - nextState?: (nextState: any) => string; - error?: (error: any, prevState: any) => string; + title?: boolean | ActionToString; + prevState?: boolean | StateToString; + action?: boolean | ActionToString; + nextState?: boolean | StateToString; + error?: boolean | ErrorToString; + } + + interface LevelObject { + prevState?: string | boolean | StateToString; + action?: string | boolean | ActionToString; + nextState?: string | boolean | StateToString; + error?: string | boolean | ErrorToString; } interface ReduxLoggerOptions { - level?: string; + level?: string | ActionToString | LevelObject; duration?: boolean; timestamp?: boolean; colors?: ColorsObject; From 647734d25203feb6f4bd94cf7919e887c347d6b2 Mon Sep 17 00:00:00 2001 From: Nathan Brown Date: Fri, 26 Feb 2016 11:44:03 -0700 Subject: [PATCH 018/103] Undo changes to react.d.ts. Update test to use static contextTypes and retype context. --- react-router/react-router-tests.tsx | 15 ++++++++++----- react/react.d.ts | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/react-router/react-router-tests.tsx b/react-router/react-router-tests.tsx index a079d49fb..703ce4a9f 100644 --- a/react-router/react-router-tests.tsx +++ b/react-router/react-router-tests.tsx @@ -10,10 +10,19 @@ import * as ReactDOM from "react-dom" import { browserHistory, hashHistory, Router, Route, IndexRoute, Link } from "react-router" +interface MasterContext { + router: ReactRouter.RouterOnContext; +} + class Master extends React.Component, {}> { + static contextTypes: React.ValidationMap = { + router: React.PropTypes.object + }; + context: MasterContext; + navigate() { - var router = this.context["router"] as ReactRouter.RouterOnContext; + var router = this.context.router; router.push("/users"); router.push({ pathname: "/users/12", @@ -32,10 +41,6 @@ class Master extends React.Component, {}> { } -(Master as React.ComponentClass<{}>).contextTypes = { - router: React.PropTypes.object, -}; - class Dashboard extends React.Component<{}, {}> { diff --git a/react/react.d.ts b/react/react.d.ts index f60fba4b1..5753731b1 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -124,7 +124,7 @@ declare namespace __React { render(): JSX.Element; props: P; state: S; - context: { [key: string]: any }; + context: {}; refs: { [key: string]: ReactInstance }; From 64807c079564afd6c95bae6b6372e5db838b7f64 Mon Sep 17 00:00:00 2001 From: Sean Kelley Date: Fri, 26 Feb 2016 11:02:39 -0800 Subject: [PATCH 019/103] Finer-grained tests for for redux-logger options. --- redux-logger/redux-logger-tests.ts | 91 +++++++++++++++++++++++++----- 1 file changed, 77 insertions(+), 14 deletions(-) diff --git a/redux-logger/redux-logger-tests.ts b/redux-logger/redux-logger-tests.ts index 530ddb01a..d93aa7e7d 100644 --- a/redux-logger/redux-logger-tests.ts +++ b/redux-logger/redux-logger-tests.ts @@ -5,27 +5,90 @@ import { applyMiddleware, createStore } from 'redux' let logger = createLogger(); -let loggerWithOpts = createLogger({ - level: 'error', +let loggerSimpleOpts = createLogger({ duration: true, timestamp: true, - colors: { - title: (action) => '#000000', - prevState: (prevState) => '#000000', - action: (action) => '#000000', - nextState: (nextState) => '#000000', - error: (error, prevState) => '#000000' - }, logger: console, logErrors: true, - collapsed: true, predicate: (getState, action) => true, - stateTransformer: state => state, - actionTransformer: actn => actn, - errorTransformer: err => err + stateTransformer: (state) => state, + actionTransformer: (action) => action, + errorTransformer: (error) => error +}); +let loggerCollapsedBool = createLogger({ + collapsed: true +}); + +let loggerCollapsedPredicate = createLogger({ + collapsed: (getAction, action) => true +}); + +let loggerColorsBoolean = createLogger({ + colors: { + title: false, + prevState: false, + action: false, + nextState: false, + error: false + } +}); + +let loggerColorsFunction = createLogger({ + colors: { + title: (action) => '#000', + prevState: (state) => '#000', + action: (action) => '#000', + nextState: (state) => '#000', + error: (error, prevState) => '#000' + } +}); + +let loggerLevelString = createLogger({ + level: 'log' +}); + +let loggerLevelFunction = createLogger({ + level: (action) => 'log' +}); + +let loggerLevelObjectFunction = createLogger({ + level: { + prevState: (state) => 'log', + action: (action) => 'log', + nextState: (state) => 'log', + error: (error, prevState) => 'log' + } +}); + +let loggerLevelObjectBoolean = createLogger({ + level: { + prevState: false, + action: false, + nextState: false, + error: false + } +}); + +let loggerLevelObjectString = createLogger({ + level: { + prevState: 'log', + action: 'log', + nextState: 'log', + error: 'log' + } }); let createStoreWithMiddleware = applyMiddleware( - logger, loggerWithOpts + logger, + loggerSimpleOpts, + loggerCollapsedBool, + loggerCollapsedPredicate, + loggerColorsBoolean, + loggerColorsFunction, + loggerLevelString, + loggerLevelFunction, + loggerLevelObjectFunction, + loggerLevelObjectBoolean, + loggerLevelObjectString )(createStore); From 98b3edc27b70b5676065693b0fac2e618a085b78 Mon Sep 17 00:00:00 2001 From: Amy Slagle Date: Fri, 26 Feb 2016 15:13:46 -0500 Subject: [PATCH 020/103] react-bootstrap: Added FormControls.Static. --- react-bootstrap/react-bootstrap-tests.tsx | 10 +++++++++- react-bootstrap/react-bootstrap.d.ts | 11 ++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/react-bootstrap/react-bootstrap-tests.tsx b/react-bootstrap/react-bootstrap-tests.tsx index 2d578a13e..64e899790 100644 --- a/react-bootstrap/react-bootstrap-tests.tsx +++ b/react-bootstrap/react-bootstrap-tests.tsx @@ -7,7 +7,7 @@ // -------------------------------------------------------------------------------- import * as React from 'react'; import { Component, CSSProperties } from 'react'; -import { Button, ButtonToolbar, Modal, Well, ButtonGroup, DropdownButton, MenuItem, Panel, ListGroup, ListGroupItem, Accordion, Tooltip, OverlayTrigger, Popover, ProgressBar, Nav, NavItem, Navbar, NavDropdown, Tabs, Tab, Pager, PageItem, Pagination, Alert, Carousel, CarouselItem, Grid, Row, Col, Thumbnail, Label, Badge, Jumbotron, PageHeader, Glyphicon, Table, Input, ButtonInput } from 'react-bootstrap'; +import { Button, ButtonToolbar, Modal, Well, ButtonGroup, DropdownButton, MenuItem, Panel, ListGroup, ListGroupItem, Accordion, Tooltip, OverlayTrigger, Popover, ProgressBar, Nav, NavItem, Navbar, NavDropdown, Tabs, Tab, Pager, PageItem, Pagination, Alert, Carousel, CarouselItem, Grid, Row, Col, Thumbnail, Label, Badge, Jumbotron, PageHeader, Glyphicon, Table, Input, ButtonInput, FormControls } from 'react-bootstrap'; export class ReactBootstrapTest extends Component { @@ -851,6 +851,14 @@ export class ReactBootstrapTest extends Component {

+
+
+ + + Bob + +
+
diff --git a/react-bootstrap/react-bootstrap.d.ts b/react-bootstrap/react-bootstrap.d.ts index af1cc7338..328513cfd 100644 --- a/react-bootstrap/react-bootstrap.d.ts +++ b/react-bootstrap/react-bootstrap.d.ts @@ -913,7 +913,16 @@ declare module "react-bootstrap" { var ButtonInput: ButtonInputClass; - // TODO: FormControls.Static + // + // ---------------------------------------- + + interface StaticProps extends React.Props { } + interface Static extends React.ReactElement { } + interface StaticClass extends React.ComponentClass { } + interface FormControlsClass { + Static: StaticClass; + } + var FormControls: FormControlsClass; // From 6a3cee4272ba394009713975184f56fe7bb80f82 Mon Sep 17 00:00:00 2001 From: Vincent Siao Date: Fri, 26 Feb 2016 12:50:00 -0800 Subject: [PATCH 021/103] [react-bootstrap] Fix types Found some issues with the current type definitions: - extends `React.Props` with incorrect type `T` (`T` should be component instance type, not component class type) - extends `React.ComponentClass` even if the component is created with `React.createClass` (should extend `ClassiComponentClass`). --- react-bootstrap/react-bootstrap.d.ts | 443 +++++++++++---------------- 1 file changed, 174 insertions(+), 269 deletions(-) diff --git a/react-bootstrap/react-bootstrap.d.ts b/react-bootstrap/react-bootstrap.d.ts index af1cc7338..1c829205c 100644 --- a/react-bootstrap/react-bootstrap.d.ts +++ b/react-bootstrap/react-bootstrap.d.ts @@ -1,6 +1,6 @@ // Type definitions for react-bootstrap // Project: https://github.com/react-bootstrap/react-bootstrap -// Definitions by: Walker Burgin +// Definitions by: Walker Burgin , Vincent Siao // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -12,7 +12,7 @@ declare module "react-bootstrap" { //