Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32089461
D15516.1765007857.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D15516.1765007857.diff
View Options
diff --git a/lib/utils/conversion-utils.js b/lib/utils/conversion-utils.js
--- a/lib/utils/conversion-utils.js
+++ b/lib/utils/conversion-utils.js
@@ -134,6 +134,10 @@
const result: { [string]: mixed } = {};
for (const key in input) {
const innerValidator = recastValidator.meta.props[key];
+ if (!innerValidator && recastValidator.meta.strict === false) {
+ result[key] = input[key];
+ continue;
+ }
result[key] = convertObject(
innerValidator,
input[key],
diff --git a/lib/utils/conversion-utils.test.js b/lib/utils/conversion-utils.test.js
--- a/lib/utils/conversion-utils.test.js
+++ b/lib/utils/conversion-utils.test.js
@@ -5,12 +5,14 @@
import {
extractUserIDsFromPayload,
+ extractFarcasterIDsFromPayload,
convertServerIDsToClientIDs,
convertClientIDsToServerIDs,
convertBytesToObj,
convertObjToBytes,
} from './conversion-utils.js';
import { tShape, tID, idSchemaRegex } from './validation-utils.js';
+import { farcasterMessageValidator } from '../shared/farcaster/farcaster-messages-types.js';
import { fetchMessageInfosResponseValidator } from '../types/validators/message-validators.js';
type ComplexType = { +ids: { +[string]: $ReadOnlyArray<string> } };
@@ -122,6 +124,43 @@
});
});
+describe('extractFarcasterIDsFromPayload', () => {
+ it('should extract all Farcaster IDs from payload', () => {
+ const payload = {
+ conversationId: '4282-7811',
+ hasMention: false,
+ isDeleted: false,
+ isPinned: false,
+ isProgrammatic: false,
+ mentions: [],
+ message:
+ 'thanks again for helping test, your report was super helpful to getting the problem solved :)',
+ messageId: '08ac07f52d1c2ad9759ffea13edd695b',
+ reactions: [],
+ senderContext: {
+ displayName: 'Ashoat',
+ fid: 7811,
+ pfp: {
+ url: 'https://i.imgur.com/ToR9Mqd.jpg',
+ verified: false,
+ },
+ username: 'ashoat.eth',
+ },
+ senderFid: 7811,
+ serverTimestamp: 1761148247480,
+ type: 'text',
+ viewerContext: {
+ focused: false,
+ isLastReadMessage: false,
+ reactions: [],
+ },
+ };
+ expect(
+ extractFarcasterIDsFromPayload(farcasterMessageValidator, payload),
+ ).toEqual([7811]);
+ });
+});
+
describe('convertObjToBytes and convertBytesToObj', () => {
it('should convert object to byte array and back', () => {
const obj = { hello: 'world', foo: 'bar', a: 2, b: false };
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 6, 7:57 AM (16 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5828589
Default Alt Text
D15516.1765007857.diff (2 KB)
Attached To
Mode
D15516: [lib] Fix extractIDsFromPayload for tShapeInexact
Attached
Detach File
Event Timeline
Log In to Comment