Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
"name": "frontend",
"private": true,
"scripts": {
"predev": "npm run typegen",
"predev": "npm run schema:extract && npm run typegen",
"dev": "next dev --turbopack",
"prebuild": "npm run typegen",
"build": "next build",
"start": "next start",
"lint": "next lint",
"typegen": "sanity typegen generate"
"typegen": "sanity typegen generate",
"schema:extract": "cd ../studio && npm run extract-types"
Copy link

Copilot AI Oct 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script relies on a relative path assumption that may break if the project structure changes. Consider using a more robust approach like defining the studio path as an environment variable or using a package manager workspace feature.

Suggested change
"schema:extract": "cd ../studio && npm run extract-types"
"schema:extract": "cd \"${STUDIO_PATH:-../studio}\" && npm run extract-types"

Copilot uses AI. Check for mistakes.
},
"dependencies": {
"@sanity/client": "^7.6.0",
Expand Down
240 changes: 89 additions & 151 deletions frontend/sanity.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,11 @@ export type Page = {
slug: Slug;
heading: string;
subheading?: string;
pageBuilder?: Array<
| ({
_key: string;
} & CallToAction)
| ({
_key: string;
} & InfoSection)
>;
pageBuilder?: Array<{
_key: string;
} & CallToAction | {
_key: string;
} & InfoSection>;
};

export type Post = {
Expand Down Expand Up @@ -252,21 +249,17 @@ export type SanityAssistInstructionTask = {

export type SanityAssistTaskStatus = {
_type: "sanity.assist.task.status";
tasks?: Array<
{
_key: string;
} & SanityAssistInstructionTask
>;
tasks?: Array<{
_key: string;
} & SanityAssistInstructionTask>;
};

export type SanityAssistSchemaTypeAnnotations = {
_type: "sanity.assist.schemaType.annotations";
title?: string;
fields?: Array<
{
_key: string;
} & SanityAssistSchemaTypeField
>;
fields?: Array<{
_key: string;
} & SanityAssistSchemaTypeField>;
};

export type SanityAssistOutputType = {
Expand Down Expand Up @@ -319,23 +312,18 @@ export type SanityAssistInstructionUserInput = {
};

export type SanityAssistInstructionPrompt = Array<{
children?: Array<
| {
marks?: Array<string>;
text?: string;
_type: "span";
_key: string;
}
| ({
_key: string;
} & SanityAssistInstructionFieldRef)
| ({
_key: string;
} & SanityAssistInstructionContext)
| ({
_key: string;
} & SanityAssistInstructionUserInput)
>;
children?: Array<{
marks?: Array<string>;
text?: string;
_type: "span";
_key: string;
} | {
_key: string;
} & SanityAssistInstructionFieldRef | {
_key: string;
} & SanityAssistInstructionContext | {
_key: string;
} & SanityAssistInstructionUserInput>;
style?: "normal";
listItem?: never;
markDefs?: null;
Expand All @@ -356,24 +344,19 @@ export type SanityAssistInstruction = {
title?: string;
userId?: string;
createdById?: string;
output?: Array<
| ({
_key: string;
} & SanityAssistOutputField)
| ({
_key: string;
} & SanityAssistOutputType)
>;
output?: Array<{
_key: string;
} & SanityAssistOutputField | {
_key: string;
} & SanityAssistOutputType>;
};

export type SanityAssistSchemaTypeField = {
_type: "sanity.assist.schemaType.field";
path?: string;
instructions?: Array<
{
_key: string;
} & SanityAssistInstruction
>;
instructions?: Array<{
_key: string;
} & SanityAssistInstruction>;
};

export type SanityImagePaletteSwatch = {
Expand Down Expand Up @@ -494,38 +477,7 @@ export type SanityAssetSourceData = {
url?: string;
};

export type AllSanitySchemaTypes =
| CallToAction
| Link
| InfoSection
| BlockContent
| Settings
| Page
| Post
| Person
| SanityAssistInstructionTask
| SanityAssistTaskStatus
| SanityAssistSchemaTypeAnnotations
| SanityAssistOutputType
| SanityAssistOutputField
| SanityAssistInstructionContext
| AssistInstructionContext
| SanityAssistInstructionUserInput
| SanityAssistInstructionPrompt
| SanityAssistInstructionFieldRef
| SanityAssistInstruction
| SanityAssistSchemaTypeField
| SanityImagePaletteSwatch
| SanityImagePalette
| SanityImageDimensions
| SanityImageHotspot
| SanityImageCrop
| SanityFileAsset
| SanityImageAsset
| SanityImageMetadata
| Geopoint
| Slug
| SanityAssetSourceData;
export type AllSanitySchemaTypes = CallToAction | Link | InfoSection | BlockContent | Settings | Page | Post | Person | SanityAssistInstructionTask | SanityAssistTaskStatus | SanityAssistSchemaTypeAnnotations | SanityAssistOutputType | SanityAssistOutputField | SanityAssistInstructionContext | AssistInstructionContext | SanityAssistInstructionUserInput | SanityAssistInstructionPrompt | SanityAssistInstructionFieldRef | SanityAssistInstruction | SanityAssistSchemaTypeField | SanityImagePaletteSwatch | SanityImagePalette | SanityImageDimensions | SanityImageHotspot | SanityImageCrop | SanityFileAsset | SanityImageAsset | SanityImageMetadata | Geopoint | Slug | SanityAssetSourceData;
export declare const internalGroqTypeReferenceTo: unique symbol;
// Source: ./sanity/lib/queries.ts
// Variable: settingsQuery
Expand Down Expand Up @@ -593,74 +545,60 @@ export type GetPageQueryResult = {
slug: Slug;
heading: string;
subheading: string | null;
pageBuilder: Array<
| {
_key: string;
_type: "callToAction";
heading: string;
pageBuilder: Array<{
_key: string;
_type: "callToAction";
heading: string;
text?: string;
buttonText?: string;
link: {
_type: "link";
linkType?: "href" | "page" | "post";
href?: string;
page: string | null;
post: string | null;
openInNewTab?: boolean;
} | null;
} | {
_key: string;
_type: "infoSection";
heading?: string;
subheading?: string;
content: Array<{
children?: Array<{
marks?: Array<string>;
text?: string;
buttonText?: string;
link: {
_type: "link";
linkType?: "href" | "page" | "post";
href?: string;
page: string | null;
post: string | null;
openInNewTab?: boolean;
} | null;
}
| {
_type: "span";
_key: string;
_type: "infoSection";
heading?: string;
subheading?: string;
content: Array<{
children?: Array<{
marks?: Array<string>;
text?: string;
_type: "span";
_key: string;
}>;
style?:
| "blockquote"
| "h1"
| "h2"
| "h3"
| "h4"
| "h5"
| "h6"
| "normal";
listItem?: "bullet" | "number";
markDefs: Array<{
linkType?: "href" | "page" | "post";
href?: string;
page: string | null;
post: string | null;
openInNewTab?: boolean;
_type: "link";
_key: string;
}> | null;
level?: number;
_type: "block";
_key: string;
}> | null;
}
> | null;
}>;
style?: "blockquote" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "normal";
listItem?: "bullet" | "number";
markDefs: Array<{
linkType?: "href" | "page" | "post";
href?: string;
page: string | null;
post: string | null;
openInNewTab?: boolean;
_type: "link";
_key: string;
}> | null;
level?: number;
_type: "block";
_key: string;
}> | null;
}> | null;
} | null;
// Variable: sitemapData
// Query: *[_type == "page" || _type == "post" && defined(slug.current)] | order(_type asc) { "slug": slug.current, _type, _updatedAt, }
export type SitemapDataResult = Array<
| {
slug: string;
_type: "page";
_updatedAt: string;
}
| {
slug: string;
_type: "post";
_updatedAt: string;
}
>;
export type SitemapDataResult = Array<{
slug: string;
_type: "page";
_updatedAt: string;
} | {
slug: string;
_type: "post";
_updatedAt: string;
}>;
// Variable: allPostsQuery
// Query: *[_type == "post" && defined(slug.current)] | order(date desc, _updatedAt desc) { _id, "status": select(_originalId in path("drafts.**") => "draft", "published"), "title": coalesce(title, "Untitled"), "slug": slug.current, excerpt, coverImage, "date": coalesce(date, _updatedAt), "author": author->{firstName, lastName, picture}, }
export type AllPostsQueryResult = Array<{
Expand Down Expand Up @@ -818,13 +756,13 @@ export type PagesSlugsResult = Array<{
import "@sanity/client";
declare module "@sanity/client" {
interface SanityQueries {
'*[_type == "settings"][0]': SettingsQueryResult;
'\n *[_type == \'page\' && slug.current == $slug][0]{\n _id,\n _type,\n name,\n slug,\n heading,\n subheading,\n "pageBuilder": pageBuilder[]{\n ...,\n _type == "callToAction" => {\n \n link {\n ...,\n \n _type == "link" => {\n "page": page->slug.current,\n "post": post->slug.current\n }\n\n }\n,\n },\n _type == "infoSection" => {\n content[]{\n ...,\n markDefs[]{\n ...,\n \n _type == "link" => {\n "page": page->slug.current,\n "post": post->slug.current\n }\n\n }\n }\n },\n },\n }\n': GetPageQueryResult;
'\n *[_type == "page" || _type == "post" && defined(slug.current)] | order(_type asc) {\n "slug": slug.current,\n _type,\n _updatedAt,\n }\n': SitemapDataResult;
'\n *[_type == "post" && defined(slug.current)] | order(date desc, _updatedAt desc) {\n \n _id,\n "status": select(_originalId in path("drafts.**") => "draft", "published"),\n "title": coalesce(title, "Untitled"),\n "slug": slug.current,\n excerpt,\n coverImage,\n "date": coalesce(date, _updatedAt),\n "author": author->{firstName, lastName, picture},\n\n }\n': AllPostsQueryResult;
'\n *[_type == "post" && _id != $skip && defined(slug.current)] | order(date desc, _updatedAt desc) [0...$limit] {\n \n _id,\n "status": select(_originalId in path("drafts.**") => "draft", "published"),\n "title": coalesce(title, "Untitled"),\n "slug": slug.current,\n excerpt,\n coverImage,\n "date": coalesce(date, _updatedAt),\n "author": author->{firstName, lastName, picture},\n\n }\n': MorePostsQueryResult;
'\n *[_type == "post" && slug.current == $slug] [0] {\n content[]{\n ...,\n markDefs[]{\n ...,\n \n _type == "link" => {\n "page": page->slug.current,\n "post": post->slug.current\n }\n\n }\n },\n \n _id,\n "status": select(_originalId in path("drafts.**") => "draft", "published"),\n "title": coalesce(title, "Untitled"),\n "slug": slug.current,\n excerpt,\n coverImage,\n "date": coalesce(date, _updatedAt),\n "author": author->{firstName, lastName, picture},\n\n }\n': PostQueryResult;
'\n *[_type == "post" && defined(slug.current)]\n {"slug": slug.current}\n': PostPagesSlugsResult;
'\n *[_type == "page" && defined(slug.current)]\n {"slug": slug.current}\n': PagesSlugsResult;
"*[_type == \"settings\"][0]": SettingsQueryResult;
"\n *[_type == 'page' && slug.current == $slug][0]{\n _id,\n _type,\n name,\n slug,\n heading,\n subheading,\n \"pageBuilder\": pageBuilder[]{\n ...,\n _type == \"callToAction\" => {\n \n link {\n ...,\n \n _type == \"link\" => {\n \"page\": page->slug.current,\n \"post\": post->slug.current\n }\n\n }\n,\n },\n _type == \"infoSection\" => {\n content[]{\n ...,\n markDefs[]{\n ...,\n \n _type == \"link\" => {\n \"page\": page->slug.current,\n \"post\": post->slug.current\n }\n\n }\n }\n },\n },\n }\n": GetPageQueryResult;
"\n *[_type == \"page\" || _type == \"post\" && defined(slug.current)] | order(_type asc) {\n \"slug\": slug.current,\n _type,\n _updatedAt,\n }\n": SitemapDataResult;
"\n *[_type == \"post\" && defined(slug.current)] | order(date desc, _updatedAt desc) {\n \n _id,\n \"status\": select(_originalId in path(\"drafts.**\") => \"draft\", \"published\"),\n \"title\": coalesce(title, \"Untitled\"),\n \"slug\": slug.current,\n excerpt,\n coverImage,\n \"date\": coalesce(date, _updatedAt),\n \"author\": author->{firstName, lastName, picture},\n\n }\n": AllPostsQueryResult;
"\n *[_type == \"post\" && _id != $skip && defined(slug.current)] | order(date desc, _updatedAt desc) [0...$limit] {\n \n _id,\n \"status\": select(_originalId in path(\"drafts.**\") => \"draft\", \"published\"),\n \"title\": coalesce(title, \"Untitled\"),\n \"slug\": slug.current,\n excerpt,\n coverImage,\n \"date\": coalesce(date, _updatedAt),\n \"author\": author->{firstName, lastName, picture},\n\n }\n": MorePostsQueryResult;
"\n *[_type == \"post\" && slug.current == $slug] [0] {\n content[]{\n ...,\n markDefs[]{\n ...,\n \n _type == \"link\" => {\n \"page\": page->slug.current,\n \"post\": post->slug.current\n }\n\n }\n },\n \n _id,\n \"status\": select(_originalId in path(\"drafts.**\") => \"draft\", \"published\"),\n \"title\": coalesce(title, \"Untitled\"),\n \"slug\": slug.current,\n excerpt,\n coverImage,\n \"date\": coalesce(date, _updatedAt),\n \"author\": author->{firstName, lastName, picture},\n\n }\n": PostQueryResult;
"\n *[_type == \"post\" && defined(slug.current)]\n {\"slug\": slug.current}\n": PostPagesSlugsResult;
"\n *[_type == \"page\" && defined(slug.current)]\n {\"slug\": slug.current}\n": PagesSlugsResult;
}
}
Loading