@farcaster/frame-core 0.0.21 → 0.0.23

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 (70) 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/context.d.ts +72 -0
  8. package/dist/context.js +2 -0
  9. package/dist/errors.js +1 -1
  10. package/dist/index.d.ts +4 -3
  11. package/dist/index.js +6 -5
  12. package/dist/internal/types.d.ts +3 -2
  13. package/dist/schemas/embeds.d.ts +1 -1
  14. package/dist/schemas/embeds.js +3 -3
  15. package/dist/schemas/events.d.ts +1 -1
  16. package/dist/schemas/events.js +5 -5
  17. package/dist/schemas/index.d.ts +5 -5
  18. package/dist/schemas/manifest.d.ts +1 -1
  19. package/dist/schemas/manifest.js +4 -4
  20. package/dist/schemas/notifications.d.ts +1 -1
  21. package/dist/schemas/shared.d.ts +1 -1
  22. package/dist/schemas/shared.js +4 -4
  23. package/dist/types.d.ts +40 -80
  24. package/esm/actions/AddFrame.d.ts +40 -0
  25. package/esm/actions/AddFrame.js +19 -0
  26. package/esm/actions/SignIn.d.ts +43 -0
  27. package/esm/actions/SignIn.js +10 -0
  28. package/esm/actions/index.d.ts +2 -0
  29. package/esm/actions/index.js +2 -0
  30. package/esm/context.d.ts +76 -0
  31. package/esm/context.js +1 -0
  32. package/esm/errors.d.ts +9 -7
  33. package/esm/errors.js +6 -6
  34. package/esm/index.d.ts +4 -3
  35. package/esm/index.js +4 -3
  36. package/esm/internal/types.d.ts +19 -7
  37. package/esm/internal/types.js +1 -1
  38. package/esm/schemas/embeds.d.ts +231 -169
  39. package/esm/schemas/embeds.js +25 -19
  40. package/esm/schemas/events.d.ts +225 -129
  41. package/esm/schemas/events.js +18 -18
  42. package/esm/schemas/index.d.ts +5 -5
  43. package/esm/schemas/index.js +5 -5
  44. package/esm/schemas/manifest.d.ts +154 -110
  45. package/esm/schemas/manifest.js +29 -23
  46. package/esm/schemas/notifications.d.ts +86 -58
  47. package/esm/schemas/notifications.js +17 -17
  48. package/esm/schemas/shared.d.ts +49 -33
  49. package/esm/schemas/shared.js +20 -19
  50. package/esm/tsconfig.tsbuildinfo +1 -1
  51. package/esm/types.d.ts +132 -147
  52. package/esm/types.js +2 -2
  53. package/package.json +4 -5
  54. package/src/actions/AddFrame.ts +51 -0
  55. package/src/actions/SignIn.ts +51 -0
  56. package/src/actions/index.ts +2 -0
  57. package/src/context.ts +90 -0
  58. package/src/errors.ts +4 -4
  59. package/src/index.ts +4 -3
  60. package/src/internal/types.ts +3 -4
  61. package/src/schemas/embeds.ts +13 -13
  62. package/src/schemas/events.ts +17 -17
  63. package/src/schemas/index.ts +5 -5
  64. package/src/schemas/manifest.ts +11 -11
  65. package/src/schemas/notifications.ts +8 -10
  66. package/src/schemas/shared.ts +13 -13
  67. package/src/types.ts +88 -149
  68. package/esm/actions/signIn.d.ts +0 -40
  69. package/esm/actions/signIn.js +0 -10
  70. package/src/actions/signIn.ts +0 -50
