@replyke/core
Version:
Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.
1,152 lines • 375 kB
TypeScript
import { PayloadAction } from "@reduxjs/toolkit";
import type { Collection } from "../../interfaces/models/Collection";
import type { Entity } from "../../interfaces/models/Entity";
import type { ReplykeState } from '../replykeReducers';
export interface CollectionsState {
collectionsById: {
[collectionId: string]: Collection;
};
subcollectionsMap: {
[parentId: string]: string[];
};
currentCollectionId: string | null;
collectionHistory: string[];
loading: boolean;
currentProjectId?: string;
entitiesByCollectionId: Record<string, Entity[]>;
}
export declare const collectionsSlice: import("@reduxjs/toolkit").Slice<CollectionsState, {
setProjectContext: (state: {
collectionsById: {
[x: string]: {
id: string;
projectId: string;
userId: string;
parentId: string | null;
name: string;
entityCount: number;
createdAt: Date;
updatedAt: Date;
};
};
subcollectionsMap: {
[x: string]: string[];
};
currentCollectionId: string | null;
collectionHistory: string[];
loading: boolean;
currentProjectId?: string | undefined;
entitiesByCollectionId: {
[x: string]: {
id: string;
foreignId: string | null;
shortId: string;
projectId: string;
sourceId: string | null;
spaceId: string | null;
space?: {
id: string;
projectId: string;
shortId: string;
slug: string | null;
name: string;
description: string | null;
avatarFileId: string | null;
bannerFileId: string | null;
userId: string;
readingPermission: import("../..").ReadingPermission;
postingPermission: import("../..").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;
} | null | undefined;
userId: string | null;
user?: {
id: string;
projectId: string;
foreignId: string | null;
role: import("../..").UserRole;
name: string | null;
username: string | null;
avatar: string | null;
avatarFileId: string | null;
bannerFileId: string | null;
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;
} | null | 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;
} | null | undefined;
bio: string | null;
birthdate: Date | null;
location: {
type: "Point";
coordinates: [number, number];
} | null;
metadata: {
[x: string]: any;
};
reputation: number;
createdAt: Date;
} | null | undefined;
title: string | null;
content: string | null;
mentions: ({
type: "user";
id: string;
foreignId?: string | null | undefined;
username: string;
} | {
type: "space";
id: string;
slug: string;
})[];
attachments: {
[x: string]: any;
}[];
files?: {
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;
keywords: string[];
upvotes: string[];
downvotes: string[];
reactionCounts: {
upvote: number;
downvote: number;
like: number;
love: number;
wow: number;
sad: number;
angry: number;
funny: number;
};
userReaction?: (import("../..").ReactionType | null) | undefined;
repliesCount: number;
views: number;
score: number;
scoreUpdatedAt: Date;
location: {
type: "Point";
coordinates: [number, number];
} | null;
metadata: {
[x: string]: any;
};
topComment: {
id: string;
user: {
id: string;
projectId: string;
foreignId: string | null;
role: import("../..").UserRole;
name: string | null;
username: string | null;
avatar: string | null;
avatarFileId: string | null;
bannerFileId: string | null;
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;
} | null | 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;
} | null | undefined;
bio: string | null;
birthdate: Date | null;
location: {
type: "Point";
coordinates: [number, number];
} | null;
metadata: {
[x: string]: any;
};
reputation: number;
createdAt: Date;
};
upvotesCount: number;
content: string;
createdAt: string;
} | null;
isSaved?: boolean | undefined;
createdAt: Date;
updatedAt: Date;
deletedAt: Date | null;
isDraft: boolean | null;
moderationStatus: "approved" | "removed" | null;
moderatedAt: Date | null;
moderatedById: string | null;
moderatedByType: "client" | "user" | null;
moderationReason: string | null;
}[];
};
}, action: PayloadAction<string>) => void;
setLoading: (state: {
collectionsById: {
[x: string]: {
id: string;
projectId: string;
userId: string;
parentId: string | null;
name: string;
entityCount: number;
createdAt: Date;
updatedAt: Date;
};
};
subcollectionsMap: {
[x: string]: string[];
};
currentCollectionId: string | null;
collectionHistory: string[];
loading: boolean;
currentProjectId?: string | undefined;
entitiesByCollectionId: {
[x: string]: {
id: string;
foreignId: string | null;
shortId: string;
projectId: string;
sourceId: string | null;
spaceId: string | null;
space?: {
id: string;
projectId: string;
shortId: string;
slug: string | null;
name: string;
description: string | null;
avatarFileId: string | null;
bannerFileId: string | null;
userId: string;
readingPermission: import("../..").ReadingPermission;
postingPermission: import("../..").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;
} | null | undefined;
userId: string | null;
user?: {
id: string;
projectId: string;
foreignId: string | null;
role: import("../..").UserRole;
name: string | null;
username: string | null;
avatar: string | null;
avatarFileId: string | null;
bannerFileId: string | null;
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;
} | null | 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;
} | null | undefined;
bio: string | null;
birthdate: Date | null;
location: {
type: "Point";
coordinates: [number, number];
} | null;
metadata: {
[x: string]: any;
};
reputation: number;
createdAt: Date;
} | null | undefined;
title: string | null;
content: string | null;
mentions: ({
type: "user";
id: string;
foreignId?: string | null | undefined;
username: string;
} | {
type: "space";
id: string;
slug: string;
})[];
attachments: {
[x: string]: any;
}[];
files?: {
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;
keywords: string[];
upvotes: string[];
downvotes: string[];
reactionCounts: {
upvote: number;
downvote: number;
like: number;
love: number;
wow: number;
sad: number;
angry: number;
funny: number;
};
userReaction?: (import("../..").ReactionType | null) | undefined;
repliesCount: number;
views: number;
score: number;
scoreUpdatedAt: Date;
location: {
type: "Point";
coordinates: [number, number];
} | null;
metadata: {
[x: string]: any;
};
topComment: {
id: string;
user: {
id: string;
projectId: string;
foreignId: string | null;
role: import("../..").UserRole;
name: string | null;
username: string | null;
avatar: string | null;
avatarFileId: string | null;
bannerFileId: string | null;
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;
} | null | 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;
} | null | undefined;
bio: string | null;
birthdate: Date | null;
location: {
type: "Point";
coordinates: [number, number];
} | null;
metadata: {
[x: string]: any;
};
reputation: number;
createdAt: Date;
};
upvotesCount: number;
content: string;
createdAt: string;
} | null;
isSaved?: boolean | undefined;
createdAt: Date;
updatedAt: Date;
deletedAt: Date | null;
isDraft: boolean | null;
moderationStatus: "approved" | "removed" | null;
moderatedAt: Date | null;
moderatedById: string | null;
moderatedByType: "client" | "user" | null;
moderationReason: string | null;
}[];
};
}, action: PayloadAction<boolean>) => void;
openCollection: (state: {
collectionsById: {
[x: string]: {
id: string;
projectId: string;
userId: string;
parentId: string | null;
name: string;
entityCount: number;
createdAt: Date;
updatedAt: Date;
};
};
subcollectionsMap: {
[x: string]: string[];
};
currentCollectionId: string | null;
collectionHistory: string[];
loading: boolean;
currentProjectId?: string | undefined;
entitiesByCollectionId: {
[x: string]: {
id: string;
foreignId: string | null;
shortId: string;
projectId: string;
sourceId: string | null;
spaceId: string | null;
space?: {
id: string;
projectId: string;
shortId: string;
slug: string | null;
name: string;
description: string | null;
avatarFileId: string | null;
bannerFileId: string | null;
userId: string;
readingPermission: import("../..").ReadingPermission;
postingPermission: import("../..").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;
} | null | undefined;
userId: string | null;
user?: {
id: string;
projectId: string;
foreignId: string | null;
role: import("../..").UserRole;
name: string | null;
username: string | null;
avatar: string | null;
avatarFileId: string | null;
bannerFileId: string | null;
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;
} | null | 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;
} | null | undefined;
bio: string | null;
birthdate: Date | null;
location: {
type: "Point";
coordinates: [number, number];
} | null;
metadata: {
[x: string]: any;
};
reputation: number;
createdAt: Date;
} | null | undefined;
title: string | null;
content: string | null;
mentions: ({
type: "user";
id: string;
foreig