@sanity/types 6.7.0-next.36 → 6.7.0-next.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/lib/index.d.ts CHANGED
@@ -3538,5 +3538,4 @@ interface UploadState {
3538
3538
  };
3539
3539
  previewImage?: string;
3540
3540
  }
3541
- export { ArrayActionName, ArrayDefinition, ArrayOfEntry, ArrayOfType, ArrayOptions, ArrayRule, ArraySchemaType, ArraySchemaTypeOf, Asset, AssetFromSource, AssetMetadataType, AssetSchemaTypeOptions, AssetSource, AssetSourceComponentAction, AssetSourceComponentProps, AssetSourceOpenInSourceResult, AssetSourceSpec, AssetSourceUploadEvent, AssetSourceUploadEventAbort, AssetSourceUploadEventAllComplete, AssetSourceUploadEventError, AssetSourceUploadEventProgress, AssetSourceUploadEventStatus, AssetSourceUploadFile, AssetSourceUploadSubscriber, AssetSourceUploader, AssetSourceUploaderClass, AutocompleteString, BaseSchemaDefinition, BaseSchemaType, BaseSchemaTypeOptions, BlockAnnotationDefinition, BlockChildrenObjectField, BlockDecoratorDefinition, BlockDefinition, BlockListDefinition, BlockListObjectField, BlockMarksDefinition, BlockOptions, BlockRule, BlockSchemaType, BlockStyleDefinition, BlockStyleObjectField, BooleanDefinition, BooleanOptions, BooleanRule, BooleanSchemaType, CanvasAppOptions, CanvasNotificationPayload, CollapseOptions, ConditionalIndexAccess, ConditionalProperty, ConditionalPropertyCallback, ConditionalPropertyCallbackContext, CreateIfNotExistsMutation, CreateMutation, CreateOrReplaceMutation, CreateSquashedMutation, CrossDatasetReferenceDefinition, CrossDatasetReferenceFilterResolver, CrossDatasetReferenceFilterSearchOptions, CrossDatasetReferenceSchemaType, CrossDatasetReferenceValue, CrossDatasetType, CurrentUser, CurrentUserAttribute, CustomValidator, CustomValidatorResult, DashboardNotificationPayload, DateDefinition, DateOptions, DateRule, DatetimeDefinition, DatetimeOptions, DatetimeRule, DefineArrayMemberBase, DefineSchemaBase, DefineSchemaOptions, DefineSchemaType, DeleteMutation, DeprecatedProperty, DeprecatedSchemaType, DeprecationConfiguration, DocumentDefinition, DocumentOptions, DocumentRule, DocumentSystem, DocumentSystemRef, EmailDefinition, EmailOptions, EmailRule, EmptyProps, EnumListProps, FieldDefinition, FieldDefinitionBase, FieldGroup, FieldGroupDefinition, FieldReference, FieldRules, Fieldset, FieldsetDefinition, File, FileAsset, FileDefinition, FileOptions, FileRule, FileSchemaType, FileValue, FormNodeValidation, GeopointDefinition, GeopointOptions, GeopointRule, GeopointValue, GlobalDocumentReferenceDefinition, GlobalDocumentReferenceFilterResolver, GlobalDocumentReferenceFilterSearchOptions, GlobalDocumentReferenceSchemaType, GlobalDocumentReferenceType, GlobalDocumentReferenceValue, HotspotOptions, HotspotPreview, I18nTextRecord, I18nTitledListValue, Image, ImageAsset, ImageCrop, ImageDefinition, ImageDimensions, ImageHotspot, ImageMetadata, ImageMetadataType, ImageOptions, ImagePalette, ImageRule, ImageSchemaType, ImageSwatch, ImageUrlAutoMode, ImageUrlCropMode, ImageUrlFitMode, ImageUrlFormat, ImageUrlOrientation, ImageUrlParams, ImageValue, IndexTuple, InitialValueProperty, InitialValueResolver, InitialValueResolverContext, InlineFieldDefinition, InsertMenuOptions, InsertPatch, IntrinsicArrayOfBase, IntrinsicArrayOfDefinition, IntrinsicBase, IntrinsicDefinitions, IntrinsicTypeName, KeyedObject, KeyedSegment, LocalizedValidationMessages, MEDIA_LIBRARY_ASSET_ASPECT_TYPE_NAME, MaybeAllowUnknownProps, MaybePreview, MediaAssetTypes, MediaLibraryAssetAspectDefinition, MediaLibraryAssetAspectDocument, MediaLibraryAssetAspectSupportedFieldDefinitions, MediaLibraryAssetAspectTypeName, MediaLibraryAssetType, MediaLibraryFilter, MediaLibraryOptions, MediaValidationValue, MediaValidator, MendozaEffectPair, MendozaPatch, ModalOptions, MultiFieldSet, MultipleMutationResult, Mutation, MutationOperationName, MutationSelection, NarrowPreview, NumberDefinition, NumberOptions, NumberRule, NumberSchemaType, ObjectDefinition, ObjectField, ObjectFieldType, ObjectOptions, ObjectRule, ObjectSchemaType, ObjectSchemaTypeWithOptions, PatchMutation, PatchMutationOperation, PatchOperations, Path, PathSegment, PortableTextBlock, PortableTextChild, PortableTextListBlock, PortableTextObject, PortableTextSpan, PortableTextTextBlock, PrepareViewOptions, PreviewConfig, PreviewValue, Reference, ReferenceBaseOptions, ReferenceDefinition, ReferenceFilterOptions, ReferenceFilterQueryOptions, ReferenceFilterResolver, ReferenceFilterResolverContext, ReferenceFilterResolverOptions, ReferenceFilterSearchOptions, ReferenceOptions, ReferenceRule, ReferenceSchemaType, ReferenceTo, ReferenceTypeFilter, ReferenceTypeFilterContext, ReferenceTypeOption, ReferenceValue, Role, Rule, RuleBuilder, RuleClass, RuleDef, RuleSpec, RuleSpecConstraint, RuleTypeConstraint, SanityCreateOptions, SanityDocument, SanityDocumentLike, Schema, SchemaType, SchemaTypeDefinition, SchemaValidationError, SchemaValidationProblem, SchemaValidationProblemGroup, SchemaValidationProblemPath, SchemaValidationValue, SchemaValidationWarning, SearchConfiguration, SearchStrategy, SingleFieldSet, SingleMutationResult, Slug, SlugDefinition, SlugIsUniqueValidator, SlugOptions, SlugParent, SlugRule, SlugSchemaType, SlugSourceContext, SlugSourceFn, SlugValidationContext, SlugValue, SlugifierFn, SortOrdering, SortOrderingItem, SpanMarksObjectField, SpanSchemaType, SpanTextObjectField, StrictDefinition, StrictVersionLayeringOptions, StringDefinition, StringOptions, StringRule, StringSchemaType, StudioNotificationPayload, SwatchName, TextDefinition, TextOptions, TextRule, TextSchemaType, TitledListValue, TransactionLogEvent, TransactionLogEventWithEffects, TransactionLogEventWithMutations, TransactionLogMutation, TypeAliasDefinition, TypeReference, TypedObject, UploadState, UriValidationOptions, UrlDefinition, UrlOptions, UrlRule, User, UserAttributeType, UserAttributeValue, ValidationBuilder, ValidationContext, ValidationError, ValidationErrorClass, ValidationErrorOptions, ValidationMarker, Validator, Validators, WeakCrossDatasetReferenceValue, WeakGlobalDocumentReferenceValue, WeakReference, WidenInitialValue, WidenValidation, defineArrayMember, defineAssetAspect, defineField, defineType, isArrayOfBlocksSchemaType, isArrayOfObjectsSchemaType, isArrayOfPrimitivesSchemaType, isArrayOfStringsSchemaType, isArraySchemaType, isAssetAspect, isBlockChildrenObjectField, isBlockListObjectField, isBlockSchemaType, isBlockStyleObjectField, isBooleanSchemaType, isCreateIfNotExistsMutation, isCreateMutation, isCreateOrReplaceMutation, isCreateSquashedMutation, isCrossDatasetReference, isCrossDatasetReferenceSchemaType, isDateTimeSchemaType, isDeleteMutation, isDeprecatedSchemaType, isDeprecationConfiguration, isDocumentSchemaType, isFileSchemaType, isGlobalDocumentReference, isImage, isImageSchemaType, isIndexSegment, isIndexTuple, isKeySegment, isKeyedObject, isNumberSchemaType, isObjectSchemaType, isPatchMutation, isPortableTextListBlock, isPortableTextSpan, isPortableTextTextBlock, isPrimitiveSchemaType, isReference, isReferenceSchemaType, isSanityDocument, isSearchStrategy, isSlug, isSpanSchemaType, isStringSchemaType, isTitledListValue, isTypedObject, isValidationError, isValidationErrorMarker, isValidationInfo, isValidationInfoMarker, isValidationWarning, isValidationWarningMarker, searchStrategies, typed };
3542
- //# sourceMappingURL=index.d.ts.map
3541
+ export { ArrayActionName, ArrayDefinition, ArrayOfEntry, ArrayOfType, ArrayOptions, ArrayRule, ArraySchemaType, ArraySchemaTypeOf, Asset, AssetFromSource, AssetMetadataType, AssetSchemaTypeOptions, AssetSource, AssetSourceComponentAction, AssetSourceComponentProps, AssetSourceOpenInSourceResult, AssetSourceSpec, AssetSourceUploadEvent, AssetSourceUploadEventAbort, AssetSourceUploadEventAllComplete, AssetSourceUploadEventError, AssetSourceUploadEventProgress, AssetSourceUploadEventStatus, AssetSourceUploadFile, AssetSourceUploadSubscriber, AssetSourceUploader, AssetSourceUploaderClass, AutocompleteString, BaseSchemaDefinition, BaseSchemaType, BaseSchemaTypeOptions, BlockAnnotationDefinition, BlockChildrenObjectField, BlockDecoratorDefinition, BlockDefinition, BlockListDefinition, BlockListObjectField, BlockMarksDefinition, BlockOptions, BlockRule, BlockSchemaType, BlockStyleDefinition, BlockStyleObjectField, BooleanDefinition, BooleanOptions, BooleanRule, BooleanSchemaType, CanvasAppOptions, CanvasNotificationPayload, CollapseOptions, ConditionalIndexAccess, ConditionalProperty, ConditionalPropertyCallback, ConditionalPropertyCallbackContext, CreateIfNotExistsMutation, CreateMutation, CreateOrReplaceMutation, CreateSquashedMutation, CrossDatasetReferenceDefinition, CrossDatasetReferenceFilterResolver, CrossDatasetReferenceFilterSearchOptions, CrossDatasetReferenceSchemaType, CrossDatasetReferenceValue, CrossDatasetType, CurrentUser, CurrentUserAttribute, CustomValidator, CustomValidatorResult, DashboardNotificationPayload, DateDefinition, DateOptions, DateRule, DatetimeDefinition, DatetimeOptions, DatetimeRule, DefineArrayMemberBase, DefineSchemaBase, DefineSchemaOptions, DefineSchemaType, DeleteMutation, DeprecatedProperty, DeprecatedSchemaType, DeprecationConfiguration, DocumentDefinition, DocumentOptions, DocumentRule, DocumentSystem, DocumentSystemRef, EmailDefinition, EmailOptions, EmailRule, EmptyProps, EnumListProps, FieldDefinition, FieldDefinitionBase, FieldGroup, FieldGroupDefinition, FieldReference, FieldRules, Fieldset, FieldsetDefinition, File, FileAsset, FileDefinition, FileOptions, FileRule, FileSchemaType, FileValue, FormNodeValidation, GeopointDefinition, GeopointOptions, GeopointRule, GeopointValue, GlobalDocumentReferenceDefinition, GlobalDocumentReferenceFilterResolver, GlobalDocumentReferenceFilterSearchOptions, GlobalDocumentReferenceSchemaType, GlobalDocumentReferenceType, GlobalDocumentReferenceValue, HotspotOptions, HotspotPreview, I18nTextRecord, I18nTitledListValue, Image, ImageAsset, ImageCrop, ImageDefinition, ImageDimensions, ImageHotspot, ImageMetadata, ImageMetadataType, ImageOptions, ImagePalette, ImageRule, ImageSchemaType, ImageSwatch, ImageUrlAutoMode, ImageUrlCropMode, ImageUrlFitMode, ImageUrlFormat, ImageUrlOrientation, ImageUrlParams, ImageValue, IndexTuple, InitialValueProperty, InitialValueResolver, InitialValueResolverContext, InlineFieldDefinition, InsertMenuOptions, InsertPatch, IntrinsicArrayOfBase, IntrinsicArrayOfDefinition, IntrinsicBase, IntrinsicDefinitions, IntrinsicTypeName, KeyedObject, KeyedSegment, LocalizedValidationMessages, MEDIA_LIBRARY_ASSET_ASPECT_TYPE_NAME, MaybeAllowUnknownProps, MaybePreview, MediaAssetTypes, MediaLibraryAssetAspectDefinition, MediaLibraryAssetAspectDocument, MediaLibraryAssetAspectSupportedFieldDefinitions, MediaLibraryAssetAspectTypeName, MediaLibraryAssetType, MediaLibraryFilter, MediaLibraryOptions, MediaValidationValue, MediaValidator, MendozaEffectPair, MendozaPatch, ModalOptions, MultiFieldSet, MultipleMutationResult, Mutation, MutationOperationName, MutationSelection, NarrowPreview, NumberDefinition, NumberOptions, NumberRule, NumberSchemaType, ObjectDefinition, ObjectField, ObjectFieldType, ObjectOptions, ObjectRule, ObjectSchemaType, ObjectSchemaTypeWithOptions, PatchMutation, PatchMutationOperation, PatchOperations, Path, PathSegment, PortableTextBlock, PortableTextChild, PortableTextListBlock, PortableTextObject, PortableTextSpan, PortableTextTextBlock, PrepareViewOptions, PreviewConfig, PreviewValue, Reference, ReferenceBaseOptions, ReferenceDefinition, ReferenceFilterOptions, ReferenceFilterQueryOptions, ReferenceFilterResolver, ReferenceFilterResolverContext, ReferenceFilterResolverOptions, ReferenceFilterSearchOptions, ReferenceOptions, ReferenceRule, ReferenceSchemaType, ReferenceTo, ReferenceTypeFilter, ReferenceTypeFilterContext, ReferenceTypeOption, ReferenceValue, Role, Rule, RuleBuilder, RuleClass, RuleDef, RuleSpec, RuleSpecConstraint, RuleTypeConstraint, SanityCreateOptions, SanityDocument, SanityDocumentLike, Schema, SchemaType, SchemaTypeDefinition, SchemaValidationError, SchemaValidationProblem, SchemaValidationProblemGroup, SchemaValidationProblemPath, SchemaValidationValue, SchemaValidationWarning, SearchConfiguration, SearchStrategy, SingleFieldSet, SingleMutationResult, Slug, SlugDefinition, SlugIsUniqueValidator, SlugOptions, SlugParent, SlugRule, SlugSchemaType, SlugSourceContext, SlugSourceFn, SlugValidationContext, SlugValue, SlugifierFn, SortOrdering, SortOrderingItem, SpanMarksObjectField, SpanSchemaType, SpanTextObjectField, StrictDefinition, StrictVersionLayeringOptions, StringDefinition, StringOptions, StringRule, StringSchemaType, StudioNotificationPayload, SwatchName, TextDefinition, TextOptions, TextRule, TextSchemaType, TitledListValue, TransactionLogEvent, TransactionLogEventWithEffects, TransactionLogEventWithMutations, TransactionLogMutation, TypeAliasDefinition, TypeReference, TypedObject, UploadState, UriValidationOptions, UrlDefinition, UrlOptions, UrlRule, User, UserAttributeType, UserAttributeValue, ValidationBuilder, ValidationContext, ValidationError, ValidationErrorClass, ValidationErrorOptions, ValidationMarker, Validator, Validators, WeakCrossDatasetReferenceValue, WeakGlobalDocumentReferenceValue, WeakReference, WidenInitialValue, WidenValidation, defineArrayMember, defineAssetAspect, defineField, defineType, isArrayOfBlocksSchemaType, isArrayOfObjectsSchemaType, isArrayOfPrimitivesSchemaType, isArrayOfStringsSchemaType, isArraySchemaType, isAssetAspect, isBlockChildrenObjectField, isBlockListObjectField, isBlockSchemaType, isBlockStyleObjectField, isBooleanSchemaType, isCreateIfNotExistsMutation, isCreateMutation, isCreateOrReplaceMutation, isCreateSquashedMutation, isCrossDatasetReference, isCrossDatasetReferenceSchemaType, isDateTimeSchemaType, isDeleteMutation, isDeprecatedSchemaType, isDeprecationConfiguration, isDocumentSchemaType, isFileSchemaType, isGlobalDocumentReference, isImage, isImageSchemaType, isIndexSegment, isIndexTuple, isKeySegment, isKeyedObject, isNumberSchemaType, isObjectSchemaType, isPatchMutation, isPortableTextListBlock, isPortableTextSpan, isPortableTextTextBlock, isPrimitiveSchemaType, isReference, isReferenceSchemaType, isSanityDocument, isSearchStrategy, isSlug, isSpanSchemaType, isStringSchemaType, isTitledListValue, isTypedObject, isValidationError, isValidationErrorMarker, isValidationInfo, isValidationInfoMarker, isValidationWarning, isValidationWarningMarker, searchStrategies, typed };
package/lib/index.js CHANGED
@@ -1,542 +1,270 @@
1
1
  function isObject(obj) {
2
- return typeof obj == "object" && !!obj && !Array.isArray(obj);
2
+ return typeof obj == "object" && obj !== null && !Array.isArray(obj);
3
3
  }
