Export Record entities
This commit is contained in:
parent
db38d3cd59
commit
6b8e79d898
11 changed files with 20 additions and 11 deletions
|
@ -17,7 +17,7 @@ import { unescapeHTML } from 'soapbox/utils/html';
|
|||
import { mergeDefined, makeEmojiMap } from 'soapbox/utils/normalizers';
|
||||
|
||||
// https://docs.joinmastodon.org/entities/account/
|
||||
const AccountRecord = ImmutableRecord({
|
||||
export const AccountRecord = ImmutableRecord({
|
||||
acct: '',
|
||||
avatar: '',
|
||||
avatar_static: '',
|
||||
|
@ -56,7 +56,7 @@ const AccountRecord = ImmutableRecord({
|
|||
});
|
||||
|
||||
// https://docs.joinmastodon.org/entities/field/
|
||||
const FieldRecord = ImmutableRecord({
|
||||
export const FieldRecord = ImmutableRecord({
|
||||
name: '',
|
||||
value: '',
|
||||
verified_at: null,
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
import { mergeDefined } from 'soapbox/utils/normalizers';
|
||||
|
||||
// https://docs.joinmastodon.org/entities/attachment/
|
||||
const AttachmentRecord = ImmutableRecord({
|
||||
export const AttachmentRecord = ImmutableRecord({
|
||||
blurhash: undefined,
|
||||
description: '',
|
||||
id: '',
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
import { Record as ImmutableRecord, Map as ImmutableMap } from 'immutable';
|
||||
|
||||
// https://docs.joinmastodon.org/entities/card/
|
||||
const CardRecord = ImmutableRecord({
|
||||
export const CardRecord = ImmutableRecord({
|
||||
author_name: '',
|
||||
author_url: '',
|
||||
blurhash: null,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
import { Record as ImmutableRecord, Map as ImmutableMap } from 'immutable';
|
||||
|
||||
// https://docs.joinmastodon.org/entities/emoji/
|
||||
const EmojiRecord = ImmutableRecord({
|
||||
export const EmojiRecord = ImmutableRecord({
|
||||
category: '',
|
||||
shortcode: '',
|
||||
static_url: '',
|
||||
|
|
9
app/soapbox/normalizers/index.ts
Normal file
9
app/soapbox/normalizers/index.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
export { AccountRecord, FieldRecord, normalizeAccount } from './account';
|
||||
export { AttachmentRecord, normalizeAttachment } from './attachment';
|
||||
export { CardRecord, normalizeCard } from './card';
|
||||
export { EmojiRecord, normalizeEmoji } from './emoji';
|
||||
export { InstanceRecord, normalizeInstance } from './instance';
|
||||
export { MentionRecord, normalizeMention } from './mention';
|
||||
export { NotificationRecord, normalizeNotification } from './notification';
|
||||
export { PollRecord, PollOptionRecord, normalizePoll } from './poll';
|
||||
export { StatusRecord, normalizeStatus } from './status';
|
|
@ -15,7 +15,7 @@ import { isNumber } from 'soapbox/utils/numbers';
|
|||
|
||||
// Use Mastodon defaults
|
||||
// https://docs.joinmastodon.org/entities/instance/
|
||||
const InstanceRecord = ImmutableRecord({
|
||||
export const InstanceRecord = ImmutableRecord({
|
||||
approval_required: false,
|
||||
contact_account: ImmutableMap(),
|
||||
configuration: ImmutableMap({
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
import { normalizeAccount } from 'soapbox/normalizers/account';
|
||||
|
||||
// https://docs.joinmastodon.org/entities/mention/
|
||||
const MentionRecord = ImmutableRecord({
|
||||
export const MentionRecord = ImmutableRecord({
|
||||
id: '',
|
||||
acct: '',
|
||||
username: '',
|
||||
|
|
|
@ -9,7 +9,7 @@ import {
|
|||
} from 'immutable';
|
||||
|
||||
// https://docs.joinmastodon.org/entities/notification/
|
||||
const NotificationRecord = ImmutableRecord({
|
||||
export const NotificationRecord = ImmutableRecord({
|
||||
account: null,
|
||||
chat_message: null, // pleroma:chat_mention
|
||||
created_at: new Date(),
|
||||
|
|
|
@ -15,7 +15,7 @@ import { normalizeEmoji } from 'soapbox/normalizers/emoji';
|
|||
import { makeEmojiMap } from 'soapbox/utils/normalizers';
|
||||
|
||||
// https://docs.joinmastodon.org/entities/poll/
|
||||
const PollRecord = ImmutableRecord({
|
||||
export const PollRecord = ImmutableRecord({
|
||||
emojis: ImmutableList(),
|
||||
expired: false,
|
||||
expires_at: new Date(),
|
||||
|
@ -29,7 +29,7 @@ const PollRecord = ImmutableRecord({
|
|||
});
|
||||
|
||||
// Sub-entity of Poll
|
||||
const PollOptionRecord = ImmutableRecord({
|
||||
export const PollOptionRecord = ImmutableRecord({
|
||||
title: '',
|
||||
votes_count: 0,
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import { normalizePoll } from 'soapbox/normalizers/poll';
|
|||
import { IStatus } from 'soapbox/types';
|
||||
|
||||
// https://docs.joinmastodon.org/entities/status/
|
||||
const StatusRecord = ImmutableRecord({
|
||||
export const StatusRecord = ImmutableRecord({
|
||||
account: null,
|
||||
application: null,
|
||||
bookmarked: false,
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue