Define source views with natural language or structured filters, sync them, and browse results
const view = await airstore.views.create('ws_abc123', { integration: 'gmail', name: 'Unread Emails', guidance: 'unread emails from the inbox',})console.log(view.path) // "/sources/gmail/Unread Emails"
A source view is a materialized query over a connected integration. You describe what data you want — either in natural language or with a structured filter — and Airstore fetches matching results as files in the virtual filesystem.
Query mode uses structured filter objects — no LLM involved. When you pass a filter instead of guidance, the view is automatically created in query mode.
Source views are materialized — results are cached for fast reads. Call sync() to re-execute the query and pick up new data from the source:
const result = await airstore.views.sync('ws_abc123', 'view_abc123')console.log(result.results_count) // total results after syncconsole.log(result.new_results) // newly discovered since last sync
Syncing is idempotent and safe to call repeatedly. Views also sync automatically in the background, but you can trigger a manual sync when freshness matters — for example, right before an agent reads the data.
Once created, use the filesystem methods to read the view’s files:
// List files in the viewconst files = await airstore.fs.list('ws_abc123', { path: view.path })for (const file of files) { console.log(`${file.name} (${file.size} bytes)`)}// Read a fileconst content = await airstore.fs.read('ws_abc123', { path: `${view.path}/${files[0].name}`,})
There may be a short delay between creating a view and its contents appearing. If the view is empty right after creation, wait a few seconds and try again — or call sync() explicitly.