@farcaster/frame-core 0.0.17 → 0.0.19

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.
@@ -0,0 +1,40 @@
1
+ import * as Errors from '../errors';
2
+ import { OneOf } from '../internal/types';
3
+ export type SignInOptions = {
4
+ /**
5
+ * A random string used to prevent replay attacks.
6
+ */
7
+ nonce: string;
8
+ /**
9
+ * Start time at which the signature becomes valid.
10
+ * ISO 8601 datetime.
11
+ */
12
+ notBefore?: string;
13
+ /**
14
+ * Expiration time at which the signature is no longer valid.
15
+ * ISO 8601 datetime.
16
+ */
17
+ expirationTime?: string;
18
+ };
19
+ export type SignInResult = {
20
+ signature: string;
21
+ message: string;
22
+ };
23
+ export type SignIn = (options: SignInOptions) => Promise<SignInResult>;
24
+ export type RejectedByUserError = {
25
+ type: 'rejected_by_user';
26
+ };
27
+ export type JsonSignInError = RejectedByUserError;
28
+ export type WireSignInResponse = OneOf<{
29
+ result: SignInResult;
30
+ } | {
31
+ error: JsonSignInError;
32
+ }>;
33
+ export type WireSignIn = (options: SignInOptions) => Promise<WireSignInResponse>;
34
+ /**
35
+ * Thrown when a sign in action was rejected.
36
+ */
37
+ export declare class RejectedByUser extends Errors.BaseError {
38
+ readonly name = "SignIn.RejectedByUser";
39
+ constructor();
40
+ }
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.RejectedByUser = void 0;
37
+ const Errors = __importStar(require("../errors"));
38
+ /**
39
+ * Thrown when a sign in action was rejected.
40
+ */
41
+ class RejectedByUser extends Errors.BaseError {
42
+ name = 'SignIn.RejectedByUser';
43
+ constructor() {
44
+ super("Sign in rejected by user");
45
+ }
46
+ }
47
+ exports.RejectedByUser = RejectedByUser;
@@ -0,0 +1,10 @@
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>);
5
+ }
6
+ export declare namespace BaseError {
7
+ type Options<cause extends Error | undefined = Error | undefined> = {
8
+ cause?: cause | undefined;
9
+ };
10
+ }
package/dist/errors.js ADDED
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseError = void 0;
4
+ class BaseError extends Error {
5
+ name = "BaseError";
6
+ cause;
7
+ constructor(message, options = {}) {
8
+ super(message, options.cause ? { cause: options.cause } : undefined);
9
+ this.cause = options.cause;
10
+ }
11
+ }
12
+ exports.BaseError = BaseError;
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
+ export * as SignIn from "./actions/signIn";
1
2
  export * from "./types";
2
3
  export * from "./schemas";
package/dist/index.js CHANGED
@@ -10,9 +10,33 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
10
10
  if (k2 === undefined) k2 = k;
11
11
  o[k2] = m[k];
12
12
  }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
13
35
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
36
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
37
  };
16
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.SignIn = void 0;
40
+ exports.SignIn = __importStar(require("./actions/signIn"));
17
41
  __exportStar(require("./types"), exports);
18
42
  __exportStar(require("./schemas"), exports);
