UNPKG

@oap75/api

Version:
21 lines (20 loc) 1.9 kB
import { Post, Space, SpacePermissions } from '@subsocial/types/substrate/interfaces'; import { FlatSpacePermissions } from '@subsocial/types/substrate/rpc'; import { CanHaveContent, CanHaveSpaceId, CommentStruct, CommonContent, EntityData, EntityId, FlatSuperCommon, HasId, HasOwner, PostStruct, ProfileStruct, PublicProfileStruct, SharedPostStruct, SpaceStruct, SuperCommonStruct, SocialAccountWithId } from '@subsocial/types/dto'; declare type EntityDataWithField<S extends {}> = EntityData<HasId & S, CommonContent> | (HasId & S); export declare function getUniqueIds<S extends {}>(structs: EntityDataWithField<S>[], idFieldName: keyof S): EntityId[]; export declare const getUniqueOwnerIds: (entities: EntityDataWithField<HasOwner>[]) => string[]; export declare const getUniqueContentIds: (entities: EntityDataWithField<CanHaveContent>[]) => string[]; export declare const getUniqueSpaceIds: (entities: EntityDataWithField<CanHaveSpaceId>[]) => string[]; export declare function flattenCommonFields(struct: SuperCommonStruct): FlatSuperCommon; export declare const flattenPermisions: (permissions?: SpacePermissions | undefined) => FlatSpacePermissions; export declare function flattenSpaceStruct(struct: Space): SpaceStruct; export declare function flattenSpaceStructs(structs: Space[]): SpaceStruct[]; export declare function flattenPostStruct(struct: Post): PostStruct; export declare function flattenPostStructs(structs: Post[]): PostStruct[]; export declare function asSharedPostStruct(post: PostStruct): SharedPostStruct; export declare function asCommentStruct(post: PostStruct): CommentStruct; export declare function asPublicProfileStruct(profile: ProfileStruct): PublicProfileStruct; export declare function flattenProfileStruct(struct: SocialAccountWithId): ProfileStruct; export declare function flattenProfileStructs(accounts: SocialAccountWithId[]): ProfileStruct[]; export {};