mirror of
https://github.com/morluto/rea
synced 2026-10-28 15:07:26 -04:00
e38a4c4394
Keep operation and slice defaults compact; preserve exact input slots and phi edges, distinguish unretained seeds, and align advertised relation schemas with runtime validation. Pin a seeded wide-PHI model task after real public MCP verification. Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
29 lines
829 B
JavaScript
29 lines
829 B
JavaScript
import { pageFacts } from "./fact-reads.mjs";
|
|
import { requireFact } from "./native-contract.mjs";
|
|
|
|
export const nativePage = (
|
|
rows,
|
|
input = {},
|
|
identity = ["id", "origin_address", "block"],
|
|
) => pageFacts(rows, { offset: 0, limit: 20, ...input }, identity);
|
|
export const uniqueNative = (rows) => {
|
|
const index = new Map();
|
|
for (const row of rows) {
|
|
requireFact(!index.has(row.id), `Duplicate native identity ${row.id}`);
|
|
index.set(row.id, row);
|
|
}
|
|
return index;
|
|
};
|
|
export const readNativeIdentities = (index, input, filter = () => true) => ({
|
|
...nativePage(
|
|
(input.ids
|
|
? [...new Set(input.ids)].flatMap((id) => index.get(id) ?? [])
|
|
: [...index.values()]
|
|
).filter(filter),
|
|
input,
|
|
),
|
|
missing: input.ids
|
|
? [...new Set(input.ids)].filter((id) => !index.has(id))
|
|
: [],
|
|
});
|