Home Reference Source
import {SharePointDataSource} from 'arva-js/data/datasources/SharePointDataSource.js'
public class | source

SharePointDataSource

Extends:

DataSource → SharePointDataSource

Static Member Summary

Static Public Members
public static get
public static set

Static Method Summary

Static Public Methods
public static

createFromChild(path: *, childName: *, options: {}): *

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public get

Indicate that the DataSource can be inherited when instantiating a list of models.

public

options: *

Method Summary

Public Methods
public

authAnonymously(onComplete: Function, options: Object): void

Authenticates all instances of this DataSource as an anonymous user.

public

authWithCustomToken(authToken: String, onComplete: Function, options: Object): void

Authenticates all instances of this DataSource with a custom auth token or secret.

public

authWithOAuthToken(provider: String, credentials: String | Object, onComplete: Function, options: Object): void

Authenticates all instances of this DataSource with the given OAuth provider and credentials.

public

authWithPassword(credentials: String | Object, onComplete: Function, options: Object): void

Authenticates all instances of this DataSource with the given email/password credentials.

public

child(childName: String, options: Object): DataSource

Returns a dataSource reference to the given child branch of the current dataSource.

public

Fetches the current user's authentication state. If the user is authenticated, returns an object containing at least the fields uid, provider, auth, and expires. If the user is not authenticated, returns null.

public

key(): String

Returns the name of the current branch in the path on the dataSource.

public

Returns a new dataSource reference that will limit the subscription to only the first given amount items.

public

Returns a new dataSource reference that will limit the subscription to only the last given amount items.

public

off(event: String, handler: Function)

Unsubscribe to a previously subscribed event.

public

on(event: String, handler: Function, context: Object)

Subscribe to an event emitted by the DataSource.

public

once(event: String, handler: Function, context: Object): *

Subscribe to an event emitted by the DataSource once, and then immediately unsubscribe.

public

Returns the full URL to the path on the dataSource.

public

Writes newData to the path this dataSource was constructed with, appended by a random UID generated by the dataSource.

public

remove(object: Object): void

Removes the object and all underlying children that this dataSource points to.

public

Removes the callback set to trigger when dataSource adds a data element.

public

Removes the callback set to trigger when dataSource changes a data element.

public

Removes the callback set to trigger when dataSource moves a data element.

public

Removes the callback set to trigger when dataSource removes a data element.

public

Removes the callback set to trigger when dataSource updates the data.

public

Dummy method that just returns an empty string.

public

set(newData: Object): Promise

Writes newData to the path this dataSource was constructed with.

public

setChildAddedCallback(callback: Function): void

Set the callback triggered when dataSource adds a data element.

public

Set the callback triggered when dataSource changes a data element.

public

setChildMovedCallback(callback: Function): void

Set the callback triggered when dataSource moves a data element.

public

Set the callback triggered when dataSource removes a data element.

public

setPriority(newPriority: String | Number): void

Sets the priority (ordering) of an object on a given dataSource.

public

Sets the callback triggered when dataSource updates the data.

public

setWithPriority(newData: Object, priority: String | Number): Promise

Writes newData with given priority (ordering) to the path this dataSource was constructed with.

public

Resolves when the DataSource is synchronized to the server

public

Returns the full path to this dataSource's source on the remote storage provider.

public

unauth(): void

Logs out from the datasource, allowing to re-authenticate at a later time.

Inherited Summary

From class DataSource
public get

Indicate that the DataSource can be inherited when instantiating a list of models.

public

authAnonymously(onComplete: Function, options: Object): void

Authenticates all instances of this DataSource as an anonymous user.

public

authWithCustomToken(authToken: String, onComplete: Function, options: Object): void

Authenticates all instances of this DataSource with a custom auth token or secret.

public

authWithOAuthToken(provider: String, credentials: String | Object, onComplete: Function, options: Object): void

Authenticates all instances of this DataSource with the given OAuth provider and credentials.

public

authWithPassword(credentials: String | Object, onComplete: Function, options: Object): void

Authenticates all instances of this DataSource with the given email/password credentials.

public

child(childName: String, options: Object): DataSource