package/esm/types.d.ts CHANGED
@@ -1,155 +1,140 @@
1
- import type { Address, Provider, RpcRequest, RpcResponse, RpcSchema } from "ox";
2
- import { FrameNotificationDetails, EventFrameAdded, EventFrameRemoved, EventNotificationsEnabled, EventNotificationsDisabled } from "./schemas";
3
- import * as SignIn from "./actions/signIn";
4
- export type SetPrimaryButton = (options: {
5
- text: string;
6
- loading?: boolean;
7
- disabled?: boolean;
8
- hidden?: boolean;
9
- }) => void;
10
- export type EthProviderRequest = Provider.RequestFn<RpcSchema.Default>;
11
- export type AccountLocation = {
12
- placeId: string;
13
- /**
14
- * Human-readable string describing the location
15
- */
16
- description: string;
17
- };
18
- export type FrameLocationContextCastEmbed = {
19
- type: "cast_embed";
20
- embed: string;
21
- cast: {
22
- fid: number;
23
- hash: string;
24
- };
25
- };
26
- export type FrameLocationContextNotification = {
27
- type: "notification";
28
- notification: {
29
- notificationId: string;
30
- title: string;
31
- body: string;
32
- };
33
- };
34
- export type FrameLocationContextLauncher = {
35
- type: "launcher";
36
- };
37
- export type FrameLocationContext = FrameLocationContextCastEmbed | FrameLocationContextNotification | FrameLocationContextLauncher;
38
- export type SafeAreaInsets = {
39
- top: number;
40
- bottom: number;
41
- left: number;
42
- right: number;
43
- };
44
- export type FrameContext = {
45
- user: {
46
- fid: number;
47
- username?: string;
48
- displayName?: string;
49
- /**
50
- * Profile image URL
51
- */
52
- pfpUrl?: string;
53
- location?: AccountLocation;
54
- };
55
- location?: FrameLocationContext;
56
- client: {
57
- clientFid: number;
58
- added: boolean;
59
- notificationDetails?: FrameNotificationDetails;
60
- safeAreaInsets?: SafeAreaInsets;
61
- };
62
- };
63
- export type AddFrameRejectedReason = "invalid_domain_manifest" | "rejected_by_user";
64
- export type AddFrameResult = {
65
- added: true;
66
- notificationDetails?: FrameNotificationDetails;
67
- } | {
68
- added: false;
69
- reason: AddFrameRejectedReason;
70
- };
71
- export type AddFrame = () => Promise<AddFrameResult>;
1
+ import type { Address, Provider, RpcRequest, RpcResponse, RpcSchema } from 'ox'
2
+ import type { AddFrame, SignIn } from './actions'
3
+ import type { FrameContext } from './context'
4
+ import type {
5
+ EventFrameAdded,
6
+ EventFrameRemoved,
7
+ EventNotificationsDisabled,
8
+ EventNotificationsEnabled,
9
+ } from './schemas'
10
+ export type SetPrimaryButtonOptions = {
11
+ text: string
12
+ loading?: boolean
13
+ disabled?: boolean
14
+ hidden?: boolean
15
+ }
16
+ export type SetPrimaryButton = (options: SetPrimaryButtonOptions) => void
17
+ export type EthProviderRequest = Provider.RequestFn<RpcSchema.Default>
72
18
  export type ReadyOptions = {
73
- /**
74
- * Disable native gestures. Use this option if your frame uses gestures
75
- * that conflict with native gestures.
76
- *
77
- * @defaultValue false
78
- */
79
- disableNativeGestures: boolean;
80
- };
81
- export declare const DEFAULT_READY_OPTIONS: ReadyOptions;
19
+ /**
20
+ * Disable native gestures. Use this option if your frame uses gestures
21
+ * that conflict with native gestures.
22
+ *
23
+ * @defaultValue false
24
+ */
25
+ disableNativeGestures: boolean
26
+ }
27
+ export declare const DEFAULT_READY_OPTIONS: ReadyOptions
82
28
  export type SignInOptions = {
83
- /**
84
- * A random string used to prevent replay attacks.
85
- */
86
- nonce: string;
87
- /**
88
- * Start time at which the signature becomes valid.
89
- * ISO 8601 datetime.
90
- */
91
- notBefore?: string;
92
- /**
93
- * Expiration time at which the signature is no longer valid.
94
- * ISO 8601 datetime.
95
- */
96
- expirationTime?: string;
97
- };
29
+ /**
30
+ * A random string used to prevent replay attacks.
31
+ */
32
+ nonce: string
33
+ /**
34
+ * Start time at which the signature becomes valid.
35
+ * ISO 8601 datetime.
36
+ */
37
+ notBefore?: string
38
+ /**
39
+ * Expiration time at which the signature is no longer valid.
40
+ * ISO 8601 datetime.
41
+ */
42
+ expirationTime?: string
43
+ }
98
44
  export type WireFrameHost = {
99
- context: FrameContext;
100
- close: () => void;
101
- ready: (options?: Partial<ReadyOptions>) => void;
102
- openUrl: (url: string) => void;
103
- signIn: SignIn.WireSignIn;
104
- setPrimaryButton: SetPrimaryButton;
105
- ethProviderRequest: EthProviderRequest;
106
- ethProviderRequestV2: RpcTransport;
107
- addFrame: AddFrame;
108
- };
45
+ context: FrameContext
46
+ close: () => void
47
+ ready: (options?: Partial<ReadyOptions>) => void
48
+ openUrl: (url: string) => void
49
+ signIn: SignIn.WireSignIn
50
+ setPrimaryButton: SetPrimaryButton
51
+ ethProviderRequest: EthProviderRequest
52
+ ethProviderRequestV2: RpcTransport
53
+ eip6963RequestProvider: () => void
54
+ addFrame: AddFrame.WireAddFrame
55
+ }
109
56
  export type FrameHost = {
110
- context: FrameContext;
111
- close: () => void;
112
- ready: (options?: Partial<ReadyOptions>) => void;
113
- openUrl: (url: string) => void;
114
- signIn: SignIn.SignIn;
115
- setPrimaryButton: SetPrimaryButton;
116
- ethProviderRequest: EthProviderRequest;
117
- ethProviderRequestV2: RpcTransport;
118
- addFrame: AddFrame;
119
- };
57
+ context: FrameContext
58
+ close: () => void
59
+ ready: (options?: Partial<ReadyOptions>) => void
60
+ openUrl: (url: string) => void
61
+ signIn: SignIn.SignIn
62
+ setPrimaryButton: SetPrimaryButton
63
+ ethProviderRequest: EthProviderRequest
64
+ ethProviderRequestV2: RpcTransport
65
+ /**
66
+ * Receive forwarded eip6963:requestProvider events from the frame document.
67
+ * Hosts must emit an EventEip6963AnnounceProvider in response.
68
+ */
69
+ eip6963RequestProvider: () => void
70
+ addFrame: AddFrame.AddFrame
71
+ }
120
72
  export type FrameEthProviderEventData = {
121
- type: "frame_eth_provider_event";
122
- } & EthProviderWireEvent;
123
- export type RpcTransport = (request: RpcRequest.RpcRequest) => Promise<RpcResponse.RpcResponse>;
73
+ type: 'frame_eth_provider_event'
74
+ } & EthProviderWireEvent
75
+ export type RpcTransport = (
76
+ request: RpcRequest.RpcRequest,
77
+ ) => Promise<RpcResponse.RpcResponse>
124
78
  export type ProviderRpcError = {
125
- code: number;
126
- details?: string;
127
- message?: string;
128
- };
129
- export type EthProviderWireEvent = {
130
- event: "accountsChanged";
131
- params: [readonly Address.Address[]];
132
- } | {
133
- event: "chainChanged";
134
- params: [string];
135
- } | {
136
- event: "connect";
137
- params: [Provider.ConnectInfo];
138
- } | {
139
- event: "disconnect";
140
- params: [ProviderRpcError];
141
- } | {
142
- event: "message";
143
- params: [Provider.Message];
144
- };
145
- export type EmitEthProvider = <event extends EthProviderWireEvent["event"]>(event: event, params: Extract<EthProviderWireEvent, {
146
- event: event;
147
- }>["params"]) => void;
79
+ code: number
80
+ details?: string
81
+ message?: string
82
+ }
83
+ export type EthProviderWireEvent =
84
+ | {
85
+ event: 'accountsChanged'
86
+ params: [readonly Address.Address[]]
87
+ }
88
+ | {
89
+ event: 'chainChanged'
90
+ params: [string]
91
+ }
92
+ | {
93
+ event: 'connect'
94
+ params: [Provider.ConnectInfo]
95
+ }
96
+ | {
97
+ event: 'disconnect'
98
+ params: [ProviderRpcError]
99
+ }
100
+ | {
101
+ event: 'message'
102
+ params: [Provider.Message]
103
+ }
104
+ export type EmitEthProvider = <event extends EthProviderWireEvent['event']>(
105
+ event: event,
106
+ params: Extract<
107
+ EthProviderWireEvent,
108
+ {
109
+ event: event
110
+ }
111
+ >['params'],
112
+ ) => void
148
113
  export type EventFrameAddRejected = {
149
- event: "frame_add_rejected";
150
- reason: AddFrameRejectedReason;
151
- };
114
+ event: 'frame_add_rejected'
115
+ reason: AddFrame.AddFrameRejectedReason
116
+ }
152
117
  export type EventPrimaryButtonClicked = {
153
- event: "primary_button_clicked";
154
- };
155
- export type FrameClientEvent = EventFrameAdded | EventFrameAddRejected | EventFrameRemoved | EventNotificationsEnabled | EventNotificationsDisabled | EventPrimaryButtonClicked;
118
+ event: 'primary_button_clicked'
119
+ }
120
+ /**
121
+ * Metadata of the EIP-1193 Provider.
122
+ */
123
+ export interface EIP6963ProviderInfo {
124
+ icon: `data:image/${string}`
125
+ name: string
126
+ rdns: string
127
+ uuid: string
128
+ }
129
+ export type EventEip6963AnnounceProvider = {
130
+ event: 'eip6963:announceProvider'
131
+ info: EIP6963ProviderInfo
132
+ }
133
+ export type FrameClientEvent =
134
+ | EventFrameAdded
135
+ | EventFrameAddRejected
136
+ | EventFrameRemoved
137
+ | EventNotificationsEnabled
138
+ | EventNotificationsDisabled
139
+ | EventPrimaryButtonClicked
140
+ | EventEip6963AnnounceProvider
package/esm/types.js CHANGED
@@ -1,3 +1,3 @@
1
1
  export const DEFAULT_READY_OPTIONS = {
2
- disableNativeGestures: false,
3
- };
2
+ disableNativeGestures: false,
3
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farcaster/frame-core",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "main": "dist/index.js",
5
5
  "module": "esm/index.js",
