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

Function sortByOwnerPrecedence

packages/core/sdk/src/executor.ts:1180–1185  ·  view source on GitHub ↗
(rows: readonly CoreRow<"plugin_storage">[])

Source from the content-addressed store, hash-verified

1178 const ownerRank = (owner: Owner): number => readOwners.indexOf(owner);
1179
1180 const sortByOwnerPrecedence = (rows: readonly CoreRow<"plugin_storage">[]) =>
1181 [...rows].sort((left, right) => {
1182 const l = ownerRank(left.owner as Owner);
1183 const r = ownerRank(right.owner as Owner);
1184 return l - r || left.key.localeCompare(right.key);
1185 });
1186
1187 const getVisible = <T>(collection: string, key: string) =>
1188 input.core.findMany("plugin_storage", { where: whereFor(collection, key) }).pipe(

Callers 3

getVisibleFunction · 0.85
queryCollectionFunction · 0.85
makePluginStorageFacadeFunction · 0.85

Calls 1

ownerRankFunction · 0.70

Tested by

no test coverage detected