Merge branch 'IDTEAM-1.26.0' into 'main'
[ProtonMail-WebClient.git] / packages / pass / store / actions / requests.ts
blobf6c1ac1192d4596d48d4bd3aa5f0e5f548e157d1
1 import type { SelectedItem } from '@proton/pass/types';
3 import { type EndpointOptions } from './enhancers/endpoint';
5 export const withKey = (base: string) => (key: string | number) => `${base}::${key}`;
6 export const selectedItemKey = ({ shareId, itemId }: SelectedItem) => `${shareId}::${itemId}`;
7 export const intKey = (value: number) => value.toString();
9 const withItemKey = (base: string) => (shareId: string, itemId: string) => `${base}::${shareId}::${itemId}`;
11 export const bootRequest = () => 'worker::boot';
12 export const syncRequest = () => 'worker::sync';
13 export const channelRequest = withKey(`worker::channel`);
14 export const wakeupRequest = ({ endpoint, tabId }: EndpointOptions) => `worker::wakeup-${endpoint}-${tabId}`;
16 export const itemPinRequest = withItemKey(`item::pin`);
17 export const itemUnpinRequest = withItemKey(`item::unpin`);
18 export const itemRevisionsRequest = withItemKey(`item::revisions`);
19 export const itemsImportRequest = () => `items::import`;
20 export const itemsBulkMoveRequest = () => `items::bulk::move`;
21 export const itemsBulkTrashRequest = () => `items::bulk::trash`;
22 export const itemsBulkDeleteRequest = () => `items::bulk::delete`;
23 export const itemsBulkRestoreRequest = () => `items::bulk::restore`;
25 export const vaultCreateRequest = withKey(`vault::create`);
26 export const vaultEditRequest = withKey(`vault::edit`);
27 export const vaultDeleteRequest = withKey(`vault::delete`);
28 export const vaultMoveAllItemsRequest = withKey(`vault::move::all::items`);
29 export const vaultTransferOwnerRequest = withKey(`vault::transfer:owner`);
30 export const trashEmptyRequest = () => `trash::empty`;
31 export const trashRestoreRequest = () => `trash::restore`;
33 export const lockCreateRequest = () => `auth::lock::create`;
35 export const settingsEditRequest = withKey(`settings::edit`);
37 export const aliasOptionsRequest = withKey(`alias::options`);
38 export const aliasDetailsRequest = withKey(`alias::details`);
40 export const shareRemoveMemberRequest = withKey(`share::members::remove`);
41 export const shareEditMemberRoleRequest = withKey(`share::members::edit-role`);
42 export const shareLeaveRequest = withKey(`share::leave`);
44 export const inviteCreateRequest = withKey(`invite::create`);
45 export const inviteResendRequest = withKey(`invite::resend`);
46 export const inviteAcceptRequest = withKey(`invite::accept`);
47 export const inviteRejectRequest = withKey(`invite::reject`);
48 export const inviteRemoveRequest = withKey(`invite::remove`);
49 export const inviteRecommendationsRequest = withKey(`invite::recommendations`);
50 export const inviteAddressesValidateRequest = withKey(`invite::addresses::validate`);
51 export const newUserInvitePromoteRequest = withKey(`new-user-invite::promote`);
52 export const newUserInviteRemoveRequest = withKey(`new-user-invite::remove`);
54 export const userAccessRequest = withKey(`user::access`);
55 export const userFeaturesRequest = withKey(`user::features`);
56 export const reportBugRequest = withKey(`report::bug`);