import React, { FC } from 'react'; import { PasswordPolicy, PangeaDataGridProps } from '@pangeacyber/react-mui-shared'; import { GridColDef } from '@mui/x-data-grid'; import { SnackbarProps } from '@mui/material/Snackbar'; import { AlertProps } from '@mui/material/Alert'; import dayjs from 'dayjs'; interface AlertsSnackbarProps { SnackbarProps?: Partial; AlertProps?: Partial; } interface PangeaResponse { request_id: string; status: string; summary: string; result: T; } interface PangeaError { request_id: string; summary: string; status: string; } interface StoreProxyApiRef { list: ((data: ObjectStore.ListRequest) => Promise>) | undefined; get: ((data: ObjectStore.GetRequest) => Promise>) | undefined; buckets?: ((data: ObjectStore.BucketsRequest) => Promise>) | undefined; getArchive?: ((data: ObjectStore.GetArchiveRequest) => Promise>) | undefined; share?: { list?: (data: ObjectStore.ListRequest) => Promise>; get?: (data: ObjectStore.ShareGetRequest) => Promise>; delete?: (data: ObjectStore.ShareDeleteRequest) => Promise; create?: (data: ObjectStore.ShareCreateRequest) => Promise>; send?: (data: ObjectStore.ShareSendRequest) => Promise>; }; delete?: (data: ObjectStore.DeleteRequest) => Promise>; update?: (data: ObjectStore.UpdateRequest) => Promise>; upload?: (data: FormData, contentType: "multipart/form-data") => Promise>; folderCreate?: (data: ObjectStore.FolderCreateRequest) => Promise>; } interface StoreConfigurations { passwordPolicy?: PasswordPolicy; alerts?: { displayAlertOnError: boolean; AlertSnackbarProps?: AlertsSnackbarProps; }; settings?: { defaultAccessCount?: number; maxAccessCount?: number; maxDate?: dayjs.Dayjs; defaultExpiresAt?: Date; }; sender?: { email: string; name?: string; }; } declare namespace ObjectStore { interface Filter { created_at?: string; created_at__gt?: string; created_at__gte?: string; created_at__lt?: string; created_at__lte?: string; updated_at?: string; updated_at__gt?: string; updated_at__gte?: string; updated_at__lt?: string; updated_at__lte?: string; type?: string; type__contains?: string[]; type__in?: string[]; id?: string; id__contains?: string[]; id__in?: string[]; name?: string; name__contains?: string[]; name__in?: string[]; parent_id?: string; parent_id__contains?: string[]; parent_id__in?: string[]; path?: string; path__contains?: string[]; path__in?: string[]; tags?: string[]; [key: string]: any; } /** * type APIListInput struct { Filter json.RawMessage `json:"filter"` Last []byte `json:"last"` // Last field for pagination. Limit int `json:"limit"` // Maximum results to return in the first page. Order string `json:"order"` // asc, desc OrderBy string `json:"order_by"` // billable_size, created_at, md5_hex, owner, sha256_hex, size, type, updated_at } */ interface ListRequest { bucket_id?: string; filter?: Filter; last?: string; limit?: number; order?: string; order_by?: string; } interface ShareSendParams { sender_email: string; sender_name?: string; } interface SingleShareCreateRequest { bucket_id?: string; targets?: string[]; link_type: string; expires_at?: string; max_access_count?: number; authenticators?: ShareAuthenticator[]; title?: string; message?: string; send_params?: ShareSendParams; } interface ShareLinkToSend { id: string; email: string; } interface ShareSendRequest { bucket_id?: string; links: ShareLinkToSend[]; sender_email: string; sender_name?: string; } interface ShareSendResponse { share_link_objects: ShareObjectResponse[]; } interface ShareCreateRequest { bucket_id?: string; links: SingleShareCreateRequest[]; } interface ShareGetRequest { bucket_id?: string; id: string; } interface ShareDeleteRequest { ids: string[]; } interface ShareResponse { object: ShareObjectResponse; } interface ShareListRequest { bucket_id?: string; filter?: Filter; last?: string; limit?: number; order?: string; order_by?: string; } enum ShareAuthenticatorType { Email = "email_otp", Sms = "sms_otp", Password = "password" } interface ShareAuthenticator { auth_type: string; auth_context: string; recipient_email?: string; phone_number?: string; } interface Recipient { phone_number: string; email: string; } interface ShareObjectResponse { id: string; targets?: string[]; link_type?: string; access_count?: number; max_access_count?: number; created_at: string; expires_at: string; last_accessed_at: string; authenticators?: ShareAuthenticator[]; link?: string; recipient_email?: string; sender_email?: string; sender_name?: string; storage_pool_id?: string; } interface ShareGetResponse { share_link_object: ShareObjectResponse; } interface SharesObjectResponse { share_link_objects: ShareObjectResponse[]; } enum ShareLinkType { Upload = "upload", Download = "download", Editor = "editor" } interface ShareListResponse { count: number; last: string; share_link_objects: ShareObjectResponse[]; } /** * type APIListInput struct { Filter json.RawMessage `json:"filter"` Last []byte `json:"last"` // Last field for pagination. Limit int `json:"limit"` // Maximum results to return in the first page. Order string `json:"order"` // asc, desc OrderBy string `json:"order_by"` // billable_size, created_at, md5_hex, owner, sha256_hex, size, type, updated_at } type APIListOutputObject struct { BillableSize int64 `json:"billable_size"` CreatedAt time.Time `json:"created_at"` ID string `json:"id"` MD5Hex string `json:"md5_hex"` Metadata map[string]string `json:"metadata"` Name string `json:"name"` Owner string `json:"owner"` ParentID string `json:"parent_id,omitempty"` SHA256Hex string `json:"sha256_hex"` SHA512Hex string `json:"sha512_hex"` Size int64 `json:"size"` Tags []string `json:"tags"` Type string `json:"type"` UpdatedAt time.Time `json:"updated_at"` } */ enum ObjectType { Folder = "folder", File = "file" } interface ObjectResponse { id: string; name: string; owner?: string; created_at: string; updated_at: string; parent_id?: string; folder?: string; path?: string; billable_size: number; size: number; md5_hex?: string; sha256_hex?: string; sha512_hex?: string; metadata?: Record; tags?: string[]; type: string | ObjectType; dest_url?: string; metadata_protected?: { format?: string; mimetype?: string; "vault-password-algorithm"?: string; }; format?: string; mimetype?: string; "vault-password-algorithm"?: string; } interface ListResponse { count: number; last: string; objects: ObjectResponse[]; } /** * multi-part upload request * type APIPutInput struct { ID string `json:"id"` // NOTE: No way to accept bucket here, it comes from service config -> resource. Name string `json:"name"` ParentID string `json:"parent_id"` Path string `json:"path"` MD5 []byte `json:"md5"` MD5Hex string `json:"md5_hex"` Metadata map[string]string `json:"metadata"` SHA256 []byte `json:"sha256"` SHA256Hex string `json:"sha256_hex"` SHA512 []byte `json:"sha512"` SHA512Hex string `json:"sha512_hex"` Size *int64 `json:"size"` Tags []string `json:"tags"` Type string `json:"type"` // dir, file } */ interface PutRequest { bucket_id?: string; id?: string; name: string; parent_id?: string; path?: string; metadata?: Record; tags?: string[]; type?: string; size?: number; password?: string; password_algorithm?: "AES-CFB-128" | "AES-CFB-256"; } interface PutResponse { object: ObjectResponse; } /** * type APIFolderCreateInput struct { Name string `json:"name"` ParentID string `json:"parent_id"` Path string `json:"path"` Metadata map[string]string `json:"metadata"` Tags []string `json:"tags"` } type APIFolderCreateOutput struct { Object APIObject `json:"object"` } */ interface FolderCreateRequest { bucket_id?: string; name: string; path?: string; parent_id?: string; metadata?: Record; tags?: string[]; } interface FolderCreateResponse { object: ObjectResponse; } interface UpdateRequest { bucket_id?: string; id: string; name?: string; parent_id?: string; path?: string; metadata?: Record; tags?: string[]; add_password?: string; add_password_algorithm?: "AES-CFB-128" | "AES-CFB-256"; remove_password?: string; } interface UpdateResponse { } interface DeleteRequest { bucket_id?: string; id?: string; path?: string; force?: boolean; } interface DeleteResponse { count: number; objects: ObjectResponse; } /** * type APIGetInput struct { ID string `json:"id"` Path string `json:"path"` TransferMethod string `json:"transfer_method"` // direct, multipart } */ interface GetRequest { bucket_id?: string; id: string; path?: string; transfer_method?: string; password?: string; } interface GetResponse { dest_url?: string; object: ObjectResponse; } interface GetArchiveRequest { bucket_id?: string; ids: string[]; format?: string; transfer_method?: string; } interface GetArchiveResponse { dest_url: string; objects: ObjectResponse[]; } interface BucketsRequest { } interface BucketInfo { id: string; name: string; transfer_methods?: string[]; default?: boolean; } interface BucketsResponse { buckets: BucketInfo[]; } } type StoreDataGridColumns = "id" | "name" | "updated_at" | "size"; interface StoreDataGridCustomizations { columnOverrides: Partial>>; } interface StoreDataGridProps { defaultVisibilityModel?: Record; defaultColumnOrder?: string[]; includeIdColumn?: boolean; customizations?: StoreDataGridCustomizations; virtualRoot?: boolean; PangeaDataGridProps?: Partial>; } interface StoreFileViewerProviderProps { children?: React.ReactNode; apiRef: StoreProxyApiRef; configurations?: StoreConfigurations; defaultFilter?: ObjectStore.Filter; defaultSort?: "asc" | "desc"; defaultSortBy?: keyof ObjectStore.ObjectResponse; defaultShareLinkTitle?: string; } interface StoreFileViewerProps extends StoreDataGridProps, StoreFileViewerProviderProps { virtualRoot?: boolean; } declare const StoreFileViewer: FC; declare const StoreDownloadFileViewer: FC; export { ObjectStore, type PangeaError, type PangeaResponse, type StoreConfigurations, type StoreDataGridColumns, type StoreDataGridCustomizations, StoreDownloadFileViewer, StoreFileViewer, type StoreFileViewerProps, type StoreProxyApiRef };