Files
mattermost-mobile/types/database/database.d.ts
Avinash Lingaloo e8ce78f39d MM-36721 - [GEKIDOU] Porting Markdown components (#5586)
* Started with Channel Post List

* Added markdown hashtag

* Added TouchableWithFeedback component

* Added utils/bottom_sheet

* Removed BottomSheet in favor of future SlideUpPanel

* Added markdown_block_quote

* Added markdown_list_item

* Added markdown_list

* Added MarkDownTableCell component

* Markdown_table - in progress - need to verify TS

* Added markdown_table

* Update Podfile.lock

* Added deep_linking constant

* Added utils/draft

* Update config to include ExperimentalNormalizeMarkdownLinks

* Added markdown_link

* Added markdown_table_row

* Added ProgressiveImage and RetriableImage components and images utils

* Converted Retriable component to functional component

* Added type definition for commonmark

* Continuing with markdown TS

* Markdown - Typing props [ in progress ]

* Fix boolean flag with mardown block quote

* Adding observable config to markdown_link

* TS Fixes [ in progress ]

* TS fixes

* TS fixes - TextStyles

* Update markdown.tsx

* TS fixes on markdown

* TS Fixes - AtMention component

* AtMention [ IN PROGRESS ]

* Add markdown support

* Fix emoji and jumboEmoji on iOS

* Fix handleMyTeam operator

* Fix navigation style based on theme

* Fix iOS MattermostManaged deleteDatabse return error type

* wrap setNavigationStackStyles under a requestAnimationFrame

* Add preventDoubleTap to channel mention

* Increase double tap to 750ms

* Fix handleReceivedPostsInChannel chunk query

* Set initial navigation theme

* Swizzle FastImage on iOS

* fix preventDoubleTap test

Co-authored-by: Avinash Lingaloo <>
Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
2021-08-02 20:30:17 +04:00

281 lines
6.1 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
/* eslint-disable max-lines */
import {Database} from '@nozbe/watermelondb';
import Model from '@nozbe/watermelondb/Model';
import {Clause} from '@nozbe/watermelondb/QueryDescription';
import {Class} from '@nozbe/watermelondb/utils/common';
import type AppDataOperator from '@database/operator/app_data_operator';
import type ServerDataOperator from '@app/database/operator/server_data_operator';
import type {Config} from '@typings/database/models/servers/config';
import type {License} from '@typings/database/models/servers/license';
import type System from '@typings/database/models/servers/system';
import {DatabaseType} from './enums';
export type WithDatabaseArgs = { database: Database }
export type CreateServerDatabaseConfig = {
dbName: string;
dbType?: DatabaseType.DEFAULT | DatabaseType.SERVER;
displayName?: string;
serverUrl?: string;
};
export type RegisterServerDatabaseArgs = {
databaseFilePath: string;
displayName: string;
serverUrl: string;
};
export type AppDatabase = {
database: Database;
operator: AppDataOperator;
};
export type ServerDatabase = {
database: Database;
operator: ServerDataOperator;
}
export type ServerDatabases = {
[x: string]: ServerDatabase;
};
export type TransformerArgs = {
action: string;
database: Database;
fieldsMapper?: (model: Model) => void;
tableName?: string;
value: RecordPair;
};
export type OperationArgs = {
tableName: string;
createRaws?: RecordPair[];
updateRaws?: RecordPair[];
deleteRaws?: Model[];
transformer: (TransformerArgs) => Promise<Model>;
};
export type Models = Array<Class<Model>>;
// The elements needed to create a new database
export type CreateServerDatabaseArgs = {
config: CreateServerDatabaseConfig;
shouldAddToAppDatabase?: boolean;
};
export type HandleReactionsArgs = {
prepareRecordsOnly: boolean;
postsReactions: ReactionsPerPost[];
};
export type HandleFilesArgs = {
files: FileInfo[];
prepareRecordsOnly: boolean;
};
export type HandlePostMetadataArgs = {
metadatas: Metadata[];
prepareRecordsOnly: boolean;
};
export type HandlePostsArgs = {
actionType: string;
order: string[];
previousPostId?: string;
posts: Post[];
};
export type SanitizeReactionsArgs = {
database: Database;
post_id: string;
rawReactions: Reaction[];
};
export type ChainPostsArgs = {
order: string[];
previousPostId: string;
posts: Post[];
};
export type SanitizePostsArgs = {
orders: string[];
posts: Post[];
};
export type IdenticalRecordArgs = {
existingRecord: Model;
newValue: RawValue;
tableName: string;
};
export type RetrieveRecordsArgs = {
database: Database;
tableName: string;
condition: Clause;
};
export type ProcessRecordsArgs = {
createOrUpdateRawValues: RawValue[];
deleteRawValues: RawValue[];
tableName: string;
fieldName: string;
findMatchingRecordBy: (existing: Model, newElement: RawValue) => boolean;
};
export type HandleRecordsArgs = {
findMatchingRecordBy: (existing: Model, newElement: RawValue) => boolean;
fieldName: string;
transformer: (TransformerArgs) => Promise<Model>;
createOrUpdateRawValues: RawValue[];
deleteRawValues?: RawValue[];
tableName: string;
prepareRecordsOnly: boolean;
};
export type RangeOfValueArgs = {
raws: RawValue[];
fieldName: string;
};
export type RecordPair = {
record?: Model;
raw: RawValue;
};
type PrepareOnly = {
prepareRecordsOnly: boolean;
}
export type HandleInfoArgs = PrepareOnly & {
info: AppInfo[];
}
export type HandleGlobalArgs = PrepareOnly & {
global: IdValue[];
}
export type HandleRoleArgs = PrepareOnly & {
roles: Role[];
}
export type HandleCustomEmojiArgs = PrepareOnly & {
emojis: CustomEmoji[];
}
export type HandleSystemArgs = PrepareOnly & {
systems: IdValue[];
}
export type HandleTOSArgs = PrepareOnly & {
termOfService: TermsOfService[];
}
export type HandleMyChannelArgs = PrepareOnly & {
channels: Channel[];
myChannels: ChannelMembership[];
};
export type HandleChannelInfoArgs = PrepareOnly &{
channelInfos: ChannelInfo[];
};
export type HandleMyChannelSettingsArgs = PrepareOnly & {
settings: ChannelMembership[];
};
export type HandleChannelArgs = PrepareOnly & {
channels: Channel[];
};
export type HandleMyTeamArgs = PrepareOnly & {
myTeams: MyTeam[];
};
export type HandleSlashCommandArgs = PrepareOnly & {
slashCommands: SlashCommand[];
};
export type HandleTeamSearchHistoryArgs = PrepareOnly &{
teamSearchHistories: TeamSearchHistory[];
};
export type HandleTeamChannelHistoryArgs = PrepareOnly & {
teamChannelHistories: TeamChannelHistory[];
};
export type HandleTeamArgs = PrepareOnly & {
teams: Team[];
};
export type HandleGroupsInChannelArgs = PrepareOnly & {
groupsInChannels: GroupChannel[];
};
export type HandleGroupsInTeamArgs = PrepareOnly &{
groupsInTeams: GroupTeam[];
};
export type HandleGroupArgs = PrepareOnly & {
groups: Group[];
};
export type HandleChannelMembershipArgs = PrepareOnly & {
channelMemberships: ChannelMembership[];
};
export type HandleGroupMembershipArgs = PrepareOnly & {
groupMemberships: GroupMembership[];
};
export type HandleTeamMembershipArgs = PrepareOnly & {
teamMemberships: TeamMembership[];
};
export type HandlePreferencesArgs = PrepareOnly & {
preferences: PreferenceType[];
};
export type HandleUsersArgs = PrepareOnly & {
users: UserProfile[];
};
export type HandleDraftArgs = PrepareOnly & {
drafts: Draft[];
};
export type LoginArgs = {
config: Partial<Config>;
ldapOnly?: boolean;
license: Partial<License>;
loginId: string;
mfaToken?: string;
password: string;
};
export type LoadMeArgs = { user?: UserProfile; deviceToken?: string };
export type ServerUrlChangedArgs = {
configRecord: System;
licenseRecord: System;
selectServerRecord: System;
serverUrl: string;
};
export type GetDatabaseConnectionArgs = {
serverUrl: string;
connectionName?: string;
setAsActiveDatabase: boolean;
}
export type ProcessRecordResults = {
createRaws: RecordPair[];
updateRaws: RecordPair[];
deleteRaws: Model[];
}