@sanity/schema 6.24.0 → 6.25.0-next.114

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,9 +1,9 @@
1
- import { a as SchemaValidationResult, i as ProblemPathTypeSegment, l as Schema$1, n as ProblemPathPropertySegment, o as TypeWithProblems, r as ProblemPathSegment, s as _FIXME_, t as ProblemPath } from "./typedefs-LNWlFyVi.js";
2
1
  import { Encoded, SetSynchronization, SynchronizationRequest, SynchronizationResult } from "@sanity/descriptors";
3
2
  import { CustomValidator, MediaValidator, SanityDocumentLike, Schema, SchemaType, SchemaTypeDefinition, SchemaValidationProblem, SchemaValidationProblemGroup } from "@sanity/types";
4
3
  import { RequestOptions } from "get-it";
5
- import { SchemaType as SchemaType$1 } from "groq-js";
4
+ import { a as SchemaValidationResult, i as ProblemPathTypeSegment, l as Schema$1, n as ProblemPathPropertySegment, o as TypeWithProblems, r as ProblemPathSegment, s as _FIXME_, t as ProblemPath } from "./typedefs-C22ZQXIT.js";
6
5
  import { ComponentType, ReactNode } from "react";
6
+ import { SchemaType as SchemaType$1 } from "groq-js";
7
7
  /** The scheduler is capable of executing work in different ways. */
