TagSpaces is an offline, open source, document manager with tagging support
refactoring interfaces (#1421)
Stanimir633d8bf93d69
diff --git a/app/components/DirectoryTreeView.tsx b/app/components/DirectoryTreeView.tsxindex 191a4c300..f7ea4ef6b 100644--- a/app/components/DirectoryTreeView.tsx+++ b/app/components/DirectoryTreeView.tsx@@ -19,17 +19,18 @@import React, { useState, forwardRef, useImperativeHandle, Ref } from 'react';import Table from 'rc-table';import FolderIcon from '@material-ui/icons/FolderOpen';-import { Location, locationType } from '-/reducers/locations';import DragItemTypes from '-/components/DragItemTypes';import AppConfig from '-/config';import PlatformIO from '-/services/platform-io';import TargetTableMoveFileBox from '-/components/TargetTableMoveFileBox';import { getLocationPath } from '-/utils/paths';+import { TS } from '-/tagspaces.namespace';+import { locationType } from '-/utils/misc';interface Props {classes: any;loadDirectoryContent: (path: string) => void;- location: Location;+ location: TS.Location;data?: any;isReadOnlyMode?: boolean;showUnixHiddenEntries: boolean;@@ -39,11 +40,11 @@ interface Props {autohide: boolean) => void;handleFileMoveDrop: (item, monitor) => void;- changeLocation: (loc: Location) => void;+ changeLocation: (loc: TS.Location) => void;}export interface DirectoryTreeViewRef {- changeLocation: (location: Location) => void;+ changeLocation: (location: TS.Location) => void;closeLocation: () => void;// removeLocation: () => void;}@@ -54,7 +55,7 @@ const DirectoryTreeView = forwardRef(const [isExpanded, setExpanded] = useState(false);useImperativeHandle(ref, () => ({- changeLocation(location: Location) {+ changeLocation(location: TS.Location) {if (isExpanded && data[location.uuid] !== undefined) {setData(undefined); // comment this to use cached data after expandsetExpanded(false);@@ -189,7 +190,7 @@ const DirectoryTreeView = forwardRef(}];- const loadSubDirectories = (location: Location, deepLevel: number) => {+ const loadSubDirectories = (location: TS.Location, deepLevel: number) => {const subFolder = {...(location.accessKeyId && { accessKeyId: location.accessKeyId }),...(location.bucketName && { bucketName: location.bucketName }),diff --git a/app/components/EntryContainer.tsx b/app/components/EntryContainer.tsxindex 9b68dee3c..bbe2c025d 100644--- a/app/components/EntryContainer.tsx+++ b/app/components/EntryContainer.tsx@@ -45,7 +45,6 @@ import ConfirmDialog from '-/components/dialogs/ConfirmDialog';import AppConfig from '-/config';import PlatformIO from '-/services/platform-io';import AddRemoveTagsDialog from '-/components/dialogs/AddRemoveTagsDialog';-import { FileSystemEntry } from '-/services/utils-io';import i18n from '-/services/i18n';import {extractContainingDirectoryPath,@@ -69,6 +68,7 @@ import {actions as AppActions} from '-/reducers/app';import useEventListener from '-/utils/useEventListener';+import { TS } from '-/tagspaces.namespace';const defaultSplitSize = 103;const openedSplitSize = AppConfig.isElectron ? 560 : 360;@@ -183,7 +183,7 @@ interface Props {addTags: () => void;removeTags: () => void;// editTagForEntry: () => void;- openFsEntry: (fsEntry: FileSystemEntry) => void;+ openFsEntry: (fsEntry: TS.FileSystemEntry) => void;openPrevFile: (path: string) => void;openNextFile: (path: string) => void;openFileNatively: (path: string) => void;diff --git a/app/components/EntryProperties.tsx b/app/components/EntryProperties.tsxindex 9d340b420..be426ef69 100644--- a/app/components/EntryProperties.tsx+++ b/app/components/EntryProperties.tsx@@ -61,7 +61,7 @@ import TagDropContainer from './TagDropContainer';import ColorPickerDialog from './dialogs/ColorPickerDialog';import MoveCopyFilesDialog from './dialogs/MoveCopyFilesDialog';import i18n from '../services/i18n';-import { enhanceOpenedEntry, FileSystemEntryMeta } from '-/services/utils-io';+import { enhanceOpenedEntry } from '-/services/utils-io';import { formatFileSize, isPlusCode } from '-/utils/misc';import {extractContainingDirectoryPath,@@ -79,13 +79,13 @@ import {replaceThumbnailURLPromise,getThumbnailURLPromise} from '-/services/thumbsgenerator';-import { Tag } from '-/reducers/taglibrary';import { OpenedEntry, perspectives } from '-/reducers/app';import { savePerspective } from '-/utils/metaoperations';import MarkerIcon from '-/assets/icons/marker-icon.png';import Marker2xIcon from '-/assets/icons/marker-icon-2x.png';import MarkerShadowIcon from '-/assets/icons/marker-shadow.png';import ConfirmDialog from '-/components/dialogs/ConfirmDialog';+import { TS } from '-/tagspaces.namespace';const ThumbnailChooserDialog =Pro && Pro.UI ? Pro.UI.ThumbnailChooserDialog : false;@@ -182,8 +182,8 @@ interface Props {showNotification: (message: string) => void;updateOpenedFile: (entryPath: string, fsEntryMeta: any) => void;updateThumbnailUrl: (path: string, thumbUrl: string) => void;- addTags: (paths: Array<string>, tags: Array<Tag>) => void;- removeTags: (paths: Array<string>, tags: Array<Tag>) => void;+ addTags: (paths: Array<string>, tags: Array<TS.Tag>) => void;+ removeTags: (paths: Array<string>, tags: Array<TS.Tag>) => void;removeAllTags: (paths: Array<string>) => void;isReadOnlyMode: boolean;currentDirectoryPath: string | null;@@ -466,7 +466,7 @@ const EntryProperties = (props: Props) => {}};- const handleChange = (name: string, value: Array<Tag>, action: string) => {+ const handleChange = (name: string, value: Array<TS.Tag>, action: string) => {if (action === 'remove-value') {if (!value) {// no tags left in the select element@@ -528,7 +528,7 @@ const EntryProperties = (props: Props) => {const changePerspective = (event: any) => {const perspective = event.target.value;savePerspective(currentEntry.path, perspective)- .then((entryMeta: FileSystemEntryMeta) => {+ .then((entryMeta: TS.FileSystemEntryMeta) => {props.updateOpenedFile(currentEntry.path, {...entryMeta,changed: true@@ -586,7 +586,7 @@ const EntryProperties = (props: Props) => {shadowAnchor: [5, 55]});- function getGeoLocation(tags: Array<Tag>) {+ function getGeoLocation(tags: Array<TS.Tag>) {if (!Pro) {return;}diff --git a/app/components/FileUploadContainer.tsx b/app/components/FileUploadContainer.tsxindex 35f8b37ae..0bb30b757 100644--- a/app/components/FileUploadContainer.tsx+++ b/app/components/FileUploadContainer.tsx@@ -18,7 +18,7 @@import React, { forwardRef, Ref, useImperativeHandle, useRef } from 'react';import { Progress } from 'aws-sdk/clients/s3';-import { FileSystemEntry } from '-/services/utils-io';+import { TS } from '-/tagspaces.namespace';interface Props {directoryPath: string;@@ -27,7 +27,7 @@ interface Props {destination: string,onUploadProgress?: (progress: Progress, response: any) => void) => any;- reflectCreateEntries: (fsEntries: Array<FileSystemEntry>) => void;+ reflectCreateEntries: (fsEntries: Array<TS.FileSystemEntry>) => void;onUploadProgress: (progress: Progress, response: any) => void;toggleUploadDialog: () => void;toggleProgressDialog: () => void;diff --git a/app/components/FolderContainer.tsx b/app/components/FolderContainer.tsxindex a962c2807..f70422077 100644--- a/app/components/FolderContainer.tsx+++ b/app/components/FolderContainer.tsx@@ -42,7 +42,7 @@ import {getMaxSearchResults,getDesktopMode} from '-/reducers/settings';-import { getLocations, Location } from '-/reducers/locations';+import { getLocations } from '-/reducers/locations';import {actions as AppActions,getDirectoryContent,@@ -59,9 +59,10 @@ import { normalizePath, extractShortDirectoryName } from '-/utils/paths';import PlatformIO from '../services/platform-io';import LoadingLazy from '../components/LoadingLazy';import { Pro } from '../pro';-import { enhanceOpenedEntry, FileSystemEntry } from '-/services/utils-io';+import { enhanceOpenedEntry } from '-/services/utils-io';import AppConfig from '-/config';import RenameEntryDialog from '-/components/dialogs/RenameEntryDialog';+import { TS } from '-/tagspaces.namespace';const GridPerspective = React.lazy(() =>import(@@ -218,7 +219,7 @@ interface Props {renameFile: () => void;openDirectory: () => void;showInFileManager: () => void;- openFsEntry: (fsEntry: FileSystemEntry) => void;+ openFsEntry: (fsEntry: TS.FileSystemEntry) => void;reflectCreateEntry: (path: string, isFile: boolean) => void;loadDirectoryContent: (path: string) => void;loadParentDirectoryContent: () => void;diff --git a/app/components/LocationManager.tsx b/app/components/LocationManager.tsxindex 440eb8507..1b6ea6c22 100644--- a/app/components/LocationManager.tsx+++ b/app/components/LocationManager.tsx@@ -28,8 +28,7 @@ import ConfirmDialog from './dialogs/ConfirmDialog';import CustomLogo from './CustomLogo';import {actions as LocationActions,- getLocations,- Location+ getLocations} from '../reducers/locations';import { actions as AppActions } from '../reducers/app';import { getPerspectives, isDesktopMode } from '-/reducers/settings';@@ -38,6 +37,7 @@ import AppConfig from '../config';import LoadingLazy from '-/components/LoadingLazy';import LocationView from '-/components/LocationView';import { Pro } from '-/pro';+import { TS } from '-/tagspaces.namespace';const CreateEditLocationDialog = React.lazy(() =>import(@@ -53,16 +53,16 @@ const CreateEditLocationDialogAsync = props => (interface Props {classes: any;style: any;- locations: Array<Location>;+ locations: Array<TS.Location>;perspectives: Array<Object>;hideDrawer: () => void;openURLExternally: (path: string) => void;toggleOpenLinkDialog: () => void;setDefaultLocations: () => void;- addLocation: (location: Location, openAfterCreate?: boolean) => void;- addLocations: (locations: Array<Location>) => void;+ addLocation: (location: TS.Location, openAfterCreate?: boolean) => void;+ addLocations: (locations: Array<TS.Location>) => void;editLocation: () => void;- removeLocation: (location: Location) => void;+ removeLocation: (location: TS.Location) => void;isDesktop: boolean;}@@ -75,7 +75,7 @@ type SubFolder = {const LocationManager = (props: Props) => {const fileInputRef = useRef<HTMLInputElement>(null);- const [selectedLocation, setSelectedLocation] = useState<Location>(null);+ const [selectedLocation, setSelectedLocation] = useState<TS.Location>(null);const [isCreateLocationDialogOpened,setCreateLocationDialogOpeneddiff --git a/app/components/LocationView.tsx b/app/components/LocationView.tsxindex 71a2f20a4..302e6020d 100644--- a/app/components/LocationView.tsx+++ b/app/components/LocationView.tsx@@ -32,7 +32,6 @@ import CloudLocationIcon from '@material-ui/icons/CloudQueue';import DefaultLocationIcon from '@material-ui/icons/Highlight';import { Progress } from 'aws-sdk/clients/s3';import styles from './SidePanels.css';-import { locationType, Location } from '-/reducers/locations';import {actions as AppActions,getCurrentLocationId,@@ -47,16 +46,17 @@ import IOActions from '../reducers/io-actions';import DirectoryTreeView, {DirectoryTreeViewRef} from '-/components/DirectoryTreeView';-import { FileSystemEntry } from '-/services/utils-io';import { getShowUnixHiddenEntries } from '-/reducers/settings';import LocationContextMenu from '-/components/menus/LocationContextMenu';import { getLocationPath } from '-/utils/paths';+import { TS } from '-/tagspaces.namespace';+import { locationType } from '-/utils/misc';interface Props {classes: any;- location: Location;+ location: TS.Location;currentLocationId: string;- openLocation: (location: Location) => void;+ openLocation: (location: TS.Location) => void;loadDirectoryContent: (path: string) => void;setSelectedEntries: (selectedEntries: Array<Object>) => void;hideDrawer: () => void;@@ -71,17 +71,17 @@ interface Props {files: Array<string>,destination: string,onUploadProgress?: (progress: Progress, response: any) => void- ) => Promise<Array<FileSystemEntry>>;+ ) => Promise<Array<TS.FileSystemEntry>>;onUploadProgress: (progress: Progress, response: any) => void;- reflectCreateEntries: (fsEntries: Array<FileSystemEntry>) => void;+ reflectCreateEntries: (fsEntries: Array<TS.FileSystemEntry>) => void;toggleUploadDialog: () => void;moveFiles: (files: Array<string>, destination: string) => void;showUnixHiddenEntries: boolean;setEditLocationDialogOpened: (open: boolean) => void;setDeleteLocationDialogOpened: (open: boolean) => void;- selectedLocation: Location;- setSelectedLocation: (loc: Location) => void;- changeLocation: (loc: Location) => void;+ selectedLocation: TS.Location;+ setSelectedLocation: (loc: TS.Location) => void;+ changeLocation: (loc: TS.Location) => void;}const LocationView = React.memo((props: Props) => {@@ -180,7 +180,7 @@ const LocationView = React.memo((props: Props) => {props.resetProgress();props.uploadFiles(arrPath, targetPath, props.onUploadProgress)- .then((fsEntries: Array<FileSystemEntry>) => {+ .then((fsEntries: Array<TS.FileSystemEntry>) => {props.reflectCreateEntries(fsEntries);return true;})diff --git a/app/components/Search.tsx b/app/components/Search.tsxindex 7ba786074..9a3975893 100644--- a/app/components/Search.tsx+++ b/app/components/Search.tsx@@ -66,7 +66,7 @@ import {import { getMaxSearchResults } from '-/reducers/settings';import styles from './SidePanels.css';import i18n from '../services/i18n';-import { FileTypeGroups, SearchQuery } from '-/services/search';+import { FileTypeGroups } from '-/services/search';import { Pro } from '../pro';import SearchMenu from './menus/SearchMenu';import { formatDateTime, extractTimePeriod } from '-/utils/dates';@@ -74,6 +74,7 @@ import { isPlusCode, parseLatLon } from '-/utils/misc';import PlatformIO from '../services/platform-io';import { AppConfig } from '-/config';import { actions as SearchActions, getSearches } from '-/reducers/searches';+import { TS } from '-/tagspaces.namespace';const SaveSearchDialog = Pro && Pro.UI ? Pro.UI.SaveSearchDialog : false;@@ -81,21 +82,21 @@ interface Props {classes: any;style?: any;theme?: any;- searchLocationIndex: (searchQuery: SearchQuery) => void;+ searchLocationIndex: (searchQuery: TS.SearchQuery) => void;createLocationsIndexes: () => void;- searchAllLocations: (searchQuery: SearchQuery) => void;+ searchAllLocations: (searchQuery: TS.SearchQuery) => void;loadDirectoryContent: (path: string) => void;openURLExternally: (url: string) => void;hideDrawer?: () => void;- searchQuery: SearchQuery; // () => any;+ searchQuery: TS.SearchQuery; // () => any;setSearchResults: (entries: Array<any>) => void;- setSearchQuery: (searchQuery: SearchQuery) => void;+ setSearchQuery: (searchQuery: TS.SearchQuery) => void;currentDirectory: string;indexedEntriesCount: number;maxSearchResults: number;indexing: boolean;- searches: Array<SearchQuery>;- addSearches: (searches: Array<SearchQuery>) => void;+ searches: Array<TS.SearchQuery>;+ addSearches: (searches: Array<TS.SearchQuery>) => void;}const Search = React.memo((props: Props) => {@@ -122,7 +123,7 @@ const Search = React.memo((props: Props) => {props.searchQuery.lastModified ? props.searchQuery.lastModified : '');const [saveSearchDialogOpened, setSaveSearchDialogOpened] = useState<- SearchQuery+ TS.SearchQuery>(undefined);const [tagTimePeriod, setTagTimePeriod] = useState<string>('');const [tagTimePeriodHelper, setTagTimePeriodHelper] = useState<string>(' ');@@ -504,7 +505,7 @@ const Search = React.memo((props: Props) => {const executeSearch = () => {const { searchAllLocations, searchLocationIndex } = props;- const searchQuery: SearchQuery = {+ const searchQuery: TS.SearchQuery = {textQuery, // .current,tagsAND: props.searchQuery.tagsAND,tagsOR: props.searchQuery.tagsOR,@@ -1106,7 +1107,7 @@ const Search = React.memo((props: Props) => {{SaveSearchDialog && saveSearchDialogOpened !== undefined && (<SaveSearchDialogopen={saveSearchDialogOpened !== undefined}- onClose={(searchQuery: SearchQuery) => {+ onClose={(searchQuery: TS.SearchQuery) => {setSaveSearchDialogOpened(undefined);if (searchQuery) {if (searchQuery.searchBoxing === 'global') {diff --git a/app/components/TagContainer.tsx b/app/components/TagContainer.tsxindex 4fc39a915..1c52b9f5f 100644--- a/app/components/TagContainer.tsx+++ b/app/components/TagContainer.tsx@@ -24,32 +24,32 @@ import MoreVertIcon from '@material-ui/icons/MoreVert';import PlaceIcon from '@material-ui/icons/Place';import DateIcon from '@material-ui/icons/DateRange';import RemoveTagIcon from '@material-ui/icons/Close';-import { getAllTags, Tag, TagGroup } from '-/reducers/taglibrary';+import { getAllTags } from '-/reducers/taglibrary';import { getTagColor, getTagTextColor } from '-/reducers/settings';import { isPlusCode } from '-/utils/misc';import { isDateTimeTag } from '-/utils/dates';-import { FileSystemEntry } from '-/services/utils-io';+import { TS } from '-/tagspaces.namespace';interface Props {- tag: Tag;+ tag: TS.Tag;isReadOnlyMode?: boolean;- allTags?: Array<Tag>;+ allTags?: Array<TS.Tag>;defaultTextColor?: string;defaultBackgroundColor?: string;- tagGroup?: TagGroup;+ tagGroup?: TS.TagGroup;handleTagMenu?: (event: Object,- tag: Tag,- tagGroup: TagGroup | string+ tag: TS.Tag,+ tagGroup: TS.TagGroup | string) => void; // TODO refactor- handleRemoveTag?: (event: Object, tags: Array<Tag>) => void;+ handleRemoveTag?: (event: Object, tags: Array<TS.Tag>) => void;isDragging?: boolean;tagMode?: 'default' | 'display' | 'remove';entryPath?: string;deleteIcon?: Object;- addTags?: (paths: Array<string>, tags: Array<Tag>) => void;+ addTags?: (paths: Array<string>, tags: Array<TS.Tag>) => void;moveTag?: () => void;- selectedEntries?: Array<FileSystemEntry>;+ selectedEntries?: Array<TS.FileSystemEntry>;}const TagContainer = React.memo((props: Props) => {@@ -85,7 +85,7 @@ const TagContainer = React.memo((props: Props) => {title = title.substr(0, 8) + '...';}- allTags.some((currentTag: Tag) => {+ allTags.some((currentTag: TS.Tag) => {if (currentTag.title === title) {textColor = currentTag.textcolor;backgroundColor = currentTag.color;diff --git a/app/components/TagContainerDnd.tsx b/app/components/TagContainerDnd.tsxindex 1e7609691..771a24ad3 100644--- a/app/components/TagContainerDnd.tsx+++ b/app/components/TagContainerDnd.tsx@@ -22,8 +22,7 @@ import { DragSource, ConnectDragPreview, ConnectDragSource } from 'react-dnd';import { getEmptyImage } from 'react-dnd-html5-backend';import DragItemTypes from './DragItemTypes';import TagContainer from './TagContainer';-import { TagGroup, Tag, Uuid } from '-/reducers/taglibrary';-import { FileSystemEntry } from '-/services/utils-io';+import { TS } from '-/tagspaces.namespace';const boxSource = {beginDrag(props) {@@ -73,20 +72,20 @@ const boxSource = {};interface Props {- tag: Tag;- tagGroup?: TagGroup;- handleTagMenu: (event: Object, tag: Tag, param: any) => void;- handleRemoveTag?: (event: Object, tag: Tag) => void;+ tag: TS.Tag;+ tagGroup?: TS.TagGroup;+ handleTagMenu: (event: Object, tag: TS.Tag, param: any) => void;+ handleRemoveTag?: (event: Object, tag: TS.Tag) => void;isDragging?: boolean;tagMode?: 'default' | 'display' | 'remove';entryPath?: string;- addTags?: (paths: Array<string>, tags: Array<Tag>) => void;- addTag?: (tag: Tag, parentTagGroupUuid: Uuid) => void;+ addTags?: (paths: Array<string>, tags: Array<TS.Tag>) => void;+ addTag?: (tag: TS.Tag, parentTagGroupUuid: TS.Uuid) => void;moveTag?: () => void;connectDragSource?: ConnectDragSource;connectDragPreview?: ConnectDragPreview;deleteIcon?: Object;- selectedEntries: Array<FileSystemEntry>;+ selectedEntries: Array<TS.FileSystemEntry>;}const TagContainerDnd = (props: Props) => {diff --git a/app/components/TagDragPreview.tsx b/app/components/TagDragPreview.tsxindex 6a9055dbd..e6bed5b94 100644--- a/app/components/TagDragPreview.tsx+++ b/app/components/TagDragPreview.tsx@@ -1,9 +1,9 @@import React, { memo } from 'react';import TagContainer from '-/components/TagContainer';-import { Tag } from '-/reducers/taglibrary';+import { TS } from '-/tagspaces.namespace';export interface Props {- tag: Tag;+ tag: TS.Tag;}export const TagDragPreview = memo((props: Props) => {diff --git a/app/components/TagLibrary.tsx b/app/components/TagLibrary.tsxindex e3462ef74..8069ebf26 100644--- a/app/components/TagLibrary.tsx+++ b/app/components/TagLibrary.tsx@@ -44,12 +44,9 @@ import CustomLogo from './CustomLogo';import TagLibraryMenu from './menus/TagLibraryMenu';import TagGroupMenu from './menus/TagGroupMenu';import {- TagGroup,- Tag,actions as TagLibraryActions,getAllTags,- getTagGroups,- Uuid+ getTagGroups} from '../reducers/taglibrary';import TaggingActions from '../reducers/tagging-actions';import i18n from '../services/i18n';@@ -64,9 +61,9 @@ import {isReadOnlyMode} from '../reducers/app';import SmartTags from '../reducers/smart-tags';-import { FileSystemEntry } from '-/services/utils-io';import { AppConfig } from '-/config';import EditTagDialog from '-/components/dialogs/EditTagDialog';+import { TS } from '-/tagspaces.namespace';interface Props {classes: any;@@ -74,15 +71,15 @@ interface Props {isReadOnlyMode: boolean;tagTextColor: string;tagBackgroundColor: string;- tagGroups: Array<TagGroup>;- allTags: Array<Tag>;+ tagGroups: Array<TS.TagGroup>;+ allTags: Array<TS.Tag>;openURLExternally: (path: string) => void;toggleTagGroup: (uuid: string) => void;removeTagGroup: (uuid: string) => void;moveTagGroupUp: (uuid: string) => void;moveTagGroupDown: (uuid: string) => void;sortTagGroup: (uuid: string) => void;- collectTagsFromLocation: (tagGroup: TagGroup) => void;+ collectTagsFromLocation: (tagGroup: TS.TagGroup) => void;addTags: () => void;importTagGroups: () => void;exportTagGroups: () => void;@@ -91,13 +88,13 @@ interface Props {moveTag: () => void;editTagGroup: () => void;editTag: () => void;- deleteTag: (tagTitle: string, parentTagGroupUuid: Uuid) => void;+ deleteTag: (tagTitle: string, parentTagGroupUuid: TS.Uuid) => void;showNotification: (text: string,notificationType?: string, // NotificationTypesautohide?: boolean) => void;- selectedEntries: Array<FileSystemEntry>;+ selectedEntries: Array<TS.FileSystemEntry>;tagGroupCollapsed: Array<string>;}@@ -113,11 +110,11 @@ const TagLibrary = (props: Props) => {tagLibraryMenuAnchorEl,setTagLibraryMenuAnchorEl] = useState<null | HTMLElement>(null);- const [selectedTagGroupEntry, setSelectedTagGroupEntry] = useState<TagGroup>(- null- );+ const [selectedTagGroupEntry, setSelectedTagGroupEntry] = useState<+ TS.TagGroup+ >(null);// const [selectedTagEntry, setSelectedTagEntry] = useState<TagGroup>(null);- const [selectedTag, setSelectedTag] = useState<Tag>(null);+ const [selectedTag, setSelectedTag] = useState<TS.Tag>(null);const [isCreateTagGroupDialogOpened,setIsCreateTagGroupDialogOpened@@ -160,7 +157,11 @@ const TagLibrary = (props: Props) => {};const handleTagMenuCallback = useCallback(- (event: React.ChangeEvent<HTMLInputElement>, tag, tagGroup: TagGroup) => {+ (+ event: React.ChangeEvent<HTMLInputElement>,+ tag,+ tagGroup: TS.TagGroup+ ) => {handleTagMenu(event, tag, tagGroup);},[]@@ -169,7 +170,7 @@ const TagLibrary = (props: Props) => {const handleTagMenu = (event: React.ChangeEvent<HTMLInputElement>,tag,- tagGroup: TagGroup+ tagGroup: TS.TagGroup) => {if (!tagGroup.readOnly) {setTagMenuAnchorEl(event.currentTarget);@@ -267,7 +268,7 @@ const TagLibrary = (props: Props) => {data-tid={'tagGroupContainer_' + tagGroup.title}>{tagGroup.children &&- tagGroup.children.map((tag: Tag) => {+ tagGroup.children.map((tag: TS.Tag) => {if (props.isReadOnlyMode) {return (<TagContainerdiff --git a/app/components/TagsSelect.tsx b/app/components/TagsSelect.tsxindex 4b081eed7..b122fb24c 100644--- a/app/components/TagsSelect.tsx+++ b/app/components/TagsSelect.tsx@@ -22,10 +22,11 @@ import { connect } from 'react-redux';import { withStyles } from '@material-ui/core/styles';import TextField from '@material-ui/core/TextField';import Autocomplete from '@material-ui/lab/Autocomplete';-import { Tag, getAllTags } from '-/reducers/taglibrary';+import { getAllTags } from '-/reducers/taglibrary';import { getTagColor, getTagTextColor } from '-/reducers/settings';import TagContainer from './TagContainer';import EntryTagMenu from '-/components/menus/EntryTagMenu';+import { TS } from '-/tagspaces.namespace';const styles: any = (theme: any) => ({root: {@@ -68,13 +69,13 @@ interface Props {dataTid?: string;classes?: any;theme?: any;- tags: Array<Tag>;+ tags: Array<TS.Tag>;label?: string;tagSearchType?: string;defaultBackgroundColor?: string;defaultTextColor?: string;handleChange?: (param1: any, param2: any, param3?: any) => void;- allTags?: Array<Tag>;+ allTags?: Array<TS.Tag>;tagMode?: 'default' | 'display' | 'remove';isReadOnlyMode?: boolean;placeholderText?: string;@@ -92,7 +93,7 @@ const TagsSelect = (props: Props) => {function handleTagChange(event: Object,- selectedTags: Array<Tag>,+ selectedTags: Array<TS.Tag>,reason: string) {if (reason === 'select-option') {@@ -103,7 +104,7 @@ const TagsSelect = (props: Props) => {selectedTags.length &&isValidNewOption(selectedTags[selectedTags.length - 1], selectedTags)) {- const newTag: Tag = {+ const newTag: TS.Tag = {id: uuidv1(),title: '' + selectedTags[selectedTags.length - 1],color: defaultBackgroundColor,@@ -155,7 +156,7 @@ const TagsSelect = (props: Props) => {);const handleRemoveTag = useCallback(- (event, cTag: Array<Tag>) => {+ (event, cTag: Array<TS.Tag>) => {/* const reducedTags = [...tags];for (let i = 0; i < reducedTags.length; i += 1) {if (reducedTags[i].title === cTag.title) {@@ -186,8 +187,8 @@ const TagsSelect = (props: Props) => {disableClearablevalue={tags}onChange={handleTagChange}- renderTags={(value: Tag[]) =>- value.map((tag: Tag) => (+ renderTags={(value: TS.Tag[]) =>+ value.map((tag: TS.Tag) => (<TagContainerkey={selectedEntryPath + tag.title}isReadOnlyMode={props.isReadOnlyMode}diff --git a/app/components/TargetMoveFileBox.tsx b/app/components/TargetMoveFileBox.tsxindex a6c9c3089..7934d134a 100644--- a/app/components/TargetMoveFileBox.tsx+++ b/app/components/TargetMoveFileBox.tsx@@ -19,7 +19,7 @@import React from 'react';import { DropTarget } from 'react-dnd';import { withStyles } from '@material-ui/core/styles/index';-import { Location } from '-/reducers/locations';+import { TS } from '-/tagspaces.namespace';const styles: any = () => ({dropzone: {@@ -51,7 +51,7 @@ interface Props {connectDropTarget: any;children: Object;path?: string;- location?: Location;+ location?: TS.Location;}const TargetMoveFileBox = (props: Props) => {diff --git a/app/components/dialogs/AddRemoveTagsDialog.tsx b/app/components/dialogs/AddRemoveTagsDialog.tsxindex 415829d4b..21d6df4a4 100644--- a/app/components/dialogs/AddRemoveTagsDialog.tsx+++ b/app/components/dialogs/AddRemoveTagsDialog.tsx@@ -31,26 +31,26 @@ import FolderIcon from '@material-ui/icons/FolderOpen';import FileIcon from '@material-ui/icons/InsertDriveFileOutlined';import Typography from '@material-ui/core/Typography';import Dialog from '@material-ui/core/Dialog';-import { Tag } from '-/reducers/taglibrary';import TagsSelect from '../TagsSelect';import i18n from '-/services/i18n';import { extractFileName, extractDirectoryName } from '-/utils/paths';import PlatformIO from '-/services/platform-io';+import { TS } from '-/tagspaces.namespace';interface Props {open: boolean;fullScreen: boolean;selectedEntries: Array<any>;onClose: (clearSelection?: boolean) => void;- addTags: (paths: Array<string>, tags: Array<Tag>) => void;- removeTags: (paths: Array<string>, tags: Array<Tag>) => void;+ addTags: (paths: Array<string>, tags: Array<TS.Tag>) => void;+ removeTags: (paths: Array<string>, tags: Array<TS.Tag>) => void;removeAllTags: (paths: Array<string>) => void;}const AddRemoveTagsDialog = (props: Props) => {- const [newlyAddedTags, setNewlyAddedTags] = useState<Array<Tag>>([]);+ const [newlyAddedTags, setNewlyAddedTags] = useState<Array<TS.Tag>>([]);- const handleChange = (name: string, value: Array<Tag>, action: string) => {+ const handleChange = (name: string, value: Array<TS.Tag>, action: string) => {if (action === 'remove-value') {const tagsToRemove: Array<string> = value.map(tag => tag.title);setNewlyAddedTags(diff --git a/app/components/dialogs/AddTagToTagGroupDialog.tsx b/app/components/dialogs/AddTagToTagGroupDialog.tsxindex a002c9b23..24e36ddd1 100644--- a/app/components/dialogs/AddTagToTagGroupDialog.tsx+++ b/app/components/dialogs/AddTagToTagGroupDialog.tsx@@ -28,19 +28,20 @@ import Select from '@material-ui/core/Select';import Input from '@material-ui/core/Input';import MenuItem from '@material-ui/core/MenuItem';import { connect } from 'react-redux';-import { getTagGroups, Tag, TagGroup } from '-/reducers/taglibrary';+import { getTagGroups } from '-/reducers/taglibrary';import i18n from '-/services/i18n';import { getTagColor, getTagTextColor } from '-/reducers/settings';+import { TS } from '-/tagspaces.namespace';interface Props {open: boolean;onClose: () => void;- addTag: (tag: Tag, uuid: string) => void;+ addTag: (tag: TS.Tag, uuid: string) => void;fullScreen?: boolean;- selectedTag: Tag;+ selectedTag: TS.Tag;defaultBackgroundColor?: string;defaultTextColor?: string;- tagGroups: Array<TagGroup>;+ tagGroups: Array<TS.TagGroup>;}const AddTagToTagGroupDialog = (props: Props) => {diff --git a/app/components/dialogs/CreateDialog.tsx b/app/components/dialogs/CreateDialog.tsxindex 645f46cab..574101213 100644--- a/app/components/dialogs/CreateDialog.tsx+++ b/app/components/dialogs/CreateDialog.tsx@@ -39,7 +39,7 @@ import { actions as AppActions } from '-/reducers/app';import AppConfig from '-/config';import { formatDateTime4Tag } from '-/utils/misc';import IOActions from '-/reducers/io-actions';-import { FileSystemEntry } from '-/services/utils-io';+import { TS } from '-/tagspaces.namespace';const styles: any = () => ({root: {@@ -68,7 +68,7 @@ interface Props {// fullScreen: boolean;chooseDirectoryPath: (path: string) => void;showNotification: (message: string, type: string, autohide: boolean) => void;- reflectCreateEntries: (fsEntries: Array<FileSystemEntry>) => void;+ reflectCreateEntries: (fsEntries: Array<TS.FileSystemEntry>) => void;createFileAdvanced: (targetPath: string,fileName: string,diff --git a/app/components/dialogs/CreateEditLocationDialog.tsx b/app/components/dialogs/CreateEditLocationDialog.tsxindex 423878d3e..b323ddbb0 100644--- a/app/components/dialogs/CreateEditLocationDialog.tsx+++ b/app/components/dialogs/CreateEditLocationDialog.tsx@@ -35,12 +35,13 @@ import { Tooltip, Typography } from '@material-ui/core';import Dialog from '@material-ui/core/Dialog';import Input from '@material-ui/core/Input';import i18n from '-/services/i18n';-import { Location, locationType } from '-/reducers/locations';import { Pro } from '-/pro';import ObjectStoreForm from './ObjectStoreForm';import LocalForm from './LocalForm';import useFirstRender from '-/utils/useFirstRender';import AppConfig from '-/config';+import { TS } from '-/tagspaces.namespace';+import { locationType } from '-/utils/misc';const styles: any = theme => ({root: {@@ -57,12 +58,12 @@ const styles: any = theme => ({});interface Props {- location?: Location;+ location?: TS.Location;open: boolean;onClose: () => void;fullScreen: boolean;- addLocation?: (location: Location) => void;- editLocation?: (location: Location) => void;+ addLocation?: (location: TS.Location) => void;+ editLocation?: (location: TS.Location) => void;}const CreateEditLocationDialog = (props: Props) => {diff --git a/app/components/dialogs/CreateTagGroupDialog.tsx b/app/components/dialogs/CreateTagGroupDialog.tsxindex b76eca470..4c8225b4a 100644--- a/app/components/dialogs/CreateTagGroupDialog.tsx+++ b/app/components/dialogs/CreateTagGroupDialog.tsx@@ -27,14 +27,14 @@ import FormControl from '@material-ui/core/FormControl';import FormHelperText from '@material-ui/core/FormHelperText';import Dialog from '@material-ui/core/Dialog';import ColorPickerDialog from './ColorPickerDialog';-import { TagGroup } from '-/reducers/taglibrary';import i18n from '-/services/i18n';import TransparentBackground from '../TransparentBackground';+import { TS } from '-/tagspaces.namespace';interface Props {open: boolean;onClose: () => void;- createTagGroup: (tagGroup: TagGroup) => void;+ createTagGroup: (tagGroup: TS.TagGroup) => void;fullScreen?: boolean;color: string;textcolor: string;diff --git a/app/components/dialogs/CreateTagsDialog.tsx b/app/components/dialogs/CreateTagsDialog.tsxindex 6466e3ed2..7d1c10b76 100644--- a/app/components/dialogs/CreateTagsDialog.tsx+++ b/app/components/dialogs/CreateTagsDialog.tsx@@ -26,15 +26,15 @@ import FormControl from '@material-ui/core/FormControl';import FormHelperText from '@material-ui/core/FormHelperText';import Dialog from '@material-ui/core/Dialog';import i18n from '-/services/i18n';-import { TagGroup } from '-/reducers/taglibrary';import useFirstRender from '-/utils/useFirstRender';+import { TS } from '-/tagspaces.namespace';interface Props {open: boolean;onClose: () => void;addTag: (tags: string, uuid: string) => void;fullScreen?: boolean;- selectedTagGroupEntry: TagGroup;+ selectedTagGroupEntry: TS.TagGroup;}const CreateTagsDialog = (props: Props) => {diff --git a/app/components/dialogs/EditEntryTagDialog.tsx b/app/components/dialogs/EditEntryTagDialog.tsxindex 162444a82..9dacb2770 100644--- a/app/components/dialogs/EditEntryTagDialog.tsx+++ b/app/components/dialogs/EditEntryTagDialog.tsx@@ -31,12 +31,12 @@ import FormHelperText from '@material-ui/core/FormHelperText';import Dialog from '@material-ui/core/Dialog';import i18n from '-/services/i18n';import { isPlusCode } from '-/utils/misc';-import { Tag } from '-/reducers/taglibrary';import { Pro } from '-/pro';import { getSelectedTag } from '-/reducers/app';import TaggingActions, { defaultTagLocation } from '-/reducers/tagging-actions';import { isDateTimeTag } from '-/utils/dates';import { AppConfig } from '-/config';+import { TS } from '-/tagspaces.namespace';const styles = () => ({root: {@@ -51,9 +51,9 @@ interface Props {open: boolean;fullScreen: boolean;onClose: () => void;- editTagForEntry: (path: string, tag: Tag, title: string) => void;+ editTagForEntry: (path: string, tag: TS.Tag, title: string) => void;currentEntryPath: string;- selectedTag: Tag;+ selectedTag: TS.Tag;}const GeoTagEditor = Pro && Pro.UI ? Pro.UI.GeoTagEditor : React.Fragment;@@ -90,7 +90,7 @@ const EditEntryTagDialog = (props: Props) => {}, []);function handleValidation() {- const tagCheck = RegExp(/^[^\#\/\\ \[\]]{1,}$/);+ const tagCheck = RegExp(/^[^#/\\ [\]]{1,}$/);if (title && tagCheck.test(title)) {setErrorTag(false);setDisableConfirmButton(false);diff --git a/app/components/dialogs/EditTagDialog.tsx b/app/components/dialogs/EditTagDialog.tsxindex 8ad2bb86e..1917633ee 100644--- a/app/components/dialogs/EditTagDialog.tsx+++ b/app/components/dialogs/EditTagDialog.tsx@@ -29,15 +29,15 @@ import Dialog from '@material-ui/core/Dialog';import ColorPickerDialog from './ColorPickerDialog';import TransparentBackground from '../TransparentBackground';import i18n from '-/services/i18n';-import { Tag, TagGroup } from '-/reducers/taglibrary';+import { TS } from '-/tagspaces.namespace';interface Props {open: boolean;fullScreen?: boolean;onClose: () => void;- editTag: (tag: Tag, tagGroupId: string, origTitle: string) => void;- selectedTag: Tag;- selectedTagGroupEntry: TagGroup;+ editTag: (tag: TS.Tag, tagGroupId: string, origTitle: string) => void;+ selectedTag: TS.Tag;+ selectedTagGroupEntry: TS.TagGroup;}const EditTagDialog = (props: Props) => {diff --git a/app/components/dialogs/EditTagGroupDialog.tsx b/app/components/dialogs/EditTagGroupDialog.tsxindex 59e3f196c..db84c9d4d 100644--- a/app/components/dialogs/EditTagGroupDialog.tsx+++ b/app/components/dialogs/EditTagGroupDialog.tsx@@ -27,15 +27,15 @@ import FormHelperText from '@material-ui/core/FormHelperText';import Switch from '@material-ui/core/Switch';import Dialog from '@material-ui/core/Dialog';import ColorPickerDialog from './ColorPickerDialog';-import { TagGroup } from '-/reducers/taglibrary';import i18n from '-/services/i18n';import TransparentBackground from '../TransparentBackground';+import { TS } from '-/tagspaces.namespace';interface Props {open: boolean;fullScreen?: boolean;- editTagGroup: (tagGroup: TagGroup) => void;- selectedTagGroupEntry: TagGroup;+ editTagGroup: (tagGroup: TS.TagGroup) => void;+ selectedTagGroupEntry: TS.TagGroup;onClose: () => void;}diff --git a/app/components/dialogs/ImportExportTagGroupsDialog.tsx b/app/components/dialogs/ImportExportTagGroupsDialog.tsxindex 62804052e..c40afd7be 100644--- a/app/components/dialogs/ImportExportTagGroupsDialog.tsx+++ b/app/components/dialogs/ImportExportTagGroupsDialog.tsx@@ -33,7 +33,7 @@ import TagContainer from '../TagContainer';import i18n from '-/services/i18n';import { isFunc } from '-/utils/misc';import AppConfig from '-/config';-import { Tag } from '-/reducers/taglibrary';+import { TS } from '-/tagspaces.namespace';const styles: any = {root: {@@ -126,7 +126,7 @@ const ImportExportTagGroupsDialog = (props: Props) => {</FormControl><TagGroupContainer taggroup={tagGroup}>{tagGroup.children &&- tagGroup.children.map((tag: Tag) => (+ tagGroup.children.map((tag: TS.Tag) => (<TagContainer tag={tag} tagMode="display" />))}</TagGroupContainer>diff --git a/app/components/menus/DirectoryMenu.tsx b/app/components/menus/DirectoryMenu.tsxindex 50dc0943a..2046c7010 100644--- a/app/components/menus/DirectoryMenu.tsx+++ b/app/components/menus/DirectoryMenu.tsx@@ -41,6 +41,7 @@ import RenameFolderIcon from '@material-ui/icons/FormatTextdirectionLToR';import DeleteForeverIcon from '@material-ui/icons/DeleteForever';import SettingsIcon from '@material-ui/icons/Settings';import { Progress } from 'aws-sdk/clients/s3';+import ImageIcon from '@material-ui/icons/Image';import { Pro } from '../../pro';import CreateDirectoryDialog from '../dialogs/CreateDirectoryDialog';// import RenameDirectoryDialog from '../dialogs/RenameDirectoryDialog';@@ -61,17 +62,15 @@ import {perspectives} from '-/reducers/app';import IOActions from '-/reducers/io-actions';-import { Tag } from '-/reducers/taglibrary';import TaggingActions from '-/reducers/tagging-actions';import {- FileSystemEntry,getAllPropertiesPromise,setFolderThumbnailPromise} from '-/services/utils-io';import FileUploadContainer, {FileUploadContainerRef} from '-/components/FileUploadContainer';-import ImageIcon from '@material-ui/icons/Image';+import { TS } from '-/tagspaces.namespace';interface Props {open: boolean;@@ -81,7 +80,7 @@ interface Props {directoryPath: string;loadDirectoryContent: (path: string) => void;openDirectory: (path: string) => void;- openFsEntry: (fsEntry: FileSystemEntry) => void;+ openFsEntry: (fsEntry: TS.FileSystemEntry) => void;reflectCreateEntry?: (path: string, isFile: boolean) => void;toggleCreateFileDialog?: () => void;// extractContent: (config: Object) => void,@@ -90,7 +89,7 @@ interface Props {destination: string,onUploadProgress?: (progress: Progress, response: any) => void) => any;- reflectCreateEntries: (fsEntries: Array<FileSystemEntry>) => void;+ reflectCreateEntries: (fsEntries: Array<TS.FileSystemEntry>) => void;onUploadProgress: (progress: Progress, response: any) => void;switchPerspective?: (perspectiveId: string) => void;setCurrentDirectoryPerspective: (perspective: string) => void;@@ -106,7 +105,7 @@ interface Props {resetProgress: () => void;addTags: (paths: Array<string>,- tags: Array<Tag>,+ tags: Array<TS.Tag>,updateIndex: boolean) => void;toggleDeleteMultipleEntriesDialog: () => void;@@ -143,7 +142,7 @@ const DirectoryMenu = (props: Props) => {function showProperties() {props.onClose();getAllPropertiesPromise(props.directoryPath)- .then((fsEntry: FileSystemEntry) => {+ .then((fsEntry: TS.FileSystemEntry) => {props.openFsEntry(fsEntry);return true;})diff --git a/app/components/menus/EntryTagMenu.tsx b/app/components/menus/EntryTagMenu.tsxindex db45c4602..2575e44d9 100644--- a/app/components/menus/EntryTagMenu.tsx+++ b/app/components/menus/EntryTagMenu.tsx@@ -29,24 +29,23 @@ import Menu from '@material-ui/core/Menu';import MenuItem from '@material-ui/core/MenuItem';import ConfirmDialog from '../dialogs/ConfirmDialog';import i18n from '-/services/i18n';-import { Tag } from '-/reducers/taglibrary';import { actions as LocationIndexActions } from '-/reducers/location-index';-import { SearchQuery } from '-/services/search';import { getMaxSearchResults } from '-/reducers/settings';import { actions as AppActions } from '-/reducers/app';+import { TS } from '-/tagspaces.namespace';interface Props {open: boolean;onClose: () => void;anchorEl: Element | null;- selectedTag: Tag | null;+ selectedTag: TS.Tag | null;currentEntryPath: string;- removeTags: (paths: Array<string>, tags: Array<Tag>) => void;- searchLocationIndex?: (searchQuery: SearchQuery) => void;+ removeTags: (paths: Array<string>, tags: Array<TS.Tag>) => void;+ searchLocationIndex?: (searchQuery: TS.SearchQuery) => void;maxSearchResults?: number;openSearchPanel?: () => void;- setIsAddTagDialogOpened?: (tag: Tag) => void;- toggleEditTagDialog?: (tag: Tag) => void;+ setIsAddTagDialogOpened?: (tag: TS.Tag) => void;+ toggleEditTagDialog?: (tag: TS.Tag) => void;isReadOnlyMode?: boolean;}diff --git a/app/components/menus/FileMenu.tsx b/app/components/menus/FileMenu.tsxindex e762723e4..5d617e309 100644--- a/app/components/menus/FileMenu.tsx+++ b/app/components/menus/FileMenu.tsx@@ -35,12 +35,12 @@ import i18n from '-/services/i18n';import AppConfig from '-/config';import PlatformIO from '-/services/platform-io';import {- FileSystemEntry,getAllPropertiesPromise,setFolderThumbnailPromise} from '-/services/utils-io';import { Pro } from '-/pro';import { extractParentDirectoryPath } from '-/utils/paths';+import { TS } from '-/tagspaces.namespace';interface Props {anchorEl: Element;@@ -52,7 +52,7 @@ interface Props {openRenameFileDialog: () => void;openMoveCopyFilesDialog: () => void;openAddRemoveTagsDialog: () => void;- openFsEntry: (fsEntry: FileSystemEntry) => void;+ openFsEntry: (fsEntry: TS.FileSystemEntry) => void;loadDirectoryContent: (path: string) => void;openFileNatively: (path: string) => void;showInFileManager: (path: string) => void;@@ -147,7 +147,7 @@ const FileMenu = (props: Props) => {props.onClose();if (props.selectedFilePath) {getAllPropertiesPromise(props.selectedFilePath)- .then((fsEntry: FileSystemEntry) => {+ .then((fsEntry: TS.FileSystemEntry) => {props.openFsEntry(fsEntry);return true;})diff --git a/app/components/menus/LocationContextMenu.tsx b/app/components/menus/LocationContextMenu.tsxindex 4e720bfc2..8366aff93 100644--- a/app/components/menus/LocationContextMenu.tsx+++ b/app/components/menus/LocationContextMenu.tsx@@ -30,17 +30,15 @@ import OpenFolderNativelyIcon from '@material-ui/icons/Launch';import CloseIcon from '@material-ui/icons/Close';import { bindActionCreators } from 'redux';import { connect } from 'react-redux';-import {- actions as LocationActions,- Location,- locationType-} from '-/reducers/locations';+import { actions as LocationActions } from '-/reducers/locations';import PlatformIO from '-/services/platform-io';import { actions as LocationIndexActions } from '-/reducers/location-index';import i18n from '-/services/i18n';import { actions as AppActions } from '-/reducers/app';import { getLocationPath } from '-/utils/paths';import AppConfig from '-/config';+import { TS } from '-/tagspaces.namespace';+import { locationType } from '-/utils/misc';interface Props {setEditLocationDialogOpened: (open: boolean) => void;@@ -50,7 +48,7 @@ interface Props {fullTextIndex: boolean,isCurrentLocation: boolean) => void;- selectedLocation: Location;+ selectedLocation: TS.Location;isCurrentLocation: (uuid: string) => boolean;moveLocationUp: (locationId: string) => void;moveLocationDown: (locationId: string) => void;diff --git a/app/components/menus/LocationMenu.tsx b/app/components/menus/LocationMenu.tsxindex 9912754be..04fd6c2b8 100644--- a/app/components/menus/LocationMenu.tsx+++ b/app/components/menus/LocationMenu.tsx@@ -30,15 +30,17 @@ import { withTheme } from '@material-ui/core/styles';import Button from '@material-ui/core/Button';import ArrowDropDownIcon from '@material-ui/icons/ArrowDropDown';import i18n from '-/services/i18n';-import { getLocations, Location, locationType } from '-/reducers/locations';+import { getLocations } from '-/reducers/locations';import { actions as AppActions, getCurrentLocationId } from '-/reducers/app';+import { TS } from '-/tagspaces.namespace';+import { locationType } from '-/utils/misc';interface Props {currentLocationId: string | null;theme: any;- locations: Array<Location>;+ locations: Array<TS.Location>;menuAnchorEl?: Element;- openLocation: (location: Location) => void;+ openLocation: (location: TS.Location) => void;}const LocationMenu = (props: Props) => {@@ -55,7 +57,7 @@ const LocationMenu = (props: Props) => {let currentLocation;if (props.currentLocationId && props.locations) {currentLocation = props.locations.find(- (location: Location) => location.uuid === props.currentLocationId+ (location: TS.Location) => location.uuid === props.currentLocationId);}@@ -105,7 +107,7 @@ const LocationMenu = (props: Props) => {>{i18n.t('core:chooseLocation')}</ListSubHeader>- {props.locations.map((location: Location) => (+ {props.locations.map((location: TS.Location) => (<MenuItemdata-tid="folderContainerMenuOpenLocation"key={location.uuid}diff --git a/app/components/menus/TagGroupMenu.tsx b/app/components/menus/TagGroupMenu.tsxindex 5f4facebb..ea6709dca 100644--- a/app/components/menus/TagGroupMenu.tsx+++ b/app/components/menus/TagGroupMenu.tsx@@ -35,29 +35,28 @@ import Menu from '@material-ui/core/Menu';import MenuItem from '@material-ui/core/MenuItem';import { bindActionCreators } from 'redux';import { connect } from 'react-redux';-import { TagGroup } from '-/reducers/taglibrary';import i18n from '-/services/i18n';import { Pro } from '-/pro';import { getMaxSearchResults } from '-/reducers/settings';import { actions as AppActions } from '-/reducers/app';import { actions as LocationIndexActions } from '-/reducers/location-index';-import { SearchQuery } from '-/services/search';+import { TS } from '-/tagspaces.namespace';interface Props {classes?: any;anchorEl: Element;open: boolean;onClose: () => void;- selectedTagGroupEntry: TagGroup;+ selectedTagGroupEntry: TS.TagGroup;showCreateTagsDialog: () => void;showDeleteTagGroupDialog: () => void;showEditTagGroupDialog: () => void;moveTagGroupUp: (tagGroupId: string) => void;moveTagGroupDown: (tagGroupId: string) => void;sortTagGroup: (tagGroupId: string) => void;- collectTagsFromLocation: (tagGroup: TagGroup) => void;+ collectTagsFromLocation: (tagGroup: TS.TagGroup) => void;handleCloseTagGroupMenu: () => void;- searchLocationIndex: (searchQuery: SearchQuery) => void;+ searchLocationIndex: (searchQuery: TS.SearchQuery) => void;openSearchPanel: () => void;maxSearchResults: number;}diff --git a/app/components/menus/TagMenu.tsx b/app/components/menus/TagMenu.tsxindex 2e66cf12b..a40f0ecf8 100644--- a/app/components/menus/TagMenu.tsx+++ b/app/components/menus/TagMenu.tsx@@ -26,12 +26,11 @@ import ListItemIcon from '@material-ui/core/ListItemIcon';import ListItemText from '@material-ui/core/ListItemText';import Menu from '@material-ui/core/Menu';import MenuItem from '@material-ui/core/MenuItem';-import { Tag } from '-/reducers/taglibrary';import { actions as LocationIndexActions } from '-/reducers/location-index';import i18n from '-/services/i18n';-import { SearchQuery } from '-/services/search';import { getMaxSearchResults } from '-/reducers/settings';import { actions as AppActions } from '-/reducers/app';+import { TS } from '-/tagspaces.namespace';const isTagLibraryReadOnly =window.ExtTagLibrary && window.ExtTagLibrary.length > 0;@@ -40,8 +39,8 @@ interface Props {anchorEl?: Element;open?: boolean;onClose: () => void;- selectedTag?: Tag;- searchLocationIndex: (searchQuery: SearchQuery) => void;+ selectedTag?: TS.Tag;+ searchLocationIndex: (searchQuery: TS.SearchQuery) => void;openSearchPanel: () => void;showEditTagDialog: () => void;showDeleteTagDialog: () => void;diff --git a/app/containers/MainPage.tsx b/app/containers/MainPage.tsxindex 9bd8250be..590323909 100644--- a/app/containers/MainPage.tsx+++ b/app/containers/MainPage.tsx@@ -94,9 +94,9 @@ import { CustomDragLayer } from '-/components/CustomDragLayer';import IOActions from '-/reducers/io-actions';import FileUploadDialog from '-/components/dialogs/FileUploadDialog';import ProgressDialog from '-/components/dialogs/ProgressDialog';-import { FileSystemEntry } from '-/services/utils-io';import useEventListener from '-/utils/useEventListener';import ConfirmDialog from '-/components/dialogs/ConfirmDialog';+import { TS } from '-/tagspaces.namespace';const initialSplitSize = 44;const drawerWidth = 300;@@ -190,7 +190,7 @@ interface Props {toggleOnboardingDialog: () => void; // needed by electron-menus// setLastSelectedEntry: (path: string) => void; // needed by electron-menussetSelectedEntries: (selectedEntries: Array<Object>) => void; // needed by electron-menus- openFsEntry: (fsEntry: FileSystemEntry) => void; // needed by electron-menus+ openFsEntry: (fsEntry: TS.FileSystemEntry) => void; // needed by electron-menusopenURLExternally: (url: string, skipConfirm: boolean) => void;openNextFile: (path?: string) => void; // needed by electron-menusopenPrevFile: (path?: string) => void; // needed by electron-menus@@ -217,7 +217,7 @@ interface Props {notificationType?: string,autohide?: boolean) => void;- reflectCreateEntries: (fsEntries: Array<FileSystemEntry>) => void;+ reflectCreateEntries: (fsEntries: Array<TS.FileSystemEntry>) => void;uploadFilesAPI: (files: Array<File>,destination: string,diff --git a/app/perspectives/grid-perspective/components/CellContent.tsx b/app/perspectives/grid-perspective/components/CellContent.tsxindex 7f97562fa..9a49d7076 100644--- a/app/perspectives/grid-perspective/components/CellContent.tsx+++ b/app/perspectives/grid-perspective/components/CellContent.tsx@@ -29,38 +29,38 @@ import UnSelectedIcon from '@material-ui/icons/CheckBoxOutlineBlank';import TagIcon from '@material-ui/icons/LocalOfferOutlined';import { formatFileSize, formatDateTime } from '-/utils/misc';import { extractTagsAsObjects, extractTitle } from '-/utils/paths';-import { FileSystemEntry, findColorForFileEntry } from '-/services/utils-io';+import { findColorForFileEntry } from '-/services/utils-io';import TagContainerDnd from '-/components/TagContainerDnd';import TagContainer from '-/components/TagContainer';import i18n from '-/services/i18n';-import { Tag, Uuid } from '-/reducers/taglibrary';import PlatformIO from '-/services/platform-io';import { AppConfig } from '-/config';import EntryIcon from '-/components/EntryIcon';+import { TS } from '-/tagspaces.namespace';const maxDescriptionPreviewLength = 100;interface Props {selected: boolean;- fsEntry: FileSystemEntry;+ fsEntry: TS.FileSystemEntry;entrySize: string;classes: any;theme: any;supportedFileTypes: Array<Object>;thumbnailMode: any;addTags: () => void;- addTag: (tag: Tag, parentTagGroupUuid: Uuid) => void;- openFsEntry: (fsEntry: FileSystemEntry) => void;- selectedEntries: Array<FileSystemEntry>;- selectEntry: (fsEntry: FileSystemEntry) => void;- deselectEntry: (fsEntry: FileSystemEntry) => void;+ addTag: (tag: TS.Tag, parentTagGroupUuid: TS.Uuid) => void;+ openFsEntry: (fsEntry: TS.FileSystemEntry) => void;+ selectedEntries: Array<TS.FileSystemEntry>;+ selectEntry: (fsEntry: TS.FileSystemEntry) => void;+ deselectEntry: (fsEntry: TS.FileSystemEntry) => void;isReadOnlyMode: boolean;showTags: boolean;- handleTagMenu: (event: Object, tag: Tag, entryPath: string) => void;+ handleTagMenu: (event: Object, tag: TS.Tag, entryPath: string) => void;layoutType: string;- handleGridContextMenu: (event: Object, fsEntry: FileSystemEntry) => void;- handleGridCellDblClick: (event: Object, fsEntry: FileSystemEntry) => void;- handleGridCellClick: (event: Object, fsEntry: FileSystemEntry) => void;+ handleGridContextMenu: (event: Object, fsEntry: TS.FileSystemEntry) => void;+ handleGridCellDblClick: (event: Object, fsEntry: TS.FileSystemEntry) => void;+ handleGridCellClick: (event: Object, fsEntry: TS.FileSystemEntry) => void;}const CellContent = (props: Props) => {@@ -361,7 +361,7 @@ const CellContent = (props: Props) => {);}- function renderTag(tag: Tag) {+ function renderTag(tag: TS.Tag) {return isReadOnlyMode ? (<TagContainertag={tag}diff --git a/app/perspectives/grid-perspective/components/GridPagination.tsx b/app/perspectives/grid-perspective/components/GridPagination.tsxindex 6b027e981..e992093f0 100644--- a/app/perspectives/grid-perspective/components/GridPagination.tsx+++ b/app/perspectives/grid-perspective/components/GridPagination.tsx@@ -20,7 +20,6 @@ import React, { useState, useEffect } from 'react';import { connect } from 'react-redux';import Typography from '@material-ui/core/Typography';import Pagination from '@material-ui/lab/Pagination';-import { FileSystemEntry } from '-/services/utils-io';import i18n from '-/services/i18n';import {getCurrentDirectoryColor,@@ -28,16 +27,17 @@ import {isLoading} from '-/reducers/app';import AppConfig from '-/config';+import { TS } from '-/tagspaces.namespace';interface Props {className: string;style: Object;theme: any;// gridRef: Object;- directories: Array<FileSystemEntry>;+ directories: Array<TS.FileSystemEntry>;showDirectories: boolean;- files: Array<FileSystemEntry>;- renderCell: (FileSystemEntry) => void;+ files: Array<TS.FileSystemEntry>;+ renderCell: (entry: TS.FileSystemEntry) => void;currentDirectoryColor: string;isAppLoading: boolean;currentPage: number;diff --git a/app/perspectives/grid-perspective/components/MainContainer.tsx b/app/perspectives/grid-perspective/components/MainContainer.tsxindex 245589ee9..36dce89b9 100644--- a/app/perspectives/grid-perspective/components/MainContainer.tsx+++ b/app/perspectives/grid-perspective/components/MainContainer.tsx@@ -21,15 +21,14 @@ import { connect } from 'react-redux';import { bindActionCreators } from 'redux';import { GlobalHotKeys } from 'react-hotkeys';import { withStyles } from '@material-ui/core/styles';-import { FileSystemEntry } from '-/services/utils-io';-import { actions as TagLibraryActions, Tag, Uuid } from '-/reducers/taglibrary';+import { actions as TagLibraryActions } from '-/reducers/taglibrary';import {getSupportedFileTypes,getDesktopMode,getKeyBindingObject,isDesktopMode} from '-/reducers/settings';-import { sortByCriteria } from '-/utils/misc';+import { locationType, sortByCriteria } from '-/utils/misc';import styles from './styles.css';import FileMenu from '-/components/menus/FileMenu';import DirectoryMenu from '-/components/menus/DirectoryMenu';@@ -55,12 +54,13 @@ import CellContent from './CellContent';import MainToolbar from './MainToolbar';import SortingMenu from './SortingMenu';import GridOptionsMenu from './GridOptionsMenu';-import { getLocation, Location, locationType } from '-/reducers/locations';+import { getLocation } from '-/reducers/locations';import PlatformIO from '-/services/platform-io';import { getLocationPath } from '-/utils/paths';import GridPagination from '-/perspectives/grid-perspective/components/GridPagination';import GridSettingsDialog from '-/perspectives/grid-perspective/components/GridSettingsDialog';import AddTagToTagGroupDialog from '-/components/dialogs/AddTagToTagGroupDialog';+import { TS } from '-/tagspaces.namespace';interface Props {classes: any;@@ -71,7 +71,7 @@ interface Props {selectedEntries: Array<any>;supportedFileTypes: Array<any>;isReadOnlyMode: boolean;- openFsEntry: (fsEntry?: FileSystemEntry) => void;+ openFsEntry: (fsEntry?: TS.FileSystemEntry) => void;openNextFile: () => any;openPrevFile: () => any;openRenameEntryDialog: () => void;@@ -84,10 +84,10 @@ interface Props {// setLastSelectedEntry: (entryPath: string | null) => void;setSelectedEntries: (selectedEntries: Array<Object>) => void;addTags: () => void;- addTag: (tag: Tag, parentTagGroupUuid: Uuid) => void;- removeTags: (paths: Array<string>, tags: Array<Tag>) => void;+ addTag: (tag: TS.Tag, parentTagGroupUuid: TS.Uuid) => void;+ removeTags: (paths: Array<string>, tags: Array<TS.Tag>) => void;removeAllTags: () => void;- directoryContent: Array<FileSystemEntry>;+ directoryContent: Array<TS.FileSystemEntry>;moveFiles: (files: Array<string>, destination: string) => void;keyBindings: any;showNotification: (@@ -95,7 +95,7 @@ interface Props {notificationType: string,autohide: boolean) => void;- currentLocation: Location;+ currentLocation: TS.Location;isDesktopMode: boolean;toggleDeleteMultipleEntriesDialog: () => void;}@@ -108,7 +108,7 @@ const GridPerspective = (props: Props) => {const allFilesSelected = useRef<boolean>(false);// const selectedEntry = useRef<FileSystemEntry>(undefined);const selectedEntryPath = useRef<string>(undefined);- const selectedTag = useRef<Tag | null>(null);+ const selectedTag = useRef<TS.Tag | null>(null);const [fileContextMenuAnchorEl,setFileContextMenuAnchorEl@@ -129,7 +129,7 @@ const GridPerspective = (props: Props) => {optionsContextMenuAnchorEl,setOptionsContextMenuAnchorEl] = useState<null | HTMLElement>(null);- const [isAddTagDialogOpened, setIsAddTagDialogOpened] = useState<Tag>(+ const [isAddTagDialogOpened, setIsAddTagDialogOpened] = useState<TS.Tag>(undefined);const [sortBy, setSortBy] = useState<string>(@@ -271,7 +271,7 @@ const GridPerspective = (props: Props) => {setOptionsContextMenuAnchorEl(anchor);};- const handleGridCellClick = (event, fsEntry: FileSystemEntry) => {+ const handleGridCellClick = (event, fsEntry: TS.FileSystemEntry) => {const {selectedEntries,directoryContent,@@ -394,7 +394,7 @@ const GridPerspective = (props: Props) => {setIsGridSettingsDialogOpened(true);};- const handleGridCellDblClick = (event, fsEntry: FileSystemEntry) => {+ const handleGridCellDblClick = (event, fsEntry: TS.FileSystemEntry) => {props.setSelectedEntries([]);if (props.currentLocation.type === locationType.TYPE_CLOUD) {PlatformIO.enableObjectStoreSupport(props.currentLocation)@@ -411,7 +411,7 @@ const GridPerspective = (props: Props) => {}};- const openLocation = (fsEntry: FileSystemEntry) => {+ const openLocation = (fsEntry: TS.FileSystemEntry) => {if (fsEntry.isFile) {props.setSelectedEntries([fsEntry]);props.openFsEntry(fsEntry);@@ -421,7 +421,7 @@ const GridPerspective = (props: Props) => {}};- const handleGridContextMenu = (event, fsEntry: FileSystemEntry) => {+ const handleGridContextMenu = (event, fsEntry: TS.FileSystemEntry) => {event.preventDefault();event.stopPropagation();setMouseX(event.clientX);@@ -474,12 +474,12 @@ const GridPerspective = (props: Props) => {}};- const selectEntry = (fsEntry: FileSystemEntry) => {+ const selectEntry = (fsEntry: TS.FileSystemEntry) => {const { setSelectedEntries, selectedEntries } = props;setSelectedEntries([...selectedEntries, fsEntry]);};- const deselectEntry = (fsEntry: FileSystemEntry) => {+ const deselectEntry = (fsEntry: TS.FileSystemEntry) => {const { setSelectedEntries, selectedEntries } = props;const newSelection = selectedEntries.filter(data => data.path !== fsEntry.path@@ -489,7 +489,7 @@ const GridPerspective = (props: Props) => {const handleTagMenu = (event: React.ChangeEvent<HTMLInputElement>,- tag: Tag,+ tag: TS.Tag,entryPath: string) => {event.preventDefault();@@ -547,7 +547,7 @@ const GridPerspective = (props: Props) => {}};- const renderCell = (fsEntry: FileSystemEntry) => {+ const renderCell = (fsEntry: TS.FileSystemEntry) => {const {classes,theme,diff --git a/app/reducers/app.ts b/app/reducers/app.tsindex 8a2fe47ea..f41684bf5 100644--- a/app/reducers/app.ts+++ b/app/reducers/app.ts@@ -18,20 +18,13 @@import uuidv1 from 'uuid';import pathLib from 'path';-import {- Location,- getLocation,- locationType,- getDefaultLocationId-} from './locations';+import { getLocation, getDefaultLocationId } from './locations';import PlatformIO from '../services/platform-io';import AppConfig from '../config';import {deleteFilesPromise,loadMetaDataPromise,renameFilesPromise,- FileSystemEntryMeta,- FileSystemEntry,getAllPropertiesPromise,prepareDirectoryContent,findExtensionsForEntry,@@ -55,18 +48,19 @@ import {getURLParameter,clearURLParam,updateHistory,- clearAllURLParams+ clearAllURLParams,+ locationType} from '-/utils/misc';import i18n from '../services/i18n';import { Pro } from '../pro';import { actions as LocationIndexActions } from './location-index';-import { Tag } from './taglibrary';import {actions as SettingsActions,getCheckForUpdateOnStartup,isFirstRun,isGlobalKeyBindingEnabled} from '-/reducers/settings';+import { TS } from '-/tagspaces.namespace';export const types = {DEVICE_ONLINE: 'APP/DEVICE_ONLINE',@@ -161,7 +155,7 @@ export type OpenedEntry = {*/shouldReload?: boolean;focused?: boolean; // TODO make it mandatory once support for multiple files is added- tags?: Array<Tag>;+ tags?: Array<TS.Tag>;};let showLocations = true;@@ -835,7 +829,7 @@ export const actions = {dispatch(actions.toggleCreateFileDialog());}},- toggleEditTagDialog: (tag: Tag) => ({+ toggleEditTagDialog: (tag: TS.Tag) => ({type: types.TOGGLE_EDIT_TAG_DIALOG,tag}),@@ -919,7 +913,7 @@ export const actions = {},loadDirectoryContentInt: (directoryPath: string,- fsEntryMeta?: FileSystemEntryMeta+ fsEntryMeta?: TS.FileSystemEntryMeta) => (dispatch: (actions: Object) => void, getState: () => any) => {const { settings } = getState();dispatch(actions.loadDirectorySuccessInt(directoryPath, [], true)); // this is to reset directoryContent (it will reset color too)@@ -978,7 +972,7 @@ export const actions = {loadDirectorySuccess: (directoryPath: string,directoryContent: Array<Object>,- directoryMeta?: FileSystemEntryMeta+ directoryMeta?: TS.FileSystemEntryMeta) => (dispatch: (actions: Object) => void) => {// const currentLocation: Location = getLocation(// getState(),@@ -1015,7 +1009,7 @@ export const actions = {directoryPath: string,directoryContent: Array<Object>,showIsLoading?: boolean,- directoryMeta?: FileSystemEntryMeta+ directoryMeta?: TS.FileSystemEntryMeta) => ({type: types.LOAD_DIRECTORY_SUCCESS,directoryPath: directoryPath || PlatformIO.getDirSeparator(),@@ -1268,7 +1262,7 @@ export const actions = {));getAllPropertiesPromise(filePath)- .then((fsEntry: FileSystemEntry) => {+ .then((fsEntry: TS.FileSystemEntry) => {dispatch(actions.openFsEntry(fsEntry)); // TODO return fsEntry from saveFilePromise and simplify// dispatch(actions.setSelectedEntries([fsEntry])); -> moved in reflectCreateEntryreturn true;@@ -1323,7 +1317,7 @@ export const actions = {newHTMLFileContent.split('<body></body>')[1];}PlatformIO.saveFilePromise(filePath, fileContent, true)- .then((fsEntry: FileSystemEntry) => {+ .then((fsEntry: TS.FileSystemEntry) => {dispatch(actions.reflectCreateEntry(filePath, true));dispatch(actions.openFsEntry(fsEntry)); // TODO return fsEntry from saveFilePromise and simplify@@ -1360,7 +1354,7 @@ export const actions = {type: types.SET_CURRENLOCATIONID,locationId}),- changeLocation: (location: Location) => (+ changeLocation: (location: TS.Location) => (dispatch: (actions: Object) => void,getState: () => any) => {@@ -1382,7 +1376,7 @@ export const actions = {return true;});},- openLocation: (location: Location) => (+ openLocation: (location: TS.Location) => (dispatch: (actions: Object) => void,getState: () => any) => {@@ -1572,7 +1566,7 @@ export const actions = {});}},- openFsEntry: (fsEntry?: FileSystemEntry) => (+ openFsEntry: (fsEntry?: TS.FileSystemEntry) => (dispatch: (actions: Object) => void,getState: () => any) => {@@ -1637,7 +1631,7 @@ export const actions = {if (fsEntry.isNewFile) {entryForOpening.editMode = true;}- const currentLocation: Location = getLocation(+ const currentLocation: TS.Location = getLocation(getState(),getState().app.currentLocationId);@@ -1701,7 +1695,7 @@ export const actions = {type: types.REFLECT_CREATE_ENTRY,newEntry}),- reflectCreateEntries: (fsEntries: Array<FileSystemEntry>) => (+ reflectCreateEntries: (fsEntries: Array<TS.FileSystemEntry>) => (dispatch: (actions: Object) => void) => {fsEntries.map(entry => dispatch(actions.reflectCreateEntryInt(entry))); // TODO remove map and set state once@@ -1767,7 +1761,7 @@ export const actions = {}), */reflectUpdateSidecarTags: (path: string,- tags: Array<Tag>,+ tags: Array<TS.Tag>,updateIndex: boolean = true) => (dispatch: (actions: Object) => void, getState: () => any) => {const { openedFiles } = getState().app;@@ -1919,7 +1913,7 @@ export const actions = {if (cmdOpen && cmdOpen.length > 0) {const entryPath = decodeURIComponent(cmdOpen);getAllPropertiesPromise(entryPath)- .then((fsEntry: FileSystemEntry) => {+ .then((fsEntry: TS.FileSystemEntry) => {if (fsEntry.isFile) {dispatch(actions.openFsEntry(fsEntry));} else {@@ -1941,7 +1935,7 @@ export const actions = {const directoryPath = dPath && decodeURIComponent(dPath);const entryPath = ePath && decodeURIComponent(ePath);// Check for relative paths- const targetLocation: Location = getLocation(getState(), locationId);+ const targetLocation: TS.Location = getLocation(getState(), locationId);if (targetLocation) {let openLocationTimer = 1000;const isCloudLocation = targetLocation.type === locationType.TYPE_CLOUD;@@ -1960,7 +1954,7 @@ export const actions = {if (entryPath) {getAllPropertiesPromise(entryPath)- .then((fsEntry: FileSystemEntry) => {+ .then((fsEntry: TS.FileSystemEntry) => {if (fsEntry) {dispatch(actions.openFsEntry(fsEntry));}@@ -2012,7 +2006,7 @@ export const actions = {const entryFullPath =locationPath + PlatformIO.getDirSeparator() + entryPath;getAllPropertiesPromise(entryFullPath)- .then((fsEntry: FileSystemEntry) => {+ .then((fsEntry: TS.FileSystemEntry) => {if (fsEntry) {dispatch(actions.openFsEntry(fsEntry));}diff --git a/app/reducers/io-actions.ts b/app/reducers/io-actions.tsindex 5faaef13f..b5db5b0c6 100644--- a/app/reducers/io-actions.ts+++ b/app/reducers/io-actions.ts@@ -27,7 +27,6 @@ import {import {copyFilesPromise,enhanceEntry,- FileSystemEntry,loadJSONString,renameFilesPromise} from '-/services/utils-io';@@ -36,6 +35,7 @@ import { Pro } from '../pro';import TaggingActions from './tagging-actions';import PlatformIO from '-/services/platform-io';import AppConfig from '-/config';+import { TS } from '-/tagspaces.namespace';const actions = {extractContent: (@@ -233,7 +233,7 @@ const actions = {const result = event.currentTarget? event.currentTarget.result: event.target.result;- const fsEntry: FileSystemEntry = await PlatformIO.saveBinaryFilePromise(+ const fsEntry: TS.FileSystemEntry = await PlatformIO.saveBinaryFilePromise(fileTargetPath,result,true,@@ -346,7 +346,7 @@ const actions = {true,onUploadProgress)- .then((fsEntry: FileSystemEntry) => {+ .then((fsEntry: TS.FileSystemEntry) => {// handle meta filesif (fileType === 'meta') {try {@@ -392,9 +392,9 @@ const actions = {});Promise.all(jobsPromises).then(filesProm => {- const arrFiles: Array<FileSystemEntry> = [];- const arrMeta: Array<FileSystemEntry> = [];- const arrThumb: Array<FileSystemEntry> = [];+ const arrFiles: Array<TS.FileSystemEntry> = [];+ const arrMeta: Array<TS.FileSystemEntry> = [];+ const arrThumb: Array<TS.FileSystemEntry> = [];filesProm.map(file => {if (file) {@@ -421,7 +421,7 @@ const actions = {// Enhance entriesresolve(- arrFiles.map((file: FileSystemEntry) => {+ arrFiles.map((file: TS.FileSystemEntry) => {const metaFilePath = getMetaFileLocationForFile(file.path,AppConfig.dirSeparatordiff --git a/app/reducers/location-index.ts b/app/reducers/location-index.tsindex 6d775c0bd..3edc35c8e 100644--- a/app/reducers/location-index.ts+++ b/app/reducers/location-index.ts@@ -16,8 +16,8 @@**/-import { Location, getLocation, getLocations, locationType } from './locations';-import { createDirectoryIndex, FileSystemEntry } from '-/services/utils-io';+import { getLocation, getLocations } from './locations';+import { createDirectoryIndex } from '-/services/utils-io';import { Pro } from '../pro';import {extractFileExtension,@@ -25,13 +25,14 @@ import {extractTagsAsObjects,getLocationPath} from '-/utils/paths';-import Search, { SearchQuery } from '../services/search';+import Search from '../services/search';import { actions as AppActions } from './app';import i18n from '../services/i18n';import PlatformIO from '../services/platform-io';-import { Tag } from './taglibrary';import GlobalSearch from '../services/search-index';import AppConfig from '-/config';+import { TS } from '-/tagspaces.namespace';+import { locationType } from '-/utils/misc';export const types = {SET_SEARCH_QUERY: 'SET_SEARCH_QUERY',@@ -176,7 +177,7 @@ export default (state: any = initialState, action: any) => {};export const actions = {- setSearchQuery: (searchQuery: SearchQuery) => ({+ setSearchQuery: (searchQuery: TS.SearchQuery) => ({type: types.SET_SEARCH_QUERY,searchQuery}),@@ -283,12 +284,12 @@ export const actions = {clearDirectoryIndex: () => ({type: types.INDEX_DIRECTORY_CLEAR}),- searchLocationIndex: (searchQuery: SearchQuery) => (+ searchLocationIndex: (searchQuery: TS.SearchQuery) => (dispatch: (actions: Object) => void,getState: () => any) => {const state = getState();- const currentLocation: Location = getLocation(+ const currentLocation: TS.Location = getLocation(state,state.app.currentLocationId);@@ -354,7 +355,7 @@ export const actions = {Search.searchLocationIndex(GlobalSearch.index, searchQuery).then(searchResults => {if (isCloudLocation) {- searchResults.forEach((entry: FileSystemEntry) => {+ searchResults.forEach((entry: TS.FileSystemEntry) => {if (entry.thumbPath &&entry.thumbPath.length > 1 &&@@ -381,12 +382,12 @@ export const actions = {});}, 50);},- searchAllLocations: (searchQuery: SearchQuery) => (+ searchAllLocations: (searchQuery: TS.SearchQuery) => (dispatch: (actions: Object) => void,getState: () => any) => {const state = getState();- const currentLocation: Location = getLocation(+ const currentLocation: TS.Location = getLocation(state,state.app.currentLocationId);@@ -463,7 +464,7 @@ export const actions = {let enhancedSearchResult = searchResults;if (isCloudLocation) {enhancedSearchResult = searchResults.filter(- (entry: FileSystemEntry) => {+ (entry: TS.FileSystemEntry) => {// Excluding s3 folders from global searchif (entry && entry.isFile) {const cleanedPath = entry.path.startsWith('/')@@ -574,7 +575,7 @@ export const actions = {path,newPath}),- reflectUpdateSidecarTags: (path: string, tags: Array<Tag>) => ({+ reflectUpdateSidecarTags: (path: string, tags: Array<TS.Tag>) => ({type: types.REFLECT_UPDATE_SIDECARTAGS,path,tagsdiff --git a/app/reducers/locations.ts b/app/reducers/locations.tsindex bcdf34999..3382bd878 100644--- a/app/reducers/locations.ts+++ b/app/reducers/locations.ts@@ -17,11 +17,12 @@*/import uuidv1 from 'uuid';-import { immutablySwapItems } from '-/utils/misc';+import { immutablySwapItems, locationType } from '-/utils/misc';import { actions as AppActions } from '-/reducers/app';import i18n from '-/services/i18n';import PlatformIO from '-/services/platform-io';import AppConfig from '-/config';+import { TS } from '-/tagspaces.namespace';export const types = {ADD_LOCATION: 'APP/ADD_LOCATION',@@ -31,40 +32,9 @@ export const types = {REMOVE_LOCATION: 'APP/REMOVE_LOCATION'};-export const locationType = {- TYPE_LOCAL: '0',- TYPE_CLOUD: '1',- TYPE_AMPLIFY: '2'-};--export type Location = {- uuid: string;- newuuid?: string;- name: string;- type: string;- accessKeyId?: string;- secretAccessKey?: string;- sessionToken?: string;- bucketName?: string;- region?: string;- paths?: Array<string>; // deprecated- path?: string;- endpointURL?: string;- children?: Array<any>;- perspective?: string; // id of the perspective- creationDate?: string;- isDefault: boolean;- isReadOnly?: boolean;- isNotEditable?: boolean;- watchForChanges?: boolean;- persistIndex?: boolean;- fullTextIndex?: boolean;- maxIndexAge?: number;-};-export const initialState = [];-export default (state: Array<Location> = initialState, action: any) => {+export default (state: Array<TS.Location> = initialState, action: any) => {switch (action.type) {case types.ADD_LOCATION: {if (action.location.isDefault) {@@ -178,7 +148,7 @@ export const actions = {);});},- addLocation: (location: Location, openAfterCreate: boolean = true) => (+ addLocation: (location: TS.Location, openAfterCreate: boolean = true) => (dispatch: (actions: Object) => void) => {dispatch(actions.createLocation(location));@@ -190,11 +160,11 @@ export const actions = {* @param arrLocations* @param override = true - if location exist override else skip*/- addLocations: (arrLocations: Array<Location>, override: boolean = true) => (- dispatch: (actions: Object) => void,- getState: () => any- ) => {- arrLocations.forEach((newLocation: Location, idx, array) => {+ addLocations: (+ arrLocations: Array<TS.Location>,+ override: boolean = true+ ) => (dispatch: (actions: Object) => void, getState: () => any) => {+ arrLocations.forEach((newLocation: TS.Location, idx, array) => {const { locations } = getState();const locationExist: boolean = locations.some(location => location.uuid === newLocation.uuid@@ -207,7 +177,7 @@ export const actions = {}});},- createLocation: (location: Location) => ({+ createLocation: (location: TS.Location) => ({type: types.ADD_LOCATION,location}),@@ -216,7 +186,7 @@ export const actions = {type: types.MOVE_DOWN_LOCATION,uuid}),- editLocation: (location: Location, openAfterEdit: boolean = true) => (+ editLocation: (location: TS.Location, openAfterEdit: boolean = true) => (dispatch: (actions: Object) => void) => {dispatch(actions.changeLocation(location));@@ -241,25 +211,28 @@ export const actions = {dispatch(AppActions.setReadOnlyMode(location.isReadOnly || false));}},- changeLocation: (location: Location) => ({+ changeLocation: (location: TS.Location) => ({type: types.EDIT_LOCATION,location}),- removeLocation: (location: Location) => (+ removeLocation: (location: TS.Location) => (dispatch: (actions: Object) => void) => {dispatch(AppActions.closeLocation(location.uuid));dispatch(actions.deleteLocation(location));},- deleteLocation: (location: Location) => ({+ deleteLocation: (location: TS.Location) => ({type: types.REMOVE_LOCATION,location})};// Selectors-export const getLocations = (state: any): Array<Location> => state.locations;-export const getLocation = (state: any, locationId: string): Location | null =>+export const getLocations = (state: any): Array<TS.Location> => state.locations;+export const getLocation = (+ state: any,+ locationId: string+): TS.Location | null =>state.locations.find(location => location.uuid === locationId);export const getDefaultLocationId = (state: any): string | undefined => {let defaultLocationID;diff --git a/app/reducers/searches.ts b/app/reducers/searches.tsindex 70b00e171..87c8fc179 100644--- a/app/reducers/searches.ts+++ b/app/reducers/searches.ts@@ -17,8 +17,7 @@*/import { immutablySwapItems } from '-/utils/misc';-import { SearchQuery } from '-/services/search';-import { Location } from '-/reducers/locations';+import { TS } from '-/tagspaces.namespace';export const initialState = [];@@ -30,7 +29,7 @@ export const types = {REMOVE_SEARCH: 'SEARCH/REMOVE_SEARCH'};-export default (state: Array<SearchQuery> = initialState, action: any) => {+export default (state: Array<TS.SearchQuery> = initialState, action: any) => {switch (action.type) {case types.ADD_SEARCH: {return [@@ -100,15 +99,15 @@ export default (state: Array<SearchQuery> = initialState, action: any) => {};export const actions = {- addSearch: (search: SearchQuery) => ({+ addSearch: (search: TS.SearchQuery) => ({type: types.ADD_SEARCH,search}),- addSearches: (arrSearches: Array<SearchQuery>, override: boolean = true) => (- dispatch: (actions: Object) => void,- getState: () => any- ) => {- arrSearches.forEach((newSearch: SearchQuery) => {+ addSearches: (+ arrSearches: Array<TS.SearchQuery>,+ override: boolean = true+ ) => (dispatch: (actions: Object) => void, getState: () => any) => {+ arrSearches.forEach((newSearch: TS.SearchQuery) => {const { searches } = getState();const searchExist: boolean = searches.some(location => location.uuid === newSearch.uuid@@ -125,7 +124,7 @@ export const actions = {type: types.MOVE_DOWN_SEARCH,uuid}),- editSearch: (search: SearchQuery) => ({+ editSearch: (search: TS.SearchQuery) => ({type: types.EDIT_SEARCH,search}),@@ -140,4 +139,5 @@ export const actions = {};// Selectors-export const getSearches = (state: any): Array<SearchQuery> => state.searches;+export const getSearches = (state: any): Array<TS.SearchQuery> =>+ state.searches;diff --git a/app/reducers/tagging-actions.ts b/app/reducers/tagging-actions.tsindex 7582dd037..4f568917f 100644--- a/app/reducers/tagging-actions.ts+++ b/app/reducers/tagging-actions.ts@@ -15,11 +15,10 @@* along with this program. If not, see <https://www.gnu.org/licenses/>.**/-import OpenLocationCode from 'open-location-code-typescript';import i18n from '../services/i18n';import { actions as AppActions } from './app';-import { actions as TagLibraryActions, Tag, TagGroup } from './taglibrary';+import { actions as TagLibraryActions } from './taglibrary';import {extractFileExtension,extractFileName,@@ -37,13 +36,14 @@ import PlatformIO from '../services/platform-io';import { Pro } from '../pro';import GlobalSearch from '../services/search-index';import { getPersistTagsInSidecarFile } from './settings';+import { TS } from '-/tagspaces.namespace';export const defaultTagLocation = OpenLocationCode.encode(51.48, 0, undefined); // default tag coordinate Greenwichconst actions = {addTags: (paths: Array<string>,- tags: Array<Tag>,+ tags: Array<TS.Tag>,updateIndex: boolean = true) => (dispatch: (actions: Object) => void, getState: () => any) => {const { settings, taglibrary } = getState();@@ -138,7 +138,7 @@ const actions = {},addTagsToEntry: (path: string,- tags: Array<Tag>,+ tags: Array<TS.Tag>,updateIndex: boolean = true) => async (dispatch: (actions: Object) => void, getState: () => any) => {const { settings } = getState();@@ -282,9 +282,9 @@ const actions = {}function getNonExistingTags(- newTagsArray: Array<Tag>,+ newTagsArray: Array<TS.Tag>,fileTagsArray: Array<string>,- sideCarTagsArray: Array<Tag>+ sideCarTagsArray: Array<TS.Tag>) {const newTags = [];for (let i = 0; i < newTagsArray.length; i += 1) {@@ -310,7 +310,7 @@ const actions = {* @param newTagTitle* @returns {Function}*/- editTagForEntry: (path: string, tag: Tag, newTagTitle: string) => async (+ editTagForEntry: (path: string, tag: TS.Tag, newTagTitle: string) => async (dispatch: (actions: Object) => void,getState: () => any) => {@@ -483,7 +483,7 @@ const actions = {}}},- removeTags: (paths: Array<string>, tags: Array<Tag>) => (+ removeTags: (paths: Array<string>, tags: Array<TS.Tag>) => (dispatch: (actions: Object) => void) => {paths.map(path => {@@ -491,7 +491,7 @@ const actions = {return true;});},- removeTagsFromEntry: (path: string, tags: Array<Tag>) => (+ removeTagsFromEntry: (path: string, tags: Array<TS.Tag>) => (dispatch: (actions: Object) => void,getState: () => any) => {@@ -663,7 +663,7 @@ const actions = {},changeTagOrder: (path: string,- tag: Tag,+ tag: TS.Tag,direction: 'prev' | 'next' | 'first') => () =>// dispatch: (actions: Object) => void@@ -723,7 +723,7 @@ const actions = {{// dispatch(actions.createLocation(location));},- collectTagsFromLocation: (tagGroup: TagGroup) => (+ collectTagsFromLocation: (tagGroup: TS.TagGroup) => (dispatch: (actions: Object) => void,getState: () => any) => {diff --git a/app/reducers/taglibrary.ts b/app/reducers/taglibrary.tsindex c5c22ad93..fbbcea6e9 100644--- a/app/reducers/taglibrary.ts+++ b/app/reducers/taglibrary.ts@@ -15,13 +15,13 @@* along with this program. If not, see <https://www.gnu.org/licenses/>.**/-import uuidv1 from 'uuid';import { immutablySwapItems, formatDateTime4Tag, extend } from '-/utils/misc';import { saveAsTextFile } from '-/services/utils-io';import versionMeta from '../version.json';import defaultTagLibrary from './taglibrary-default';import AppConfig from '../config';+import { TS } from '-/tagspaces.namespace';export const types = {CREATE_TAGGROUP: 'CREATE_TAGGROUP',@@ -43,37 +43,7 @@ export const types = {MOVE_TAG: 'MOVE_TAG'};-export type Uuid = string;--export interface Tag {- title?: string;- type?: 'plain' | 'sidecar' | 'smart'; // smart should be eventually removed from this list, functionality should be enough- id?: Uuid;- icon?: string;- description?: string;- style?: string;- path?: string; // needed for geo tagging should be removed- modified_date?: string;- functionality?: string;- keyBinding?: string;- color?: string;- textcolor?: string;- originTitle?: string;-}--export interface TagGroup {- uuid: Uuid;- title: string;- expanded?: boolean;- description?: string;- categoryId?: string;- readOnly?: boolean;- color?: string;- textcolor?: string;- children?: Array<Tag>;-}--export default (state: Array<TagGroup> = defaultTagLibrary, action: any) => {+export default (state: Array<TS.TagGroup> = defaultTagLibrary, action: any) => {switch (action.type) {case types.CREATE_TAGGROUP: {return [@@ -470,27 +440,27 @@ export default (state: Array<TagGroup> = defaultTagLibrary, action: any) => {};export const actions = {- createTagGroup: (entry: TagGroup) => ({+ createTagGroup: (entry: TS.TagGroup) => ({type: types.CREATE_TAGGROUP,entry}),- editTagGroup: (entry: TagGroup) => ({+ editTagGroup: (entry: TS.TagGroup) => ({type: types.UPDATE_TAGGROUP,entry}),- removeTagGroup: (parentTagGroupUuid: Uuid) => ({+ removeTagGroup: (parentTagGroupUuid: TS.Uuid) => ({type: types.REMOVE_TAGGROUP,uuid: parentTagGroupUuid}),- addTagGroup: (entry: TagGroup) => ({+ addTagGroup: (entry: TS.TagGroup) => ({type: types.ADD_TAGGROUP,entry}),- mergeTagGroup: (entry: TagGroup) => ({+ mergeTagGroup: (entry: TS.TagGroup) => ({type: types.MERGE_TAGGROUP,entry}),- addTag: (tag: string | Object, parentTagGroupUuid: Uuid) => (+ addTag: (tag: string | Object, parentTagGroupUuid: TS.Uuid) => (dispatch: (actions: Object) => void,getState: () => any) => {@@ -525,7 +495,7 @@ export const actions = {},addTagIntern: (tag: string,- parentTagGroupUuid: Uuid,+ parentTagGroupUuid: TS.Uuid,defaultTagTextColor: string,defaultTagBackgroundColor: string) => ({@@ -535,38 +505,38 @@ export const actions = {defaultTagTextColor,defaultTagBackgroundColor}),- copyTag: (tag: Tag, parentTagGroupUuid: Uuid) => ({+ copyTag: (tag: TS.Tag, parentTagGroupUuid: TS.Uuid) => ({type: types.COPY_TAG,tag,uuid: parentTagGroupUuid}),- editTag: (tag: Tag, parentTagGroupUuid: Uuid, origTitle: string) => ({+ editTag: (tag: TS.Tag, parentTagGroupUuid: TS.Uuid, origTitle: string) => ({type: types.UPDATE_TAG,tag,uuid: parentTagGroupUuid,origTitle}),- deleteTag: (tagTitle: string, parentTagGroupUuid: Uuid) => ({+ deleteTag: (tagTitle: string, parentTagGroupUuid: TS.Uuid) => ({type: types.REMOVE_TAG,tagTitle,uuid: parentTagGroupUuid}),- moveTagGroupUp: (parentTagGroupUuid: Uuid) => ({+ moveTagGroupUp: (parentTagGroupUuid: TS.Uuid) => ({type: types.MOVE_TAG_GROUP_UP,uuid: parentTagGroupUuid}),- moveTagGroupDown: (parentTagGroupUuid: Uuid) => ({+ moveTagGroupDown: (parentTagGroupUuid: TS.Uuid) => ({type: types.MOVE_TAG_GROUP_DOWN,uuid: parentTagGroupUuid}),- sortTagGroup: (parentTagGroupUuid: Uuid) => ({+ sortTagGroup: (parentTagGroupUuid: TS.Uuid) => ({type: types.SORT_TAG_GROUP_UP,uuid: parentTagGroupUuid}),moveTag: (tagTitle: string,- fromTagGroupUuid: Uuid,- toTagGroupUuid: Uuid+ fromTagGroupUuid: TS.Uuid,+ toTagGroupUuid: TS.Uuid) => ({type: types.MOVE_TAG,tagTitle,@@ -625,7 +595,7 @@ export const actions = {// Selectorsexport const getTagGroups = (state: any) => state.taglibrary;export const getAllTags = (state: any) => {- const uniqueTags: Array<Tag> = [];+ const uniqueTags: Array<TS.Tag> = [];state.taglibrary.forEach(tagGroup => {tagGroup.children.forEach(tag => {const found = uniqueTags.find(uTag => uTag.title === tag.title);@@ -645,7 +615,7 @@ export const getTagColors = (state: any, tagTitle: string) => {color: state.settings.tagBackgroundColor};state.taglibrary.forEach(tagGroup => {- tagGroup.children.forEach((tag: Tag) => {+ tagGroup.children.forEach((tag: TS.Tag) => {if (tag.title === tagTitle) {tagColors.textcolor = tag.textcolor;tagColors.color = tag.color;diff --git a/app/services/cordova-io.ts b/app/services/cordova-io.tsindex 4a99f5a07..488153319 100644--- a/app/services/cordova-io.ts+++ b/app/services/cordova-io.ts@@ -25,7 +25,7 @@ import {extractFileName,extractFileExtension} from '-/utils/paths';-import { FileSystemEntry } from './utils-io';+import { TS } from '-/tagspaces.namespace';const appSettingFile = 'settings.json';const appSettingTagsFile = 'settingsTags.json';@@ -670,7 +670,10 @@ export default class CordovaIO {});});- getEntryMeta = (eentry: FileSystemEntry, metaPath: string): Promise<any> => {+ getEntryMeta = (+ eentry: TS.FileSystemEntry,+ metaPath: string+ ): Promise<any> => {if (eentry.isFile) {// const metaFilePath = getMetaFileLocationForFile(eentry.path);return this.loadTextFilePromise(metaPath).then(result => {@@ -837,7 +840,7 @@ export default class CordovaIO {content,overWrite: boolean,isRaw?: boolean- ): Promise<FileSystemEntry> => {+ ): Promise<TS.FileSystemEntry> => {// eslint-disable-next-line no-param-reassignfilePath = this.normalizePath(filePath);console.log('Saving file: ' + filePath);@@ -945,7 +948,7 @@ export default class CordovaIO {filePath: string,content: any,overWrite: boolean- ): Promise<FileSystemEntry> => {+ ): Promise<TS.FileSystemEntry> => {console.log('Saving binary file: ' + filePath);// var dataView = new Int8Array(content);const dataView = content;diff --git a/app/services/electron-io.ts b/app/services/electron-io.tsindex bb7685de1..309102aca 100644--- a/app/services/electron-io.ts+++ b/app/services/electron-io.ts@@ -15,7 +15,6 @@* along with this program. If not, see <https://www.gnu.org/licenses/>.**/-import fsextra from 'fs-extra';import pathLib from 'path';import winattr from 'winattr';@@ -33,7 +32,7 @@ import TrayIcon from '../assets/icons/trayIcon.png';import TrayIcon2x from '../assets/icons/[email protected]';import TrayIcon3x from '../assets/icons/[email protected]';import { Pro } from '../pro';-import { FileSystemEntry } from '-/services/utils-io';+import { TS } from '-/tagspaces.namespace';export default class ElectronIO {electron: any;@@ -692,10 +691,10 @@ export default class ElectronIO {filePath: string,content: any,overwrite: boolean = true- ): Promise<FileSystemEntry> =>+ ): Promise<TS.FileSystemEntry> =>new Promise((resolve, reject) => {const fileSystem = this.fs;- function saveFile(entry: FileSystemEntry, tContent) {+ function saveFile(entry: TS.FileSystemEntry, tContent) {fileSystem.writeFile(entry.path, tContent, 'utf8', error => {if (error) {reject(error);@@ -706,7 +705,7 @@ export default class ElectronIO {}this.getPropertiesPromise(filePath)- .then((entry: FileSystemEntry) => {+ .then((entry: TS.FileSystemEntry) => {if (entry && entry.isFile && overwrite) {saveFile({ ...entry, isNewFile: false, tags: [] }, content);} else {@@ -737,7 +736,7 @@ export default class ElectronIO {filePath: string,content: string,overwrite: boolean- ): Promise<FileSystemEntry> => {+ ): Promise<TS.FileSystemEntry> => {console.log('Saving file: ' + filePath);// Handling the UTF8 support for text files@@ -757,7 +756,7 @@ export default class ElectronIO {filePath: string,content: any,overwrite: boolean- ): Promise<FileSystemEntry> => {+ ): Promise<TS.FileSystemEntry> => {console.log('Saving binary file: ' + filePath);const buff = arrayBufferToBuffer(content);return this.saveFilePromise(filePath, buff, overwrite);diff --git a/app/services/objectstore-io.ts b/app/services/objectstore-io.tsindex bb8a67d48..549880896 100644--- a/app/services/objectstore-io.ts+++ b/app/services/objectstore-io.ts@@ -29,7 +29,7 @@ import {extractFileExtension,getMetaFileLocationForDir} from '-/utils/paths';-import { FileSystemEntry } from '-/services/utils-io';+import { TS } from '-/tagspaces.namespace';export default class ObjectStoreIO {objectStore = undefined;@@ -312,7 +312,7 @@ export default class ObjectStoreIO {});});- getEntryMeta = async (eentry: FileSystemEntry): Promise<Object> => {+ getEntryMeta = async (eentry: TS.FileSystemEntry): Promise<Object> => {const promise = new Promise(async resolve => {if (eentry.isFile) {const metaFilePath = getMetaFileLocationForFile(eentry.path, '/');@@ -601,7 +601,7 @@ export default class ObjectStoreIO {request: () => any) => void,onAbort?: () => void- ): Promise<FileSystemEntry> {+ ): Promise<TS.FileSystemEntry> {return new Promise((resolve, reject) => {let isNewFile = false;// eslint-disable-next-line no-param-reassigndiff --git a/app/services/platform-io.ts b/app/services/platform-io.tsindex 76dab7c31..fc7335975 100644--- a/app/services/platform-io.ts+++ b/app/services/platform-io.ts@@ -22,7 +22,7 @@ import { Pro } from '../pro';import NativePlatformIO from './_PLATFORMIO_';import ObjectStoreIO from './objectstore-io';import AppConfig from '-/config';-import { FileSystemEntry } from '-/services/utils-io';+import { TS } from '-/tagspaces.namespace';const nativeAPI: any = new NativePlatformIO();let objectStoreAPI;@@ -336,7 +336,7 @@ export default class PlatformIO {progress: any, // ManagedUpload.Progress,response: any // AWS.Response<AWS.S3.PutObjectOutput, AWS.AWSError>) => void- ): Promise<FileSystemEntry> => {+ ): Promise<TS.FileSystemEntry> => {if (objectStoreAPI) {return objectStoreAPI.saveBinaryFilePromise(filePath,diff --git a/app/services/search.ts b/app/services/search.tsindex 97b55dc1b..ea3f63fba 100644--- a/app/services/search.ts+++ b/app/services/search.ts@@ -22,9 +22,8 @@ import jmespath from 'jmespath';import OpenLocationCode from 'open-location-code-typescript';import { isPlusCode } from '-/utils/misc';import { extractTimePeriod } from '-/utils/dates';-import { Tag } from '-/reducers/taglibrary';import { Pro } from '../pro';-import { FileSystemEntry } from './utils-io';+import { TS } from '-/tagspaces.namespace';// export type FileTypeGroups = 'images' | 'notes' | 'documents' | 'audio' | 'video' | 'archives';@@ -54,29 +53,6 @@ export const FileTypeGroups = {untagged: ['untagged']};-export type SearchQuery = {- uuid?: string; // for saved searches- title?: string; // for saved searches- // creationDate?: number; // for saved searches TODO rethink if this needed ?- textQuery?: string;- fileTypes?: Array<string>;- tagsAND?: Array<Tag>;- tagsOR?: Array<Tag>;- tagsNOT?: Array<Tag>;- lastModified?: string;- fileSize?: string;- searchBoxing?: 'location' | 'folder' | 'global';- searchType?: 'fussy' | 'semistrict' | 'strict';- forceIndexing?: boolean;- currentDirectory?: string;- tagTimePeriodFrom?: number | null;- tagTimePeriodTo?: number | null;- tagPlaceLat?: number | null;- tagPlaceLong?: number | null;- tagPlaceRadius?: number | null;- maxSearchResults?: number;-};-// id, name, isFile, tags, extension, size, lmdt, path// index[?size > '9000' && contains(path, 'Apple')]@@ -150,7 +126,7 @@ const fuseOptions = {// filters for all AND and NOT tags. The Pro version can pipe the result into an additional filter for extension instead of tags.title.// The final string for the tag search should look like this:// index[? tags[? title=='ORTag1' || title=='ORTag2']] | [? tags[? title=='ANDTag1']] | [? tags[? title=='ANDTag2']] | [?!(tags[? title=='NOTTag1'])] | [?!(tags[? title=='NOTTag2'])] | extensionFilter-function constructjmespathQuery(searchQuery: SearchQuery): string {+function constructjmespathQuery(searchQuery: TS.SearchQuery): string {let jmespathQuery = '';const ANDtagsExist = searchQuery.tagsAND && searchQuery.tagsAND.length >= 1;const ORtagsExist = searchQuery.tagsOR && searchQuery.tagsOR.length >= 1;@@ -242,7 +218,7 @@ function prepareIndex(index: Array<Object>) {let toTime = null;if (tags && tags.length) {tags.map(tag => {- const enhancedTag: Tag = {+ const enhancedTag: TS.Tag = {...tag};try {@@ -306,9 +282,9 @@ function setOriginTitle(results: Array<Object>) {export default class Search {static searchLocationIndex = (- locationContent: Array<FileSystemEntry>,- searchQuery: SearchQuery- ): Promise<Array<FileSystemEntry> | []> =>+ locationContent: Array<TS.FileSystemEntry>,+ searchQuery: TS.SearchQuery+ ): Promise<Array<TS.FileSystemEntry> | []> =>new Promise(resolve => {console.time('searchtime');const jmespathQuery = constructjmespathQuery(searchQuery);diff --git a/app/services/utils-io.ts b/app/services/utils-io.tsindex 6f0eb3083..0dadd9722 100644--- a/app/services/utils-io.ts+++ b/app/services/utils-io.ts@@ -34,42 +34,11 @@ import {} from '-/utils/paths';import i18n from '../services/i18n';import versionMeta from '../version.json';-import { Tag } from '-/reducers/taglibrary';import { getThumbnailURLPromise } from '-/services/thumbsgenerator';import { OpenedEntry, actions as AppActions } from '-/reducers/app';-import { Location, locationType, getLocation } from '-/reducers/locations';--export interface FileSystemEntry {- uuid?: string;- name: string;- isFile: boolean;- isNewFile?: boolean;- extension: string;- thumbPath?: string;- color?: string;- perspective?: string;- textContent?: string;- description?: string;- tags: Array<Tag>;- size: number;- lmdt: number;- path: string;- url?: string;- meta?: FileSystemEntryMeta;-}--export interface FileSystemEntryMeta {- id?: string;- description?: string;- tags?: Array<Tag>;- color?: string;- perspective?: string;- appName: string;- appVersion: string;- lastUpdated: string;- files?: Array<FileSystemEntry>;- dirs?: Array<FileSystemEntry>;-}+import { getLocation } from '-/reducers/locations';+import { TS } from '-/tagspaces.namespace';+import { locationType } from '-/utils/misc';export function enhanceDirectoryContent(dirEntries,@@ -123,7 +92,7 @@ export function enhanceDirectoryContent(};}-export function enhanceEntry(entry: any): FileSystemEntry {+export function enhanceEntry(entry: any): TS.FileSystemEntry {let fileNameTags = [];if (entry.isFile) {fileNameTags = extractTagsAsObjects(@@ -149,7 +118,7 @@ export function enhanceEntry(entry: any): FileSystemEntry {return true;});}- const enhancedEntry: FileSystemEntry = {+ const enhancedEntry: TS.FileSystemEntry = {uuid: uuidv1(),name: entry.name,isFile: entry.isFile,@@ -215,7 +184,7 @@ export function prepareDirectoryContent(getState,dirEntryMeta) {- const currentLocation: Location = getLocation(+ const currentLocation: TS.Location = getLocation(getState(),getState().app.currentLocationId);@@ -336,8 +305,8 @@ export function findExtensionsForEntry(export function getNextFile(pivotFilePath?: string,lastSelectedEntry?: string,- currentDirectoryEntries?: Array<FileSystemEntry>-): FileSystemEntry {+ currentDirectoryEntries?: Array<TS.FileSystemEntry>+): TS.FileSystemEntry {const currentEntries = currentDirectoryEntries? currentDirectoryEntries.filter(entry => entry.isFile): [];@@ -373,8 +342,8 @@ export function getNextFile(export function getPrevFile(pivotFilePath?: string,lastSelectedEntry?: string,- currentDirectoryEntries?: Array<FileSystemEntry>-): FileSystemEntry {+ currentDirectoryEntries?: Array<TS.FileSystemEntry>+): TS.FileSystemEntry {const currentEntries = currentDirectoryEntries? currentDirectoryEntries.filter(entry => entry.isFile): [];@@ -409,7 +378,7 @@ export function getPrevFile(export function createDirectoryIndex(directoryPath: string,extractText: boolean = false-): Promise<Array<FileSystemEntry>> {+): Promise<Array<TS.FileSystemEntry>> {const dirPath = cleanTrailingDirSeparator(directoryPath);if (PlatformIO.isWorkerAvailable() && !PlatformIO.haveObjectStoreSupport()) {// Start indexing in worker if not in the object store mode@@ -551,7 +520,7 @@ export function walkDirectory(export async function getAllPropertiesPromise(entryPath: string-): Promise<FileSystemEntry> {+): Promise<TS.FileSystemEntry> {const entryProps = await PlatformIO.getPropertiesPromise(entryPath);let metaFilePath;const dirSep = PlatformIO.getDirSeparator();@@ -742,7 +711,7 @@ export function generateFileName(export async function loadMetaDataPromise(path: string-): Promise<FileSystemEntryMeta> {+): Promise<TS.FileSystemEntryMeta> {const entryProperties = await PlatformIO.getPropertiesPromise(path);let metaDataObject;if (entryProperties.isFile) {@@ -798,8 +767,8 @@ export async function loadMetaDataPromise(}export function cleanMetaData(- metaData: FileSystemEntryMeta-): FileSystemEntryMeta {+ metaData: TS.FileSystemEntryMeta+): TS.FileSystemEntryMeta {const cleanedMeta: any = {};if (metaData.id) {cleanedMeta.id = metaData.id;@@ -822,7 +791,7 @@ export function cleanMetaData(if (metaData.tags && metaData.tags.length > 0) {cleanedMeta.tags = [];metaData.tags.forEach(tag => {- const cleanedTag: Tag = {};+ const cleanedTag: TS.Tag = {};if (tag.title) {cleanedTag.title = tag.title;}diff --git a/app/services/webdav-io.ts b/app/services/webdav-io.tsindex 0aa0539d7..c3625d822 100644--- a/app/services/webdav-io.ts+++ b/app/services/webdav-io.ts@@ -15,7 +15,6 @@* along with this program. If not, see <https://www.gnu.org/licenses/>.**/-import nl from '../utils/js-webdav-client';import {extractParentDirectoryPath,@@ -23,9 +22,9 @@ import {getMetaFileLocationForDir,extractFileName,extractFileExtension-} from '../utils/paths';+} from '-/utils/paths';import AppConfig from '../config';-import { FileSystemEntry } from './utils-io';+import { TS } from '-/tagspaces.namespace';export default class WebDAVIO {davClient: any;@@ -326,7 +325,10 @@ export default class WebDAVIO {dav.resourcetype._xmlvalue[0].localName === 'collection'));- getEntryMeta = (eentry: FileSystemEntry, metaPath: string): Promise<Object> =>+ getEntryMeta = (+ eentry: TS.FileSystemEntry,+ metaPath: string+ ): Promise<Object> =>new Promise(resolve => {if (eentry.isFile) {this.loadTextFilePromise(metaPath)@@ -448,7 +450,7 @@ export default class WebDAVIO {content: string,overWrite: boolean,mode?: string- ): Promise<FileSystemEntry> =>+ ): Promise<TS.FileSystemEntry> =>new Promise((resolve, reject) => {let isNewFile = false;this.davClient.propfind(@@ -520,7 +522,7 @@ export default class WebDAVIO {filePath: string,content: string,overWrite: boolean- ): Promise<FileSystemEntry> {+ ): Promise<TS.FileSystemEntry> {console.log('Saving binary file: ' + filePath);return this.saveFilePromise(filePath, content, overWrite);}diff --git a/app/store/configureStore.dev.ts b/app/store/configureStore.dev.tsindex 2a96bc2c6..065f862a0 100644--- a/app/store/configureStore.dev.ts+++ b/app/store/configureStore.dev.ts@@ -15,7 +15,8 @@* along with this program. If not, see <https://www.gnu.org/licenses/>.**/-+/* global TagSpaces */+/* eslint no-undef: "error" */import { createStore, applyMiddleware, compose } from 'redux';import { persistStore } from 'redux-persist';import thunk from 'redux-thunk';diff --git a/app/tagspaces.namespace.d.ts b/app/tagspaces.namespace.d.tsnew file mode 100644index 000000000..59ac1abfc--- /dev/null+++ b/app/tagspaces.namespace.d.ts@@ -0,0 +1,129 @@+/**+ * TagSpaces - universal file and folder organizer+ * Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License (version 3) as+ * published by the Free Software Foundation.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <https://www.gnu.org/licenses/>.+ *+ */++export namespace TS {+ interface Location {+ uuid: string;+ newuuid?: string;+ name: string;+ type: string;+ accessKeyId?: string;+ secretAccessKey?: string;+ sessionToken?: string;+ bucketName?: string;+ region?: string;+ paths?: Array<string>; // deprecated+ path?: string;+ endpointURL?: string;+ children?: Array<any>;+ perspective?: string; // id of the perspective+ creationDate?: string;+ isDefault: boolean;+ isReadOnly?: boolean;+ isNotEditable?: boolean;+ watchForChanges?: boolean;+ persistIndex?: boolean;+ fullTextIndex?: boolean;+ maxIndexAge?: number;+ }++ interface SearchQuery {+ uuid?: string; // for saved searches+ title?: string; // for saved searches+ // creationDate?: number; // for saved searches TODO rethink if this needed ?+ textQuery?: string;+ fileTypes?: Array<string>;+ tagsAND?: Array<Tag>;+ tagsOR?: Array<Tag>;+ tagsNOT?: Array<Tag>;+ lastModified?: string;+ fileSize?: string;+ searchBoxing?: 'location' | 'folder' | 'global';+ searchType?: 'fussy' | 'semistrict' | 'strict';+ forceIndexing?: boolean;+ currentDirectory?: string;+ tagTimePeriodFrom?: number | null;+ tagTimePeriodTo?: number | null;+ tagPlaceLat?: number | null;+ tagPlaceLong?: number | null;+ tagPlaceRadius?: number | null;+ maxSearchResults?: number;+ }++ type Uuid = string;++ interface Tag {+ title?: string;+ type?: 'plain' | 'sidecar' | 'smart'; // smart should be eventually removed from this list, functionality should be enough+ id?: Uuid;+ icon?: string;+ description?: string;+ style?: string;+ path?: string; // needed for geo tagging should be removed+ modified_date?: string;+ functionality?: string;+ keyBinding?: string;+ color?: string;+ textcolor?: string;+ originTitle?: string;+ }++ interface TagGroup {+ uuid: Uuid;+ title: string;+ expanded?: boolean;+ description?: string;+ categoryId?: string;+ readOnly?: boolean;+ color?: string;+ textcolor?: string;+ children?: Array<Tag>;+ }++ interface FileSystemEntry {+ uuid?: string;+ name: string;+ isFile: boolean;+ isNewFile?: boolean;+ extension: string;+ thumbPath?: string;+ color?: string;+ perspective?: string;+ textContent?: string;+ description?: string;+ tags: Array<TS.Tag>;+ size: number;+ lmdt: number;+ path: string;+ url?: string;+ meta?: FileSystemEntryMeta;+ }++ interface FileSystemEntryMeta {+ id?: string;+ description?: string;+ tags?: Array<TS.Tag>;+ color?: string;+ perspective?: string;+ appName: string;+ appVersion: string;+ lastUpdated: string;+ files?: Array<FileSystemEntry>;+ dirs?: Array<FileSystemEntry>;+ }+}diff --git a/app/utils/HandleAuth.tsx b/app/utils/HandleAuth.tsxindex b3a355787..7e509d00f 100644--- a/app/utils/HandleAuth.tsx+++ b/app/utils/HandleAuth.tsx@@ -7,15 +7,16 @@ import {import { API, Auth } from 'aws-amplify';import { bindActionCreators } from 'redux';import { connect } from 'react-redux';-import { actions as LocationActions, Location } from '-/reducers/locations';-import { actions as TagGroupActions, TagGroup } from '-/reducers/taglibrary';+import { actions as LocationActions } from '-/reducers/locations';+import { actions as TagGroupActions } from '-/reducers/taglibrary';import { actions as AppActions } from '-/reducers/app';+import { TS } from '-/tagspaces.namespace';interface Props {loggedIn: (user: CognitoUserInterface) => void;initApp: () => void;- addLocations: (locations: Array<Location>, override: boolean) => void;- importTagGroups: (tagGroups: Array<TagGroup>, replace: boolean) => void;+ addLocations: (locations: Array<TS.Location>, override: boolean) => void;+ importTagGroups: (tagGroups: Array<TS.TagGroup>, replace: boolean) => void;}const HandleAuth = React.memo((props: Props) => {const username = useRef(undefined);diff --git a/app/utils/metaoperations.ts b/app/utils/metaoperations.tsindex 1b36ce341..42cdc14f4 100644--- a/app/utils/metaoperations.ts+++ b/app/utils/metaoperations.ts@@ -1,18 +1,15 @@-import {- FileSystemEntryMeta,- loadMetaDataPromise,- saveMetaDataPromise-} from '-/services/utils-io';+import { loadMetaDataPromise, saveMetaDataPromise } from '-/services/utils-io';+import { TS } from '-/tagspaces.namespace';// eslint-disable-next-line import/prefer-default-exportexport function savePerspective(path: string,perspective: string-): Promise<FileSystemEntryMeta> {+): Promise<TS.FileSystemEntryMeta> {return new Promise((resolve, reject) => {loadMetaDataPromise(path)- .then((fsEntryMeta: FileSystemEntryMeta) => {- let updatedFsEntryMeta: FileSystemEntryMeta;+ .then((fsEntryMeta: TS.FileSystemEntryMeta) => {+ let updatedFsEntryMeta: TS.FileSystemEntryMeta;if (perspective && perspective !== 'unspecified') {updatedFsEntryMeta = {...fsEntryMeta,@@ -36,7 +33,7 @@ export function savePerspective(return true;}).catch(() => {- const newFsEntryMeta: FileSystemEntryMeta = {+ const newFsEntryMeta: TS.FileSystemEntryMeta = {appName: '',appVersion: '',description: '',diff --git a/app/utils/misc.ts b/app/utils/misc.tsindex 4214730b4..8937ef808 100644--- a/app/utils/misc.ts+++ b/app/utils/misc.ts@@ -15,9 +15,14 @@* along with this program. If not, see <https://www.gnu.org/licenses/>.**/--import { Location, locationType } from '-/reducers/locations';import { cleanFileName, getLocationPath } from '-/utils/paths';+import { TS } from '-/tagspaces.namespace';++export const locationType = {+ TYPE_LOCAL: '0',+ TYPE_CLOUD: '1',+ TYPE_AMPLIFY: '2'+};/** Returns true is a string is plus code e.g. 8FWH4HVG+3V 8FWH4HVG+ 8FWH4H+ */export function isPlusCode(plusCode: string): boolean {@@ -155,7 +160,7 @@ export function clearURLParam(paramName) {}export function updateHistory(- currentLocation: Location,+ currentLocation: TS.Location,currentDirectory: string,entryPath?: string) {diff --git a/app/utils/paths.ts b/app/utils/paths.tsindex 3db116c6b..46235a3c5 100644--- a/app/utils/paths.ts+++ b/app/utils/paths.ts@@ -17,8 +17,7 @@*/import AppConfig from '../config';-import { Tag } from '-/reducers/taglibrary';-import { Location } from '-/reducers/locations';+import { TS } from '-/tagspaces.namespace';export function baseName(dirPath: string,@@ -347,7 +346,7 @@ export function extractTagsAsObjects(filePath: string,tagDelimiter: string = AppConfig.tagDelimiter,dirSeparator: string // = AppConfig.dirSeparator-): Array<Tag> {+): Array<TS.Tag> {const tagsInFileName = extractTags(filePath, tagDelimiter, dirSeparator);const tagArray = [];tagsInFileName.map(tag => {@@ -393,7 +392,7 @@ export function extractTags(return cleanedTags;}-export function getLocationPath(location: Location) {+export function getLocationPath(location: TS.Location) {if (location) {if (location.path) {return location.path;@@ -410,7 +409,10 @@ export function getLocationPath(location: Location) {* @param filePath* @param locations*/-export function extractLocation(filePath: string, locations: Array<Location>) {+export function extractLocation(+ filePath: string,+ locations: Array<TS.Location>+) {let currentLocation;const path = filePath.replace(/[/\\]/g, '');for (let i = 0; i < locations.length; i += 1) {diff --git a/tests/unit/search.inactive.js b/tests/unit/search.test.jssimilarity index 100%rename from tests/unit/search.inactive.jsrename to tests/unit/search.test.js