Skip to content

Commit b0f0b31

Browse files
feat: add specification to parse result
1 parent 93ecc74 commit b0f0b31

File tree

6 files changed

+53
-3
lines changed

6 files changed

+53
-3
lines changed

packages/frames.js/src/frame-parsers/farcaster.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ describe("farcaster frame parser", () => {
2323
parseFarcasterFrame(document, { reporter, fallbackPostUrl })
2424
).toEqual({
2525
status: "success",
26+
specification: "farcaster",
2627
reports: {},
2728
frame: {
2829
image: "http://example.com/image.png",
@@ -46,6 +47,7 @@ describe("farcaster frame parser", () => {
4647
parseFarcasterFrame(document, { reporter, fallbackPostUrl })
4748
).toMatchObject({
4849
status: "failure",
50+
specification: "farcaster",
4951
frame: {},
5052
reports: expect.objectContaining({
5153
"fc:frame": [
@@ -71,6 +73,7 @@ describe("farcaster frame parser", () => {
7173
parseFarcasterFrame(document, { reporter, fallbackPostUrl })
7274
).toMatchObject({
7375
status: "failure",
76+
specification: "farcaster",
7477
frame: {},
7578
reports: expect.objectContaining({
7679
"fc:frame": [
@@ -96,6 +99,7 @@ describe("farcaster frame parser", () => {
9699
parseFarcasterFrame(document, { reporter, fallbackPostUrl })
97100
).toEqual({
98101
status: "success",
102+
specification: "farcaster",
99103
frame: {
100104
image: "http://example.com/image.png",
101105
ogImage: "http://example.com/image.png",
@@ -123,6 +127,7 @@ describe("farcaster frame parser", () => {
123127
})
124128
).toEqual({
125129
status: "success",
130+
specification: "farcaster",
126131
reports: {
127132
title: [
128133
{
@@ -153,6 +158,7 @@ describe("farcaster frame parser", () => {
153158

154159
expect(parseFarcasterFrame($, { reporter, fallbackPostUrl })).toEqual({
155160
status: "success",
161+
specification: "farcaster",
156162
reports: {},
157163
frame: {
158164
version: "vNext",
@@ -174,6 +180,7 @@ describe("farcaster frame parser", () => {
174180

175181
expect(parseFarcasterFrame($, { reporter, fallbackPostUrl })).toEqual({
176182
status: "success",
183+
specification: "farcaster",
177184
reports: {},
178185
frame: {
179186
version: "vNext",
@@ -196,6 +203,7 @@ describe("farcaster frame parser", () => {
196203

197204
expect(parseFarcasterFrame($, { reporter, fallbackPostUrl })).toEqual({
198205
status: "success",
206+
specification: "farcaster",
199207
reports: {
200208
"og:image": [
201209
{
@@ -229,6 +237,7 @@ describe("farcaster frame parser", () => {
229237
})
230238
).toEqual({
231239
status: "success",
240+
specification: "farcaster",
232241
reports: {},
233242
frame: {
234243
version: "vNext",
@@ -249,6 +258,7 @@ describe("farcaster frame parser", () => {
249258

250259
expect(parseFarcasterFrame($, { reporter, fallbackPostUrl })).toEqual({
251260
status: "success",
261+
specification: "farcaster",
252262
reports: {},
253263
frame: {
254264
version: "vNext",
@@ -273,6 +283,7 @@ describe("farcaster frame parser", () => {
273283
parseFarcasterFrame(document, { reporter, fallbackPostUrl })
274284
).toMatchObject({
275285
status: "failure",
286+
specification: "farcaster",
276287
frame: {
277288
version: "vNext",
278289
ogImage: "http://example.com/image.png",
@@ -303,6 +314,7 @@ describe("farcaster frame parser", () => {
303314
parseFarcasterFrame(document, { reporter, fallbackPostUrl })
304315
).toEqual({
305316
status: "success",
317+
specification: "farcaster",
306318
frame: {
307319
image: "http://example.com/image.png",
308320
ogImage: "http://example.com/image.png",
@@ -329,6 +341,7 @@ describe("farcaster frame parser", () => {
329341
parseFarcasterFrame(document, { reporter, fallbackPostUrl })
330342
).toEqual({
331343
status: "success",
344+
specification: "farcaster",
332345
frame: {
333346
image: "http://example.com/image.png",
334347
version: "vNext",
@@ -356,6 +369,7 @@ describe("farcaster frame parser", () => {
356369
parseFarcasterFrame(document, { reporter, fallbackPostUrl })
357370
).toEqual({
358371
status: "success",
372+
specification: "farcaster",
359373
frame: {
360374
image: "http://example.com/image.png",
361375
version: "vNext",
@@ -384,6 +398,7 @@ describe("farcaster frame parser", () => {
384398
parseFarcasterFrame(document, { reporter, fallbackPostUrl })
385399
).toMatchObject({
386400
status: "failure",
401+
specification: "farcaster",
387402
frame: {
388403
version: "vNext",
389404
image: "http://example.com/image.png",
@@ -416,6 +431,7 @@ describe("farcaster frame parser", () => {
416431
parseFarcasterFrame(document, { reporter, fallbackPostUrl })
417432
).toEqual({
418433
status: "success",
434+
specification: "farcaster",
419435
frame: {
420436
image: "http://example.com/image.png",
421437
version: "vNext",
@@ -442,6 +458,7 @@ describe("farcaster frame parser", () => {
442458
parseFarcasterFrame(document, { reporter, fallbackPostUrl })
443459
).toEqual({
444460
status: "success",
461+
specification: "farcaster",
445462
frame: {
446463
image: "http://example.com/image.png",
447464
ogImage: "http://example.com/image.png",
@@ -471,6 +488,7 @@ describe("farcaster frame parser", () => {
471488
parseFarcasterFrame(document, { reporter, fallbackPostUrl })
472489
).toEqual({
473490
status: "success",
491+
specification: "farcaster",
474492
frame: {
475493
image: "http://example.com/image.png",
476494
version: "vNext",

packages/frames.js/src/frame-parsers/farcaster.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,14 @@ export function parseFarcasterFrame(
143143
status: "failure",
144144
frame,
145145
reports: reporter.toObject(),
146+
specification: "farcaster",
146147
};
147148
}
148149

149150
return {
150151
status: "success",
151152
frame: frame as unknown as Frame,
152153
reports: reporter.toObject(),
154+
specification: "farcaster",
153155
};
154156
}

packages/frames.js/src/frame-parsers/open-frames.test.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ describe("open frames frame parser", () => {
2424
parseOpenFramesFrame($, { farcasterFrame: {}, reporter, fallbackPostUrl })
2525
).toEqual({
2626
status: "success",
27+
specification: "openframes",
2728
reports: {},
2829
frame: {
2930
accepts: [{ id: "some_protocol", version: "vNext" }],
@@ -62,6 +63,7 @@ describe("open frames frame parser", () => {
6263
})
6364
).toEqual({
6465
status: "success",
66+
specification: "openframes",
6567
reports: {},
6668
frame: {
6769
accepts: [{ id: "myproto", version: "1.0.0" }],
@@ -98,6 +100,7 @@ describe("open frames frame parser", () => {
98100
})
99101
).toEqual({
100102
status: "failure",
103+
specification: "openframes",
101104
reports: {
102105
"of:version": [
103106
{
@@ -133,6 +136,7 @@ describe("open frames frame parser", () => {
133136
})
134137
).toEqual({
135138
status: "failure",
139+
specification: "openframes",
136140
reports: {
137141
"of:version": [
138142
{
@@ -169,6 +173,7 @@ describe("open frames frame parser", () => {
169173
})
170174
).toEqual({
171175
status: "success",
176+
specification: "openframes",
172177
reports: {},
173178
frame: {
174179
accepts: [{ id: "some_protocol", version: "vNext" }],
@@ -199,6 +204,7 @@ describe("open frames frame parser", () => {
199204
})
200205
).toEqual({
201206
status: "failure",
207+
specification: "openframes",
202208
frame: {
203209
accepts: [],
204210
version: "vNext",
@@ -237,6 +243,7 @@ describe("open frames frame parser", () => {
237243
})
238244
).toEqual({
239245
status: "success",
246+
specification: "openframes",
240247
reports: {},
241248
frame: {
242249
accepts: [{ id: "farcaster", version: "vNext" }],
@@ -267,6 +274,7 @@ describe("open frames frame parser", () => {
267274
})
268275
).toEqual({
269276
status: "success",
277+
specification: "openframes",
270278
reports: {
271279
title: [
272280
{
@@ -305,6 +313,7 @@ describe("open frames frame parser", () => {
305313
})
306314
).toEqual({
307315
status: "success",
316+
specification: "openframes",
308317
reports: {},
309318
frame: {
310319
accepts: [{ id: "farcaster", version: "vNext" }],
@@ -334,6 +343,7 @@ describe("open frames frame parser", () => {
334343
})
335344
).toEqual({
336345
status: "success",
346+
specification: "openframes",
337347
reports: {},
338348
frame: {
339349
accepts: [{ id: "farcaster", version: "vNext" }],
@@ -364,6 +374,7 @@ describe("open frames frame parser", () => {
364374
})
365375
).toEqual({
366376
status: "success",
377+
specification: "openframes",
367378
reports: {
368379
"og:image": [
369380
{
@@ -400,6 +411,7 @@ describe("open frames frame parser", () => {
400411
})
401412
).toEqual({
402413
status: "success",
414+
specification: "openframes",
403415
reports: {},
404416
frame: {
405417
accepts: [{ id: "some_protocol", version: "vNext" }],
@@ -428,6 +440,7 @@ describe("open frames frame parser", () => {
428440
})
429441
).toEqual({
430442
status: "success",
443+
specification: "openframes",
431444
reports: {},
432445
frame: {
433446
accepts: [{ id: "some_protocol", version: "vNext" }],
@@ -458,6 +471,7 @@ describe("open frames frame parser", () => {
458471
})
459472
).toEqual({
460473
status: "failure",
474+
specification: "openframes",
461475
reports: {
462476
"of:image": [
463477
{
@@ -495,6 +509,7 @@ describe("open frames frame parser", () => {
495509
})
496510
).toEqual({
497511
status: "success",
512+
specification: "openframes",
498513
reports: {},
499514
frame: {
500515
accepts: [{ id: "farcaster", version: "vNext" }],
@@ -524,6 +539,7 @@ describe("open frames frame parser", () => {
524539
})
525540
).toEqual({
526541
status: "success",
542+
specification: "openframes",
527543
reports: {},
528544
frame: {
529545
accepts: [{ id: "some_protocol", version: "vNext" }],
@@ -557,6 +573,7 @@ describe("open frames frame parser", () => {
557573
})
558574
).toEqual({
559575
status: "success",
576+
specification: "openframes",
560577
reports: {},
561578
frame: {
562579
accepts: [{ id: "farcaster", version: "vNext" }],
@@ -588,6 +605,7 @@ describe("open frames frame parser", () => {
588605
})
589606
).toEqual({
590607
status: "success",
608+
specification: "openframes",
591609
reports: {},
592610
frame: {
593611
accepts: [{ id: "some_protocol", version: "vNext" }],
@@ -622,6 +640,7 @@ describe("open frames frame parser", () => {
622640
})
623641
).toEqual({
624642
status: "success",
643+
specification: "openframes",
625644
reports: {},
626645
frame: {
627646
accepts: [{ id: "farcaster", version: "vNext" }],
@@ -653,6 +672,7 @@ describe("open frames frame parser", () => {
653672
})
654673
).toEqual({
655674
status: "success",
675+
specification: "openframes",
656676
frame: {
657677
accepts: [{ id: "some_protocol", version: "vNext" }],
658678
version: "vNext",
@@ -687,6 +707,7 @@ describe("open frames frame parser", () => {
687707
})
688708
).toEqual({
689709
status: "failure",
710+
specification: "openframes",
690711
reports: {
691712
"of:post_url": [
692713
{
@@ -726,6 +747,7 @@ describe("open frames frame parser", () => {
726747
})
727748
).toEqual({
728749
status: "success",
750+
specification: "openframes",
729751
reports: {},
730752
frame: {
731753
accepts: [{ id: "farcaster", version: "vNext" }],
@@ -756,6 +778,7 @@ describe("open frames frame parser", () => {
756778
})
757779
).toEqual({
758780
status: "success",
781+
specification: "openframes",
759782
reports: {},
760783
frame: {
761784
accepts: [{ id: "some_protocol", version: "vNext" }],
@@ -785,6 +808,7 @@ describe("open frames frame parser", () => {
785808
})
786809
).toEqual({
787810
status: "success",
811+
specification: "openframes",
788812
reports: {},
789813
frame: {
790814
accepts: [{ id: "farcaster", version: "vNext" }],
@@ -818,6 +842,7 @@ describe("open frames frame parser", () => {
818842
})
819843
).toEqual({
820844
status: "success",
845+
specification: "openframes",
821846
reports: {},
822847
frame: {
823848
accepts: [{ id: "farcaster", version: "vNext" }],
@@ -849,6 +874,7 @@ describe("open frames frame parser", () => {
849874
})
850875
).toEqual({
851876
status: "success",
877+
specification: "openframes",
852878
reports: {},
853879
frame: {
854880
accepts: [{ id: "some_protocol", version: "vNext" }],
@@ -884,6 +910,7 @@ describe("open frames frame parser", () => {
884910
})
885911
).toEqual({
886912
status: "success",
913+
specification: "openframes",
887914
reports: {},
888915
frame: {
889916
accepts: [{ id: "some_protocol", version: "vNext" }],

packages/frames.js/src/frame-parsers/open-frames.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,14 @@ export function parseOpenFramesFrame(
194194
status: "failure",
195195
frame,
196196
reports: reporter.toObject(),
197+
specification: "openframes",
197198
};
198199
}
199200

200201
return {
201202
status: "success",
202203
frame: frame as unknown as Frame,
203204
reports: reporter.toObject(),
205+
specification: "openframes",
204206
};
205207
}

0 commit comments

Comments
 (0)