wire.data.DataSource

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

Properties

Name

Type

Default

Description

Ajax

object

null

Headers

object

null

Model

object

null

Provider

object

null

ServiceRoot

string

null

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

Methods

Name

Description

allow

cast

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

delete

deleteAsync

exec

Executes a query in a data service.

execAsync

Executes a query in a data service.

getResponseTable

serviceProvider

test

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

writeAsync

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

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