6
6
  "files": [
@@ -9,13 +9,12 @@
9
9
  "src"
10
10
  ],
11
11
  "devDependencies": {
12
- "tsup": "^8.3.5",
13
- "typescript": "^5.6.3",
12
+ "typescript": "^5.7.2",
14
13
  "@farcaster/tsconfig": "0.0.2"
15
14
  },
16
15
  "dependencies": {
17
- "ox": "^0.4.0",
18
- "zod": "^3.23.8"
16
+ "ox": "^0.4.4",
17
+ "zod": "^3.24.1"
19
18
  },
20
19
  "publishConfig": {
21
20
  "access": "public"
@@ -0,0 +1,51 @@
1
+ import * as Errors from '../errors'
2
+ import type { OneOf } from '../internal/types'
3
+ import type { FrameNotificationDetails } from '../schemas'
4
+
5
+ export type AddFrameResult = {
6
+ notificationDetails?: FrameNotificationDetails
7
+ }
8
+
9
+ export type AddFrame = () => Promise<AddFrameResult>
10
+
11
+ type InvalidDomainManifestJsonError = {
12
+ type: 'invalid_domain_manifest'
13
+ }
14
+
15
+ type RejectedByUserJsonError = {
16
+ type: 'rejected_by_user'
17
+ }
18
+
19
+ export type AddFrameJsonError =
20
+ | InvalidDomainManifestJsonError
21
+ | RejectedByUserJsonError
22
+
23
+ export type AddFrameRejectedReason = AddFrameJsonError['type']
24
+
25
+ export type AddFrameJsonResult = OneOf<
26
+ { result: AddFrameResult } | { error: AddFrameJsonError }
27
+ >
28
+
29
+ export type WireAddFrame = () => Promise<AddFrameJsonResult>
30
+
31
+ /**
32
+ * Thrown when the frame does not have a valid domain manifest.
33
+ */
34
+ export class InvalidDomainManifest extends Errors.BaseError {
35
+ override readonly name = 'AddFrame.InvalidDomainManifest'
36
+
37
+ constructor() {
38
+ super('Invalid domain manifest')
39
+ }
40
+ }
41
+
42
+ /**
43
+ * Thrown when add frame action was rejected by the user.
44
+ */
45
+ export class RejectedByUser extends Errors.BaseError {
46
+ override readonly name = 'AddFrame.RejectedByUser'
47
+
48
+ constructor() {
49
+ super('Add frame rejected by user')
50
+ }
51
+ }
@@ -0,0 +1,51 @@
1
+ import * as Errors from '../errors'
2
+ import type { OneOf } from '../internal/types'
3
+
4
+ export type SignInOptions = {
5
+ /**
6
+ * A random string used to prevent replay attacks.
7
+ */
8
+ nonce: string
9
+
10
+ /**
11
+ * Start time at which the signature becomes valid.
12
+ * ISO 8601 datetime.
13
+ */
14
+ notBefore?: string
15
+
16
+ /**
17
+ * Expiration time at which the signature is no longer valid.
18
+ * ISO 8601 datetime.
19
+ */
20
+ expirationTime?: string
21
+ }
22
+
23
+ export type SignInResult = {
24
+ signature: string
25
+ message: string
26
+ }
27
+
28
+ export type SignIn = (options: SignInOptions) => Promise<SignInResult>
29
+
30
+ type RejectedByUserJsonError = {
31
+ type: 'rejected_by_user'
32
+ }
33
+
34
+ export type SignInJsonError = RejectedByUserJsonError
35
+
36
+ export type SignInJsonResult = OneOf<
37
+ { result: SignInResult } | { error: SignInJsonError }
38
+ >
39
+
40
+ export type WireSignIn = (options: SignInOptions) => Promise<SignInJsonResult>
41
+
42
+ /**
43
+ * Thrown when a sign in action was rejected.
44
+ */
45
+ export class RejectedByUser extends Errors.BaseError {
46
+ override readonly name = 'SignIn.RejectedByUser'
47
+
48
+ constructor() {
49
+ super('Sign in rejected by user')
50
+ }
51
+ }
@@ -0,0 +1,2 @@
1
+ export * as AddFrame from './AddFrame'
2
+ export * as SignIn from './SignIn'
package/src/context.ts ADDED
@@ -0,0 +1,90 @@
1
+ import type { FrameNotificationDetails } from './schemas'
2
+
3
+ export type CastEmbedLocationContext = {
4
+ type: 'cast_embed'
5
+ embed: string
6
+ cast: {
7
+ fid: number
8
+ hash: string
9
+ }
10
+ }
11
+
12
+ export type NotificationLocationContext = {
13
+ type: 'notification'
14
+ notification: {
15
+ notificationId: string
16
+ title: string
17
+ body: string
18
+ }
19
+ }
20
+
21
+ export type LauncherLocationContext = {
22
+ type: 'launcher'
23
+ }
24
+
25
+ export type ChannelLocationContext = {
26
+ type: 'channel'
27
+ channel: {
28
+ /**
29
+ * Channel key identifier
30
+ */
31
+ key: string
32
+
33
+ /**
34
+ * Channel name
35
+ */
36
+ name: string
37
+
38
+ /**
39
+ * Channel profile image URL
40
+ */
41
+ imageUrl?: string
42
+ }
43
+ }
44
+
45
+ export type LocationContext =
46
+ | CastEmbedLocationContext
47
+ | NotificationLocationContext
48
+ | LauncherLocationContext
49
+ | ChannelLocationContext
50
+
51
+ export type AccountLocation = {
52
+ placeId: string
53
+
54
+ /**
55
+ * Human-readable string describing the location
56
+ */
57
+ description: string
58
+ }
59
+
60
+ export type UserContext = {
61
+ fid: number
62
+ username?: string
63
+ displayName?: string
64
+
65
+ /**
66
+ * Profile image URL
67
+ */
68
+ pfpUrl?: string
69
+ location?: AccountLocation
70
+ }
71
+
72
+ export type SafeAreaInsets = {
73
+ top: number
74
+ bottom: number
75
+ left: number
76
+ right: number
77
+ }
78
+
79
+ export type ClientContext = {
80
+ clientFid: number
81
+ added: boolean
82
+ notificationDetails?: FrameNotificationDetails
83
+ safeAreaInsets?: SafeAreaInsets
84
+ }
85
+
86
+ export type FrameContext = {
87
+ client: ClientContext
88
+ user: UserContext
89
+ location?: LocationContext
90
+ }
package/src/errors.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  export class BaseError<
2
- cause extends Error | undefined = undefined
2
+ cause extends Error | undefined = undefined,
3
3
  > extends Error {
4
- override name = "BaseError";
5
- cause: cause;
4
+ override name = 'BaseError'
5
+ cause: cause
6
6
 
7
7
  constructor(message: string, options: BaseError.Options<cause> = {}) {
8
8
  super(message, options.cause ? { cause: options.cause } : undefined)
9
- this.cause = options.cause as any;
9
+ this.cause = options.cause as any
10
10
  }
11
11
  }
12
12
 
package/src/index.ts CHANGED
@@ -1,3 +1,4 @@
1
- export * as SignIn from "./actions/signIn";
2
- export * from "./types";
3
- export * from "./schemas";
1
+ export * from './actions'
2
+ export * as Context from './context'
3
+ export * from './types'
4
+ export * from './schemas'
@@ -1,4 +1,6 @@
1
- export type Compute<type> = { [key in keyof type]: type[key] } & unknown
1
+ type Compute<type> = { [key in keyof type]: type[key] } & unknown
2
+
3
+ type KeyofUnion<type> = type extends type ? keyof type : never
2
4
 
3
5
  export type OneOf<
4
6
  union extends object,
@@ -16,6 +18,3 @@ export type OneOf<
16
18
  }