4
- /** @internal */
5
4
  function isReference(reference) {
6
- return isObject(reference) && typeof reference._ref == "string";
5
+ return isObject(reference) && typeof reference._ref == "string";
7
6
  }
8
- /** @public */
9
7
  function isImage(value) {
10
- return isObject(value) && isReference(value.asset) && value.asset._ref.startsWith("image-");
8
+ return isObject(value) && isReference(value.asset) && value.asset._ref.startsWith("image-");
11
9
  }
12
- /** @beta */
13
10
  function isCrossDatasetReference(reference) {
14
- return isObject(reference) && typeof reference._ref == "string" && typeof reference._dataset == "string" && typeof reference._projectId == "string";
11
+ return isObject(reference) && typeof reference._ref == "string" && typeof reference._dataset == "string" && typeof reference._projectId == "string";
15
12
  }
16
- /** @public */
17
13
  function isSanityDocument(document) {
18
- return isObject(document) && typeof document._id == "string" && typeof document._type == "string";
14
+ return isObject(document) && typeof document._id == "string" && typeof document._type == "string";
19
15
  }
20
- /** @public */
21
16
  function isTypedObject(obj) {
22
- return isObject(obj) && typeof obj._type == "string";
17
+ return isObject(obj) && typeof obj._type == "string";
23
18
  }
24
- /** @public */
25
19
  function isKeyedObject(obj) {
26
- return isObject(obj) && typeof obj._key == "string";
20
+ return isObject(obj) && typeof obj._key == "string";
27
21
  }
28
- /** @beta */
29
22
  function isGlobalDocumentReference(reference) {
30
- return !isObject(reference) || typeof reference._ref != "string" ? !1 : reference._ref.split(":").length === 3;
23
+ return !isObject(reference) || typeof reference._ref != "string" ? !1 : reference._ref.split(":").length === 3;
31
24
  }
32
- /** @internal */
33
25
  function isValidationErrorMarker(marker) {
34
- return marker.level === "error";
26
+ return marker.level === "error";
35
27
  }
36
- /** @internal */
37
28
  function isValidationWarningMarker(marker) {
38
- return marker.level === "warning";
29
+ return marker.level === "warning";
39
30
  }
40
- /** @internal */
41
31
  function isValidationInfoMarker(marker) {
42
- return marker.level === "info";
32
+ return marker.level === "info";
43
33
  }
44
- /**
45
- * @public
46
- */
47
34
  const MEDIA_LIBRARY_ASSET_ASPECT_TYPE_NAME = "sanity.asset.aspect";
48
- /**
49
- * Check whether the provided value resembles a Media Library asset aspect document.
50
- *
51
- * Note: This function does not perform a comprehensive check.
52
- *
53
- * @see validateMediaLibraryAssetAspect
54
- *
55
- * @internal
56
- */
57
35
  function isAssetAspect(maybeAssetAspect) {
58
- return typeof maybeAssetAspect == "object" && !!maybeAssetAspect && "_type" in maybeAssetAspect && maybeAssetAspect._type === "sanity.asset.aspect";
59
- }
60
- /**
61
- * Define a Media Library asset aspect.
62
- *
63
- * Aspects can be deployed using the `sanity media deploy-aspect` CLI command.
64
- *
65
- * @public
66
- * @beta
67
- */
36
+ return typeof maybeAssetAspect == "object" && maybeAssetAspect !== null && "_type" in maybeAssetAspect && maybeAssetAspect._type === MEDIA_LIBRARY_ASSET_ASPECT_TYPE_NAME;
37
+ }
68
38
  function defineAssetAspect(definition) {
69
- let { assetType, name } = definition;
70
- return {
71
- _type: MEDIA_LIBRARY_ASSET_ASPECT_TYPE_NAME,
72
- _id: `${name}`,
73
- definition,
74
- ...assetType && { assetType: Array.isArray(assetType) ? assetType : [assetType] },
75
- public: definition.public
76
- };
77
- }
78
- /** @internal */
39
+ const { assetType, name } = definition;
40
+ return {
41
+ _type: MEDIA_LIBRARY_ASSET_ASPECT_TYPE_NAME,
42
+ _id: `${name}`,
43
+ definition,
44
+ ...assetType && {
45
+ assetType: Array.isArray(assetType) ? assetType : [assetType]
46
+ },
47
+ public: definition.public
48
+ };
49
+ }
79
50
  function isCreateMutation(mutation) {
80
- return "create" in mutation;
51
+ return "create" in mutation;
81
52
  }
82
- /** @internal */
83
53
  function isCreateIfNotExistsMutation(mutation) {
84
- return "createIfNotExists" in mutation;
54
+ return "createIfNotExists" in mutation;
85
55
  }
86
- /** @internal */
87
56
  function isCreateOrReplaceMutation(mutation) {
88
- return "createOrReplace" in mutation;
57
+ return "createOrReplace" in mutation;
89
58
  }
90
- /** @internal */
91
59
  function isDeleteMutation(mutation) {
92
- return "delete" in mutation;
60
+ return "delete" in mutation;
93
61
  }
94
- /** @internal */
95
62
  function isPatchMutation(mutation) {
96
- return "patch" in mutation;
63
+ return "patch" in mutation;
97
64
  }
