@farcaster/frame-core 0.0.23 → 0.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/actions/ViewProfile.d.ts +4 -0
  2. package/dist/actions/ViewProfile.js +2 -0
  3. package/dist/actions/index.d.ts +1 -0
  4. package/dist/actions/index.js +2 -1
  5. package/dist/schemas/embeds.d.ts +61 -0
  6. package/dist/schemas/embeds.js +6 -1
  7. package/dist/schemas/shared.d.ts +1 -0
  8. package/dist/schemas/shared.js +5 -1
  9. package/dist/types.d.ts +3 -1
  10. package/esm/actions/AddFrame.d.ts +23 -27
  11. package/esm/actions/AddFrame.js +9 -9
  12. package/esm/actions/SignIn.d.ts +33 -35
  13. package/esm/actions/SignIn.js +5 -5
  14. package/esm/actions/ViewProfile.d.ts +4 -0
  15. package/esm/actions/ViewProfile.js +1 -0
  16. package/esm/actions/index.d.ts +3 -2
  17. package/esm/actions/index.js +3 -2
  18. package/esm/context.d.ts +61 -65
  19. package/esm/context.js +1 -1
  20. package/esm/errors.d.ts +7 -9
  21. package/esm/errors.js +6 -6
  22. package/esm/index.d.ts +4 -4
  23. package/esm/index.js +4 -4
  24. package/esm/internal/types.d.ts +7 -18
  25. package/esm/internal/types.js +1 -1
  26. package/esm/schemas/embeds.d.ts +230 -231
  27. package/esm/schemas/embeds.js +23 -24
  28. package/esm/schemas/events.d.ts +129 -225
  29. package/esm/schemas/events.js +17 -17
  30. package/esm/schemas/index.d.ts +5 -5
  31. package/esm/schemas/index.js +5 -5
  32. package/esm/schemas/manifest.d.ts +110 -154
  33. package/esm/schemas/manifest.js +23 -29
  34. package/esm/schemas/notifications.d.ts +58 -86
  35. package/esm/schemas/notifications.js +17 -17
  36. package/esm/schemas/shared.d.ts +34 -49
  37. package/esm/schemas/shared.js +23 -20
  38. package/esm/tsconfig.tsbuildinfo +1 -1
  39. package/esm/types.d.ts +102 -125
  40. package/esm/types.js +2 -2
  41. package/package.json +7 -2
  42. package/src/actions/ViewProfile.ts +5 -0
  43. package/src/actions/index.ts +1 -0
  44. package/src/schemas/embeds.ts +7 -0
  45. package/src/schemas/shared.ts +7 -0
  46. package/src/types.ts +3 -1
