wire.data.DataSource

Use the DataSource class to create a connection to a data service.

Properties

Name

Type

Default

Description

Ajax

object

null

Ajax options used by the data source service provider to make calls to the data service if using jQuery Ajax.

Headers

object

null

Attached headers to the data service call. See Authentication for an example.

Model

object

null

Optional wire.data.DataModel to be used by the data source.

Provider

object

null

Configuration for the service provider used by the data source. This will be specific to the service provider. Visit Service Providers for details.

ServiceRoot

string

null

URL end point for the data service used by the data source.

Methods

Name

Description

allow

Returned from the service provider. See Allow details below.

cast

Static method that casts an object with the same data source properties into an instance of the DataSource class.

delete

Deletes data from a data service. See Writing Data Deletes for details.

deleteAsync

Deletes data from a data service. See Writing Data Deletes for details.

exec

Executes a query in a data service.

execAsync

Executes a query in a data service.

getResponseTable

Call into the service provider to transform data returned from a data service into a DataTable.

serviceProvider

Returns the service provider instance. Visit Service Providers for details.

test

Service provider must set allow().test for consumers to be sure testing the data service is supported.

useBasicAuth

Tells the service provider to use Basic authentication when calling into the data service

useBearerAuth

Tells the service provider to use Bearer authentication when calling into the data service

write

Use this method to update data in a data service. See Writing Data Updates for details.

writeAsync

Use this method to update data in a data service. See Writing Data Updates for details.

Authentication

Use the Headers property to attach headers to the data service call.

const token = "Ajb9fur9jgk9f6jr";

const source = new wire.data.DataSource("custom", {
    Headers: { Authorization: "Bearer " + token }
});

The example above uses a token with the Bearer authentication. Below is an example that uses Basic authentication with a user name and password.

const userName = "pdougherty";
const password = "Password21#$"

const source = new wire.data.DataSource("custom", {
    Headers: { Authorization: "Basic " + window.btoa(user + ":" + password) }
});

Allow

The allow method exposes certain aspects of functionality available in the service provider.

Name

Type

Default

Description

discover

boolean

false

Does the service provider allow meta data about data elements in the data service to be dynamically read.

tableQuery

boolean

true

Does the service provider support building queries using TableQuery.

tableQuery.orderBy

number

0

Does table query support include the orderBy function. 0 = does not support order by, 1 = order by on a single field is supported, 2 = order by supported on multiple fields.

tableQuery.groupBy

boolean

false

Does the service provider support the groupBy function.

test

boolean

false

Does the service provider support testing data service availability.

storedProcedure

boolean

false

Does the service provider support building queries using

Discover Methods

Use the following methods to read meta data about the data contained in a data service.

All the discover methods take a singe options parameter. This parameter will be specific to the service provider if applicable at all. See DataSource Discovery for examples. Visit the service provider documentation for details on discovery options.

Name

Description

discoverCatalogs

Returns the list of catalogs or databases from a data service using a synchronous call.

discoverCatalogsAsync

Returns the list of catalogs or databases from a data service using an asynchronous call.

discoverEntities

Returns the list of entities or tables from the database defined in the data service connection using a synchronous call.

discoverEntitiesAsync

Returns the list of entities or tables from the database defined in the data service connection using an asynchronous call.

discoverFields(config)

Returns the list of fields for an entity or table specified in config.entityusing a synchronous call.

discoverFieldsAsync(config)

Returns the list of fields for an entity or table specified in config.entityusing an asynchronous call.

discoverProcedures

Returns the list of stored procedures from the database defined in the data service connection using a synchronous call.

discoverProceduresAsync

Returns the list of stored procedures from the database defined in the data service connection using an asynchronous call.

discoverProcedureParameters

Returns the list of parameters for a stored procedure specified in config.procedureusing a synchronous call.

discoverProcedureParametersAsync(config)

Returns the list of parameters for a stored procedure specified in config.procedureusing an asynchronous call.

For more on data sources, visit Connecting to Data.

Last updated