98
65
  const reKeySegment = /_key\s*==\s*['"](.*)['"]/, reIndexTuple = /^\d*:\d*$/;
99
- /** @internal */
100
66
  function isIndexSegment(segment) {
101
- return typeof segment == "number" || typeof segment == "string" && /^\[\d+\]$/.test(segment);
67
+ return typeof segment == "number" || typeof segment == "string" && /^\[\d+\]$/.test(segment);
102
68
  }
103
- /** @internal */
104
69
  function isKeySegment(segment) {
105
- return typeof segment == "string" ? reKeySegment.test(segment.trim()) : typeof segment == "object" && "_key" in segment;
70
+ return typeof segment == "string" ? reKeySegment.test(segment.trim()) : typeof segment == "object" && "_key" in segment;
106
71
  }
107
- /** @internal */
108
72
  function isIndexTuple(segment) {
109
- if (typeof segment == "string" && reIndexTuple.test(segment)) return !0;
110
- if (!Array.isArray(segment) || segment.length !== 2) return !1;
111
- let [from, to] = segment;
112
- return (typeof from == "number" || from === "") && (typeof to == "number" || to === "");
73
+ if (typeof segment == "string" && reIndexTuple.test(segment))
74
+ return !0;
75
+ if (!Array.isArray(segment) || segment.length !== 2)
76
+ return !1;
77
+ const [from, to] = segment;
78
+ return (typeof from == "number" || from === "") && (typeof to == "number" || to === "");
113
79
  }
114
80
  function isRecord$1(value) {
115
- return !!value && (typeof value == "object" || typeof value == "function");
116
- }
117
- /**
118
- * Assert that a given object is a portable-text text-block type object
119
- *
120
- * @remarks
121
- * * The `markDefs` and `style` property of a block is optional.
122
- * * Block types can be named, so expect anything of the _type property.
123
- *
124
- * @alpha
125
- */
81
+ return !!value && (typeof value == "object" || typeof value == "function");
82
+ }
126
83
  function isPortableTextTextBlock(value) {
127
- return isRecord$1(value) && typeof value._type == "string" && Array.isArray(value.children) && value.children.every((child) => isRecord$1(child)) && ("markDefs" in value ? Array.isArray(value.markDefs) && value.markDefs.every((def) => isRecord$1(def)) : !0) && ("style" in value ? typeof value.style == "string" : !0);
128
- }
129
- /**
130
- * Assert that a given object is a portable-text span-type object
131
- *
132
- * @remarks
133
- * The `marks` property of a block is optional.
134
- *
135
- * @alpha
136
- */
84
+ return isRecord$1(value) && typeof value._type == "string" && // block types can be named, so expect anything here.
85
+ Array.isArray(value.children) && value.children.every((child) => isRecord$1(child)) && ("markDefs" in value ? Array.isArray(value.markDefs) && value.markDefs.every((def) => isRecord$1(def)) : !0) && ("style" in value ? typeof value.style == "string" : !0);
86
+ }
137
87
  function isPortableTextSpan(value) {
138
- return isRecord$1(value) && value._type === "span" && typeof value.text == "string" && ("marks" in value ? Array.isArray(value.marks) && value.marks.every((mark) => typeof mark == "string") : !0);
139
- }
140
- /**
141
- * Assert that a given object is a portable-text list-text-block-type object
142
- *
143
- * @remarks
144
- * Uses `isPortableTextTextBlock` and checks for `listItem` and `level`
145
- *
146
- * @see isPortableTextTextBlock
147
- *
148
- * @alpha
149
- */
88
+ return isRecord$1(value) && value._type === "span" && typeof value.text == "string" && ("marks" in value ? Array.isArray(value.marks) && value.marks.every((mark) => typeof mark == "string") : !0);
89
+ }
150
90
  function isPortableTextListBlock(value) {
151
- return isPortableTextTextBlock(value) && "listItem" in value && typeof value.listItem == "string" && "level" in value && Number.isInteger(value.level);
91
+ return isPortableTextTextBlock(value) && "listItem" in value && typeof value.listItem == "string" && "level" in value && Number.isInteger(value.level);
152
92
  }
153
93
  function isRecord(value) {
154
- return !!value && (typeof value == "object" || typeof value == "function");
155
- }
156
- /**
157
- * Returns wether or not the given type is a document type
158
- * (eg that it was defined as `type: 'document'`)
159
- *
160
- * @param type - Schema type to test
161
- * @returns True if type is a document type, false otherwise
162
- *
163
- * @public
164
- */
94
+ return !!value && (typeof value == "object" || typeof value == "function");
95
+ }
165
96
  function isDocumentSchemaType(type) {
166
- if (!isObjectSchemaType(type)) return !1;
167
- let current = type;
168
- for (; current;) {
169
- if (current.name === "document") return !0;
170
- current = current.type;
171
- }
172
- return !1;
173
- }
174
- /** @internal */
97
+ if (!isObjectSchemaType(type))
98
+ return !1;
99
+ let current = type;
100
+ for (; current; ) {
101
+ if (current.name === "document")
102
+ return !0;
103
+ current = current.type;
104
+ }
105
+ return !1;
106
+ }
175
107
  function isObjectSchemaType(type) {
176
- return isRecord(type) ? type.jsonType === "object" : !1;
108
+ return isRecord(type) ? type.jsonType === "object" : !1;
177
109
  }
178
- /** @internal */
179
110
  function isArraySchemaType(type) {
180
- return isRecord(type) ? type.jsonType === "array" : !1;
111
+ return isRecord(type) ? type.jsonType === "array" : !1;
181
112
  }
182
- /** @internal */
183
113
  function isArrayOfBlocksSchemaType(type) {
184
- return isArraySchemaType(type) && type.of.some((memberType) => isBlockSchemaType(memberType));
114
+ return isArraySchemaType(type) && type.of.some((memberType) => isBlockSchemaType(memberType));
185
115
  }
186
- /** @internal */
187
116
  function isArrayOfObjectsSchemaType(type) {
188
- return isArraySchemaType(type) && type.of.every((memberType) => isObjectSchemaType(memberType));
117
+ return isArraySchemaType(type) && type.of.every((memberType) => isObjectSchemaType(memberType));
189
118
  }
190
- /** @internal */
191
119
  function isArrayOfPrimitivesSchemaType(type) {
192
- return isArraySchemaType(type) && type.of.every((memberType) => isPrimitiveSchemaType(memberType));
120
+ return isArraySchemaType(type) && type.of.every((memberType) => isPrimitiveSchemaType(memberType));
193
121
  }
194
- /** @internal */
195
122
  function isArrayOfStringsSchemaType(type) {
196
- return isArraySchemaType(type) && type.of.every((memberType) => isStringSchemaType(memberType));
123
+ return isArraySchemaType(type) && type.of.every((memberType) => isStringSchemaType(memberType));
197
124
  }
198
- /** @internal */
199
125
  function isBooleanSchemaType(type) {
200
- return isRecord(type) ? type.jsonType === "boolean" : !1;
126
+ return isRecord(type) ? type.jsonType === "boolean" : !1;
201
127
  }
202
- /** @internal */
203
128
  function isStringSchemaType(type) {
204
- return isRecord(type) ? type.jsonType === "string" : !1;
129
+ return isRecord(type) ? type.jsonType === "string" : !1;
205
130
  }
206
- /** @internal */
207
131
  function isDateTimeSchemaType(type) {
208
- return isStringSchemaType(type) ? type.name === "datetime" : !1;
132
+ return isStringSchemaType(type) ? type.name === "datetime" : !1;
209
133
  }
210
- /** @internal */
211
134
  function isNumberSchemaType(type) {
212
- return isRecord(type) ? type.jsonType === "number" : !1;
135
+ return isRecord(type) ? type.jsonType === "number" : !1;
213
136
  }
214
- /** @internal */
215
137
  function isPrimitiveSchemaType(type) {
216
- return isBooleanSchemaType(type) || isStringSchemaType(type) || isNumberSchemaType(type);
138
+ return isBooleanSchemaType(type) || isStringSchemaType(type) || isNumberSchemaType(type);
217
139
  }
218
- /** @internal */
219
140
  function isReferenceSchemaType(type) {
220
- return isRecord(type) && (type.name === "reference" || isReferenceSchemaType(type.type));
141
+ return isRecord(type) && (type.name === "reference" || isReferenceSchemaType(type.type));
221
142
  }
222
- /** @internal */
223
143
  function isImageSchemaType(type) {
224
- return isRecord(type) && (type.name === "image" || isImageSchemaType(type.type));
144
+ return isRecord(type) && (type.name === "image" || isImageSchemaType(type.type));
225
145
  }
226
- /** @internal */
227
146
  function isFileSchemaType(type) {
228
- return isRecord(type) && (type.name === "file" || isFileSchemaType(type.type));
147
+ return isRecord(type) && (type.name === "file" || isFileSchemaType(type.type));
229
148
  }
230
- /** @internal */
231
149
  function isDeprecatedSchemaType(type) {
232
- return isRecord(type) ? type.deprecated !== void 0 : !1;
150
+ return isRecord(type) ? typeof type.deprecated < "u" : !1;
233
151
  }
234
- /** @internal */
235
152
  function isDeprecationConfiguration(type) {
236
- return isRecord(type) ? type.deprecated !== void 0 : !1;
153
+ return isRecord(type) ? typeof type.deprecated < "u" : !1;
237
154
  }
238
- /** @internal */
239
155
  function isCrossDatasetReferenceSchemaType(type) {
240
- return isRecord(type) && (type.name === "crossDatasetReference" || isCrossDatasetReferenceSchemaType(type.type));
156
+ return isRecord(type) && (type.name === "crossDatasetReference" || isCrossDatasetReferenceSchemaType(type.type));
241
157
  }
242
- /** @internal */
243
158
  function isTitledListValue(item) {
244
- return typeof item == "object" && !!item && "title" in item && "value" in item;
159
+ return typeof item == "object" && item !== null && "title" in item && "value" in item;
245
160
  }
246
- /** @internal */
247
161
  function isSpanSchemaType(type) {
248
- return isRecord(type) ? Array.isArray(type.annotations) && Array.isArray(type.decorators) : !1;
162
+ return isRecord(type) ? Array.isArray(type.annotations) && Array.isArray(type.decorators) : !1;
249
163
  }
250
- /** @internal */
251
164
  function isBlockSchemaType(type) {
252
- if (!isRecord(type) || !Array.isArray(type.fields)) return !1;
253
- let maybeSpanChildren = type.fields.find(isBlockChildrenObjectField), maybeStyle = type.fields.find(isBlockStyleObjectField), maybeList = type.fields.find(isBlockListObjectField);
254
- return isBlockChildrenObjectField(maybeSpanChildren) && isBlockStyleObjectField(maybeStyle) && isBlockListObjectField(maybeList);
165
+ if (!isRecord(type) || !Array.isArray(type.fields)) return !1;
166
+ const maybeSpanChildren = type.fields.find(isBlockChildrenObjectField), maybeStyle = type.fields.find(isBlockStyleObjectField), maybeList = type.fields.find(isBlockListObjectField);
167
+ return isBlockChildrenObjectField(maybeSpanChildren) && isBlockStyleObjectField(maybeStyle) && isBlockListObjectField(maybeList);
255
168
  }
256
- /** @internal */
257
169
  function isBlockStyleObjectField(field) {
258
- return !isRecord(field) || field.name !== "style" ? !1 : isRecord(field.type) && field.type.jsonType === "string";
170
+ return !isRecord(field) || field.name !== "style" ? !1 : isRecord(field.type) && field.type.jsonType === "string";
259
171
  }
260
- /** @internal */
261
172
  function isBlockListObjectField(field) {
262
- return !isRecord(field) || field.name !== "listItem" ? !1 : isRecord(field.type) && field.type.jsonType === "string";
173
+ return !isRecord(field) || field.name !== "listItem" ? !1 : isRecord(field.type) && field.type.jsonType === "string";
263
174
  }
264
- /** @internal */
265
175
  function isBlockChildrenObjectField(field) {
266
- return !isRecord(field) || field.name !== "children" || !isArraySchemaType(field.type) ? !1 : field.type.of.some(isSpanSchemaType);
267
- }
268
- /**
269
- * Helper function for defining a Sanity type definition. This function does not do anything on its own;
270
- * it exists to check that your schema definition is correct, and help autocompletion in your IDE.
271
- *
272
- * This function will narrow the schema type down to fields and options based on the provided type-string.
273
- *
274
- * Schema types defined using `defineType` should typically be added to the Studio config under `schema.types`.
275
- * Defined types can be referenced by their `name`. This is referred to as a type-alias.
276
- *
277
- * When using type-aliases as `type`, `defineType` cannot know the base-type, so type-safety will be reduced.
278
- * If you know the base type of the type-alias, provide `defineOptions.aliasFor: <base type name>`.
279
- * This will enforce that the schema definition conforms with the provided type.
280
- *
281
- * By default, `defineType` only allows known properties and options.
282
- * Use `defineOptions.strict: false` to allow unknown properties and options.
283
- *
284
- * ### Basic usage
285
- *
286
- * ```ts
287
- * defineType({
288
- * type: 'object',
289
- * name: 'custom-object',
290
- * fields: [ {type: 'string', name: 'title', title: 'Title'}],
291
- * })
292
- * ```
293
- *
294
- * ### Usage with aliasFor narrowing
295
- *
296
- * ```ts
297
- * defineType({
298
- * type: 'custom-object',
299
- * name: 'redefined-custom-object',
300
- * options: {
301
- * columns: 2
302
- * }
303
- * }, {aliasFor: 'object' })
304
- * ```
305
- *
306
- * ### Allow unknown properties
307
- *
308
- * ```ts
309
- * defineType({
310
- * type: 'custom-object',
311
- * name: 'redefined-custom-object',
312
- * allowsUnknownProperties: true
313
- * options: {
314
- * columns: 2,
315
- * allowsUnknownOptions: true
316
- * }
317
- * }, {strict: false})
318
- * ```
319
- * ### Maximum safety and best autocompletion
320
- *
321
- * Use {@link defineType}, {@link defineField} and {@link defineArrayMember}:
322
- *
323
- * ```ts
324
- * defineType({
325
- * type: 'object',
326
- * name: 'custom-object',
327
- * fields: [
328
- * defineField({
329
- * type: 'array',
330
- * name: 'arrayField',
331
- * title: 'Things',
332
- * of: [
333
- * defineArrayMember({
334
- * type: 'object',
335
- * name: 'type-name-in-array',
336
- * fields: [defineField({type: 'string', name: 'title', title: 'Title'})],
337
- * }),
338
- * ],
339
- * }),
340
- * ],
341
- * })
342
- * ```
343
- *
344
- * ## Note on type-safety in the current implementation
345
- *
346
- * Type-safety inside array-like properties (schema properties like `fields` and `of`) can only be guaranteed when
347
- * {@link defineField} and {@link defineArrayMember} are used to wrap each value in the array.
348
- *
349
- * For array-values without a function-wrapper, TypeScript will resolve to a union type of all possible properties across
350
- * all schema types. This result in less precise typing.
351
- *
352
- * ### Extending the Sanity Schema types
353
- *
354
- * If you want to extend the Sanity Schema types with your own properties or options to make them typesafe,
355
- * you can use [TypeScript declaration merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html).
356
- *
357
- * With declaration merging, properties and options will be available in a type-safe manner, and
358
- * `strict: false` will not be necessary.
359
- *
360
- * #### Example: Add option to StringOptions
361
- *
362
- * ```ts
363
- * // string.ts
364
- *
365
- * //redeclare the sanity module
366
- * declare module 'sanity' {
367
- * // redeclare StringOptions; it will be merged with StringOptions in the sanity module
368
- * export interface StringOptions {
369
- * myCustomOption?: boolean
370
- * }
371
- * }
372
- *
373
- * // the option is now part of the StringOptions type, just as if it was declared in the sanity codebase:
374
- * defineType({
375
- * type: 'string',
376
- * name: 'my-string',
377
- * options: {
378
- * myCustomOption: true // this does not give an error anymore
379
- * }
380
- * })
381
- *
382
- * ```
383
- *
384
- * #### Example: Add a schema definition to "intrinsic-types"
385
- *
386
- * ```ts
387
- * //my-custom-type-definition.ts
388
- *
389
- * // create a new schema definition based on object (we remove the ability to assign field, change the type add some options)
390
- * export type MagicallyAddedDefinition = Omit<Schema.ObjectDefinition, 'type' | 'fields'> & {
391
- * type: 'magically-added-type'
392
- * options?: {
393
- * sparkles?: boolean
394
- * }
395
- * }
396
- *
397
- * // redeclares sanity module so we can add interfaces props to it
398
- * declare module 'sanity' {
399
- * // redeclares IntrinsicDefinitions and adds a named definition to it
400
- * // it is important that the key is the same as the type in the definition ('magically-added-type')
401
- * export interface IntrinsicDefinitions {
402
- * 'magically-added-type': MagicallyAddedDefinition
403
- * }
404
- * }
405
- *
406
- * // defineType will now narrow `type: 'magically-added-type'` to `MagicallyAddedDefinition`
407
- * defineType({
408
- * type: 'magically-added-type'
409
- * name: 'magic',
410
- * options: {
411
- * sparkles: true // this is allowed,
412
- * //@ts-expect-error this is not allowed in MagicallyAddedDefinition.options
413
- * sparks: true
414
- * }
415
- * })
416
- * ```
417
- *
418
- * @param schemaDefinition - should be a valid schema type definition.
419
- * @param defineOptions - optional param to provide type hints for `schemaDefinition`.
420
- *
421
- * @see defineField
422
- * @see defineArrayMember
423
- * @see typed
424
- *
425
- * @beta
426
- */
176
+ return !isRecord(field) || field.name !== "children" || !isArraySchemaType(field.type) ? !1 : field.type.of.some(isSpanSchemaType);
177
+ }
427
178
  function defineType(schemaDefinition, defineOptions) {
428
- return schemaDefinition;
429
- }
430
- /**
431
- * Define a field within a document, object, image or file definition `fields` array.
432
- *
433
- * This function will narrow the schema type down to fields and options based on the provided
434
- * type-string.
435
- *
436
- * Using `defineField` is optional, but should provide improved autocompletion in your IDE, when building your schema.
437
- * Field-properties like `validation` and `initialValue`will also be more specific.
438
- *
439
- * See {@link defineType} for more examples.
440
- *
441
- * @param schemaField - should be a valid field type definition.
442
- * @param defineOptions - optional param to provide type hints for `schemaField`.
443
- *
444
- * @see defineField
445
- * @see defineArrayMember
446
- * @see typed
447
- *
448
- * @beta
449
- */
179
+ return schemaDefinition;
180
+ }
450
181
  function defineField(schemaField, defineOptions) {
451
- return schemaField;
452
- }
453
- /**
454
- * Define an array item member type within an array definition `of`-array.
455
- *
456
- * This function will narrow the schema type down to fields and options based on the provided
457
- * `type` string.
458
- *
459
- * Using `defineArrayMember` is optional, but should provide improved autocompletion in your IDE, when building your schema.
460
- * Field properties like `validation` and `initialValue` will also be more specific.
461
- *
462
- * See {@link defineType} for example usage.
463
- *
464
- * @param arrayOfSchema - should be a valid `array.of` member definition.
465
- * @param defineOptions - optional param to provide type hints for `arrayOfSchema`.
466
- *
467
- * @see defineType
468
- * @see defineField
469
- * @see typed
470
- *
471
- * @beta
472
- */
182
+ return schemaField;
183
+ }
473
184
  function defineArrayMember(arrayOfSchema, defineOptions) {
474
- return arrayOfSchema;
475
- }
476
- /**
477
- * `typed` can be used to ensure that an object conforms to an exact interface.
478
- *
479
- * It can be useful when working with `defineType` and `defineField` on occasions where a wider type with
480
- * custom options or properties is required.
481
- *
482
- * ## Example usage
483
- * ```ts
484
- * defineField({
485
- * type: 'string',
486
- * name: 'nestedField',
487
- * options: typed<StringOptions & {myCustomOption: boolean}>({
488
- * layout: 'radio',
489
- * // allowed
490
- * myCustomOption: true,
491
- * //@ts-expect-error unknownProp is not part of StringOptions & {myCustomOption: boolean}
492
- * unknownProp: 'not allowed in typed context',
493
- * }),
494
- * }),
495
- * ```
496
- *
497
- * @param input - returned directly
498
- *
499
- * @internal
500
- */
185
+ return arrayOfSchema;
186
+ }
501
187
  function typed(input) {
502
- return input;
188
+ return input;
503
189
  }
504
- /**
505
- * @public
506
- */
507
190
  const searchStrategies = ["groq2024", "groqLegacy"];
508
- /**
509
- * @internal
510
- */
511
191
  function isSearchStrategy(maybeSearchStrategy) {
512
- return searchStrategies.includes(maybeSearchStrategy);
513
- }
514
- /**
515
- * Checks whether the given `thing` is a slug, eg an object with a `current` string property.
516
- *
517
- * @param thing - The thing to check
518
- * @returns True if slug, false otherwise
519
- * @public
520
- */
192
+ return searchStrategies.includes(maybeSearchStrategy);
193
+ }
521
194
  function isSlug(thing) {
522
- return isObject(thing) && typeof thing.current == "string";
195
+ return isObject(thing) && typeof thing.current == "string";
523
196
  }
524
- /** @internal */
525
197
  function isCreateSquashedMutation(mutation) {
526
- return "createSquashed" in mutation;
198
+ return "createSquashed" in mutation;
527
199
  }
528
- /** @internal */
529
200
  function isValidationError(node) {
530
- return node.level === "error";
201
+ return node.level === "error";
531
202
  }
532
- /** @internal */
533
203
  function isValidationWarning(node) {
534
- return node.level === "warning";
204
+ return node.level === "warning";
535
205
  }
536
- /** @internal */
537
206
  function isValidationInfo(node) {
538
- return node.level === "info";
539
- }
540
- export { MEDIA_LIBRARY_ASSET_ASPECT_TYPE_NAME, defineArrayMember, defineAssetAspect, defineField, defineType, isArrayOfBlocksSchemaType, isArrayOfObjectsSchemaType, isArrayOfPrimitivesSchemaType, isArrayOfStringsSchemaType, isArraySchemaType, isAssetAspect, isBlockChildrenObjectField, isBlockListObjectField, isBlockSchemaType, isBlockStyleObjectField, isBooleanSchemaType, isCreateIfNotExistsMutation, isCreateMutation, isCreateOrReplaceMutation, isCreateSquashedMutation, isCrossDatasetReference, isCrossDatasetReferenceSchemaType, isDateTimeSchemaType, isDeleteMutation, isDeprecatedSchemaType, isDeprecationConfiguration, isDocumentSchemaType, isFileSchemaType, isGlobalDocumentReference, isImage, isImageSchemaType, isIndexSegment, isIndexTuple, isKeySegment, isKeyedObject, isNumberSchemaType, isObjectSchemaType, isPatchMutation, isPortableTextListBlock, isPortableTextSpan, isPortableTextTextBlock, isPrimitiveSchemaType, isReference, isReferenceSchemaType, isSanityDocument, isSearchStrategy, isSlug, isSpanSchemaType, isStringSchemaType, isTitledListValue, isTypedObject, isValidationError, isValidationErrorMarker, isValidationInfo, isValidationInfoMarker, isValidationWarning, isValidationWarningMarker, searchStrategies, typed };
541
-
542
- //# sourceMappingURL=index.js.map
207
+ return node.level === "info";
208
+ }
209
+ export {
210
+ MEDIA_LIBRARY_ASSET_ASPECT_TYPE_NAME,
211
+ defineArrayMember,
212
+ defineAssetAspect,
213
+ defineField,
214
+ defineType,
215
+ isArrayOfBlocksSchemaType,
216
+ isArrayOfObjectsSchemaType,
217
+ isArrayOfPrimitivesSchemaType,
218
+ isArrayOfStringsSchemaType,
219
+ isArraySchemaType,
220
+ isAssetAspect,
221
+ isBlockChildrenObjectField,
222
+ isBlockListObjectField,
223
+ isBlockSchemaType,
224
+ isBlockStyleObjectField,
225
+ isBooleanSchemaType,
226
+ isCreateIfNotExistsMutation,
227
+ isCreateMutation,
228
+ isCreateOrReplaceMutation,
229
+ isCreateSquashedMutation,
230
+ isCrossDatasetReference,
231
+ isCrossDatasetReferenceSchemaType,
232
+ isDateTimeSchemaType,
233
+ isDeleteMutation,
234
+ isDeprecatedSchemaType,
235
+ isDeprecationConfiguration,
236
+ isDocumentSchemaType,
237
+ isFileSchemaType,
238
+ isGlobalDocumentReference,
239
+ isImage,
240
+ isImageSchemaType,
241
+ isIndexSegment,
242
+ isIndexTuple,
243
+ isKeySegment,
244
+ isKeyedObject,
245
+ isNumberSchemaType,
246
+ isObjectSchemaType,
247
+ isPatchMutation,
248
+ isPortableTextListBlock,
249
+ isPortableTextSpan,
250
+ isPortableTextTextBlock,
251
+ isPrimitiveSchemaType,
252
+ isReference,
253
+ isReferenceSchemaType,
254
+ isSanityDocument,
255
+ isSearchStrategy,
256
+ isSlug,
257
+ isSpanSchemaType,
258
+ isStringSchemaType,
259
+ isTitledListValue,
260
+ isTypedObject,
261
+ isValidationError,
262
+ isValidationErrorMarker,
263
+ isValidationInfo,
264
+ isValidationInfoMarker,
265
+ isValidationWarning,
266
+ isValidationWarningMarker,
267
+ searchStrategies,
268
+ typed
269
+ };
270
+ //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["isRecord"],"sources":["../src/helpers.ts","../src/reference/asserters.ts","../src/assets/asserters.ts","../src/crossDatasetReference/asserters.ts","../src/documents/asserters.ts","../src/globalDocumentReference/asserters.ts","../src/markers/asserters.ts","../src/mediaLibrary/types.ts","../src/mediaLibrary/asserters.ts","../src/mediaLibrary/defineAssetAspect.ts","../src/mutations/asserters.ts","../src/paths/asserters.ts","../src/portableText/asserters.ts","../src/schema/asserters.ts","../src/schema/define.ts","../src/search/types.ts","../src/search/asserters.ts","../src/slug/asserters.ts","../src/transactionLog/asserters.ts","../src/validation/asserters.ts"],"sourcesContent":["export function isObject(obj: unknown): obj is Record<string, unknown> {\n return typeof obj === 'object' && obj !== null && !Array.isArray(obj)\n}\n","import {isObject} from '../helpers'\nimport {type Reference} from './types'\n\n/** @internal */\nexport function isReference(reference: unknown): reference is Reference {\n return isObject(reference) && typeof reference._ref === 'string'\n}\n","import {isObject} from '../helpers'\nimport {isReference} from '../reference'\nimport {type Image} from './types'\n\n/** @public */\nexport function isImage(value: unknown): value is Image {\n return isObject(value) && isReference(value.asset) && value.asset._ref.startsWith('image-')\n}\n","import {isObject} from '../helpers'\nimport {type CrossDatasetReferenceValue} from './types'\n\n/** @beta */\nexport function isCrossDatasetReference(\n reference: unknown,\n): reference is CrossDatasetReferenceValue {\n return (\n isObject(reference) &&\n typeof reference._ref === 'string' &&\n typeof reference._dataset === 'string' &&\n typeof reference._projectId === 'string'\n )\n}\n","import {isObject} from '../helpers'\nimport {type KeyedObject, type SanityDocument, type TypedObject} from './types'\n\n/** @public */\nexport function isSanityDocument(document: unknown): document is SanityDocument {\n return (\n isObject(document) && typeof document._id === 'string' && typeof document._type === 'string'\n )\n}\n\n/** @public */\nexport function isTypedObject(obj: unknown): obj is TypedObject {\n return isObject(obj) && typeof obj._type === 'string'\n}\n\n/** @public */\nexport function isKeyedObject(obj: unknown): obj is KeyedObject {\n return isObject(obj) && typeof obj._key === 'string'\n}\n","import {isObject} from '../helpers'\nimport {type GlobalDocumentReferenceValue} from './types'\n\n/** @beta */\nexport function isGlobalDocumentReference(\n reference: unknown,\n): reference is GlobalDocumentReferenceValue {\n if (!isObject(reference) || typeof reference._ref !== 'string') {\n return false\n }\n\n return reference._ref.split(':').length === 3\n}\n","import {type ValidationMarker} from './types'\n\n/** @internal */\nexport function isValidationErrorMarker(\n marker: ValidationMarker,\n): marker is ValidationMarker & {level: 'error'} {\n return marker.level === 'error'\n}\n\n/** @internal */\nexport function isValidationWarningMarker(\n marker: ValidationMarker,\n): marker is ValidationMarker & {level: 'warning'} {\n return marker.level === 'warning'\n}\n\n/** @internal */\nexport function isValidationInfoMarker(\n marker: ValidationMarker,\n): marker is ValidationMarker & {level: 'info'} {\n return marker.level === 'info'\n}\n","import {type FileAsset, type ImageAsset} from '../assets/types'\nimport {type SanityDocumentLike} from '../documents/types'\nimport {type FieldDefinition, type IntrinsicTypeName} from '../schema/definition/schemaDefinition'\n\n/**\n * @public\n */\nexport type MediaLibraryAssetAspectSupportedFieldDefinitions = FieldDefinition<\n Exclude<IntrinsicTypeName, 'document' | 'image' | 'file' | 'reference' | 'crossDatasetReference'>\n>\n\n/**\n * @public\n */\nexport type MediaLibraryAssetAspectDefinition = MediaLibraryAssetAspectSupportedFieldDefinitions & {\n assetType?: MediaLibraryAssetType | MediaLibraryAssetType[]\n\n // Whether the aspect is publicly available from GROQ queries\n public?: boolean\n}\n\n/**\n * @public\n */\nexport const MEDIA_LIBRARY_ASSET_ASPECT_TYPE_NAME = 'sanity.asset.aspect'\n\n/**\n * @public\n */\nexport type MediaLibraryAssetAspectTypeName = typeof MEDIA_LIBRARY_ASSET_ASPECT_TYPE_NAME\n\n/**\n * @public\n */\nexport type MediaLibraryAssetType = ImageAsset['_type'] | FileAsset['_type']\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 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","import {MEDIA_LIBRARY_ASSET_ASPECT_TYPE_NAME, type MediaLibraryAssetAspectDocument} from './types'\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 function isAssetAspect(\n maybeAssetAspect: unknown,\n): maybeAssetAspect is MediaLibraryAssetAspectDocument {\n return (\n typeof maybeAssetAspect === 'object' &&\n maybeAssetAspect !== null &&\n '_type' in maybeAssetAspect &&\n maybeAssetAspect._type === MEDIA_LIBRARY_ASSET_ASPECT_TYPE_NAME\n )\n}\n","import {\n MEDIA_LIBRARY_ASSET_ASPECT_TYPE_NAME,\n type MediaLibraryAssetAspectDefinition,\n type MediaLibraryAssetAspectDocument,\n} from './types'\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 function defineAssetAspect(\n definition: MediaLibraryAssetAspectDefinition,\n): MediaLibraryAssetAspectDocument {\n const {assetType, name} = definition\n\n return {\n _type: MEDIA_LIBRARY_ASSET_ASPECT_TYPE_NAME,\n _id: `${name}`,\n definition,\n ...(assetType && {\n assetType: Array.isArray(assetType) ? assetType : [assetType],\n }),\n public: definition.public,\n }\n}\n","import {type TransactionLogMutation} from '../transactionLog'\nimport {\n type CreateIfNotExistsMutation,\n type CreateMutation,\n type CreateOrReplaceMutation,\n type DeleteMutation,\n type Mutation,\n type PatchMutation,\n} from './types'\n\n/** @internal */\nexport function isCreateMutation(\n mutation: Mutation | TransactionLogMutation,\n): mutation is CreateMutation {\n return 'create' in mutation\n}\n\n/** @internal */\nexport function isCreateIfNotExistsMutation(\n mutation: Mutation | TransactionLogMutation,\n): mutation is CreateIfNotExistsMutation {\n return 'createIfNotExists' in mutation\n}\n\n/** @internal */\nexport function isCreateOrReplaceMutation(\n mutation: Mutation | TransactionLogMutation,\n): mutation is CreateOrReplaceMutation {\n return 'createOrReplace' in mutation\n}\n\n/** @internal */\nexport function isDeleteMutation(\n mutation: Mutation | TransactionLogMutation,\n): mutation is DeleteMutation {\n return 'delete' in mutation\n}\n\n/** @internal */\nexport function isPatchMutation(\n mutation: Mutation | TransactionLogMutation,\n): mutation is PatchMutation {\n return 'patch' in mutation\n}\n","import {type IndexTuple, type KeyedSegment, type PathSegment} from './types'\n\nconst reKeySegment = /_key\\s*==\\s*['\"](.*)['\"]/\nconst reIndexTuple = /^\\d*:\\d*$/\n\n/** @internal */\nexport function isIndexSegment(segment: PathSegment): segment is number {\n return typeof segment === 'number' || (typeof segment === 'string' && /^\\[\\d+\\]$/.test(segment))\n}\n\n/** @internal */\nexport function isKeySegment(segment: PathSegment): segment is KeyedSegment {\n if (typeof segment === 'string') {\n return reKeySegment.test(segment.trim())\n }\n\n return typeof segment === 'object' && '_key' in segment\n}\n\n/** @internal */\nexport function isIndexTuple(segment: PathSegment): segment is IndexTuple {\n if (typeof segment === 'string' && reIndexTuple.test(segment)) {\n return true\n }\n\n if (!Array.isArray(segment) || segment.length !== 2) {\n return false\n }\n\n const [from, to] = segment\n return (typeof from === 'number' || from === '') && (typeof to === 'number' || to === '')\n}\n","import {type PortableTextObject, type PortableTextSpan, type PortableTextTextBlock} from './types'\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return !!value && (typeof value == 'object' || typeof value == 'function')\n}\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 function isPortableTextTextBlock<T = PortableTextSpan | PortableTextObject>(\n value: unknown,\n): value is PortableTextTextBlock<T> {\n return (\n isRecord(value) &&\n typeof value._type === 'string' && // block types can be named, so expect anything here.\n Array.isArray(value.children) &&\n value.children.every((child) => isRecord(child)) &&\n ('markDefs' in value // optional property\n ? Array.isArray(value.markDefs) && value.markDefs.every((def) => isRecord(def))\n : true) &&\n ('style' in value ? typeof value.style === 'string' : true) // optional property\n )\n}\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 function isPortableTextSpan(value: unknown): value is PortableTextSpan {\n return (\n isRecord(value) &&\n value._type === 'span' &&\n typeof value.text === 'string' &&\n ('marks' in value // optional property\n ? Array.isArray(value.marks) && value.marks.every((mark) => typeof mark === 'string')\n : true)\n )\n}\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 function isPortableTextListBlock<T = PortableTextSpan | PortableTextObject>(\n value: unknown,\n): value is PortableTextTextBlock<T> {\n return (\n isPortableTextTextBlock(value) &&\n 'listItem' in value &&\n typeof value.listItem === 'string' &&\n 'level' in value &&\n Number.isInteger(value.level)\n )\n}\n","import {type CrossDatasetReferenceSchemaType} from '../crossDatasetReference'\nimport {type TitledListValue} from './definition'\nimport {\n type ArraySchemaType,\n type BaseSchemaType,\n type BlockChildrenObjectField,\n type BlockListObjectField,\n type BlockSchemaType,\n type BlockStyleObjectField,\n type BooleanSchemaType,\n type DeprecatedSchemaType,\n type DeprecationConfiguration,\n type FileSchemaType,\n type ImageSchemaType,\n type NumberSchemaType,\n type ObjectSchemaType,\n type ReferenceSchemaType,\n type SchemaType,\n type SpanSchemaType,\n type StringSchemaType,\n} from './types'\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return !!value && (typeof value == 'object' || typeof value == 'function')\n}\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 function isDocumentSchemaType(type: unknown): type is ObjectSchemaType {\n if (!isObjectSchemaType(type)) {\n return false\n }\n\n let current: SchemaType | undefined = type as SchemaType\n while (current) {\n if (current.name === 'document') {\n return true\n }\n\n current = current.type\n }\n return false\n}\n\n/** @internal */\nexport function isObjectSchemaType(type: unknown): type is ObjectSchemaType {\n if (!isRecord(type)) return false\n return type.jsonType === 'object'\n}\n\n/** @internal */\nexport function isArraySchemaType(type: unknown): type is ArraySchemaType {\n if (!isRecord(type)) return false\n return type.jsonType === 'array'\n}\n\n/** @internal */\nexport function isArrayOfBlocksSchemaType(\n type: unknown,\n): type is ArraySchemaType<ObjectSchemaType> {\n return isArraySchemaType(type) && type.of.some((memberType) => isBlockSchemaType(memberType))\n}\n\n/** @internal */\nexport function isArrayOfObjectsSchemaType(\n type: unknown,\n): type is ArraySchemaType<ObjectSchemaType> {\n return isArraySchemaType(type) && type.of.every((memberType) => isObjectSchemaType(memberType))\n}\n\n/** @internal */\nexport function isArrayOfPrimitivesSchemaType(type: unknown): type is ArraySchemaType {\n return isArraySchemaType(type) && type.of.every((memberType) => isPrimitiveSchemaType(memberType))\n}\n\n/** @internal */\nexport function isArrayOfStringsSchemaType(type: unknown): type is ArraySchemaType<string> {\n return isArraySchemaType(type) && type.of.every((memberType) => isStringSchemaType(memberType))\n}\n\n/** @internal */\nexport function isBooleanSchemaType(type: unknown): type is BooleanSchemaType {\n if (!isRecord(type)) return false\n return type.jsonType === 'boolean'\n}\n\n/** @internal */\nexport function isStringSchemaType(type: unknown): type is StringSchemaType {\n if (!isRecord(type)) return false\n return type.jsonType === 'string'\n}\n\n/** @internal */\nexport function isDateTimeSchemaType(type: unknown): type is StringSchemaType {\n if (!isStringSchemaType(type)) return false\n return type.name === 'datetime'\n}\n\n/** @internal */\nexport function isNumberSchemaType(type: unknown): type is NumberSchemaType {\n if (!isRecord(type)) return false\n return type.jsonType === 'number'\n}\n\n/** @internal */\nexport function isPrimitiveSchemaType(\n type: unknown,\n): type is BooleanSchemaType | StringSchemaType | NumberSchemaType {\n return isBooleanSchemaType(type) || isStringSchemaType(type) || isNumberSchemaType(type)\n}\n\n/** @internal */\nexport function isReferenceSchemaType(type: unknown): type is ReferenceSchemaType {\n return isRecord(type) && (type.name === 'reference' || isReferenceSchemaType(type.type))\n}\n\n/** @internal */\nexport function isImageSchemaType(type: unknown): type is ImageSchemaType {\n return isRecord(type) && (type.name === 'image' || isImageSchemaType(type.type))\n}\n\n/** @internal */\nexport function isFileSchemaType(type: unknown): type is FileSchemaType {\n return isRecord(type) && (type.name === 'file' || isFileSchemaType(type.type))\n}\n\n/** @internal */\nexport function isDeprecatedSchemaType<TSchemaType extends BaseSchemaType>(\n type: TSchemaType,\n): type is DeprecatedSchemaType<TSchemaType> {\n if (!isRecord(type)) return false\n return typeof type.deprecated !== 'undefined'\n}\n\n/** @internal */\nexport function isDeprecationConfiguration(type: unknown): type is DeprecationConfiguration {\n if (!isRecord(type)) return false\n return typeof type.deprecated !== 'undefined'\n}\n\n/** @internal */\nexport function isCrossDatasetReferenceSchemaType(\n type: unknown,\n): type is CrossDatasetReferenceSchemaType {\n return (\n isRecord(type) &&\n (type.name === 'crossDatasetReference' || isCrossDatasetReferenceSchemaType(type.type))\n )\n}\n\n/** @internal */\nexport function isTitledListValue(item: unknown): item is TitledListValue {\n return typeof item === 'object' && item !== null && 'title' in item && 'value' in item\n}\n\n/** @internal */\nexport function isSpanSchemaType(type: unknown): type is SpanSchemaType {\n if (!isRecord(type)) return false\n // we check for `annotations` and `decorators` instead of `type.name` because\n // schema names can technically change if someone extends the type\n return Array.isArray(type.annotations) && Array.isArray(type.decorators)\n}\n\n/** @internal */\nexport function isBlockSchemaType(type: unknown): type is BlockSchemaType {\n if (!isRecord(type)) return false\n if (!Array.isArray(type.fields)) return false\n const maybeSpanChildren = type.fields.find(isBlockChildrenObjectField)\n const maybeStyle = type.fields.find(isBlockStyleObjectField)\n const maybeList = type.fields.find(isBlockListObjectField)\n return (\n isBlockChildrenObjectField(maybeSpanChildren) &&\n isBlockStyleObjectField(maybeStyle) &&\n isBlockListObjectField(maybeList)\n )\n}\n\n/** @internal */\nexport function isBlockStyleObjectField(field: unknown): field is BlockStyleObjectField {\n if (!isRecord(field)) return false\n if (field.name !== 'style') return false\n return isRecord(field.type) && field.type.jsonType === 'string'\n}\n\n/** @internal */\nexport function isBlockListObjectField(field: unknown): field is BlockListObjectField {\n if (!isRecord(field)) return false\n if (field.name !== 'listItem') return false\n return isRecord(field.type) && field.type.jsonType === 'string'\n}\n\n/** @internal */\nexport function isBlockChildrenObjectField(field: unknown): field is BlockChildrenObjectField {\n if (!isRecord(field)) return false\n if (field.name !== 'children') return false\n if (!isArraySchemaType(field.type)) return false\n // there will always be a span item in `SpanChildrenObjectField`\n return field.type.of.some(isSpanSchemaType)\n}\n","import {\n type DefineArrayMemberBase,\n type DefineSchemaBase,\n type DefineSchemaOptions,\n type MaybeAllowUnknownProps,\n type NarrowPreview,\n type StrictDefinition,\n type WidenInitialValue,\n type WidenValidation,\n} from './defineTypes'\nimport {type FieldDefinitionBase, type IntrinsicTypeName} from './definition'\nimport {type AutocompleteString} from './types'\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 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\n defineOptions?: DefineSchemaOptions<TStrict, TAlias>,\n): typeof schemaDefinition {\n return schemaDefinition\n}\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 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\n defineOptions?: DefineSchemaOptions<TStrict, TAlias>,\n): typeof schemaField & WidenValidation & WidenInitialValue {\n // TODO: re-evaluate the need for this cast\n return schemaField as typeof schemaField & WidenValidation & WidenInitialValue\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 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\n defineOptions?: DefineSchemaOptions<TStrict, TAlias>,\n): typeof arrayOfSchema & WidenValidation & WidenInitialValue {\n // TODO: re-evaluate the need for this cast\n return arrayOfSchema as typeof arrayOfSchema & WidenValidation & WidenInitialValue\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 function typed<T>(input: T): T {\n return input\n}\n","/**\n * @public\n */\nexport const searchStrategies = ['groq2024', 'groqLegacy'] as const\n\n/**\n * @public\n */\nexport type SearchStrategy = (typeof searchStrategies)[number]\n","import {searchStrategies, type SearchStrategy} from './types'\n\n/**\n * @internal\n */\nexport function isSearchStrategy(\n maybeSearchStrategy: unknown,\n): maybeSearchStrategy is SearchStrategy {\n return searchStrategies.includes(maybeSearchStrategy as SearchStrategy)\n}\n","import {isObject} from '../helpers'\nimport {type Slug} from './types'\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 function isSlug(thing: unknown): thing is Slug {\n return isObject(thing) && typeof thing.current === 'string'\n}\n","import {type Mutation} from '../mutations'\nimport {type CreateSquashedMutation, type TransactionLogMutation} from './types'\n\n/** @internal */\nexport function isCreateSquashedMutation(\n mutation: Mutation | TransactionLogMutation,\n): mutation is CreateSquashedMutation {\n return 'createSquashed' in mutation\n}\n","import {type FormNodeValidation} from './types'\n\n/** @internal */\nexport function isValidationError(\n node: FormNodeValidation,\n): node is FormNodeValidation & {level: 'error'} {\n return node.level === 'error'\n}\n\n/** @internal */\nexport function isValidationWarning(\n node: FormNodeValidation,\n): node is FormNodeValidation & {level: 'warning'} {\n return node.level === 'warning'\n}\n\n/** @internal */\nexport function isValidationInfo(\n node: FormNodeValidation,\n): node is FormNodeValidation & {level: 'info'} {\n return node.level === 'info'\n}\n"],"mappings":"AAAA,SAAgB,SAAS,KAA8C;CACrE,OAAO,OAAO,OAAQ,cAAY,OAAgB,CAAC,MAAM,QAAQ,GAAG;AACtE;;ACEA,SAAgB,YAAY,WAA4C;CACtE,OAAO,SAAS,SAAS,KAAK,OAAO,UAAU,QAAS;AAC1D;;ACDA,SAAgB,QAAQ,OAAgC;CACtD,OAAO,SAAS,KAAK,KAAK,YAAY,MAAM,KAAK,KAAK,MAAM,MAAM,KAAK,WAAW,QAAQ;AAC5F;;ACHA,SAAgB,wBACd,WACyC;CACzC,OACE,SAAS,SAAS,KAClB,OAAO,UAAU,QAAS,YAC1B,OAAO,UAAU,YAA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BAAoB;AAC7B;;ACLA,SAAgB,kBACd,MAC+C;CAC/C,OAAO,KAAK,UAAU;AACxB;;AAGA,SAAgB,oBACd,MACiD;CACjD,OAAO,KAAK,UAAU;AACxB;;AAGA,SAAgB,iBACd,MAC8C;CAC9C,OAAO,KAAK,UAAU;AACxB"}
1
+ {"version":3,"file":"index.js","sources":["../src/helpers.ts","../src/reference/asserters.ts","../src/assets/asserters.ts","../src/crossDatasetReference/asserters.ts","../src/documents/asserters.ts","../src/globalDocumentReference/asserters.ts","../src/markers/asserters.ts","../src/mediaLibrary/types.ts","../src/mediaLibrary/asserters.ts","../src/mediaLibrary/defineAssetAspect.ts","../src/mutations/asserters.ts","../src/paths/asserters.ts","../src/portableText/asserters.ts","../src/schema/asserters.ts","../src/schema/define.ts","../src/search/types.ts","../src/search/asserters.ts","../src/slug/asserters.ts","../src/transactionLog/asserters.ts","../src/validation/asserters.ts"],"sourcesContent":["export function isObject(obj: unknown): obj is Record<string, unknown> {\n return typeof obj === 'object' && obj !== null && !Array.isArray(obj)\n}\n","import {isObject} from '../helpers'\nimport {type Reference} from './types'\n\n/** @internal */\nexport function isReference(reference: unknown): reference is Reference {\n return isObject(reference) && typeof reference._ref === 'string'\n}\n","import {isObject} from '../helpers'\nimport {isReference} from '../reference'\nimport {type Image} from './types'\n\n/** @public */\nexport function isImage(value: unknown): value is Image {\n return isObject(value) && isReference(value.asset) && value.asset._ref.startsWith('image-')\n}\n","import {isObject} from '../helpers'\nimport {type CrossDatasetReferenceValue} from './types'\n\n/** @beta */\nexport function isCrossDatasetReference(\n reference: unknown,\n): reference is CrossDatasetReferenceValue {\n return (\n isObject(reference) &&\n typeof reference._ref === 'string' &&\n typeof reference._dataset === 'string' &&\n typeof reference._projectId === 'string'\n )\n}\n","import {isObject} from '../helpers'\nimport {type KeyedObject, type SanityDocument, type TypedObject} from './types'\n\n/** @public */\nexport function isSanityDocument(document: unknown): document is SanityDocument {\n return (\n isObject(document) && typeof document._id === 'string' && typeof document._type === 'string'\n )\n}\n\n/** @public */\nexport function isTypedObject(obj: unknown): obj is TypedObject {\n return isObject(obj) && typeof obj._type === 'string'\n}\n\n/** @public */\nexport function isKeyedObject(obj: unknown): obj is KeyedObject {\n return isObject(obj) && typeof obj._key === 'string'\n}\n","import {isObject} from '../helpers'\nimport {type GlobalDocumentReferenceValue} from './types'\n\n/** @beta */\nexport function isGlobalDocumentReference(\n reference: unknown,\n): reference is GlobalDocumentReferenceValue {\n if (!isObject(reference) || typeof reference._ref !== 'string') {\n return false\n }\n\n return reference._ref.split(':').length === 3\n}\n","import {type ValidationMarker} from './types'\n\n/** @internal */\nexport function isValidationErrorMarker(\n marker: ValidationMarker,\n): marker is ValidationMarker & {level: 'error'} {\n return marker.level === 'error'\n}\n\n/** @internal */\nexport function isValidationWarningMarker(\n marker: ValidationMarker,\n): marker is ValidationMarker & {level: 'warning'} {\n return marker.level === 'warning'\n}\n\n/** @internal */\nexport function isValidationInfoMarker(\n marker: ValidationMarker,\n): marker is ValidationMarker & {level: 'info'} {\n return marker.level === 'info'\n}\n","import {type FileAsset, type ImageAsset} from '../assets/types'\nimport {type SanityDocumentLike} from '../documents/types'\nimport {type FieldDefinition, type IntrinsicTypeName} from '../schema/definition/schemaDefinition'\n\n/**\n * @public\n */\nexport type MediaLibraryAssetAspectSupportedFieldDefinitions = FieldDefinition<\n Exclude<IntrinsicTypeName, 'document' | 'image' | 'file' | 'reference' | 'crossDatasetReference'>\n>\n\n/**\n * @public\n */\nexport type MediaLibraryAssetAspectDefinition = MediaLibraryAssetAspectSupportedFieldDefinitions & {\n assetType?: MediaLibraryAssetType | MediaLibraryAssetType[]\n\n // Whether the aspect is publicly available from GROQ queries\n public?: boolean\n}\n\n/**\n * @public\n */\nexport const MEDIA_LIBRARY_ASSET_ASPECT_TYPE_NAME = 'sanity.asset.aspect'\n\n/**\n * @public\n */\nexport type MediaLibraryAssetAspectTypeName = typeof MEDIA_LIBRARY_ASSET_ASPECT_TYPE_NAME\n\n/**\n * @public\n */\nexport type MediaLibraryAssetType = ImageAsset['_type'] | FileAsset['_type']\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 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","import {MEDIA_LIBRARY_ASSET_ASPECT_TYPE_NAME, type MediaLibraryAssetAspectDocument} from './types'\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 function isAssetAspect(\n maybeAssetAspect: unknown,\n): maybeAssetAspect is MediaLibraryAssetAspectDocument {\n return (\n typeof maybeAssetAspect === 'object' &&\n maybeAssetAspect !== null &&\n '_type' in maybeAssetAspect &&\n maybeAssetAspect._type === MEDIA_LIBRARY_ASSET_ASPECT_TYPE_NAME\n )\n}\n","import {\n MEDIA_LIBRARY_ASSET_ASPECT_TYPE_NAME,\n type MediaLibraryAssetAspectDefinition,\n type MediaLibraryAssetAspectDocument,\n} from './types'\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 function defineAssetAspect(\n definition: MediaLibraryAssetAspectDefinition,\n): MediaLibraryAssetAspectDocument {\n const {assetType, name} = definition\n\n return {\n _type: MEDIA_LIBRARY_ASSET_ASPECT_TYPE_NAME,\n _id: `${name}`,\n definition,\n ...(assetType && {\n assetType: Array.isArray(assetType) ? assetType : [assetType],\n }),\n public: definition.public,\n }\n}\n","import {type TransactionLogMutation} from '../transactionLog'\nimport {\n type CreateIfNotExistsMutation,\n type CreateMutation,\n type CreateOrReplaceMutation,\n type DeleteMutation,\n type Mutation,\n type PatchMutation,\n} from './types'\n\n/** @internal */\nexport function isCreateMutation(\n mutation: Mutation | TransactionLogMutation,\n): mutation is CreateMutation {\n return 'create' in mutation\n}\n\n/** @internal */\nexport function isCreateIfNotExistsMutation(\n mutation: Mutation | TransactionLogMutation,\n): mutation is CreateIfNotExistsMutation {\n return 'createIfNotExists' in mutation\n}\n\n/** @internal */\nexport function isCreateOrReplaceMutation(\n mutation: Mutation | TransactionLogMutation,\n): mutation is CreateOrReplaceMutation {\n return 'createOrReplace' in mutation\n}\n\n/** @internal */\nexport function isDeleteMutation(\n mutation: Mutation | TransactionLogMutation,\n): mutation is DeleteMutation {\n return 'delete' in mutation\n}\n\n/** @internal */\nexport function isPatchMutation(\n mutation: Mutation | TransactionLogMutation,\n): mutation is PatchMutation {\n return 'patch' in mutation\n}\n","import {type IndexTuple, type KeyedSegment, type PathSegment} from './types'\n\nconst reKeySegment = /_key\\s*==\\s*['\"](.*)['\"]/\nconst reIndexTuple = /^\\d*:\\d*$/\n\n/** @internal */\nexport function isIndexSegment(segment: PathSegment): segment is number {\n return typeof segment === 'number' || (typeof segment === 'string' && /^\\[\\d+\\]$/.test(segment))\n}\n\n/** @internal */\nexport function isKeySegment(segment: PathSegment): segment is KeyedSegment {\n if (typeof segment === 'string') {\n return reKeySegment.test(segment.trim())\n }\n\n return typeof segment === 'object' && '_key' in segment\n}\n\n/** @internal */\nexport function isIndexTuple(segment: PathSegment): segment is IndexTuple {\n if (typeof segment === 'string' && reIndexTuple.test(segment)) {\n return true\n }\n\n if (!Array.isArray(segment) || segment.length !== 2) {\n return false\n }\n\n const [from, to] = segment\n return (typeof from === 'number' || from === '') && (typeof to === 'number' || to === '')\n}\n","import {type PortableTextObject, type PortableTextSpan, type PortableTextTextBlock} from './types'\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return !!value && (typeof value == 'object' || typeof value == 'function')\n}\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 function isPortableTextTextBlock<T = PortableTextSpan | PortableTextObject>(\n value: unknown,\n): value is PortableTextTextBlock<T> {\n return (\n isRecord(value) &&\n typeof value._type === 'string' && // block types can be named, so expect anything here.\n Array.isArray(value.children) &&\n value.children.every((child) => isRecord(child)) &&\n ('markDefs' in value // optional property\n ? Array.isArray(value.markDefs) && value.markDefs.every((def) => isRecord(def))\n : true) &&\n ('style' in value ? typeof value.style === 'string' : true) // optional property\n )\n}\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 function isPortableTextSpan(value: unknown): value is PortableTextSpan {\n return (\n isRecord(value) &&\n value._type === 'span' &&\n typeof value.text === 'string' &&\n ('marks' in value // optional property\n ? Array.isArray(value.marks) && value.marks.every((mark) => typeof mark === 'string')\n : true)\n )\n}\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 function isPortableTextListBlock<T = PortableTextSpan | PortableTextObject>(\n value: unknown,\n): value is PortableTextTextBlock<T> {\n return (\n isPortableTextTextBlock(value) &&\n 'listItem' in value &&\n typeof value.listItem === 'string' &&\n 'level' in value &&\n Number.isInteger(value.level)\n )\n}\n","import {type CrossDatasetReferenceSchemaType} from '../crossDatasetReference'\nimport {type TitledListValue} from './definition'\nimport {\n type ArraySchemaType,\n type BaseSchemaType,\n type BlockChildrenObjectField,\n type BlockListObjectField,\n type BlockSchemaType,\n type BlockStyleObjectField,\n type BooleanSchemaType,\n type DeprecatedSchemaType,\n type DeprecationConfiguration,\n type FileSchemaType,\n type ImageSchemaType,\n type NumberSchemaType,\n type ObjectSchemaType,\n type ReferenceSchemaType,\n type SchemaType,\n type SpanSchemaType,\n type StringSchemaType,\n} from './types'\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return !!value && (typeof value == 'object' || typeof value == 'function')\n}\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 function isDocumentSchemaType(type: unknown): type is ObjectSchemaType {\n if (!isObjectSchemaType(type)) {\n return false\n }\n\n let current: SchemaType | undefined = type as SchemaType\n while (current) {\n if (current.name === 'document') {\n return true\n }\n\n current = current.type\n }\n return false\n}\n\n/** @internal */\nexport function isObjectSchemaType(type: unknown): type is ObjectSchemaType {\n if (!isRecord(type)) return false\n return type.jsonType === 'object'\n}\n\n/** @internal */\nexport function isArraySchemaType(type: unknown): type is ArraySchemaType {\n if (!isRecord(type)) return false\n return type.jsonType === 'array'\n}\n\n/** @internal */\nexport function isArrayOfBlocksSchemaType(\n type: unknown,\n): type is ArraySchemaType<ObjectSchemaType> {\n return isArraySchemaType(type) && type.of.some((memberType) => isBlockSchemaType(memberType))\n}\n\n/** @internal */\nexport function isArrayOfObjectsSchemaType(\n type: unknown,\n): type is ArraySchemaType<ObjectSchemaType> {\n return isArraySchemaType(type) && type.of.every((memberType) => isObjectSchemaType(memberType))\n}\n\n/** @internal */\nexport function isArrayOfPrimitivesSchemaType(type: unknown): type is ArraySchemaType {\n return isArraySchemaType(type) && type.of.every((memberType) => isPrimitiveSchemaType(memberType))\n}\n\n/** @internal */\nexport function isArrayOfStringsSchemaType(type: unknown): type is ArraySchemaType<string> {\n return isArraySchemaType(type) && type.of.every((memberType) => isStringSchemaType(memberType))\n}\n\n/** @internal */\nexport function isBooleanSchemaType(type: unknown): type is BooleanSchemaType {\n if (!isRecord(type)) return false\n return type.jsonType === 'boolean'\n}\n\n/** @internal */\nexport function isStringSchemaType(type: unknown): type is StringSchemaType {\n if (!isRecord(type)) return false\n return type.jsonType === 'string'\n}\n\n/** @internal */\nexport function isDateTimeSchemaType(type: unknown): type is StringSchemaType {\n if (!isStringSchemaType(type)) return false\n return type.name === 'datetime'\n}\n\n/** @internal */\nexport function isNumberSchemaType(type: unknown): type is NumberSchemaType {\n if (!isRecord(type)) return false\n return type.jsonType === 'number'\n}\n\n/** @internal */\nexport function isPrimitiveSchemaType(\n type: unknown,\n): type is BooleanSchemaType | StringSchemaType | NumberSchemaType {\n return isBooleanSchemaType(type) || isStringSchemaType(type) || isNumberSchemaType(type)\n}\n\n/** @internal */\nexport function isReferenceSchemaType(type: unknown): type is ReferenceSchemaType {\n return isRecord(type) && (type.name === 'reference' || isReferenceSchemaType(type.type))\n}\n\n/** @internal */\nexport function isImageSchemaType(type: unknown): type is ImageSchemaType {\n return isRecord(type) && (type.name === 'image' || isImageSchemaType(type.type))\n}\n\n/** @internal */\nexport function isFileSchemaType(type: unknown): type is FileSchemaType {\n return isRecord(type) && (type.name === 'file' || isFileSchemaType(type.type))\n}\n\n/** @internal */\nexport function isDeprecatedSchemaType<TSchemaType extends BaseSchemaType>(\n type: TSchemaType,\n): type is DeprecatedSchemaType<TSchemaType> {\n if (!isRecord(type)) return false\n return typeof type.deprecated !== 'undefined'\n}\n\n/** @internal */\nexport function isDeprecationConfiguration(type: unknown): type is DeprecationConfiguration {\n if (!isRecord(type)) return false\n return typeof type.deprecated !== 'undefined'\n}\n\n/** @internal */\nexport function isCrossDatasetReferenceSchemaType(\n type: unknown,\n): type is CrossDatasetReferenceSchemaType {\n return (\n isRecord(type) &&\n (type.name === 'crossDatasetReference' || isCrossDatasetReferenceSchemaType(type.type))\n )\n}\n\n/** @internal */\nexport function isTitledListValue(item: unknown): item is TitledListValue {\n return typeof item === 'object' && item !== null && 'title' in item && 'value' in item\n}\n\n/** @internal */\nexport function isSpanSchemaType(type: unknown): type is SpanSchemaType {\n if (!isRecord(type)) return false\n // we check for `annotations` and `decorators` instead of `type.name` because\n // schema names can technically change if someone extends the type\n return Array.isArray(type.annotations) && Array.isArray(type.decorators)\n}\n\n/** @internal */\nexport function isBlockSchemaType(type: unknown): type is BlockSchemaType {\n if (!isRecord(type)) return false\n if (!Array.isArray(type.fields)) return false\n const maybeSpanChildren = type.fields.find(isBlockChildrenObjectField)\n const maybeStyle = type.fields.find(isBlockStyleObjectField)\n const maybeList = type.fields.find(isBlockListObjectField)\n return (\n isBlockChildrenObjectField(maybeSpanChildren) &&\n isBlockStyleObjectField(maybeStyle) &&\n isBlockListObjectField(maybeList)\n )\n}\n\n/** @internal */\nexport function isBlockStyleObjectField(field: unknown): field is BlockStyleObjectField {\n if (!isRecord(field)) return false\n if (field.name !== 'style') return false\n return isRecord(field.type) && field.type.jsonType === 'string'\n}\n\n/** @internal */\nexport function isBlockListObjectField(field: unknown): field is BlockListObjectField {\n if (!isRecord(field)) return false\n if (field.name !== 'listItem') return false\n return isRecord(field.type) && field.type.jsonType === 'string'\n}\n\n/** @internal */\nexport function isBlockChildrenObjectField(field: unknown): field is BlockChildrenObjectField {\n if (!isRecord(field)) return false\n if (field.name !== 'children') return false\n if (!isArraySchemaType(field.type)) return false\n // there will always be a span item in `SpanChildrenObjectField`\n return field.type.of.some(isSpanSchemaType)\n}\n","import {\n type DefineArrayMemberBase,\n type DefineSchemaBase,\n type DefineSchemaOptions,\n type MaybeAllowUnknownProps,\n type NarrowPreview,\n type StrictDefinition,\n type WidenInitialValue,\n type WidenValidation,\n} from './defineTypes'\nimport {type FieldDefinitionBase, type IntrinsicTypeName} from './definition'\nimport {type AutocompleteString} from './types'\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 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\n defineOptions?: DefineSchemaOptions<TStrict, TAlias>,\n): typeof schemaDefinition {\n return schemaDefinition\n}\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 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\n defineOptions?: DefineSchemaOptions<TStrict, TAlias>,\n): typeof schemaField & WidenValidation & WidenInitialValue {\n // TODO: re-evaluate the need for this cast\n return schemaField as typeof schemaField & WidenValidation & WidenInitialValue\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 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\n defineOptions?: DefineSchemaOptions<TStrict, TAlias>,\n): typeof arrayOfSchema & WidenValidation & WidenInitialValue {\n // TODO: re-evaluate the need for this cast\n return arrayOfSchema as typeof arrayOfSchema & WidenValidation & WidenInitialValue\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 function typed<T>(input: T): T {\n return input\n}\n","/**\n * @public\n */\nexport const searchStrategies = ['groq2024', 'groqLegacy'] as const\n\n/**\n * @public\n */\nexport type SearchStrategy = (typeof searchStrategies)[number]\n","import {searchStrategies, type SearchStrategy} from './types'\n\n/**\n * @internal\n */\nexport function isSearchStrategy(\n maybeSearchStrategy: unknown,\n): maybeSearchStrategy is SearchStrategy {\n return searchStrategies.includes(maybeSearchStrategy as SearchStrategy)\n}\n","import {isObject} from '../helpers'\nimport {type Slug} from './types'\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 function isSlug(thing: unknown): thing is Slug {\n return isObject(thing) && typeof thing.current === 'string'\n}\n","import {type Mutation} from '../mutations'\nimport {type CreateSquashedMutation, type TransactionLogMutation} from './types'\n\n/** @internal */\nexport function isCreateSquashedMutation(\n mutation: Mutation | TransactionLogMutation,\n): mutation is CreateSquashedMutation {\n return 'createSquashed' in mutation\n}\n","import {type FormNodeValidation} from './types'\n\n/** @internal */\nexport function isValidationError(\n node: FormNodeValidation,\n): node is FormNodeValidation & {level: 'error'} {\n return node.level === 'error'\n}\n\n/** @internal */\nexport function isValidationWarning(\n node: FormNodeValidation,\n): node is FormNodeValidation & {level: 'warning'} {\n return node.level === 'warning'\n}\n\n/** @internal */\nexport function isValidationInfo(\n node: FormNodeValidation,\n): node is FormNodeValidation & {level: 'info'} {\n return node.level === 'info'\n}\n"],"names":["isRecord"],"mappings":"AAAO,SAAS,SAAS,KAA8C;AACrE,SAAO,OAAO,OAAQ,YAAY,QAAQ,QAAQ,CAAC,MAAM,QAAQ,GAAG;AACtE;ACEO,SAAS,YAAY,WAA4C;AACtE,SAAO,SAAS,SAAS,KAAK,OAAO,UAAU,QAAS;AAC1D;ACDO,SAAS,QAAQ,OAAgC;AACtD,SAAO,SAAS,KAAK,KAAK,YAAY,MAAM,KAAK,KAAK,MAAM,MAAM,KAAK,WAAW,QAAQ;AAC5F;ACHO,SAAS,wBACd,WACyC;AACzC,SACE,SAAS,SAAS,KAClB,OAAO,UAAU,QAAS,YAC1B,OAAO,UAAU,YAAa,YAC9B,OAAO,UAAU,cAAe;AAEpC;ACTO,SAAS,iBAAiB,UAA+C;AAC9E,SACE,SAAS,QAAQ,KAAK,OAAO,SAAS,OAAQ,YAAY,OAAO,SAAS,SAAU;AAExF;AAGO,SAAS,cAAc,KAAkC;AAC9D,SAAO,SAAS,GAAG,KAAK,OAAO,IAAI,SAAU;AAC/C;AAGO,SAAS,cAAc,KAAkC;AAC9D,SAAO,SAAS,GAAG,KAAK,OAAO,IAAI,QAAS;AAC9C;ACdO,SAAS,0BACd,WAC2C;AAC3C,SAAI,CAAC,SAAS,SAAS,KAAK,OAAO,UAAU,QAAS,WAC7C,KAGF,UAAU,KAAK,MAAM,GAAG,EAAE,WAAW;AAC9C;ACTO,SAAS,wBACd,QAC+C;AAC/C,SAAO,OAAO,UAAU;AAC1B;AAGO,SAAS,0BACd,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Qd,kBAOA,eACyB;AACzB,SAAO;AACT;AAsBO,SAAS,YAQd,aAQA,eAC0D;AAE1D,SAAO;AACT;AAsBO,SAAS,kBAQd,eAaA,eAC4D;AAE5D,SAAO;AACT;AA2BO,SAAS,MAAS,OAAa;AACpC,SAAO;AACT;ACjTO,MAAM,mBAAmB,CAAC,YAAY,YAAY;ACElD,SAAS,iBACd,qBACuC;AACvC,SAAO,iBAAiB,SAAS,mBAAqC;AACxE;ACCO,SAAS,OAAO,OAA+B;AACpD,SAAO,SAAS,KAAK,KAAK,OAAO,MAAM,WAAY;AACrD;ACRO,SAAS,yBACd,UACoC;AACpC,SAAO,oBAAoB;AAC7B;ACLO,SAAS,kBACd,MAC+C;AAC/C,SAAO,KAAK,UAAU;AACxB;AAGO,SAAS,oBACd,MACiD;AACjD,SAAO,KAAK,UAAU;AACxB;AAGO,SAAS,iBACd,MAC8C;AAC9C,SAAO,KAAK,UAAU;AACxB;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/types",
3
- "version": "6.7.0-next.36",
3
+ "version": "6.7.0-next.5",
4
4
  "description": "Type definitions for common Sanity data structures",
5
5
  "keywords": [
6
6
  "cms",
@@ -27,6 +27,7 @@
27
27
  ],
28
28
  "type": "module",
29
29
  "sideEffects": false,
30
+ "main": "./lib/index.js",
30
31
  "types": "./lib/index.d.ts",
31
32
  "exports": {
32
33
  ".": "./lib/index.js",
@@ -37,16 +38,17 @@
37
38
  "@sanity/media-library-types": "^1.6.0"
38
39
  },
39
40
  "devDependencies": {
41
+ "@sanity/pkg-utils": "^11.0.13",
40
42
  "@types/react": "^19.2.17",
41
43
  "@typescript/native-preview": "beta",
42
44
  "@vitejs/plugin-react": "^6.0.3",
43
45
  "react": "^19.2.7",
44
- "tsdown": "^0.22.13",
46
+ "rimraf": "^6.1.3",
45
47
  "vite": "^8.1.5",
46
48
  "vitest": "^4.1.10",
47
- "@repo/test-config": "6.7.0-next.36+c8813c5fcb",
48
- "@repo/tsconfig": "6.7.0-next.36+c8813c5fcb",
49
- "@repo/tsdown.config": "6.7.0-next.36+c8813c5fcb"
49
+ "@repo/package.config": "6.7.0-next.5+376f81defc",
50
+ "@repo/test-config": "6.7.0-next.5+376f81defc",
51
+ "@repo/tsconfig": "6.7.0-next.5+376f81defc"
50
52
  },
51
53
  "peerDependencies": {
52
54
  "@types/react": "*"
@@ -56,10 +58,11 @@
56
58
  "baseline 2024"
57
59
  ],
58
60
  "scripts": {
59
- "build": "tsdown",
61
+ "build": "pkg-utils build --strict --check --clean",
60
62
  "check:types": "(cd ../../.. && tsgo --project packages/@sanity/types/tsconfig.lib.json --erasableSyntaxOnly)",
63
+ "clean": "rimraf lib",
61
64
  "test": "vitest run",
62
65
  "test:watch": "vitest watch",
63
- "watch": "tsdown --watch"
66
+ "watch": "pkg-utils watch"
64
67
  }
65
68
  }