From 819a1d62db2abcfd9731fa8cd272462282b60c42 Mon Sep 17 00:00:00 2001 From: "ecospark[bot]" <128108030+ecospark[bot]@users.noreply.github.com> Date: Thu, 21 Nov 2024 03:03:59 +0100 Subject: [PATCH] =?UTF-8?q?chore(typegen):=20=F0=9F=A4=96=20=E2=9C=A8=20(#?= =?UTF-8?q?10)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: ecospark[bot] <128108030+ecospark[bot]@users.noreply.github.com> --- studio/schema.json | 798 +++++++++++++++++++++++++++++++++ tanstack-start/sanity.types.ts | 196 ++++++++ 2 files changed, 994 insertions(+) create mode 100644 studio/schema.json create mode 100644 tanstack-start/sanity.types.ts diff --git a/studio/schema.json b/studio/schema.json new file mode 100644 index 0000000..07cd06a --- /dev/null +++ b/studio/schema.json @@ -0,0 +1,798 @@ +[ + { + "name": "sanity.imagePaletteSwatch", + "type": "type", + "value": { + "type": "object", + "attributes": { + "_type": { + "type": "objectAttribute", + "value": { + "type": "string", + "value": "sanity.imagePaletteSwatch" + } + }, + "background": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + }, + "foreground": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + }, + "population": { + "type": "objectAttribute", + "value": { + "type": "number" + }, + "optional": true + }, + "title": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + } + } + } + }, + { + "name": "sanity.imagePalette", + "type": "type", + "value": { + "type": "object", + "attributes": { + "_type": { + "type": "objectAttribute", + "value": { + "type": "string", + "value": "sanity.imagePalette" + } + }, + "darkMuted": { + "type": "objectAttribute", + "value": { + "type": "inline", + "name": "sanity.imagePaletteSwatch" + }, + "optional": true + }, + "lightVibrant": { + "type": "objectAttribute", + "value": { + "type": "inline", + "name": "sanity.imagePaletteSwatch" + }, + "optional": true + }, + "darkVibrant": { + "type": "objectAttribute", + "value": { + "type": "inline", + "name": "sanity.imagePaletteSwatch" + }, + "optional": true + }, + "vibrant": { + "type": "objectAttribute", + "value": { + "type": "inline", + "name": "sanity.imagePaletteSwatch" + }, + "optional": true + }, + "dominant": { + "type": "objectAttribute", + "value": { + "type": "inline", + "name": "sanity.imagePaletteSwatch" + }, + "optional": true + }, + "lightMuted": { + "type": "objectAttribute", + "value": { + "type": "inline", + "name": "sanity.imagePaletteSwatch" + }, + "optional": true + }, + "muted": { + "type": "objectAttribute", + "value": { + "type": "inline", + "name": "sanity.imagePaletteSwatch" + }, + "optional": true + } + } + } + }, + { + "name": "sanity.imageDimensions", + "type": "type", + "value": { + "type": "object", + "attributes": { + "_type": { + "type": "objectAttribute", + "value": { + "type": "string", + "value": "sanity.imageDimensions" + } + }, + "height": { + "type": "objectAttribute", + "value": { + "type": "number" + }, + "optional": true + }, + "width": { + "type": "objectAttribute", + "value": { + "type": "number" + }, + "optional": true + }, + "aspectRatio": { + "type": "objectAttribute", + "value": { + "type": "number" + }, + "optional": true + } + } + } + }, + { + "name": "sanity.imageHotspot", + "type": "type", + "value": { + "type": "object", + "attributes": { + "_type": { + "type": "objectAttribute", + "value": { + "type": "string", + "value": "sanity.imageHotspot" + } + }, + "x": { + "type": "objectAttribute", + "value": { + "type": "number" + }, + "optional": true + }, + "y": { + "type": "objectAttribute", + "value": { + "type": "number" + }, + "optional": true + }, + "height": { + "type": "objectAttribute", + "value": { + "type": "number" + }, + "optional": true + }, + "width": { + "type": "objectAttribute", + "value": { + "type": "number" + }, + "optional": true + } + } + } + }, + { + "name": "sanity.imageCrop", + "type": "type", + "value": { + "type": "object", + "attributes": { + "_type": { + "type": "objectAttribute", + "value": { + "type": "string", + "value": "sanity.imageCrop" + } + }, + "top": { + "type": "objectAttribute", + "value": { + "type": "number" + }, + "optional": true + }, + "bottom": { + "type": "objectAttribute", + "value": { + "type": "number" + }, + "optional": true + }, + "left": { + "type": "objectAttribute", + "value": { + "type": "number" + }, + "optional": true + }, + "right": { + "type": "objectAttribute", + "value": { + "type": "number" + }, + "optional": true + } + } + } + }, + { + "name": "sanity.fileAsset", + "type": "document", + "attributes": { + "_id": { + "type": "objectAttribute", + "value": { + "type": "string" + } + }, + "_type": { + "type": "objectAttribute", + "value": { + "type": "string", + "value": "sanity.fileAsset" + } + }, + "_createdAt": { + "type": "objectAttribute", + "value": { + "type": "string" + } + }, + "_updatedAt": { + "type": "objectAttribute", + "value": { + "type": "string" + } + }, + "_rev": { + "type": "objectAttribute", + "value": { + "type": "string" + } + }, + "originalFilename": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + }, + "label": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + }, + "title": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + }, + "description": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + }, + "altText": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + }, + "sha1hash": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + }, + "extension": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + }, + "mimeType": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + }, + "size": { + "type": "objectAttribute", + "value": { + "type": "number" + }, + "optional": true + }, + "assetId": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + }, + "uploadId": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + }, + "path": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + }, + "url": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + }, + "source": { + "type": "objectAttribute", + "value": { + "type": "inline", + "name": "sanity.assetSourceData" + }, + "optional": true + } + } + }, + { + "name": "sanity.imageAsset", + "type": "document", + "attributes": { + "_id": { + "type": "objectAttribute", + "value": { + "type": "string" + } + }, + "_type": { + "type": "objectAttribute", + "value": { + "type": "string", + "value": "sanity.imageAsset" + } + }, + "_createdAt": { + "type": "objectAttribute", + "value": { + "type": "string" + } + }, + "_updatedAt": { + "type": "objectAttribute", + "value": { + "type": "string" + } + }, + "_rev": { + "type": "objectAttribute", + "value": { + "type": "string" + } + }, + "originalFilename": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + }, + "label": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + }, + "title": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + }, + "description": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + }, + "altText": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + }, + "sha1hash": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + }, + "extension": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + }, + "mimeType": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + }, + "size": { + "type": "objectAttribute", + "value": { + "type": "number" + }, + "optional": true + }, + "assetId": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + }, + "uploadId": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + }, + "path": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + }, + "url": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + }, + "metadata": { + "type": "objectAttribute", + "value": { + "type": "inline", + "name": "sanity.imageMetadata" + }, + "optional": true + }, + "source": { + "type": "objectAttribute", + "value": { + "type": "inline", + "name": "sanity.assetSourceData" + }, + "optional": true + } + } + }, + { + "name": "sanity.imageMetadata", + "type": "type", + "value": { + "type": "object", + "attributes": { + "_type": { + "type": "objectAttribute", + "value": { + "type": "string", + "value": "sanity.imageMetadata" + } + }, + "location": { + "type": "objectAttribute", + "value": { + "type": "inline", + "name": "geopoint" + }, + "optional": true + }, + "dimensions": { + "type": "objectAttribute", + "value": { + "type": "inline", + "name": "sanity.imageDimensions" + }, + "optional": true + }, + "palette": { + "type": "objectAttribute", + "value": { + "type": "inline", + "name": "sanity.imagePalette" + }, + "optional": true + }, + "lqip": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + }, + "blurHash": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + }, + "hasAlpha": { + "type": "objectAttribute", + "value": { + "type": "boolean" + }, + "optional": true + }, + "isOpaque": { + "type": "objectAttribute", + "value": { + "type": "boolean" + }, + "optional": true + } + } + } + }, + { + "name": "geopoint", + "type": "type", + "value": { + "type": "object", + "attributes": { + "_type": { + "type": "objectAttribute", + "value": { + "type": "string", + "value": "geopoint" + } + }, + "lat": { + "type": "objectAttribute", + "value": { + "type": "number" + }, + "optional": true + }, + "lng": { + "type": "objectAttribute", + "value": { + "type": "number" + }, + "optional": true + }, + "alt": { + "type": "objectAttribute", + "value": { + "type": "number" + }, + "optional": true + } + } + } + }, + { + "name": "sanity.assetSourceData", + "type": "type", + "value": { + "type": "object", + "attributes": { + "_type": { + "type": "objectAttribute", + "value": { + "type": "string", + "value": "sanity.assetSourceData" + } + }, + "name": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + }, + "id": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + }, + "url": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + } + } + } + }, + { + "name": "demo", + "type": "document", + "attributes": { + "_id": { + "type": "objectAttribute", + "value": { + "type": "string" + } + }, + "_type": { + "type": "objectAttribute", + "value": { + "type": "string", + "value": "demo" + } + }, + "_createdAt": { + "type": "objectAttribute", + "value": { + "type": "string" + } + }, + "_updatedAt": { + "type": "objectAttribute", + "value": { + "type": "string" + } + }, + "_rev": { + "type": "objectAttribute", + "value": { + "type": "string" + } + }, + "title": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + }, + "slug": { + "type": "objectAttribute", + "value": { + "type": "inline", + "name": "slug" + }, + "optional": true + } + } + }, + { + "name": "slug", + "type": "type", + "value": { + "type": "object", + "attributes": { + "_type": { + "type": "objectAttribute", + "value": { + "type": "string", + "value": "slug" + } + }, + "current": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + }, + "source": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + } + } + } + }, + { + "name": "theme", + "type": "document", + "attributes": { + "_id": { + "type": "objectAttribute", + "value": { + "type": "string" + } + }, + "_type": { + "type": "objectAttribute", + "value": { + "type": "string", + "value": "theme" + } + }, + "_createdAt": { + "type": "objectAttribute", + "value": { + "type": "string" + } + }, + "_updatedAt": { + "type": "objectAttribute", + "value": { + "type": "string" + } + }, + "_rev": { + "type": "objectAttribute", + "value": { + "type": "string" + } + }, + "background": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + }, + "text": { + "type": "objectAttribute", + "value": { + "type": "string" + }, + "optional": true + } + } + } +] diff --git a/tanstack-start/sanity.types.ts b/tanstack-start/sanity.types.ts new file mode 100644 index 0000000..5437447 --- /dev/null +++ b/tanstack-start/sanity.types.ts @@ -0,0 +1,196 @@ +// Query TypeMap +import '@sanity/client' + +/** + * --------------------------------------------------------------------------------- + * This file has been generated by Sanity TypeGen. + * Command: `sanity typegen generate` + * + * Any modifications made directly to this file will be overwritten the next time + * the TypeScript definitions are generated. Please make changes to the Sanity + * schema definitions and/or GROQ queries if you need to update these types. + * + * For more information on how to use Sanity TypeGen, visit the official documentation: + * https://www.sanity.io/docs/sanity-typegen + * --------------------------------------------------------------------------------- + */ + +// Source: schema.json +export type SanityImagePaletteSwatch = { + _type: 'sanity.imagePaletteSwatch' + background?: string + foreground?: string + population?: number + title?: string +} + +export type SanityImagePalette = { + _type: 'sanity.imagePalette' + darkMuted?: SanityImagePaletteSwatch + lightVibrant?: SanityImagePaletteSwatch + darkVibrant?: SanityImagePaletteSwatch + vibrant?: SanityImagePaletteSwatch + dominant?: SanityImagePaletteSwatch + lightMuted?: SanityImagePaletteSwatch + muted?: SanityImagePaletteSwatch +} + +export type SanityImageDimensions = { + _type: 'sanity.imageDimensions' + height?: number + width?: number + aspectRatio?: number +} + +export type SanityImageHotspot = { + _type: 'sanity.imageHotspot' + x?: number + y?: number + height?: number + width?: number +} + +export type SanityImageCrop = { + _type: 'sanity.imageCrop' + top?: number + bottom?: number + left?: number + right?: number +} + +export type SanityFileAsset = { + _id: string + _type: 'sanity.fileAsset' + _createdAt: string + _updatedAt: string + _rev: string + originalFilename?: string + label?: string + title?: string + description?: string + altText?: string + sha1hash?: string + extension?: string + mimeType?: string + size?: number + assetId?: string + uploadId?: string + path?: string + url?: string + source?: SanityAssetSourceData +} + +export type SanityImageAsset = { + _id: string + _type: 'sanity.imageAsset' + _createdAt: string + _updatedAt: string + _rev: string + originalFilename?: string + label?: string + title?: string + description?: string + altText?: string + sha1hash?: string + extension?: string + mimeType?: string + size?: number + assetId?: string + uploadId?: string + path?: string + url?: string + metadata?: SanityImageMetadata + source?: SanityAssetSourceData +} + +export type SanityImageMetadata = { + _type: 'sanity.imageMetadata' + location?: Geopoint + dimensions?: SanityImageDimensions + palette?: SanityImagePalette + lqip?: string + blurHash?: string + hasAlpha?: boolean + isOpaque?: boolean +} + +export type Geopoint = { + _type: 'geopoint' + lat?: number + lng?: number + alt?: number +} + +export type SanityAssetSourceData = { + _type: 'sanity.assetSourceData' + name?: string + id?: string + url?: string +} + +export type Demo = { + _id: string + _type: 'demo' + _createdAt: string + _updatedAt: string + _rev: string + title?: string + slug?: Slug +} + +export type Slug = { + _type: 'slug' + current?: string + source?: string +} + +export type Theme = { + _id: string + _type: 'theme' + _createdAt: string + _updatedAt: string + _rev: string + background?: string + text?: string +} + +export type AllSanitySchemaTypes = + | SanityImagePaletteSwatch + | SanityImagePalette + | SanityImageDimensions + | SanityImageHotspot + | SanityImageCrop + | SanityFileAsset + | SanityImageAsset + | SanityImageMetadata + | Geopoint + | SanityAssetSourceData + | Demo + | Slug + | Theme +export declare const internalGroqTypeReferenceTo: unique symbol +// Source: ./app/routes/__root.tsx +// Variable: THEME_QUERY +// Query: *[_id == "theme"][0]{background,text} +export type THEME_QUERYResult = + | { + background: null + text: null + } + | { + background: string | null + text: string | null + } + | null + +// Source: ./app/routes/index.tsx +// Variable: DEMO_QUERY +// Query: *[_type == "demo" && slug.current == $slug][0].title +export type DEMO_QUERYResult = string | null + +declare module '@sanity/client' { + interface SanityQueries { + '*[_id == "theme"][0]{background,text}': THEME_QUERYResult + '*[_type == "demo" && slug.current == $slug][0].title': DEMO_QUERYResult + } +}