8
8
  type Scheduler = {
9
9
  map<T, U>(arr: T[], fn: (val: T) => U): Promise<U[]>;
@@ -419,17 +419,17 @@ export declare const builtinTypes: ({
419
419
  type: string;
420
420
  title: string;
421
421
  readOnly: boolean;
422
+ fieldset?: undefined;
422
423
  validation?: undefined;
423
424
  hidden?: undefined;
424
- fieldset?: undefined;
425
425
  } | {
426
426
  name: string;
427
427
  type: string;
428
428
  title: string;
429
+ fieldset?: undefined;
430
+ readOnly?: undefined;
429
431
  validation?: undefined;
430
432
  hidden?: undefined;
431
- readOnly?: undefined;
432
- fieldset?: undefined;
433
433
  } | {
434
434
  name: string;
435
435
  type: string;
@@ -444,8 +444,8 @@ export declare const builtinTypes: ({
444
444
  readOnly: boolean;
445
445
  hidden: boolean;
446
446
  fieldset: string;
447
- validation?: undefined;
448
447
  title?: undefined;
448
+ validation?: undefined;
449
449
  } | {
450
450
  name: string;
451
451
  type: string;
@@ -498,17 +498,17 @@ export declare const builtinTypes: ({
498
498
  type: string;
499
499
  title: string;
500
500
  readOnly: boolean;
501
+ fieldset?: undefined;
501
502
  validation?: undefined;
502
503
  hidden?: undefined;
503
- fieldset?: undefined;
504
504
  } | {
505
505
  name: string;
506
506
  type: string;
507
507
  title: string;
508
+ fieldset?: undefined;
509
+ readOnly?: undefined;
508
510
  validation?: undefined;
509
511
  hidden?: undefined;
510
- readOnly?: undefined;
511
- fieldset?: undefined;
512
512
  } | {
513
513
  name: string;
514
514
  type: string;
@@ -518,21 +518,21 @@ export declare const builtinTypes: ({
518
518
  validation: (Rule: import("@sanity/types").Rule) => import("@sanity/types").Rule;
519
519
  hidden?: undefined;
520
520
  } | {
521
- validation?: undefined;
522
521
  name: string;
523
522
  type: string;
524
523
  readOnly: boolean;
525
524
  hidden: boolean;
526
525
  fieldset: string;
527
526
  title?: undefined;
528
- } | {
529
527
  validation?: undefined;
530
- hidden?: undefined;
528
+ } | {
531
529
  name: string;
532
530
  type: string;
533
531
  title: string;
534
532
  readOnly: boolean;
535
533
  fieldset: string;
534
+ validation?: undefined;
535
+ hidden?: undefined;
536
536
  })[];
537
537
  preview: {
538
538
  select: {
@@ -582,17 +582,17 @@ export declare const builtinTypes: ({
582
582
  };
583
583
  }[];
584
584
  fields: ({
585
- title?: undefined;
586
- readOnly?: undefined;
587
- fieldset?: undefined;
588
585
  name: string;
589
586
  type: string;
590
- } | {
587
+ fieldset?: undefined;
588
+ title?: undefined;
591
589
  readOnly?: undefined;
590
+ } | {
592
591
  name: string;
593
592
  title: string;
594
593
  type: string;
595
594
  fieldset: string;
595
+ readOnly?: undefined;
596
596
  } | {
597
597
  fieldset?: undefined;
598
598
  name: string;
package/lib/_internal.js CHANGED
@@ -1,16 +1,16 @@
1
- import { c as DEFAULT_MAX_FIELD_DEPTH, d as ALL_FIELDS_GROUP_NAME, f as OWN_PROPS_NAME, l as resolveSearchConfig, n as Schema$1, p as Rule, s as isGuessedPreview, u as resolveSearchConfigForBaseFieldPaths } from "./Schema-dJfwxOet.js";
2
1
  import { SetBuilder, processSetSynchronization } from "@sanity/descriptors";
3
2
  import { isSpanSchemaType } from "@sanity/types";
4
3
  import { dequal } from "dequal/lite";
4
+ import { c as DEFAULT_MAX_FIELD_DEPTH, d as ALL_FIELDS_GROUP_NAME, f as OWN_PROPS_NAME, l as resolveSearchConfig, n as Schema$1, p as Rule, s as isGuessedPreview, u as resolveSearchConfigForBaseFieldPaths } from "./Schema-DQqUqcpq.js";
5
5
  import { HttpError, createRequester } from "get-it";
6
6
  import { retry } from "get-it/middleware";
7
7
  import "@sanity/generate-help-url";
8
- import startCase from "lodash-es/startCase.js";
9
- import omit from "lodash-es/omit.js";
10
- import isPlainObject from "lodash-es/isPlainObject.js";
11
8
  import get from "lodash-es/get.js";
12
9
  import humanizeList from "humanize-list";
10
+ import isPlainObject from "lodash-es/isPlainObject.js";
11
+ import omit from "lodash-es/omit.js";
13
12
  import leven from "leven";
13
+ import startCase from "lodash-es/startCase.js";
14
14
  import { createReferenceTypeNode } from "groq-js";
15
15
  const internalValidators = /* @__PURE__ */ new WeakSet();
16
16
  /** @internal */
@@ -1468,7 +1468,7 @@ function getDefaultProblems(type, path = []) {
1468
1468
  }
1469
1469
  function getTypeProblems(type, path = []) {
1470
1470
  switch (type.type) {
1471
- case "object": return getObjectProblems(type, path);
1471
+ case "object":
1472
1472
  case "document": return getObjectProblems(type, path);
1473
1473
  case "array": return getArrayProblems(type, path);
1474
1474
  case "reference": return getReferenceProblems(type, path);
@@ -2541,15 +2541,13 @@ function transformBlockType(blockType, context) {
2541
2541
  };
2542
2542
  }
2543
2543
  function resolveEnabledStyles(blockType) {
2544
- let styleField = blockType.fields?.find((btField) => btField.name === "style");
2545
- return resolveTitleValueArray(styleField?.type?.options?.list);
2544
+ return resolveTitleValueArray((blockType.fields?.find((btField) => btField.name === "style"))?.type?.options?.list);
2546
2545
  }
2547
2546
  function resolveEnabledDecorators(spanType) {
2548
2547
  return "decorators" in spanType ? resolveTitleValueArray(spanType.decorators) : void 0;
2549
2548
  }
2550
2549
  function resolveEnabledListItems(blockType) {
2551
- let listField = blockType.fields?.find((btField) => btField.name === "listItem");
2552
- return resolveTitleValueArray(listField?.type?.options?.list);
2550
+ return resolveTitleValueArray((blockType.fields?.find((btField) => btField.name === "listItem"))?.type?.options?.list);
2553
2551
  }
2554
2552
  function resolveTitleValueArray(possibleArray) {
2555
2553
  if (!possibleArray || !Array.isArray(possibleArray)) return;