Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.usehasp.com/llms.txt

Use this file to discover all available pages before exploring further.

getBootstrap(signal?)

Returns context about the current user, their role, the app, and plan limits. Call this once during initialization and cache the result — it does not change mid-session.
const bootstrap = await sdk.getBootstrap();

// bootstrap.user   — { id, name, email }
// bootstrap.role   — 'viewer' | 'org_admin_viewer' | 'editor' | 'admin'
// bootstrap.app    — { id, name, type }
// bootstrap.limits — { maxPageSize, maxRecordCount, rateLimitPerMinute }

Role

Use bootstrap.role to conditionally show or hide editing controls:
const canEdit = ['editor', 'admin'].includes(bootstrap.role);
const isAdmin = bootstrap.role === 'admin';
See Roles & Permissions for the full role capability matrix, and the Role-Based UI guide for patterns.

User

Use bootstrap.user to personalise the UI or pre-fill the current user’s details:
document.getElementById('welcome').textContent = `Hello, ${bootstrap.user.name}`;

Limits

bootstrap.limits is a key-value map of plan limits for the authenticated user:
KeyDescription
maxPageSizeMaximum allowed pageSize for listRecords
maxRecordCountMaximum records allowed per app on this plan
rateLimitPerMinuteAPI requests allowed per minute
const { maxRecordCount } = bootstrap.limits;
if (currentCount >= maxRecordCount) {
  showMessage('Record limit reached. Contact your admin to upgrade.');
}
getBootstrap() is a read operation and is allowed during maintenance mode.

getSchema(signal?)

Returns the entity schema for the current app — all entities and their fields. Use this for dynamic form rendering or runtime field discovery.
const schema = await sdk.getSchema();
// schema.data — SchemaEntity[]

SchemaEntity

{
  key: string,           // e.g. 'tasks'
  name: string,          // e.g. 'Tasks'
  display_field: string | null,
  fields: SchemaField[],
}

SchemaField

{
  key: string,           // e.g. 'status'
  name: string,          // e.g. 'Status'
  type: string,          // e.g. 'select'
  required: boolean,
  read_only: boolean,
  options: string[] | null,  // only set for select / multi_select fields
  sort_order: number,
}

Example — dynamic form rendering

const schema = await sdk.getSchema();
const tasksEntity = schema.data.find(e => e.key === 'tasks');

tasksEntity.fields.forEach(field => {
  if (field.type === 'select') {
    renderSelectField(field.key, field.name, field.options, field.required);
  } else if (field.type === 'text') {
    renderTextField(field.key, field.name, field.required);
  }
});
See Field Types for all field type strings and their stored formats. getSchema() is a read operation and is allowed during maintenance mode.