Skip to content

Reconstruct any moment

AnalyticsHTTPSDKCLIMCPaggregateByFacetsasOfended_at

Pass a past instant and membership rebuilds the live set as it stood then, from the same rows, with no snapshot table.

The situation

A shipment was late last Tuesday. The question is what the packing floor looked like at 14:00 that day: how many orders were waiting at each station.

The recipe

reports/as-of.ts
const then = await lt.escalations.aggregateByFacets({
query: { roles: ['picking', 'packing', 'shipping'] },
groupBy: { columns: ['role'] },
measure: { kind: 'membership', asOf: '2026-10-14T14:00:00Z' },
distinctBy: 'orderId',
});
The same from a terminal
ltc esc aggregate-facets --roles '["picking","packing","shipping"]' \
--group-columns role --as-of 2026-10-14T14:00:00Z --distinct-by orderId

A row was live at an instant when created_at is at or before it and ended_at is after it or still null. Omit asOf for now.

The guarantee

The intervals are row truth: resolve stamps resolved_at and cancel or expire stamp the transition inside their guarded updates, and no write path touches a terminal row afterward. Past answers do not change, so past-anchored results are cached. A future asOf is a 400. Grouping by status uses the row’s status now, since status history is not stored. See Analytics.