@mica/sdk (SDK contract v1)
    Preparing search index...

    Function createPagedStore

    • A server-paged list over an add-on's own service, typed from its declaration (MICA-313).

      The declaration your server half registers, and the action that reads one page. Its output is addonOutput<{ rows: Row[]; nextCursor: … | null }>() — or addonOutput<Row[]>() for a list that is always one page — and Row, which needs an id: number, is the store's row type. The action is sent { ...filter, cursor, limit }, so it declares an optional cursor of the type nextCursor hands out, and a limit field if you set pageSize; whatever load(filter) adds must be declared too, or the server refuses it.

      const feed = createPagedStore(journal, 'page', { pageSize: 20 });
      

      At run time it is createPagedStore(action, { ...options, service: declaration.id }): the same store, through the same generic service route, refused by the shell for any id but your own.

      Type Parameters

      Parameters

      • declaration: D
      • action: PageEvent<D, A>
      • Optionaloptions: {
            pageSize?: "limit" extends | OptionalKeys<D["actions"][A]["input"]>
            | Exclude<
                keyof D["actions"][A]["input"],
                OptionalKeys<D["actions"][A]["input"]>,
            >
                ? number
                : `'${A}' must declare a 'limit' field to take a pageSize`;
        }
        • OptionalpageSize?: "limit" extends | OptionalKeys<D["actions"][A]["input"]>
          | Exclude<
              keyof D["actions"][A]["input"],
              OptionalKeys<D["actions"][A]["input"]>,
          >
              ? number
              : `'${A}' must declare a 'limit' field to take a pageSize`

          Sent as limit, so the action must declare a limit field to take it.

      Returns PagedStore<PageRow<AddonActionOutput<D, A>>>

    • A server-paged list: by NUI action name, by server action name with service: set, or through a reader function. See the module comment above.

      Type Parameters

      • T extends { id: number }

      Parameters

      • action: string | PageReader<T>

        The NUI action, the server action (with service: set), or the reader itself. A function is also what keeps server/__tests__/routes.test.ts's scanner from reading the name as a route nobody declared — there is no name to read.

      • Optionaloptions: PagedOptions

      Returns PagedStore<T>