@replyke/core
Version:
Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.
1,002 lines (1,001 loc) • 37.1 kB
TypeScript
import { PayloadAction } from '@reduxjs/toolkit';
import type { ReplykeState } from '../replykeReducers';
import type { AuthUser } from '../../interfaces/models/User';
export interface UserState {
user: AuthUser | null;
loading: boolean;
updating: boolean;
currentProjectId?: string;
error: string | null;
}
declare const userSlice: import("@reduxjs/toolkit").Slice<UserState, {
setUser: (state: {
user: {
id: string;
projectId: string;
foreignId: string | null;
role: import("../../interfaces/models/User").UserRole;
email: string | null;
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;
isVerified: boolean;
isActive: boolean;
lastActive: Date;
createdAt: Date;
updatedAt: Date;
suspensions: {
reason: string | null;
startDate: Date;
endDate: Date | null;
}[];
authMethods: string[];
} | null;
loading: boolean;
updating: boolean;
currentProjectId?: string | undefined;
error: string | null;
}, action: PayloadAction<AuthUser | null>) => void;
clearUser: (state: {
user: {
id: string;
projectId: string;
foreignId: string | null;
role: import("../../interfaces/models/User").UserRole;
email: string | null;
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;
isVerified: boolean;
isActive: boolean;
lastActive: Date;
createdAt: Date;
updatedAt: Date;
suspensions: {
reason: string | null;
startDate: Date;
endDate: Date | null;
}[];
authMethods: string[];
} | null;
loading: boolean;
updating: boolean;
currentProjectId?: string | undefined;
error: string | null;
}) => void;
setProjectContext: (state: {
user: {
id: string;
projectId: string;
foreignId: string | null;
role: import("../../interfaces/models/User").UserRole;
email: string | null;
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;
isVerified: boolean;
isActive: boolean;
lastActive: Date;
createdAt: Date;
updatedAt: Date;
suspensions: {
reason: string | null;
startDate: Date;
endDate: Date | null;
}[];
authMethods: string[];
} | null;
loading: boolean;
updating: boolean;
currentProjectId?: string | undefined;
error: string | null;
}, action: PayloadAction<string>) => void;
setLoading: (state: {
user: {
id: string;
projectId: string;
foreignId: string | null;
role: import("../../interfaces/models/User").UserRole;
email: string | null;
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;
isVerified: boolean;
isActive: boolean;
lastActive: Date;
createdAt: Date;
updatedAt: Date;
suspensions: {
reason: string | null;
startDate: Date;
endDate: Date | null;
}[];
authMethods: string[];
} | null;
loading: boolean;
updating: boolean;
currentProjectId?: string | undefined;
error: string | null;
}, action: PayloadAction<boolean>) => void;
setUpdating: (state: {
user: {
id: string;
projectId: string;
foreignId: string | null;
role: import("../../interfaces/models/User").UserRole;
email: string | null;
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;
isVerified: boolean;
isActive: boolean;
lastActive: Date;
createdAt: Date;
updatedAt: Date;
suspensions: {
reason: string | null;
startDate: Date;
endDate: Date | null;
}[];
authMethods: string[];
} | null;
loading: boolean;
updating: boolean;
currentProjectId?: string | undefined;
error: string | null;
}, action: PayloadAction<boolean>) => void;
setError: (state: {
user: {
id: string;
projectId: string;
foreignId: string | null;
role: import("../../interfaces/models/User").UserRole;
email: string | null;
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;
isVerified: boolean;
isActive: boolean;
lastActive: Date;
createdAt: Date;
updatedAt: Date;
suspensions: {
reason: string | null;
startDate: Date;
endDate: Date | null;
}[];
authMethods: string[];
} | null;
loading: boolean;
updating: boolean;
currentProjectId?: string | undefined;
error: string | null;
}, action: PayloadAction<string | null>) => void;
clearError: (state: {
user: {
id: string;
projectId: string;
foreignId: string | null;
role: import("../../interfaces/models/User").UserRole;
email: string | null;
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;
isVerified: boolean;
isActive: boolean;
lastActive: Date;
createdAt: Date;
updatedAt: Date;
suspensions: {
reason: string | null;
startDate: Date;
endDate: Date | null;
}[];
authMethods: string[];
} | null;
loading: boolean;
updating: boolean;
currentProjectId?: string | undefined;
error: string | null;
}) => void;
updateUserOptimistic: (state: {
user: {
id: string;
projectId: string;
foreignId: string | null;
role: import("../../interfaces/models/User").UserRole;
email: string | null;
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;
isVerified: boolean;
isActive: boolean;
lastActive: Date;
createdAt: Date;
updatedAt: Date;
suspensions: {
reason: string | null;
startDate: Date;
endDate: Date | null;
}[];
authMethods: string[];
} | null;
loading: boolean;
updating: boolean;
currentProjectId?: string | undefined;
error: string | null;
}, action: PayloadAction<Partial<AuthUser>>) => void;
}, "user", "user", import("@reduxjs/toolkit").SliceSelectors<UserState>>;
export declare const setUser: import("@reduxjs/toolkit").ActionCreatorWithPayload<AuthUser | null, "user/setUser">, clearUser: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"user/clearUser">, setProjectContext: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "user/setProjectContext">, setLoading: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "user/setLoading">, setUpdating: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "user/setUpdating">, setError: import("@reduxjs/toolkit").ActionCreatorWithPayload<string | null, "user/setError">, clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"user/clearError">, updateUserOptimistic: import("@reduxjs/toolkit").ActionCreatorWithPayload<Partial<AuthUser>, "user/updateUserOptimistic">;
export declare const selectUser: (state: {
replyke: ReplykeState;
}) => AuthUser | null;
export declare const selectUserLoading: (state: {
replyke: ReplykeState;
}) => boolean;
export declare const selectUserUpdating: (state: {
replyke: ReplykeState;
}) => boolean;
export declare const selectCurrentProjectId: (state: {
replyke: ReplykeState;
}) => string | undefined;
export declare const selectUserError: (state: {
replyke: ReplykeState;
}) => string | null;
export declare const selectUserById: (userId: string) => (state: {
replyke: ReplykeState;
}) => AuthUser | null;
export declare const userReducer: import("@reduxjs/toolkit").Reducer<UserState>;
export default userSlice;