import type { JsonValue } from 'type-fest';
export type AppsDbScope = 'user' | 'global';
export type AppsDbChunks = Map<string, string>;
export interface RawAppsDbEntry {
    id: string;
    storeId: string;
    value: string;
}
export type RawAppsDbValueMap = Map<RawAppsDbEntry['id'], RawAppsDbEntry['value']>;
export interface RawAppsDbEntryList {
    entries: RawAppsDbEntry[];
    cursor?: string;
}
export interface AppsDbEntry<T> extends Omit<RawAppsDbEntry, 'value'> {
    value: T;
}
/**
 * There is an issue with typescript (https://github.com/microsoft/TypeScript/issues/15300) where interfaces can't be
 * used if the function expects a `Scalar`. Define your interface as a type OR use the utility type `ToScalar` to
 * provide your interface with an index signature.
 *
 * @internal REMOVE SCALAR IN NEXT MAJOR AND RE EXPORT JsonValue
 */
export type Scalar = JsonValue;
/**
 * Utility type to provide your interface with an index signature.
 *
 * @example
 * ```typescript
 * import { Showpad } from '@showpad/experience-app-sdk'
 *
 * type PotatoType = {
 *   color: string
 * }
 *
 * interface PotatoInterface {
 *   color: string
 * }
 *
 * await Showpad.getStoreEntries<PotatoType>('potato-store')
 * await Showpad.getStoreEntries<Showpad.ToScalar<PotatoInterface>>('potato-store')
 * ```
 */
export type ToScalar<O extends object> = {
    [P in keyof O]: O[P] extends object ? ToScalar<O[P]> : O[P];
};
