@subsocial/api
Version:
JavaScript API for Subsocial blockchain.
21 lines (20 loc) • 1.85 kB
TypeScript
import { PalletDomainsDomainMeta } from '@polkadot/types/lookup';
import { Post, Space, SpacePermissions as BlockchainSpacePermissions, Reaction } from '@subsocial/definitions/interfaces';
import { DomainStruct, ReactionStruct, SpacePermissions } from '../../types';
import { CanHaveContent, CanHaveSpaceId, CommonContent, EntityData, EntityId, FlatSuperCommon, HasId, HasOwner, PostStruct, SpaceStruct, SuperCommonStruct } from '../../types/';
export * from './utils';
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 flattenPermissions: (permissions?: BlockchainSpacePermissions | undefined) => SpacePermissions;
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 flattenDomainStruct(struct: PalletDomainsDomainMeta): DomainStruct;
export declare function flattenDomainStructs(structs: PalletDomainsDomainMeta[]): DomainStruct[];
export declare function flattenReaction(rawReaction: Reaction): ReactionStruct;
export declare function flattenReactions(rawReactions: Reaction[]): ReactionStruct[];