@farcaster/frame-core
Advanced tools
Comparing version
@@ -1,2 +0,2 @@ | ||
import { z } from 'zod'; | ||
import { z } from "zod"; | ||
export declare const actionLaunchFrameSchema: z.ZodObject<{ | ||
@@ -40,3 +40,2 @@ type: z.ZodLiteral<"launch_frame">; | ||
}>]>; | ||
export declare const buttonTitleSchema: z.ZodString; | ||
export declare const buttonSchema: z.ZodObject<{ | ||
@@ -43,0 +42,0 @@ title: z.ZodString; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.safeParseFrameEmbed = exports.frameEmbedNextSchema = exports.buttonSchema = exports.buttonTitleSchema = exports.actionSchema = exports.actionLaunchFrameSchema = void 0; | ||
exports.safeParseFrameEmbed = exports.frameEmbedNextSchema = exports.buttonSchema = exports.actionSchema = exports.actionLaunchFrameSchema = void 0; | ||
const zod_1 = require("zod"); | ||
const shared_1 = require("./shared"); | ||
exports.actionLaunchFrameSchema = zod_1.z.object({ | ||
type: zod_1.z.literal('launch_frame'), | ||
type: zod_1.z.literal("launch_frame"), | ||
name: shared_1.frameNameSchema, | ||
@@ -13,10 +13,11 @@ url: shared_1.secureUrlSchema, | ||
}); | ||
exports.actionSchema = zod_1.z.discriminatedUnion('type', [exports.actionLaunchFrameSchema]); | ||
exports.buttonTitleSchema = zod_1.z.string().max(32); | ||
exports.actionSchema = zod_1.z.discriminatedUnion("type", [ | ||
exports.actionLaunchFrameSchema, | ||
]); | ||
exports.buttonSchema = zod_1.z.object({ | ||
title: exports.buttonTitleSchema, | ||
title: shared_1.buttonTitleSchema, | ||
action: exports.actionSchema, | ||
}); | ||
exports.frameEmbedNextSchema = zod_1.z.object({ | ||
version: zod_1.z.literal('next'), | ||
version: zod_1.z.literal("next"), | ||
imageUrl: shared_1.secureUrlSchema, | ||
@@ -23,0 +24,0 @@ button: exports.buttonSchema, |
@@ -1,2 +0,2 @@ | ||
import { z } from 'zod'; | ||
import { z } from "zod"; | ||
export declare const eventFrameAddedPayloadSchema: z.ZodObject<{ | ||
@@ -3,0 +3,0 @@ event: z.ZodLiteral<"frame_added">; |
@@ -1,2 +0,2 @@ | ||
import { z } from 'zod'; | ||
import { z } from "zod"; | ||
export declare const domainFrameConfigSchema: z.ZodObject<{ | ||
@@ -7,2 +7,4 @@ version: z.ZodUnion<[z.ZodLiteral<"0.0.0">, z.ZodLiteral<"0.0.1">, z.ZodLiteral<"1">]>; | ||
homeUrl: z.ZodString; | ||
imageUrl: z.ZodOptional<z.ZodString>; | ||
buttonTitle: z.ZodOptional<z.ZodString>; | ||
splashImageUrl: z.ZodOptional<z.ZodString>; | ||
@@ -18,2 +20,4 @@ splashBackgroundColor: z.ZodOptional<z.ZodString>; | ||
splashBackgroundColor?: string | undefined; | ||
imageUrl?: string | undefined; | ||
buttonTitle?: string | undefined; | ||
webhookUrl?: string | undefined; | ||
@@ -27,2 +31,4 @@ }, { | ||
splashBackgroundColor?: string | undefined; | ||
imageUrl?: string | undefined; | ||
buttonTitle?: string | undefined; | ||
webhookUrl?: string | undefined; | ||
@@ -49,2 +55,4 @@ }>; | ||
homeUrl: z.ZodString; | ||
imageUrl: z.ZodOptional<z.ZodString>; | ||
buttonTitle: z.ZodOptional<z.ZodString>; | ||
splashImageUrl: z.ZodOptional<z.ZodString>; | ||
@@ -60,2 +68,4 @@ splashBackgroundColor: z.ZodOptional<z.ZodString>; | ||
splashBackgroundColor?: string | undefined; | ||
imageUrl?: string | undefined; | ||
buttonTitle?: string | undefined; | ||
webhookUrl?: string | undefined; | ||
@@ -69,2 +79,4 @@ }, { | ||
splashBackgroundColor?: string | undefined; | ||
imageUrl?: string | undefined; | ||
buttonTitle?: string | undefined; | ||
webhookUrl?: string | undefined; | ||
@@ -85,2 +97,4 @@ }>>; | ||
splashBackgroundColor?: string | undefined; | ||
imageUrl?: string | undefined; | ||
buttonTitle?: string | undefined; | ||
webhookUrl?: string | undefined; | ||
@@ -101,4 +115,6 @@ } | undefined; | ||
splashBackgroundColor?: string | undefined; | ||
imageUrl?: string | undefined; | ||
buttonTitle?: string | undefined; | ||
webhookUrl?: string | undefined; | ||
} | undefined; | ||
}>; |
@@ -9,13 +9,11 @@ "use strict"; | ||
// backwards compatibilty | ||
version: zod_1.z.union([ | ||
zod_1.z.literal('0.0.0'), | ||
zod_1.z.literal('0.0.1'), | ||
zod_1.z.literal('1') | ||
]), | ||
version: zod_1.z.union([zod_1.z.literal("0.0.0"), zod_1.z.literal("0.0.1"), zod_1.z.literal("1")]), | ||
name: shared_1.frameNameSchema, | ||
iconUrl: shared_1.secureUrlSchema, | ||
homeUrl: shared_1.secureUrlSchema, | ||
imageUrl: shared_1.secureUrlSchema.optional(), | ||
buttonTitle: shared_1.buttonTitleSchema.optional(), | ||
splashImageUrl: shared_1.secureUrlSchema.optional(), | ||
splashBackgroundColor: shared_1.hexColorSchema.optional(), | ||
webhookUrl: shared_1.secureUrlSchema.optional() | ||
webhookUrl: shared_1.secureUrlSchema.optional(), | ||
}); | ||
@@ -22,0 +20,0 @@ exports.domainManifestSchema = zod_1.z.object({ |
@@ -1,2 +0,2 @@ | ||
import { z } from 'zod'; | ||
import { z } from "zod"; | ||
export declare const notificationDetailsSchema: z.ZodObject<{ | ||
@@ -3,0 +3,0 @@ url: z.ZodString; |
@@ -1,4 +0,5 @@ | ||
import { z } from 'zod'; | ||
import { z } from "zod"; | ||
export declare const secureUrlSchema: z.ZodString; | ||
export declare const frameNameSchema: z.ZodString; | ||
export declare const buttonTitleSchema: z.ZodString; | ||
export declare const hexColorSchema: z.ZodString; | ||
@@ -5,0 +6,0 @@ export declare const encodedJsonFarcasterSignatureSchema: z.ZodObject<{ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.jsonFarcasterSignatureHeaderSchema = exports.encodedJsonFarcasterSignatureSchema = exports.hexColorSchema = exports.frameNameSchema = exports.secureUrlSchema = void 0; | ||
exports.jsonFarcasterSignatureHeaderSchema = exports.encodedJsonFarcasterSignatureSchema = exports.hexColorSchema = exports.buttonTitleSchema = exports.frameNameSchema = exports.secureUrlSchema = void 0; | ||
const zod_1 = require("zod"); | ||
exports.secureUrlSchema = zod_1.z.string().url().startsWith('https://', { message: 'Must be an https url' }).max(512); | ||
exports.secureUrlSchema = zod_1.z | ||
.string() | ||
.url() | ||
.startsWith("https://", { message: "Must be an https url" }) | ||
.max(512); | ||
exports.frameNameSchema = zod_1.z.string().max(32); | ||
exports.hexColorSchema = zod_1.z.string() | ||
exports.buttonTitleSchema = zod_1.z.string().max(32); | ||
exports.hexColorSchema = zod_1.z | ||
.string() | ||
.regex(/^#([0-9A-F]{3}|[0-9A-F]{6})$/i, { | ||
@@ -9,0 +15,0 @@ message: "Invalid hex color code. It should be in the format #RRGGBB or #RGB.", |
@@ -1,2 +0,2 @@ | ||
import { z } from 'zod'; | ||
import { z } from "zod"; | ||
export declare const actionLaunchFrameSchema: z.ZodObject<{ | ||
@@ -40,3 +40,2 @@ type: z.ZodLiteral<"launch_frame">; | ||
}>]>; | ||
export declare const buttonTitleSchema: z.ZodString; | ||
export declare const buttonSchema: z.ZodObject<{ | ||
@@ -43,0 +42,0 @@ title: z.ZodString; |
@@ -1,5 +0,5 @@ | ||
import { z } from 'zod'; | ||
import { hexColorSchema, frameNameSchema, secureUrlSchema } from './shared'; | ||
import { z } from "zod"; | ||
import { hexColorSchema, frameNameSchema, secureUrlSchema, buttonTitleSchema, } from "./shared"; | ||
export const actionLaunchFrameSchema = z.object({ | ||
type: z.literal('launch_frame'), | ||
type: z.literal("launch_frame"), | ||
name: frameNameSchema, | ||
@@ -10,4 +10,5 @@ url: secureUrlSchema, | ||
}); | ||
export const actionSchema = z.discriminatedUnion('type', [actionLaunchFrameSchema]); | ||
export const buttonTitleSchema = z.string().max(32); | ||
export const actionSchema = z.discriminatedUnion("type", [ | ||
actionLaunchFrameSchema, | ||
]); | ||
export const buttonSchema = z.object({ | ||
@@ -18,3 +19,3 @@ title: buttonTitleSchema, | ||
export const frameEmbedNextSchema = z.object({ | ||
version: z.literal('next'), | ||
version: z.literal("next"), | ||
imageUrl: secureUrlSchema, | ||
@@ -21,0 +22,0 @@ button: buttonSchema, |
@@ -1,2 +0,2 @@ | ||
import { z } from 'zod'; | ||
import { z } from "zod"; | ||
export declare const eventFrameAddedPayloadSchema: z.ZodObject<{ | ||
@@ -3,0 +3,0 @@ event: z.ZodLiteral<"frame_added">; |
@@ -1,3 +0,3 @@ | ||
import { z } from 'zod'; | ||
import { notificationDetailsSchema } from './notifications'; | ||
import { z } from "zod"; | ||
import { notificationDetailsSchema } from "./notifications"; | ||
export const eventFrameAddedPayloadSchema = z.object({ | ||
@@ -4,0 +4,0 @@ event: z.literal("frame_added"), |
@@ -1,2 +0,2 @@ | ||
import { z } from 'zod'; | ||
import { z } from "zod"; | ||
export declare const domainFrameConfigSchema: z.ZodObject<{ | ||
@@ -7,2 +7,4 @@ version: z.ZodUnion<[z.ZodLiteral<"0.0.0">, z.ZodLiteral<"0.0.1">, z.ZodLiteral<"1">]>; | ||
homeUrl: z.ZodString; | ||
imageUrl: z.ZodOptional<z.ZodString>; | ||
buttonTitle: z.ZodOptional<z.ZodString>; | ||
splashImageUrl: z.ZodOptional<z.ZodString>; | ||
@@ -18,2 +20,4 @@ splashBackgroundColor: z.ZodOptional<z.ZodString>; | ||
splashBackgroundColor?: string | undefined; | ||
imageUrl?: string | undefined; | ||
buttonTitle?: string | undefined; | ||
webhookUrl?: string | undefined; | ||
@@ -27,2 +31,4 @@ }, { | ||
splashBackgroundColor?: string | undefined; | ||
imageUrl?: string | undefined; | ||
buttonTitle?: string | undefined; | ||
webhookUrl?: string | undefined; | ||
@@ -49,2 +55,4 @@ }>; | ||
homeUrl: z.ZodString; | ||
imageUrl: z.ZodOptional<z.ZodString>; | ||
buttonTitle: z.ZodOptional<z.ZodString>; | ||
splashImageUrl: z.ZodOptional<z.ZodString>; | ||
@@ -60,2 +68,4 @@ splashBackgroundColor: z.ZodOptional<z.ZodString>; | ||
splashBackgroundColor?: string | undefined; | ||
imageUrl?: string | undefined; | ||
buttonTitle?: string | undefined; | ||
webhookUrl?: string | undefined; | ||
@@ -69,2 +79,4 @@ }, { | ||
splashBackgroundColor?: string | undefined; | ||
imageUrl?: string | undefined; | ||
buttonTitle?: string | undefined; | ||
webhookUrl?: string | undefined; | ||
@@ -85,2 +97,4 @@ }>>; | ||
splashBackgroundColor?: string | undefined; | ||
imageUrl?: string | undefined; | ||
buttonTitle?: string | undefined; | ||
webhookUrl?: string | undefined; | ||
@@ -101,4 +115,6 @@ } | undefined; | ||
splashBackgroundColor?: string | undefined; | ||
imageUrl?: string | undefined; | ||
buttonTitle?: string | undefined; | ||
webhookUrl?: string | undefined; | ||
} | undefined; | ||
}>; |
@@ -1,17 +0,15 @@ | ||
import { z } from 'zod'; | ||
import { secureUrlSchema, frameNameSchema, hexColorSchema, encodedJsonFarcasterSignatureSchema } from './shared'; | ||
import { z } from "zod"; | ||
import { secureUrlSchema, frameNameSchema, hexColorSchema, encodedJsonFarcasterSignatureSchema, buttonTitleSchema, } from "./shared"; | ||
export const domainFrameConfigSchema = z.object({ | ||
// 0.0.0 and 0.0.1 are not technically part of the spec but kept for | ||
// backwards compatibilty | ||
version: z.union([ | ||
z.literal('0.0.0'), | ||
z.literal('0.0.1'), | ||
z.literal('1') | ||
]), | ||
version: z.union([z.literal("0.0.0"), z.literal("0.0.1"), z.literal("1")]), | ||
name: frameNameSchema, | ||
iconUrl: secureUrlSchema, | ||
homeUrl: secureUrlSchema, | ||
imageUrl: secureUrlSchema.optional(), | ||
buttonTitle: buttonTitleSchema.optional(), | ||
splashImageUrl: secureUrlSchema.optional(), | ||
splashBackgroundColor: hexColorSchema.optional(), | ||
webhookUrl: secureUrlSchema.optional() | ||
webhookUrl: secureUrlSchema.optional(), | ||
}); | ||
@@ -18,0 +16,0 @@ export const domainManifestSchema = z.object({ |
@@ -1,2 +0,2 @@ | ||
import { z } from 'zod'; | ||
import { z } from "zod"; | ||
export declare const notificationDetailsSchema: z.ZodObject<{ | ||
@@ -3,0 +3,0 @@ url: z.ZodString; |
@@ -1,3 +0,3 @@ | ||
import { z } from 'zod'; | ||
import { secureUrlSchema } from './shared'; | ||
import { z } from "zod"; | ||
import { secureUrlSchema } from "./shared"; | ||
export const notificationDetailsSchema = z.object({ | ||
@@ -4,0 +4,0 @@ url: z.string(), |
@@ -1,4 +0,5 @@ | ||
import { z } from 'zod'; | ||
import { z } from "zod"; | ||
export declare const secureUrlSchema: z.ZodString; | ||
export declare const frameNameSchema: z.ZodString; | ||
export declare const buttonTitleSchema: z.ZodString; | ||
export declare const hexColorSchema: z.ZodString; | ||
@@ -5,0 +6,0 @@ export declare const encodedJsonFarcasterSignatureSchema: z.ZodObject<{ |
@@ -1,5 +0,11 @@ | ||
import { z } from 'zod'; | ||
export const secureUrlSchema = z.string().url().startsWith('https://', { message: 'Must be an https url' }).max(512); | ||
import { z } from "zod"; | ||
export const secureUrlSchema = z | ||
.string() | ||
.url() | ||
.startsWith("https://", { message: "Must be an https url" }) | ||
.max(512); | ||
export const frameNameSchema = z.string().max(32); | ||
export const hexColorSchema = z.string() | ||
export const buttonTitleSchema = z.string().max(32); | ||
export const hexColorSchema = z | ||
.string() | ||
.regex(/^#([0-9A-F]{3}|[0-9A-F]{6})$/i, { | ||
@@ -6,0 +12,0 @@ message: "Invalid hex color code. It should be in the format #RRGGBB or #RGB.", |
{ | ||
"name": "@farcaster/frame-core", | ||
"version": "0.0.15", | ||
"version": "0.0.16", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "module": "esm/index.js", |
@@ -1,6 +0,11 @@ | ||
import { z } from 'zod'; | ||
import { hexColorSchema, frameNameSchema, secureUrlSchema } from './shared'; | ||
import { z } from "zod"; | ||
import { | ||
hexColorSchema, | ||
frameNameSchema, | ||
secureUrlSchema, | ||
buttonTitleSchema, | ||
} from "./shared"; | ||
export const actionLaunchFrameSchema = z.object({ | ||
type: z.literal('launch_frame'), | ||
type: z.literal("launch_frame"), | ||
name: frameNameSchema, | ||
@@ -12,6 +17,6 @@ url: secureUrlSchema, | ||
export const actionSchema = z.discriminatedUnion('type', [actionLaunchFrameSchema]); | ||
export const actionSchema = z.discriminatedUnion("type", [ | ||
actionLaunchFrameSchema, | ||
]); | ||
export const buttonTitleSchema = z.string().max(32); | ||
export const buttonSchema = z.object({ | ||
@@ -23,3 +28,3 @@ title: buttonTitleSchema, | ||
export const frameEmbedNextSchema = z.object({ | ||
version: z.literal('next'), | ||
version: z.literal("next"), | ||
imageUrl: secureUrlSchema, | ||
@@ -29,4 +34,5 @@ button: buttonSchema, | ||
export const safeParseFrameEmbed = (rawResponse: unknown) => frameEmbedNextSchema.safeParse(rawResponse); | ||
export const safeParseFrameEmbed = (rawResponse: unknown) => | ||
frameEmbedNextSchema.safeParse(rawResponse); | ||
export type FrameEmbedNext = z.infer<typeof frameEmbedNextSchema>; |
@@ -1,3 +0,3 @@ | ||
import { z } from 'zod'; | ||
import { notificationDetailsSchema } from './notifications'; | ||
import { z } from "zod"; | ||
import { notificationDetailsSchema } from "./notifications"; | ||
@@ -46,3 +46,1 @@ export const eventFrameAddedPayloadSchema = z.object({ | ||
export type FrameEvent = z.infer<typeof eventPayloadSchema>; | ||
@@ -1,3 +0,9 @@ | ||
import { z } from 'zod'; | ||
import { secureUrlSchema, frameNameSchema, hexColorSchema, encodedJsonFarcasterSignatureSchema } from './shared'; | ||
import { z } from "zod"; | ||
import { | ||
secureUrlSchema, | ||
frameNameSchema, | ||
hexColorSchema, | ||
encodedJsonFarcasterSignatureSchema, | ||
buttonTitleSchema, | ||
} from "./shared"; | ||
@@ -7,13 +13,11 @@ export const domainFrameConfigSchema = z.object({ | ||
// backwards compatibilty | ||
version: z.union([ | ||
z.literal('0.0.0'), | ||
z.literal('0.0.1'), | ||
z.literal('1') | ||
]), | ||
version: z.union([z.literal("0.0.0"), z.literal("0.0.1"), z.literal("1")]), | ||
name: frameNameSchema, | ||
iconUrl: secureUrlSchema, | ||
homeUrl: secureUrlSchema, | ||
imageUrl: secureUrlSchema.optional(), | ||
buttonTitle: buttonTitleSchema.optional(), | ||
splashImageUrl: secureUrlSchema.optional(), | ||
splashBackgroundColor: hexColorSchema.optional(), | ||
webhookUrl: secureUrlSchema.optional() | ||
webhookUrl: secureUrlSchema.optional(), | ||
}); | ||
@@ -20,0 +24,0 @@ |
@@ -1,3 +0,3 @@ | ||
import { z } from 'zod'; | ||
import { secureUrlSchema } from './shared'; | ||
import { z } from "zod"; | ||
import { secureUrlSchema } from "./shared"; | ||
@@ -4,0 +4,0 @@ export const notificationDetailsSchema = z.object({ |
@@ -1,13 +0,19 @@ | ||
import { z } from 'zod'; | ||
import { z } from "zod"; | ||
export const secureUrlSchema = z.string().url().startsWith('https://', { message: 'Must be an https url' }).max(512); | ||
export const secureUrlSchema = z | ||
.string() | ||
.url() | ||
.startsWith("https://", { message: "Must be an https url" }) | ||
.max(512); | ||
export const frameNameSchema = z.string().max(32); | ||
export const buttonTitleSchema = z.string().max(32); | ||
export const hexColorSchema = z.string() | ||
export const hexColorSchema = z | ||
.string() | ||
.regex(/^#([0-9A-F]{3}|[0-9A-F]{6})$/i, { | ||
message: "Invalid hex color code. It should be in the format #RRGGBB or #RGB.", | ||
message: | ||
"Invalid hex color code. It should be in the format #RRGGBB or #RGB.", | ||
}); | ||
export const encodedJsonFarcasterSignatureSchema = z.object({ | ||
@@ -19,3 +25,5 @@ header: z.string(), | ||
export type EncodedJsonFarcasterSignatureSchema = z.infer<typeof encodedJsonFarcasterSignatureSchema>; | ||
export type EncodedJsonFarcasterSignatureSchema = z.infer< | ||
typeof encodedJsonFarcasterSignatureSchema | ||
>; | ||
@@ -28,2 +36,4 @@ export const jsonFarcasterSignatureHeaderSchema = z.object({ | ||
export type JsonFarcasterSignatureHeaderSchema = z.infer<typeof jsonFarcasterSignatureHeaderSchema>; | ||
export type JsonFarcasterSignatureHeaderSchema = z.infer< | ||
typeof jsonFarcasterSignatureHeaderSchema | ||
>; |
@@ -89,3 +89,3 @@ import type { Address, Provider, RpcRequest, RpcResponse, RpcSchema } from "ox"; | ||
disableNativeGestures: false, | ||
} | ||
}; | ||
@@ -108,3 +108,3 @@ export type FrameHost = { | ||
export type RpcTransport = ( | ||
request: RpcRequest.RpcRequest | ||
request: RpcRequest.RpcRequest, | ||
) => Promise<RpcResponse.RpcResponse>; | ||
@@ -142,3 +142,3 @@ | ||
event: event, | ||
params: Extract<EthProviderWireEvent, { event: event }>["params"] | ||
params: Extract<EthProviderWireEvent, { event: event }>["params"], | ||
) => void; |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
122428
2.26%1817
3.65%1
Infinity%