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';
|
import { mergeDefined, makeEmojiMap } from 'soapbox/utils/normalizers';
|
||||||
|
|
||||||
// https://docs.joinmastodon.org/entities/account/
|
// https://docs.joinmastodon.org/entities/account/
|
||||||
const AccountRecord = ImmutableRecord({
|
export const AccountRecord = ImmutableRecord({
|
||||||
acct: '',
|
acct: '',
|
||||||
avatar: '',
|
avatar: '',
|
||||||
avatar_static: '',
|
avatar_static: '',
|
||||||
|
@ -56,7 +56,7 @@ const AccountRecord = ImmutableRecord({
|
||||||
});
|
});
|
||||||
|
|
||||||
// https://docs.joinmastodon.org/entities/field/
|
// https://docs.joinmastodon.org/entities/field/
|
||||||
const FieldRecord = ImmutableRecord({
|
export const FieldRecord = ImmutableRecord({
|
||||||
name: '',
|
name: '',
|
||||||
value: '',
|
value: '',
|
||||||
verified_at: null,
|
verified_at: null,
|
||||||
|
|
|
@ -11,7 +11,7 @@ import {
|
||||||
import { mergeDefined } from 'soapbox/utils/normalizers';
|
import { mergeDefined } from 'soapbox/utils/normalizers';
|
||||||
|
|
||||||
// https://docs.joinmastodon.org/entities/attachment/
|
// https://docs.joinmastodon.org/entities/attachment/
|
||||||
const AttachmentRecord = ImmutableRecord({
|
export const AttachmentRecord = ImmutableRecord({
|
||||||
blurhash: undefined,
|
blurhash: undefined,
|
||||||
description: '',
|
description: '',
|
||||||
id: '',
|
id: '',
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
import { Record as ImmutableRecord, Map as ImmutableMap } from 'immutable';
|
import { Record as ImmutableRecord, Map as ImmutableMap } from 'immutable';
|
||||||
|
|
||||||
// https://docs.joinmastodon.org/entities/card/
|
// https://docs.joinmastodon.org/entities/card/
|
||||||
const CardRecord = ImmutableRecord({
|
export const CardRecord = ImmutableRecord({
|
||||||
author_name: '',
|
author_name: '',
|
||||||
author_url: '',
|
author_url: '',
|
||||||
blurhash: null,
|
blurhash: null,
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
import { Record as ImmutableRecord, Map as ImmutableMap } from 'immutable';
|
import { Record as ImmutableRecord, Map as ImmutableMap } from 'immutable';
|
||||||
|
|
||||||
// https://docs.joinmastodon.org/entities/emoji/
|
// https://docs.joinmastodon.org/entities/emoji/
|
||||||
const EmojiRecord = ImmutableRecord({
|
export const EmojiRecord = ImmutableRecord({
|
||||||
category: '',
|
category: '',
|
||||||
shortcode: '',
|
shortcode: '',
|
||||||
static_url: '',
|
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
|
// Use Mastodon defaults
|
||||||
// https://docs.joinmastodon.org/entities/instance/
|
// https://docs.joinmastodon.org/entities/instance/
|
||||||
const InstanceRecord = ImmutableRecord({
|
export const InstanceRecord = ImmutableRecord({
|
||||||
approval_required: false,
|
approval_required: false,
|
||||||
contact_account: ImmutableMap(),
|
contact_account: ImmutableMap(),
|
||||||
configuration: ImmutableMap({
|
configuration: ImmutableMap({
|
||||||
|
|
|
@ -11,7 +11,7 @@ import {
|
||||||
import { normalizeAccount } from 'soapbox/normalizers/account';
|
import { normalizeAccount } from 'soapbox/normalizers/account';
|
||||||
|
|
||||||
// https://docs.joinmastodon.org/entities/mention/
|
// https://docs.joinmastodon.org/entities/mention/
|
||||||
const MentionRecord = ImmutableRecord({
|
export const MentionRecord = ImmutableRecord({
|
||||||
id: '',
|
id: '',
|
||||||
acct: '',
|
acct: '',
|
||||||
username: '',
|
username: '',
|
||||||
|
|
|
@ -9,7 +9,7 @@ import {
|
||||||
} from 'immutable';
|
} from 'immutable';
|
||||||
|
|
||||||
// https://docs.joinmastodon.org/entities/notification/
|
// https://docs.joinmastodon.org/entities/notification/
|
||||||
const NotificationRecord = ImmutableRecord({
|
export const NotificationRecord = ImmutableRecord({
|
||||||
account: null,
|
account: null,
|
||||||
chat_message: null, // pleroma:chat_mention
|
chat_message: null, // pleroma:chat_mention
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
|
|
|
@ -15,7 +15,7 @@ import { normalizeEmoji } from 'soapbox/normalizers/emoji';
|
||||||
import { makeEmojiMap } from 'soapbox/utils/normalizers';
|
import { makeEmojiMap } from 'soapbox/utils/normalizers';
|
||||||
|
|
||||||
// https://docs.joinmastodon.org/entities/poll/
|
// https://docs.joinmastodon.org/entities/poll/
|
||||||
const PollRecord = ImmutableRecord({
|
export const PollRecord = ImmutableRecord({
|
||||||
emojis: ImmutableList(),
|
emojis: ImmutableList(),
|
||||||
expired: false,
|
expired: false,
|
||||||
expires_at: new Date(),
|
expires_at: new Date(),
|
||||||
|
@ -29,7 +29,7 @@ const PollRecord = ImmutableRecord({
|
||||||
});
|
});
|
||||||
|
|
||||||
// Sub-entity of Poll
|
// Sub-entity of Poll
|
||||||
const PollOptionRecord = ImmutableRecord({
|
export const PollOptionRecord = ImmutableRecord({
|
||||||
title: '',
|
title: '',
|
||||||
votes_count: 0,
|
votes_count: 0,
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ import { normalizePoll } from 'soapbox/normalizers/poll';
|
||||||
import { IStatus } from 'soapbox/types';
|
import { IStatus } from 'soapbox/types';
|
||||||
|
|
||||||
// https://docs.joinmastodon.org/entities/status/
|
// https://docs.joinmastodon.org/entities/status/
|
||||||
const StatusRecord = ImmutableRecord({
|
export const StatusRecord = ImmutableRecord({
|
||||||
account: null,
|
account: null,
|
||||||
application: null,
|
application: null,
|
||||||
bookmarked: false,
|
bookmarked: false,
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue