// (C) 2019-2024 GoodData Corporation
/**
 * Tiger actions utility functions
 *
 * @internal
 */
export class ActionsUtilities {
    /**
     * Loads all items of the paginated endpoint.
     *
     * @param promiseFactory - promise factory
     * @param options - change defaults eg size
     * @returns
     */
    static loadAllPages = async (promiseFactory, options = { size: 1000 }) => {
        const results = [];
        const size = options.size;
        let page = 0;
        let lastPageSize = size;
        while (lastPageSize === size) {
            const result = await promiseFactory({
                page,
                size,
            });
            results.push(...result);
            lastPageSize = result.length;
            page++;
        }
        return results;
    };
}
//# sourceMappingURL=actionsUtilities.js.map