@@ -1,19 +1,8 @@
1
1
  type Compute<type> = {
2
- [key in keyof type]: type[key]
3
- } & unknown
4
- type KeyofUnion<type> = type extends type ? keyof type : never
5
- export type OneOf<
6
- union extends object,
7
- fallback extends object | undefined = undefined,
8
- keys extends KeyofUnion<union> = KeyofUnion<union>,
9
- > = union extends infer item
10
- ? Compute<
11
- item & {
12
- [key in Exclude<keys, keyof item>]?: fallback extends object
13
- ? key extends keyof fallback
14
- ? fallback[key]
15
- : undefined
16
- : undefined
17
- }
18
- >
19
- : never
2
+ [key in keyof type]: type[key];
3
+ } & unknown;
4
+ type KeyofUnion<type> = type extends type ? keyof type : never;
5
+ export type OneOf<union extends object, fallback extends object | undefined = undefined, keys extends KeyofUnion<union> = KeyofUnion<union>> = union extends infer item ? Compute<item & {
6
+ [key in Exclude<keys, keyof item>]?: fallback extends object ? key extends keyof fallback ? fallback[key] : undefined : undefined;
7
+ }> : never;
8
+ export {};
@@ -1 +1 @@
1
- export {}
1
+ export {};
@@ -1,239 +1,238 @@
1
- import type { z } from 'zod'
2
- export declare const actionLaunchFrameSchema: z.ZodObject<
3
- {
4
- type: z.ZodLiteral<'launch_frame'>
5
- name: z.ZodString
6
- url: z.ZodString
7
- splashImageUrl: z.ZodOptional<z.ZodString>
8
- splashBackgroundColor: z.ZodOptional<z.ZodString>
9
- },
10
- 'strip',
11
- z.ZodTypeAny,
12
- {
13
- type: 'launch_frame'
14
- name: string
15
- url: string
16
- splashImageUrl?: string | undefined
17
- splashBackgroundColor?: string | undefined
18
- },
19
- {
20
- type: 'launch_frame'
21
- name: string
22
- url: string
23
- splashImageUrl?: string | undefined
24
- splashBackgroundColor?: string | undefined
25
- }
26
- >
27
- export declare const actionSchema: z.ZodDiscriminatedUnion<
28
- 'type',
29
- [
30
- z.ZodObject<
31
- {
32
- type: z.ZodLiteral<'launch_frame'>
33
- name: z.ZodString
34
- url: z.ZodString
35
- splashImageUrl: z.ZodOptional<z.ZodString>
36
- splashBackgroundColor: z.ZodOptional<z.ZodString>
37
- },
38
- 'strip',
39
- z.ZodTypeAny,
40
- {
41
- type: 'launch_frame'
42
- name: string
43
- url: string
44
- splashImageUrl?: string | undefined
45
- splashBackgroundColor?: string | undefined
46
- },
47
- {
48
- type: 'launch_frame'
49
- name: string
50
- url: string
51
- splashImageUrl?: string | undefined
52
- splashBackgroundColor?: string | undefined
53
- }
54
- >,
55
- ]
56
- >
57
- export declare const buttonSchema: z.ZodObject<
58
- {
59
- title: z.ZodString
60
- action: z.ZodDiscriminatedUnion<
61
- 'type',
62
- [
63
- z.ZodObject<
64
- {
65
- type: z.ZodLiteral<'launch_frame'>
66
- name: z.ZodString
67
- url: z.ZodString
68
- splashImageUrl: z.ZodOptional<z.ZodString>
69
- splashBackgroundColor: z.ZodOptional<z.ZodString>
70
- },
71
- 'strip',
72
- z.ZodTypeAny,
73
- {
74
- type: 'launch_frame'
75
- name: string
76
- url: string
77
- splashImageUrl?: string | undefined
78
- splashBackgroundColor?: string | undefined
79
- },
80
- {
81
- type: 'launch_frame'
82
- name: string
83
- url: string
84
- splashImageUrl?: string | undefined
85
- splashBackgroundColor?: string | undefined
86
- }
87
- >,
88
- ]
89
- >
90
- },
91
- 'strip',
92
- z.ZodTypeAny,
93
- {
94
- title: string
1
+ import { z } from 'zod';
2
+ export declare const actionLaunchFrameSchema: z.ZodObject<{
3
+ type: z.ZodLiteral<"launch_frame">;
4
+ name: z.ZodString;
5
+ url: z.ZodString;
6
+ splashImageUrl: z.ZodOptional<z.ZodString>;
7
+ splashBackgroundColor: z.ZodOptional<z.ZodString>;
8
+ }, "strip", z.ZodTypeAny, {
9
+ type: "launch_frame";
10
+ name: string;
11
+ url: string;
12
+ splashImageUrl?: string | undefined;
13
+ splashBackgroundColor?: string | undefined;
14
+ }, {
15
+ type: "launch_frame";
16
+ name: string;
17
+ url: string;
18
+ splashImageUrl?: string | undefined;
19
+ splashBackgroundColor?: string | undefined;
20
+ }>;
21
+ export declare const actionViewTokenSchema: z.ZodObject<{
22
+ type: z.ZodLiteral<"view_token">;
23
+ token: z.ZodString;
24
+ }, "strip", z.ZodTypeAny, {
25
+ type: "view_token";
26
+ token: string;
27
+ }, {
28
+ type: "view_token";
29
+ token: string;
30
+ }>;
31
+ export declare const actionSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
32
+ type: z.ZodLiteral<"launch_frame">;
33
+ name: z.ZodString;
34
+ url: z.ZodString;
35
+ splashImageUrl: z.ZodOptional<z.ZodString>;
36
+ splashBackgroundColor: z.ZodOptional<z.ZodString>;
37
+ }, "strip", z.ZodTypeAny, {
38
+ type: "launch_frame";
39
+ name: string;
40
+ url: string;
41
+ splashImageUrl?: string | undefined;
42
+ splashBackgroundColor?: string | undefined;
43
+ }, {
44
+ type: "launch_frame";
45
+ name: string;
46
+ url: string;
47
+ splashImageUrl?: string | undefined;
48
+ splashBackgroundColor?: string | undefined;
49
+ }>, z.ZodObject<{
50
+ type: z.ZodLiteral<"view_token">;
51
+ token: z.ZodString;
52
+ }, "strip", z.ZodTypeAny, {
53
+ type: "view_token";
54
+ token: string;
55
+ }, {
56
+ type: "view_token";
57
+ token: string;
58
+ }>]>;
59
+ export declare const buttonSchema: z.ZodObject<{
60
+ title: z.ZodString;
61
+ action: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
62
+ type: z.ZodLiteral<"launch_frame">;
63
+ name: z.ZodString;
64
+ url: z.ZodString;
65
+ splashImageUrl: z.ZodOptional<z.ZodString>;
66
+ splashBackgroundColor: z.ZodOptional<z.ZodString>;
67
+ }, "strip", z.ZodTypeAny, {
68
+ type: "launch_frame";
69
+ name: string;
70
+ url: string;
71
+ splashImageUrl?: string | undefined;
72
+ splashBackgroundColor?: string | undefined;
73
+ }, {
74
+ type: "launch_frame";
75
+ name: string;
76
+ url: string;
77
+ splashImageUrl?: string | undefined;
78
+ splashBackgroundColor?: string | undefined;
79
+ }>, z.ZodObject<{
80
+ type: z.ZodLiteral<"view_token">;
81
+ token: z.ZodString;
82
+ }, "strip", z.ZodTypeAny, {
83
+ type: "view_token";
84
+ token: string;
85
+ }, {
86
+ type: "view_token";
87
+ token: string;
88
+ }>]>;
89
+ }, "strip", z.ZodTypeAny, {
90
+ title: string;
95
91
  action: {
96
- type: 'launch_frame'
97
- name: string
98
- url: string
99
- splashImageUrl?: string | undefined
100
- splashBackgroundColor?: string | undefined
101
- }
102
- },
103
- {
104
- title: string
92
+ type: "launch_frame";
93
+ name: string;
94
+ url: string;
95
+ splashImageUrl?: string | undefined;
96
+ splashBackgroundColor?: string | undefined;
97
+ } | {
98
+ type: "view_token";
99
+ token: string;
100
+ };
101
+ }, {
102
+ title: string;
105
103
  action: {
106
- type: 'launch_frame'
107
- name: string
108
- url: string
109
- splashImageUrl?: string | undefined
110
- splashBackgroundColor?: string | undefined
111
- }
112
- }
113
- >
114
- export declare const frameEmbedNextSchema: z.ZodObject<
115
- {
116
- version: z.ZodLiteral<'next'>
117
- imageUrl: z.ZodString
118
- button: z.ZodObject<
119
- {
120
- title: z.ZodString
121
- action: z.ZodDiscriminatedUnion<
122
- 'type',
123
- [
124
- z.ZodObject<
125
- {
126
- type: z.ZodLiteral<'launch_frame'>
127
- name: z.ZodString
128
- url: z.ZodString
129
- splashImageUrl: z.ZodOptional<z.ZodString>
130
- splashBackgroundColor: z.ZodOptional<z.ZodString>
131
- },
132
- 'strip',
133
- z.ZodTypeAny,
134
- {
135
- type: 'launch_frame'
136
- name: string
137
- url: string
138
- splashImageUrl?: string | undefined
139
- splashBackgroundColor?: string | undefined
140
- },
141
- {
142
- type: 'launch_frame'
143
- name: string
144
- url: string
145
- splashImageUrl?: string | undefined
146
- splashBackgroundColor?: string | undefined
147
- }
148
- >,
149
- ]
150
- >
151
- },
152
- 'strip',
153
- z.ZodTypeAny,
154
- {
155
- title: string
104
+ type: "launch_frame";
105
+ name: string;
106
+ url: string;
107
+ splashImageUrl?: string | undefined;
108
+ splashBackgroundColor?: string | undefined;
109
+ } | {
110
+ type: "view_token";
111
+ token: string;
112
+ };
113
+ }>;
114
+ export declare const frameEmbedNextSchema: z.ZodObject<{
115
+ version: z.ZodLiteral<"next">;
116
+ imageUrl: z.ZodString;
117
+ button: z.ZodObject<{
118
+ title: z.ZodString;
119
+ action: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
120
+ type: z.ZodLiteral<"launch_frame">;
121
+ name: z.ZodString;
122
+ url: z.ZodString;
123
+ splashImageUrl: z.ZodOptional<z.ZodString>;
124
+ splashBackgroundColor: z.ZodOptional<z.ZodString>;
125
+ }, "strip", z.ZodTypeAny, {
126
+ type: "launch_frame";
127
+ name: string;
128
+ url: string;
129
+ splashImageUrl?: string | undefined;
130
+ splashBackgroundColor?: string | undefined;
131
+ }, {
132
+ type: "launch_frame";
133
+ name: string;
134
+ url: string;
135
+ splashImageUrl?: string | undefined;
136
+ splashBackgroundColor?: string | undefined;
137
+ }>, z.ZodObject<{
138
+ type: z.ZodLiteral<"view_token">;
139
+ token: z.ZodString;
140
+ }, "strip", z.ZodTypeAny, {
141
+ type: "view_token";
142
+ token: string;
143
+ }, {
144
+ type: "view_token";
145
+ token: string;
146
+ }>]>;
147
+ }, "strip", z.ZodTypeAny, {
148
+ title: string;
156
149
  action: {
157
- type: 'launch_frame'
158
- name: string
159
- url: string
160
- splashImageUrl?: string | undefined
161
- splashBackgroundColor?: string | undefined
162
- }
163
- },
164
- {
165
- title: string
150
+ type: "launch_frame";
151
+ name: string;
152
+ url: string;
153
+ splashImageUrl?: string | undefined;
154
+ splashBackgroundColor?: string | undefined;
155
+ } | {
156
+ type: "view_token";
157
+ token: string;
158
+ };
159
+ }, {
160
+ title: string;
166
161
  action: {
167
- type: 'launch_frame'
168
- name: string
169
- url: string
170
- splashImageUrl?: string | undefined
171
- splashBackgroundColor?: string | undefined
172
- }
173
- }
174
- >
175
- },
176
- 'strip',
177
- z.ZodTypeAny,
178
- {
179
- version: 'next'
180
- imageUrl: string
162
+ type: "launch_frame";
163
+ name: string;
164
+ url: string;
165
+ splashImageUrl?: string | undefined;
166
+ splashBackgroundColor?: string | undefined;
167
+ } | {
168
+ type: "view_token";
169
+ token: string;
170
+ };
171
+ }>;
172
+ }, "strip", z.ZodTypeAny, {
173
+ version: "next";
174
+ imageUrl: string;
181
175
  button: {
182
- title: string
183
- action: {
184
- type: 'launch_frame'
185
- name: string
186
- url: string
187
- splashImageUrl?: string | undefined
188
- splashBackgroundColor?: string | undefined
189
- }
190
- }
191
- },
192
- {
193
- version: 'next'
194
- imageUrl: string
176
+ title: string;
177
+ action: {
178
+ type: "launch_frame";
179
+ name: string;
180
+ url: string;
181
+ splashImageUrl?: string | undefined;
182
+ splashBackgroundColor?: string | undefined;
183
+ } | {
184
+ type: "view_token";
185
+ token: string;
186
+ };
187
+ };
188
+ }, {
189
+ version: "next";
190
+ imageUrl: string;
195
191
  button: {
196
- title: string
197
- action: {
198
- type: 'launch_frame'
199
- name: string
200
- url: string
201
- splashImageUrl?: string | undefined
202
- splashBackgroundColor?: string | undefined
203
- }
204
- }
205
- }
206
- >
207
- export declare const safeParseFrameEmbed: (
208
- rawResponse: unknown,
209
- ) => z.SafeParseReturnType<
210
- {
211
- version: 'next'
212
- imageUrl: string
192
+ title: string;
193
+ action: {
194
+ type: "launch_frame";
195
+ name: string;
196
+ url: string;
197
+ splashImageUrl?: string | undefined;
198
+ splashBackgroundColor?: string | undefined;
199
+ } | {
200
+ type: "view_token";
201
+ token: string;
202
+ };
203
+ };
204
+ }>;
205
+ export declare const safeParseFrameEmbed: (rawResponse: unknown) => z.SafeParseReturnType<{
206
+ version: "next";
207
+ imageUrl: string;
213
208
  button: {
214
- title: string
215
- action: {
216
- type: 'launch_frame'
217
- name: string
218
- url: string
219
- splashImageUrl?: string | undefined
220
- splashBackgroundColor?: string | undefined
221
- }
222
- }
223
- },
224
- {
225
- version: 'next'
226
- imageUrl: string
209
+ title: string;
210
+ action: {
211
+ type: "launch_frame";
212
+ name: string;
213
+ url: string;
214
+ splashImageUrl?: string | undefined;
215
+ splashBackgroundColor?: string | undefined;
216
+ } | {
217
+ type: "view_token";
218
+ token: string;
219
+ };
220
+ };
221
+ }, {
222
+ version: "next";
223
+ imageUrl: string;
227
224
  button: {
228
- title: string
229
- action: {
230
- type: 'launch_frame'
231
- name: string
232
- url: string
233
- splashImageUrl?: string | undefined
234
- splashBackgroundColor?: string | undefined
235
- }
236
- }
237
- }
238
- >
239
- export type FrameEmbedNext = z.infer<typeof frameEmbedNextSchema>
225
+ title: string;
226
+ action: {
227
+ type: "launch_frame";
228
+ name: string;
229
+ url: string;
230
+ splashImageUrl?: string | undefined;
231
+ splashBackgroundColor?: string | undefined;
232
+ } | {
233
+ type: "view_token";
234
+ token: string;
235
+ };
236
+ };
237
+ }>;
238
+ export type FrameEmbedNext = z.infer<typeof frameEmbedNextSchema>;
@@ -1,28 +1,27 @@
1
- import { z } from 'zod'
2
- import {
3
- buttonTitleSchema,
4
- frameNameSchema,
5
- hexColorSchema,
6
- secureUrlSchema,
7
- } from './shared'
1
+ import { z } from 'zod';
2
+ import { buttonTitleSchema, caip19TokenSchema, frameNameSchema, hexColorSchema, secureUrlSchema, } from './shared';
8
3
  export const actionLaunchFrameSchema = z.object({
9
- type: z.literal('launch_frame'),
10
- name: frameNameSchema,
11
- url: secureUrlSchema,
12
- splashImageUrl: secureUrlSchema.optional(),
13
- splashBackgroundColor: hexColorSchema.optional(),
14
- })
4
+ type: z.literal('launch_frame'),
5
+ name: frameNameSchema,
6
+ url: secureUrlSchema,
7
+ splashImageUrl: secureUrlSchema.optional(),
8
+ splashBackgroundColor: hexColorSchema.optional(),
9
+ });
10
+ export const actionViewTokenSchema = z.object({
11
+ type: z.literal('view_token'),
12
+ token: caip19TokenSchema,
13
+ });
15
14
  export const actionSchema = z.discriminatedUnion('type', [
16
- actionLaunchFrameSchema,
17
- ])
15
+ actionLaunchFrameSchema,
16
+ actionViewTokenSchema,
17
+ ]);
18
18
  export const buttonSchema = z.object({
19
- title: buttonTitleSchema,
20
- action: actionSchema,
21
- })
19
+ title: buttonTitleSchema,
20
+ action: actionSchema,
21
+ });
22
22
  export const frameEmbedNextSchema = z.object({
23
- version: z.literal('next'),
24
- imageUrl: secureUrlSchema,
25
- button: buttonSchema,
26
- })
27
- export const safeParseFrameEmbed = (rawResponse) =>
28
- frameEmbedNextSchema.safeParse(rawResponse)
23
+ version: z.literal('next'),
24
+ imageUrl: secureUrlSchema,
25
+ button: buttonSchema,
26
+ });
27
+ export const safeParseFrameEmbed = (rawResponse) => frameEmbedNextSchema.safeParse(rawResponse);