/*! * @license * Copyright Squiz Australia Pty Ltd. All Rights Reserved. */ import { AttributeValue } from '@aws-sdk/client-dynamodb'; import { PageQuery } from '../model/PageQuery'; import { PaginationInfo } from '../model/PaginationInfo'; import { PaginationLinks, PaginationTokens } from '../model/PaginationLinks'; import { PaginationFormattedResponse, PaginationResponse } from '../model/PaginationResponse'; /** * Decode the token string included in a pagination query parameter. * @param {string} token A base64 encoded token string. * @returns {Record} The decoded token item. */ export declare const decodeTokenString: (token: string) => Record; /** * Convert a DynamoDB LastEvaluatedKey into a base64 encoded token string. * @param {SettingsPrimaryKey} lastEvaluatedKey The LastEvaluatedKey returned from a dynamo query. * @returns {string} The encoded string. */ export declare const encodeTokenString: (lastEvaluatedKey: T) => string; /** * Get the pagination info from the page query param. * @param {string} requestUrl The URL for the request. * @param {PageQuery} page The page query param object. * @returns {PaginationInfo} The pagination info. */ export declare const getPaginationInfo: (requestUrl: string, page: PageQuery) => PaginationInfo; /** * Generate the pagination links for a response. * @param {string} requestUrl The URL of the request. * @param {PaginationTokens} tokens The next/prev tokens. * @returns {PaginationLinks} The pagination links. */ export declare const getPaginationLinks: (requestUrl: string, tokens: PaginationTokens) => PaginationLinks; /** * Remove specified query params from a URL string. * @param {Array} keys The keys for each param to remove. * @param {string} requestUrl The URL of the request. * @returns {string} The updated URL. */ export declare const removeParamsByName: (keys: Array, requestUrl: string) => string; /** * Validate token corresponds to a valid DynamoDB primary key. * @param {string | null} token The token to validate. */ export declare const validateTokenHasCorrectFormat: (token: string | null) => void; export declare const getFormattedResponse: (results: PaginationResponse) => PaginationFormattedResponse;