@@ -0,0 +1,7 @@
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;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- export declare const eventFrameAddedPayloadSchema: z.ZodObject<{
2
+ export declare const eventFrameAddedSchema: z.ZodObject<{
3
3
  event: z.ZodLiteral<"frame_added">;
4
4
  notificationDetails: z.ZodOptional<z.ZodObject<{
5
5
  url: z.ZodString;
@@ -24,16 +24,16 @@ export declare const eventFrameAddedPayloadSchema: z.ZodObject<{
24
24
  token: string;
25
25
  } | undefined;
26
26
  }>;
27
- export type EventFrameAddedPayload = z.infer<typeof eventFrameAddedPayloadSchema>;
28
- export declare const eventFrameRemovedPayloadSchema: z.ZodObject<{
27
+ export type EventFrameAdded = z.infer<typeof eventFrameAddedSchema>;
28
+ export declare const eventFrameRemovedSchema: z.ZodObject<{
29
29
  event: z.ZodLiteral<"frame_removed">;
30
30
  }, "strip", z.ZodTypeAny, {
31
31
  event: "frame_removed";
32
32
  }, {
33
33
  event: "frame_removed";
34
34
  }>;
35
- export type EventFrameRemovedPayload = z.infer<typeof eventFrameRemovedPayloadSchema>;
36
- export declare const eventNotificationsEnabledPayloadSchema: z.ZodObject<{
35
+ export type EventFrameRemoved = z.infer<typeof eventFrameRemovedSchema>;
36
+ export declare const eventNotificationsEnabledSchema: z.ZodObject<{
37
37
  event: z.ZodLiteral<"notifications_enabled">;
38
38
  notificationDetails: z.ZodObject<{
39
39
  url: z.ZodString;
@@ -58,16 +58,16 @@ export declare const eventNotificationsEnabledPayloadSchema: z.ZodObject<{
58
58
  token: string;
59
59
  };
60
60
  }>;
61
- export type EventNotificationsEnabledPayload = z.infer<typeof eventNotificationsEnabledPayloadSchema>;
62
- export declare const notificationsDisabledPayloadSchema: z.ZodObject<{
61
+ export type EventNotificationsEnabled = z.infer<typeof eventNotificationsEnabledSchema>;
62
+ export declare const notificationsDisabledSchema: z.ZodObject<{
63
63
  event: z.ZodLiteral<"notifications_disabled">;
64
64
  }, "strip", z.ZodTypeAny, {
65
65
  event: "notifications_disabled";
66
66
  }, {
67
67
  event: "notifications_disabled";
68
68
  }>;
69
- export type EventNotificationsDisabledPayload = z.infer<typeof notificationsDisabledPayloadSchema>;
70
- export declare const eventPayloadSchema: z.ZodDiscriminatedUnion<"event", [z.ZodObject<{
69
+ export type EventNotificationsDisabled = z.infer<typeof notificationsDisabledSchema>;
70
+ export declare const serverEventSchema: z.ZodDiscriminatedUnion<"event", [z.ZodObject<{
71
71
  event: z.ZodLiteral<"frame_added">;
72
72
  notificationDetails: z.ZodOptional<z.ZodObject<{
73
73
  url: z.ZodString;
@@ -128,4 +128,4 @@ export declare const eventPayloadSchema: z.ZodDiscriminatedUnion<"event", [z.Zod
128
128
  }, {
129
129
  event: "notifications_disabled";
130
130
  }>]>;
131
- export type FrameEvent = z.infer<typeof eventPayloadSchema>;
131
+ export type FrameServerEvent = z.infer<typeof serverEventSchema>;
@@ -1,25 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.eventPayloadSchema = exports.notificationsDisabledPayloadSchema = exports.eventNotificationsEnabledPayloadSchema = exports.eventFrameRemovedPayloadSchema = exports.eventFrameAddedPayloadSchema = void 0;
3
+ exports.serverEventSchema = exports.notificationsDisabledSchema = exports.eventNotificationsEnabledSchema = exports.eventFrameRemovedSchema = exports.eventFrameAddedSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const notifications_1 = require("./notifications");
6
- exports.eventFrameAddedPayloadSchema = zod_1.z.object({
6
+ exports.eventFrameAddedSchema = zod_1.z.object({
7
7
  event: zod_1.z.literal("frame_added"),
8
8
  notificationDetails: notifications_1.notificationDetailsSchema.optional(),
9
9
  });
10
- exports.eventFrameRemovedPayloadSchema = zod_1.z.object({
10
+ exports.eventFrameRemovedSchema = zod_1.z.object({
11
11
  event: zod_1.z.literal("frame_removed"),
12
12
  });
13
- exports.eventNotificationsEnabledPayloadSchema = zod_1.z.object({
13
+ exports.eventNotificationsEnabledSchema = zod_1.z.object({
14
14
  event: zod_1.z.literal("notifications_enabled"),
15
15
  notificationDetails: notifications_1.notificationDetailsSchema.required(),
16
16
  });
17
- exports.notificationsDisabledPayloadSchema = zod_1.z.object({
17
+ exports.notificationsDisabledSchema = zod_1.z.object({
18
18
  event: zod_1.z.literal("notifications_disabled"),
19
19
  });
20
- exports.eventPayloadSchema = zod_1.z.discriminatedUnion("event", [
21
- exports.eventFrameAddedPayloadSchema,
22
- exports.eventFrameRemovedPayloadSchema,
23
- exports.eventNotificationsEnabledPayloadSchema,
24
- exports.notificationsDisabledPayloadSchema,
20
+ exports.serverEventSchema = zod_1.z.discriminatedUnion("event", [
21
+ exports.eventFrameAddedSchema,
22
+ exports.eventFrameRemovedSchema,
23
+ exports.eventNotificationsEnabledSchema,
24
+ exports.notificationsDisabledSchema,
25
25
  ]);
package/dist/types.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { Address, Provider, RpcRequest, RpcResponse, RpcSchema } from "ox";
2
- import { FrameNotificationDetails } from "./schemas";
2
+ import { FrameNotificationDetails, EventFrameAdded, EventFrameRemoved, EventNotificationsEnabled, EventNotificationsDisabled } from "./schemas";
3
+ import * as SignIn from "./actions/signIn";
3
4
  export type SetPrimaryButton = (options: {
4
5
  text: string;
5
6
  loading?: boolean;
@@ -42,6 +43,7 @@ export type FrameContext = {
42
43
  * Profile image URL
43
44
  */
44
45
  pfpUrl?: string;
46
+ location?: AccountLocation;
45
47
  };
46
48
  location?: FrameLocationContext;
47
49
  client: {
@@ -50,12 +52,13 @@ export type FrameContext = {
50
52
  notificationDetails?: FrameNotificationDetails;
51
53
  };
52
54
  };
55
+ export type AddFrameRejectedReason = "invalid_domain_manifest" | "rejected_by_user";
53
56
  export type AddFrameResult = {
54
57
  added: true;
55
58
  notificationDetails?: FrameNotificationDetails;
56
59
  } | {
57
60
  added: false;
58
- reason: "invalid_domain_manifest" | "rejected_by_user";
61
+ reason: AddFrameRejectedReason;
59
62
  };
60
63
  export type AddFrame = () => Promise<AddFrameResult>;
61
64
  export type ReadyOptions = {
@@ -68,11 +71,39 @@ export type ReadyOptions = {
68
71
  disableNativeGestures: boolean;
69
72
  };
70
73
  export declare const DEFAULT_READY_OPTIONS: ReadyOptions;
74
+ export type SignInOptions = {
75
+ /**
76
+ * A random string used to prevent replay attacks.
77
+ */
78
+ nonce: string;
79
+ /**
80
+ * Start time at which the signature becomes valid.
81
+ * ISO 8601 datetime.
82
+ */
83
+ notBefore?: string;
84
+ /**
85
+ * Expiration time at which the signature is no longer valid.
86
+ * ISO 8601 datetime.
87
+ */
88
+ expirationTime?: string;
89
+ };
90
+ export type WireFrameHost = {
91
+ context: FrameContext;
92
+ close: () => void;
93
+ ready: (options?: Partial<ReadyOptions>) => void;
94
+ openUrl: (url: string) => void;
95
+ signIn: SignIn.WireSignIn;
96
+ setPrimaryButton: SetPrimaryButton;
97
+ ethProviderRequest: EthProviderRequest;
98
+ ethProviderRequestV2: RpcTransport;
99
+ addFrame: AddFrame;
100
+ };
71
101
  export type FrameHost = {
72
102
  context: FrameContext;
73
103
  close: () => void;
74
104
  ready: (options?: Partial<ReadyOptions>) => void;
75
105
  openUrl: (url: string) => void;
106
+ signIn: SignIn.SignIn;
76
107
  setPrimaryButton: SetPrimaryButton;
77
108
  ethProviderRequest: EthProviderRequest;
78
109
  ethProviderRequestV2: RpcTransport;
@@ -106,3 +137,11 @@ export type EthProviderWireEvent = {
106
137
  export type EmitEthProvider = <event extends EthProviderWireEvent["event"]>(event: event, params: Extract<EthProviderWireEvent, {
107
138
  event: event;
108
139
  }>["params"]) => void;
140
+ export type EventFrameAddRejected = {
141
+ event: "frame_add_rejected";
142
+ reason: AddFrameRejectedReason;
143
+ };
144
+ export type EventPrimaryButtonClicked = {
145
+ event: "primary_button_clicked";
146
+ };
147
+ export type FrameClientEvent = EventFrameAdded | EventFrameAddRejected | EventFrameRemoved | EventNotificationsEnabled | EventNotificationsDisabled | EventPrimaryButtonClicked;
@@ -0,0 +1,40 @@
1
+ import * as Errors from '../errors';
2
+ import { OneOf } from '../internal/types';
3
+ export type SignInOptions = {
4
+ /**
5
+ * A random string used to prevent replay attacks.
6
+ */
7
+ nonce: string;
8
+ /**
9
+ * Start time at which the signature becomes valid.
10
+ * ISO 8601 datetime.
11
+ */
12
+ notBefore?: string;
13
+ /**
14
+ * Expiration time at which the signature is no longer valid.
15
+ * ISO 8601 datetime.
16
+ */
17
+ expirationTime?: string;
18
+ };
19
+ export type SignInResult = {
20
+ signature: string;
21
+ message: string;
22
+ };
23
+ export type SignIn = (options: SignInOptions) => Promise<SignInResult>;
24
+ export type RejectedByUserError = {
25
+ type: 'rejected_by_user';
26
+ };
27
+ export type JsonSignInError = RejectedByUserError;
28
+ export type WireSignInResponse = OneOf<{
29
+ result: SignInResult;
30
+ } | {
31
+ error: JsonSignInError;
32
+ }>;
33
+ export type WireSignIn = (options: SignInOptions) => Promise<WireSignInResponse>;
34
+ /**
35
+ * Thrown when a sign in action was rejected.
36
+ */
37
+ export declare class RejectedByUser extends Errors.BaseError {
38
+ readonly name = "SignIn.RejectedByUser";
39
+ constructor();
40
+ }
@@ -0,0 +1,10 @@
1
+ import * as Errors from '../errors';
2
+ /**
3
+ * Thrown when a sign in action was rejected.
4
+ */
5
+ export class RejectedByUser extends Errors.BaseError {
6
+ name = 'SignIn.RejectedByUser';
7
+ constructor() {
8
+ super("Sign in rejected by user");
9
+ }
10
+ }
@@ -0,0 +1,10 @@
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>);
5
+ }
6
+ export declare namespace BaseError {
7
+ type Options<cause extends Error | undefined = Error | undefined> = {
8
+ cause?: cause | undefined;
9
+ };
10
+ }
package/esm/errors.js ADDED
@@ -0,0 +1,8 @@
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
+ }
8
+ }
package/esm/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
+ export * as SignIn from "./actions/signIn";
1
2
  export * from "./types";
2
3
  export * from "./schemas";
package/esm/index.js CHANGED
@@ -1,2 +1,3 @@
1
+ export * as SignIn from "./actions/signIn";
1
2
  export * from "./types";
2
3
  export * from "./schemas";
@@ -0,0 +1,7 @@
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;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- export declare const eventFrameAddedPayloadSchema: z.ZodObject<{
2
+ export declare const eventFrameAddedSchema: z.ZodObject<{
3
3
  event: z.ZodLiteral<"frame_added">;
4
4
  notificationDetails: z.ZodOptional<z.ZodObject<{
5
5
  url: z.ZodString;
@@ -24,16 +24,16 @@ export declare const eventFrameAddedPayloadSchema: z.ZodObject<{
24
24
  token: string;
25
25
  } | undefined;
26
26
  }>;
27
- export type EventFrameAddedPayload = z.infer<typeof eventFrameAddedPayloadSchema>;
28
- export declare const eventFrameRemovedPayloadSchema: z.ZodObject<{
27
+ export type EventFrameAdded = z.infer<typeof eventFrameAddedSchema>;
28
+ export declare const eventFrameRemovedSchema: z.ZodObject<{
29
29
  event: z.ZodLiteral<"frame_removed">;
30
30
  }, "strip", z.ZodTypeAny, {
31
31
  event: "frame_removed";
32
32
  }, {
33
33
  event: "frame_removed";
34
34
  }>;
35
- export type EventFrameRemovedPayload = z.infer<typeof eventFrameRemovedPayloadSchema>;
36
- export declare const eventNotificationsEnabledPayloadSchema: z.ZodObject<{
35
+ export type EventFrameRemoved = z.infer<typeof eventFrameRemovedSchema>;
36
+ export declare const eventNotificationsEnabledSchema: z.ZodObject<{
37
37
  event: z.ZodLiteral<"notifications_enabled">;
38
38
  notificationDetails: z.ZodObject<{
39
39
  url: z.ZodString;
@@ -58,16 +58,16 @@ export declare const eventNotificationsEnabledPayloadSchema: z.ZodObject<{
58
58
  token: string;
59
59
  };
60
60
  }>;
61
- export type EventNotificationsEnabledPayload = z.infer<typeof eventNotificationsEnabledPayloadSchema>;
62
- export declare const notificationsDisabledPayloadSchema: z.ZodObject<{
61
+ export type EventNotificationsEnabled = z.infer<typeof eventNotificationsEnabledSchema>;
62
+ export declare const notificationsDisabledSchema: z.ZodObject<{
63
63
  event: z.ZodLiteral<"notifications_disabled">;
64
64
  }, "strip", z.ZodTypeAny, {
65
65
  event: "notifications_disabled";
66
66
  }, {
67
67
  event: "notifications_disabled";
68
68
  }>;
69
- export type EventNotificationsDisabledPayload = z.infer<typeof notificationsDisabledPayloadSchema>;
70
- export declare const eventPayloadSchema: z.ZodDiscriminatedUnion<"event", [z.ZodObject<{
69
+ export type EventNotificationsDisabled = z.infer<typeof notificationsDisabledSchema>;
70
+ export declare const serverEventSchema: z.ZodDiscriminatedUnion<"event", [z.ZodObject<{
71
71
  event: z.ZodLiteral<"frame_added">;
72
72
  notificationDetails: z.ZodOptional<z.ZodObject<{
73
73
  url: z.ZodString;
@@ -128,4 +128,4 @@ export declare const eventPayloadSchema: z.ZodDiscriminatedUnion<"event", [z.Zod
128
128
  }, {
129
129
  event: "notifications_disabled";
130
130
  }>]>;
131
- export type FrameEvent = z.infer<typeof eventPayloadSchema>;
131
+ export type FrameServerEvent = z.infer<typeof serverEventSchema>;
@@ -1,22 +1,22 @@
1
1
  import { z } from "zod";
2
2
  import { notificationDetailsSchema } from "./notifications";
3
- export const eventFrameAddedPayloadSchema = z.object({
3
+ export const eventFrameAddedSchema = z.object({
4
4
  event: z.literal("frame_added"),
5
5
  notificationDetails: notificationDetailsSchema.optional(),
6
6
  });
7
- export const eventFrameRemovedPayloadSchema = z.object({
7
+ export const eventFrameRemovedSchema = z.object({
8
8
  event: z.literal("frame_removed"),
9
9
  });
10
- export const eventNotificationsEnabledPayloadSchema = z.object({
10
+ export const eventNotificationsEnabledSchema = z.object({
11
11
  event: z.literal("notifications_enabled"),
12
12
  notificationDetails: notificationDetailsSchema.required(),
13
13
  });
14
- export const notificationsDisabledPayloadSchema = z.object({
14
+ export const notificationsDisabledSchema = z.object({
15
15
  event: z.literal("notifications_disabled"),
16
16
  });
17
- export const eventPayloadSchema = z.discriminatedUnion("event", [
18
- eventFrameAddedPayloadSchema,
19
- eventFrameRemovedPayloadSchema,
20
- eventNotificationsEnabledPayloadSchema,
21
- notificationsDisabledPayloadSchema,
17
+ export const serverEventSchema = z.discriminatedUnion("event", [
18
+ eventFrameAddedSchema,
19
+ eventFrameRemovedSchema,
20
+ eventNotificationsEnabledSchema,
21
+ notificationsDisabledSchema,
22
22
  ]);