Files
DefinitelyTyped/avoscloud-sdk/index.d.ts
Mohamed Hegazy 80060c94ef Merge 10/04 (#11739)
* Add ERROR_STATE flag

* added prop options and func timeFormatter

added property `options`, which can be found in [the code](15fc4b62f5/smoothie.js (L270)).
Even though it's not mentioned in the docs, it useful to be able to access these options after chart is initialized when you want to change appearance in real tme.

added function `timeFormatter`, which is mentioned in [right here, in the definitions](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/smoothie/smoothie.d.ts#L127) and can be found in [the code](15fc4b62f5/smoothie.js (L795))

* Fix type errors

* Added typings for css-modules-require-hook

* Remove spaces

* Added semver, added explicit ignore callback, unified array definition and removed one time interface

* Overwriting method signature

* Correct parameter type

* Add MobilePhoneLocale

* Add isMobilePhone tests

* Type definitions for bit-array

* Add emit for cluster

* To use the definition inline

* [logat.d.ts] Type definition for node module 'logat' (#11485)

* Create logat.d.ts

* Create logat-tests.ts

* Update logat-tests.ts

* Update logat-tests.ts

* Update logat.d.ts

* updated logat test

* updated type definiton

* [dateformat.d.ts] Add definitions for dateformat

* Remove the ES6 module hack

* Yayson definitions (#11484)

* Add yayson Store typings

* Add yayson Store tests

* Improve yayson coverage

* Specify version in yayson definition

* Remove yayson generics and tidy

* Changed namespace from angularTouchspin to angular.touchspin (#11414)

* [perfect-scrollbar.d.ts] Add definitions for perfect-scrollbar (#11486)

* Added types for klaw (#11492)

* Added types for klaw

* addressed pr comments and `tsfmt -r klaw/*.ts`

* add typings for onselected and onunselected methods, refs #11493 (#11496)

* Improve through2 declarations (#11499)

* [through2] Fix typos

* [through2] Change return types to stream.Transform

`through2` creates `stream.Transform`-flavored streams, so switching the return types to `stream.Transform` gives us richer typing information than using `NodeJS.ReadWriteStream`, which is missing methods (e.g. `stream.Transform#push`) and the ability to use object mode.

* [through2] Add through2.ctor method

* [through2] Update header and docs

* Add module declaration to crossfilter so that it can be explicitly imported (#11521)

* Add typings for murmurhash3js

* fix module import to be ES6 compliant

* newline at EOF

* [rethinkdb] Adds missing promise methods to Cursor and Connection

* [rethinkdb] Applied TypeScript formatting to the file

* [rethinkdb] Adds types to Cursor methods

* webpack - HotModuleReplacementPlugin has opts arg

* [openlayers] forEachFeatureAtPixel can return a value

See doc http://openlayers.org/en/latest/apidoc/ol.Map.html#forEachFeatureAtPixel

* Update react.d.ts

Added myself as an author so I get notifications of PRs / updates from GitHub.

* vue: fixed definition for activate() in ComponentOption

* Fix error that came using typescript 2

This error come when try compile with typescript 2
kue.d.ts(13,3): error TS2440: Import declaration conflicts with local declaration of 'redis'

* path can be string or a hash of options

As per http://restify.com/#client-api it states:

> Note that all further documentation refers to the "short-hand"
> form of methods like get/put/del which take a string path. You
> can also pass in an object to any of those methods with extra
> params (notably headers):

So the path can be either a string or a hash of options.

* Add CognitoIdentity into aws-sdk

* Font advanced config options added (for v2.0.6+)

* Add missing slider parameters

* Add backspaceToRemoveMessage prop

* fixup! path can be string or a hash of options

* add request.body (#11395)

* add request.body

* Update koa-bodyparser.d.ts

According to the documentation of `koa-bodyparser`:
```javascript
 // the parsed body will store in this.request.body
 // if nothing was parsed, body will be an empty object {}
 ctx.body = ctx.request.body;
```

Therefore the `body` property will exit in the `request` object.
Changing the `body` property from optional to required can also fix the conflict problem in Koa's declaration file:
```ts
 class Koa extend Request, Response {}
```

* Implement tilebelt definition (#11495)

* Add import test (#11476)

* [validator] Add new stuff which document not mentioned (#11498)

* Add new stuff which document not mentioned

* Add related test

* http.ServerRequest => http.IncomingMessage (#11500)

* [node] Add events for dgram (#11501)

* Add events for dgram

* Add tests for dgram

* Correct dgram.RemoteInfo interface

* Correct emit

* Correct emit

* [node] Add events for tls.Server and tls.TLSSocket (#11502)

* Add events for tls.Server

* Add tests for tls.Server

* Add tests for TLSSocket

* Add events for TLSSocket

* [react-router] Update getComponents signatures (#11319)

Update `getComponent(s)` all over the place. See #9530 for more info.

* Updated jquery.dataTables for 1.10.7. (#11408)

* Updated jquery.dataTables for 1.10.7.

Version release notes: https://cdn.datatables.net/1.10.7/

* Added any()
* Added i18n()

Note: selector-modifier support currently exists with interface ObjectSelectorModifier.

* Added strong variable typing in jquery.dataTables-tests.ts

* For parameter 'def', replaced 'Object' data type with 'any' per TypeScript declaration file guidance.

* [HAPI] Add `IStrictSessionHandler` (#11523)

* Fix #11519

* Added FileResizeOptions for the changed resize function call

* getEvent should not be set to void it should return a value (#11135)

* getEvent should not be set to void it should return a value

* Add type to getActionData for testing

* pnotify Add type fpr notice styling and state

* fix pnotify test

* Remove Generics and replaces by return any

* convert space tp tabs

* Add barTintColor to NavigatorIOS (#11522)

* GreenSock TweenMax TweenLite config Object typed refs #11265 (#11310)

* refs #9944

* refs #11265

* refs #11265

* Call strategy with only mode or options (#11466)

* Call strategy with only mode or options

* Refactor `server.auth.strategy`

* - add client.exists([params, [callback]]) (#11515)

* Update to Electron 1.4.1 (#11481)

* Correct fs.createWriteStream (#11560)

* add  declaration file for  weapp (#11554)

* add  declaration file of  weapp

* rename "weapp" to "weapp-api"

rename "weapp" to "weapp-api" to avoid naming conflicts

* Added more methods to Turf (#11558)

* Added more methods to Turf
- circle
- geojsonType
- propReduce
- coordAll
- tesselate

* Replace Object with GeoJSON

* Implemented cheap-ruler definition

* Remove GeoJSON dependency

* Cheap-ruler fixes
- Removed GeoJSON from tests
- Added return-type to fromTile

* Update JSDocs cheap-ruler
Update based on comments https://github.com/mapbox/cheap-ruler/pull/20
- Removed `{@name}`
- Changed {Object} to {CheapRuler}

* [bluebird] document .suppressUnhandledRejections

http://bluebirdjs.com/docs/api/suppressunhandledrejections.html

* Add typings for shallowequal.

* URIjs fix .joinPaths()

the .joinPaths function is on URIStatic, not an instance of URI
https://medialize.github.io/URI.js/docs.html#static-joinPaths

* set document id property to be optional

* Fixed type of onchallenge

* feat(CKEditor): Add missing typings for `focusManager`

* sequelize: fix return value type of Model.findOrXXX methods

http://docs.sequelizejs.com/en/latest/api/model/#findorinitialize-promiseinstance-initialized

* Added type Point for simplicity
Comments from @vladima

* add interface for mongoose document optional properties

* optional constructor for RecurrenceRule

* fix the framework type

* add parameter support in initialize()

* add callback parameter

* Added promise() to the JQueryPromise<T> interface

jQuery allows calling a promise() function on a Promise object. Updated the interface to reflect this.

* optional authorize

* add contains fn

* Update ip-tests.ts

* Added tests for the promise() method on jqXHR

Ensures that the jqXHR object exposes a standard promise because it implements the JQueryPromise<T> interface.

* angular-dynamic-local Add "storageKey" definition (#11566)

Add "storageKey" definition

cf : https://github.com/lgalfaso/angular-dynamic-locale/blob/master/src/tmhDynamicLocale.js#L197

* Added declare module for easier including. (#11562)

* Adding recompose@0.20.2 typings (#11577)

* Added typings for change-emitter@0.1.2

* Adding recompose@0.20.2 typings

* Update typescript definition for selectize to 0.12.13 (#11570)

* [react-router-redux] Update action payload type (#11559)

The payload for React Redux Router action is a location object. For more information look at the source code [here](https://github.com/reactjs/react-router-redux/blob/master/src/sync.js#L95)

* [openlayers] Rewrite for openlayers 3.18.2 (#11339)

* Added missing config options for release v2.0.8 (#11595)

* [graphql] Create graphql (#11598)

* Complete graphql/language

* Update graphql/error

* Update graphql.d.ts

* Create graphql-tests.ts

* Update graphql/type

* Update graphql/error and graphql/execution

* Remove null type

* Remove comma

* ej typings v14.3.0.49 added (#11597)

* ej typings v14.3.0.49 added

* jquery dependent added

* react-bootstrap-table: add ignoreSinglePage option (#11581)

As shown in the [docs](http://allenfang.github.io/react-bootstrap-table/docs.html)

```
ignoreSinglePage : Bool
Enable to ignore the pagination if only one page, default is false.
```

* There is no INST_EDGE_FALLING exported const but INT_EDGE_FALLING (#11603)

Exporting correct `const` `INST_EDGE_FALLING` -> `INT_EDGE_FALLING`

* Complete HighchartsBarStates interface. Add Color interface (#11505)

- HighchartsBarStates interfaces didn't include `borderColor` and `color` properties, as documented in http://api.highcharts.com/highcharts/plotOptions.bar.states.hover
- A Color interface was added, since the documentation refers many times to `Color` as a type. This colors can be either a string or a gradient, as stated in http://www.highcharts.com/docs/chart-design-and-style/colors. The introduction of this type should help alleviating the errors currently present where certain "color" properties are only allowed to be strings.

* Add definition for swagger-jsdoc (#11298)

* Add definition for swagger-jsdoc

* Update files

* Remove interface and use any instead for options, fix tests

* Fix Usage example

* Add definitions for: "bunyan-config", "express-mung", "node-vitalsigns" and "memwatch-next" (#11285)

* Add definition for "bunnymq".

* Add definition for "strftime".

* Add definitions for: "bunyan-config", "express-mung" and
"node-vitalsigns".

* Add definitions for: "bunyan-config", "express-mung" and
"node-vitalsigns".

* Add definition for "memwatch-next".

* Fix project URL address.

* Rename "node-vitalsigns" to "vitalsigns".

* Update definitions.

* Use {} instead of "Object" type.
Remove unnecessary namespace for "memwatch-next" definition.
Rewrite "bunyan-config" definition.

* Replace "Object" by "{}".

* (helmet): change to namespace and export interfaces (#11585)

* Replace reference to deprecated http.ClientResponse with newer http.IncomingMessage (#11596)

* [cheerio] Adds missing load(CheerioElement) (#11520)

* add id (#11619)

* add id

* remove readonly

* add touch after

* fix typo

* change Topic property latch to boolean type (#11607)

* Add AngularJS linky filter definition (#11507)

* Support universal modules for SAT (#11632)

* changed versionKey in Schema spec to string

* better structure

* Add argumentless Q()

* add definitions for tz-format (#11565)

* add definitions for tz-format

* fix return type

* Create typings for ngeohash (#11634)

* [nprogress] Update configuration properties (#11627)

Update a couple of nprogress configuration properties:
* `ease` is renamed to `easing`.
* `trickleRate` is removed.
* `parent` is added.

More info [here](https://github.com/rstacruz/nprogress/blob/master/nprogress.js#L19-L31)

* Fix leaflet L.GeoJSON.addData et al (#11590) (#11591)

* NotificationAlertOptions can have a subtitle (#11638)

* Parse5 comment data (#11649)

* Add test for data

* Update parse5.d.ts

* feat: add localforage-cordovasqlitedriver definition (#11650)

* Fix export for "bunyan-config" and improve definitions (#11653)

* Fix export for "bunyan-config".

* Update definitions.
Replace "Object" to "{}" type.
Add "express" property in "VitalSigns" class.

* Update ejs.d.ts (#11467)

This typings give an error when templating HTML 

Error: Cannot invoke an expression whose type lacks a call signature.

my code 
```javascript
var templateFunction = EJS.compile(SOMESTRTEMPLATE);
myDomElement.innerHTML = templateFunction(someDataObject) // <= ERROR
```

* Added hyperscript module (#11661)

* update parsimmon typings for parsimmon 0.9.2 (#11648)

* update parsimmon typings for parsimmon 0.9.2

* add overloads for parsimmon#seq

* code review

* Fix babel-traverse buildCodeFrameError signature (#11654)

The Error argument is not an error instance, instead it is a constructor function that returns an error instance. 
Additionally, the constructor function is optional, by default SyntaxError is used

* Added type definition for riot library (#11664)

* Added type definition for riot

* Added type information for compile function, version, settings and template error handler

* Updated namespace name Riot -> riot

* Renamed riot-test.ts -> riot-tests.ts

* Add definitions for pem (#11666)

https://github.com/andris9/pem

* Added hapi-decorators.d.ts (#11668)

* Add missing each, and correct type of Date.now() (#11670)

* Add definitions for spdy (#11672)

https://github.com/indutny/node-spdy

* Allow interface to be named (#11673)

> error TS4023: Exported variable 'DevTools' has or is using name 'IDevTools' from external module "/Users/remojansen/CODE/forks/redux-bootstrap/node_modules/@types/redux-devtools/index" but cannot be named.

* Add array methods to LoDashExplicitArrayWrapper to match LoDashImplicitArrayWrapper. (#11518)

* add transducers-js types w/ tests (#11676)

* Fix redeclare block-scoped Base64 (#11677)

Issue found by https://github.com/dankogai/js-base64/issues/38#issuecomment-250999729

* added seed, randomTests and randomizeTests property (#11678)

* Add toJSON method to signature (#11682)

* Fix instance of cropperjs for library version > 0.8 (#11490)

* Updated fbsdk definitions for authentication responses and api calls. (#11686)

Fixes #11327
May help with #11007

* Create typings for jquery-alertable (#11642)

* ADD: definition file for the moment-duration-format library (#11557)

* Update d.ts file for Dialog API updates (#11526)

* Add support for Highcharts modules: offline exporting and boost (#11030)

* Create highcharts-modules-offline-exporting

* Rename highcharts-modules-offline-exporting to highcharts-modules-offline-exporting.d.ts

* Create highcharts-modules-boost.d.ts

* Added cash-js.d.ts File (#10765)

* Added cash-js.d.ts File

* Fixed Link break issue

* Renamed from cash-js to cash

* Fixed the module name as suggested

* Update headroom.d.ts (#11313)

notBottom  missing from definition

* Added the definition for the npm package simple-url-cache (#11296)

* Added the definition for the npm package simple-url-cache

https://www.npmjs.com/package/simple-url-cache

* - Some problems with shells.js missing the touch fucntion deifnition

* More details on the touch parameters - nice screenshot btw

* Updated the RowMethods interface (#11665)

* Updated the RowMethods interface

This Interface was missing the Definition of the id() method.

Link to official documentation: https://datatables.net/reference/api/row().id()

* Changed indentation from tabs to spaces

* Added definition file for Defaults Js Library (#11451)

* Added missing className property to CardProps (#10823)

The className property for CardPros is missing, so using it like
<Card className={this.myClass}>...</Card>
is not possible.

* Add missing perMessageDeflate server option (#11380)

* Add missing class AgendaView (#11371)

* Add missing class AgendaView

* Move class to kendo.ui namespace

* Change path to interface

* Add static fn

* Add static extend

* Add static extend

* Resolve conflicts

* adds system faker methods (#11432)

* added definitions for SharePoint file Search.ClientControls.js (#11652)

* added definitions for SharePoint file Search.ClientControls.js (Srch namespace, heavily used in Search Display Templates)

* --noImplicitAny compatibility fixes
also small improvements

* more fixes for --noImplicitAny

* Adding union type for offset (#11689)

* add type definitions for msgpack-lite package. (#11690)

* Updating jasmine to version 2.5 (#11688)

* Updating jasmine to version 2.5

* Fixing 2 small errors in the update of jasmine

* withMock now takes a  "() => void"

* fixed the withMock syntax error

* number added as type to seed function

* add missing isEmpty function (#11698)

* Added type definitions for terminal-menu (#11697)

* Update THREE.js definitions to r81 (#11679)

* Update THREE.js definitions to r81

* Update test_unit_maths.ts to r81

* Update version in header to r81

* UPDATE localForage type definitions (#11702)

* Update Google Maps API type definition to 3.25 (#11626)

* Update Google Maps Places Library definition

- According to the Places Library documentation (https://goo.gl/EJFiuQ), certain fields are being removed
- I have aligned the Places Library definitions with the API reference (https://goo.gl/kYoi9V) and added deprecation comments for the old properties as they are still accepted until February
- I could not find an official deprecation attribute or similar for Typescript definitions so I just left a comment

* Update the API version in the header

* Apply API changes between version 3.20 and 3.25

- Used the Google Maps API release notes (https://goo.gl/nRUZGJ) as a reference

* Fix inconsistant type definition

* Override ol.layer.Vector#getSource() (#11703)

Reference: http://openlayers.org/en/latest/apidoc/ol.layer.Vector.html

* Replace number[] by [number, number] (#11704)

* [lodash]: memoize.Cache expects construcor (#11707)

https://lodash.com/docs/4.15.0#memoize

* Added jquery.flagstrap.js definition suport (#11710)

* apply declaration merging (#10900)

* Update material-ui.d.ts (#11353)

Expose ThemePalette interface.

* Change ChartAxisXOptions (#11449)

Change the type for minimum and maximum options in ChartAxisXOptions to
support both number and Date.

* Improve support for arrays of promises (#11685)

* Alias IWhenable<T> = IPromise<T> | T

* Allow all Q functions to work with either promises or raw values

* Allow functions expecting arrays to take promises for arrays

Q.race is deliberately excluded, as this does not support this type of argument.

* scheduler options (#11543)

* Added missing move function (#11563)

* Added missing move function

Added missing move function in typings so that the move function is recognised by the IDE and the compiler.

* Minor derp here

* Add missing Valdr typings for validation results and constraints (#11636)

* Add missing Valdr types

Add ValdrValidationConstraints and ValdrValidationResult typings

* Refine Valdr-message typings

Set a more refined type to messages instead of any

* Expand Valdr typings tests

Expand tests to include added typings for ValdrValidationResult and ValdrConstraints

* Fix spacing

Replace tabs by spaces

* Rename vars in test

Rename vars to make test clearer

* Fix TS issues

Added missing types

* Remove undefined

In TS by default null and undefined are subtypes of all other types

* Fix wrong type

Add missing namespace

* Fix wrong version number

Set version to only numbers

* Fix wrong version number

Keep version to only numbers

* Use douple quotes

* Remove invalid triple-slash references

* Add tsconfig.json files and move main file to index.d.ts

* Rename file to index.d.ts

* Remove tscparams files

* Remove unused file

* Remove invalid references

* Move hapi-decorator to use index.d.ts

* Switch to use external modules

* Correctely extend angular

* Fix tsconfig.json

* Remove unused references

* HACK: Put back /// reference tag.
2016-10-05 11:40:00 -07:00

807 lines
28 KiB
TypeScript

// Type definitions for avoscloud-sdk 0.6.10
// Project: https://leancloud.cn/
// Definitions by: Wu Jun <http://leancloud.cn>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "avoscloud-sdk" {
namespace AV {
var applicationId: string;
var applicationKey: string;
var masterKey: string;
interface SuccessOption {
success?: Function;
}
interface ErrorOption {
error?: Function;
}
interface SuccessFailureOptions extends SuccessOption, ErrorOption {
}
interface WaitOption {
/**
* Set to true to wait for the server to confirm success
* before triggering an event.
*/
wait?: boolean;
}
interface UseMasterKeyOption {
/**
* In Cloud Code and Node only, causes the Master Key to be used for this request.
*/
useMasterKey?: boolean;
}
interface SilentOption {
/**
* Set to true to avoid firing the event.
*/
silent?: boolean;
}
/**
* A Promise is returned by async methods as a hook to provide callbacks to be
* called when the async task is fulfilled.
*
* <p>Typical usage would be like:<pre>
* query.find().then(function(results) {
* results[0].set("foo", "bar");
* return results[0].saveAsync();
* }).then(function(result) {
* console.log("Updated " + result.id);
* });
* </pre></p>
*
* @see AV.Promise.prototype.then
* @class
*/
interface IPromise<T> {
then<U>(resolvedCallback: (value: T) => IPromise<U>, rejectedCallback?: (reason: any) => IPromise<U>): IPromise<T>;
then<U>(resolvedCallback: (value: T) => U, rejectedCallback?: (reason: any) => IPromise<U>): IPromise<U>;
then<U>(resolvedCallback: (value: T) => U, rejectedCallback?: (reason: any) => U): IPromise<U>;
}
class Promise<T> {
static as<U>(resolvedValue: U): Promise<U>;
static error<U>(error: U): Promise<U>;
static is(possiblePromise: any): Boolean;
static when(promises: Promise<any>[]): Promise<any>;
always(callback: Function): Promise<T>;
done(callback: Function): Promise<T>;
fail(callback: Function): Promise<T>;
reject(error: any): void;
resolve(result: any): void;
then<U>(resolvedCallback: (value: T) => Promise<U>,
rejectedCallback?: (reason: any) => Promise<U>): IPromise<T>;
then<U>(resolvedCallback: (value: T) => U,
rejectedCallback?: (reason: any) => IPromise<U>): IPromise<T>;
then<U>(resolvedCallback: (value: T) => U,
rejectedCallback?: (reason: any) => U): IPromise<T>;
}
interface IBaseObject {
toJSON(): any;
}
class BaseObject implements IBaseObject {
toJSON(): any;
}
/**
* Creates a new ACL.
* If no argument is given, the ACL has no permissions for anyone.
* If the argument is a AV.User, the ACL will have read and write
* permission for only that user.
* If the argument is any other JSON object, that object will be interpretted
* as a serialized ACL created with toJSON().
* @see AV.Object#setACL
* @class
*
* <p>An ACL, or Access Control List can be added to any
* <code>AV.Object</code> to restrict access to only a subset of users
* of your application.</p>
*/
class ACL extends BaseObject {
permissionsById: any;
constructor(arg1?: any);
setPublicReadAccess(allowed: boolean): void;
getPublicReadAccess(): boolean;
setPublicWriteAccess(allowed: boolean): void;
getPublicWriteAccess(): boolean;
setReadAccess(userId: User, allowed: boolean): void;
getReadAccess(userId: User): boolean;
setReadAccess(userId: string, allowed: boolean): void;
getReadAccess(userId: string): boolean;
setRoleReadAccess(role: Role, allowed: boolean): void;
setRoleReadAccess(role: string, allowed: boolean): void;
getRoleReadAccess(role: Role): boolean;
getRoleReadAccess(role: string): boolean;
setRoleWriteAccess(role: Role, allowed: boolean): void;
setRoleWriteAccess(role: string, allowed: boolean): void;
getRoleWriteAccess(role: Role): boolean;
getRoleWriteAccess(role: string): boolean;
setWriteAccess(userId: User, allowed: boolean): void;
setWriteAccess(userId: string, allowed: boolean): void;
getWriteAccess(userId: User): boolean;
getWriteAccess(userId: string): boolean;
}
/**
* A AV.File is a local representation of a file that is saved to the AV
* cloud.
* @class
* @param name {String} The file's name. This will be prefixed by a unique
* value once the file has finished saving. The file name must begin with
* an alphanumeric character, and consist of alphanumeric characters,
* periods, spaces, underscores, or dashes.
* @param data {Array} The data for the file, as either:
* 1. an Array of byte value Numbers, or
* 2. an Object like { base64: "..." } with a base64-encoded String.
* 3. a File object selected with a file upload control. (3) only works
* in Firefox 3.6+, Safari 6.0.2+, Chrome 7+, and IE 10+.
* For example:<pre>
* var fileUploadControl = $("#profilePhotoFileUpload")[0];
* if (fileUploadControl.files.length > 0) {
* var file = fileUploadControl.files[0];
* var name = "photo.jpg";
* var AVFile = new AV.File(name, file);
* AVFile.save().then(function() {
* // The file has been saved to AV.
* }, function(error) {
* // The file either could not be read, or could not be saved to AV.
* });
* }</pre>
* @param type {String} Optional Content-Type header to use for the file. If
* this is omitted, the content type will be inferred from the name's
* extension.
*/
class File {
constructor(name: string, data: any, type?: string);
name(): string;
url(): string;
save<T>(options?: SuccessFailureOptions): Promise<T>;
}
/**
* Creates a new GeoPoint with any of the following forms:<br>
* <pre>
* new GeoPoint(otherGeoPoint)
* new GeoPoint(30, 30)
* new GeoPoint([30, 30])
* new GeoPoint({latitude: 30, longitude: 30})
* new GeoPoint() // defaults to (0, 0)
* </pre>
* @class
*
* <p>Represents a latitude / longitude point that may be associated
* with a key in a AVObject or used as a reference point for geo queries.
* This allows proximity-based queries on the key.</p>
*
* <p>Only one key in a class may contain a GeoPoint.</p>
*
* <p>Example:<pre>
* var point = new AV.GeoPoint(30.0, -20.0);
* var object = new AV.Object("PlaceObject");
* object.set("location", point);
* object.save();</pre></p>
*/
class GeoPoint extends BaseObject {
latitude: number;
longitude: number;
constructor(arg1?: any, arg2?: any);
current(options?: SuccessFailureOptions): GeoPoint;
radiansTo(point: GeoPoint): number;
kilometersTo(point: GeoPoint): number;
milesTo(point: GeoPoint): number;
}
/**
* A class that is used to access all of the children of a many-to-many relationship.
* Each instance of AV.Relation is associated with a particular parent object and key.
*/
class Relation extends BaseObject {
parent: Object;
key: string;
targetClassName: string;
constructor(parent?: Object, key?: string);
//Adds a AV.Object or an array of AV.Objects to the relation.
add(object: Object): void;
// Returns a AV.Query that is limited to objects in this relation.
query(): Query;
// Removes a AV.Object or an array of AV.Objects from this relation.
remove(object: Object): void;
}
/**
* Creates a new model with defined attributes. A client id (cid) is
* automatically generated and assigned for you.
*
* <p>You won't normally call this method directly. It is recommended that
* you use a subclass of <code>AV.Object</code> instead, created by calling
* <code>extend</code>.</p>
*
* <p>However, if you don't want to use a subclass, or aren't sure which
* subclass is appropriate, you can use this form:<pre>
* var object = new AV.Object("ClassName");
* </pre>
* That is basically equivalent to:<pre>
* var MyClass = AV.Object.extend("ClassName");
* var object = new MyClass();
* </pre></p>
*
* @param {Object} attributes The initial set of data to store in the object.
* @param {Object} options A set of Backbone-like options for creating the
* object. The only option currently supported is "collection".
* @see AV.Object.extend
*
* @class
*
* <p>The fundamental unit of AV data, which implements the Backbone Model
* interface.</p>
*/
class Object extends BaseObject {
id: any;
createdAt:any;
updatedAt:any;
attributes: any;
cid: string;
changed: boolean;
className: string;
constructor(className?: string, options?: any);
constructor(attributes?: string[], options?: any);
static extend(className: string, protoProps?: any, classProps?: any): any;
static fetchAll<T>(list: Object[], options: SuccessFailureOptions): Promise<T>;
static fetchAllIfNeeded<T>(list: Object[], options: SuccessFailureOptions): Promise<T>;
static destroyAll<T>(list: Object[], options?: Object.DestroyAllOptions): Promise<T>;
static saveAll<T>(list: Object[], options?: Object.SaveAllOptions): Promise<T>;
initialize(): void;
add(attr: string, item: any): Object;
addUnique(attr: string, item: any): any;
change(options: any): Object;
changedAttributes(diff: any): boolean;
clear(options: any): any;
clone(): Object;
destroy<T>(options?: Object.DestroyOptions): Promise<T>;
dirty(attr: String): boolean;
dirtyKeys(): string[];
escape(attr: string): string;
existed(): boolean;
fetch<T>(options?: Object.FetchOptions): Promise<T>;
get(attr: string): any;
getACL(): ACL;
getObjectId(): string;
has(attr: string): boolean;
hasChanged(attr: string): boolean;
increment(attr: string, amount?: number): any;
isValid(): boolean;
op(attr: string): any;
previous(attr: string): any;
previousAttributes(): any;
relation(attr: string): Relation;
remove(attr: string, item: any): any;
save<T>(options?: Object.SaveOptions, arg2?: any, arg3?: any): Promise<T>;
set(key: string, value: any, options?: Object.SetOptions): boolean;
setACL(acl: ACL, options?: SuccessFailureOptions): boolean;
unset(attr: string, options?: any): any;
validate(attrs: any, options?: SuccessFailureOptions): boolean;
}
namespace Object {
interface DestroyOptions extends SuccessFailureOptions, WaitOption, UseMasterKeyOption { }
interface DestroyAllOptions extends SuccessFailureOptions, UseMasterKeyOption { }
interface FetchOptions extends SuccessFailureOptions, UseMasterKeyOption { }
interface SaveOptions extends SuccessFailureOptions, SilentOption, UseMasterKeyOption, WaitOption { }
interface SaveAllOptions extends SuccessFailureOptions, UseMasterKeyOption { }
interface SetOptions extends ErrorOption, SilentOption {
promise?: any;
}
}
/**
* Every AV application installed on a device registered for
* push notifications has an associated Installation object.
*/
class Installation extends Object {
badge: any;
channels: string[];
timeZone: any;
deviceType: string;
pushType: string;
installationId: string;
deviceToken: string;
channelUris: string;
appName: string;
appVersion: string;
AVVersion: string;
appIdentifier: string;
}
/**
* Creates a new instance with the given models and options. Typically, you
* will not call this method directly, but will instead make a subclass using
* <code>AV.Collection.extend</code>.
*
* @param {Array} models An array of instances of <code>AV.Object</code>.
*
* @param {Object} options An optional object with Backbone-style options.
* Valid options are:<ul>
* <li>model: The AV.Object subclass that this collection contains.
* <li>query: An instance of AV.Query to use when fetching items.
* <li>comparator: A string property name or function to sort by.
* </ul>
*
* @see AV.Collection.extend
*
* @class
*
* <p>Provides a standard collection class for our sets of models, ordered
* or unordered. For more information, see the
* <a href="http://documentcloud.github.com/backbone/#Collection">Backbone
* documentation</a>.</p>
*/
class Collection<T> extends Events implements IBaseObject {
model: Object;
models: Object[];
query: Query;
comparator: (object: Object) => any;
constructor(models?: Object[], options?: Collection.Options);
static extend(instanceProps: any, classProps: any): any;
initialize(): void;
add(models: any[], options?: Collection.AddOptions): Collection<T>;
at(index: number): Object;
fetch(options?: Collection.FetchOptions): Promise<T>;
create(model: Object, options?: Collection.CreateOptions): Object;
get(id: string): Object;
getByCid(cid: any): any;
pluck(attr: string): any[];
remove(model: any, options?: Collection.RemoveOptions): Collection<T>;
remove(models: any[], options?: Collection.RemoveOptions): Collection<T>;
reset(models: any[], options?: Collection.ResetOptions): Collection<T>;
sort(options?: Collection.SortOptions): Collection<T>;
toJSON(): any;
}
namespace Collection {
interface Options {
model?: Object;
query?: Query;
comparator?: string;
}
interface AddOptions extends SilentOption {
/**
* The index at which to add the models.
*/
at?: number;
}
interface CreateOptions extends SuccessFailureOptions, WaitOption, SilentOption, UseMasterKeyOption {
}
interface FetchOptions extends SuccessFailureOptions, SilentOption, UseMasterKeyOption { }
interface RemoveOptions extends SilentOption { }
interface ResetOptions extends SilentOption { }
interface SortOptions extends SilentOption { }
}
/**
* @class
*
* <p>AV.Events is a fork of Backbone's Events module, provided for your
* convenience.</p>
*
* <p>A module that can be mixed in to any object in order to provide
* it with custom events. You may bind callback functions to an event
* with `on`, or remove these functions with `off`.
* Triggering an event fires all callbacks in the order that `on` was
* called.
*
* <pre>
* var object = {};
* _.extend(object, AV.Events);
* object.on('expand', function(){ alert('expanded'); });
* object.trigger('expand');</pre></p>
*
* <p>For more information, see the
* <a href="http://documentcloud.github.com/backbone/#Events">Backbone
* documentation</a>.</p>
*/
class Events {
static off(events: string[], callback?: Function, context?: any): Events;
static on(events: string[], callback?: Function, context?: any): Events;
static trigger(events: string[]): Events;
static bind(): Events;
static unbind(): Events;
on(eventName: string, callback?: Function, context?: any): Events;
off(eventName?: string, callback?: Function, context?: any): Events;
trigger(eventName: string, ...args: any[]): Events;
bind(eventName: string, callback: Function, context?: any): Events;
unbind(eventName?: string, callback?: Function, context?: any): Events;
}
/**
* Creates a new AV AV.Query for the given AV.Object subclass.
* @param objectClass -
* An instance of a subclass of AV.Object, or a AV className string.
* @class
*
* <p>AV.Query defines a query that is used to fetch AV.Objects. The
* most common use case is finding all objects that match a query through the
* <code>find</code> method. For example, this sample code fetches all objects
* of class <code>MyClass</code>. It calls a different function depending on
* whether the fetch succeeded or not.
*
* <pre>
* var query = new AV.Query(MyClass);
* query.find({
* success: function(results) {
* // results is an array of AV.Object.
* },
*
* error: function(error) {
* // error is an instance of AV.Error.
* }
* });</pre></p>
*
* <p>A AV.Query can also be used to retrieve a single object whose id is
* known, through the get method. For example, this sample code fetches an
* object of class <code>MyClass</code> and id <code>myId</code>. It calls a
* different function depending on whether the fetch succeeded or not.
*
* <pre>
* var query = new AV.Query(MyClass);
* query.get(myId, {
* success: function(object) {
* // object is an instance of AV.Object.
* },
*
* error: function(object, error) {
* // error is an instance of AV.Error.
* }
* });</pre></p>
*
* <p>A AV.Query can also be used to count the number of objects that match
* the query without retrieving all of those objects. For example, this
* sample code counts the number of objects of the class <code>MyClass</code>
* <pre>
* var query = new AV.Query(MyClass);
* query.count({
* success: function(number) {
* // There are number instances of MyClass.
* },
*
* error: function(error) {
* // error is an instance of AV.Error.
* }
* });</pre></p>
*/
class Query extends BaseObject {
objectClass: any;
className: string;
constructor(objectClass: any);
static and(...var_args: Query[]): Query;
static or(...var_args: Query[]): Query;
addAscending(key: string): Query;
addAscending(key: string[]): Query;
addDescending(key: string): Query;
addDescending(key: string[]): Query;
ascending(key: string): Query;
ascending(key: string[]): Query;
collection(items?: Object[], options?: Collection.Options): Collection<Object>;
containedIn(key: string, values: any[]): Query;
contains(key: string, substring: string): Query;
containsAll(key: string, values: any[]): Query;
count<T>(options?: Query.CountOptions): Promise<T>;
descending(key: string): Query;
descending(key: string[]): Query;
doesNotExist(key: string): Query;
doesNotMatchKeyInQuery(key: string, queryKey: string, query: Query): Query;
doesNotMatchQuery(key: string, query: Query): Query;
each<T>(callback: Function, options?: SuccessFailureOptions): Promise<T>;
endsWith(key: string, suffix: string): Query;
equalTo(key: string, value: any): Query;
exists(key: string): Query;
find<T>(options?: Query.FindOptions): Promise<T>;
first<T>(options?: Query.FirstOptions): Promise<T>;
get(objectId: string, options?: Query.GetOptions): Promise<any>;
greaterThan(key: string, value: any): Query;
greaterThanOrEqualTo(key: string, value: any): Query;
include(key: string): Query;
include(keys: string[]): Query;
lessThan(key: string, value: any): Query;
lessThanOrEqualTo(key: string, value: any): Query;
limit(n: number): Query;
matches(key: string, regex: RegExp, modifiers: any): Query;
matchesKeyInQuery(key: string, queryKey: string, query: Query): Query;
matchesQuery(key: string, query: Query): Query;
near(key: string, point: GeoPoint): Query;
notContainedIn(key: string, values: any[]): Query;
notEqualTo(key: string, value: any): Query;
select(...keys: string[]): Query;
skip(n: number): Query;
startsWith(key: string, prefix: string): Query;
withinGeoBox(key: string, southwest: GeoPoint, northeast: GeoPoint): Query;
withinKilometers(key: string, point: GeoPoint, maxDistance: number): Query;
withinMiles(key: string, point: GeoPoint, maxDistance: number): Query;
withinRadians(key: string, point: GeoPoint, maxDistance: number): Query;
}
namespace Query {
interface CountOptions extends SuccessFailureOptions, UseMasterKeyOption { }
interface FindOptions extends SuccessFailureOptions, UseMasterKeyOption { }
interface FirstOptions extends SuccessFailureOptions, UseMasterKeyOption { }
interface GetOptions extends SuccessFailureOptions, UseMasterKeyOption { }
}
/**
* Represents a Role on the AV server. Roles represent groupings of
* Users for the purposes of granting permissions (e.g. specifying an ACL
* for an Object). Roles are specified by their sets of child users and
* child roles, all of which are granted any permissions that the parent
* role has.
*
* <p>Roles must have a name (which cannot be changed after creation of the
* role), and must specify an ACL.</p>
* @class
* A AV.Role is a local representation of a role persisted to the AV
* cloud.
*/
class Role extends Object {
constructor(name: string, acl: ACL);
getRoles(): Relation;
getUsers(): Relation;
getName(): string;
setName(name: string, options?: SuccessFailureOptions): any;
}
/**
* @class
*
* <p>A AV.User object is a local representation of a user persisted to the
* AV cloud. This class is a subclass of a AV.Object, and retains the
* same functionality of a AV.Object, but also extends it with various
* user specific methods, like authentication, signing up, and validation of
* uniqueness.</p>
*/
class User extends Object {
static current(): User;
static signUp<T>(username: string, password: string, attrs: any, options?: SuccessFailureOptions): Promise<T>;
static logIn<T>(username: string, password: string, options?: SuccessFailureOptions): Promise<T>;
static logOut<T>(): Promise<T>;
static allowCustomUserClass(isAllowed: boolean): void;
static become<T>(sessionToken: string, options?: SuccessFailureOptions): Promise<T>;
static requestPasswordReset<T>(email: string, options?: SuccessFailureOptions): Promise<T>;
signUp<T>(attrs: any, options?: SuccessFailureOptions): Promise<T>;
logIn<T>(options?: SuccessFailureOptions): Promise<T>;
fetch<T>(options?: SuccessFailureOptions): Promise<T>;
save<T>(arg1?: any, arg2?: any, arg3?: any): Promise<T>;
authenticated(): boolean;
isCurrent(): boolean;
getEmail(): string;
setEmail(email: string, options: SuccessFailureOptions): boolean;
getUsername(): string;
setUsername(username: string, options?: SuccessFailureOptions): boolean;
setPassword(password: string, options?: SuccessFailureOptions): boolean;
getSessionToken(): string;
}
namespace Analytics {
function track<T>(name: string, dimensions: any):Promise<T>;
}
class Error {
code: ErrorCode;
message: string;
constructor(code: ErrorCode, message: string);
}
enum ErrorCode {
OTHER_CAUSE = -1,
INTERNAL_SERVER_ERROR = 1,
CONNECTION_FAILED = 100,
OBJECT_NOT_FOUND = 101,
INVALID_QUERY = 102,
INVALID_CLASS_NAME = 103,
MISSING_OBJECT_ID = 104,
INVALID_KEY_NAME = 105,
INVALID_POINTER = 106,
INVALID_JSON = 107,
COMMAND_UNAVAILABLE = 108,
NOT_INITIALIZED = 109,
INCORRECT_TYPE = 111,
INVALID_CHANNEL_NAME = 112,
PUSH_MISCONFIGURED = 115,
OBJECT_TOO_LARGE = 116,
OPERATION_FORBIDDEN = 119,
CACHE_MISS = 120,
INVALID_NESTED_KEY = 121,
INVALID_FILE_NAME = 122,
INVALID_ACL = 123,
TIMEOUT = 124,
INVALID_EMAIL_ADDRESS = 125,
MISSING_CONTENT_TYPE = 126,
MISSING_CONTENT_LENGTH = 127,
INVALID_CONTENT_LENGTH = 128,
FILE_TOO_LARGE = 129,
FILE_SAVE_ERROR = 130,
DUPLICATE_VALUE = 137,
INVALID_ROLE_NAME = 139,
EXCEEDED_QUOTA = 140,
SCRIPT_FAILED = 141,
VALIDATION_ERROR = 142,
INVALID_IMAGE_DATA = 150,
UNSAVED_FILE_ERROR = 151,
INVALID_PUSH_TIME_ERROR = 152,
FILE_DELETE_ERROR = 153,
REQUEST_LIMIT_EXCEEDED = 155,
INVALID_EVENT_NAME = 160,
USERNAME_MISSING = 200,
PASSWORD_MISSING = 201,
USERNAME_TAKEN = 202,
EMAIL_TAKEN = 203,
EMAIL_MISSING = 204,
EMAIL_NOT_FOUND = 205,
SESSION_MISSING = 206,
MUST_CREATE_USER_THROUGH_SIGNUP = 207,
ACCOUNT_ALREADY_LINKED = 208,
INVALID_SESSION_TOKEN = 209,
LINKED_ID_MISSING = 250,
INVALID_LINKED_SESSION = 251,
UNSUPPORTED_SERVICE = 252,
AGGREGATE_ERROR = 600,
FILE_READ_ERROR = 601,
X_DOMAIN_REQUEST = 602
}
/**
* @class
* A AV.Op is an atomic operation that can be applied to a field in a
* AV.Object. For example, calling <code>object.set("foo", "bar")</code>
* is an example of a AV.Op.Set. Calling <code>object.unset("foo")</code>
* is a AV.Op.Unset. These operations are stored in a AV.Object and
* sent to the server as part of <code>object.save()</code> operations.
* Instances of AV.Op should be immutable.
*
* You should not create subclasses of AV.Op or instantiate AV.Op
* directly.
*/
namespace Op {
interface BaseOperation extends IBaseObject {
objects(): any[];
}
interface Add extends BaseOperation {
}
interface AddUnique extends BaseOperation {
}
interface Increment extends IBaseObject {
amount: number;
}
interface Relation extends IBaseObject {
added(): Object[];
removed: Object[];
}
interface Set extends IBaseObject {
value(): any;
}
interface Unset extends IBaseObject {
}
}
/**
* Contains functions to deal with Push in AV
* @name AV.Push
* @namespace
*/
namespace Push {
function send<T>(data: PushData, options?: SendOptions): Promise<T>;
interface PushData {
channels?: string[];
push_time?: Date;
expiration_time?: Date;
expiration_interval?: number;
where?: Query;
data?: any;
alert?: string;
badge?: string;
sound?: string;
title?: string;
}
interface SendOptions {
success?: () => void;
error?: (error: Error) => void;
}
}
/**
* Call this method first to set up your authentication tokens for AV.
* @param {String} applicationId Your Application ID.
* @param {String} applicationKey Your Application Key.
* @param {String} masterKey (optional) Your Application Master Key. (Node.js only!)
*/
function initialize(applicationId: string, applicationKey: string, masterKey?: string): void;
}
export = AV;
}
declare module 'leanengine' {
import alias = require('avoscloud-sdk');
export = alias;
}