Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3307158
D11939.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D11939.diff
View Options
diff --git a/keyserver/src/endpoints.js b/keyserver/src/endpoints.js
--- a/keyserver/src/endpoints.js
+++ b/keyserver/src/endpoints.js
@@ -19,6 +19,11 @@
deltaEntryInfosResultValidator,
restoreEntryResponseValidator,
} from 'lib/types/validators/entry-validators.js';
+import { createOrUpdateFarcasterChannelTagResponseValidator } from 'lib/types/validators/farcaster-channel-tag-validators.js';
+import {
+ fetchInviteLinksResponseValidator,
+ inviteLinkVerificationResponseValidator,
+} from 'lib/types/validators/link-validators.js';
import { updateUserAvatarRequestValidator } from 'lib/utils/avatar-utils.js';
import {
@@ -52,7 +57,6 @@
deleteFarcasterChannelTagResponder,
createOrUpdateFarcasterChannelTagInputValidator,
deleteFarcasterChannelTagInputValidator,
- createOrUpdateFarcasterChannelTagResponseValidator,
} from './responders/farcaster-channel-tag-responders.js';
import type { JSONResponder } from './responders/handlers.js';
import { createJSONResponder } from './responders/handlers.js';
@@ -64,9 +68,7 @@
inviteLinkVerificationResponder,
createOrUpdatePublicLinkInputValidator,
disableInviteLinkInputValidator,
- fetchInviteLinksResponseValidator,
inviteLinkVerificationRequestInputValidator,
- inviteLinkVerificationResponseValidator,
} from './responders/link-responders.js';
import {
messageReportCreationResponder,
diff --git a/keyserver/src/responders/farcaster-channel-tag-responders.js b/keyserver/src/responders/farcaster-channel-tag-responders.js
--- a/keyserver/src/responders/farcaster-channel-tag-responders.js
+++ b/keyserver/src/responders/farcaster-channel-tag-responders.js
@@ -19,12 +19,6 @@
farcasterChannelID: t.String,
});
-const createOrUpdateFarcasterChannelTagResponseValidator: TInterface<CreateOrUpdateFarcasterChannelTagResponse> =
- tShape<CreateOrUpdateFarcasterChannelTagResponse>({
- commCommunityID: tID,
- blobHolder: t.String,
- });
-
async function createOrUpdateFarcasterChannelTagResponder(
viewer: Viewer,
request: CreateOrUpdateFarcasterChannelTagRequest,
@@ -49,7 +43,6 @@
export {
createOrUpdateFarcasterChannelTagResponder,
createOrUpdateFarcasterChannelTagInputValidator,
- createOrUpdateFarcasterChannelTagResponseValidator,
deleteFarcasterChannelTagResponder,
deleteFarcasterChannelTagInputValidator,
};
diff --git a/keyserver/src/responders/link-responders.js b/keyserver/src/responders/link-responders.js
--- a/keyserver/src/responders/link-responders.js
+++ b/keyserver/src/responders/link-responders.js
@@ -1,13 +1,12 @@
// @flow
-import t, { type TUnion, type TInterface } from 'tcomb';
+import t, { type TInterface } from 'tcomb';
import {
type InviteLinkVerificationRequest,
type InviteLinkVerificationResponse,
type FetchInviteLinksResponse,
type InviteLink,
- inviteLinkValidator,
type CreateOrUpdatePublicLinkRequest,
type DisableInviteLinkRequest,
type InviteLinkWithHolder,
@@ -27,20 +26,6 @@
secret: t.String,
});
-export const inviteLinkVerificationResponseValidator: TUnion<InviteLinkVerificationResponse> =
- t.union([
- tShape({
- status: t.enums.of(['valid', 'already_joined']),
- community: tShape({
- name: t.String,
- id: tID,
- }),
- }),
- tShape({
- status: t.enums.of(['invalid', 'expired']),
- }),
- ]);
-
async function inviteLinkVerificationResponder(
viewer: Viewer,
request: InviteLinkVerificationRequest,
@@ -48,11 +33,6 @@
return await verifyInviteLink(viewer, request);
}
-export const fetchInviteLinksResponseValidator: TInterface<FetchInviteLinksResponse> =
- tShape<FetchInviteLinksResponse>({
- links: t.list(inviteLinkValidator),
- });
-
async function fetchPrimaryInviteLinksResponder(
viewer: Viewer,
): Promise<FetchInviteLinksResponse> {
diff --git a/keyserver/src/responders/responder-validators.test.js b/keyserver/src/responders/responder-validators.test.js
--- a/keyserver/src/responders/responder-validators.test.js
+++ b/keyserver/src/responders/responder-validators.test.js
@@ -12,11 +12,11 @@
deltaEntryInfosResultValidator,
restoreEntryResponseValidator,
} from 'lib/types/validators/entry-validators.js';
-
import {
inviteLinkVerificationResponseValidator,
fetchInviteLinksResponseValidator,
-} from './link-responders.js';
+} from 'lib/types/validators/link-validators.js';
+
import { messageReportCreationResultValidator } from './message-report-responder.js';
import {
fetchMessageInfosResponseValidator,
diff --git a/lib/types/validators/farcaster-channel-tag-validators.js b/lib/types/validators/farcaster-channel-tag-validators.js
new file mode 100644
--- /dev/null
+++ b/lib/types/validators/farcaster-channel-tag-validators.js
@@ -0,0 +1,12 @@
+// @flow
+
+import t, { type TInterface } from 'tcomb';
+
+import { tShape, tID } from '../../utils/validation-utils.js';
+import type { CreateOrUpdateFarcasterChannelTagResponse } from '../community-types';
+
+export const createOrUpdateFarcasterChannelTagResponseValidator: TInterface<CreateOrUpdateFarcasterChannelTagResponse> =
+ tShape<CreateOrUpdateFarcasterChannelTagResponse>({
+ commCommunityID: tID,
+ blobHolder: t.String,
+ });
diff --git a/lib/types/validators/link-validators.js b/lib/types/validators/link-validators.js
new file mode 100644
--- /dev/null
+++ b/lib/types/validators/link-validators.js
@@ -0,0 +1,29 @@
+// @flow
+
+import t, { type TUnion, type TInterface } from 'tcomb';
+
+import { tShape, tID } from '../../utils/validation-utils.js';
+import {
+ type InviteLinkVerificationResponse,
+ type FetchInviteLinksResponse,
+ inviteLinkValidator,
+} from '../link-types.js';
+
+export const fetchInviteLinksResponseValidator: TInterface<FetchInviteLinksResponse> =
+ tShape<FetchInviteLinksResponse>({
+ links: t.list(inviteLinkValidator),
+ });
+
+export const inviteLinkVerificationResponseValidator: TUnion<InviteLinkVerificationResponse> =
+ t.union([
+ tShape({
+ status: t.enums.of(['valid', 'already_joined']),
+ community: tShape({
+ name: t.String,
+ id: tID,
+ }),
+ }),
+ tShape({
+ status: t.enums.of(['invalid', 'expired']),
+ }),
+ ]);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 20, 12:49 AM (20 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2540830
Default Alt Text
D11939.diff (6 KB)
Attached To
Mode
D11939: [lib][keyserver] Move output farcaster and link validators to lib
Attached
Detach File
Event Timeline
Log In to Comment