import { DataTablet } from './datastructures/index'; import { Data, ProfileStruct, AuthorizationStruct, GroupStruct, DataStruct, EventStruct, ChatroomStruct, CommentStruct, Struct } from './datastructures/types'; import { TimeSpecifier } from './genTimestamps'; import { Service } from '../../services/Service'; import { User } from '../../services/router/Router'; import { GraphNodeProperties } from '../../core/Graph'; export declare const randomId: (prefix?: any) => string; export declare const pseudoObjectId: (m?: Math, d?: DateConstructor, h?: number, s?: (s: any) => string) => string; export type StructFrontendProps = { useAccessTokens?: boolean; useRefreshTokens?: boolean; } & GraphNodeProperties; export declare class StructFrontend extends Service { name: string; currentUser: User; tablet: DataTablet; collections: Map; id: string; useAccessTokens: boolean; useRefreshTokens: boolean; constructor(options?: any, user?: Partial); getToken(user: Partial): string; setupUser: (userinfo: Partial, callback?: (currentUser: any) => void) => Promise; baseServerCallback: (data: any) => void; structNotification: () => void; structDeleted: (struct: { _id: string; structType: string; }) => void; onResult: (data: any) => void; randomId(tag?: string): string; /** let struct = { _id: randomId(structType+'defaultId'), //random id associated for unique identification, used for lookup and indexing structType: structType, //this is how you will look it up by type in the server ownerId: parentUser?._id, //owner user timestamp: Date.now(), //date of creation parent: {structType:parentStruct?.structType,_id:parentStruct?._id}, //parent struct it's associated with (e.g. if it needs to spawn with it) } */ addStruct: (structType?: string, props?: any, parentUser?: { [key: string]: any; }, parentStruct?: { [key: string]: any; }, updateServer?: boolean) => Promise; getUser: (info?: string | number, basicInfo?: boolean, callback?: (data: any) => void) => Promise<{ user: ProfileStruct; groups: GroupStruct[]; authorizations: AuthorizationStruct[]; }>; queryUsers: (info: string, skip?: number, limit?: number, callback?: (data: any) => void) => Promise; getUsers: (ids?: (string | number)[], basicInfo?: boolean, callback?: (data: any) => void) => Promise; getUsersByRole: (userRole: string, callback?: (data: any) => void) => Promise; getAllUserData: (ownerId: string | number, excluded?: any[], timeRange?: [number | TimeSpecifier, number | TimeSpecifier], callback?: (data: any) => void) => Promise; query: (collection: string, mongoQuery?: {}, findOne?: boolean, skip?: number, callback?: (data: any) => void) => Promise; getDataByTimeRange(collection: any, timeRange?: [number | TimeSpecifier, number | TimeSpecifier], ownerId?: string | number | undefined, limit?: number, skip?: number, key?: string): Promise; getData: (collection: string, ownerId?: string | number | undefined, searchDict?: any, limit?: number, skip?: number, callback?: (data: any) => void) => Promise; getDataByIds: (structIds?: any[], ownerId?: string | number | undefined, collection?: string | undefined, callback?: (data: any) => void) => Promise; getStructParentData: (struct: Struct, callback?: (data: any) => void) => Promise; setUser: (userStruct: ProfileStruct, callback?: (data: any) => void) => Promise; checkUserToken: (usertoken: any, user?: User, callback?: (data: any) => void) => Promise; setData: (structs?: Partial | Partial[], notify?: boolean, callback?: (data: any) => void) => Promise; updateServerData: (structs?: Partial | Partial[], notify?: boolean, callback?: (data: any) => void) => Promise; deleteData: (structs?: any[], callback?: (data: any) => void) => Promise; deleteUser: (userId?: string, deleteData?: boolean, callback?: (data: any) => void) => Promise; setGroup: (groupStruct: GroupStruct, callback?: (data: any) => void) => Promise; getUserGroups: (userId?: string, groupId?: string, callback?: (data: any) => void) => Promise; deleteGroup: (groupId: any, callback?: (data: any) => void) => Promise; setAuthorization: (authorizationStruct: AuthorizationStruct, callback?: (data: any) => void) => Promise; getAuthorizations: (userId?: string, authorizationId?: string, callback?: (data: any) => void) => Promise; deleteAuthorization: (authorizationId: any, callback?: (data: any) => void) => Promise; checkForNotifications: (userId?: string) => Promise; resolveNotifications: (notifications?: any[], pull?: boolean, user?: Partial) => Promise; setAuthorizationsByGroup: (user?: User) => Promise; deleteRoom: (roomStruct: any) => Promise; deleteComment: (commentStruct: any) => Promise; getUserDataByAuthorization: (authorizationStruct: any, collection: any, searchDict: any, limit?: number, skip?: number, callback?: (data: any) => void) => Promise; getUserDataByAuthorizationGroup: (groupId: string, collection: any, searchDict: any, limit?: number, skip?: number, callback?: (data: any) => void) => Promise; overwriteLocalData(structs: any): void; setLocalData(structs: any): void; getLocalData(collection: any, query?: any): any; getLocalUserPeerIds: (user?: User) => any; getLocalReplies(struct: any): any; hasLocalAuthorization(otherUserId: any, ownerId?: string): any; deleteLocalData(structs: Struct[]): boolean; deleteStruct(struct: Struct): boolean; stripStruct(struct: Struct): Struct; createStruct(structType: string, props: { [key: string]: any; }, parentUser?: User, parentStruct?: Struct): any; userStruct(props?: Partial, currentUser?: boolean): ProfileStruct; authorizeUser: (parentUser: Partial, authorizerUserId?: string, authorizerUserName?: string, authorizedUserId?: string, authorizedUserName?: string, authorizations?: {}, structs?: {}, excluded?: {}, groups?: {}, expires?: boolean) => Promise; addGroup: (parentUser: Partial, name?: string, details?: string, admins?: {}, peers?: {}, clients?: {}, updateServer?: boolean) => Promise; dataObject(data?: any, type?: string, timestamp?: string | number): { type: string; data: any; timestamp: string | number; }; addData: (parentUser: Partial, author?: string, title?: string, type?: string, data?: string | Data[], expires?: boolean, updateServer?: boolean) => Promise; addEvent: (parentUser: Partial, author?: string, event?: string | number, notes?: string, startTime?: string | number, endTime?: string | number, grade?: string | number, value?: any, units?: string, location?: any, attachments?: string | Data[], users?: { [key: string]: true; }, updateServer?: boolean) => Promise; addChatroom: (parentUser: Partial, authorId?: string, message?: string, attachments?: string | Data[], users?: { [key: string]: true; }, updateServer?: boolean) => Promise; addComment: (parentUser: Partial, roomStruct?: { _id: string; users: any[]; comments: any[]; }, replyTo?: { _id: string; replies: any[]; }, authorId?: string, message?: string, attachments?: string | Data[], updateServer?: boolean) => Promise; }