sanity 5.1.0-next.7 → 5.1.0-next.8

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.
@@ -1,4 +1,4 @@
1
- var version = "5.1.0-next.7+e4b29c6836", peerDependencies = {
1
+ var version = "5.1.0-next.8+d0a0119c0c", peerDependencies = {
2
2
  "styled-components": "^6.1.15"
3
3
  };
4
4
  export {
@@ -7,7 +7,7 @@ try {
7
7
  try {
8
8
  buildVersion = buildVersion || // This is replaced by `@sanity/pkg-utils` at build time
9
9
  // and must always be references by its full static name, e.g. no optional chaining, no `if (process && process.env)` etc.
10
- "5.1.0-next.7+e4b29c6836";
10
+ "5.1.0-next.8+d0a0119c0c";
11
11
  } catch {
12
12
  }
13
13
  const SANITY_VERSION = buildVersion || `${version}-dev`;
package/lib/index.d.ts CHANGED
@@ -8159,6 +8159,12 @@ export declare function isTextSelectionComment(comment: CommentDocument): boolea
8159
8159
  /** @internal */
8160
8160
  export declare function isTruthy<T>(value: T | false): value is T
8161
8161
 
8162
+ /**
8163
+ * Test if the given schema type or any of its ancestors matches the given type name.
8164
+ * @internal
8165
+ */
8166
+ export declare function _isType(schemaType: SchemaType, typeName: string): boolean
8167
+
8162
8168
  /** @internal */
8163
8169
  export declare function isUnchangedDiff(diff: Diff): diff is Diff & {
8164
8170
  action: 'unchanged'
package/lib/index.js CHANGED
@@ -3022,6 +3022,9 @@ function _isSanityDocumentTypeDefinition(def) {
3022
3022
  function _isCustomDocumentTypeDefinition(def) {
3023
3023
  return def.type === "document" && !_isSanityDocumentTypeDefinition(def);
3024
3024
  }
3025
+ function _isType(schemaType, typeName) {
3026
+ return schemaType.name === typeName ? !0 : schemaType.type ? _isType(schemaType.type, typeName) : !1;
3027
+ }
3025
3028
  const GROQ_KEYWORDS = ["match", "in", "asc", "desc", "true", "false", "null"], VALID_FIELD = /^[a-zA-Z_][a-zA-Z0-9_]*$/, fieldNeedsEscape = (fieldName) => !VALID_FIELD.test(fieldName) || GROQ_KEYWORDS.includes(fieldName), escapeField = (fieldName) => `["${fieldName}"]`, escapeFirst = (fieldName) => `@${escapeField(fieldName)}`, isEmptyArray = (value) => Array.isArray(value) && value.length === 0, joinPath = (pathArray) => {
3026
3029
  let path = "";
3027
3030
  for (let i = 0; i < pathArray.length; i++) {
@@ -22231,7 +22234,7 @@ function uploadTarget$1(Component2) {
22231
22234
  });
22232
22235
  }
22233
22236
  function getFilesAndAssetSources(files, types, assetSourceDestinationName, formBuilder) {
22234
- const imageType = types.find((type) => type.name === "image"), fileType = types.find((type) => type.name === "file");
22237
+ const imageType = types.find((type) => _isType(type, "image")), fileType = types.find((type) => _isType(type, "file"));
22235
22238
  return files.map((file) => {
22236
22239
  const imageAssetSource = imageType && resolveUploadAssetSources(imageType, formBuilder, file).find((source) => !assetSourceDestinationName || source.name === assetSourceDestinationName) || null;
22237
22240
  if (imageType && file.type.startsWith("image/") && imageAssetSource)
@@ -90102,6 +90105,7 @@ export {
90102
90105
  _createAuthStore,
90103
90106
  _isCustomDocumentTypeDefinition,
90104
90107
  _isSanityDocumentTypeDefinition,
90108
+ _isType,
90105
90109
  asLoadable,
90106
90110
  buildCommentRangeDecorations,
90107
90111
  buildLegacyTheme,