Returns a dataSource reference to the given child branch of the current dataSource.

public

Fetches the current user's authentication state. If the user is authenticated, returns an object containing at least the fields uid, provider, auth, and expires. If the user is not authenticated, returns null.

public

key(): String

Returns the name of the current branch in the path on the dataSource.

public

Returns a new dataSource reference that will limit the subscription to only the first given amount items.

public

Returns a new dataSource reference that will limit the subscription to only the last given amount items.

public

off(event: String, handler: Function)

Unsubscribe to a previously subscribed event.

public

on(event: String, handler: Function, context: Object)

Subscribe to an event emitted by the DataSource.

public

once(event: String, handler: Function, context: Object)

Subscribe to an event emitted by the DataSource once, and then immediately unsubscribe.

public

Orders the DataSource's childs by the value in child[key].

public

Orders the DataSource's childs by their key names, ignoring their priority.

public

Orders the DataSource's childs by their values, ignoring their priority.

public

Returns the full URL to the path on the dataSource.

public

push(newData: Object): void

Writes newData to the path this dataSource was constructed with, appended by a random UID generated by the dataSource.

public

remove(): void

Removes the object and all underlying children that this dataSource points to.

public

Removes the callback set to trigger when dataSource adds a data element.

public

Removes the callback set to trigger when dataSource changes a data element.

public

Removes the callback set to trigger when dataSource moves a data element.

public

Removes the callback set to trigger when dataSource removes a data element.

public

Removes the callback set to trigger when dataSource updates the data.

public

set(newData: Object): Promise

Writes newData to the path this dataSource was constructed with.

public

setChildAddedCallback(callback: Function): void

Set the callback triggered when dataSource adds a data element.

public

Set the callback triggered when dataSource changes a data element.

public

setChildMovedCallback(callback: Function): void

Set the callback triggered when dataSource moves a data element.

public

Set the callback triggered when dataSource removes a data element.

public

setPriority(newPriority: String | Number): void

Sets the priority (ordering) of an object on a given dataSource.

public

Sets the callback triggered when dataSource updates the data.

public

setWithPriority(newData: Object, priority: String | Number): Promise

Writes newData with given priority (ordering) to the path this dataSource was constructed with.

public

Resolves when the DataSource is synchronized to the server

public

Returns the full path to this dataSource's source on the remote storage provider.

public

unauth(): void

Logs out from the datasource, allowing to re-authenticate at a later time.

Static Public Members

public static get currentUser: * source

public static set currentUser: * source

Static Public Methods

public static createFromChild(path: *, childName: *, options: {}): * source

Params:

NameTypeAttributeDescription
path *
childName *
options {}
  • optional
  • default: {}

Return:

*

Public Constructors

public constructor(path: String): SharePointDataSource source

Override:

DataSource#constructor

Params:

NameTypeAttributeDescription
path String

Full path to resource in remote data storage.

Return:

SharePointDataSource

SharePointDataSource instance.

Public Members

public get inheritable: Boolean: boolean source

Indicate that the DataSource can be inherited when instantiating a list of models. By default we indicate false, which should trigger data model instantiation to create unique DataSource references to each model either in array or directly.

If set to false, model updates trigger creation of a new DataSource instance. (default)

Override:

DataSource#inheritable

Return:

Boolean

Whether the DataSource is inheritable.

public options: * source

Public Methods

public authAnonymously(onComplete: Function, options: Object): void source

Authenticates all instances of this DataSource as an anonymous user.

Override:

DataSource#authAnonymously

Params:

NameTypeAttributeDescription
onComplete Function

Callback, executed when login is completed either successfully or erroneously. On error, first argument is error message. On success, the first argument is null, and the second argument is an object containing the fields uid, provider, auth, and expires.

options Object

Optional, additional client arguments, such as configuring session persistence.

Return:

void

public authWithCustomToken(authToken: String, onComplete: Function, options: Object): void source

Authenticates all instances of this DataSource with a custom auth token or secret.

Override:

DataSource#authWithCustomToken

Params:

NameTypeAttributeDescription
authToken String

Authentication token or secret.

onComplete Function

