Properties
dataSets

dataSets

An async function that returns a list of data sets to make available to the user.

Parameters

We will call this function with a single argument containing the following information;

type IdentityConfig = {
  dashboardAccess: {
    accessType: "standard" | "admin";
 
    organisationId: string;
 
    // Template dashboard ID
    dashboardId: string;
 
    // Unique identifier for the user
    userReference: string;
 
    // ISO 8601 format.
    expires: string;
 
    // Signature to verify this object hasn't been tampered with.
    // Use your Vizzly public key to verify this.
    signature: string;
  };
  dataAccess?: {
    dataSetIds: string[] | "*";
 
    // Secure filters which are sent with every query for
    // a given data set.
    secureFilters: {
      [dataSetId: string]: Array<Query.Filter>;
    };
 
    // ISO 8601 format.
    expires: string;
 
    // Signature to verify this object hasn't been tampered with.
    // Use your Vizzly public key to verify this.
    signature: string;
  };
};
🔒

Please note, that most of the values here are unverified and "peeked" from the JWT which is stored under the signature key. Therefore best security practice would be to pass only the signature back to your server, verify the JWT using your public key and then use the verified data to return the definitions of the data sets.

In this way, you can keep the definitions of the data sets secure.

Return value

From the loadDataSetsCallback function, you should return an array of data sets. If there is an error, you should return null.

Array<{
  // ID of the data set.
  id: string;
 
  // Public name of the data set, displayed to your users.
  name: string;
 
  // Fields that make up the data set.
  fields: Array<{
    // Unique constant that identifies this field.
    id: string;
 
    // Public name of the field, displayed to your users.
    publicName: string;
 
    // Data type of the field
    dataType: "number" | "boolean" | "string" | "date_time";
 
    // Can this field be used as a dimension? Default: true
    canBeDimension?: boolean;
 
    // Can this field be used as a measure? Default: true
    canBeMeasure?: boolean;
 
    // What date/time granularities can be used on this field
    // Note; only valid for fields with a dataType of `date_time`.
    allowedGranularities?: Array<
      "second" | "minute" | "hour" | "day" | "month" | "year"
    >;
  }>;
}>;