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.

An inventory management app demonstrating number and boolean fields, category filtering, and bulkUpdateRecords for stocktake adjustments.

Schema

Entity: Items — key: items
FieldTypeNotes
nametextrequired
skutextrequired
categoryselectelectronics / furniture / supplies / other — required
quantitynumberrequired, min: 0
unit_pricenumbermin: 0
locationtext
is_low_stockboolean
last_restockeddate
notestextarea

Key Patterns

Boolean Filter

// Low stock only
filter.is_low_stock = { eq: true };

// In stock only
filter.is_low_stock = { eq: false };

Number Field Handling

Always convert form input strings to numbers before sending to the SDK — form inputs return strings even for type="number":
quantity: document.getElementById('quantity').value !== ''
  ? Number(document.getElementById('quantity').value)
  : null,

Bulk Stocktake Adjustment

Update multiple items at once after a stocktake. Check result.error per batch to handle partial failures:
const adjustments = [
  { id: '01JA...', data: { quantity: 45, is_low_stock: false } },
  { id: '01JB...', data: { quantity: 3,  is_low_stock: true  } },
  { id: '01JC...', data: { quantity: 0,  is_low_stock: true  } },
];

const result = await sdk.bulkUpdateRecords('items', adjustments);

if (result.error) {
  console.warn('Some updates failed:', result.error.details);
}

Low-Stock Indicator

const qtyClass = item.is_low_stock ? 'low' : 'ok';
// render: <span class="qty low">3 <span class="low-badge">LOW</span></span>