@farcaster/frame-core 0.0.20 → 0.0.22
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.
- package/dist/actions/AddFrame.d.ts +36 -0
- package/dist/actions/AddFrame.js +57 -0
- package/dist/actions/{signIn.d.ts → SignIn.d.ts} +7 -6
- package/dist/actions/{signIn.js → SignIn.js} +1 -1
- package/dist/actions/index.d.ts +2 -0
- package/dist/actions/index.js +38 -0
- package/dist/errors.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -25
- package/dist/internal/types.d.ts +3 -2
- package/dist/schemas/embeds.d.ts +1 -1
- package/dist/schemas/embeds.js +3 -3
- package/dist/schemas/events.d.ts +1 -1
- package/dist/schemas/events.js +5 -5
- package/dist/schemas/index.d.ts +5 -5
- package/dist/schemas/manifest.d.ts +1 -1
- package/dist/schemas/manifest.js +4 -4
- package/dist/schemas/notifications.d.ts +1 -1
- package/dist/schemas/shared.d.ts +1 -1
- package/dist/schemas/shared.js +4 -4
- package/dist/types.d.ts +43 -31
- package/esm/actions/AddFrame.d.ts +40 -0
- package/esm/actions/AddFrame.js +19 -0
- package/esm/actions/SignIn.d.ts +43 -0
- package/esm/actions/SignIn.js +10 -0
- package/esm/actions/index.d.ts +2 -0
- package/esm/actions/index.js +2 -0
- package/esm/errors.d.ts +9 -7
- package/esm/errors.js +6 -6
- package/esm/index.d.ts +3 -3
- package/esm/index.js +3 -3
- package/esm/internal/types.d.ts +19 -7
- package/esm/internal/types.js +1 -1
- package/esm/schemas/embeds.d.ts +231 -169
- package/esm/schemas/embeds.js +25 -19
- package/esm/schemas/events.d.ts +225 -129
- package/esm/schemas/events.js +18 -18
- package/esm/schemas/index.d.ts +5 -5
- package/esm/schemas/index.js +5 -5
- package/esm/schemas/manifest.d.ts +154 -110
- package/esm/schemas/manifest.js +29 -23
- package/esm/schemas/notifications.d.ts +86 -58
- package/esm/schemas/notifications.js +17 -17
- package/esm/schemas/shared.d.ts +49 -33
- package/esm/schemas/shared.js +20 -19
- package/esm/tsconfig.tsbuildinfo +1 -1
- package/esm/types.d.ts +180 -139
- package/esm/types.js +2 -2
- package/package.json +4 -5
- package/src/actions/AddFrame.ts +51 -0
- package/src/actions/SignIn.ts +51 -0
- package/src/actions/index.ts +2 -0
- package/src/errors.ts +4 -4
- package/src/index.ts +3 -3
- package/src/internal/types.ts +3 -4
- package/src/schemas/embeds.ts +13 -13
- package/src/schemas/events.ts +17 -17
- package/src/schemas/index.ts +5 -5
- package/src/schemas/manifest.ts +11 -11
- package/src/schemas/notifications.ts +8 -10
- package/src/schemas/shared.ts +13 -13
- package/src/types.ts +125 -123
- package/esm/actions/signIn.d.ts +0 -40
- package/esm/actions/signIn.js +0 -10
- package/src/actions/signIn.ts +0 -50
package/esm/errors.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
export declare class BaseError<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export declare class BaseError<
|
|
2
|
+
cause extends Error | undefined = undefined,
|
|
3
|
+
> extends Error {
|
|
4
|
+
name: string
|
|
5
|
+
cause: cause
|
|
6
|
+
constructor(message: string, options?: BaseError.Options<cause>)
|
|
5
7
|
}
|
|
6
8
|
export declare namespace BaseError {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
type Options<cause extends Error | undefined = Error | undefined> = {
|
|
10
|
+
cause?: cause | undefined
|
|
11
|
+
}
|
|
10
12
|
}
|
package/esm/errors.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export class BaseError extends Error {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
name = 'BaseError'
|
|
3
|
+
cause
|
|
4
|
+
constructor(message, options = {}) {
|
|
5
|
+
super(message, options.cause ? { cause: options.cause } : undefined)
|
|
6
|
+
this.cause = options.cause
|
|
7
|
+
}
|
|
8
8
|
}
|
package/esm/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export *
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from './actions'
|
|
2
|
+
export * from './schemas'
|
|
3
|
+
export * from './types'
|
package/esm/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export *
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from './actions'
|
|
2
|
+
export * from './schemas'
|
|
3
|
+
export * from './types'
|
package/esm/internal/types.d.ts
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
} & unknown
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
package/esm/internal/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {}
|
|
1
|
+
export {}
|
package/esm/schemas/embeds.d.ts
CHANGED
|
@@ -1,177 +1,239 @@
|
|
|
1
|
-
import { z } from
|
|
2
|
-
export declare const actionLaunchFrameSchema: z.ZodObject<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
|
63
95
|
action: {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
|
|
96
|
+
type: 'launch_frame'
|
|
97
|
+
name: string
|
|
98
|
+
url: string
|
|
99
|
+
splashImageUrl?: string | undefined
|
|
100
|
+
splashBackgroundColor?: string | undefined
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
title: string
|
|
72
105
|
action: {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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
|
|
106
156
|
action: {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
157
|
+
type: 'launch_frame'
|
|
158
|
+
name: string
|
|
159
|
+
url: string
|
|
160
|
+
splashImageUrl?: string | undefined
|
|
161
|
+
splashBackgroundColor?: string | undefined
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
title: string
|
|
115
166
|
action: {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
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
|
|
126
181
|
button: {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
|
|
138
|
-
|
|
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
|
|
139
195
|
button: {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
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
|
|
153
213
|
button: {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
|
|
165
|
-
|
|
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
|
|
166
227
|
button: {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
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>
|
package/esm/schemas/embeds.js
CHANGED
|
@@ -1,22 +1,28 @@
|
|
|
1
|
-
import { z } from
|
|
2
|
-
import {
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
import {
|
|
3
|
+
buttonTitleSchema,
|
|
4
|
+
frameNameSchema,
|
|
5
|
+
hexColorSchema,
|
|
6
|
+
secureUrlSchema,
|
|
7
|
+
} from './shared'
|
|
3
8
|
export const actionLaunchFrameSchema = z.object({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
})
|
|
10
|
-
export const actionSchema = z.discriminatedUnion(
|
|
11
|
-
|
|
12
|
-
])
|
|
9
|
+
type: z.literal('launch_frame'),
|
|
10
|
+
name: frameNameSchema,
|
|
11
|
+
url: secureUrlSchema,
|
|
12
|
+
splashImageUrl: secureUrlSchema.optional(),
|
|
13
|
+
splashBackgroundColor: hexColorSchema.optional(),
|
|
14
|
+
})
|
|
15
|
+
export const actionSchema = z.discriminatedUnion('type', [
|
|
16
|
+
actionLaunchFrameSchema,
|
|
17
|
+
])
|
|
13
18
|
export const buttonSchema = z.object({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
})
|
|
19
|
+
title: buttonTitleSchema,
|
|
20
|
+
action: actionSchema,
|
|
21
|
+
})
|
|
17
22
|
export const frameEmbedNextSchema = z.object({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
})
|
|
22
|
-
export const safeParseFrameEmbed = (rawResponse) =>
|
|
23
|
+
version: z.literal('next'),
|
|
24
|
+
imageUrl: secureUrlSchema,
|
|
25
|
+
button: buttonSchema,
|
|
26
|
+
})
|
|
27
|
+
export const safeParseFrameEmbed = (rawResponse) =>
|
|
28
|
+
frameEmbedNextSchema.safeParse(rawResponse)
|