17
19
  >
18
20
  : never
19
-
20
- export type KeyofUnion<type> = type extends type ? keyof type : never
21
-
@@ -1,35 +1,35 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
  import {
3
- hexColorSchema,
3
+ buttonTitleSchema,
4
4
  frameNameSchema,
5
+ hexColorSchema,
5
6
  secureUrlSchema,
6
- buttonTitleSchema,
7
- } from "./shared";
7
+ } from './shared'
8
8
 
9
9
  export const actionLaunchFrameSchema = z.object({
10
- type: z.literal("launch_frame"),
10
+ type: z.literal('launch_frame'),
11
11
  name: frameNameSchema,
12
12
  url: secureUrlSchema,
13
13
  splashImageUrl: secureUrlSchema.optional(),
14
14
  splashBackgroundColor: hexColorSchema.optional(),
15
- });
15
+ })
16
16
 
17
- export const actionSchema = z.discriminatedUnion("type", [
17
+ export const actionSchema = z.discriminatedUnion('type', [
18
18
  actionLaunchFrameSchema,
19
- ]);
19
+ ])
20
20
 
21
21
  export const buttonSchema = z.object({
22
22
  title: buttonTitleSchema,
23
23
  action: actionSchema,
24
- });
24
+ })
25
25
 
26
26
  export const frameEmbedNextSchema = z.object({
27
- version: z.literal("next"),
27
+ version: z.literal('next'),
28
28
  imageUrl: secureUrlSchema,
29
29
  button: buttonSchema,
30
- });
30
+ })
31
31
 
