@cloudhal/core-contracts 0.3.13 → 0.5.0

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.
@@ -176,10 +176,11 @@ export const SiteSchema = {
176
176
  },
177
177
  "collections": {
178
178
  "type": "object",
179
- "description": "RFC-0038: per-collection settings, keyed by collection (ContentEntry.collection). A collection without an entry here uses the defaults.",
179
+ "description": "RFC-0038, RFC-0040: the site's declared collections and their settings, keyed by collection (ContentEntry.collection). A key here declares the collection, even with no settings ({}). A collection with entries but no key is inferred and uses the defaults.",
180
180
  "propertyNames": {
181
181
  "$ref": "#/$defs/Slug"
182
182
  },
183
+ "maxProperties": 50,
183
184
  "additionalProperties": {
184
185
  "$ref": "#/$defs/CollectionSettings"
185
186
  }
@@ -558,6 +559,30 @@ export const SiteSchema = {
558
559
  }
559
560
  }
560
561
  },
562
+ "CollectionLabel": {
563
+ "type": "object",
564
+ "additionalProperties": false,
565
+ "required": [
566
+ "singular",
567
+ "plural"
568
+ ],
569
+ "properties": {
570
+ "singular": {
571
+ "type": "string",
572
+ "minLength": 1,
573
+ "maxLength": 100
574
+ },
575
+ "plural": {
576
+ "type": "string",
577
+ "minLength": 1,
578
+ "maxLength": 100
579
+ },
580
+ "description": {
581
+ "type": "string",
582
+ "maxLength": 1000
583
+ }
584
+ }
585
+ },
561
586
  "CollectionSettings": {
562
587
  "type": "object",
563
588
  "additionalProperties": false,
@@ -566,6 +591,49 @@ export const SiteSchema = {
566
591
  "type": "string",
567
592
  "description": "RFC-0038: where the collection's entries live, as a template with a closed token set. Version 1: one or more fixed lower-case path segments followed by /{slug}, e.g. /blog/{slug}. Absent means /<collection>/{slug}.",
568
593
  "pattern": "^(/[a-z0-9]+(-[a-z0-9]+)*)+/\\{slug\\}$"
594
+ },
595
+ "labels": {
596
+ "type": "object",
597
+ "description": "RFC-0040: display names per locale (Studio, agents, themes). Absent or missing a locale: the default locale's, then the key.",
598
+ "propertyNames": {
599
+ "$ref": "#/$defs/Locale"
600
+ },
601
+ "minProperties": 1,
602
+ "additionalProperties": {
603
+ "$ref": "#/$defs/CollectionLabel"
604
+ }
605
+ },
606
+ "icon": {
607
+ "type": "string",
608
+ "description": "RFC-0040: a name from Studio's closed icon set (e.g. calendar, briefcase, users). Unknown names show the default icon. Never a URL or markup.",
609
+ "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
610
+ "maxLength": 40
611
+ },
612
+ "feed": {
613
+ "type": "boolean",
614
+ "description": "RFC-0040: entries appear in the site's RSS feeds. Absent: true."
615
+ },
616
+ "sitemap": {
617
+ "type": "boolean",
618
+ "description": "RFC-0040: published entries appear in sitemap.xml. Absent: true."
619
+ },
620
+ "sort": {
621
+ "type": "string",
622
+ "description": "RFC-0040: default order where none is given (Studio's list, entry queries without sort, MCP list_entries). Absent: newest.",
623
+ "enum": [
624
+ "newest",
625
+ "oldest",
626
+ "title"
627
+ ]
628
+ },
629
+ "fields": {
630
+ "type": "array",
631
+ "description": "RFC-0041: the collection's typed custom fields, in form order. Values live in ContentEntry.fields under each key. At most 200 per site and unique keys (checked in code).",
632
+ "minItems": 1,
633
+ "maxItems": 30,
634
+ "items": {
635
+ "$ref": "#/$defs/FieldDefinition"
636
+ }
569
637
  }
570
638
  }
