@tinacms/schema-tools 2.7.1 → 2.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2255,6 +2255,12 @@ const resolveField = (field, schema) => {
2255
2255
  component: "reference",
2256
2256
  ...extraFields
2257
2257
  };
2258
+ case "displayOnly":
2259
+ return {
2260
+ component: "displayOnly",
2261
+ ...field,
2262
+ ...extraFields
2263
+ };
2258
2264
  default:
2259
2265
  throw new Error(`Unknown field type ${field.type}`);
2260
2266
  }
@@ -2343,7 +2349,8 @@ const TypeName = [
2343
2349
  "image",
2344
2350
  "object",
2345
2351
  "reference",
2346
- "rich-text"
2352
+ "rich-text",
2353
+ "displayOnly"
2347
2354
  ];
2348
2355
  const formattedTypes = ` - ${TypeName.join("\n - ")}`;
2349
2356
  const typeTypeError = `Invalid \`type\` property. \`type\` expected to be one of the following values:
@@ -2415,6 +2422,27 @@ const DateTimeField = TinaScalerBase.extend({
2415
2422
  dateFormat: z.string().optional(),
2416
2423
  timeFormat: z.string().optional()
2417
2424
  });
2425
+ const DisplayOnlyField = TinaField.omit({ required: true }).extend({
2426
+ type: z.literal("displayOnly", {
2427
+ invalid_type_error: typeTypeError,
2428
+ required_error: typeRequiredError
2429
+ }),
2430
+ list: z.literal(void 0, {
2431
+ errorMap: () => ({
2432
+ message: "Property `list` is not allowed on fields of `type: displayOnly`."
2433
+ })
2434
+ }).optional(),
2435
+ required: z.literal(void 0, {
2436
+ errorMap: () => ({
2437
+ message: "Property `required` is not allowed on fields of `type: displayOnly`."
2438
+ })
2439
+ }).optional(),
2440
+ indexed: z.literal(void 0, {
2441
+ errorMap: () => ({
2442
+ message: "Property `indexed` is not allowed on fields of `type: displayOnly`."
2443
+ })
2444
+ }).optional()
2445
+ });
2418
2446
  const ReferenceField = FieldWithList.extend({
2419
2447
  type: z.literal("reference", {
2420
2448
  invalid_type_error: typeTypeError,
@@ -2491,7 +2519,8 @@ const TinaFieldZod = z.lazy(() => {
2491
2519
  ReferenceField,
2492
2520
  ObjectField,
2493
2521
  RichTextField,
2494
- PasswordField
2522
+ PasswordField,
2523
+ DisplayOnlyField
2495
2524
  ],
2496
2525
  {
2497
2526
  errorMap: (issue, ctx) => {
@@ -245,6 +245,15 @@ export type ReferenceField = (FieldGeneric<string, undefined, ReferenceFieldOpti
245
245
  export type PasswordField = (FieldGeneric<string, undefined> | FieldGeneric<string, false>) & BaseField & {
246
246
  type: 'password';
247
247
  };
248
+ export type DisplayOnlyField = BaseField & {
249
+ type: 'displayOnly';
250
+ list?: never;
251
+ required?: never;
252
+ indexed?: never;
253
+ ui?: {
254
+ component?: FC<any> | null;
255
+ };
256
+ };
248
257
  export type ToolbarOverrideType = 'heading' | 'link' | 'image' | 'quote' | 'ul' | 'ol' | 'code' | 'codeBlock' | 'bold' | 'italic' | 'strikethrough' | 'highlight' | 'raw' | 'embed' | 'mermaid' | 'table' | 'hr';
249
258
  type RichTextAst = {
250
259
  type: 'root';
@@ -320,7 +329,7 @@ export type ObjectField<WithNamespace extends boolean = false> = (FieldGeneric<s
320
329
  templates: Template<WithNamespace>[];
321
330
  templateKey?: string;
322
331
  });
323
- type Field<WithNamespace extends boolean = false> = (StringField | NumberField | BooleanField | DateTimeField | ImageField | ReferenceField | RichTextField<WithNamespace> | ObjectField<WithNamespace> | PasswordField) & MaybeNamespace<WithNamespace>;
332
+ type Field<WithNamespace extends boolean = false> = (StringField | NumberField | BooleanField | DateTimeField | ImageField | ReferenceField | RichTextField<WithNamespace> | ObjectField<WithNamespace> | PasswordField | DisplayOnlyField) & MaybeNamespace<WithNamespace>;
324
333
  export type TinaField<WithNamespace extends boolean = false> = Field<WithNamespace> & MaybeNamespace<WithNamespace>;
325
334
  type MaybeNamespace<WithNamespace extends boolean = false> = WithNamespace extends true ? {
326
335
  namespace: string[];
@@ -659,7 +668,7 @@ export interface Config<CMSCallback = undefined, FormifyCallback = undefined, Do
659
668
  * @example
660
669
  *s
661
670
  * historyUrl: ({ relativePath, branch }) => ({
662
- * url: `https://github.com/tinacms/tinacms/commits/${branch}/examples/next-2024/${relativePath}`
671
+ * url: `https://github.com/tinacms/tinacms/commits/${branch}/examples/next/kitchen-sink/${relativePath}`
663
672
  * })
664
673
  * */
665
674
  historyUrl?: (context: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tinacms/schema-tools",
3
3
  "type": "module",
4
- "version": "2.7.1",
4
+ "version": "2.7.2",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "files": [