* Build subscription options for an alias based on whether it uses ordered * loading, is lazy, or should pass orderBy/limit hints.
(
alias: string,
isLazy: boolean,
orderByInfo: OrderByOptimizationInfo | undefined,
whereExpression: BasicExpression<boolean> | undefined,
)
| 795 | * loading, is lazy, or should pass orderBy/limit hints. |
| 796 | */ |
| 797 | private buildSubscriptionOptions( |
| 798 | alias: string, |
| 799 | isLazy: boolean, |
| 800 | orderByInfo: OrderByOptimizationInfo | undefined, |
| 801 | whereExpression: BasicExpression<boolean> | undefined, |
| 802 | ): { |
| 803 | includeInitialState?: boolean |
| 804 | whereExpression?: BasicExpression<boolean> |
| 805 | orderBy?: any |
| 806 | limit?: number |
| 807 | } { |
| 808 | // Ordered aliases explicitly disable initial state — data is loaded |
| 809 | // via requestLimitedSnapshot/requestSnapshot after subscription setup. |
| 810 | if (orderByInfo) { |
| 811 | return { includeInitialState: false, whereExpression } |
| 812 | } |
| 813 | |
| 814 | const includeInitialState = !isLazy |
| 815 | |
| 816 | // For unordered subscriptions, pass orderBy/limit hints so on-demand |
| 817 | // collections can optimise server-side fetching. |
| 818 | const hints = computeSubscriptionOrderByHints(this.query, alias) |
| 819 | |
| 820 | return { |
| 821 | includeInitialState, |
| 822 | whereExpression, |
| 823 | ...(hints.orderBy ? { orderBy: hints.orderBy } : {}), |
| 824 | ...(hints.limit !== undefined ? { limit: hints.limit } : {}), |
| 825 | } |
| 826 | } |
| 827 | |
| 828 | /** |
| 829 | * Request the initial ordered snapshot for an alias. |
no test coverage detected