571
639
  },
@@ -622,6 +690,476 @@ export const SiteSchema = {
622
690
  }
623
691
  }
624
692
  },
693
+ "FieldDefinition": {
694
+ "description": "RFC-0041: one typed custom field of a collection, discriminated by `type`.",
695
+ "oneOf": [
696
+ {
697
+ "title": "TextField",
698
+ "type": "object",
699
+ "description": "Plain text: a string of at most maxLength characters.",
700
+ "additionalProperties": false,
701
+ "required": [
702
+ "key",
703
+ "type",
704
+ "labels",
705
+ "localized"
706
+ ],
707
+ "properties": {
708
+ "key": {
709
+ "$ref": "#/$defs/FieldKey"
710
+ },
711
+ "type": {
712
+ "type": "string",
713
+ "enum": [
714
+ "text"
715
+ ]
716
+ },
717
+ "labels": {
718
+ "$ref": "#/$defs/FieldLabels"
719
+ },
720
+ "localized": {
721
+ "type": "boolean",
722
+ "description": "true: each language version has its own value (missing reads the original's); false: only the translation group's original holds it."
723
+ },
724
+ "requiredToPublish": {
725
+ "type": "boolean",
726
+ "description": "An entry in review or published needs a value. Absent: false."
727
+ },
728
+ "migration": {
729
+ "$ref": "#/$defs/FieldMigration"
730
+ },
731
+ "maxLength": {
732
+ "type": "integer",
733
+ "description": "Absent: 5000.",
734
+ "minimum": 1,
735
+ "maximum": 5000
736
+ },
737
+ "multiline": {
738
+ "type": "boolean",
739
+ "description": "Line breaks allowed. Absent: false."
740
+ },
741
+ "searchable": {
742
+ "type": "boolean",
743
+ "description": "Its words go into site search. Absent: false."
744
+ }
745
+ }
746
+ },
747
+ {
748
+ "title": "RichTextField",
749
+ "type": "object",
750
+ "description": "Cloudhal Markdown v1 (ADR-0028), at most 50 000 characters.",
751
+ "additionalProperties": false,
752
+ "required": [
753
+ "key",
754
+ "type",
755
+ "labels",
756
+ "localized"
757
+ ],
758
+ "properties": {
759
+ "key": {
760
+ "$ref": "#/$defs/FieldKey"
761
+ },
762
+ "type": {
763
+ "type": "string",
764
+ "enum": [
765
+ "richText"
766
+ ]
767
+ },
768
+ "labels": {
769
+ "$ref": "#/$defs/FieldLabels"
770
+ },
771
+ "localized": {
772
+ "type": "boolean",
773
+ "description": "true: each language version has its own value (missing reads the original's); false: only the translation group's original holds it."
774
+ },
775
+ "requiredToPublish": {
776
+ "type": "boolean",
777
+ "description": "An entry in review or published needs a value. Absent: false."
778
+ },
779
+ "migration": {
780
+ "$ref": "#/$defs/FieldMigration"
781
+ },
782
+ "searchable": {
783
+ "type": "boolean",
784
+ "description": "Its words go into site search. Absent: false."
785
+ }
786
+ }
787
+ },
788
+ {
789
+ "title": "NumberField",
790
+ "type": "object",
791
+ "description": "A finite number.",
792
+ "additionalProperties": false,
793
+ "required": [
794
+ "key",
795
+ "type",
796
+ "labels",
797
+ "localized"
798
+ ],
799
+ "properties": {
800
+ "key": {
801
+ "$ref": "#/$defs/FieldKey"
802
+ },
803
+ "type": {
804
+ "type": "string",
805
+ "enum": [
806
+ "number"
807
+ ]
808
+ },
809
+ "labels": {
810
+ "$ref": "#/$defs/FieldLabels"
811
+ },
812
+ "localized": {
813
+ "type": "boolean",
814
+ "description": "true: each language version has its own value (missing reads the original's); false: only the translation group's original holds it."
815
+ },
816
+ "requiredToPublish": {
817
+ "type": "boolean",
818
+ "description": "An entry in review or published needs a value. Absent: false."
819
+ },
820
+ "migration": {
821
+ "$ref": "#/$defs/FieldMigration"
822
+ },
823
+ "integer": {
824
+ "type": "boolean",
825
+ "description": "Whole numbers only. Absent: false."
826
+ },
827
+ "minimum": {
828
+ "type": "number"
829
+ },
830
+ "maximum": {
831
+ "type": "number"
832
+ }
833
+ }
834
+ },
835
+ {
836
+ "title": "BooleanField",
837
+ "type": "object",
838
+ "description": "true or false; absent reads as false, so it cannot be required to publish.",
839
+ "additionalProperties": false,
840
+ "required": [
841
+ "key",
842
+ "type",
843
+ "labels",
844
+ "localized"
845
+ ],
846
+ "properties": {
847
+ "key": {
848
+ "$ref": "#/$defs/FieldKey"
849
+ },
850
+ "type": {
851
+ "type": "string",
852
+ "enum": [
853
+ "boolean"
854
+ ]
855
+ },
856
+ "labels": {
857
+ "$ref": "#/$defs/FieldLabels"
858
+ },
859
+ "localized": {
860
+ "type": "boolean",
861
+ "description": "true: each language version has its own value (missing reads the original's); false: only the translation group's original holds it."
862
+ },
863
+ "migration": {
864
+ "$ref": "#/$defs/FieldMigration"
865
+ }
866
+ }
867
+ },
868
+ {
869
+ "title": "DateField",
870
+ "type": "object",
871
+ "description": "A calendar day without a zone (YYYY-MM-DD).",
872
+ "additionalProperties": false,
873
+ "required": [
874
+ "key",
875
+ "type",
876
+ "labels",
877
+ "localized"
878
+ ],
879
+ "properties": {
880
+ "key": {
881
+ "$ref": "#/$defs/FieldKey"
882
+ },
883
+ "type": {
884
+ "type": "string",
885
+ "enum": [
886
+ "date"
887
+ ]
888
+ },
889
+ "labels": {
890
+ "$ref": "#/$defs/FieldLabels"
891
+ },
892
+ "localized": {
893
+ "type": "boolean",
894
+ "description": "true: each language version has its own value (missing reads the original's); false: only the translation group's original holds it."
895
+ },
896
+ "requiredToPublish": {
897
+ "type": "boolean",
898
+ "description": "An entry in review or published needs a value. Absent: false."
899
+ },
900
+ "migration": {
901
+ "$ref": "#/$defs/FieldMigration"
902
+ }
903
+ }
904
+ },
905
+ {
906
+ "title": "DateTimeField",
907
+ "type": "object",
908
+ "description": "An instant with the zone it was entered in: {at, timeZone} (RFC-0008 §9.1).",
909
+ "additionalProperties": false,
910
+ "required": [
911
+ "key",
912
+ "type",
913
+ "labels",
914
+ "localized"
915
+ ],
916
+ "properties": {
917
+ "key": {
918
+ "$ref": "#/$defs/FieldKey"
919
+ },
920
+ "type": {
921
+ "type": "string",
922
+ "enum": [
923
+ "datetime"
924
+ ]
925
+ },
926
+ "labels": {
927
+ "$ref": "#/$defs/FieldLabels"
928
+ },
929
+ "localized": {
930
+ "type": "boolean",
931
+ "description": "true: each language version has its own value (missing reads the original's); false: only the translation group's original holds it."
932
+ },
933
+ "requiredToPublish": {
934
+ "type": "boolean",
935
+ "description": "An entry in review or published needs a value. Absent: false."
936
+ },
937
+ "migration": {
938
+ "$ref": "#/$defs/FieldMigration"
939
+ }
940
+ }
941
+ },
942
+ {
943
+ "title": "UrlField",
944
+ "type": "object",
945
+ "description": "A link: https, http, mailto, tel, a site-relative path or a #fragment; at most 2048 characters.",
946
+ "additionalProperties": false,
947
+ "required": [
948
+ "key",
949
+ "type",
950
+ "labels",
951
+ "localized"
952
+ ],
953
+ "properties": {
954
+ "key": {
955
+ "$ref": "#/$defs/FieldKey"
956
+ },
957
+ "type": {
958
+ "type": "string",
959
+ "enum": [
960
+ "url"
961
+ ]
962
+ },
963
+ "labels": {
964
+ "$ref": "#/$defs/FieldLabels"
965
+ },
966
+ "localized": {
967
+ "type": "boolean",
968
+ "description": "true: each language version has its own value (missing reads the original's); false: only the translation group's original holds it."
969
+ },
970
+ "requiredToPublish": {
971
+ "type": "boolean",
972
+ "description": "An entry in review or published needs a value. Absent: false."
973
+ },
974
+ "migration": {
975
+ "$ref": "#/$defs/FieldMigration"
976
+ }
977
+ }
978
+ },
979
+ {
980
+ "title": "ImageField",
981
+ "type": "object",
982
+ "description": "An image Asset of the same site, by id (asset_…).",
983
+ "additionalProperties": false,
984
+ "required": [
985
+ "key",
986
+ "type",
987
+ "labels",
988
+ "localized"
989
+ ],
990
+ "properties": {
991
+ "key": {
992
+ "$ref": "#/$defs/FieldKey"
993
+ },
994
+ "type": {
995
+ "type": "string",
996
+ "enum": [
997
+ "image"
998
+ ]
999
+ },
1000
+ "labels": {
1001
+ "$ref": "#/$defs/FieldLabels"
1002
+ },
1003
+ "localized": {
1004
+ "type": "boolean",
1005
+ "description": "true: each language version has its own value (missing reads the original's); false: only the translation group's original holds it."
1006
+ },
1007
+ "requiredToPublish": {
1008
+ "type": "boolean",
1009
+ "description": "An entry in review or published needs a value. Absent: false."
1010
+ },
1011
+ "migration": {
1012
+ "$ref": "#/$defs/FieldMigration"
1013
+ }
1014
+ }
1015
+ },
1016
+ {
1017
+ "title": "SelectField",
1018
+ "type": "object",
1019
+ "description": "One of a closed list of options, or several when multiple.",
1020
+ "additionalProperties": false,
1021
+ "required": [
1022
+ "key",
1023
+ "type",
1024
+ "labels",
1025
+ "localized",
1026
+ "options"
1027
+ ],
1028
+ "properties": {
1029
+ "key": {
1030
+ "$ref": "#/$defs/FieldKey"
1031
+ },
1032
+ "type": {
1033
+ "type": "string",
1034
+ "enum": [
1035
+ "select"
1036
+ ]
1037
+ },
1038
+ "labels": {
1039
+ "$ref": "#/$defs/FieldLabels"
1040
+ },
1041
+ "localized": {
1042
+ "type": "boolean",
1043
+ "description": "true: each language version has its own value (missing reads the original's); false: only the translation group's original holds it."
1044
+ },
1045
+ "requiredToPublish": {
1046
+ "type": "boolean",
1047
+ "description": "An entry in review or published needs a value. Absent: false."
1048
+ },
1049
+ "migration": {
1050
+ "$ref": "#/$defs/FieldMigration"
1051
+ },
1052
+ "options": {
1053
+ "type": "array",
1054
+ "minItems": 1,
1055
+ "maxItems": 50,
1056
+ "items": {
1057
+ "$ref": "#/$defs/FieldOption"
1058
+ }
1059
+ },
1060
+ "multiple": {
1061
+ "type": "boolean",
1062
+ "description": "The value is a list of option values. Absent: false."
1063
+ }
1064
+ }
1065
+ }
1066
+ ]
1067
+ },
1068
+ "FieldKey": {
1069
+ "type": "string",
1070
+ "description": "The field's key in ContentEntry.fields: lower camelCase, a JavaScript identifier. Unique in its collection; built-in entry property names are reserved (checked in code).",
1071
+ "pattern": "^[a-z][A-Za-z0-9]{0,39}$"
1072
+ },
1073
+ "FieldLabel": {
1074
+ "type": "object",
1075
+ "additionalProperties": false,
1076
+ "required": [
1077
+ "label"
1078
+ ],
1079
+ "properties": {
1080
+ "label": {
1081
+ "type": "string",
1082
+ "minLength": 1,
1083
+ "maxLength": 100
1084
+ },
1085
+ "help": {
1086
+ "type": "string",
1087
+ "maxLength": 300
1088
+ }
1089
+ }
1090
+ },
1091
+ "FieldLabels": {
1092
+ "type": "object",
1093
+ "description": "The field's label and help per locale. Missing a locale: the default locale's, then the key.",
1094
+ "propertyNames": {
1095
+ "$ref": "#/$defs/Locale"
1096
+ },
1097
+ "minProperties": 1,
1098
+ "additionalProperties": {
1099
+ "$ref": "#/$defs/FieldLabel"
1100
+ }
1101
+ },
1102
+ "FieldMigration": {
1103
+ "type": "object",
1104
+ "description": "RFC-0041 §6: present only while a field operation rewrites entries.",
1105
+ "additionalProperties": false,
1106
+ "required": [
1107
+ "id"
1108
+ ],
1109
+ "properties": {
1110
+ "id": {
1111
+ "$ref": "#/$defs/Id",
1112
+ "description": "The operation's \"before\" snapshot."
1113
+ },
1114
+ "fromKey": {
1115
+ "$ref": "#/$defs/FieldKey"
1116
+ },
1117
+ "fromType": {
1118
+ "type": "string",
1119
+ "enum": [
1120
+ "text",
1121
+ "richText",
1122
+ "number",
1123
+ "boolean",
1124
+ "date",
1125
+ "datetime",
1126
+ "url",
1127
+ "image",
1128
+ "select"
1129
+ ]
1130
+ },
1131
+ "fromLocalized": {
1132
+ "type": "boolean"
1133
+ }
1134
+ }
1135
+ },
1136
+ "FieldOption": {
1137
+ "type": "object",
1138
+ "description": "One option of a select field. Values are unique in the field (checked in code).",
1139
+ "additionalProperties": false,
1140
+ "required": [
1141
+ "value",
1142
+ "labels"
1143
+ ],
1144
+ "properties": {
1145
+ "value": {
1146
+ "$ref": "#/$defs/Slug",
1147
+ "description": "Stored in entries, never shown."
1148
+ },
1149
+ "labels": {
1150
+ "type": "object",
1151
+ "propertyNames": {
1152
+ "$ref": "#/$defs/Locale"
1153
+ },
1154
+ "minProperties": 1,
1155
+ "additionalProperties": {
1156
+ "type": "string",
1157
+ "minLength": 1,
1158
+ "maxLength": 100
1159
+ }
1160
+ }
1161
+ }
1162
+ },
625
1163
  "FooterColumn": {
626
1164
  "type": "object",
627
1165
  "additionalProperties": false,
@@ -2409,7 +2947,7 @@ export const ContentEntrySchema = {
2409
2947
  },
2410
2948
  "fields": {
2411
2949
  "type": "object",
2412
- "description": "Collection-specific values; any JSON.",
2950
+ "description": "Collection-specific values, keyed by field. A collection with typed fields (RFC-0041, Site.collections.<key>.fields) checks each value against its definition on write; otherwise any JSON. An absent key means no value.",
2413
2951
  "additionalProperties": true
2414
2952
  },
2415
2953
  "tags": {