Callback, executed when login is completed either successfully or erroneously. On error, first argument is error message. On success, the first argument is null, and the second argument is an object containing the fields uid, provider, auth, and expires.

options Object

Optional, additional client arguments, such as configuring session persistence.

Return:

void

public authWithOAuthToken(provider: String, credentials: String | Object, onComplete: Function, options: Object): void source

Authenticates all instances of this DataSource with the given OAuth provider and credentials.

Override:

DataSource#authWithOAuthToken

Params:

NameTypeAttributeDescription
provider String

google, facebook, github, or twitter

credentials String | Object

Access token string, or object with key/value pairs with e.g. OAuth 1.1 credentials.

onComplete Function

Callback, executed when login is completed either successfully or erroneously. On error, first argument is error message. On success, the first argument is null, and the second argument is an object containing the fields uid, provider, auth, and expires.

options Object

Optional, additional client arguments, such as configuring session persistence.

Return:

void

public authWithPassword(credentials: String | Object, onComplete: Function, options: Object): void source

Authenticates all instances of this DataSource with the given email/password credentials.

Override:

DataSource#authWithPassword

Params:

NameTypeAttributeDescription
credentials String | Object

Object with key/value pairs {email: 'value', password:'value'}.

onComplete Function

Callback, executed when login is completed either successfully or erroneously. On error, first argument is error message. On success, the first argument is null, and the second argument is an object containing the fields uid, provider, auth, and expires.

options Object

Optional, additional client arguments, such as configuring session persistence.

Return:

void

public child(childName: String, options: Object): DataSource source

Returns a dataSource reference to the given child branch of the current dataSource.

Override:

DataSource#child

Params:

NameTypeAttributeDescription
childName String

Child branch name.

options Object

Optional: additional options to pass to new DataSource instance.

Return:

DataSource

New dataSource instance pointing to the given child branch.

public getAuth(): Object | null source

Fetches the current user's authentication state. If the user is authenticated, returns an object containing at least the fields uid, provider, auth, and expires. If the user is not authenticated, returns null.

Override:

DataSource#getAuth

Return:

Object | null

User auth object.

public key(): String source

Returns the name of the current branch in the path on the dataSource.

Override:

DataSource#key

Return:

String

Current branch name.

public limitToFirst(amount: Number): DataSource source

Returns a new dataSource reference that will limit the subscription to only the first given amount items.

Override:

DataSource#limitToFirst

Params:

NameTypeAttributeDescription
amount Number

Amount of items to limit the dataSource to.

Return:

DataSource

New dataSource instance.

public limitToLast(amount: Number): DataSource source

Returns a new dataSource reference that will limit the subscription to only the last given amount items.

Override:

DataSource#limitToLast

Params:

NameTypeAttributeDescription
amount Number

Amount of items to limit the dataSource to.

Return:

DataSource

New dataSource instance.

public off(event: String, handler: Function) source

Unsubscribe to a previously subscribed event. If no handler or context is given, all handlers for the given event are removed. If no parameters are given at all, all event types will have their handlers removed.

Override:

DataSource#off

Params:

NameTypeAttributeDescription
event String

Event type to unsubscribe from. Allowed values are: 'value', 'child_changed', 'child_added', 'child_removed'.

handler Function

Optional: Function that was used in previous subscription.

public on(event: String, handler: Function, context: Object) source

Subscribe to an event emitted by the DataSource.

Override:

DataSource#on

Params:

NameTypeAttributeDescription
event String

Event type to subscribe to. Allowed values are: 'value', 'child_changed', 'child_added', 'child_removed'.

handler Function

Function to call when the subscribed event is emitted.

context Object

Context to set 'this' to when calling the handler function.

public once(event: String, handler: Function, context: Object): * source

Subscribe to an event emitted by the DataSource once, and then immediately unsubscribe.

Override:

DataSource#once

Params:

NameTypeAttributeDescription
event String

Event type to subscribe to. Allowed values are: 'value', 'child_changed', 'child_added', 'child_removed'.

handler Function

Function to call when the subscribed event is emitted.

context Object

Context to set 'this' to when calling the handler function.

Return:

*

public path(): String source

