next-sanity 12.0.3 → 12.0.5
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.
- package/dist/defineLive.d.ts.map +1 -1
- package/dist/isCorsOriginError.d.ts +2 -2
- package/dist/isCorsOriginError.d.ts.map +1 -1
- package/dist/isCorsOriginError.js +1 -2
- package/dist/isCorsOriginError.js.map +1 -1
- package/dist/studio/index.d.ts.map +1 -1
- package/dist/visual-editing/client-component/index.d.ts.map +1 -1
- package/dist/webhook/index.d.ts +9 -11
- package/dist/webhook/index.d.ts.map +1 -1
- package/dist/webhook/index.js.map +1 -1
- package/package.json +1 -3
package/dist/defineLive.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineLive.d.ts","names":[],"sources":["../src/live/defineLive.tsx"],"sourcesContent":[],"mappings":";;AAmBA;;AAEW,KAFC,sBAAA,GAED,CAAA,0BAAA,MAAA,CAAA,CAAA,OAAA,EAAA;EAAsB,KAAA,EADxB,WACwB;EAAR,MAAA,CAAA,EAAd,WAAc,GAAA,OAAA,CAAQ,WAAR,CAAA;EAQD;;;;;;EAYlB,IAAA,CAAA,EAAA,MAAA,EAAA;EASN,WAAY,CAAA,EArBI,OAqBJ,CArBY,iBAqBZ,EAAA,KAAA,CAAA;EACH,KAAA,CAAA,EAAA,OAAA;EACE;;;EAQa,GAAA,CAAA,EAAA,KAAA;EAAR;;;;;EAgBA,UAAA,CAAA,EAAA,MAAA;CAAR,EAAA,GAnCF,OAmCE,CAAA;EAGF,IAAA,EArCE,YAqCI,CArCS,WAqCT,CAAA;EAAA,SAAA,EApCC,gBAoCD,GAAA,IAAA;EAKZ,IAAiB,EAAA,MAAA,EAAA;CAoDI,CAAA;;;;AAYJ,KAlGL,2BAAA,
|
|
1
|
+
{"version":3,"file":"defineLive.d.ts","names":[],"sources":["../src/live/defineLive.tsx"],"sourcesContent":[],"mappings":";;AAmBA;;AAEW,KAFC,sBAAA,GAED,CAAA,0BAAA,MAAA,CAAA,CAAA,OAAA,EAAA;EAAsB,KAAA,EADxB,WACwB;EAAR,MAAA,CAAA,EAAd,WAAc,GAAA,OAAA,CAAQ,WAAR,CAAA;EAQD;;;;;;EAYlB,IAAA,CAAA,EAAA,MAAA,EAAA;EASN,WAAY,CAAA,EArBI,OAqBJ,CArBY,iBAqBZ,EAAA,KAAA,CAAA;EACH,KAAA,CAAA,EAAA,OAAA;EACE;;;EAQa,GAAA,CAAA,EAAA,KAAA;EAAR;;;;;EAgBA,UAAA,CAAA,EAAA,MAAA;CAAR,EAAA,GAnCF,OAmCE,CAAA;EAGF,IAAA,EArCE,YAqCI,CArCS,WAqCT,CAAA;EAAA,SAAA,EApCC,gBAoCD,GAAA,IAAA;EAKZ,IAAiB,EAAA,MAAA,EAAA;CAoDI,CAAA;;;;AAYJ,KAlGL,2BAAA,GAsGF,CAAA,0BAAA,MAAA,CAAA,CAAA,KAAA,EAAA;EAmCV,KAAgB,EAxIP,WAwIO;EAAmB,MAAA,CAAA,EAvIxB,WAuIwB,GAvIV,OAuIU,CAvIF,WAuIE,CAAA;EAKpB;;;;;;;gBApIC,QAAQ;;;;;;;;;;;;;UAad,aAAa;eACR;;QAEP,QAAQ,QAAQ,KAAA,CAAM;MAGxB,KAAA,CAAM;;;;UAKK,sBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAoDI;;;;;8BAMS,cAAc;;;;;UAM3B,uBAAA;;;;UAIP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAmCM,UAAA,SAAmB;;;;;eAKpB;;;;;cAKD,KAAA,CAAM,cAAc;;;;oBAId"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CorsOriginError
|
|
1
|
+
import { CorsOriginError } from "@sanity/client";
|
|
2
2
|
/** @public */
|
|
3
|
-
declare function isCorsOriginError(error: unknown): error is CorsOriginError
|
|
3
|
+
declare function isCorsOriginError(error: unknown): error is CorsOriginError;
|
|
4
4
|
export { isCorsOriginError as t };
|
|
5
5
|
//# sourceMappingURL=isCorsOriginError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isCorsOriginError.d.ts","names":[],"sources":["../src/isCorsOriginError.ts"],"sourcesContent":[],"mappings":";;AAGgB,iBAAA,iBAAA,CAA4C,KAAA,EAAA,OAAA,CAAA,EAAA,KAAA,IAAA,
|
|
1
|
+
{"version":3,"file":"isCorsOriginError.d.ts","names":[],"sources":["../src/isCorsOriginError.ts"],"sourcesContent":[],"mappings":";;AAGgB,iBAAA,iBAAA,CAA4C,KAAA,EAAA,OAAA,CAAA,EAAA,KAAA,IAAA,eAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isCorsOriginError.js","names":[],"sources":["../src/isCorsOriginError.ts"],"sourcesContent":["import {CorsOriginError} from '@sanity/client'\n\n/** @public */\nexport function isCorsOriginError(error: unknown): error is CorsOriginError {\n return error instanceof CorsOriginError\n}\n\nexport type {CorsOriginError}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"isCorsOriginError.js","names":[],"sources":["../src/isCorsOriginError.ts"],"sourcesContent":["import type {CorsOriginError} from '@sanity/client'\n\n/** @public */\nexport function isCorsOriginError(error: unknown): error is CorsOriginError {\n return error instanceof Error && error.name === 'CorsOriginError'\n}\n\nexport type {CorsOriginError}\n"],"mappings":"AAGA,SAAgB,kBAAkB,OAA0C;AAC1E,QAAO,iBAAiB,SAAS,MAAM,SAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/studio/head.tsx","../../src/studio/NextStudioLayout.tsx","../../src/studio/NextStudioNoScript.tsx","../../src/studio/NextStudioWithBridge.tsx"],"sourcesContent":[],"mappings":";;;AAoBA;AAyBA;;AC5CA;AAaA;;;;;;ACOA;;ACXA;;;;cHUa;;;;;;;;;;;;;;;;;;;;;;;cAyBA;;;;;UC5CI,qBAAA;EDmBjB,QAAa,EClBD,KAAA,CAAM,SDkBL;AAyBb;;AC5CiB,cAaJ,gBAbI,EAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/studio/head.tsx","../../src/studio/NextStudioLayout.tsx","../../src/studio/NextStudioNoScript.tsx","../../src/studio/NextStudioWithBridge.tsx"],"sourcesContent":[],"mappings":";;;AAoBA;AAyBA;;AC5CA;AAaA;;;;;;ACOA;;ACXA;;;;cHUa;;;;;;;;;;;;;;;;;;;;;;;cAyBA;;;;;UC5CI,qBAAA;EDmBjB,QAAa,EClBD,KAAA,CAAM,SDkBL;AAyBb;;AC5CiB,cAaJ,gBAbI,EAAA,CACL;EAAA;AAAM,CAAA,EAY2B,qBAZ3B,EAAA,GAYmD,KAAA,CAAM,GAAA,CAAI,OAZ7D;;cCmBL,0BAAyB,KAAA,CAAM,GAAA,CAAI;iBCXhC,oBAAA,QAA4B,oBAAkB,KAAA,CAAM,GAAA,CAAI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/visual-editing/client-component/VisualEditing.tsx","../../../src/visual-editing/client-component/VisualEditingLazy.tsx"],"sourcesContent":[],"mappings":";;AAgBA;;ACFgB,UDEC,kBAAA,SAA2B,ICF5B,CDEiC,oBCFO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/visual-editing/client-component/VisualEditing.tsx","../../../src/visual-editing/client-component/VisualEditingLazy.tsx"],"sourcesContent":[],"mappings":";;AAgBA;;ACFgB,UDEC,kBAAA,SAA2B,ICF5B,CDEiC,oBCFO,EAAqB,SAAM,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;iBAAnE,gCAAA,QAAwC,qBAAqB,KAAA,CAAM"}
|
package/dist/webhook/index.d.ts
CHANGED
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
import "react";
|
|
2
|
-
import { ClientPerspective, SanityClient } from "@sanity/client";
|
|
3
1
|
import { NextRequest } from "next/server";
|
|
4
2
|
/** @public */
|
|
5
|
-
declare interface SanityDocument {
|
|
6
|
-
_id: string;
|
|
7
|
-
_type: string;
|
|
8
|
-
_createdAt: string;
|
|
9
|
-
_updatedAt: string;
|
|
10
|
-
_rev: string;
|
|
11
|
-
[key: string]: unknown;
|
|
12
|
-
}
|
|
13
|
-
/** @public */
|
|
14
3
|
type ParsedBody<T> = {
|
|
15
4
|
/**
|
|
16
5
|
* If a secret is given then it returns a boolean. If no secret is provided then no validation is done on the signature, and it'll return `null`
|
|
@@ -18,6 +7,15 @@ type ParsedBody<T> = {
|
|
|
18
7
|
isValidSignature: boolean | null;
|
|
19
8
|
body: T | null;
|
|
20
9
|
};
|
|
10
|
+
/** @public */
|
|
11
|
+
interface SanityDocument {
|
|
12
|
+
_id: string;
|
|
13
|
+
_type: string;
|
|
14
|
+
_createdAt: string;
|
|
15
|
+
_updatedAt: string;
|
|
16
|
+
_rev: string;
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
}
|
|
21
19
|
/**
|
|
22
20
|
* Handles parsing the body JSON, and validating its signature. Also waits for Content Lake eventual consistency so you can run your queries
|
|
23
21
|
* without worrying about getting stale data.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["Asset","Asset_2","AssetInstanceDocument","ClientPerspective","ComponentType","ElementType","ReactNode","SanityClient","StackablePerspective","ArrayActionName","ArrayDefinition","ArrayOfType","InitialValueProperty","ArrayRule","ValidationBuilder","ArrayOptions","BaseSchemaDefinition","ArrayOfEntry","T","Omit","TType","TAlias","IntrinsicTypeName","IntrinsicArrayOfDefinition","TypeAliasDefinition","V","TitledListValue","InsertMenuOptions","SearchConfiguration","BaseSchemaTypeOptions","Value","FieldReference","RuleDef","ArraySchemaType","SchemaType","Exclude","ReferenceSchemaType","BaseSchemaType","ArraySchemaTypeOf","TSchemaType","AssetSourceSpec","SanityDocument","AssetFromSource","File_2","ImageAsset","AssetMetadataType","AssetSchemaTypeOptions","AssetSource","AssetSourceComponentProps","EmptyProps","AssetSourceUploaderClass","React","ImageSchemaType","FileSchemaType","AssetSourceUploader","globalThis","File","AssetSourceUploadFile","AssetSourceUploadEvent","Error","AssetSourceUploadEventProgress","AssetSourceUploadEventStatus","AssetSourceUploadEventAllComplete","AssetSourceUploadEventError","AssetSourceUploadEventAbort","AssetSourceUploadSubscriber","AutocompleteString","JSX","Element","ConditionalProperty","DeprecatedProperty","DeprecationConfiguration","SchemaValidationValue","PreviewConfig","Partial","SanityCreateOptions","CanvasAppOptions","BlockAnnotationDefinition","ObjectDefinition","BlockChildrenObjectField","ObjectField","BlockDecoratorDefinition","BlockDefinition","BlockStyleDefinition","BlockListDefinition","BlockMarksDefinition","BlockOptions","BlockRule","BlockListObjectField","StringSchemaType","BlockSchemaType","BlockStyleObjectField","ObjectSchemaType","BooleanDefinition","BooleanOptions","BooleanRule","BooleanSchemaType","CanvasNotificationPayload","DashboardNotificationPayload","CollapseOptions","ConditionalIndexAccess","U","ConditionalPropertyCallback","ConditionalPropertyCallbackContext","CurrentUser","CreateIfNotExistsMutation","CreateMutation","CreateOrReplaceMutation","CreateSquashedMutation","CrossDatasetReferenceDefinition","ReferenceOptions","CrossDatasetReferenceFilterResolver","Record","Path","CrossDatasetReferenceFilterSearchOptions","Promise","CrossDatasetReferenceSchemaType","CrossDatasetType","ReferenceFilterOptions","CrossDatasetReferenceValue","Role","CustomValidator","ValidationContext","CustomValidatorResult","ValidationError","LocalizedValidationMessages","User","PortableTextBlock","DateDefinition","DateOptions","DateRule","DatetimeDefinition","DatetimeOptions","DatetimeRule","defineArrayMember","TName","TSelect","TPrepareValue","TStrict","StrictDefinition","DefineArrayMemberBase","NarrowPreview","MaybeAllowUnknownProps","DefineSchemaOptions","arrayOfSchema","WidenValidation","WidenInitialValue","IntrinsicArrayOfBase","defineAssetAspect","MediaLibraryAssetAspectDefinition","MediaLibraryAssetAspectDocument","defineField","DefineSchemaBase","FieldDefinitionBase","schemaField","IntrinsicBase","DefineSchemaType","IntrinsicDefinitions","defineType","schemaDefinition","DeleteMutation","MutationSelection","DeprecatedSchemaType","DocumentDefinition","SortOrdering","DocumentOptions","DocumentRule","EmailDefinition","EmailOptions","EmailRule","EnumListProps","Array","FieldDefinition","InlineFieldDefinition","FieldGroup","I18nTextRecord","FieldGroupDefinition","FieldRules","Fieldset","SingleFieldSet","MultiFieldSet","FieldsetDefinition","ObjectOptions","Reference","FileAsset","FileDefinition","FileOptions","FileRule","FileValue","MediaLibraryOptions","FormNodeValidation","GeopointDefinition","GeopointOptions","GeopointRule","GeopointValue","GlobalDocumentReferenceDefinition","GlobalDocumentReferenceFilterResolver","GlobalDocumentReferenceFilterSearchOptions","GlobalDocumentReferenceSchemaType","GlobalDocumentReferenceType","GlobalDocumentReferenceValue","HotspotOptions","HotspotPreview","K","I18nTitledListValue","Image_2","ImageCrop","ImageHotspot","Image","ImageMetadata","ImageDefinition","ImageOptions","ImageRule","ImageValue","ImageDimensions","ImagePalette","ImageMetadataType","ImageSwatch","ImageUrlAutoMode","ImageUrlCropMode","ImageUrlFitMode","ImageUrlFormat","ImageUrlOrientation","ImageUrlParams","IndexTuple","Params","InitialValueResolver","InitialValueResolverContext","Schema","InsertPatch","NumberDefinition","ReferenceDefinition","SlugDefinition","StringDefinition","TextDefinition","UrlDefinition","isArrayOfBlocksSchemaType","isArrayOfObjectsSchemaType","isArrayOfPrimitivesSchemaType","isArraySchemaType","isAssetAspect","isBlockChildrenObjectField","isBlockListObjectField","isBlockSchemaType","isBlockStyleObjectField","isBooleanSchemaType","isCreateIfNotExistsMutation","Mutation","TransactionLogMutation","isCreateMutation","isCreateOrReplaceMutation","isCreateSquashedMutation","isCrossDatasetReference","isCrossDatasetReferenceSchemaType","isDateTimeSchemaType","isDeleteMutation","isDeprecatedSchemaType","isDeprecationConfiguration","isDocumentSchemaType","isFileSchemaType","isGlobalDocumentReference","isImage","isImageSchemaType","isIndexSegment","PathSegment","isIndexTuple","isKeyedObject","KeyedObject","isKeySegment","KeyedSegment","isNumberSchemaType","NumberSchemaType","isObjectSchemaType","isPatchMutation","PatchMutation","isPortableTextListBlock","PortableTextSpan","PortableTextObject","PortableTextTextBlock","isPortableTextSpan","isPortableTextTextBlock","isPrimitiveSchemaType","isReference","isReferenceSchemaType","isSanityDocument","isSearchStrategy","SearchStrategy","isSlug","Slug","isSpanSchemaType","SpanSchemaType","isStringSchemaType","isTitledListValue","isTypedObject","TypedObject","isValidationError","isValidationErrorMarker","ValidationMarker","isValidationInfo","isValidationInfoMarker","isValidationWarning","isValidationWarningMarker","MaybePreview","Select","PrepareValue","MEDIA_LIBRARY_ASSET_ASPECT_TYPE_NAME","MediaAssetTypes","MediaLibraryAssetAspectSupportedFieldDefinitions","MediaLibraryAssetType","MediaLibraryAssetAspectTypeName","SanityDocumentLike","MediaLibraryFilter","MediaValidationValue","Extract","MediaValidator","MendozaEffectPair","MendozaPatch","MultipleMutationResult","MutationOperationName","NumberOptions","NumberRule","ObjectRule","ObjectFieldType","ObjectSchemaTypeWithOptions","PatchMutationOperation","PatchOperations","PortableTextChild","PortableTextListBlock","TChild","PrepareViewOptions","PreviewValue","ReferenceBaseOptions","ReferenceTo","ReferenceRule","ReferenceValue","ReferenceFilterResolverOptions","ReferenceFilterQueryOptions","ReferenceFilterResolver","ReferenceFilterResolverContext","ReferenceFilterSearchOptions","SchemaTypeDefinition","TypeReference","Rule","RuleTypeConstraint","RuleSpec","Lowercase","RegExp","UriValidationOptions","RuleBuilder","FieldValue","RuleClass","LenientFieldValue","RuleSpecConstraint","SchemaValidationProblemGroup","SchemaValidationError","SchemaValidationProblem","SchemaValidationWarning","SchemaValidationProblemPath","searchStrategies","SingleMutationResult","SlugOptions","SlugRule","SlugValue","SlugifierFn","SlugSchemaType","SlugSourceContext","SlugIsUniqueValidator","SlugValidationContext","SlugSourceFn","SlugParent","SortOrderingItem","SpanMarksObjectField","SpanTextObjectField","TextSchemaType","StrictVersionLayeringOptions","StringOptions","StringRule","TextOptions","StudioNotificationPayload","SwatchName","TextRule","TransactionLogEvent","TransactionLogEventWithEffects","TransactionLogEventWithMutations","typed","UploadState","UrlOptions","UrlRule","ValidationErrorClass","ValidationErrorOptions","Validator","Validators","P","WeakCrossDatasetReferenceValue","WeakGlobalDocumentReferenceValue","WeakReference"],"sources":["../../../../node_modules/.pnpm/@sanity+types@5.0.1_@types+react@19.2.7_debug@4.4.3/node_modules/@sanity/types/lib/index.d.ts","../../src/webhook/index.ts"],"sourcesContent":["import {Asset as Asset_2} from '@sanity/media-library-types'\nimport {AssetInstanceDocument} from '@sanity/media-library-types'\nimport {ClientPerspective} from '@sanity/client'\nimport {ComponentType} from 'react'\nimport {ElementType} from 'react'\nimport {ReactNode} from 'react'\nimport {SanityClient} from '@sanity/client'\nimport {StackablePerspective} from '@sanity/client'\n\n/**\n * Types of array actions that can be performed\n * @beta\n */\nexport declare type ArrayActionName =\n /**\n * Add any item to the array at any position\n */\n | 'add'\n /**\n * Add item after an existing item\n */\n | 'addBefore'\n /**\n * Add item after an existing item\n */\n | 'addAfter'\n /**\n * Remove any item\n */\n | 'remove'\n /**\n * Duplicate item\n */\n | 'duplicate'\n /**\n * Copy item\n */\n | 'copy'\n\n/** @public */\nexport declare interface ArrayDefinition extends BaseSchemaDefinition {\n type: 'array'\n of: ArrayOfType[]\n initialValue?: InitialValueProperty<any, unknown[]>\n validation?: ValidationBuilder<ArrayRule<unknown[]>, unknown[]>\n options?: ArrayOptions\n}\n\n/** @public */\nexport declare type ArrayOfEntry<T> = Omit<T, 'name' | 'hidden'> & {\n name?: string\n}\n\n/** @public */\nexport declare type ArrayOfType<\n TType extends IntrinsicTypeName = IntrinsicTypeName,\n TAlias extends IntrinsicTypeName | undefined = undefined,\n> = IntrinsicArrayOfDefinition[TType] | ArrayOfEntry<TypeAliasDefinition<string, TAlias>>\n\n/** @public */\nexport declare interface ArrayOptions<V = unknown>\n extends SearchConfiguration, BaseSchemaTypeOptions {\n list?: TitledListValue<V>[] | V[]\n layout?: 'list' | 'tags' | 'grid'\n /** @deprecated This option does not have any effect anymore */\n direction?: 'horizontal' | 'vertical'\n sortable?: boolean\n modal?: {\n type?: 'dialog' | 'popover'\n width?: number | 'auto'\n }\n /** @alpha This API may change */\n insertMenu?: InsertMenuOptions\n /**\n * A boolean flag to enable or disable tree editing for the array.\n * If there are any nested arrays, they will inherit this value.\n * @deprecated tree editing beta feature has been disabled\n */\n treeEditing?: boolean\n /**\n * A list of array actions to disable\n * Possible options are defined by {@link ArrayActionName}\n * @beta\n */\n disableActions?: ArrayActionName[]\n}\n\n/** @public */\nexport declare interface ArrayRule<Value> extends RuleDef<ArrayRule<Value>, Value> {\n min: (length: number | FieldReference) => ArrayRule<Value>\n max: (length: number | FieldReference) => ArrayRule<Value>\n length: (length: number | FieldReference) => ArrayRule<Value>\n unique: () => ArrayRule<Value>\n}\n\n/** @public */\nexport declare interface ArraySchemaType<V = unknown> extends BaseSchemaType {\n jsonType: 'array'\n of: (Exclude<SchemaType, ArraySchemaType> | ReferenceSchemaType)[]\n options?: ArrayOptions<V> & {\n layout?: V extends string ? 'tag' : 'grid'\n }\n}\n\n/** @internal */\nexport declare type ArraySchemaTypeOf<TSchemaType extends ArraySchemaType['of'][number]> = Omit<\n ArraySchemaType,\n 'of'\n> & {\n of: TSchemaType[]\n}\n\n/** @public */\nexport declare interface Asset extends SanityDocument {\n url: string\n path: string\n assetId: string\n extension: string\n mimeType: string\n sha1hash: string\n size: number\n originalFilename?: string\n label?: string\n title?: string\n description?: string\n creditLine?: string\n source?: AssetSourceSpec\n}\n\n/** @public */\nexport declare type AssetFromSource = {\n kind: 'assetDocumentId' | 'file' | 'base64' | 'url'\n value: string | File_2\n assetDocumentProps?: ImageAsset\n mediaLibraryProps?: {\n mediaLibraryId: string\n assetId: string\n assetInstanceId: string\n }\n}\n\n/** @public */\nexport declare type AssetMetadataType =\n | 'location'\n | 'exif'\n | 'image'\n | 'palette'\n | 'lqip'\n | 'blurhash'\n | 'none'\n\n/** @public */\nexport declare interface AssetSchemaTypeOptions {\n accept?: string\n storeOriginalFilename?: boolean\n}\n\n/** @public */\nexport declare interface AssetSource {\n name: string\n /** @deprecated provide `i18nKey` instead */\n title?: string\n i18nKey?: string\n component: ComponentType<AssetSourceComponentProps>\n icon?: ComponentType<EmptyProps>\n /** @beta */\n Uploader?: AssetSourceUploaderClass\n}\n\n/** @public */\nexport declare interface AssetSourceComponentProps {\n action?: 'select' | 'upload'\n assetSource: AssetSource\n assetType?: 'file' | 'image' | 'sanity.video'\n accept: string\n selectionType: 'single'\n dialogHeaderTitle?: React.ReactNode\n selectedAssets: Asset[]\n onClose: () => void\n onSelect: (assetFromSource: AssetFromSource[]) => void\n schemaType?: ImageSchemaType | FileSchemaType\n /** @beta */\n uploader?: AssetSourceUploader\n}\n\n/** @public */\nexport declare interface AssetSourceSpec {\n id: string\n name: string\n url?: string\n}\n\n/** @beta */\nexport declare interface AssetSourceUploader {\n upload(\n files: globalThis.File[],\n options?: {\n /**\n * The schema type of the field the asset is being uploaded to.\n * May be of interest to the uploader to read file and image options.\n */\n schemaType?: SchemaType\n /**\n * The uploader may send patches directly to the field\n * Typed 'unknown' as we don't have patch definitions in sanity/types yet.\n */\n onChange?: (patch: unknown) => void\n },\n ): AssetSourceUploadFile[]\n /**\n * Abort the upload of a file\n */\n abort(file?: AssetSourceUploadFile): void\n /**\n * Get the files that are currently being uploaded\n */\n getFiles(): AssetSourceUploadFile[]\n /**\n * Subscribe to upload events from the uploader\n */\n subscribe(subscriber: (event: AssetSourceUploadEvent) => void): () => void\n /**\n * Update the status of a file. Will be emitted to subscribers.\n */\n updateFile(\n fileId: string,\n data: {\n progress?: number\n status?: string\n error?: Error\n },\n ): void\n /**\n * Reset the uploader (clear files). Should be called by the uploader when all files are done.\n */\n reset(): void\n}\n\n/** @beta */\nexport declare type AssetSourceUploaderClass = new (...args: any[]) => AssetSourceUploader\n\n/** @beta */\nexport declare type AssetSourceUploadEvent =\n | AssetSourceUploadEventProgress\n | AssetSourceUploadEventStatus\n | AssetSourceUploadEventAllComplete\n | AssetSourceUploadEventError\n | AssetSourceUploadEventAbort\n\n/**\n * Emitted when all files are done, either successfully, aborted or with errors\n * @beta */\nexport declare type AssetSourceUploadEventAbort = {\n type: 'abort'\n /**\n * Files aborted\n */\n files: AssetSourceUploadFile[]\n}\n\n/**\n * Emitted when all files are done, either successfully, aborted or with errors\n * @beta */\nexport declare type AssetSourceUploadEventAllComplete = {\n type: 'all-complete'\n files: AssetSourceUploadFile[]\n}\n\n/**\n * Emitted when all files are done, either successfully, aborted or with errors\n * @beta */\nexport declare type AssetSourceUploadEventError = {\n type: 'error'\n /**\n * Files errored\n */\n files: AssetSourceUploadFile[]\n}\n\n/**\n * Emitted when a file upload is progressing\n * @beta */\nexport declare type AssetSourceUploadEventProgress = {\n type: 'progress'\n file: AssetSourceUploadFile\n progress: number\n}\n\n/**\n * Emitted when a file upload is changing status\n * @beta */\nexport declare type AssetSourceUploadEventStatus = {\n type: 'status'\n file: AssetSourceUploadFile\n status: AssetSourceUploadFile['status']\n}\n\n/** @beta */\nexport declare interface AssetSourceUploadFile {\n id: string\n file: globalThis.File\n progress: number\n status: 'pending' | 'uploading' | 'complete' | 'error' | 'aborted' | 'alreadyExists'\n error?: Error\n result?: unknown\n}\n\n/** @beta */\nexport declare type AssetSourceUploadSubscriber = (event: AssetSourceUploadEvent) => void\n\n/**\n * Enhances VSCode autocomplete by using a distinct type for strings.\n *\n * `AllowOtherStrings` is defined as `string & {}`, an intersection that behaves\n * like `string` but is treated differently by TypeScript's type system for\n * internal processing. This helps in improving the specificity and relevance of\n * autocomplete suggestions by potentially prioritizing `IntrinsicTypeName`\n * over general string inputs, addressing issues where `string` type suggestions\n * might overshadow more useful specific literals.\n *\n * @beta\n */\nexport declare type AutocompleteString = string & {}\n\n/** @public */\nexport declare interface BaseSchemaDefinition {\n name: string\n title?: string\n description?: string | React.JSX.Element\n hidden?: ConditionalProperty\n readOnly?: ConditionalProperty\n icon?: ComponentType | ReactNode\n validation?: unknown\n initialValue?: unknown\n deprecated?: DeprecatedProperty\n}\n\n/** @public */\nexport declare interface BaseSchemaType extends Partial<DeprecationConfiguration> {\n name: string\n title?: string\n description?: string\n type?: SchemaType\n liveEdit?: boolean\n readOnly?: ConditionalProperty\n hidden?: ConditionalProperty\n icon?: ComponentType\n initialValue?: InitialValueProperty<any, any>\n validation?: SchemaValidationValue\n preview?: PreviewConfig\n /** @beta */\n components?: {\n block?: ComponentType<any>\n inlineBlock?: ComponentType<any>\n annotation?: ComponentType<any>\n diff?: ComponentType<any>\n field?: ComponentType<any>\n input?: ComponentType<any>\n item?: ComponentType<any>\n preview?: ComponentType<any>\n portableText?: {\n plugins?: ComponentType<any>\n }\n }\n /**\n * @deprecated This will be removed.\n */\n placeholder?: string\n}\n\n/**\n * `BaseOptions` applies to all type options.\n *\n * It can be extended by interface declaration merging in plugins to provide generic options to all types and fields.\n *\n * @public\n * */\nexport declare interface BaseSchemaTypeOptions {\n sanityCreate?: SanityCreateOptions\n canvasApp?: CanvasAppOptions\n}\n\n/**\n * Schema definition for a text block annotation object.\n *\n * @public\n * @example The default link annotation\n * ```ts\n * {\n * name: 'blockContent',\n * title: 'Content',\n * type: 'array',\n * of: [\n * {\n * type: 'block',\n * marks: {\n * annotations: [\n * {\n * type: 'object',\n * name: 'link',\n * fields: [\n * {\n * type: 'string',\n * name: 'href',\n * },\n * ],\n * },\n * ]\n * },\n * }\n * ]\n * }\n * ```\n */\nexport declare interface BlockAnnotationDefinition extends ObjectDefinition {\n icon?: ReactNode | ComponentType\n}\n\n/**\n * The specific `children` field of a `block` type (`BlockSchemaType`)\n * @see BlockSchemaType\n *\n * @internal\n */\nexport declare type BlockChildrenObjectField = {\n name: 'children'\n} & ObjectField<ArraySchemaType>\n\n/**\n * Schema definition for text block decorators.\n *\n * @public\n * @example The default set of decorators\n * ```ts\n * {\n * name: 'blockContent',\n * title: 'Content',\n * type: 'array',\n * of: [\n * {\n * type: 'block',\n * marks: {\n * decorators: [\n * {title: 'Strong', value: 'strong'},\n * {title: 'Emphasis', value: 'em'},\n * {title: 'Underline', value: 'underline'},\n * {title: 'Strike', value: 'strike-through'},\n * {title: 'Code', value: 'code'},\n * ]\n * }\n * }\n * ]\n * }\n * ```\n */\nexport declare interface BlockDecoratorDefinition {\n title: string\n i18nTitleKey?: string\n value: string\n icon?: ReactNode | ComponentType\n}\n\n/**\n * Schema definition for text blocks.\n *\n * @public\n * @example the default block definition\n * ```ts\n * {\n * name: 'blockContent',\n * title: 'Content',\n * type: 'array',\n * of: [\n * {\n * type: 'block',\n * marks: {\n * decorators: [\n * {title: 'Strong', value: 'strong'},\n * {title: 'Emphasis', value: 'em'},\n * {title: 'Underline', value: 'underline'},\n * {title: 'Strike', value: 'strike-through'},\n * {title: 'Code', value: 'code'},\n * ],\n * annotations: [\n * {\n * type: 'object',\n * name: 'link',\n * fields: [\n * {\n * type: 'string',\n * name: 'href',\n * },\n * ],\n * },\n * ]\n * },\n * styles: [\n * {title: 'Normal', value: 'normal'},\n * {title: 'H1', value: 'h1'},\n * {title: 'H2', value: 'h2'},\n * {title: 'H3', value: 'h3'},\n * {title: 'H4', value: 'h4'},\n * {title: 'H5', value: 'h5'},\n * {title: 'H6', value: 'h6'},\n * {title: 'Quote', value: 'blockquote'}\n * ],\n * lists: [\n * {title: 'Bullet', value: 'bullet'},\n * {title: 'Number', value: 'number'},\n * ],\n * },\n * ]\n * }\n * ```\n */\nexport declare interface BlockDefinition extends BaseSchemaDefinition {\n type: 'block'\n styles?: BlockStyleDefinition[]\n lists?: BlockListDefinition[]\n marks?: BlockMarksDefinition\n of?: ArrayOfType<'object' | 'reference'>[]\n initialValue?: InitialValueProperty<any, any[]>\n options?: BlockOptions\n validation?: ValidationBuilder<BlockRule, any[]>\n}\n\n/**\n * Schema definition for a text block list style.\n *\n * @public\n * @example The defaults lists\n * ```ts\n * {\n * name: 'blockContent',\n * title: 'Content',\n * type: 'array',\n * of: [\n * {\n * type: 'block',\n * lists: [\n * {title: 'Bullet', value: 'bullet'},\n * {title: 'Number', value: 'number'},\n * ]\n * }\n * ]\n * }\n * ```\n */\nexport declare interface BlockListDefinition {\n title: string\n i18nTitleKey?: string\n value: string\n icon?: ReactNode | ComponentType\n}\n\n/**\n * A specific `ObjectField` for `list` in `BlockSchemaType`\n * @see BlockSchemaType\n *\n * @internal\n */\nexport declare type BlockListObjectField = {\n name: 'list'\n} & ObjectField<StringSchemaType>\n\n/**\n * Schema definition for text block marks (decorators and annotations).\n *\n * @public */\nexport declare interface BlockMarksDefinition {\n decorators?: BlockDecoratorDefinition[]\n annotations?: ArrayOfType<'object' | 'reference'>[]\n}\n\n/**\n * Schema options for a Block schema definition\n * @public */\nexport declare interface BlockOptions extends BaseSchemaTypeOptions {\n /**\n * Turn on or off the builtin browser spellchecking. Default is on.\n */\n spellCheck?: boolean\n unstable_whitespaceOnPasteMode?: 'preserve' | 'normalize' | 'remove'\n /**\n * When enabled, the editor will restrict all line breaks and soft breaks,\n * forcing content to remain on a single line. This will also update\n * the styling of the editor to reflect the single-line constraint.\n *\n * Pasting content that is on multiple lines will be normalized to a single line, if possible.\n *\n * @defaultValue false\n */\n oneLine?: boolean\n}\n\n/** @public */\nexport declare interface BlockRule extends RuleDef<BlockRule, any[]> {}\n\n/**\n * Represents the compiled schema shape for `block`s for portable text.\n *\n * Note: this does _not_ represent the schema definition shape.\n *\n * @internal\n */\nexport declare interface BlockSchemaType extends ObjectSchemaType {\n fields: [BlockChildrenObjectField, BlockStyleObjectField, BlockListObjectField, ...ObjectField[]]\n options?: BlockOptions\n}\n\n/**\n * Schema definition for a text block style.\n * A text block may have a block style like 'header', 'normal', 'lead'\n * attached to it, which is stored on the `.style` property for that block.\n *\n * @public\n * @remarks The first defined style will become the default style.´´\n * @example The default set of styles\n * ```ts\n * {\n * name: 'blockContent',\n * title: 'Content',\n * type: 'array',\n * of: [\n * {\n * type: 'block',\n * styles: [\n * {title: 'Normal', value: 'normal'},\n * {title: 'H1', value: 'h1'},\n * {title: 'H2', value: 'h2'},\n * {title: 'H3', value: 'h3'},\n * {title: 'H4', value: 'h4'},\n * {title: 'H5', value: 'h5'},\n * {title: 'H6', value: 'h6'},\n * {title: 'Quote', value: 'blockquote'}\n * ]\n * }\n * ]\n * }\n * ```\n * @example Example of defining a block type with custom styles and render components.\n * ```ts\n * defineArrayMember({\n * type: 'block',\n * styles: [\n * {\n * title: 'Paragraph',\n * value: 'paragraph',\n * component: ParagraphStyle,\n * },\n * {\n * title: 'Lead',\n * value: 'lead',\n * component: LeadStyle,\n * },\n * {\n * title: 'Heading',\n * value: 'heading',\n * component: HeadingStyle,\n * },\n * ],\n * })\n * ```\n */\nexport declare interface BlockStyleDefinition {\n title: string\n value: string\n i18nTitleKey?: string\n icon?: ReactNode | ComponentType\n}\n\n/**\n * A specific `ObjectField` for `style` in `BlockSchemaType`\n * @see BlockSchemaType\n *\n * @internal\n */\nexport declare type BlockStyleObjectField = {\n name: 'style'\n} & ObjectField<StringSchemaType>\n\n/** @public */\nexport declare interface BooleanDefinition extends BaseSchemaDefinition {\n type: 'boolean'\n options?: BooleanOptions\n initialValue?: InitialValueProperty<any, boolean>\n validation?: ValidationBuilder<BooleanRule, boolean>\n}\n\n/** @public */\nexport declare interface BooleanOptions extends BaseSchemaTypeOptions {\n layout?: 'switch' | 'checkbox'\n}\n\n/** @public */\nexport declare interface BooleanRule extends RuleDef<BooleanRule, boolean> {}\n\n/** @public */\nexport declare interface BooleanSchemaType extends BaseSchemaType {\n jsonType: 'boolean'\n options?: BooleanOptions\n initialValue?: InitialValueProperty<any, boolean>\n}\n\n/**\n * Options for configuring how Canvas app interfaces with the type or field.\n *\n * @public\n */\nexport declare interface CanvasAppOptions {\n /** Set to true to exclude a type or field from appearing in Canvas */\n exclude?: boolean\n /**\n * A short description of what the type or field is used for.\n * Purpose can be used to improve how and when content mapping uses the field.\n * */\n purpose?: string\n}\n\n/**\n * @internal\n * Payload that will be passed by canvas to our notifications system to display the notification in canvas.\n * */\nexport declare interface CanvasNotificationPayload extends DashboardNotificationPayload {\n applicationType: 'canvas'\n link: {\n type: 'dashboard'\n path: string\n }\n}\n\n/** @public */\nexport declare interface CollapseOptions {\n collapsed?: boolean\n collapsible?: boolean\n /**\n * @deprecated Use `collapsible` instead\n */\n collapsable?: boolean\n}\n\n/**\n * this is used to get allow index access (e.g. `RuleSpec['constraint']`) to\n * constraint when a rule spec might not have a `constraint` prop\n *\n * @internal\n */\nexport declare type ConditionalIndexAccess<T, U> = U extends keyof T ? T[U] : undefined\n\n/** @public */\nexport declare type ConditionalProperty = boolean | ConditionalPropertyCallback | undefined\n\n/** @public */\nexport declare type ConditionalPropertyCallback = (\n context: ConditionalPropertyCallbackContext,\n) => boolean\n\n/** @public */\nexport declare interface ConditionalPropertyCallbackContext {\n document: SanityDocument | undefined\n parent: any\n value: any\n currentUser: Omit<CurrentUser, 'role'> | null\n}\n\n/** @internal */\nexport declare interface CreateIfNotExistsMutation {\n createIfNotExists: {\n _id: string\n _type: string\n [key: string]: unknown\n }\n}\n\n/** @internal */\nexport declare interface CreateMutation {\n create: {\n _id?: string\n _type: string\n [key: string]: unknown\n }\n}\n\n/** @internal */\nexport declare interface CreateOrReplaceMutation {\n createOrReplace: {\n _id: string\n _type: string\n [key: string]: unknown\n }\n}\n\n/**\n * Mutation type used when the document has passed the threshold of the\n * \"history retention\" - any transactions done prior to the threshold gets \"squashed\"\n * into a single \"create\" transaction.\n *\n * @internal\n */\nexport declare interface CreateSquashedMutation {\n createSquashed: {\n /**\n * The user IDs of all the users who contributed to the document prior to the squashing\n */\n authors: string[]\n /**\n * User ID of the person who initially created the document\n */\n createdBy: string\n /**\n * ISO-formatted timestamp (zulu-time) of when the document as initially created\n */\n createdAt: string\n /**\n * The document as it exists after squashing has occurred\n */\n document: {\n _id: string\n _type: string\n [key: string]: unknown\n }\n }\n}\n\n/** @public */\nexport declare interface CrossDatasetReferenceDefinition extends BaseSchemaDefinition {\n type: 'crossDatasetReference'\n weak?: boolean\n to: {\n type: string\n title?: string\n icon?: ComponentType\n preview?: PreviewConfig\n /**\n * @deprecated Unused. Configuring search is no longer supported.\n */\n __experimental_search?: {\n path: string | string[]\n weight?: number\n mapWith?: string\n }[]\n }[]\n dataset: string\n studioUrl?: (document: {id: string; type?: string}) => string | null\n tokenId?: string\n options?: ReferenceOptions\n /**\n * @deprecated Cross-project references are no longer supported, only cross-dataset\n */\n projectId?: string\n}\n\n/** @beta */\nexport declare type CrossDatasetReferenceFilterResolver = (options: {\n document: SanityDocument\n parent?: Record<string, unknown> | Record<string, unknown>[]\n parentPath: Path\n}) => CrossDatasetReferenceFilterSearchOptions | Promise<CrossDatasetReferenceFilterSearchOptions>\n\n/** @beta */\nexport declare type CrossDatasetReferenceFilterSearchOptions = {\n filter?: string\n params?: Record<string, unknown>\n tag?: string\n}\n\n/** @beta */\nexport declare interface CrossDatasetReferenceSchemaType extends Omit<ObjectSchemaType, 'options'> {\n jsonType: 'object'\n to: CrossDatasetType[]\n dataset: string\n studioUrl?: (document: {id: string; type?: string}) => string | null\n weak?: boolean\n options?: ReferenceFilterOptions\n}\n\n/** @beta */\nexport declare interface CrossDatasetReferenceValue {\n _type: string\n _dataset: string\n _projectId: string\n _ref: string\n _key?: string\n _weak?: boolean\n}\n\n/** @beta */\nexport declare interface CrossDatasetType {\n type: string\n title?: string\n icon: ComponentType\n preview: PreviewConfig\n /** @deprecated Unused. Configuring search is no longer supported for cross-dataset references. */\n __experimental_search: ObjectSchemaType['__experimental_search']\n}\n\n/** @public */\nexport declare interface CurrentUser {\n id: string\n name: string\n email: string\n profileImage?: string\n provider?: string\n /** @deprecated use `roles` instead */\n role: string\n roles: Role[]\n}\n\n/** @public */\nexport declare interface CustomValidator<T = unknown> {\n (value: T, context: ValidationContext): CustomValidatorResult | Promise<CustomValidatorResult>\n bypassConcurrencyLimit?: boolean\n}\n\n/** @public */\nexport declare type CustomValidatorResult =\n | true\n | string\n | ValidationError\n | ValidationError[]\n | LocalizedValidationMessages\n\n/**\n * @internal\n * Payload notifications have to provide to the notification system in order to display correctly in dashboard\n */\nexport declare interface DashboardNotificationPayload {\n version: '1.0.0'\n applicationType: string\n createdAt: string\n /**\n * The user who took the action which triggered the notification.\n */\n actor: User\n title: PortableTextBlock[]\n body: PortableTextBlock[] | undefined\n organizationId: string\n applicationId?: string\n workspaceName?: string\n link:\n | {\n type: 'url'\n url: string\n }\n | {\n type: 'dashboard'\n path: string\n }\n}\n\n/** @public */\nexport declare interface DateDefinition extends BaseSchemaDefinition {\n type: 'date'\n options?: DateOptions\n placeholder?: string\n validation?: ValidationBuilder<DateRule, string>\n initialValue?: InitialValueProperty<any, string>\n}\n\n/** @public */\nexport declare interface DateOptions extends BaseSchemaTypeOptions {\n dateFormat?: string\n}\n\n/** @public */\nexport declare interface DateRule extends RuleDef<DateRule, string> {\n /**\n * @param minDate - Minimum date (inclusive). minDate should be in ISO 8601 format.\n */\n min: (minDate: string | FieldReference) => DateRule\n /**\n * @param maxDate - Maximum date (inclusive). maxDate should be in ISO 8601 format.\n */\n max: (maxDate: string | FieldReference) => DateRule\n}\n\n/** @public */\nexport declare interface DatetimeDefinition extends BaseSchemaDefinition {\n type: 'datetime'\n options?: DatetimeOptions\n placeholder?: string\n validation?: ValidationBuilder<DatetimeRule, string>\n initialValue?: InitialValueProperty<any, string>\n}\n\n/** @public */\nexport declare interface DatetimeOptions extends BaseSchemaTypeOptions {\n dateFormat?: string\n timeFormat?: string\n timeStep?: number\n displayTimeZone?: string\n allowTimeZoneSwitch?: boolean\n}\n\n/** @public */\nexport declare interface DatetimeRule extends RuleDef<DatetimeRule, string> {\n /**\n * @param minDate - Minimum date (inclusive). minDate should be in ISO 8601 format.\n */\n min: (minDate: string | FieldReference) => DatetimeRule\n /**\n * @param maxDate - Maximum date (inclusive). maxDate should be in ISO 8601 format.\n */\n max: (maxDate: string | FieldReference) => DatetimeRule\n}\n\n/**\n * Define an array item member type within an array definition `of`-array.\n *\n * This function will narrow the schema type down to fields and options based on the provided\n * `type` string.\n *\n * Using `defineArrayMember` is optional, but should provide improved autocompletion in your IDE, when building your schema.\n * Field properties like `validation` and `initialValue` will also be more specific.\n *\n * See {@link defineType} for example usage.\n *\n * @param arrayOfSchema - should be a valid `array.of` member definition.\n * @param defineOptions - optional param to provide type hints for `arrayOfSchema`.\n *\n * @see defineType\n * @see defineField\n * @see typed\n *\n * @beta\n */\nexport declare function defineArrayMember<\n const TType extends IntrinsicTypeName | AutocompleteString,\n const TName extends string,\n TSelect extends Record<string, string> | undefined,\n TPrepareValue extends Record<keyof TSelect, any> | undefined,\n TAlias extends IntrinsicTypeName | undefined,\n TStrict extends StrictDefinition,\n>(\n arrayOfSchema: {\n type: TType\n /**\n * When provided, `name` is used as `_type` for the array item when stored.\n *\n * Necessary when an array contains multiple entries with the same `type`, each with\n * different configuration (title and initialValue for instance).\n */\n name?: TName\n } & DefineArrayMemberBase<TType, TAlias> &\n NarrowPreview<TType, TAlias, TSelect, TPrepareValue> &\n MaybeAllowUnknownProps<TStrict>,\n defineOptions?: DefineSchemaOptions<TStrict, TAlias>,\n): typeof arrayOfSchema & WidenValidation & WidenInitialValue\n\n/** @beta */\nexport declare type DefineArrayMemberBase<\n TType extends string,\n TAlias extends IntrinsicTypeName | undefined,\n> = TType extends IntrinsicTypeName\n ? IntrinsicArrayOfBase[TType]\n : ArrayOfEntry<TypeAliasDefinition<string, TAlias>>\n\n/**\n * Define a Media Library asset aspect.\n *\n * Aspects can be deployed using the `sanity media deploy-aspect` CLI command.\n *\n * @public\n * @beta\n */\nexport declare function defineAssetAspect(\n definition: MediaLibraryAssetAspectDefinition,\n): MediaLibraryAssetAspectDocument\n\n/**\n * Define a field within a document, object, image or file definition `fields` array.\n *\n * This function will narrow the schema type down to fields and options based on the provided\n * type-string.\n *\n * Using `defineField` is optional, but should provide improved autocompletion in your IDE, when building your schema.\n * Field-properties like `validation` and `initialValue`will also be more specific.\n *\n * See {@link defineType} for more examples.\n *\n * @param schemaField - should be a valid field type definition.\n * @param defineOptions - optional param to provide type hints for `schemaField`.\n *\n * @see defineField\n * @see defineArrayMember\n * @see typed\n *\n * @beta\n */\nexport declare function defineField<\n const TType extends IntrinsicTypeName | AutocompleteString,\n const TName extends string,\n TSelect extends Record<string, string> | undefined,\n TPrepareValue extends Record<keyof TSelect, any> | undefined,\n TAlias extends IntrinsicTypeName | undefined,\n TStrict extends StrictDefinition,\n>(\n schemaField: {\n type: TType\n name: TName\n } & DefineSchemaBase<TType, TAlias> &\n NarrowPreview<TType, TAlias, TSelect, TPrepareValue> &\n MaybeAllowUnknownProps<TStrict> &\n FieldDefinitionBase,\n defineOptions?: DefineSchemaOptions<TStrict, TAlias>,\n): typeof schemaField & WidenValidation & WidenInitialValue\n\n/** @beta */\nexport declare type DefineSchemaBase<\n TType extends string,\n TAlias extends IntrinsicTypeName | undefined,\n> = TType extends IntrinsicTypeName ? IntrinsicBase[TType] : TypeAliasDefinition<TType, TAlias>\n\n/** @beta */\nexport declare interface DefineSchemaOptions<\n TStrict extends StrictDefinition,\n TAlias extends IntrinsicTypeName | undefined,\n> {\n /**\n * `strict: false` allows unknown properties in the schema.\n * Use this when adding customizations to the schema that are not part of sanity core.\n *\n * If you want to extend the Sanity Schema types with your own properties or options to make them typesafe,\n * you can use [TypeScript declaration merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html).\n *\n * See {@link defineType} for more.\n *\n * @see defineType\n */\n strict?: TStrict\n /** Should be provided when type is a non-intrinsic type, ie type is a type alias */\n aliasFor?: TAlias extends IntrinsicTypeName ? TAlias : never\n}\n\n/** @beta */\nexport declare type DefineSchemaType<\n TType extends string,\n TAlias extends IntrinsicTypeName | undefined,\n> = TType extends IntrinsicTypeName\n ? IntrinsicDefinitions[TType]\n : TypeAliasDefinition<TType, TAlias>\n\n/**\n * Helper function for defining a Sanity type definition. This function does not do anything on its own;\n * it exists to check that your schema definition is correct, and help autocompletion in your IDE.\n *\n * This function will narrow the schema type down to fields and options based on the provided type-string.\n *\n * Schema types defined using `defineType` should typically be added to the Studio config under `schema.types`.\n * Defined types can be referenced by their `name`. This is referred to as a type-alias.\n *\n * When using type-aliases as `type`, `defineType` cannot know the base-type, so type-safety will be reduced.\n * If you know the base type of the type-alias, provide `defineOptions.aliasFor: <base type name>`.\n * This will enforce that the schema definition conforms with the provided type.\n *\n * By default, `defineType` only allows known properties and options.\n * Use `defineOptions.strict: false` to allow unknown properties and options.\n *\n * ### Basic usage\n *\n * ```ts\n * defineType({\n * type: 'object',\n * name: 'custom-object',\n * fields: [ {type: 'string', name: 'title', title: 'Title'}],\n * })\n * ```\n *\n * ### Usage with aliasFor narrowing\n *\n * ```ts\n * defineType({\n * type: 'custom-object',\n * name: 'redefined-custom-object',\n * options: {\n * columns: 2\n * }\n * }, {aliasFor: 'object' })\n * ```\n *\n * ### Allow unknown properties\n *\n * ```ts\n * defineType({\n * type: 'custom-object',\n * name: 'redefined-custom-object',\n * allowsUnknownProperties: true\n * options: {\n * columns: 2,\n * allowsUnknownOptions: true\n * }\n * }, {strict: false})\n * ```\n * ### Maximum safety and best autocompletion\n *\n * Use {@link defineType}, {@link defineField} and {@link defineArrayMember}:\n *\n * ```ts\n * defineType({\n * type: 'object',\n * name: 'custom-object',\n * fields: [\n * defineField({\n * type: 'array',\n * name: 'arrayField',\n * title: 'Things',\n * of: [\n * defineArrayMember({\n * type: 'object',\n * name: 'type-name-in-array',\n * fields: [defineField({type: 'string', name: 'title', title: 'Title'})],\n * }),\n * ],\n * }),\n * ],\n * })\n * ```\n *\n * ## Note on type-safety in the current implementation\n *\n * Type-safety inside array-like properties (schema properties like `fields` and `of`) can only be guaranteed when\n * {@link defineField} and {@link defineArrayMember} are used to wrap each value in the array.\n *\n * For array-values without a function-wrapper, TypeScript will resolve to a union type of all possible properties across\n * all schema types. This result in less precise typing.\n *\n * ### Extending the Sanity Schema types\n *\n * If you want to extend the Sanity Schema types with your own properties or options to make them typesafe,\n * you can use [TypeScript declaration merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html).\n *\n * With declaration merging, properties and options will be available in a type-safe manner, and\n * `strict: false` will not be necessary.\n *\n * #### Example: Add option to StringOptions\n *\n * ```ts\n * // string.ts\n *\n * //redeclare the sanity module\n * declare module 'sanity' {\n * // redeclare StringOptions; it will be merged with StringOptions in the sanity module\n * export interface StringOptions {\n * myCustomOption?: boolean\n * }\n * }\n *\n * // the option is now part of the StringOptions type, just as if it was declared in the sanity codebase:\n * defineType({\n * type: 'string',\n * name: 'my-string',\n * options: {\n * myCustomOption: true // this does not give an error anymore\n * }\n * })\n *\n * ```\n *\n * #### Example: Add a schema definition to \"intrinsic-types\"\n *\n * ```ts\n * //my-custom-type-definition.ts\n *\n * // create a new schema definition based on object (we remove the ability to assign field, change the type add some options)\n * export type MagicallyAddedDefinition = Omit<Schema.ObjectDefinition, 'type' | 'fields'> & {\n * type: 'magically-added-type'\n * options?: {\n * sparkles?: boolean\n * }\n * }\n *\n * // redeclares sanity module so we can add interfaces props to it\n * declare module 'sanity' {\n * // redeclares IntrinsicDefinitions and adds a named definition to it\n * // it is important that the key is the same as the type in the definition ('magically-added-type')\n * export interface IntrinsicDefinitions {\n * 'magically-added-type': MagicallyAddedDefinition\n * }\n * }\n *\n * // defineType will now narrow `type: 'magically-added-type'` to `MagicallyAddedDefinition`\n * defineType({\n * type: 'magically-added-type'\n * name: 'magic',\n * options: {\n * sparkles: true // this is allowed,\n * //@ts-expect-error this is not allowed in MagicallyAddedDefinition.options\n * sparks: true\n * }\n * })\n * ```\n *\n * @param schemaDefinition - should be a valid schema type definition.\n * @param defineOptions - optional param to provide type hints for `schemaDefinition`.\n *\n * @see defineField\n * @see defineArrayMember\n * @see typed\n *\n * @beta\n */\nexport declare function defineType<\n const TType extends IntrinsicTypeName | AutocompleteString,\n const TName extends string,\n TSelect extends Record<string, string> | undefined,\n TPrepareValue extends Record<keyof TSelect, any> | undefined,\n TAlias extends IntrinsicTypeName | undefined,\n TStrict extends StrictDefinition,\n>(\n schemaDefinition: {\n type: TType\n name: TName\n } & DefineSchemaBase<TType, TAlias> &\n NarrowPreview<TType, TAlias, TSelect, TPrepareValue> &\n MaybeAllowUnknownProps<TStrict>,\n defineOptions?: DefineSchemaOptions<TStrict, TAlias>,\n): typeof schemaDefinition\n\n/** @internal */\nexport declare interface DeleteMutation {\n delete: MutationSelection\n}\n\n/** @public */\nexport declare interface DeprecatedProperty {\n reason: string\n}\n\n/** @public */\nexport declare type DeprecatedSchemaType<TSchemaType extends BaseSchemaType = BaseSchemaType> =\n TSchemaType & DeprecationConfiguration\n\n/**\n * @public\n */\nexport declare interface DeprecationConfiguration {\n deprecated: DeprecatedProperty\n}\n\n/** @public */\nexport declare interface DocumentDefinition extends Omit<ObjectDefinition, 'type'> {\n type: 'document'\n liveEdit?: boolean\n /** @beta */\n orderings?: SortOrdering[]\n options?: DocumentOptions\n validation?: ValidationBuilder<DocumentRule, SanityDocument>\n initialValue?: InitialValueProperty<any, Record<string, unknown>>\n /** @deprecated Unused. Use the new field-level search config. */\n __experimental_search?: {\n path: string\n weight: number\n mapWith?: string\n }[]\n /** @alpha */\n __experimental_omnisearch_visibility?: boolean\n /**\n * Determines whether the large preview title is displayed in the document pane form\n * @alpha\n * */\n __experimental_formPreviewTitle?: boolean\n}\n\n/**\n * This exists only to allow for extensions using declaration-merging.\n *\n * @public\n */\nexport declare interface DocumentOptions extends BaseSchemaTypeOptions {}\n\n/** @public */\nexport declare interface DocumentRule extends RuleDef<DocumentRule, SanityDocument> {}\n\n/** @public */\nexport declare interface EmailDefinition extends BaseSchemaDefinition {\n type: 'email'\n options?: EmailOptions\n placeholder?: string\n validation?: ValidationBuilder<EmailRule, string>\n initialValue?: InitialValueProperty<any, string>\n}\n\n/** @public */\nexport declare interface EmailOptions extends BaseSchemaTypeOptions {}\n\n/** @public */\nexport declare interface EmailRule extends RuleDef<EmailRule, string> {}\n\n/** @public */\nexport declare interface EmptyProps {}\n\n/** @public */\nexport declare interface EnumListProps<V = unknown> {\n list?: Array<TitledListValue<V> | V>\n layout?: 'radio' | 'dropdown'\n direction?: 'horizontal' | 'vertical'\n}\n\n/**\n * The shape of a field definition. Note, it's recommended to use the\n * `defineField` function instead of using this type directly.\n *\n * Where `defineField` infers the exact field type,\n * FieldDefinition is a compromise union of all types a field can have.\n *\n * A field definition can be a reference to another registered top-level type\n * or a inline type definition.\n *\n * @public\n */\nexport declare type FieldDefinition<\n TType extends IntrinsicTypeName = IntrinsicTypeName,\n TAlias extends IntrinsicTypeName | undefined = undefined,\n> = (InlineFieldDefinition[TType] | TypeAliasDefinition<string, TAlias>) & FieldDefinitionBase\n\n/** @public */\nexport declare interface FieldDefinitionBase {\n fieldset?: string\n group?: string | string[]\n}\n\n/** @public */\nexport declare interface FieldGroup {\n name: string\n icon?: ComponentType\n title?: string\n description?: string\n i18n?: I18nTextRecord<'title'>\n hidden?: ConditionalProperty\n default?: boolean\n fields?: ObjectField[]\n}\n\n/** @public */\nexport declare type FieldGroupDefinition = {\n name: string\n title?: string\n hidden?: ConditionalProperty\n icon?: ComponentType\n default?: boolean\n i18n?: I18nTextRecord<'title'>\n}\n\n/**\n * Holds a reference to a different field\n * NOTE: Only use this through {@link Rule.valueOfField}\n *\n * @public\n */\nexport declare interface FieldReference {\n type: symbol\n path: string | string[]\n}\n\n/** @public */\nexport declare type FieldRules = {\n [fieldKey: string]: SchemaValidationValue\n}\n\n/** @public */\nexport declare type Fieldset = SingleFieldSet | MultiFieldSet\n\n/** @public */\nexport declare type FieldsetDefinition = {\n name: string\n title?: string\n description?: string\n group?: string\n hidden?: ConditionalProperty\n readOnly?: ConditionalProperty\n options?: ObjectOptions\n}\n\n/** @public */\ndeclare interface File_2 {\n [key: string]: unknown\n asset?: Reference\n}\nexport {File_2 as File}\n\n/** @public */\nexport declare interface FileAsset extends Asset {\n _type: 'sanity.fileAsset'\n metadata: Record<string, unknown>\n}\n\n/** @public */\nexport declare interface FileDefinition extends Omit<\n ObjectDefinition,\n 'type' | 'fields' | 'options' | 'groups' | 'validation'\n> {\n type: 'file'\n fields?: ObjectDefinition['fields']\n options?: FileOptions\n validation?: ValidationBuilder<FileRule, FileValue>\n initialValue?: InitialValueProperty<any, FileValue>\n}\n\n/** @public */\nexport declare interface FileOptions extends ObjectOptions {\n storeOriginalFilename?: boolean\n accept?: string\n sources?: AssetSource[]\n mediaLibrary?: MediaLibraryOptions\n}\n\n/** @public */\nexport declare interface FileRule extends RuleDef<FileRule, FileValue> {\n /**\n * Require a file field has an asset.\n *\n * @example\n * ```ts\n * defineField({\n * name: 'file',\n * title: 'File',\n * type: 'file',\n * validation: (Rule) => Rule.required().assetRequired(),\n * })\n * ```\n */\n assetRequired(): FileRule\n}\n\n/** @public */\nexport declare interface FileSchemaType extends Omit<ObjectSchemaType, 'options'> {\n options?: FileOptions\n}\n\n/** @public */\nexport declare interface FileValue {\n asset?: Reference\n [index: string]: unknown\n}\n\n/** @public */\nexport declare interface FormNodeValidation {\n level: 'error' | 'warning' | 'info'\n message: string\n path: Path\n}\n\n/** @public */\nexport declare interface GeopointDefinition extends BaseSchemaDefinition {\n type: 'geopoint'\n options?: GeopointOptions\n validation?: ValidationBuilder<GeopointRule, GeopointValue>\n initialValue?: InitialValueProperty<any, Omit<GeopointValue, '_type'>>\n}\n\n/** @public */\nexport declare interface GeopointOptions extends BaseSchemaTypeOptions {}\n\n/** @public */\nexport declare interface GeopointRule extends RuleDef<GeopointRule, GeopointValue> {}\n\n/**\n * Geographical point representing a pair of latitude and longitude coordinates,\n * stored as degrees, in the World Geodetic System 1984 (WGS 84) format. Also\n * includes an optional `alt` property representing the altitude in meters.\n *\n * @public\n */\nexport declare interface GeopointValue {\n /**\n * Type of the object. Must be `geopoint`.\n */\n _type: 'geopoint'\n /**\n * Latitude in degrees\n */\n lat: number\n /**\n * Longitude in degrees\n */\n lng: number\n /**\n * Altitude in meters\n */\n alt?: number\n}\n\n/** @public */\nexport declare interface GlobalDocumentReferenceDefinition extends BaseSchemaDefinition {\n type: 'globalDocumentReference'\n weak?: boolean\n to: {\n type: string\n title?: string\n icon?: ComponentType\n preview?: PreviewConfig\n }[]\n resourceType: string\n resourceId: string\n options?: ReferenceOptions\n studioUrl?: string | ((document: {id: string; type?: string}) => string | null)\n}\n\n/** @beta */\nexport declare type GlobalDocumentReferenceFilterResolver = (options: {\n document: SanityDocument\n parent?: Record<string, unknown> | Record<string, unknown>[]\n parentPath: Path\n}) =>\n | GlobalDocumentReferenceFilterSearchOptions\n | Promise<GlobalDocumentReferenceFilterSearchOptions>\n\n/** @beta */\nexport declare type GlobalDocumentReferenceFilterSearchOptions = {\n filter?: string\n params?: Record<string, unknown>\n tag?: string\n}\n\n/** @beta */\nexport declare interface GlobalDocumentReferenceSchemaType extends Omit<\n ObjectSchemaType,\n 'options'\n> {\n jsonType: 'object'\n to: GlobalDocumentReferenceType[]\n resourceType: string\n resourceId: string\n studioUrl?: string | ((document: {id: string; type?: string}) => string | null)\n weak?: boolean\n options?: ReferenceFilterOptions\n}\n\n/** @beta */\nexport declare interface GlobalDocumentReferenceType {\n type: string\n title?: string\n icon: ComponentType\n preview: PreviewConfig\n /** @deprecated Unused. It's only here for the type to be compatible with createSearchQuery.ts */\n __experimental_search: never\n}\n\n/** @beta */\nexport declare interface GlobalDocumentReferenceValue {\n _type: string\n /** The reference to the document. This is a string of the form `a:b:c`,\n * where:\n * - `a` is the resource type, for example `dataset` or `media-library`\n * - `b` is the resource ID, for example data set name or media library ID\n * - `c` is the document ID */\n _ref: `${string}:${string}:${string}`\n _key?: string\n _weak?: boolean\n}\n\n/** @public */\nexport declare interface HotspotOptions {\n previews?: HotspotPreview[]\n}\n\n/** @public */\nexport declare interface HotspotPreview {\n title: string\n aspectRatio: number\n}\n\n/** @public */\nexport declare type I18nTextRecord<K extends string> = {\n [P in K]?: {\n key: string\n ns: string\n }\n}\n\n/** @public */\nexport declare interface I18nTitledListValue<V = unknown> {\n _key?: string\n title: string\n i18nTitleKey?: string\n value?: V\n}\n\n/** @public */\ndeclare interface Image_2 {\n [key: string]: unknown\n asset?: Reference\n crop?: ImageCrop\n hotspot?: ImageHotspot\n}\nexport {Image_2 as Image}\n\n/** @public */\nexport declare interface ImageAsset extends Asset {\n _type: 'sanity.imageAsset'\n metadata: ImageMetadata\n}\n\n/** @public */\nexport declare interface ImageCrop {\n _type?: 'sanity.imageCrop'\n left: number\n bottom: number\n right: number\n top: number\n}\n\n/** @public */\nexport declare interface ImageDefinition extends Omit<\n ObjectDefinition,\n 'type' | 'fields' | 'options' | 'groups' | 'validation'\n> {\n type: 'image'\n fields?: FieldDefinition[]\n options?: ImageOptions\n validation?: ValidationBuilder<ImageRule, ImageValue>\n initialValue?: InitialValueProperty<any, ImageValue>\n}\n\n/** @public */\nexport declare interface ImageDimensions {\n _type: 'sanity.imageDimensions'\n height: number\n width: number\n aspectRatio: number\n}\n\n/** @public */\nexport declare interface ImageHotspot {\n _type?: 'sanity.imageHotspot'\n width: number\n height: number\n x: number\n y: number\n}\n\n/** @public */\nexport declare interface ImageMetadata {\n [key: string]: unknown\n _type: 'sanity.imageMetadata'\n dimensions: ImageDimensions\n palette?: ImagePalette\n lqip?: string\n blurHash?: string\n hasAlpha: boolean\n isOpaque: boolean\n}\n\n/** @public */\nexport declare type ImageMetadataType =\n | 'blurhash'\n | 'lqip'\n | 'palette'\n | 'exif'\n | 'image'\n | 'location'\n\n/** @public */\nexport declare interface ImageOptions extends FileOptions {\n metadata?: ImageMetadataType[]\n hotspot?: boolean | HotspotOptions\n}\n\n/** @public */\nexport declare interface ImagePalette {\n _type: 'sanity.imagePalette'\n darkMuted?: ImageSwatch\n darkVibrant?: ImageSwatch\n dominant?: ImageSwatch\n lightMuted?: ImageSwatch\n lightVibrant?: ImageSwatch\n muted?: ImageSwatch\n vibrant?: ImageSwatch\n}\n\n/** @public */\nexport declare interface ImageRule extends RuleDef<ImageRule, ImageValue> {\n /**\n * Require an image field has an asset.\n *\n * @example\n * ```ts\n * defineField({\n * name: 'image',\n * title: 'Image',\n * type: 'image',\n * validation: (Rule) => Rule.required().assetRequired(),\n * })\n * ```\n */\n assetRequired(): ImageRule\n}\n\n/** @public */\nexport declare interface ImageSchemaType extends Omit<ObjectSchemaType, 'options'> {\n options?: ImageOptions\n}\n\n/** @public */\nexport declare interface ImageSwatch {\n _type: 'sanity.imagePaletteSwatch'\n background: string\n foreground: string\n population: number\n title?: string\n}\n\n/** @internal */\nexport declare type ImageUrlAutoMode = 'format'\n\n/** @internal */\nexport declare type ImageUrlCropMode =\n | 'top'\n | 'bottom'\n | 'left'\n | 'right'\n | 'center'\n | 'focalpoint'\n | 'entropy'\n\n/** @internal */\nexport declare type ImageUrlFitMode = 'clip' | 'crop' | 'fill' | 'fillmax' | 'max' | 'scale' | 'min'\n\n/** @internal */\nexport declare type ImageUrlFormat = 'jpg' | 'pjpg' | 'png' | 'webp'\n\n/** @internal */\nexport declare type ImageUrlOrientation = '0' | '90' | '180' | '270'\n\n/**\n * NOTE: These are query parameters, so they will eventually be encoded as strings.\n * However, since most/all query parameter encoders will accept numbers and encode\n * them as strings, we'll use `string| number` where applicable, as it makes it easier\n * to use in places that do calculations and such.\n *\n * @internal\n */\nexport declare interface ImageUrlParams {\n 'bg'?: string\n 'dpr'?: number | string\n 'w'?: number | string\n 'h'?: number | string\n 'q'?: number | string\n 'dl'?: string\n 'dlRaw'?: string\n 'fp-x'?: number | string\n 'fp-y'?: number | string\n 'max-w'?: number | string\n 'max-h'?: number | string\n 'min-w'?: number | string\n 'min-h'?: number | string\n 'blur'?: number | string\n 'sharp'?: number | string\n 'rect'?: string\n 'fm'?: ImageUrlFormat\n 'or'?: ImageUrlOrientation\n 'fit'?: ImageUrlFitMode\n 'crop'?: ImageUrlCropMode\n 'auto'?: ImageUrlAutoMode\n 'invert'?: 'true' | 'false'\n 'quality'?: number | string\n 'flip'?: 'h' | 'v' | 'hv'\n 'sat'?: number | string\n 'pad'?: number | string\n 'colorquant'?: number | string\n 'border'?: string\n}\n\n/** @public */\nexport declare interface ImageValue extends FileValue {\n crop?: ImageCrop\n hotspot?: ImageHotspot\n [index: string]: unknown\n}\n\n/** @public */\nexport declare type IndexTuple = [number | '', number | '']\n\n/** @public */\nexport declare type InitialValueProperty<Params, Value> =\n | Value\n | InitialValueResolver<Params, Value>\n | undefined\n\n/** @public */\nexport declare type InitialValueResolver<Params, Value> = (\n params: Params | undefined,\n context: InitialValueResolverContext,\n) => Promise<Value> | Value\n\n/** @public */\nexport declare interface InitialValueResolverContext {\n projectId: string\n dataset: string\n schema: Schema\n currentUser: CurrentUser | null\n getClient: (options: {apiVersion: string}) => SanityClient\n}\n\n/** @public */\nexport declare type InlineFieldDefinition = {\n [K in keyof IntrinsicDefinitions]: Omit<\n IntrinsicDefinitions[K],\n 'initialValue' | 'validation'\n > & {\n validation?: SchemaValidationValue\n initialValue?: InitialValueProperty<any, any>\n }\n}\n\n/** @alpha This API may change */\nexport declare interface InsertMenuOptions {\n /**\n * @defaultValue `'auto'`\n * `filter: 'auto'` automatically turns on filtering if there are more than 5\n * schema types added to the menu.\n */\n filter?: 'auto' | boolean | undefined\n groups?:\n | Array<{\n name: string\n title?: string\n of?: Array<string>\n }>\n | undefined\n /** defaultValue `true` */\n showIcons?: boolean | undefined\n /** @defaultValue `[{name: 'list'}]` */\n views?:\n | Array<\n | {\n name: 'list'\n }\n | {\n name: 'grid'\n previewImageUrl?: (schemaTypeName: string) => string | undefined\n }\n >\n | undefined\n}\n\n/** @internal */\nexport declare type InsertPatch =\n | {\n before: string\n items: unknown[]\n }\n | {\n after: string\n items: unknown[]\n }\n | {\n replace: string\n items: unknown[]\n }\n\n/** @beta */\nexport declare type IntrinsicArrayOfBase = {\n [K in keyof IntrinsicDefinitions]: Omit<ArrayOfEntry<IntrinsicDefinitions[K]>, 'preview'>\n}\n\n/** @public */\nexport declare type IntrinsicArrayOfDefinition = {\n [K in keyof IntrinsicDefinitions]: Omit<\n ArrayOfEntry<IntrinsicDefinitions[K]>,\n 'validation' | 'initialValue'\n > & {\n validation?: SchemaValidationValue\n initialValue?: InitialValueProperty<any, any>\n }\n}\n\n/** @beta */\nexport declare type IntrinsicBase = {\n [K in keyof IntrinsicDefinitions]: Omit<IntrinsicDefinitions[K], 'preview'>\n}\n\n/**\n * `IntrinsicDefinitions` is a lookup map for \"predefined\" schema definitions.\n * Schema types in `IntrinsicDefinitions` will have good type-completion and type-safety in {@link defineType},\n * {@link defineField} and {@link defineArrayMember} once the `type` property is provided.\n *\n * By default, `IntrinsicDefinitions` contains all standard Sanity schema types (`array`, `string`, `number` ect),\n * but it is an interface and as such, open for extension.\n *\n * This type can be extended using declaration merging; this way new entries can be added.\n * See {@link defineType} for examples on how this can be accomplished.\n *\n * @see defineType\n *\n * @public\n */\nexport declare interface IntrinsicDefinitions {\n array: ArrayDefinition\n block: BlockDefinition\n boolean: BooleanDefinition\n date: DateDefinition\n datetime: DatetimeDefinition\n document: DocumentDefinition\n file: FileDefinition\n geopoint: GeopointDefinition\n image: ImageDefinition\n number: NumberDefinition\n object: ObjectDefinition\n reference: ReferenceDefinition\n crossDatasetReference: CrossDatasetReferenceDefinition\n globalDocumentReference: GlobalDocumentReferenceDefinition\n slug: SlugDefinition\n string: StringDefinition\n text: TextDefinition\n url: UrlDefinition\n email: EmailDefinition\n}\n\n/**\n * A union of all intrinsic types allowed natively in the schema.\n *\n * @see IntrinsicDefinitions\n *\n * @public\n */\nexport declare type IntrinsicTypeName = IntrinsicDefinitions[keyof IntrinsicDefinitions]['type']\n\n/** @internal */\nexport declare function isArrayOfBlocksSchemaType(\n type: unknown,\n): type is ArraySchemaType<ObjectSchemaType>\n\n/** @internal */\nexport declare function isArrayOfObjectsSchemaType(\n type: unknown,\n): type is ArraySchemaType<ObjectSchemaType>\n\n/** @internal */\nexport declare function isArrayOfPrimitivesSchemaType(type: unknown): type is ArraySchemaType\n\n/** @internal */\nexport declare function isArraySchemaType(type: unknown): type is ArraySchemaType\n\n/**\n * Check whether the provided value resembles a Media Library asset aspect document.\n *\n * Note: This function does not perform a comprehensive check.\n *\n * @see validateMediaLibraryAssetAspect\n *\n * @internal\n */\nexport declare function isAssetAspect(\n maybeAssetAspect: unknown,\n): maybeAssetAspect is MediaLibraryAssetAspectDocument\n\n/** @internal */\nexport declare function isBlockChildrenObjectField(\n field: unknown,\n): field is BlockChildrenObjectField\n\n/** @internal */\nexport declare function isBlockListObjectField(field: unknown): field is BlockListObjectField\n\n/** @internal */\nexport declare function isBlockSchemaType(type: unknown): type is BlockSchemaType\n\n/** @internal */\nexport declare function isBlockStyleObjectField(field: unknown): field is BlockStyleObjectField\n\n/** @internal */\nexport declare function isBooleanSchemaType(type: unknown): type is BooleanSchemaType\n\n/** @internal */\nexport declare function isCreateIfNotExistsMutation(\n mutation: Mutation | TransactionLogMutation,\n): mutation is CreateIfNotExistsMutation\n\n/** @internal */\nexport declare function isCreateMutation(\n mutation: Mutation | TransactionLogMutation,\n): mutation is CreateMutation\n\n/** @internal */\nexport declare function isCreateOrReplaceMutation(\n mutation: Mutation | TransactionLogMutation,\n): mutation is CreateOrReplaceMutation\n\n/** @internal */\nexport declare function isCreateSquashedMutation(\n mutation: Mutation | TransactionLogMutation,\n): mutation is CreateSquashedMutation\n\n/** @beta */\nexport declare function isCrossDatasetReference(\n reference: unknown,\n): reference is CrossDatasetReferenceValue\n\n/** @internal */\nexport declare function isCrossDatasetReferenceSchemaType(\n type: unknown,\n): type is CrossDatasetReferenceSchemaType\n\n/** @internal */\nexport declare function isDateTimeSchemaType(type: unknown): type is StringSchemaType\n\n/** @internal */\nexport declare function isDeleteMutation(\n mutation: Mutation | TransactionLogMutation,\n): mutation is DeleteMutation\n\n/** @internal */\nexport declare function isDeprecatedSchemaType<TSchemaType extends BaseSchemaType>(\n type: TSchemaType,\n): type is DeprecatedSchemaType<TSchemaType>\n\n/** @internal */\nexport declare function isDeprecationConfiguration(type: unknown): type is DeprecationConfiguration\n\n/**\n * Returns wether or not the given type is a document type\n * (eg that it was defined as `type: 'document'`)\n *\n * @param type - Schema type to test\n * @returns True if type is a document type, false otherwise\n *\n * @public\n */\nexport declare function isDocumentSchemaType(type: unknown): type is ObjectSchemaType\n\n/** @internal */\nexport declare function isFileSchemaType(type: unknown): type is FileSchemaType\n\n/** @beta */\nexport declare function isGlobalDocumentReference(\n reference: unknown,\n): reference is GlobalDocumentReferenceValue\n\n/** @public */\nexport declare function isImage(value: unknown): value is Image_2\n\n/** @internal */\nexport declare function isImageSchemaType(type: unknown): type is ImageSchemaType\n\n/** @internal */\nexport declare function isIndexSegment(segment: PathSegment): segment is number\n\n/** @internal */\nexport declare function isIndexTuple(segment: PathSegment): segment is IndexTuple\n\n/** @public */\nexport declare function isKeyedObject(obj: unknown): obj is KeyedObject\n\n/** @internal */\nexport declare function isKeySegment(segment: PathSegment): segment is KeyedSegment\n\n/** @internal */\nexport declare function isNumberSchemaType(type: unknown): type is NumberSchemaType\n\n/** @internal */\nexport declare function isObjectSchemaType(type: unknown): type is ObjectSchemaType\n\n/** @internal */\nexport declare function isPatchMutation(\n mutation: Mutation | TransactionLogMutation,\n): mutation is PatchMutation\n\n/**\n * Assert that a given object is a portable-text list-text-block-type object\n *\n * @remarks\n * Uses `isPortableTextTextBlock` and checks for `listItem` and `level`\n *\n * @see isPortableTextTextBlock\n *\n * @alpha\n */\nexport declare function isPortableTextListBlock<T = PortableTextSpan | PortableTextObject>(\n value: unknown,\n): value is PortableTextTextBlock<T>\n\n/**\n * Assert that a given object is a portable-text span-type object\n *\n * @remarks\n * The `marks` property of a block is optional.\n *\n * @alpha\n */\nexport declare function isPortableTextSpan(value: unknown): value is PortableTextSpan\n\n/**\n * Assert that a given object is a portable-text text-block type object\n *\n * @remarks\n * * The `markDefs` and `style` property of a block is optional.\n * * Block types can be named, so expect anything of the _type property.\n *\n * @alpha\n */\nexport declare function isPortableTextTextBlock<T = PortableTextSpan | PortableTextObject>(\n value: unknown,\n): value is PortableTextTextBlock<T>\n\n/** @internal */\nexport declare function isPrimitiveSchemaType(\n type: unknown,\n): type is BooleanSchemaType | StringSchemaType | NumberSchemaType\n\n/** @internal */\nexport declare function isReference(reference: unknown): reference is Reference\n\n/** @internal */\nexport declare function isReferenceSchemaType(type: unknown): type is ReferenceSchemaType\n\n/** @public */\nexport declare function isSanityDocument(document: unknown): document is SanityDocument\n\n/**\n * @internal\n */\nexport declare function isSearchStrategy(\n maybeSearchStrategy: unknown,\n): maybeSearchStrategy is SearchStrategy\n\n/**\n * Checks whether the given `thing` is a slug, eg an object with a `current` string property.\n *\n * @param thing - The thing to check\n * @returns True if slug, false otherwise\n * @public\n */\nexport declare function isSlug(thing: unknown): thing is Slug\n\n/** @internal */\nexport declare function isSpanSchemaType(type: unknown): type is SpanSchemaType\n\n/** @internal */\nexport declare function isStringSchemaType(type: unknown): type is StringSchemaType\n\n/** @internal */\nexport declare function isTitledListValue(item: unknown): item is TitledListValue\n\n/** @public */\nexport declare function isTypedObject(obj: unknown): obj is TypedObject\n\n/** @internal */\nexport declare function isValidationError(node: FormNodeValidation): node is FormNodeValidation & {\n level: 'error'\n}\n\n/** @internal */\nexport declare function isValidationErrorMarker(\n marker: ValidationMarker,\n): marker is ValidationMarker & {\n level: 'error'\n}\n\n/** @internal */\nexport declare function isValidationInfo(node: FormNodeValidation): node is FormNodeValidation & {\n level: 'info'\n}\n\n/** @internal */\nexport declare function isValidationInfoMarker(\n marker: ValidationMarker,\n): marker is ValidationMarker & {\n level: 'info'\n}\n\n/** @internal */\nexport declare function isValidationWarning(\n node: FormNodeValidation,\n): node is FormNodeValidation & {\n level: 'warning'\n}\n\n/** @internal */\nexport declare function isValidationWarningMarker(\n marker: ValidationMarker,\n): marker is ValidationMarker & {\n level: 'warning'\n}\n\n/** @public */\nexport declare interface KeyedObject {\n [key: string]: unknown\n _key: string\n}\n\n/** @public */\nexport declare type KeyedSegment = {\n _key: string\n}\n\n/**\n * Holds localized validation messages for a given field.\n *\n * @example Custom message for English (US) and Norwegian (Bokmål):\n * ```\n * {\n * 'en-US': 'Needs to start with a capital letter',\n * 'no-NB': 'Må starte med stor bokstav',\n * }\n * ```\n * @public\n */\nexport declare interface LocalizedValidationMessages {\n [locale: string]: string\n}\n\n/** @beta */\nexport declare type MaybeAllowUnknownProps<TStrict extends StrictDefinition> = TStrict extends false\n ? {\n options?: {\n [index: string]: any\n }\n [index: string]: any\n }\n : unknown\n\n/** @beta */\nexport declare type MaybePreview<\n Select extends Record<string, string> | undefined,\n PrepareValue extends Record<keyof Select, any> | undefined,\n> =\n Select extends Record<string, string>\n ? PrepareValue extends Record<keyof Select, any>\n ? PreviewConfig<Select, PrepareValue>\n : never\n : never\n\n/**\n * @public\n */\nexport declare const MEDIA_LIBRARY_ASSET_ASPECT_TYPE_NAME = 'sanity.asset.aspect'\n\n/** @public */\nexport declare type MediaAssetTypes = AssetInstanceDocument['_type']\n\n/**\n * @public\n */\nexport declare type MediaLibraryAssetAspectDefinition =\n MediaLibraryAssetAspectSupportedFieldDefinitions & {\n assetType?: MediaLibraryAssetType | MediaLibraryAssetType[]\n public?: boolean\n }\n\n/**\n * A document representing a Media Library asset aspect.\n *\n * Each aspect provides a schema describing custom data that can be assigned to assets.\n *\n * @public\n */\nexport declare interface MediaLibraryAssetAspectDocument extends SanityDocumentLike {\n _type: MediaLibraryAssetAspectTypeName\n /**\n * Asset types the aspect can be assigned to.\n *\n * If no `assetType` is defined, the aspect may be assigned to any asset type.\n */\n assetType?: MediaLibraryAssetType[]\n definition: FieldDefinition\n public?: boolean\n}\n\n/**\n * @public\n */\nexport declare type MediaLibraryAssetAspectSupportedFieldDefinitions = FieldDefinition<\n Exclude<IntrinsicTypeName, 'document' | 'image' | 'file' | 'reference' | 'crossDatasetReference'>\n>\n\n/**\n * @public\n */\nexport declare type MediaLibraryAssetAspectTypeName = typeof MEDIA_LIBRARY_ASSET_ASPECT_TYPE_NAME\n\n/**\n * @public\n */\nexport declare type MediaLibraryAssetType = ImageAsset['_type'] | FileAsset['_type']\n\n/** @public */\nexport declare interface MediaLibraryFilter {\n name: string\n query: string\n}\n\n/** @public */\nexport declare interface MediaLibraryOptions {\n filters?: MediaLibraryFilter[]\n}\n\n/** @public */\nexport declare interface MediaValidationValue<T extends MediaAssetTypes = MediaAssetTypes> {\n /**\n * Media information\n */\n media: {\n /**\n * The Media Library Asset.\n */\n asset: Asset_2 & {\n currentVersion: Extract<\n AssetInstanceDocument,\n {\n _type: T\n }\n >\n }\n }\n /**\n * The field value which the media is used in.\n */\n value: unknown\n}\n\n/** @public */\nexport declare interface MediaValidator<T extends MediaAssetTypes = MediaAssetTypes> {\n (\n value: MediaValidationValue<T>,\n context: ValidationContext,\n ): CustomValidatorResult | Promise<CustomValidatorResult>\n}\n\n/**\n * A pair of mendoza patches that can either be _applied_ (to perform the effect),\n * or _reverted_ (to undo the effect). Requires the exact, previous version of the\n * document when applying - any difference might have unexpected consequences.\n *\n * @internal\n */\nexport declare interface MendozaEffectPair {\n apply: MendozaPatch\n revert: MendozaPatch\n}\n\n/**\n * A mendoza patch. These are not human-readable patches, but are optimized to\n * take as little space as possible, while still being represented by plain JSON.\n * See {@link https://www.sanity.io/blog/mendoza}\n *\n * @internal\n */\nexport declare type MendozaPatch = unknown[]\n\n/** @public */\nexport declare interface MultiFieldSet {\n name: string\n title?: string\n description?: string\n single?: false\n group?: string | string[]\n options?: CollapseOptions & {\n columns?: number\n }\n fields: ObjectField[]\n hidden?: ConditionalProperty\n readOnly?: ConditionalProperty\n}\n\n/** @internal */\nexport declare interface MultipleMutationResult {\n transactionId: string\n documentIds: string[]\n results: {\n id: string\n }[]\n}\n\n/** @internal */\nexport declare type Mutation =\n | CreateMutation\n | CreateOrReplaceMutation\n | CreateIfNotExistsMutation\n | DeleteMutation\n | PatchMutation\n\n/** @internal */\nexport declare type MutationOperationName =\n | 'create'\n | 'createOrReplace'\n | 'createIfNotExists'\n | 'delete'\n | 'patch'\n\n/** @internal */\nexport declare type MutationSelection =\n | {\n query: string\n params?: Record<string, unknown>\n }\n | {\n id: string\n }\n\n/** @beta */\nexport declare type NarrowPreview<\n TType extends string,\n TAlias extends IntrinsicTypeName | undefined,\n TSelect extends Record<string, string> | undefined,\n TPrepareValue extends Record<keyof TSelect, any> | undefined,\n> =\n DefineSchemaType<TType, TAlias> extends {\n preview?: Record<string, any>\n }\n ? {\n preview?: MaybePreview<TSelect, TPrepareValue>\n }\n : unknown\n\n/** @public */\nexport declare interface NumberDefinition extends BaseSchemaDefinition {\n type: 'number'\n options?: NumberOptions\n placeholder?: string\n validation?: ValidationBuilder<NumberRule, number>\n initialValue?: InitialValueProperty<any, number>\n}\n\n/** @public */\nexport declare interface NumberOptions extends EnumListProps<number>, BaseSchemaTypeOptions {}\n\n/** @public */\nexport declare interface NumberRule extends RuleDef<NumberRule, number> {\n min: (minNumber: number | FieldReference) => NumberRule\n max: (maxNumber: number | FieldReference) => NumberRule\n lessThan: (limit: number | FieldReference) => NumberRule\n greaterThan: (limit: number | FieldReference) => NumberRule\n integer: () => NumberRule\n precision: (limit: number | FieldReference) => NumberRule\n positive: () => NumberRule\n negative: () => NumberRule\n}\n\n/** @public */\nexport declare interface NumberSchemaType extends BaseSchemaType {\n jsonType: 'number'\n options?: NumberOptions\n initialValue?: InitialValueProperty<any, number>\n}\n\n/** @public */\nexport declare interface ObjectDefinition extends BaseSchemaDefinition {\n type: 'object'\n /**\n * Object must have at least one field. This is validated at Studio startup.\n */\n fields: FieldDefinition[]\n groups?: FieldGroupDefinition[]\n fieldsets?: FieldsetDefinition[]\n preview?: PreviewConfig\n options?: ObjectOptions\n validation?: ValidationBuilder<ObjectRule, Record<string, unknown>>\n initialValue?: InitialValueProperty<any, Record<string, unknown>>\n}\n\n/** @public */\nexport declare interface ObjectField<T extends SchemaType = SchemaType> {\n name: string\n fieldset?: string\n group?: string | string[]\n type: ObjectFieldType<T>\n}\n\n/** @public */\nexport declare type ObjectFieldType<T extends SchemaType = SchemaType> = T & {\n hidden?: ConditionalProperty\n readOnly?: ConditionalProperty\n}\n\n/** @public */\nexport declare interface ObjectOptions extends BaseSchemaTypeOptions {\n collapsible?: boolean\n collapsed?: boolean\n columns?: number\n modal?: {\n type?: 'dialog' | 'popover'\n width?: number | number[] | 'auto'\n }\n}\n\n/** @public */\nexport declare interface ObjectRule extends RuleDef<ObjectRule, Record<string, unknown>> {}\n\n/** @public */\nexport declare interface ObjectSchemaType extends BaseSchemaType {\n jsonType: 'object'\n fields: ObjectField[]\n groups?: FieldGroup[]\n fieldsets?: Fieldset[]\n initialValue?: InitialValueProperty<any, Record<string, unknown>>\n weak?: boolean\n /** @deprecated Unused. Use the new field-level search config. */\n __experimental_search?: {\n path: (string | number)[]\n weight: number\n mapWith?: string\n }[]\n /** @alpha */\n __experimental_omnisearch_visibility?: boolean\n /** @alpha */\n __experimental_actions?: string[]\n /** @alpha */\n __experimental_formPreviewTitle?: boolean\n /**\n * @beta\n */\n orderings?: SortOrdering[]\n options?: any\n}\n\n/** @internal */\nexport declare interface ObjectSchemaTypeWithOptions extends Omit<ObjectSchemaType, 'options'> {\n options?: CollapseOptions & {\n columns?: number\n }\n}\n\n/** @internal */\nexport declare interface PatchMutation {\n patch: PatchMutationOperation\n}\n\n/** @internal */\nexport declare type PatchMutationOperation = PatchOperations & MutationSelection\n\n/**\n * NOTE: this is actually incorrect/invalid, but implemented as-is for backwards compatibility\n *\n * @internal\n */\nexport declare interface PatchOperations {\n set?: {\n [key: string]: unknown\n }\n setIfMissing?: {\n [key: string]: unknown\n }\n merge?: {\n [key: string]: unknown\n }\n diffMatchPatch?: {\n [key: string]: string\n }\n unset?: string[]\n inc?: {\n [key: string]: number\n }\n dec?: {\n [key: string]: number\n }\n insert?: InsertPatch\n ifRevisionID?: string\n}\n\n/** @public */\nexport declare type Path = PathSegment[]\n\n/** @public */\nexport declare type PathSegment = string | number | KeyedSegment | IndexTuple\n\n/** @alpha */\nexport declare type PortableTextBlock = PortableTextTextBlock | PortableTextObject\n\n/** @alpha */\nexport declare type PortableTextChild = PortableTextObject | PortableTextSpan\n\n/** @alpha */\nexport declare interface PortableTextListBlock extends PortableTextTextBlock {\n listItem: string\n level: number\n}\n\n/** @alpha */\nexport declare interface PortableTextObject {\n _type: string\n _key: string\n [other: string]: unknown\n}\n\n/** @alpha */\nexport declare interface PortableTextSpan {\n _key: string\n _type: 'span'\n text: string\n marks?: string[]\n}\n\n/** @alpha */\nexport declare interface PortableTextTextBlock<TChild = PortableTextSpan | PortableTextObject> {\n _type: string\n _key: string\n children: TChild[]\n markDefs?: PortableTextObject[]\n listItem?: string\n style?: string\n level?: number\n}\n\n/** @public */\nexport declare interface PrepareViewOptions {\n /** @beta */\n ordering?: SortOrdering\n}\n\n/** @public */\nexport declare interface PreviewConfig<\n Select extends Record<string, string> = Record<string, string>,\n PrepareValue extends Record<keyof Select, any> = Record<keyof Select, any>,\n> {\n select?: Select\n prepare?: (value: PrepareValue, viewOptions?: PrepareViewOptions) => PreviewValue\n}\n\n/** @public */\nexport declare interface PreviewValue {\n _id?: string\n _createdAt?: string\n _updatedAt?: string\n title?: string\n subtitle?: string\n description?: string\n media?: ReactNode | ElementType\n imageUrl?: string\n}\n\n/** @public */\nexport declare interface Reference {\n _type: string\n _ref: string\n _key?: string\n _weak?: boolean\n _strengthenOnPublish?: {\n type: string\n weak?: boolean\n template?: {\n id: string\n params: Record<string, string | number | boolean>\n }\n }\n}\n\n/** @public */\nexport declare interface ReferenceBaseOptions extends BaseSchemaTypeOptions {\n disableNew?: boolean\n}\n\n/** @public */\nexport declare interface ReferenceDefinition extends BaseSchemaDefinition {\n type: 'reference'\n to: ReferenceTo\n weak?: boolean\n options?: ReferenceOptions\n validation?: ValidationBuilder<ReferenceRule, ReferenceValue>\n initialValue?: InitialValueProperty<any, Omit<ReferenceValue, '_type'>>\n}\n\n/** @public */\nexport declare type ReferenceFilterOptions =\n | ReferenceFilterResolverOptions\n | ReferenceFilterQueryOptions\n\n/** @public */\nexport declare interface ReferenceFilterQueryOptions {\n filter: string\n filterParams?: Record<string, unknown>\n}\n\n/** @public */\nexport declare type ReferenceFilterResolver = (\n context: ReferenceFilterResolverContext,\n) => ReferenceFilterSearchOptions | Promise<ReferenceFilterSearchOptions>\n\n/** @public */\nexport declare interface ReferenceFilterResolverContext {\n document: SanityDocument\n parent?: Record<string, unknown> | Record<string, unknown>[]\n parentPath: Path\n perspective: StackablePerspective[]\n getClient: (options: {apiVersion: string}) => SanityClient\n}\n\n/** @public */\nexport declare interface ReferenceFilterResolverOptions {\n filter?: ReferenceFilterResolver\n filterParams?: never\n}\n\n/** @public */\nexport declare type ReferenceFilterSearchOptions = {\n filter?: string\n params?: Record<string, unknown>\n tag?: string\n maxFieldDepth?: number\n strategy?: SearchStrategy\n perspective?: Exclude<ClientPerspective, 'raw' | 'previewDrafts'>\n}\n\n/**\n * Types are closed for extension. To add properties via declaration merging to this type,\n * redeclare and add the properties to the interfaces that make up ReferenceOptions type.\n *\n * @see ReferenceFilterOptions\n * @see ReferenceFilterResolverOptions\n * @see ReferenceBaseOptions\n *\n * @public\n */\nexport declare type ReferenceOptions = ReferenceBaseOptions & ReferenceFilterOptions\n\n/** @public */\nexport declare interface ReferenceRule extends RuleDef<ReferenceRule, ReferenceValue> {}\n\n/** @public */\nexport declare interface ReferenceSchemaType extends Omit<ObjectSchemaType, 'options'> {\n jsonType: 'object'\n to: ObjectSchemaType[]\n weak?: boolean\n options?: ReferenceOptions\n}\n\n/** @public */\nexport declare type ReferenceTo =\n | SchemaTypeDefinition\n | TypeReference\n | Array<SchemaTypeDefinition | TypeReference>\n\n/** @public */\nexport declare type ReferenceValue = Reference\n\n/** @public */\nexport declare interface Role {\n name: string\n title: string\n description?: string\n}\n\n/** @public */\nexport declare interface Rule {\n /**\n * @internal\n * @deprecated internal use only\n */\n _type: RuleTypeConstraint | undefined\n /**\n * @internal\n * @deprecated internal use only\n */\n _level: 'error' | 'warning' | 'info' | undefined\n /**\n * @internal\n * @deprecated internal use only\n */\n _required: 'required' | 'optional' | undefined\n /**\n * @internal\n * @deprecated internal use only\n */\n _typeDef: SchemaType | undefined\n /**\n * @internal\n * @deprecated internal use only\n */\n _message: string | LocalizedValidationMessages | undefined\n /**\n * @internal\n * @deprecated internal use only\n */\n _rules: RuleSpec[]\n /**\n * @internal\n * @deprecated internal use only\n */\n _fieldRules: FieldRules | undefined\n /**\n * Takes in a path and returns an object with a symbol.\n *\n * When the validation lib sees this symbol, it will use the provided path to\n * get a value from the current field's parent and use that value as the input\n * to the Rule.\n *\n * The path that's given is forwarded to `lodash/get`\n *\n * ```js\n * fields: [\n * // ...\n * {\n * // ...\n * name: 'highestTemperature',\n * type: 'number',\n * validation: (Rule) => Rule.positive().min(Rule.valueOfField('lowestTemperature')),\n * // ...\n * },\n * ]\n * ```\n */\n valueOfField: (path: string | string[]) => FieldReference\n error(message?: string | LocalizedValidationMessages): Rule\n warning(message?: string | LocalizedValidationMessages): Rule\n info(message?: string | LocalizedValidationMessages): Rule\n reset(): this\n isRequired(): boolean\n clone(): Rule\n cloneWithRules(rules: RuleSpec[]): Rule\n merge(rule: Rule): Rule\n type(targetType: RuleTypeConstraint | Lowercase<RuleTypeConstraint>): Rule\n all(children: Rule[]): Rule\n either(children: Rule[]): Rule\n optional(): Rule\n required(): Rule\n custom<T = unknown>(\n fn: CustomValidator<T>,\n options?: {\n bypassConcurrencyLimit?: boolean\n },\n ): Rule\n media<T extends MediaAssetTypes = MediaAssetTypes>(fn: MediaValidator<T>): Rule\n min(len: number | string | FieldReference): Rule\n max(len: number | string | FieldReference): Rule\n length(len: number | FieldReference): Rule\n valid(value: unknown | unknown[]): Rule\n integer(): Rule\n precision(limit: number | FieldReference): Rule\n positive(): Rule\n negative(): Rule\n greaterThan(num: number | FieldReference): Rule\n lessThan(num: number | FieldReference): Rule\n uppercase(): Rule\n lowercase(): Rule\n regex(\n pattern: RegExp,\n name: string,\n options: {\n name?: string\n invert?: boolean\n },\n ): Rule\n regex(\n pattern: RegExp,\n options: {\n name?: string\n invert?: boolean\n },\n ): Rule\n regex(pattern: RegExp, name: string): Rule\n regex(pattern: RegExp): Rule\n email(): Rule\n uri(options?: UriValidationOptions): Rule\n unique(): Rule\n reference(): Rule\n fields(rules: FieldRules): Rule\n assetRequired(): Rule\n validate(\n value: unknown,\n options: ValidationContext & {\n /**\n * @deprecated Internal use only\n * @internal\n */\n __internal?: {\n customValidationConcurrencyLimiter?: {\n ready: () => Promise<void>\n release: () => void\n }\n }\n },\n ): Promise<ValidationMarker[]>\n}\n\n/** @public */\nexport declare type RuleBuilder<T extends RuleDef<T, FieldValue>, FieldValue = unknown> = T | T[]\n\n/**\n * Note: `RuleClass` and `Rule` are split to fit the current `@sanity/types`\n * setup. Classes are a bit weird in the `@sanity/types` package because classes\n * create an actual javascript class while simultaneously creating a type\n * definition.\n *\n * This implicitly creates two types:\n * 1. the instance type — `Rule` and\n * 2. the static/class type - `RuleClass`\n *\n * The `RuleClass` type contains the static methods and the `Rule` instance\n * contains the instance methods. Downstream in the validation package, the Rule\n * implementation asserts the class declaration is of this type.\n *\n * @internal\n */\nexport declare interface RuleClass {\n FIELD_REF: symbol\n array: (def?: SchemaType) => Rule\n object: (def?: SchemaType) => Rule\n string: (def?: SchemaType) => Rule\n number: (def?: SchemaType) => Rule\n boolean: (def?: SchemaType) => Rule\n dateTime: (def?: SchemaType) => Rule\n valueOfField: Rule['valueOfField']\n new (typeDef?: SchemaType): Rule\n}\n\n/** @public */\nexport declare interface RuleDef<T, FieldValue = unknown> {\n required: () => T\n custom: <LenientFieldValue extends FieldValue>(\n fn: CustomValidator<LenientFieldValue | undefined>,\n ) => T\n info: (message?: string | LocalizedValidationMessages) => T\n error: (message?: string | LocalizedValidationMessages) => T\n warning: (message?: string | LocalizedValidationMessages) => T\n valueOfField: (path: string | string[]) => FieldReference\n}\n\n/** @public */\nexport declare type RuleSpec =\n | {\n flag: 'integer'\n }\n | {\n flag: 'email'\n }\n | {\n flag: 'unique'\n }\n | {\n flag: 'reference'\n }\n | {\n flag: 'type'\n constraint: RuleTypeConstraint\n }\n | {\n flag: 'all'\n constraint: Rule[]\n }\n | {\n flag: 'either'\n constraint: Rule[]\n }\n | {\n flag: 'presence'\n constraint: 'optional' | 'required'\n }\n | {\n flag: 'custom'\n constraint: CustomValidator\n }\n | {\n flag: 'min'\n constraint: number | string | FieldReference\n }\n | {\n flag: 'max'\n constraint: number | string | FieldReference\n }\n | {\n flag: 'length'\n constraint: number | FieldReference\n }\n | {\n flag: 'valid'\n constraint: unknown[]\n }\n | {\n flag: 'precision'\n constraint: number | FieldReference\n }\n | {\n flag: 'lessThan'\n constraint: number | FieldReference\n }\n | {\n flag: 'greaterThan'\n constraint: number | FieldReference\n }\n | {\n flag: 'stringCasing'\n constraint: 'uppercase' | 'lowercase'\n }\n | {\n flag: 'assetRequired'\n constraint: {\n assetType: 'asset' | 'image' | 'file'\n }\n }\n | {\n flag: 'media'\n constraint: MediaValidator<any>\n }\n | {\n flag: 'regex'\n constraint: {\n pattern: RegExp\n name?: string\n invert: boolean\n }\n }\n | {\n flag: 'uri'\n constraint: {\n options: {\n scheme: RegExp[]\n allowRelative: boolean\n relativeOnly: boolean\n allowCredentials: boolean\n }\n }\n }\n\n/** @internal */\nexport declare type RuleSpecConstraint<T extends RuleSpec['flag']> = ConditionalIndexAccess<\n Extract<\n RuleSpec,\n {\n flag: T\n }\n >,\n 'constraint'\n>\n\n/** @public */\nexport declare type RuleTypeConstraint =\n | 'Array'\n | 'Boolean'\n | 'Date'\n | 'Number'\n | 'Object'\n | 'String'\n\n/**\n * Options for configuring how Sanity Create interfaces with the type or field.\n *\n * @public\n */\nexport declare interface SanityCreateOptions {\n /** Set to true to exclude a type or field from appearing in Sanity Create */\n exclude?: boolean\n /**\n * A short description of what the type or field is used for.\n * Purpose can be used to improve how and when content mapping uses the field.\n * */\n purpose?: string\n}\n\n/** @public */\nexport declare interface SanityDocument {\n _id: string\n _type: string\n _createdAt: string\n _updatedAt: string\n _rev: string\n [key: string]: unknown\n}\n\n/**\n * Similar to `SanityDocument` but only requires the `_id` and `_type`\n *\n * @see SanityDocument\n *\n * @public\n */\nexport declare interface SanityDocumentLike {\n _id: string\n _type: string\n _createdAt?: string\n _updatedAt?: string\n _rev?: string\n _system?: {\n delete?: boolean\n }\n [key: string]: unknown\n}\n\n/** @public */\nexport declare interface Schema {\n /** @internal */\n _original?: {\n name: string\n types: SchemaTypeDefinition[]\n }\n /** @internal */\n _registry: {\n [typeName: string]: any\n }\n /** @internal */\n _validation?: SchemaValidationProblemGroup[]\n name: string\n get: (name: string) => SchemaType | undefined\n has: (name: string) => boolean\n getTypeNames: () => string[]\n /**\n * Returns the types which were explicitly defined in this schema,\n * as opposed to the types which were inherited from the parent.\n */\n getLocalTypeNames: () => string[]\n /**\n * Returns the parent schema.\n */\n parent?: Schema\n}\n\n/**\n * Note: you probably want `SchemaTypeDefinition` instead\n * @see SchemaTypeDefinition\n *\n * @public\n */\nexport declare type SchemaType =\n | ArraySchemaType\n | BooleanSchemaType\n | FileSchemaType\n | NumberSchemaType\n | ObjectSchemaType\n | StringSchemaType\n | ReferenceSchemaType\n\n/**\n * Represents a Sanity schema type definition with an optional type parameter.\n *\n * It's recommend to use the `defineType` helper instead of this type by\n * itself.\n *\n * @see defineType\n *\n * @public\n */\nexport declare type SchemaTypeDefinition<TType extends IntrinsicTypeName = IntrinsicTypeName> =\n | IntrinsicDefinitions[IntrinsicTypeName]\n | TypeAliasDefinition<string, TType>\n\n/** @public */\nexport declare interface SchemaValidationError {\n helpId?: string\n message: string\n severity: 'error'\n}\n\n/** @internal */\nexport declare type SchemaValidationProblem = SchemaValidationError | SchemaValidationWarning\n\n/** @internal */\nexport declare interface SchemaValidationProblemGroup {\n path: SchemaValidationProblemPath\n problems: SchemaValidationProblem[]\n}\n\n/** @internal */\nexport declare type SchemaValidationProblemPath = Array<\n | {\n kind: 'type'\n type: string\n name?: string\n }\n | {\n kind: 'property'\n name: string\n }\n>\n\n/**\n * Represents the possible values of a schema type's `validation` field.\n *\n * If the schema has not been run through `inferFromSchema` from\n * `sanity/validation` then value could be a function.\n *\n * `inferFromSchema` mutates the schema converts this value to an array of\n * `Rule` instances.\n *\n * @privateRemarks\n *\n * Usage of the schema inside the studio will almost always be from the compiled\n * `createSchema` function. In this case, you can cast the value or throw to\n * narrow the type. E.g.:\n *\n * ```ts\n * if (typeof type.validation === 'function') {\n * throw new Error(\n * `Schema type \"${type.name}\"'s \\`validation\\` was not run though \\`inferFromSchema\\``\n * )\n * }\n * ```\n *\n * @public\n */\nexport declare type SchemaValidationValue =\n | false\n | undefined\n | Rule\n | SchemaValidationValue[]\n | ((rule: Rule) => SchemaValidationValue)\n\n/** @internal */\nexport declare interface SchemaValidationWarning {\n helpId?: string\n message: string\n severity: 'warning'\n}\n\n/** @public */\nexport declare interface SearchConfiguration {\n search?: {\n /**\n * Defines a search weight for this field to prioritize its importance\n * during search operations in the Studio. This setting allows the specified\n * field to be ranked higher in search results compared to other fields.\n *\n * By default, all fields are assigned a weight of 1. However, if a field is\n * chosen as the `title` in the preview configuration's `select` option, it\n * will automatically receive a default weight of 10. Similarly, if selected\n * as the `subtitle`, the default weight is 5. Fields marked as\n * `hidden: true` (no function) are assigned a weight of 0 by default.\n *\n * Note: Search weight configuration is currently supported only for fields\n * of type string or portable text arrays.\n */\n weight?: number\n }\n}\n\n/**\n * @public\n */\nexport declare const searchStrategies: readonly ['groqLegacy', 'groq2024']\n\n/**\n * @public\n */\nexport declare type SearchStrategy = (typeof searchStrategies)[number]\n\n/** @public */\nexport declare interface SingleFieldSet {\n single: true\n field: ObjectField\n hidden?: ConditionalProperty\n readOnly?: ConditionalProperty\n group?: string | string[]\n}\n\n/** @internal */\nexport declare interface SingleMutationResult {\n transactionId: string\n documentId: string\n results: {\n id: string\n }[]\n}\n\n/**\n * A slug object, currently holding a `current` property\n *\n * In the future, this may be extended with a `history` property\n *\n * @public\n */\nexport declare interface Slug {\n _type: 'slug'\n current: string\n}\n\n/** @public */\nexport declare interface SlugDefinition extends BaseSchemaDefinition {\n type: 'slug'\n options?: SlugOptions\n validation?: ValidationBuilder<SlugRule, SlugValue>\n initialValue?: InitialValueProperty<any, Omit<SlugValue, '_type'>>\n}\n\n/** @public */\nexport declare type SlugifierFn = (\n source: string,\n schemaType: SlugSchemaType,\n context: SlugSourceContext,\n) => string | Promise<string>\n\n/** @public */\nexport declare type SlugIsUniqueValidator = (\n slug: string,\n context: SlugValidationContext,\n) => boolean | Promise<boolean>\n\n/** @public */\nexport declare interface SlugOptions extends SearchConfiguration, BaseSchemaTypeOptions {\n source?: string | Path | SlugSourceFn\n maxLength?: number\n slugify?: SlugifierFn\n isUnique?: SlugIsUniqueValidator\n disableArrayWarning?: boolean\n}\n\n/** @public */\nexport declare type SlugParent = Record<string, unknown> | Record<string, unknown>[]\n\n/** @public */\nexport declare interface SlugRule extends RuleDef<SlugRule, SlugValue> {}\n\n/** @public */\nexport declare interface SlugSchemaType extends ObjectSchemaType {\n jsonType: 'object'\n options?: SlugOptions\n}\n\n/** @public */\nexport declare interface SlugSourceContext {\n parentPath: Path\n parent: SlugParent\n projectId: string\n dataset: string\n schema: Schema\n currentUser: CurrentUser | null\n getClient: (options: {apiVersion: string}) => SanityClient\n}\n\n/** @public */\nexport declare type SlugSourceFn = (\n document: SanityDocument,\n context: SlugSourceContext,\n) => string | Promise<string>\n\n/** @public */\nexport declare interface SlugValidationContext extends ValidationContext {\n parent: SlugParent\n type: SlugSchemaType\n defaultIsUnique: SlugIsUniqueValidator\n}\n\n/** @public */\nexport declare interface SlugValue {\n _type: 'slug'\n current?: string\n}\n\n/** @beta */\nexport declare type SortOrdering = {\n title: string\n i18n?: I18nTextRecord<'title'>\n name: string\n by: SortOrderingItem[]\n}\n\n/** @beta */\nexport declare interface SortOrderingItem {\n field: string\n direction: 'asc' | 'desc'\n}\n\n/**\n * A specific `ObjectField` for `marks` in `SpanSchemaType`\n * @see SpanSchemaType\n *\n * @internal\n */\nexport declare type SpanMarksObjectField = {\n name: 'marks'\n} & ObjectField<ArraySchemaTypeOf<StringSchemaType>>\n\n/**\n * Represents the compiled schema shape for `span`s for portable text.\n *\n * Note: this does _not_ represent the schema definition shape.\n *\n * @internal\n */\nexport declare interface SpanSchemaType extends Omit<ObjectSchemaType, 'fields'> {\n annotations: (ObjectSchemaType & {\n icon?: string | ComponentType\n components?: {\n item?: ComponentType\n }\n })[]\n decorators: BlockDecoratorDefinition[]\n fields: [SpanMarksObjectField, SpanTextObjectField]\n}\n\n/**\n * A specific `ObjectField` for `text` in `SpanSchemaType`\n * @see SpanSchemaType\n *\n * @internal\n */\nexport declare type SpanTextObjectField = {\n name: 'text'\n} & ObjectField<TextSchemaType>\n\n/** @beta */\nexport declare type StrictDefinition = boolean | undefined\n\n/**\n * @internal\n */\nexport declare interface StrictVersionLayeringOptions {\n /**\n * By default, version layering includes all document versions, regardless of their expected\n * publication time—or lack thereof. For example, it includes all ASAP and undecided versions,\n * despite ASAP and undecided versions having no fixed chronology. There is no way to determine\n * which ASAP or undecided version is expected to be published before another.\n *\n * It also includes any existing draft, which has no fixed chronology, either.\n *\n * This functionality is useful for listing all document versions in a deterministic order, but\n * doesn't accurately portray the upstream and downstream versions based on expected publication\n * time.\n *\n * In strict mode, version layering instead only includes versions that have a fixed chronology.\n * **Cross-version layering is only effective for scheduled versions, with all other\n * versions being layered directly onto the published version (if it exists).**\n */\n strict?: boolean\n}\n\n/** @public */\nexport declare interface StringDefinition extends BaseSchemaDefinition {\n type: 'string'\n options?: StringOptions\n placeholder?: string\n validation?: ValidationBuilder<StringRule, string>\n initialValue?: InitialValueProperty<any, string>\n}\n\n/** @public */\nexport declare interface StringOptions\n extends EnumListProps<string>, SearchConfiguration, BaseSchemaTypeOptions {}\n\n/** @public */\nexport declare interface StringRule extends RuleDef<StringRule, string> {\n min: (minNumber: number | FieldReference) => StringRule\n max: (maxNumber: number | FieldReference) => StringRule\n length: (exactLength: number | FieldReference) => StringRule\n uppercase: () => StringRule\n lowercase: () => StringRule\n regex(\n pattern: RegExp,\n name: string,\n options: {\n name?: string\n invert?: boolean\n },\n ): StringRule\n regex(\n pattern: RegExp,\n options: {\n name?: string\n invert?: boolean\n },\n ): StringRule\n regex(pattern: RegExp, name: string): StringRule\n regex(pattern: RegExp): StringRule\n email(): StringRule\n}\n\n/**\n * This is used for string, text, date and datetime.\n * This interface represent the compiled version at runtime, when accessed through Schema.\n *\n * @public\n */\nexport declare interface StringSchemaType extends BaseSchemaType {\n jsonType: 'string'\n options?: StringOptions & TextOptions & DateOptions & DatetimeOptions\n initialValue?: InitialValueProperty<any, string>\n}\n\n/**\n * @internal\n * Payload that will be passed by the comments backend to our notifications system to display the notification in dashboard.\n * */\nexport declare interface StudioNotificationPayload extends DashboardNotificationPayload {\n applicationType: 'studio'\n applicationId: string | undefined\n workspaceName: string | undefined\n link: {\n type: 'url'\n url: string\n }\n}\n\n/** @public */\nexport declare type SwatchName =\n | 'darkMuted'\n | 'darkVibrant'\n | 'dominant'\n | 'lightMuted'\n | 'lightVibrant'\n | 'muted'\n | 'vibrant'\n\n/** @public */\nexport declare interface TextDefinition extends BaseSchemaDefinition {\n type: 'text'\n rows?: number\n options?: TextOptions\n placeholder?: string\n validation?: ValidationBuilder<TextRule, string>\n initialValue?: InitialValueProperty<any, string>\n}\n\n/** @public */\nexport declare interface TextOptions extends StringOptions {}\n\n/** @public */\nexport declare interface TextRule extends StringRule {}\n\n/** @public */\nexport declare interface TextSchemaType extends StringSchemaType {\n rows?: number\n}\n\n/** @public */\nexport declare interface TitledListValue<V = unknown> {\n _key?: string\n title: string\n value?: V\n}\n\n/**\n * An entry in the transaction log\n *\n * @internal\n */\nexport declare interface TransactionLogEvent {\n /**\n * ID of transaction\n */\n id: string\n /**\n * ISO-formatted timestamp (zulu-time) of when the transaction happened\n */\n timestamp: string\n /**\n * User ID of the user who performed the transaction\n */\n author: string\n /**\n * Document IDs involved in this transaction\n */\n documentIDs: string[]\n}\n\n/**\n * An entry in the transaction log that includes the effects of the transaction.\n * Used when asking the transaction log to include effects in mendoza format,\n * eg `?effectFormat=mendoza`\n *\n * @internal\n */\nexport declare interface TransactionLogEventWithEffects extends TransactionLogEvent {\n /**\n * Object of effects, where the key is the document ID affected and the value\n * is the effect pair, eg `{apply: MendozaPatch, revert: MendozaPatch}`\n */\n effects: Record<string, MendozaEffectPair | undefined>\n}\n\n/**\n * An entry in the transaction log that includes the mutations that were performed.\n * Used when asking the transaction log not to exclude the mutations,\n * eg `excludeMutations=false`\n *\n * @internal\n */\nexport declare interface TransactionLogEventWithMutations extends TransactionLogEvent {\n /**\n * Array of mutations that occurred in this transaction. Note that the transaction\n * log has an additional mutation type not typically seen in other APIs;\n * `createSquashed` ({@link CreateSquashedMutation}).\n */\n mutations: TransactionLogMutation[]\n}\n\n/**\n * A mutation that can occur in the transaction log, which includes the\n * {@link CreateSquashedMutation} mutation type.\n *\n * @internal\n */\nexport declare type TransactionLogMutation = Mutation | CreateSquashedMutation\n\n/**\n * Represents a type definition that is an alias/extension of an existing type\n * in your schema. Creating a type alias will re-register that existing type\n * under a different name. You can also override the default type options with\n * a type alias definition.\n *\n * @public\n */\nexport declare interface TypeAliasDefinition<\n TType extends string,\n TAlias extends IntrinsicTypeName | undefined,\n> extends BaseSchemaDefinition {\n type: TType\n options?: TAlias extends IntrinsicTypeName ? IntrinsicDefinitions[TAlias]['options'] : unknown\n validation?: SchemaValidationValue\n initialValue?: InitialValueProperty<any, any>\n preview?: PreviewConfig\n components?: {\n annotation?: ComponentType<any>\n block?: ComponentType<any>\n inlineBlock?: ComponentType<any>\n diff?: ComponentType<any>\n field?: ComponentType<any>\n input?: ComponentType<any>\n item?: ComponentType<any>\n preview?: ComponentType<any>\n }\n}\n\n/**\n * `typed` can be used to ensure that an object conforms to an exact interface.\n *\n * It can be useful when working with `defineType` and `defineField` on occasions where a wider type with\n * custom options or properties is required.\n *\n * ## Example usage\n * ```ts\n * defineField({\n * type: 'string',\n * name: 'nestedField',\n * options: typed<StringOptions & {myCustomOption: boolean}>({\n * layout: 'radio',\n * // allowed\n * myCustomOption: true,\n * //@ts-expect-error unknownProp is not part of StringOptions & {myCustomOption: boolean}\n * unknownProp: 'not allowed in typed context',\n * }),\n * }),\n * ```\n *\n * @param input - returned directly\n *\n * @internal\n */\nexport declare function typed<T>(input: T): T\n\n/** @public */\nexport declare interface TypedObject {\n [key: string]: unknown\n _type: string\n}\n\n/**\n * Represents a reference to another type registered top-level in your schema.\n *\n * @public\n */\nexport declare interface TypeReference {\n type: string\n name?: string\n icon?: ComponentType | ReactNode\n options?: {\n [key: string]: unknown\n }\n}\n\n/** @internal */\nexport declare interface UploadState {\n progress: number\n /** @deprecated use createdAt instead */\n initiated?: string\n /** @deprecated use updatedAt instead */\n updated?: string\n createdAt: string\n updatedAt: string\n file: {\n name: string\n type: string\n }\n previewImage?: string\n}\n\n/** @public */\nexport declare interface UriValidationOptions {\n scheme?: (string | RegExp) | Array<string | RegExp>\n allowRelative?: boolean\n relativeOnly?: boolean\n allowCredentials?: boolean\n}\n\n/** @public */\nexport declare interface UrlDefinition extends BaseSchemaDefinition {\n type: 'url'\n options?: UrlOptions\n placeholder?: string\n validation?: ValidationBuilder<UrlRule, string>\n initialValue?: InitialValueProperty<any, string>\n}\n\n/** @public */\nexport declare interface UrlOptions extends BaseSchemaTypeOptions {}\n\n/** @public */\nexport declare interface UrlRule extends RuleDef<UrlRule, string> {\n uri(options: UriValidationOptions): UrlRule\n}\n\n/** @public */\nexport declare interface User {\n id: string\n displayName?: string\n imageUrl?: string\n email?: string\n}\n\n/** @public */\nexport declare type ValidationBuilder<T extends RuleDef<T, FieldValue>, FieldValue = unknown> = (\n rule: T,\n) => RuleBuilder<T, FieldValue>\n\n/**\n * A context object passed around during validation. This includes the\n * `Rule.custom` context.\n *\n * e.g.\n *\n * ```js\n * Rule.custom((_, validationContext) => {\n * // ...\n * })`\n * ```\n *\n * @public\n */\nexport declare interface ValidationContext {\n getClient: (options: {apiVersion: string}) => SanityClient\n schema: Schema\n parent?: unknown\n type?: SchemaType\n document?: SanityDocument\n path?: Path\n getDocumentExists?: (options: {id: string}) => Promise<boolean>\n environment: 'cli' | 'studio'\n}\n\n/**\n * The shape that can be returned from a custom validator to be converted into\n * a validation marker by the validation logic. Inside of a custom validator,\n * you can return an array of these in order to specify multiple paths within\n * an object or array.\n *\n * @public\n */\nexport declare interface ValidationError {\n /**\n * The message describing why the value is not valid. This message will be\n * included in the validation markers after validation has finished running.\n */\n message: string\n /**\n * If writing a custom validator, you can return validation messages to\n * specific path inside of the current value (object or array) by populating\n * this `path` prop.\n *\n * NOTE: This path is relative to the current value and _not_ relative to\n * the document.\n */\n path?: Path\n /**\n * Extra metadata for the validation error. Currently used by the Media Library asset source to ignore\n * certain validation markers when validating asset source media library assets.\n *\n * @internal\n */\n __internal_metadata?: unknown\n /**\n * Same as `path` but allows more than one value. If provided, the same\n * message will create two markers from each path with the same message\n * provided.\n *\n * @deprecated prefer `path`\n */\n paths?: Path[]\n /**\n * @deprecated Unused. Was used to store the results from `.either()` /`.all()`\n */\n children?: ValidationMarker[]\n /**\n * @deprecated Unused. Was used to signal if this error came from an `.either()`/`.all()`.\n */\n operation?: 'AND' | 'OR'\n /**\n * @deprecated Unused. Was relevant when validation error was used as a class.\n */\n cloneWithMessage?(message: string): ValidationError\n}\n\n/**\n * This follows the same pattern as `RuleClass` and `Rule` above\n * Note: this class does not actually extend `Error` since it's never thrown\n * within the validation library\n *\n * @deprecated It is preferred to a plain object that adheres to `ValidationError`\n * @internal\n */\nexport declare interface ValidationErrorClass {\n new (message: string, options?: ValidationErrorOptions): ValidationError\n}\n\n/** @internal */\nexport declare interface ValidationErrorOptions {\n paths?: Path[]\n children?: ValidationMarker[]\n operation?: 'AND' | 'OR'\n}\n\n/** @public */\nexport declare interface ValidationMarker {\n level: 'error' | 'warning' | 'info'\n /**\n * The validation message for this marker. E.g. \"Must be greater than 0\"\n */\n message: string\n /**\n * @deprecated use `message` instead\n */\n item?: ValidationError\n /**\n * The sanity path _relative to the root of the current document_ to this\n * marker.\n *\n * NOTE: Sanity paths may contain keyed segments (i.e. `{_key: string}`) that\n * are not compatible with deep getters like lodash/get\n */\n path: Path\n /**\n * Extra metadata for the validation marker. Currently used by the Media Library asset source to ignore\n * certain validation markers when validating asset source media library assets.\n *\n * @internal\n */\n __internal_metadata?: unknown\n}\n\n/**\n * The base type for all validators in the validation library. Takes in a\n * `RuleSpec`'s constraint, the value to check, an optional override message,\n * and the validation context.\n *\n * @see Rule.validate from `sanity/src/core/validation/Rule`\n *\n * @internal\n */\nexport declare type Validator<T = any, Value = any> = (\n constraint: T,\n value: Value,\n message: string | undefined,\n context: ValidationContext,\n) =>\n | ValidationError[]\n | ValidationError\n | string\n | true\n | Promise<ValidationError[] | ValidationError | string | true>\n\n/**\n * A type helper used to define a group of validators. The type of the\n * `RuleSpec` constraint is inferred via the key.\n *\n * E.g.\n *\n * ```ts\n * const booleanValidators: Validators = {\n * ...genericValidator,\n *\n * presence: (v, value, message) => {\n * if (v === 'required' && typeof value !== 'boolean') return message || 'Required'\n * return true\n * },\n * }\n * ```\n *\n * @internal\n */\nexport declare type Validators = Partial<{\n [P in RuleSpec['flag']]: Validator<\n Exclude<\n ConditionalIndexAccess<\n Extract<\n RuleSpec,\n {\n flag: P\n }\n >,\n 'constraint'\n >,\n FieldReference\n >\n >\n}>\n\n/** @beta */\nexport declare interface WeakCrossDatasetReferenceValue extends CrossDatasetReferenceValue {\n _weak: true\n}\n\n/** @beta */\nexport declare interface WeakGlobalDocumentReferenceValue extends GlobalDocumentReferenceValue {\n _weak: true\n}\n\n/** @internal */\nexport declare interface WeakReference extends Reference {\n _weak: true\n}\n\n/** @beta */\nexport declare interface WidenInitialValue {\n initialValue?: InitialValueProperty<any, any>\n}\n\n/** @beta */\nexport declare interface WidenValidation {\n validation?: SchemaValidationValue\n}\n\nexport {}\n"],"x_google_ignoreList":[0],"mappings":";;;;kBAmkGyByC,cAAAA;;;;;;;;;KC7jGb;ED6jGZ;;AC7jGA;EAaA,gBAAsB,EAAA,OAAA,GAAA,IAAA;EAAiB,IAAA,EAR/B,CAQ+B,GAAA,IAAA;CAChC;;;;;;iBADe,iBAAiB,qBAChC,gFAGJ,QAAQ,WAAW"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/webhook/index.ts"],"sourcesContent":[],"mappings":";;AAKY,KAAA,UAAA,CAAA,CAAA,CAAA,GAAA;;AAuBZ;;EACO,gBAAA,EAAA,OAAA,GAAA,IAAA;EAGe,IAAA,EAtBd,CAsBc,GAAA,IAAA;CAAX;;UAlBD,cAAA,CAkBP;;;;;;;;;;;;;iBAJmB,iBAAiB,qBAChC,gFAGJ,QAAQ,WAAW"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../node_modules/.pnpm/@sanity+webhook@4.0.4/node_modules/@sanity/webhook/dist/index.mjs","../../src/webhook/index.ts"],"sourcesContent":["class WebhookSignatureValueError extends Error {\n type = \"WebhookSignatureValueError\";\n statusCode = 401;\n}\nclass WebhookSignatureFormatError extends Error {\n type = \"WebhookSignatureFormatError\";\n statusCode = 400;\n}\nfunction isSignatureError(error) {\n return typeof error == \"object\" && error !== null && \"type\" in error && [\"WebhookSignatureValueError\", \"WebhookSignatureFormatError\"].includes(\n error.type\n );\n}\nconst MINIMUM_TIMESTAMP = 16094592e5, SIGNATURE_HEADER_REGEX = /^t=(\\d+)[, ]+v1=([^, ]+)$/, SIGNATURE_HEADER_NAME = \"sanity-webhook-signature\";\nasync function assertValidSignature(stringifiedPayload, signature, secret) {\n const { timestamp } = decodeSignatureHeader(signature), encoded = await encodeSignatureHeader(stringifiedPayload, timestamp, secret);\n if (signature !== encoded)\n throw new WebhookSignatureValueError(\"Signature is invalid\");\n}\nasync function isValidSignature(stringifiedPayload, signature, secret) {\n try {\n return await assertValidSignature(stringifiedPayload, signature, secret), !0;\n } catch (err) {\n if (isSignatureError(err))\n return !1;\n throw err;\n }\n}\nasync function assertValidRequest(request, secret) {\n const signature = request.headers[SIGNATURE_HEADER_NAME];\n if (Array.isArray(signature))\n throw new WebhookSignatureFormatError(\"Multiple signature headers received\");\n if (typeof signature != \"string\")\n throw new WebhookSignatureValueError(\"Request contained no signature header\");\n if (typeof request.body > \"u\")\n throw new WebhookSignatureFormatError(\"Request contained no parsed request body\");\n if (typeof request.body == \"string\" || Buffer.isBuffer(request.body))\n await assertValidSignature(request.body.toString(\"utf8\"), signature, secret);\n else\n throw new Error(\n \"[@sanity/webhook] `request.body` was not a string/buffer - this can lead to invalid signatures. See the [migration docs](https://github.com/sanity-io/webhook-toolkit#from-parsed-to-unparsed-body) for details on how to fix this.\"\n );\n}\nasync function isValidRequest(request, secret) {\n try {\n return await assertValidRequest(request, secret), !0;\n } catch (err) {\n if (isSignatureError(err))\n return !1;\n throw err;\n }\n}\nasync function encodeSignatureHeader(stringifiedPayload, timestamp, secret) {\n const signature = await createHS256Signature(stringifiedPayload, timestamp, secret);\n return `t=${timestamp},v1=${signature}`;\n}\nfunction decodeSignatureHeader(signaturePayload) {\n if (!signaturePayload)\n throw new WebhookSignatureFormatError(\"Missing or empty signature header\");\n const [, timestamp, hashedPayload] = signaturePayload.trim().match(SIGNATURE_HEADER_REGEX) || [];\n if (!timestamp || !hashedPayload)\n throw new WebhookSignatureFormatError(\"Invalid signature payload format\");\n return {\n timestamp: parseInt(timestamp, 10),\n hashedPayload\n };\n}\nasync function createHS256Signature(stringifiedPayload, timestamp, secret) {\n if (typeof crypto > \"u\")\n throw new TypeError(\n \"The Web Crypto API is not available in this environment, either polyfill `globalThis.crypto` or downgrade to `@sanity/webhook@3` which uses the Node.js `crypto` module.\"\n );\n if (!secret || typeof secret != \"string\")\n throw new WebhookSignatureFormatError(\"Invalid secret provided\");\n if (!stringifiedPayload)\n throw new WebhookSignatureFormatError(\"Can not create signature for empty payload\");\n if (typeof stringifiedPayload != \"string\")\n throw new WebhookSignatureFormatError(\"Payload must be a JSON-encoded string\");\n if (typeof timestamp != \"number\" || isNaN(timestamp) || timestamp < MINIMUM_TIMESTAMP)\n throw new WebhookSignatureFormatError(\n \"Invalid signature timestamp, must be a unix timestamp with millisecond precision\"\n );\n const enc = new TextEncoder(), key = await crypto.subtle.importKey(\n \"raw\",\n enc.encode(secret),\n { name: \"HMAC\", hash: \"SHA-256\" },\n !1,\n [\"sign\"]\n ), signaturePayload = `${timestamp}.${stringifiedPayload}`, signature = await crypto.subtle.sign(\"HMAC\", key, enc.encode(signaturePayload)), signatureArray = Array.from(new Uint8Array(signature));\n return btoa(String.fromCharCode.apply(null, signatureArray)).replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=+$/, \"\");\n}\nfunction requireSignedRequest(options) {\n const parseBody = typeof options.parseBody > \"u\" ? !0 : options.parseBody, respondOnError = typeof options.respondOnError > \"u\" ? !0 : options.respondOnError;\n return async function(request, response, next) {\n try {\n await assertValidRequest(request, options.secret), parseBody && typeof request.body == \"string\" && (request.body = JSON.parse(request.body)), next();\n } catch (err) {\n if (!respondOnError || !isSignatureError(err)) {\n next(err);\n return;\n }\n response.status(err.statusCode).json({ message: err.message });\n }\n };\n}\nexport {\n SIGNATURE_HEADER_NAME,\n WebhookSignatureFormatError,\n WebhookSignatureValueError,\n assertValidRequest,\n assertValidSignature,\n decodeSignatureHeader,\n encodeSignatureHeader,\n isSignatureError,\n isValidRequest,\n isValidSignature,\n requireSignedRequest\n};\n//# sourceMappingURL=index.mjs.map\n","import type {
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../node_modules/.pnpm/@sanity+webhook@4.0.4/node_modules/@sanity/webhook/dist/index.mjs","../../src/webhook/index.ts"],"sourcesContent":["class WebhookSignatureValueError extends Error {\n type = \"WebhookSignatureValueError\";\n statusCode = 401;\n}\nclass WebhookSignatureFormatError extends Error {\n type = \"WebhookSignatureFormatError\";\n statusCode = 400;\n}\nfunction isSignatureError(error) {\n return typeof error == \"object\" && error !== null && \"type\" in error && [\"WebhookSignatureValueError\", \"WebhookSignatureFormatError\"].includes(\n error.type\n );\n}\nconst MINIMUM_TIMESTAMP = 16094592e5, SIGNATURE_HEADER_REGEX = /^t=(\\d+)[, ]+v1=([^, ]+)$/, SIGNATURE_HEADER_NAME = \"sanity-webhook-signature\";\nasync function assertValidSignature(stringifiedPayload, signature, secret) {\n const { timestamp } = decodeSignatureHeader(signature), encoded = await encodeSignatureHeader(stringifiedPayload, timestamp, secret);\n if (signature !== encoded)\n throw new WebhookSignatureValueError(\"Signature is invalid\");\n}\nasync function isValidSignature(stringifiedPayload, signature, secret) {\n try {\n return await assertValidSignature(stringifiedPayload, signature, secret), !0;\n } catch (err) {\n if (isSignatureError(err))\n return !1;\n throw err;\n }\n}\nasync function assertValidRequest(request, secret) {\n const signature = request.headers[SIGNATURE_HEADER_NAME];\n if (Array.isArray(signature))\n throw new WebhookSignatureFormatError(\"Multiple signature headers received\");\n if (typeof signature != \"string\")\n throw new WebhookSignatureValueError(\"Request contained no signature header\");\n if (typeof request.body > \"u\")\n throw new WebhookSignatureFormatError(\"Request contained no parsed request body\");\n if (typeof request.body == \"string\" || Buffer.isBuffer(request.body))\n await assertValidSignature(request.body.toString(\"utf8\"), signature, secret);\n else\n throw new Error(\n \"[@sanity/webhook] `request.body` was not a string/buffer - this can lead to invalid signatures. See the [migration docs](https://github.com/sanity-io/webhook-toolkit#from-parsed-to-unparsed-body) for details on how to fix this.\"\n );\n}\nasync function isValidRequest(request, secret) {\n try {\n return await assertValidRequest(request, secret), !0;\n } catch (err) {\n if (isSignatureError(err))\n return !1;\n throw err;\n }\n}\nasync function encodeSignatureHeader(stringifiedPayload, timestamp, secret) {\n const signature = await createHS256Signature(stringifiedPayload, timestamp, secret);\n return `t=${timestamp},v1=${signature}`;\n}\nfunction decodeSignatureHeader(signaturePayload) {\n if (!signaturePayload)\n throw new WebhookSignatureFormatError(\"Missing or empty signature header\");\n const [, timestamp, hashedPayload] = signaturePayload.trim().match(SIGNATURE_HEADER_REGEX) || [];\n if (!timestamp || !hashedPayload)\n throw new WebhookSignatureFormatError(\"Invalid signature payload format\");\n return {\n timestamp: parseInt(timestamp, 10),\n hashedPayload\n };\n}\nasync function createHS256Signature(stringifiedPayload, timestamp, secret) {\n if (typeof crypto > \"u\")\n throw new TypeError(\n \"The Web Crypto API is not available in this environment, either polyfill `globalThis.crypto` or downgrade to `@sanity/webhook@3` which uses the Node.js `crypto` module.\"\n );\n if (!secret || typeof secret != \"string\")\n throw new WebhookSignatureFormatError(\"Invalid secret provided\");\n if (!stringifiedPayload)\n throw new WebhookSignatureFormatError(\"Can not create signature for empty payload\");\n if (typeof stringifiedPayload != \"string\")\n throw new WebhookSignatureFormatError(\"Payload must be a JSON-encoded string\");\n if (typeof timestamp != \"number\" || isNaN(timestamp) || timestamp < MINIMUM_TIMESTAMP)\n throw new WebhookSignatureFormatError(\n \"Invalid signature timestamp, must be a unix timestamp with millisecond precision\"\n );\n const enc = new TextEncoder(), key = await crypto.subtle.importKey(\n \"raw\",\n enc.encode(secret),\n { name: \"HMAC\", hash: \"SHA-256\" },\n !1,\n [\"sign\"]\n ), signaturePayload = `${timestamp}.${stringifiedPayload}`, signature = await crypto.subtle.sign(\"HMAC\", key, enc.encode(signaturePayload)), signatureArray = Array.from(new Uint8Array(signature));\n return btoa(String.fromCharCode.apply(null, signatureArray)).replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=+$/, \"\");\n}\nfunction requireSignedRequest(options) {\n const parseBody = typeof options.parseBody > \"u\" ? !0 : options.parseBody, respondOnError = typeof options.respondOnError > \"u\" ? !0 : options.respondOnError;\n return async function(request, response, next) {\n try {\n await assertValidRequest(request, options.secret), parseBody && typeof request.body == \"string\" && (request.body = JSON.parse(request.body)), next();\n } catch (err) {\n if (!respondOnError || !isSignatureError(err)) {\n next(err);\n return;\n }\n response.status(err.statusCode).json({ message: err.message });\n }\n };\n}\nexport {\n SIGNATURE_HEADER_NAME,\n WebhookSignatureFormatError,\n WebhookSignatureValueError,\n assertValidRequest,\n assertValidSignature,\n decodeSignatureHeader,\n encodeSignatureHeader,\n isSignatureError,\n isValidRequest,\n isValidSignature,\n requireSignedRequest\n};\n//# sourceMappingURL=index.mjs.map\n","import type {NextRequest} from 'next/server'\n\nimport {isValidSignature, SIGNATURE_HEADER_NAME} from '@sanity/webhook'\n\n/** @public */\nexport type ParsedBody<T> = {\n /**\n * If a secret is given then it returns a boolean. If no secret is provided then no validation is done on the signature, and it'll return `null`\n */\n isValidSignature: boolean | null\n body: T | null\n}\n\n/** @public */\ninterface SanityDocument {\n _id: string\n _type: string\n _createdAt: string\n _updatedAt: string\n _rev: string\n [key: string]: unknown\n}\n\n/**\n * Handles parsing the body JSON, and validating its signature. Also waits for Content Lake eventual consistency so you can run your queries\n * without worrying about getting stale data.\n * @public\n */\nexport async function parseBody<Body = SanityDocument>(\n req: NextRequest,\n secret?: string,\n waitForContentLakeEventualConsistency = true,\n): Promise<ParsedBody<Body>> {\n const signature = req.headers.get(SIGNATURE_HEADER_NAME)\n if (!signature) {\n console.error('Missing signature header')\n return {body: null, isValidSignature: null}\n }\n\n const body = await req.text()\n const validSignature = secret ? await isValidSignature(body, signature, secret.trim()) : null\n\n if (validSignature !== false && waitForContentLakeEventualConsistency) {\n await new Promise((resolve) => setTimeout(resolve, 3000))\n }\n\n return {\n body: body.trim() ? JSON.parse(body) : null,\n isValidSignature: validSignature,\n }\n}\n"],"x_google_ignoreList":[0],"mappings":"AAAA,IAAM,6BAAN,cAAyC,MAAM;CAC7C,OAAO;CACP,aAAa;;AAEf,IAAM,8BAAN,cAA0C,MAAM;CAC9C,OAAO;CACP,aAAa;;AAEf,SAAS,iBAAiB,OAAO;AAC/B,QAAO,OAAO,SAAS,YAAY,UAAU,QAAQ,UAAU,SAAS,CAAC,8BAA8B,8BAA8B,CAAC,SACpI,MAAM,KACP;;AAEH,MAAM,oBAAoB,YAAY,yBAAyB,6BAA6B,wBAAwB;AACpH,eAAe,qBAAqB,oBAAoB,WAAW,QAAQ;CACzE,MAAM,EAAE,cAAc,sBAAsB,UAAU;AACtD,KAAI,cAD8D,MAAM,sBAAsB,oBAAoB,WAAW,OAAO,CAElI,OAAM,IAAI,2BAA2B,uBAAuB;;AAEhE,eAAe,iBAAiB,oBAAoB,WAAW,QAAQ;AACrE,KAAI;AACF,SAAO,MAAM,qBAAqB,oBAAoB,WAAW,OAAO,EAAE,CAAC;UACpE,KAAK;AACZ,MAAI,iBAAiB,IAAI,CACvB,QAAO,CAAC;AACV,QAAM;;;AA2BV,eAAe,sBAAsB,oBAAoB,WAAW,QAAQ;AAE1E,QAAO,KAAK,UAAU,MADJ,MAAM,qBAAqB,oBAAoB,WAAW,OAAO;;AAGrF,SAAS,sBAAsB,kBAAkB;AAC/C,KAAI,CAAC,iBACH,OAAM,IAAI,4BAA4B,oCAAoC;CAC5E,MAAM,GAAG,WAAW,iBAAiB,iBAAiB,MAAM,CAAC,MAAM,uBAAuB,IAAI,EAAE;AAChG,KAAI,CAAC,aAAa,CAAC,cACjB,OAAM,IAAI,4BAA4B,mCAAmC;AAC3E,QAAO;EACL,WAAW,SAAS,WAAW,GAAG;EAClC;EACD;;AAEH,eAAe,qBAAqB,oBAAoB,WAAW,QAAQ;AACzE,KAAI,OAAO,SAAS,IAClB,OAAM,IAAI,UACR,2KACD;AACH,KAAI,CAAC,UAAU,OAAO,UAAU,SAC9B,OAAM,IAAI,4BAA4B,0BAA0B;AAClE,KAAI,CAAC,mBACH,OAAM,IAAI,4BAA4B,6CAA6C;AACrF,KAAI,OAAO,sBAAsB,SAC/B,OAAM,IAAI,4BAA4B,wCAAwC;AAChF,KAAI,OAAO,aAAa,YAAY,MAAM,UAAU,IAAI,YAAY,kBAClE,OAAM,IAAI,4BACR,mFACD;CACH,MAAM,MAAM,IAAI,aAAa,EAAE,MAAM,MAAM,OAAO,OAAO,UACvD,OACA,IAAI,OAAO,OAAO,EAClB;EAAE,MAAM;EAAQ,MAAM;EAAW,EACjC,CAAC,GACD,CAAC,OAAO,CACT,EAAE,mBAAmB,GAAG,UAAU,GAAG,sBAAsB,YAAY,MAAM,OAAO,OAAO,KAAK,QAAQ,KAAK,IAAI,OAAO,iBAAiB,CAAC,EAAE,iBAAiB,MAAM,KAAK,IAAI,WAAW,UAAU,CAAC;AACnM,QAAO,KAAK,OAAO,aAAa,MAAM,MAAM,eAAe,CAAC,CAAC,QAAQ,OAAO,IAAI,CAAC,QAAQ,OAAO,IAAI,CAAC,QAAQ,OAAO,GAAG;;AC7DzH,eAAsB,UACpB,KACA,QACA,wCAAwC,MACb;CAC3B,MAAM,YAAY,IAAI,QAAQ,IAAI,sBAAsB;AACxD,KAAI,CAAC,WAAW;AACd,UAAQ,MAAM,2BAA2B;AACzC,SAAO;GAAC,MAAM;GAAM,kBAAkB;GAAK;;CAG7C,MAAM,OAAO,MAAM,IAAI,MAAM;CAC7B,MAAM,iBAAiB,SAAS,MAAM,iBAAiB,MAAM,WAAW,OAAO,MAAM,CAAC,GAAG;AAEzF,KAAI,mBAAmB,SAAS,sCAC9B,OAAM,IAAI,SAAS,YAAY,WAAW,SAAS,IAAK,CAAC;AAG3D,QAAO;EACL,MAAM,KAAK,MAAM,GAAG,KAAK,MAAM,KAAK,GAAG;EACvC,kBAAkB;EACnB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-sanity",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.5",
|
|
4
4
|
"description": "Sanity.io toolkit for Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"live",
|
|
@@ -66,9 +66,7 @@
|
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@sanity/browserslist-config": "^1.0.5",
|
|
69
|
-
"@sanity/pkg-utils": "^10.2.2",
|
|
70
69
|
"@sanity/tsconfig": "^2.1.0",
|
|
71
|
-
"@sanity/types": "^5.0.1",
|
|
72
70
|
"@sanity/webhook": "4.0.4",
|
|
73
71
|
"@types/node": "^24.10.4",
|
|
74
72
|
"@types/react": "^19.2.7",
|