1import androidData from './android.json';
2import iosData from './ios.json';
3
4export type PermissionMeta = {
5  source: string;
6  scrapedAt: string;
7};
8
9export type AndroidPermission = {
10  /** The unique name of the permission. (e.g. "CAMERA" for "android.permission.CAMERA") */
11  name: string;
12  /** The full unique name of the permission. (e.g. "android.permission.CAMERA") */
13  constant: string;
14  /** A short description of the permission and what it provides. */
15  description: string;
16  /** A longer in-depth description of the permission and what it provides. */
17  explanation: string | null;
18  /** The Android protection level, indicates if its a system-granted or user-granted permission. */
19  protection: string | null;
20  /** A caution message for permissions which are replaced, deprecated, or requires special usage. */
21  warning: string | null;
22  /** The Android API where this permission was added. */
23  apiAdded: number;
24  /** The Android API where this permission was deprecated. */
25  apiDeprecated: number | null;
26  /** The unique name of the permission that replaces this permission. */
27  apiReplaced: string | null;
28};
29
30export type IOSPermission = {
31  /** The unique name of the permission. (e.g. "NSCameraUsageDescription") */
32  name: string;
33  /** A short description of the permission and what it provides. */
34  description: string;
35  /** A caution message for permissions which are replaced, deprecated, or requires special usage. */
36  warning: string | null;
37  /** The iOS framework where this permission belongs to. */
38  framework: string;
39  /** String containing OS and version key/value pairs where this permission was added. (separated by two spaces) */
40  apiAdded: string;
41  /** A boolean if this permission is deprecated or not. */
42  apiDeprecated: boolean;
43};
44
45/**
46 * Permissions can be referenced by direct name, or object with overwrites to display.
47 */
48export type PermissionReference<T extends { name: string }> =
49  | string
50  | ({ name: T['name'] } & Partial<Omit<T, 'name'>>);
51
52type DataSet<P> = { meta: PermissionMeta; data: Record<string, P> };
53
54const { meta: androidMeta, data: androidPermissions }: DataSet<AndroidPermission> = androidData;
55const { meta: iosMeta, data: iosPermissions }: DataSet<IOSPermission> = iosData;
56
57export { androidMeta, androidPermissions, iosMeta, iosPermissions };
58