From 6b8e79d8981e7673038592126b2234a1a56eb568 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 16 Mar 2022 21:15:38 -0500 Subject: [PATCH] Export Record entities --- app/soapbox/normalizers/account.ts | 4 ++-- app/soapbox/normalizers/attachment.ts | 2 +- app/soapbox/normalizers/card.ts | 2 +- app/soapbox/normalizers/emoji.ts | 2 +- app/soapbox/normalizers/index.ts | 9 +++++++++ app/soapbox/normalizers/instance.ts | 2 +- app/soapbox/normalizers/mention.ts | 2 +- app/soapbox/normalizers/notification.ts | 2 +- app/soapbox/normalizers/poll.ts | 4 ++-- app/soapbox/normalizers/status.ts | 2 +- app/soapbox/reducers/index.js | Bin 3828 -> 3835 bytes 11 files changed, 20 insertions(+), 11 deletions(-) create mode 100644 app/soapbox/normalizers/index.ts diff --git a/app/soapbox/normalizers/account.ts b/app/soapbox/normalizers/account.ts index 98f895aa84..2a8a1748b4 100644 --- a/app/soapbox/normalizers/account.ts +++ b/app/soapbox/normalizers/account.ts @@ -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, diff --git a/app/soapbox/normalizers/attachment.ts b/app/soapbox/normalizers/attachment.ts index 9599fc1cee..f25f09581e 100644 --- a/app/soapbox/normalizers/attachment.ts +++ b/app/soapbox/normalizers/attachment.ts @@ -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: '', diff --git a/app/soapbox/normalizers/card.ts b/app/soapbox/normalizers/card.ts index c9ac76adb0..0ae1f0b0f1 100644 --- a/app/soapbox/normalizers/card.ts +++ b/app/soapbox/normalizers/card.ts @@ -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, diff --git a/app/soapbox/normalizers/emoji.ts b/app/soapbox/normalizers/emoji.ts index f450af2533..133d294d13 100644 --- a/app/soapbox/normalizers/emoji.ts +++ b/app/soapbox/normalizers/emoji.ts @@ -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: '', diff --git a/app/soapbox/normalizers/index.ts b/app/soapbox/normalizers/index.ts new file mode 100644 index 0000000000..c4a34d66c2 --- /dev/null +++ b/app/soapbox/normalizers/index.ts @@ -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'; diff --git a/app/soapbox/normalizers/instance.ts b/app/soapbox/normalizers/instance.ts index 8e0fe02a6c..aded8075d0 100644 --- a/app/soapbox/normalizers/instance.ts +++ b/app/soapbox/normalizers/instance.ts @@ -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({ diff --git a/app/soapbox/normalizers/mention.ts b/app/soapbox/normalizers/mention.ts index 9982020655..266f22dc69 100644 --- a/app/soapbox/normalizers/mention.ts +++ b/app/soapbox/normalizers/mention.ts @@ -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: '', diff --git a/app/soapbox/normalizers/notification.ts b/app/soapbox/normalizers/notification.ts index e0f4666188..b05b501484 100644 --- a/app/soapbox/normalizers/notification.ts +++ b/app/soapbox/normalizers/notification.ts @@ -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(), diff --git a/app/soapbox/normalizers/poll.ts b/app/soapbox/normalizers/poll.ts index fa127702e7..30fc7ff4e8 100644 --- a/app/soapbox/normalizers/poll.ts +++ b/app/soapbox/normalizers/poll.ts @@ -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, diff --git a/app/soapbox/normalizers/status.ts b/app/soapbox/normalizers/status.ts index 2a1039f45a..3257c112bf 100644 --- a/app/soapbox/normalizers/status.ts +++ b/app/soapbox/normalizers/status.ts @@ -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, diff --git a/app/soapbox/reducers/index.js b/app/soapbox/reducers/index.js index 989a1fa1f6ff32436b2a74cb2fce11aa1b511f45..743a622d4e0b693569f5c0a839ece099f149d424 100644 GIT binary patch delta 20 bcmew&`&)K{Fb{ibML~X1iNa=Ko`*~TRaggi delta 12 Tcmew@`$cwxFwbTwo`*~TBe(>$