Returns the full URL to the path on the dataSource. Functionally identical to toString().

Override:

DataSource#path

Return:

String

Full resource path.

public push(newData: Object): SharePointDataSource source

Writes newData to the path this dataSource was constructed with, appended by a random UID generated by the dataSource.

Override:

DataSource#push

Params:

NameTypeAttributeDescription
newData Object

New data to append to dataSource.

public remove(object: Object): void source

Removes the object and all underlying children that this dataSource points to.

Override:

DataSource#remove

Params:

NameTypeAttributeDescription
object Object

The current object, needed because of a SharePointDataSource-specific issue. Will be refactored out in the future.

Return:

void

public removeChildAddedCallback(): void source

Removes the callback set to trigger when dataSource adds a data element.

Override:

DataSource#removeChildAddedCallback

Return:

void

public removeChildChangedCallback(): void source

Removes the callback set to trigger when dataSource changes a data element.

Override:

DataSource#removeChildChangedCallback

Return:

void

public removeChildMovedCallback(): void source

Removes the callback set to trigger when dataSource moves a data element.

Override:

DataSource#removeChildMovedCallback

Return:

void

public removeChildRemovedCallback(): void source

Removes the callback set to trigger when dataSource removes a data element.

Override:

DataSource#removeChildRemovedCallback

Return:

void

public removeValueChangedCallback(): void source

Removes the callback set to trigger when dataSource updates the data.

Override:

DataSource#removeValueChangedCallback

Return:

void

public root(): String source

Dummy method that just returns an empty string.

Return:

String

Empty string.

public set(newData: Object): Promise source

Writes newData to the path this dataSource was constructed with.

Override:

DataSource#set

Params:

NameTypeAttributeDescription
newData Object

Data to write to dataSource.

Return:

Promise

Resolves when write to server is complete.

public setChildAddedCallback(callback: Function): void source

Set the callback triggered when dataSource adds a data element.

Override:

DataSource#setChildAddedCallback

Params:

NameTypeAttributeDescription
callback Function

Callback function to call when a new data child is added.

Return:

void

public setChildChangedCallback(callback: Function): void source

Set the callback triggered when dataSource changes a data element.

Override:

DataSource#setChildChangedCallback

Params:

NameTypeAttributeDescription
callback Function

Callback function to call when a child is changed.

Return:

void

public setChildMovedCallback(callback: Function): void source

Set the callback triggered when dataSource moves a data element.

Override:

DataSource#setChildMovedCallback

Params:

NameTypeAttributeDescription
callback Function

Callback function to call when a child is moved.

Return:

void

public setChildRemovedCallback(callback: Function): void source

Set the callback triggered when dataSource removes a data element.

Override:

DataSource#setChildRemovedCallback

Params:

NameTypeAttributeDescription
callback Function

Callback function to call when a child is removed.

Return:

void

public setPriority(newPriority: String | Number): void source

Sets the priority (ordering) of an object on a given dataSource.

Override:

DataSource#setPriority

Params:

NameTypeAttributeDescription
newPriority String | Number

New priority value to order data by.

Return:

void

public setValueChangedCallback(callback: Function): void source

Sets the callback triggered when dataSource updates the data.

Override:

DataSource#setValueChangedCallback

Params:

NameTypeAttributeDescription
callback Function

Callback function to call when the subscribed data value changes.

Return:

void

public setWithPriority(newData: Object, priority: String | Number): Promise source

Writes newData with given priority (ordering) to the path this dataSource was constructed with.

Override:

DataSource#setWithPriority

Params:

NameTypeAttributeDescription
newData Object

New data to set.

priority String | Number

Priority value by which the data should be ordered.

Return:

Promise

Resolves when write to server is complete.

public synced(): Promise source

Resolves when the DataSource is synchronized to the server

Override:

DataSource#synced

Return:

Promise

Resolves when the DataSource is synchronized

public toString(): String source

Returns the full path to this dataSource's source on the remote storage provider.

Override:

DataSource#toString

Return:

String

Full resource path.

public unauth(): void source

Logs out from the datasource, allowing to re-authenticate at a later time.

Override:

DataSource#unauth

Return:

void