32
32
  export const safeParseFrameEmbed = (rawResponse: unknown) =>
33
- frameEmbedNextSchema.safeParse(rawResponse);
33
+ frameEmbedNextSchema.safeParse(rawResponse)
34
34
 
35
- export type FrameEmbedNext = z.infer<typeof frameEmbedNextSchema>;
35
+ export type FrameEmbedNext = z.infer<typeof frameEmbedNextSchema>
@@ -1,41 +1,41 @@
1
- import { z } from "zod";
2
- import { notificationDetailsSchema } from "./notifications";
1
+ import { z } from 'zod'
2
+ import { notificationDetailsSchema } from './notifications'
3
3
 
4
4
  export const eventFrameAddedSchema = z.object({
5
- event: z.literal("frame_added"),
5
+ event: z.literal('frame_added'),
6
6
  notificationDetails: notificationDetailsSchema.optional(),
7
- });
7
+ })
8
8
 
9
- export type EventFrameAdded = z.infer<typeof eventFrameAddedSchema>;
9
+ export type EventFrameAdded = z.infer<typeof eventFrameAddedSchema>
10
10
 
11
11
  export const eventFrameRemovedSchema = z.object({
12
- event: z.literal("frame_removed"),
13
- });
12
+ event: z.literal('frame_removed'),
13
+ })
14
14
 
