/** * Resolve "the rows" from any CLEO operation payload (T12077). * * The key list itself lives in `@cleocode/contracts` as const data * ({@link COLLECTION_KEYS}); this module holds the runtime helper, because * `packages/contracts` is types-only (architectural Gate 10). * * See the contracts module for the three separate outages that motivated a * shared SSoT — most severely the sentient loop, which read `data.tasks` from * an SDK call returning bare `{results, total}` and therefore picked zero * tasks on every tick for three months while reporting "no unblocked tasks * available". * * @task T12077 */ /** * Resolve the first list-shaped collection on a payload. * * Accepts BOTH the enveloped shape (`{data: {results: […]}}`) and the bare * shape the SDK returns (`{results: […]}`). Confusing those two is precisely * what made the sentient loop inert, so this helper deliberately handles both * rather than making each caller guess which surface it is holding. * * @param payload - an operation response, enveloped or bare. * @returns the matching array, or `undefined` when the payload carries none. * * @example * ```ts * pickCollection({ results: [{ id: 'T1' }], total: 1 }); // → [{ id: 'T1' }] * pickCollection({ data: { tasks: [{ id: 'T2' }] } }); // → [{ id: 'T2' }] * pickCollection({ total: 0 }); // → undefined * ``` * * @task T12077 */ export declare function pickCollection(payload: unknown): unknown[] | undefined; /** * Typed convenience wrapper over {@link pickCollection}. * * @param payload - an operation response, enveloped or bare. * @returns the rows cast to `T[]`, or an empty array when absent. * * @example * ```ts * const tasks = collectionOf(await cleo.tasks.find({ status: 'pending' })); * ``` * * @task T12077 */ export declare function collectionOf(payload: unknown): T[]; //# sourceMappingURL=collection.d.ts.map