MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / listSubjects

Function listSubjects

packages/core/sdk/src/executor.ts:6875–6894  ·  view source on GitHub ↗
(
        options?: AdminListSubjectsOptions,
      )

Source from the content-addressed store, hash-verified

6873 };
6874
6875 const listSubjects = (
6876 options?: AdminListSubjectsOptions,
6877 ): Effect.Effect<readonly AdminSubject[], StorageFailure> => {
6878 // Always both, always integers — see `normalizeAdminPaging`. Passing
6879 // them through independently produced a bare OFFSET, which SQLite
6880 // rejects outright.
6881 const { limit, offset } = normalizeAdminPaging(options);
6882 return platformCore
6883 .findMany("subject", {
6884 // Oldest first, ties broken on the unique key so the order is
6885 // total and paging can't repeat or skip a row.
6886 orderBy: [
6887 ["created_at", "asc"],
6888 ["external_id", "asc"],
6889 ],
6890 limit,
6891 offset,
6892 })
6893 .pipe(Effect.map((rows) => rows.map(rowToAdminSubject)));
6894 };
6895
6896 // Keyed on `(tenant, external_id)` — the table's unique index. No
6897 // `tenant` clause here: the tenant policy adds it to every read, the

Callers 1

Calls 1

normalizeAdminPagingFunction · 0.85

Tested by

no test coverage detected