15
- export type EventFrameRemoved = z.infer<typeof eventFrameRemovedSchema>;
15
+ export type EventFrameRemoved = z.infer<typeof eventFrameRemovedSchema>
16
16
 
17
17
  export const eventNotificationsEnabledSchema = z.object({
18
- event: z.literal("notifications_enabled"),
18
+ event: z.literal('notifications_enabled'),
19
19
  notificationDetails: notificationDetailsSchema.required(),
20
- });
20
+ })
21
21
 
22
22
  export type EventNotificationsEnabled = z.infer<
23
23
  typeof eventNotificationsEnabledSchema
24
- >;
24
+ >
25
25
 
26
26
  export const notificationsDisabledSchema = z.object({
27
- event: z.literal("notifications_disabled"),
28
- });
27
+ event: z.literal('notifications_disabled'),
28
+ })
29
29
 
30
30
  export type EventNotificationsDisabled = z.infer<
31
31
  typeof notificationsDisabledSchema
32
- >;
32
+ >
33
33
 
34
- export const serverEventSchema = z.discriminatedUnion("event", [
34
+ export const serverEventSchema = z.discriminatedUnion('event', [
35
35
  eventFrameAddedSchema,
36
36
  eventFrameRemovedSchema,
37
37
  eventNotificationsEnabledSchema,
38
38
  notificationsDisabledSchema,
39
- ]);
39
+ ])
40
40
 
41
- export type FrameServerEvent = z.infer<typeof serverEventSchema>;
41
+ export type FrameServerEvent = z.infer<typeof serverEventSchema>
@@ -1,5 +1,5 @@
1
- export * from "./embeds";
2
- export * from "./events";
3
- export * from "./shared";
4
- export * from "./manifest";
5
- export * from "./notifications";
1
+ export * from './embeds'
2
+ export * from './events'
3
+ export * from './shared'
4
+ export * from './manifest'
5
+ export * from './notifications'