MCPcopy Index your code
hub / github.com/simstudioai/sim / loadAllSelectorOptions

Function loadAllSelectorOptions

apps/sim/hooks/selectors/registry.ts:74–95  ·  view source on GitHub ↗
(
  definition: SelectorDefinition,
  args: SelectorQueryArgs
)

Source from the content-addressed store, hash-verified

72 * provides neither.
73 */
74export async function loadAllSelectorOptions(
75 definition: SelectorDefinition,
76 args: SelectorQueryArgs
77): Promise<SelectorOption[]> {
78 if (definition.fetchList) {
79 return definition.fetchList(args)
80 }
81
82 if (definition.fetchPage) {
83 const items: SelectorOption[] = []
84 let cursor: string | undefined
85 for (let page = 0; page < MAX_LOAD_ALL_PAGES; page++) {
86 const { items: pageItems, nextCursor } = await definition.fetchPage({ ...args, cursor })
87 items.push(...pageItems)
88 cursor = nextCursor
89 if (!cursor) break
90 }
91 return items
92 }
93
94 return []
95}
96
97export function mergeOption(options: SelectorOption[], option?: SelectorOption | null) {
98 if (!option) return options

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected