@replyke/core
Version:
Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.
1,163 lines • 84 kB
TypeScript
import { PayloadAction } from "@reduxjs/toolkit";
import type { ReplykeState } from '../replykeReducers';
import { Space } from "../../interfaces/models/Space";
import { SpaceListSortByOptions } from "../../interfaces/SpaceListSortByOptions";
export interface SpaceListState {
spaces: Space[];
page: number;
loading: boolean;
hasMore: boolean;
error: string | null;
lastFetched: number | null;
limit: number;
sortBy: SpaceListSortByOptions;
searchSlug: string | null;
searchName: string | null;
searchDescription: string | null;
searchAny: string | null;
readingPermission: "anyone" | "members" | null;
memberOf: boolean;
parentSpaceId: string | null;
}
export interface SpaceListsState {
lists: {
[listId: string]: SpaceListState;
};
}
export interface SpaceListFilters {
sortBy?: SpaceListSortByOptions;
searchSlug?: string | null;
searchName?: string | null;
searchDescription?: string | null;
searchAny?: string | null;
readingPermission?: "anyone" | "members" | null;
memberOf?: boolean;
parentSpaceId?: string | null;
}
export interface SpaceListConfig {
limit?: number;
}
export interface SpaceListFetchOptions {
resetUnspecified?: boolean;
fetchImmediately?: boolean;
clearImmediately?: boolean;
}
export interface FilterUpdatePayload {
listId: string;
filters: Partial<SpaceListFilters>;
config?: SpaceListConfig;
options?: SpaceListFetchOptions;
}
export interface InitializeListPayload {
listId: string;
}
export interface SpaceAddPayload {
listId: string;
space: Space;
insertPosition?: "first" | "last";
}
export interface SpaceRemovePayload {
listId: string;
spaceId: string;
}
export interface SpaceUpdatePayload {
listId: string;
spaceId: string;
updates: Partial<Space>;
}
export interface SpacesSetPayload {
listId: string;
spaces: Space[];
append?: boolean;
}
export declare const spaceListsSlice: import("@reduxjs/toolkit").Slice<SpaceListsState, {
initializeList: (state: {
lists: {
[x: string]: {
spaces: {
id: string;
projectId: string;
shortId: string;
slug: string | null;
name: string;
description: string | null;
avatarFileId: string | null;
bannerFileId: string | null;
userId: string;
readingPermission: import("../../interfaces/models/Space").ReadingPermission;
postingPermission: import("../../interfaces/models/Space").PostingPermission;
requireJoinApproval: boolean;
parentSpaceId: string | null;
depth: number;
metadata: {
[x: string]: any;
};
createdAt: Date;
updatedAt: Date;
deletedAt: Date | null;
membersCount: number;
childSpacesCount: number;
isMember?: boolean | undefined;
avatarFile?: {
id: string;
projectId: string;
userId: string | null;
entityId: string | null;
commentId: string | null;
chatMessageId: string | null;
spaceId: string | null;
type: "image" | "video" | "document" | "other";
originalPath: string;
originalSize: number;
originalMimeType: string;
position: number;
metadata: {
[x: string]: any;
};
image?: {
fileId: string;
originalWidth: number;
originalHeight: number;
variants: {
[x: string]: {
path: string;
publicPath: string;
width: number;
height: number;
size: number;
format: string;
};
};
processingStatus: "completed" | "failed";
processingError: string | null;
format: string;
quality: number;
exifStripped: boolean;
createdAt: Date;
updatedAt: Date;
} | undefined;
createdAt: Date;
updatedAt: Date;
} | undefined;
bannerFile?: {
id: string;
projectId: string;
userId: string | null;
entityId: string | null;
commentId: string | null;
chatMessageId: string | null;
spaceId: string | null;
type: "image" | "video" | "document" | "other";
originalPath: string;
originalSize: number;
originalMimeType: string;
position: number;
metadata: {
[x: string]: any;
};
image?: {
fileId: string;
originalWidth: number;
originalHeight: number;
variants: {
[x: string]: {
path: string;
publicPath: string;
width: number;
height: number;
size: number;
format: string;
};
};
processingStatus: "completed" | "failed";
processingError: string | null;
format: string;
quality: number;
exifStripped: boolean;
createdAt: Date;
updatedAt: Date;
} | undefined;
createdAt: Date;
updatedAt: Date;
} | undefined;
}[];
page: number;
loading: boolean;
hasMore: boolean;
error: string | null;
lastFetched: number | null;
limit: number;
sortBy: SpaceListSortByOptions;
searchSlug: string | null;
searchName: string | null;
searchDescription: string | null;
searchAny: string | null;
readingPermission: "anyone" | "members" | null;
memberOf: boolean;
parentSpaceId: string | null;
};
};
}, action: PayloadAction<InitializeListPayload>) => void;
updateFilters: (state: {
lists: {
[x: string]: {
spaces: {
id: string;
projectId: string;
shortId: string;
slug: string | null;
name: string;
description: string | null;
avatarFileId: string | null;
bannerFileId: string | null;
userId: string;
readingPermission: import("../../interfaces/models/Space").ReadingPermission;
postingPermission: import("../../interfaces/models/Space").PostingPermission;
requireJoinApproval: boolean;
parentSpaceId: string | null;
depth: number;
metadata: {
[x: string]: any;
};
createdAt: Date;
updatedAt: Date;
deletedAt: Date | null;
membersCount: number;
childSpacesCount: number;
isMember?: boolean | undefined;
avatarFile?: {
id: string;
projectId: string;
userId: string | null;
entityId: string | null;
commentId: string | null;
chatMessageId: string | null;
spaceId: string | null;
type: "image" | "video" | "document" | "other";
originalPath: string;
originalSize: number;
originalMimeType: string;
position: number;
metadata: {
[x: string]: any;
};
image?: {
fileId: string;
originalWidth: number;
originalHeight: number;
variants: {
[x: string]: {
path: string;
publicPath: string;
width: number;
height: number;
size: number;
format: string;
};
};
processingStatus: "completed" | "failed";
processingError: string | null;
format: string;
quality: number;
exifStripped: boolean;
createdAt: Date;
updatedAt: Date;
} | undefined;
createdAt: Date;
updatedAt: Date;
} | undefined;
bannerFile?: {
id: string;
projectId: string;
userId: string | null;
entityId: string | null;
commentId: string | null;
chatMessageId: string | null;
spaceId: string | null;
type: "image" | "video" | "document" | "other";
originalPath: string;
originalSize: number;
originalMimeType: string;
position: number;
metadata: {
[x: string]: any;
};
image?: {
fileId: string;
originalWidth: number;
originalHeight: number;
variants: {
[x: string]: {
path: string;
publicPath: string;
width: number;
height: number;
size: number;
format: string;
};
};
processingStatus: "completed" | "failed";
processingError: string | null;
format: string;
quality: number;
exifStripped: boolean;
createdAt: Date;
updatedAt: Date;
} | undefined;
createdAt: Date;
updatedAt: Date;
} | undefined;
}[];
page: number;
loading: boolean;
hasMore: boolean;
error: string | null;
lastFetched: number | null;
limit: number;
sortBy: SpaceListSortByOptions;
searchSlug: string | null;
searchName: string | null;
searchDescription: string | null;
searchAny: string | null;
readingPermission: "anyone" | "members" | null;
memberOf: boolean;
parentSpaceId: string | null;
};
};
}, action: PayloadAction<FilterUpdatePayload>) => void;
setSpaceListLoading: (state: {
lists: {
[x: string]: {
spaces: {
id: string;
projectId: string;
shortId: string;
slug: string | null;
name: string;
description: string | null;
avatarFileId: string | null;
bannerFileId: string | null;
userId: string;
readingPermission: import("../../interfaces/models/Space").ReadingPermission;
postingPermission: import("../../interfaces/models/Space").PostingPermission;
requireJoinApproval: boolean;
parentSpaceId: string | null;
depth: number;
metadata: {
[x: string]: any;
};
createdAt: Date;
updatedAt: Date;
deletedAt: Date | null;
membersCount: number;
childSpacesCount: number;
isMember?: boolean | undefined;
avatarFile?: {
id: string;
projectId: string;
userId: string | null;
entityId: string | null;
commentId: string | null;
chatMessageId: string | null;
spaceId: string | null;
type: "image" | "video" | "document" | "other";
originalPath: string;
originalSize: number;
originalMimeType: string;
position: number;
metadata: {
[x: string]: any;
};
image?: {
fileId: string;
originalWidth: number;
originalHeight: number;
variants: {
[x: string]: {
path: string;
publicPath: string;
width: number;
height: number;
size: number;
format: string;
};
};
processingStatus: "completed" | "failed";
processingError: string | null;
format: string;
quality: number;
exifStripped: boolean;
createdAt: Date;
updatedAt: Date;
} | undefined;
createdAt: Date;
updatedAt: Date;
} | undefined;
bannerFile?: {
id: string;
projectId: string;
userId: string | null;
entityId: string | null;
commentId: string | null;
chatMessageId: string | null;
spaceId: string | null;
type: "image" | "video" | "document" | "other";
originalPath: string;
originalSize: number;
originalMimeType: string;
position: number;
metadata: {
[x: string]: any;
};
image?: {
fileId: string;
originalWidth: number;
originalHeight: number;
variants: {
[x: string]: {
path: string;
publicPath: string;
width: number;
height: number;
size: number;
format: string;
};
};
processingStatus: "completed" | "failed";
processingError: string | null;
format: string;
quality: number;
exifStripped: boolean;
createdAt: Date;
updatedAt: Date;
} | undefined;
createdAt: Date;
updatedAt: Date;
} | undefined;
}[];
page: number;
loading: boolean;
hasMore: boolean;
error: string | null;
lastFetched: number | null;
limit: number;
sortBy: SpaceListSortByOptions;
searchSlug: string | null;
searchName: string | null;
searchDescription: string | null;
searchAny: string | null;
readingPermission: "anyone" | "members" | null;
memberOf: boolean;
parentSpaceId: string | null;
};
};
}, action: PayloadAction<{
listId: string;
loading: boolean;
}>) => void;
setSpaceListSpaces: (state: {
lists: {
[x: string]: {
spaces: {
id: string;
projectId: string;
shortId: string;
slug: string | null;
name: string;
description: string | null;
avatarFileId: string | null;
bannerFileId: string | null;
userId: string;
readingPermission: import("../../interfaces/models/Space").ReadingPermission;
postingPermission: import("../../interfaces/models/Space").PostingPermission;
requireJoinApproval: boolean;
parentSpaceId: string | null;
depth: number;
metadata: {
[x: string]: any;
};
createdAt: Date;
updatedAt: Date;
deletedAt: Date | null;
membersCount: number;
childSpacesCount: number;
isMember?: boolean | undefined;
avatarFile?: {
id: string;
projectId: string;
userId: string | null;
entityId: string | null;
commentId: string | null;
chatMessageId: string | null;
spaceId: string | null;
type: "image" | "video" | "document" | "other";
originalPath: string;
originalSize: number;
originalMimeType: string;
position: number;
metadata: {
[x: string]: any;
};
image?: {
fileId: string;
originalWidth: number;
originalHeight: number;
variants: {
[x: string]: {
path: string;
publicPath: string;
width: number;
height: number;
size: number;
format: string;
};
};
processingStatus: "completed" | "failed";
processingError: string | null;
format: string;
quality: number;
exifStripped: boolean;
createdAt: Date;
updatedAt: Date;
} | undefined;
createdAt: Date;
updatedAt: Date;
} | undefined;
bannerFile?: {
id: string;
projectId: string;
userId: string | null;
entityId: string | null;
commentId: string | null;
chatMessageId: string | null;
spaceId: string | null;
type: "image" | "video" | "document" | "other";
originalPath: string;
originalSize: number;
originalMimeType: string;
position: number;
metadata: {
[x: string]: any;
};
image?: {
fileId: string;
originalWidth: number;
originalHeight: number;
variants: {
[x: string]: {
path: string;
publicPath: string;
width: number;
height: number;
size: number;
format: string;
};
};
processingStatus: "completed" | "failed";
processingError: string | null;
format: string;
quality: number;
exifStripped: boolean;
createdAt: Date;
updatedAt: Date;
} | undefined;
createdAt: Date;
updatedAt: Date;
} | undefined;
}[];
page: number;
loading: boolean;
hasMore: boolean;
error: string | null;
lastFetched: number | null;
limit: number;
sortBy: SpaceListSortByOptions;
searchSlug: string | null;
searchName: string | null;
searchDescription: string | null;
searchAny: string | null;
readingPermission: "anyone" | "members" | null;
memberOf: boolean;
parentSpaceId: string | null;
};
};
}, action: PayloadAction<SpacesSetPayload>) => void;
incrementPage: (state: {
lists: {
[x: string]: {
spaces: {
id: string;
projectId: string;
shortId: string;
slug: string | null;
name: string;
description: string | null;
avatarFileId: string | null;
bannerFileId: string | null;
userId: string;
readingPermission: import("../../interfaces/models/Space").ReadingPermission;
postingPermission: import("../../interfaces/models/Space").PostingPermission;
requireJoinApproval: boolean;
parentSpaceId: string | null;
depth: number;
metadata: {
[x: string]: any;
};
createdAt: Date;
updatedAt: Date;
deletedAt: Date | null;
membersCount: number;
childSpacesCount: number;
isMember?: boolean | undefined;
avatarFile?: {
id: string;
projectId: string;
userId: string | null;
entityId: string | null;
commentId: string | null;
chatMessageId: string | null;
spaceId: string | null;
type: "image" | "video" | "document" | "other";
originalPath: string;
originalSize: number;
originalMimeType: string;
position: number;
metadata: {
[x: string]: any;
};
image?: {
fileId: string;
originalWidth: number;
originalHeight: number;
variants: {
[x: string]: {
path: string;
publicPath: string;
width: number;
height: number;
size: number;
format: string;
};
};
processingStatus: "completed" | "failed";
processingError: string | null;
format: string;
quality: number;
exifStripped: boolean;
createdAt: Date;
updatedAt: Date;
} | undefined;
createdAt: Date;
updatedAt: Date;
} | undefined;
bannerFile?: {
id: string;
projectId: string;
userId: string | null;
entityId: string | null;
commentId: string | null;
chatMessageId: string | null;
spaceId: string | null;
type: "image" | "video" | "document" | "other";
originalPath: string;
originalSize: number;
originalMimeType: string;
position: number;
metadata: {
[x: string]: any;
};
image?: {
fileId: string;
originalWidth: number;
originalHeight: number;
variants: {
[x: string]: {
path: string;
publicPath: string;
width: number;
height: number;
size: number;
format: string;
};
};
processingStatus: "completed" | "failed";
processingError: string | null;
format: string;
quality: number;
exifStripped: boolean;
createdAt: Date;
updatedAt: Date;
} | undefined;
createdAt: Date;
updatedAt: Date;
} | undefined;
}[];
page: number;
loading: boolean;
hasMore: boolean;
error: string | null;
lastFetched: number | null;
limit: number;
sortBy: SpaceListSortByOptions;
searchSlug: string | null;
searchName: string | null;
searchDescription: string | null;
searchAny: string | null;
readingPermission: "anyone" | "members" | null;
memberOf: boolean;
parentSpaceId: string | null;
};
};
}, action: PayloadAction<string>) => void;
setSpaceListHasMore: (state: {
lists: {
[x: string]: {
spaces: {
id: string;
projectId: string;
shortId: string;
slug: string | null;
name: string;
description: string | null;
avatarFileId: string | null;
bannerFileId: string | null;
userId: string;
readingPermission: import("../../interfaces/models/Space").ReadingPermission;
postingPermission: import("../../interfaces/models/Space").PostingPermission;
requireJoinApproval: boolean;
parentSpaceId: string | null;
depth: number;
metadata: {
[x: string]: any;
};
createdAt: Date;
updatedAt: Date;
deletedAt: Date | null;
membersCount: number;
childSpacesCount: number;
isMember?: boolean | undefined;
avatarFile?: {
id: string;
projectId: string;
userId: string | null;
entityId: string | null;
commentId: string | null;
chatMessageId: string | null;
spaceId: string | null;
type: "image" | "video" | "document" | "other";
originalPath: string;
originalSize: number;
originalMimeType: string;
position: number;
metadata: {
[x: string]: any;
};
image?: {
fileId: string;
originalWidth: number;
originalHeight: number;
variants: {
[x: string]: {
path: string;
publicPath: string;
width: number;
height: number;
size: number;
format: string;
};
};
processingStatus: "completed" | "failed";
processingError: string | null;
format: string;
quality: number;
exifStripped: boolean;
createdAt: Date;
updatedAt: Date;
} | undefined;
createdAt: Date;
updatedAt: Date;
} | undefined;
bannerFile?: {
id: string;
projectId: string;
userId: string | null;
entityId: string | null;
commentId: string | null;
chatMessageId: string | null;
spaceId: string | null;
type: "image" | "video" | "document" | "other";
originalPath: string;
originalSize: number;
originalMimeType: string;
position: number;
metadata: {
[x: string]: any;
};
image?: {
fileId: string;
originalWidth: number;
originalHeight: number;
variants: {
[x: string]: {
path: string;
publicPath: string;
width: number;
height: number;
size: number;
format: string;
};
};
processingStatus: "completed" | "failed";
processingError: string | null;
format: string;
quality: number;
exifStripped: boolean;
createdAt: Date;
updatedAt: Date;
} | undefined;
createdAt: Date;
updatedAt: Date;
} | undefined;
}[];
page: number;
loading: boolean;
hasMore: boolean;
error: string | null;
lastFetched: number | null;
limit: number;
sortBy: SpaceListSortByOptions;
searchSlug: string | null;
searchName: string | null;
searchDescription: string | null;
searchAny: string | null;
readingPermission: "anyone" | "members" | null;
memberOf: boolean;
parentSpaceId: string | null;
};
};
}, action: PayloadAction<{
listId: string;
hasMore: boolean;
}>) => void;
setSpaceListError: (state: {
lists: {
[x: string]: {
spaces: {
id: string;
projectId: string;
shortId: string;
slug: string | null;
name: string;
description: string | null;
avatarFileId: string | null;
bannerFileId: string | null;
userId: string;
readingPermission: import("../../interfaces/models/Space").ReadingPermission;
postingPermission: import("../../interfaces/models/Space").PostingPermission;
requireJoinApproval: boolean;
parentSpaceId: string | null;
depth: number;
metadata: {
[x: string]: any;
};
createdAt: Date;
updatedAt: Date;
deletedAt: Date | null;
membersCount: number;
childSpacesCount: number;
isMember?: boolean | undefined;
avatarFile?: {
id: string;
projectId: string;
userId: string | null;
entityId: string | null;
commentId: string | null;
chatMessageId: string | null;
spaceId: string | null;
type: "image" | "video" | "document" | "other";
originalPath: string;
originalSize: number;
originalMimeType: string;
position: number;
metadata: {
[x: string]: any;
};
image?: {
fileId: string;
originalWidth: number;
originalHeight: number;
variants: {
[x: string]: {
path: string;
publicPath: string;
width: number;
height: number;
size: number;
format: string;
};
};
processingStatus: "completed" | "failed";
processingError: string | null;
format: string;
quality: number;
exifStripped: boolean;
createdAt: Date;
updatedAt: Date;
} | undefined;
createdAt: Date;
updatedAt: Date;
} | undefined;
bannerFile?: {
id: string;
projectId: string;
userId: string | null;
entityId: string | null;
commentId: string | null;
chatMessageId: string | null;
spaceId: string | null;
type: "image" | "video" | "document" | "other";
originalPath: string;
originalSize: number;
originalMimeType: string;
position: number;
metadata: {
[x: string]: any;
};
image?: {
fileId: string;
originalWidth: number;
originalHeight: number;
variants: {
[x: string]: {
path: string;
publicPath: string;
width: number;
height: number;
size: number;
format: string;
};
};
processingStatus: "completed" | "failed";
processingError: string | null;
format: string;
quality: number;
exifStripped: boolean;
createdAt: Date;
updatedAt: Date;
} | undefined;
createdAt: Date;
updatedAt: Date;
} | undefined;
}[];
page: number;
loading: boolean;
hasMore: boolean;
error: string | null;
lastFetched: number | null;
limit: number;
sortBy: SpaceListSortByOptions;
searchSlug: string | null;
searchName: string | null;
searchDescription: string | null;
searchAny: string | null;
readingPermission: "anyone" | "members" | null;
memberOf: boolean;
parentSpaceId: string | null;
};
};
}, action: PayloadAction<{
listId: string;
error: string | null;
}>) => void;
addSpace: (state: {
lists: {
[x: string]: {
spaces: {
id: string;
projectId: string;
shortId: string;
slug: string | null;
name: string;
description: string | null;
avatarFileId: string | null;
bannerFileId: string | null;
userId: string;
readingPermission: import("../../interfaces/models/Space").ReadingPermission;
postingPermission: import("../../interfaces/models/Space").PostingPermission;
requireJoinApproval: boolean;
parentSpaceId: string | null;
depth: number;
metadata: {
[x: string]: any;
};
createdAt: Date;
updatedAt: Date;
deletedAt: Date | null;
membersCount: number;
childSpacesCount: number;
isMember?: boolean | undefined;
avatarFile?: {
id: string;
projectId: string;
userId: string | null;
entityId: string | null;
commentId: string | null;
chatMessageId: string | null;
spaceId: string | null;
type: "image" | "video" | "document" | "other";
originalPath: string;
originalSize: number;
originalMimeType: string;
position: number;
metadata: {
[x: string]: any;
};
image?: {
fileId: string;
originalWidth: number;
originalHeight: number;
variants: {
[x: string]: {
path: string;
publicPath: string;
width: number;
height: number;
size: number;
format: string;
};
};
processingStatus: "completed" | "failed";
processingError: string | null;
format: string;
quality: number;
exifStripped: boolean;
createdAt: Date;
updatedAt: Date;
} | undefined;
createdAt: Date;
updatedAt: Date;
} | undefined;
bannerFile?: {
id: string;
projectId: string;
userId: string | null;
entityId: string | null;
commentId: string | null;
chatMessageId: string | null;
spaceId: string | null;
type: "image" | "video" | "document" | "other";
originalPath: string;
originalSize: number;
originalMimeType: string;
position: number;
metadata: {
[x: string]: any;
};
image?: {
fileId: string;
originalWidth: number;
originalHeight: number;
variants: {
[x: string]: {
path: string;
publicPath: string;
width: number;
height: number;
size: number;
format: string;
};
};
processingStatus: "completed" | "failed";
processingError: string | null;
format: string;
quality: number;
exifStripped: boolean;
createdAt: Date;
updatedAt: Date;
} | undefined;
createdAt: Date;
updatedAt: Date;
} | undefined;
}[];
page: number;
loading: boolean;
hasMore: boolean;
error: string | null;
lastFetched: number | null;
limit: number;
sortBy: SpaceListSortByOptions;
searchSlug: string | null;
searchName: string | null;
searchDescription: string | null;
searchAny: string | null;
readingPermission: "anyone" | "members" | null;
memberOf: boolean;
parentSpaceId: string | null;
};
};
}, action: PayloadAction<SpaceAddPayload>) => void;
removeSpace: (state: {
lists: {
[x: string]: {
spaces: {
id: string;
projectId: string;
shortId: string;
slug: string | null;
name: string;
description: string | null;
avatarFileId: string | null;
bannerFileId: string | null;
userId: string;
readingPermission: import("../../interfaces/models/Space").ReadingPermission;
postingPermission: import("../../interfaces/models/Space").PostingPermission;
requireJoinApproval: boolean;
parentSpaceId: string | null;
depth: number;
metadata: {
[x: string]: any;
};
createdAt: Date;
updatedAt: Date;
deletedAt: Date | null;
membersCount: number;
childSpacesCount: number;
isMember?: boolean | undefined;
avatarFile?: {
id: string;
projectId: string;
userId: string | null;
entityId: string | null;
commentId: string | null;
chatMessageId: string | null;
spaceId: string | null;
type: "image" | "video" | "document" | "other";
originalPath: string;
originalSize: number;
originalMimeType: string;
position: number;
metadata: {
[x: string]: any;
};
image?: {
fileId: string;
originalWidth: number;
originalHeight: number;
variants: {
[x: string]: {
path: string;
publicPath: string;
width: number;
height: number;
size: number;
format: string;
};
};
processingStatus: "completed" | "failed";
processingError: string | null;
format: string;
quality: number;
exifStripped: boolean;
createdAt: Date;
updatedAt: Date;
}