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