@datocms/cma-client 5.1.10 → 5.1.12
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/README.md +569 -0
- package/dist/cjs/fieldTypes/boolean.js +2 -2
- package/dist/cjs/fieldTypes/boolean.js.map +1 -1
- package/dist/cjs/fieldTypes/color.js +2 -2
- package/dist/cjs/fieldTypes/color.js.map +1 -1
- package/dist/cjs/fieldTypes/date.js +2 -3
- package/dist/cjs/fieldTypes/date.js.map +1 -1
- package/dist/cjs/fieldTypes/date_time.js +2 -2
- package/dist/cjs/fieldTypes/date_time.js.map +1 -1
- package/dist/cjs/fieldTypes/file.js +33 -5
- package/dist/cjs/fieldTypes/file.js.map +1 -1
- package/dist/cjs/fieldTypes/float.js +2 -2
- package/dist/cjs/fieldTypes/float.js.map +1 -1
- package/dist/cjs/fieldTypes/gallery.js +20 -5
- package/dist/cjs/fieldTypes/gallery.js.map +1 -1
- package/dist/cjs/fieldTypes/index.js +2 -2
- package/dist/cjs/fieldTypes/index.js.map +1 -1
- package/dist/cjs/fieldTypes/integer.js +2 -2
- package/dist/cjs/fieldTypes/integer.js.map +1 -1
- package/dist/cjs/fieldTypes/json.js +2 -3
- package/dist/cjs/fieldTypes/json.js.map +1 -1
- package/dist/cjs/fieldTypes/lat_lon.js +2 -2
- package/dist/cjs/fieldTypes/lat_lon.js.map +1 -1
- package/dist/cjs/fieldTypes/link.js +4 -4
- package/dist/cjs/fieldTypes/link.js.map +1 -1
- package/dist/cjs/fieldTypes/links.js +5 -3
- package/dist/cjs/fieldTypes/links.js.map +1 -1
- package/dist/cjs/fieldTypes/rich_text.js +18 -18
- package/dist/cjs/fieldTypes/rich_text.js.map +1 -1
- package/dist/cjs/fieldTypes/schema.js +3 -0
- package/dist/cjs/fieldTypes/schema.js.map +1 -0
- package/dist/cjs/fieldTypes/seo.js +2 -3
- package/dist/cjs/fieldTypes/seo.js.map +1 -1
- package/dist/cjs/fieldTypes/single_block.js +20 -19
- package/dist/cjs/fieldTypes/single_block.js.map +1 -1
- package/dist/cjs/fieldTypes/slug.js +2 -3
- package/dist/cjs/fieldTypes/slug.js.map +1 -1
- package/dist/cjs/fieldTypes/string.js +2 -2
- package/dist/cjs/fieldTypes/string.js.map +1 -1
- package/dist/cjs/fieldTypes/structured_text.js +17 -18
- package/dist/cjs/fieldTypes/structured_text.js.map +1 -1
- package/dist/cjs/fieldTypes/text.js +2 -3
- package/dist/cjs/fieldTypes/text.js.map +1 -1
- package/dist/cjs/fieldTypes/video.js +2 -2
- package/dist/cjs/fieldTypes/video.js.map +1 -1
- package/dist/cjs/generated/Client.js +1 -1
- package/dist/cjs/generated/resources/Item.js.map +1 -1
- package/dist/cjs/generated/resources/ScheduledPublication.js.map +1 -1
- package/dist/cjs/generated/resources/ScheduledUnpublishing.js.map +1 -1
- package/dist/cjs/generated/resources/Upload.js.map +1 -1
- package/dist/cjs/index.js +5 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/utilities/buildBlockRecord.js +1 -45
- package/dist/cjs/utilities/buildBlockRecord.js.map +1 -1
- package/dist/cjs/utilities/duplicateBlockRecord.js +49 -0
- package/dist/cjs/utilities/duplicateBlockRecord.js.map +1 -0
- package/dist/cjs/utilities/inspectItem.js +427 -0
- package/dist/cjs/utilities/inspectItem.js.map +1 -0
- package/dist/cjs/utilities/{blocks.js → nonRecursiveBlocks.js} +60 -234
- package/dist/cjs/utilities/nonRecursiveBlocks.js.map +1 -0
- package/dist/cjs/utilities/{fieldValue.js → normalizedFieldValues.js} +53 -41
- package/dist/cjs/utilities/normalizedFieldValues.js.map +1 -0
- package/dist/cjs/utilities/recursiveBlocks.js +73 -92
- package/dist/cjs/utilities/recursiveBlocks.js.map +1 -1
- package/dist/cjs/utilities/schemaRepository.js +2 -2
- package/dist/esm/fieldTypes/boolean.d.ts +1 -1
- package/dist/esm/fieldTypes/boolean.js +2 -2
- package/dist/esm/fieldTypes/boolean.js.map +1 -1
- package/dist/esm/fieldTypes/color.d.ts +1 -1
- package/dist/esm/fieldTypes/color.js +2 -2
- package/dist/esm/fieldTypes/color.js.map +1 -1
- package/dist/esm/fieldTypes/date.d.ts +1 -1
- package/dist/esm/fieldTypes/date.js +2 -3
- package/dist/esm/fieldTypes/date.js.map +1 -1
- package/dist/esm/fieldTypes/date_time.d.ts +1 -1
- package/dist/esm/fieldTypes/date_time.js +2 -2
- package/dist/esm/fieldTypes/date_time.js.map +1 -1
- package/dist/esm/fieldTypes/file.d.ts +68 -1
- package/dist/esm/fieldTypes/file.js +29 -3
- package/dist/esm/fieldTypes/file.js.map +1 -1
- package/dist/esm/fieldTypes/float.d.ts +1 -1
- package/dist/esm/fieldTypes/float.js +2 -2
- package/dist/esm/fieldTypes/float.js.map +1 -1
- package/dist/esm/fieldTypes/gallery.d.ts +27 -11
- package/dist/esm/fieldTypes/gallery.js +17 -4
- package/dist/esm/fieldTypes/gallery.js.map +1 -1
- package/dist/esm/fieldTypes/index.d.ts +2 -2
- package/dist/esm/fieldTypes/index.js +2 -2
- package/dist/esm/fieldTypes/index.js.map +1 -1
- package/dist/esm/fieldTypes/integer.d.ts +1 -1
- package/dist/esm/fieldTypes/integer.js +2 -2
- package/dist/esm/fieldTypes/integer.js.map +1 -1
- package/dist/esm/fieldTypes/json.d.ts +1 -1
- package/dist/esm/fieldTypes/json.js +2 -3
- package/dist/esm/fieldTypes/json.js.map +1 -1
- package/dist/esm/fieldTypes/lat_lon.d.ts +1 -1
- package/dist/esm/fieldTypes/lat_lon.js +2 -2
- package/dist/esm/fieldTypes/lat_lon.js.map +1 -1
- package/dist/esm/fieldTypes/link.d.ts +1 -1
- package/dist/esm/fieldTypes/link.js +4 -4
- package/dist/esm/fieldTypes/link.js.map +1 -1
- package/dist/esm/fieldTypes/links.d.ts +1 -1
- package/dist/esm/fieldTypes/links.js +5 -3
- package/dist/esm/fieldTypes/links.js.map +1 -1
- package/dist/esm/fieldTypes/rich_text.d.ts +9 -10
- package/dist/esm/fieldTypes/rich_text.js +13 -13
- package/dist/esm/fieldTypes/rich_text.js.map +1 -1
- package/dist/esm/fieldTypes/schema.d.ts +59 -0
- package/dist/esm/fieldTypes/schema.js +2 -0
- package/dist/esm/fieldTypes/schema.js.map +1 -0
- package/dist/esm/fieldTypes/seo.d.ts +1 -1
- package/dist/esm/fieldTypes/seo.js +2 -3
- package/dist/esm/fieldTypes/seo.js.map +1 -1
- package/dist/esm/fieldTypes/single_block.d.ts +31 -16
- package/dist/esm/fieldTypes/single_block.js +15 -14
- package/dist/esm/fieldTypes/single_block.js.map +1 -1
- package/dist/esm/fieldTypes/slug.d.ts +1 -1
- package/dist/esm/fieldTypes/slug.js +2 -3
- package/dist/esm/fieldTypes/slug.js.map +1 -1
- package/dist/esm/fieldTypes/string.d.ts +1 -1
- package/dist/esm/fieldTypes/string.js +2 -2
- package/dist/esm/fieldTypes/string.js.map +1 -1
- package/dist/esm/fieldTypes/structured_text.d.ts +15 -16
- package/dist/esm/fieldTypes/structured_text.js +12 -13
- package/dist/esm/fieldTypes/structured_text.js.map +1 -1
- package/dist/esm/fieldTypes/text.d.ts +1 -1
- package/dist/esm/fieldTypes/text.js +2 -3
- package/dist/esm/fieldTypes/text.js.map +1 -1
- package/dist/esm/fieldTypes/video.d.ts +1 -1
- package/dist/esm/fieldTypes/video.js +2 -2
- package/dist/esm/fieldTypes/video.js.map +1 -1
- package/dist/esm/generated/ApiTypes.d.ts +90 -980
- package/dist/esm/generated/Client.js +1 -1
- package/dist/esm/generated/RawApiTypes.d.ts +156 -999
- package/dist/esm/generated/resources/Field.d.ts +200 -200
- package/dist/esm/generated/resources/Item.d.ts +34 -34
- package/dist/esm/generated/resources/Item.js.map +1 -1
- package/dist/esm/generated/resources/ItemVersion.d.ts +3 -1
- package/dist/esm/generated/resources/ScheduledPublication.d.ts +3 -3
- package/dist/esm/generated/resources/ScheduledPublication.js.map +1 -1
- package/dist/esm/generated/resources/ScheduledUnpublishing.d.ts +3 -3
- package/dist/esm/generated/resources/ScheduledUnpublishing.js.map +1 -1
- package/dist/esm/generated/resources/Upload.d.ts +6 -6
- package/dist/esm/generated/resources/Upload.js.map +1 -1
- package/dist/esm/index.d.ts +5 -4
- package/dist/esm/index.js +5 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utilities/buildBlockRecord.d.ts +3 -5
- package/dist/esm/utilities/buildBlockRecord.js +0 -43
- package/dist/esm/utilities/buildBlockRecord.js.map +1 -1
- package/dist/esm/utilities/duplicateBlockRecord.d.ts +6 -0
- package/dist/esm/utilities/duplicateBlockRecord.js +45 -0
- package/dist/esm/utilities/duplicateBlockRecord.js.map +1 -0
- package/dist/esm/utilities/inspectItem.d.ts +8 -0
- package/dist/esm/utilities/inspectItem.js +400 -0
- package/dist/esm/utilities/inspectItem.js.map +1 -0
- package/dist/esm/utilities/itemDefinition.d.ts +45 -23
- package/dist/esm/utilities/nonRecursiveBlocks.d.ts +114 -0
- package/dist/esm/utilities/{blocks.js → nonRecursiveBlocks.js} +52 -220
- package/dist/esm/utilities/nonRecursiveBlocks.js.map +1 -0
- package/dist/{types/utilities/fieldValue.d.ts → esm/utilities/normalizedFieldValues.d.ts} +15 -14
- package/dist/esm/utilities/{fieldValue.js → normalizedFieldValues.js} +39 -28
- package/dist/esm/utilities/normalizedFieldValues.js.map +1 -0
- package/dist/esm/utilities/recursiveBlocks.d.ts +124 -11
- package/dist/esm/utilities/recursiveBlocks.js +65 -84
- package/dist/esm/utilities/recursiveBlocks.js.map +1 -1
- package/dist/esm/utilities/schemaRepository.d.ts +2 -2
- package/dist/esm/utilities/schemaRepository.js +2 -2
- package/dist/types/fieldTypes/boolean.d.ts +1 -1
- package/dist/types/fieldTypes/color.d.ts +1 -1
- package/dist/types/fieldTypes/date.d.ts +1 -1
- package/dist/types/fieldTypes/date_time.d.ts +1 -1
- package/dist/types/fieldTypes/file.d.ts +68 -1
- package/dist/types/fieldTypes/float.d.ts +1 -1
- package/dist/types/fieldTypes/gallery.d.ts +27 -11
- package/dist/types/fieldTypes/index.d.ts +2 -2
- package/dist/types/fieldTypes/integer.d.ts +1 -1
- package/dist/types/fieldTypes/json.d.ts +1 -1
- package/dist/types/fieldTypes/lat_lon.d.ts +1 -1
- package/dist/types/fieldTypes/link.d.ts +1 -1
- package/dist/types/fieldTypes/links.d.ts +1 -1
- package/dist/types/fieldTypes/rich_text.d.ts +9 -10
- package/dist/types/fieldTypes/schema.d.ts +59 -0
- package/dist/types/fieldTypes/seo.d.ts +1 -1
- package/dist/types/fieldTypes/single_block.d.ts +31 -16
- package/dist/types/fieldTypes/slug.d.ts +1 -1
- package/dist/types/fieldTypes/string.d.ts +1 -1
- package/dist/types/fieldTypes/structured_text.d.ts +15 -16
- package/dist/types/fieldTypes/text.d.ts +1 -1
- package/dist/types/fieldTypes/video.d.ts +1 -1
- package/dist/types/generated/ApiTypes.d.ts +90 -980
- package/dist/types/generated/RawApiTypes.d.ts +156 -999
- package/dist/types/generated/resources/Field.d.ts +200 -200
- package/dist/types/generated/resources/Item.d.ts +34 -34
- package/dist/types/generated/resources/ItemVersion.d.ts +3 -1
- package/dist/types/generated/resources/ScheduledPublication.d.ts +3 -3
- package/dist/types/generated/resources/ScheduledUnpublishing.d.ts +3 -3
- package/dist/types/generated/resources/Upload.d.ts +6 -6
- package/dist/types/index.d.ts +5 -4
- package/dist/types/utilities/buildBlockRecord.d.ts +3 -5
- package/dist/types/utilities/duplicateBlockRecord.d.ts +6 -0
- package/dist/types/utilities/inspectItem.d.ts +8 -0
- package/dist/types/utilities/itemDefinition.d.ts +45 -23
- package/dist/types/utilities/nonRecursiveBlocks.d.ts +114 -0
- package/dist/{esm/utilities/fieldValue.d.ts → types/utilities/normalizedFieldValues.d.ts} +15 -14
- package/dist/types/utilities/recursiveBlocks.d.ts +124 -11
- package/dist/types/utilities/schemaRepository.d.ts +2 -2
- package/package.json +4 -4
- package/src/fieldTypes/boolean.ts +5 -3
- package/src/fieldTypes/color.ts +5 -3
- package/src/fieldTypes/date.ts +5 -4
- package/src/fieldTypes/date_time.ts +5 -3
- package/src/fieldTypes/file.ts +98 -4
- package/src/fieldTypes/float.ts +5 -3
- package/src/fieldTypes/gallery.ts +53 -20
- package/src/fieldTypes/index.ts +2 -3
- package/src/fieldTypes/integer.ts +5 -3
- package/src/fieldTypes/json.ts +5 -4
- package/src/fieldTypes/lat_lon.ts +5 -3
- package/src/fieldTypes/link.ts +7 -5
- package/src/fieldTypes/links.ts +8 -4
- package/src/fieldTypes/rich_text.ts +33 -31
- package/src/fieldTypes/schema.ts +657 -0
- package/src/fieldTypes/seo.ts +5 -4
- package/src/fieldTypes/single_block.ts +71 -46
- package/src/fieldTypes/slug.ts +5 -4
- package/src/fieldTypes/string.ts +5 -3
- package/src/fieldTypes/structured_text.ts +64 -58
- package/src/fieldTypes/text.ts +5 -4
- package/src/fieldTypes/video.ts +5 -3
- package/src/generated/ApiTypes.ts +217 -1880
- package/src/generated/Client.ts +1 -1
- package/src/generated/RawApiTypes.ts +272 -2113
- package/src/generated/resources/Item.ts +93 -187
- package/src/generated/resources/ScheduledPublication.ts +4 -15
- package/src/generated/resources/ScheduledUnpublishing.ts +4 -15
- package/src/generated/resources/Upload.ts +9 -32
- package/src/index.ts +5 -4
- package/src/utilities/buildBlockRecord.ts +4 -59
- package/src/utilities/duplicateBlockRecord.ts +52 -0
- package/src/utilities/inspectItem.ts +602 -0
- package/src/utilities/itemDefinition.ts +130 -92
- package/src/utilities/nonRecursiveBlocks.ts +406 -0
- package/src/utilities/{fieldValue.ts → normalizedFieldValues.ts} +70 -30
- package/src/utilities/recursiveBlocks.ts +484 -204
- package/src/utilities/schemaRepository.ts +2 -2
- package/dist/cjs/utilities/blocks.js.map +0 -1
- package/dist/cjs/utilities/fieldValue.js.map +0 -1
- package/dist/esm/utilities/blocks.d.ts +0 -180
- package/dist/esm/utilities/blocks.js.map +0 -1
- package/dist/esm/utilities/fieldValue.js.map +0 -1
- package/dist/types/utilities/blocks.d.ts +0 -180
- package/src/utilities/blocks.ts +0 -626
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { isValidId } from '../utilities/id';
|
|
2
|
+
import { isLocalizedFieldValue, } from '../utilities/normalizedFieldValues';
|
|
1
3
|
import { isItemId, isItemWithOptionalIdAndMeta, isItemWithOptionalMeta, } from './single_block';
|
|
2
4
|
/**
|
|
3
5
|
* =============================================================================
|
|
@@ -9,18 +11,18 @@ import { isItemId, isItemWithOptionalIdAndMeta, isItemWithOptionalMeta, } from '
|
|
|
9
11
|
* Checks for array structure and ensures all blocks are string references.
|
|
10
12
|
*/
|
|
11
13
|
export function isRichTextFieldValue(value) {
|
|
12
|
-
return (Array.isArray(value) &&
|
|
14
|
+
return (Array.isArray(value) &&
|
|
15
|
+
value.every((block) => typeof block === 'string' && isValidId(block)));
|
|
13
16
|
}
|
|
14
17
|
export function isLocalizedRichTextFieldValue(value) {
|
|
15
|
-
return (
|
|
16
|
-
value !== null &&
|
|
18
|
+
return (isLocalizedFieldValue(value) &&
|
|
17
19
|
Object.values(value).every(isRichTextFieldValue));
|
|
18
20
|
}
|
|
19
21
|
/**
|
|
20
22
|
* Type guard for Modular Content field values in API request format.
|
|
21
23
|
* Allows blocks as string IDs, full objects with IDs, or objects without IDs.
|
|
22
24
|
*/
|
|
23
|
-
export function
|
|
25
|
+
export function isRichTextFieldValueInRequest(value) {
|
|
24
26
|
if (value === null)
|
|
25
27
|
return true;
|
|
26
28
|
if (!Array.isArray(value))
|
|
@@ -33,16 +35,15 @@ export function isRichTextFieldValueAsRequest(value) {
|
|
|
33
35
|
return isItemWithOptionalIdAndMeta(block);
|
|
34
36
|
});
|
|
35
37
|
}
|
|
36
|
-
export function
|
|
37
|
-
return (
|
|
38
|
-
value
|
|
39
|
-
Object.values(value).every(isRichTextFieldValueAsRequest));
|
|
38
|
+
export function isLocalizedRichTextFieldValueInRequest(value) {
|
|
39
|
+
return (isLocalizedFieldValue(value) &&
|
|
40
|
+
Object.values(value).every(isRichTextFieldValueInRequest));
|
|
40
41
|
}
|
|
41
42
|
/**
|
|
42
43
|
* Type guard for Modular Content field values with nested blocks (?nested=true format).
|
|
43
44
|
* Ensures all blocks are full RawApiTypes.Item objects with complete data.
|
|
44
45
|
*/
|
|
45
|
-
export function
|
|
46
|
+
export function isRichTextFieldValueInNestedResponse(value) {
|
|
46
47
|
if (!Array.isArray(value))
|
|
47
48
|
return false;
|
|
48
49
|
return value.every((block) => {
|
|
@@ -50,9 +51,8 @@ export function isRichTextFieldValueWithNestedBlocks(value) {
|
|
|
50
51
|
return isItemWithOptionalMeta(block);
|
|
51
52
|
});
|
|
52
53
|
}
|
|
53
|
-
export function
|
|
54
|
-
return (
|
|
55
|
-
value
|
|
56
|
-
Object.values(value).every(isRichTextFieldValueWithNestedBlocks));
|
|
54
|
+
export function isLocalizedRichTextFieldValueInNestedResponse(value) {
|
|
55
|
+
return (isLocalizedFieldValue(value) &&
|
|
56
|
+
Object.values(value).every(isRichTextFieldValueInNestedResponse));
|
|
57
57
|
}
|
|
58
58
|
//# sourceMappingURL=rich_text.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rich_text.js","sourceRoot":"","sources":["../../../src/fieldTypes/rich_text.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rich_text.js","sourceRoot":"","sources":["../../../src/fieldTypes/rich_text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAEL,qBAAqB,GACtB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAGL,QAAQ,EACR,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AA2ExB;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAClC,KAAc;IAEd,OAAO,CACL,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACpB,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,CACtE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,6BAA6B,CAC3C,KAAc;IAEd,OAAO,CACL,qBAAqB,CAAC,KAAK,CAAC;QAC5B,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC,CACjD,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,6BAA6B,CAE3C,KAAc;IACd,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEhC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAExC,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QAC3B,yCAAyC;QACzC,IAAI,QAAQ,CAAC,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QAEjC,0DAA0D;QAC1D,OAAO,2BAA2B,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,sCAAsC,CAGpD,KAAc;IAEd,OAAO,CACL,qBAAqB,CAAC,KAAK,CAAC;QAC5B,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAC1D,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oCAAoC,CAElD,KAAc;IACd,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAExC,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QAC3B,uFAAuF;QACvF,OAAO,sBAAsB,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,6CAA6C,CAG3D,KAAc;IAEd,OAAO,CACL,qBAAqB,CAAC,KAAK,CAAC;QAC5B,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,oCAAoC,CAAC,CACjE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { BooleanFieldAppearance, BooleanFieldValidators, BooleanFieldValue, ColorFieldAppearance, ColorFieldValidators, ColorFieldValue, DateFieldAppearance, DateFieldValidators, DateFieldValue, DateTimeFieldAppearance, DateTimeFieldValidators, DateTimeFieldValue, FileFieldAppearance, FileFieldValidators, FloatFieldAppearance, FloatFieldValidators, FloatFieldValue, GalleryFieldAppearance, GalleryFieldValidators, IntegerFieldAppearance, IntegerFieldValidators, IntegerFieldValue, JsonFieldAppearance, JsonFieldValidators, JsonFieldValue, LatLonFieldAppearance, LatLonFieldValidators, LatLonFieldValue, LinkFieldAppearance, LinkFieldValidators, LinksFieldAppearance, LinksFieldValidators, RichTextFieldAppearance, RichTextFieldValidators, SeoFieldAppearance, SeoFieldValidators, SingleBlockFieldAppearance, SingleBlockFieldValidators, SlugFieldAppearance, SlugFieldValidators, StringFieldAppearance, StringFieldValidators, StringFieldValue, StructuredTextFieldAppearance, StructuredTextFieldValidators, TextFieldAppearance, TextFieldValidators, TextFieldValue, VideoFieldAppearance, VideoFieldValidators } from '..';
|
|
2
|
+
import type { FieldAttributesStableShell } from '../generated/RawApiTypes';
|
|
3
|
+
/**
|
|
4
|
+
* Enhanced appearance configuration with field-specific types and addon support
|
|
5
|
+
*/
|
|
6
|
+
type FieldAppearanceConfig<TAppearance> = TAppearance & Omit<FieldAttributesStableShell['appearance'], keyof TAppearance>;
|
|
7
|
+
/**
|
|
8
|
+
* Base field configuration for attributes (non-localized), extending the original RawApiTypes
|
|
9
|
+
*/
|
|
10
|
+
type NonLocalizedFieldAttributesForFieldType<SourceType, FieldType extends FieldAttributesStableShell['field_type'], FieldValue, FieldValidators, FieldAppearance> = Omit<SourceType, 'field_type' | 'default_value' | 'validators' | 'appearance' | 'localized'> & {
|
|
11
|
+
field_type: FieldType;
|
|
12
|
+
localized: false;
|
|
13
|
+
default_value: FieldValue;
|
|
14
|
+
validators: FieldValidators;
|
|
15
|
+
appearance: FieldAppearanceConfig<FieldAppearance>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Base field configuration for attributes (localized), extending the original RawApiTypes
|
|
19
|
+
*/
|
|
20
|
+
type LocalizedFieldAttributesForFieldType<SourceType, FieldType extends FieldAttributesStableShell['field_type'], FieldValue, FieldValidators, FieldAppearance> = Omit<SourceType, 'field_type' | 'default_value' | 'validators' | 'appearance' | 'localized'> & {
|
|
21
|
+
field_type: FieldType;
|
|
22
|
+
localized: true;
|
|
23
|
+
default_value: FieldValue | Record<string, FieldValue>;
|
|
24
|
+
validators: FieldValidators;
|
|
25
|
+
appearance: FieldAppearanceConfig<FieldAppearance>;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Union of localized and non-localized field configurations for attributes
|
|
29
|
+
*/
|
|
30
|
+
type FieldAttributesForFieldType<SourceType, FieldType extends FieldAttributesStableShell['field_type'], FieldValue, FieldValidators, FieldAppearance> = NonLocalizedFieldAttributesForFieldType<SourceType, FieldType, FieldValue, FieldValidators, FieldAppearance> | LocalizedFieldAttributesForFieldType<SourceType, FieldType, FieldValue, FieldValidators, FieldAppearance>;
|
|
31
|
+
export type GenericFieldAttributes<SourceType> = FieldAttributesForFieldType<SourceType, 'boolean', BooleanFieldValue, BooleanFieldValidators, BooleanFieldAppearance> | FieldAttributesForFieldType<SourceType, 'color', ColorFieldValue, ColorFieldValidators, ColorFieldAppearance> | FieldAttributesForFieldType<SourceType, 'date', DateFieldValue, DateFieldValidators, DateFieldAppearance> | FieldAttributesForFieldType<SourceType, 'date_time', DateTimeFieldValue, DateTimeFieldValidators, DateTimeFieldAppearance> | FieldAttributesForFieldType<SourceType, 'file', null, FileFieldValidators, FileFieldAppearance> | FieldAttributesForFieldType<SourceType, 'float', FloatFieldValue, FloatFieldValidators, FloatFieldAppearance> | FieldAttributesForFieldType<SourceType, 'gallery', null, GalleryFieldValidators, GalleryFieldAppearance> | FieldAttributesForFieldType<SourceType, 'integer', IntegerFieldValue, IntegerFieldValidators, IntegerFieldAppearance> | FieldAttributesForFieldType<SourceType, 'json', JsonFieldValue, JsonFieldValidators, JsonFieldAppearance> | FieldAttributesForFieldType<SourceType, 'lat_lon', LatLonFieldValue, LatLonFieldValidators, LatLonFieldAppearance> | FieldAttributesForFieldType<SourceType, 'link', null, LinkFieldValidators, LinkFieldAppearance> | FieldAttributesForFieldType<SourceType, 'links', null, LinksFieldValidators, LinksFieldAppearance> | FieldAttributesForFieldType<SourceType, 'rich_text', null, RichTextFieldValidators, RichTextFieldAppearance> | FieldAttributesForFieldType<SourceType, 'seo', null, SeoFieldValidators, SeoFieldAppearance> | FieldAttributesForFieldType<SourceType, 'single_block', null, SingleBlockFieldValidators, SingleBlockFieldAppearance> | FieldAttributesForFieldType<SourceType, 'slug', null, SlugFieldValidators, SlugFieldAppearance> | FieldAttributesForFieldType<SourceType, 'string', StringFieldValue, StringFieldValidators, StringFieldAppearance> | FieldAttributesForFieldType<SourceType, 'structured_text', null, StructuredTextFieldValidators, StructuredTextFieldAppearance> | FieldAttributesForFieldType<SourceType, 'text', TextFieldValue, TextFieldValidators, TextFieldAppearance> | FieldAttributesForFieldType<SourceType, 'video', null, VideoFieldValidators, VideoFieldAppearance>;
|
|
32
|
+
type LocalizedFieldCreateConfigForFieldType<SourceType, FieldType extends FieldAttributesStableShell['field_type'], FieldValue, FieldValidators, FieldAppearance> = Omit<SourceType, 'field_type' | 'default_value' | 'validators' | 'appearance' | 'localized'> & {
|
|
33
|
+
field_type: FieldType;
|
|
34
|
+
localized: true;
|
|
35
|
+
default_value?: Record<string, FieldValue>;
|
|
36
|
+
validators?: FieldValidators;
|
|
37
|
+
appearance?: FieldAppearanceConfig<FieldAppearance>;
|
|
38
|
+
};
|
|
39
|
+
type NonLocalizedFieldCreateConfigForFieldType<SourceType, FieldType extends FieldAttributesStableShell['field_type'], FieldValue, FieldValidators, FieldAppearance> = Omit<SourceType, 'field_type' | 'default_value' | 'validators' | 'appearance' | 'localized'> & {
|
|
40
|
+
field_type: FieldType;
|
|
41
|
+
localized?: false;
|
|
42
|
+
default_value?: FieldValue;
|
|
43
|
+
validators?: FieldValidators;
|
|
44
|
+
appearance?: FieldAppearanceConfig<FieldAppearance>;
|
|
45
|
+
};
|
|
46
|
+
type FieldCreateConfigForFieldType<SourceType, FieldType extends FieldAttributesStableShell['field_type'], FieldValue, FieldValidators, FieldAppearance> = LocalizedFieldCreateConfigForFieldType<SourceType, FieldType, FieldValue, FieldValidators, FieldAppearance> | NonLocalizedFieldCreateConfigForFieldType<SourceType, FieldType, FieldValue, FieldValidators, FieldAppearance>;
|
|
47
|
+
export type FieldCreateConfig<SourceType> = FieldCreateConfigForFieldType<SourceType, 'boolean', BooleanFieldValue, BooleanFieldValidators, BooleanFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'color', ColorFieldValue, ColorFieldValidators, ColorFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'date', DateFieldValue, DateFieldValidators, DateFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'date_time', DateTimeFieldValue, DateTimeFieldValidators, DateTimeFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'file', null, FileFieldValidators, FileFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'float', FloatFieldValue, FloatFieldValidators, FloatFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'gallery', null, GalleryFieldValidators, GalleryFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'integer', IntegerFieldValue, IntegerFieldValidators, IntegerFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'json', JsonFieldValue, JsonFieldValidators, JsonFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'lat_lon', LatLonFieldValue, LatLonFieldValidators, LatLonFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'link', null, LinkFieldValidators, LinkFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'links', null, LinksFieldValidators, LinksFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'rich_text', null, RichTextFieldValidators, RichTextFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'seo', null, SeoFieldValidators, SeoFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'single_block', null, SingleBlockFieldValidators, SingleBlockFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'slug', null, SlugFieldValidators, SlugFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'string', StringFieldValue, StringFieldValidators, StringFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'structured_text', null, StructuredTextFieldValidators, StructuredTextFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'text', TextFieldValue, TextFieldValidators, TextFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'video', null, VideoFieldValidators, VideoFieldAppearance>;
|
|
48
|
+
/**
|
|
49
|
+
* Helper type to conditionally handle default values based on localization for field updates
|
|
50
|
+
*/
|
|
51
|
+
type FieldUpdateDefaultValue<T> = T | Record<string, T> | undefined;
|
|
52
|
+
type FieldUpdateConfigForFieldType<SourceType, FieldType extends FieldAttributesStableShell['field_type'], FieldValue, FieldValidators, FieldAppearance> = Omit<SourceType, 'field_type' | 'default_value' | 'validators' | 'appearance'> & {
|
|
53
|
+
field_type?: FieldType;
|
|
54
|
+
default_value?: FieldUpdateDefaultValue<FieldValue>;
|
|
55
|
+
validators?: FieldValidators;
|
|
56
|
+
appearance?: FieldAppearanceConfig<FieldAppearance>;
|
|
57
|
+
};
|
|
58
|
+
export type FieldUpdateConfig<SourceType> = FieldUpdateConfigForFieldType<SourceType, 'boolean', BooleanFieldValue, BooleanFieldValidators, BooleanFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'color', ColorFieldValue, ColorFieldValidators, ColorFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'date', DateFieldValue, DateFieldValidators, DateFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'date_time', DateTimeFieldValue, DateTimeFieldValidators, DateTimeFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'file', null, FileFieldValidators, FileFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'float', FloatFieldValue, FloatFieldValidators, FloatFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'gallery', null, GalleryFieldValidators, GalleryFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'integer', IntegerFieldValue, IntegerFieldValidators, IntegerFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'json', JsonFieldValue, JsonFieldValidators, JsonFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'lat_lon', LatLonFieldValue, LatLonFieldValidators, LatLonFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'link', null, LinkFieldValidators, LinkFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'links', null, LinksFieldValidators, LinksFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'rich_text', null, RichTextFieldValidators, RichTextFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'seo', null, SeoFieldValidators, SeoFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'single_block', null, SingleBlockFieldValidators, SingleBlockFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'slug', null, SlugFieldValidators, SlugFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'string', StringFieldValue, StringFieldValidators, StringFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'structured_text', null, StructuredTextFieldValidators, StructuredTextFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'text', TextFieldValue, TextFieldValidators, TextFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'video', null, VideoFieldValidators, VideoFieldAppearance>;
|
|
59
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/fieldTypes/schema.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type LocalizedFieldValue } from '../utilities/normalizedFieldValues';
|
|
2
2
|
import type { SeoEditorConfiguration } from './appearance/seo';
|
|
3
3
|
import type { DescriptionLengthValidator } from './validators/description_length';
|
|
4
4
|
import type { FileSizeValidator } from './validators/file_size';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isLocalizedFieldValue, } from '../utilities/normalizedFieldValues';
|
|
1
2
|
export function isSeoFieldValue(value) {
|
|
2
3
|
if (value === null)
|
|
3
4
|
return true;
|
|
@@ -10,8 +11,6 @@ export function isSeoFieldValue(value) {
|
|
|
10
11
|
'no_index' in value));
|
|
11
12
|
}
|
|
12
13
|
export function isLocalizedSeoFieldValue(value) {
|
|
13
|
-
return (
|
|
14
|
-
value !== null &&
|
|
15
|
-
Object.values(value).every(isSeoFieldValue));
|
|
14
|
+
return (isLocalizedFieldValue(value) && Object.values(value).every(isSeoFieldValue));
|
|
16
15
|
}
|
|
17
16
|
//# sourceMappingURL=seo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seo.js","sourceRoot":"","sources":["../../../src/fieldTypes/seo.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"seo.js","sourceRoot":"","sources":["../../../src/fieldTypes/seo.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,qBAAqB,GACtB,MAAM,oCAAoC,CAAC;AAiB5C,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAChC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,CAAC,OAAO,IAAI,KAAK;YACf,aAAa,IAAI,KAAK;YACtB,OAAO,IAAI,KAAK;YAChB,cAAc,IAAI,KAAK;YACvB,UAAU,IAAI,KAAK,CAAC,CACvB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,KAAc;IAEd,OAAO,CACL,qBAAqB,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,CAC5E,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as RawApiTypes from '../generated/RawApiTypes';
|
|
2
|
-
import type {
|
|
3
|
-
import type
|
|
2
|
+
import type { ItemTypeDefinition, ToItemAttributesInRequest } from '../utilities/itemDefinition';
|
|
3
|
+
import { type LocalizedFieldValue } from '../utilities/normalizedFieldValues';
|
|
4
4
|
import type { FramedSingleBlockEditorConfiguration } from './appearance/framed_single_block';
|
|
5
5
|
import type { FramelessSingleBlockEditorConfiguration } from './appearance/frameless_single_block';
|
|
6
6
|
import type { RequiredValidator } from './validators/required';
|
|
@@ -46,11 +46,25 @@ export type SingleBlockFieldValue = string | null;
|
|
|
46
46
|
* - Omit ID for new blocks being created
|
|
47
47
|
*/
|
|
48
48
|
/** Represents an existing block in a CMA request */
|
|
49
|
-
export type
|
|
49
|
+
export type UnchangedBlockInRequest = RawApiTypes.ItemIdentity;
|
|
50
50
|
/** Represents a block we want to update in a CMA request */
|
|
51
|
-
export type
|
|
51
|
+
export type UpdatedBlockInRequest<D extends ItemTypeDefinition = ItemTypeDefinition> = {
|
|
52
|
+
__itemTypeId?: D['itemTypeId'];
|
|
53
|
+
type: RawApiTypes.ItemType1;
|
|
54
|
+
id: RawApiTypes.ItemIdentity;
|
|
55
|
+
relationships?: RawApiTypes.ItemRelationships<D>;
|
|
56
|
+
meta?: RawApiTypes.ItemMeta;
|
|
57
|
+
attributes: ToItemAttributesInRequest<D>;
|
|
58
|
+
};
|
|
52
59
|
/** Represents a new block to create in a CMA request */
|
|
53
|
-
export type
|
|
60
|
+
export type NewBlockInRequest<D extends ItemTypeDefinition = ItemTypeDefinition> = {
|
|
61
|
+
__itemTypeId?: D['itemTypeId'];
|
|
62
|
+
type: RawApiTypes.ItemType1;
|
|
63
|
+
id?: RawApiTypes.ItemIdentity;
|
|
64
|
+
relationships: RawApiTypes.ItemRelationships<D>;
|
|
65
|
+
meta?: RawApiTypes.ItemMeta;
|
|
66
|
+
attributes: ToItemAttributesInRequest<D>;
|
|
67
|
+
};
|
|
54
68
|
/**
|
|
55
69
|
* Union type representing the different ways a block can be specified in API requests:
|
|
56
70
|
* - string: Just the block ID (to keep existing blocks unchanged)
|
|
@@ -59,14 +73,15 @@ export type NewBlockInARequest<D extends ItemDefinition = ItemDefinition> = D ex
|
|
|
59
73
|
*
|
|
60
74
|
* Also, 'meta' can always be omitted
|
|
61
75
|
*/
|
|
62
|
-
export type
|
|
76
|
+
export type BlockInRequest<D extends ItemTypeDefinition = ItemTypeDefinition> = UnchangedBlockInRequest | UpdatedBlockInRequest<D> | NewBlockInRequest<D>;
|
|
77
|
+
export type BlockInNestedResponse<D extends ItemTypeDefinition = ItemTypeDefinition> = D extends unknown ? RawApiTypes.ItemInNestedResponse<D> : never;
|
|
63
78
|
/**
|
|
64
79
|
* Single Block field value for API requests - allows flexible block representations:
|
|
65
80
|
* - string: Just the block ID (to keep existing blocks unchanged)
|
|
66
81
|
* - Full block object with ID (to update an existing block)
|
|
67
82
|
* - Block object without ID (to create a new block)
|
|
68
83
|
*/
|
|
69
|
-
export type
|
|
84
|
+
export type SingleBlockFieldValueInRequest<D extends ItemTypeDefinition = ItemTypeDefinition> = BlockInRequest<D> | null;
|
|
70
85
|
/**
|
|
71
86
|
* =============================================================================
|
|
72
87
|
* NESTED VARIANT - Type for API responses with ?nested=true parameter
|
|
@@ -79,7 +94,7 @@ export type SingleBlockFieldValueAsRequest<D extends ItemDefinition = ItemDefini
|
|
|
79
94
|
/**
|
|
80
95
|
* Single Block field value with nested block - fully populated block object
|
|
81
96
|
*/
|
|
82
|
-
export type
|
|
97
|
+
export type SingleBlockFieldValueInNestedResponse<D extends ItemTypeDefinition = ItemTypeDefinition> = BlockInNestedResponse<D> | null;
|
|
83
98
|
/**
|
|
84
99
|
* =============================================================================
|
|
85
100
|
* SHARED UTILITY FUNCTIONS
|
|
@@ -90,16 +105,16 @@ export type SingleBlockFieldValueWithNestedBlocks<D extends ItemDefinition = Ite
|
|
|
90
105
|
* Validates if the input is a valid item (either block or record) ID
|
|
91
106
|
*/
|
|
92
107
|
export declare function isItemId(input: unknown): input is string;
|
|
93
|
-
export type ItemWithOptionalIdAndMeta<D extends
|
|
108
|
+
export type ItemWithOptionalIdAndMeta<D extends ItemTypeDefinition = ItemTypeDefinition> = D extends any ? OptionalFields<RawApiTypes.Item<D>, 'id' | 'meta'> : never;
|
|
94
109
|
/**
|
|
95
110
|
* Validates if the input is a RawApiTypes.Item object (with optional `id` and `meta`)
|
|
96
111
|
*/
|
|
97
|
-
export declare function isItemWithOptionalIdAndMeta<D extends
|
|
98
|
-
export type ItemWithOptionalMeta<D extends
|
|
112
|
+
export declare function isItemWithOptionalIdAndMeta<D extends ItemTypeDefinition = ItemTypeDefinition>(block: unknown): block is ItemWithOptionalIdAndMeta<D>;
|
|
113
|
+
export type ItemWithOptionalMeta<D extends ItemTypeDefinition = ItemTypeDefinition> = D extends any ? OptionalFields<RawApiTypes.Item<D>, 'meta'> : never;
|
|
99
114
|
/**
|
|
100
115
|
* Validates if the input is a a complete RawApiTypes.Item object with optional `meta`
|
|
101
116
|
*/
|
|
102
|
-
export declare function isItemWithOptionalMeta<D extends
|
|
117
|
+
export declare function isItemWithOptionalMeta<D extends ItemTypeDefinition = ItemTypeDefinition>(block: unknown): block is ItemWithOptionalMeta<D>;
|
|
103
118
|
/**
|
|
104
119
|
* =============================================================================
|
|
105
120
|
* TYPE GUARDS - Runtime validation functions
|
|
@@ -115,14 +130,14 @@ export declare function isLocalizedSingleBlockFieldValue(value: unknown): value
|
|
|
115
130
|
* Type guard for Single Block field values in API request format.
|
|
116
131
|
* Allows block as string ID, full object with ID, or object without ID.
|
|
117
132
|
*/
|
|
118
|
-
export declare function
|
|
119
|
-
export declare function
|
|
133
|
+
export declare function isSingleBlockFieldValueInRequest<D extends ItemTypeDefinition = ItemTypeDefinition>(value: unknown): value is SingleBlockFieldValueInRequest<D>;
|
|
134
|
+
export declare function isLocalizedSingleBlockFieldValueInRequest<D extends ItemTypeDefinition = ItemTypeDefinition>(value: unknown): value is LocalizedFieldValue<SingleBlockFieldValueInRequest<D>>;
|
|
120
135
|
/**
|
|
121
136
|
* Type guard for Single Block field values with nested blocks (?nested=true format).
|
|
122
137
|
* Ensures block is a full RawApiTypes.Item object with complete data.
|
|
123
138
|
*/
|
|
124
|
-
export declare function
|
|
125
|
-
export declare function
|
|
139
|
+
export declare function isSingleBlockFieldValueInNestedResponse<D extends ItemTypeDefinition = ItemTypeDefinition>(value: unknown): value is SingleBlockFieldValueInNestedResponse<D>;
|
|
140
|
+
export declare function isLocalizedSingleBlockFieldValueInNestedResponse<D extends ItemTypeDefinition = ItemTypeDefinition>(value: unknown): value is LocalizedFieldValue<SingleBlockFieldValueInNestedResponse<D>>;
|
|
126
141
|
export type SingleBlockFieldValidators = {
|
|
127
142
|
/** Only accept references to block records of the specified block models */
|
|
128
143
|
single_block_blocks: SingleBlockBlocksValidator;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { isValidId } from '../utilities/id';
|
|
2
|
+
import { isLocalizedFieldValue, } from '../utilities/normalizedFieldValues';
|
|
1
3
|
/**
|
|
2
4
|
* =============================================================================
|
|
3
5
|
* SHARED UTILITY FUNCTIONS
|
|
@@ -17,7 +19,9 @@ export function isItemWithOptionalIdAndMeta(block) {
|
|
|
17
19
|
return (typeof block === 'object' &&
|
|
18
20
|
block !== null &&
|
|
19
21
|
'type' in block &&
|
|
20
|
-
'
|
|
22
|
+
block.type === 'item' &&
|
|
23
|
+
'attributes' in block &&
|
|
24
|
+
'relationships' in block);
|
|
21
25
|
}
|
|
22
26
|
/**
|
|
23
27
|
* Validates if the input is a a complete RawApiTypes.Item object with optional `meta`
|
|
@@ -37,18 +41,17 @@ export function isItemWithOptionalMeta(block) {
|
|
|
37
41
|
* Checks for string structure and ensures block is a string reference.
|
|
38
42
|
*/
|
|
39
43
|
export function isSingleBlockFieldValue(value) {
|
|
40
|
-
return typeof value === 'string' || value === null;
|
|
44
|
+
return (typeof value === 'string' && isValidId(value)) || value === null;
|
|
41
45
|
}
|
|
42
46
|
export function isLocalizedSingleBlockFieldValue(value) {
|
|
43
|
-
return (
|
|
44
|
-
value !== null &&
|
|
47
|
+
return (isLocalizedFieldValue(value) &&
|
|
45
48
|
Object.values(value).every(isSingleBlockFieldValue));
|
|
46
49
|
}
|
|
47
50
|
/**
|
|
48
51
|
* Type guard for Single Block field values in API request format.
|
|
49
52
|
* Allows block as string ID, full object with ID, or object without ID.
|
|
50
53
|
*/
|
|
51
|
-
export function
|
|
54
|
+
export function isSingleBlockFieldValueInRequest(value) {
|
|
52
55
|
if (value === null)
|
|
53
56
|
return true;
|
|
54
57
|
// String ID - referencing existing block
|
|
@@ -57,24 +60,22 @@ export function isSingleBlockFieldValueAsRequest(value) {
|
|
|
57
60
|
// Object (either with or without ID for updates/creation)
|
|
58
61
|
return isItemWithOptionalIdAndMeta(value);
|
|
59
62
|
}
|
|
60
|
-
export function
|
|
61
|
-
return (
|
|
62
|
-
value
|
|
63
|
-
Object.values(value).every(isSingleBlockFieldValueAsRequest));
|
|
63
|
+
export function isLocalizedSingleBlockFieldValueInRequest(value) {
|
|
64
|
+
return (isLocalizedFieldValue(value) &&
|
|
65
|
+
Object.values(value).every(isSingleBlockFieldValueInRequest));
|
|
64
66
|
}
|
|
65
67
|
/**
|
|
66
68
|
* Type guard for Single Block field values with nested blocks (?nested=true format).
|
|
67
69
|
* Ensures block is a full RawApiTypes.Item object with complete data.
|
|
68
70
|
*/
|
|
69
|
-
export function
|
|
71
|
+
export function isSingleBlockFieldValueInNestedResponse(value) {
|
|
70
72
|
if (value === null)
|
|
71
73
|
return true;
|
|
72
74
|
// Must be a full object with ID (nested format always includes complete block objects)
|
|
73
75
|
return isItemWithOptionalMeta(value);
|
|
74
76
|
}
|
|
75
|
-
export function
|
|
76
|
-
return (
|
|
77
|
-
value
|
|
78
|
-
Object.values(value).every(isSingleBlockFieldValueWithNestedBlocks));
|
|
77
|
+
export function isLocalizedSingleBlockFieldValueInNestedResponse(value) {
|
|
78
|
+
return (isLocalizedFieldValue(value) &&
|
|
79
|
+
Object.values(value).every(isSingleBlockFieldValueInNestedResponse));
|
|
79
80
|
}
|
|
80
81
|
//# sourceMappingURL=single_block.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"single_block.js","sourceRoot":"","sources":["../../../src/fieldTypes/single_block.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"single_block.js","sourceRoot":"","sources":["../../../src/fieldTypes/single_block.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAK5C,OAAO,EAEL,qBAAqB,GACtB,MAAM,oCAAoC,CAAC;AA0H5C;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;AACnC,CAAC;AAMD;;GAEG;AACH,MAAM,UAAU,2BAA2B,CAEzC,KAAc;IACd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,IAAI,KAAK;QACf,KAAK,CAAC,IAAI,KAAK,MAAM;QACrB,YAAY,IAAI,KAAK;QACrB,eAAe,IAAI,KAAK,CACzB,CAAC;AACJ,CAAC;AAMD;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAEpC,KAAc;IACd,OAAO,CACL,2BAA2B,CAAC,KAAK,CAAC;QAClC,IAAI,IAAI,KAAK;QACb,OAAO,KAAK,CAAC,EAAE,KAAK,QAAQ,CAC7B,CAAC;AACJ,CAAC;AAED;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CACrC,KAAc;IAEd,OAAO,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,KAAK,IAAI,CAAC;AAC3E,CAAC;AAED,MAAM,UAAU,gCAAgC,CAC9C,KAAc;IAEd,OAAO,CACL,qBAAqB,CAAC,KAAK,CAAC;QAC5B,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,uBAAuB,CAAC,CACpD,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gCAAgC,CAE9C,KAAc;IACd,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEhC,yCAAyC;IACzC,IAAI,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAEjC,0DAA0D;IAC1D,OAAO,2BAA2B,CAAC,KAAK,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,yCAAyC,CAGvD,KAAc;IAEd,OAAO,CACL,qBAAqB,CAAC,KAAK,CAAC;QAC5B,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAC7D,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,uCAAuC,CAErD,KAAc;IACd,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEhC,uFAAuF;IACvF,OAAO,sBAAsB,CAAC,KAAK,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,gDAAgD,CAG9D,KAAc;IAEd,OAAO,CACL,qBAAqB,CAAC,KAAK,CAAC;QAC5B,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,uCAAuC,CAAC,CACpE,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type LocalizedFieldValue } from '../utilities/normalizedFieldValues';
|
|
2
2
|
import type { SlugEditorConfiguration } from './appearance/slug';
|
|
3
3
|
import type { LengthValidator } from './validators/length';
|
|
4
4
|
import type { RequiredValidator } from './validators/required';
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
+
import { isLocalizedFieldValue, } from '../utilities/normalizedFieldValues';
|
|
1
2
|
export function isSlugFieldValue(value) {
|
|
2
3
|
if (value === null)
|
|
3
4
|
return true;
|
|
4
5
|
return typeof value === 'string';
|
|
5
6
|
}
|
|
6
7
|
export function isLocalizedSlugFieldValue(value) {
|
|
7
|
-
return (
|
|
8
|
-
value !== null &&
|
|
9
|
-
Object.values(value).every(isSlugFieldValue));
|
|
8
|
+
return (isLocalizedFieldValue(value) && Object.values(value).every(isSlugFieldValue));
|
|
10
9
|
}
|
|
11
10
|
//# sourceMappingURL=slug.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slug.js","sourceRoot":"","sources":["../../../src/fieldTypes/slug.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"slug.js","sourceRoot":"","sources":["../../../src/fieldTypes/slug.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,qBAAqB,GACtB,MAAM,oCAAoC,CAAC;AAS5C,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAChC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,KAAc;IAEd,OAAO,CACL,qBAAqB,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAC7E,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type LocalizedFieldValue } from '../utilities/normalizedFieldValues';
|
|
2
2
|
import type { SingleLineEditorConfiguration } from './appearance/single_line';
|
|
3
3
|
import type { StringRadioGroupEditorConfiguration } from './appearance/string_radio_group';
|
|
4
4
|
import type { StringSelectEditorConfiguration } from './appearance/string_select';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { isLocalizedFieldValue, } from '../utilities/normalizedFieldValues';
|
|
1
2
|
export function isStringFieldValue(value) {
|
|
2
3
|
return typeof value === 'string' || value === null;
|
|
3
4
|
}
|
|
4
5
|
export function isLocalizedStringFieldValue(value) {
|
|
5
|
-
return (
|
|
6
|
-
value !== null &&
|
|
6
|
+
return (isLocalizedFieldValue(value) &&
|
|
7
7
|
Object.values(value).every(isStringFieldValue));
|
|
8
8
|
}
|
|
9
9
|
//# sourceMappingURL=string.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.js","sourceRoot":"","sources":["../../../src/fieldTypes/string.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"string.js","sourceRoot":"","sources":["../../../src/fieldTypes/string.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,qBAAqB,GACtB,MAAM,oCAAoC,CAAC;AAY5C,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,2BAA2B,CACzC,KAAc;IAEd,OAAO,CACL,qBAAqB,CAAC,KAAK,CAAC;QAC5B,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAC/C,CAAC;AACJ,CAAC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { type Block, type Document, type InlineBlock } from 'datocms-structured-text-utils';
|
|
2
|
-
import type
|
|
3
|
-
import type
|
|
4
|
-
import type { ItemDefinition } from '../utilities/itemDefinition';
|
|
2
|
+
import type { ItemTypeDefinition } from '../utilities/itemDefinition';
|
|
3
|
+
import { type LocalizedFieldValue } from '../utilities/normalizedFieldValues';
|
|
5
4
|
import type { StructuredTextEditorConfiguration } from './appearance/structured_text';
|
|
6
|
-
import { type
|
|
5
|
+
import { type BlockInNestedResponse, type BlockInRequest } from './single_block';
|
|
7
6
|
import type { LengthValidator } from './validators/length';
|
|
8
7
|
import type { StructuredTextBlocksValidator } from './validators/structured_text_blocks';
|
|
9
8
|
import type { StructuredTextInlineBlocksValidator } from './validators/structured_text_inline_blocks';
|
|
@@ -40,15 +39,15 @@ import type { StructuredTextLinksValidator } from './validators/structured_text_
|
|
|
40
39
|
/**
|
|
41
40
|
* Variant of 'block' structured text node for API requests
|
|
42
41
|
*/
|
|
43
|
-
export type
|
|
42
|
+
export type BlockNodeInRequest<D extends ItemTypeDefinition = ItemTypeDefinition> = Block<BlockInRequest<D>>;
|
|
44
43
|
/**
|
|
45
44
|
* Variant of 'inlineBlock' structured text node for API requests
|
|
46
45
|
*/
|
|
47
|
-
export type
|
|
46
|
+
export type InlineBlockNodeInRequest<D extends ItemTypeDefinition = ItemTypeDefinition> = InlineBlock<BlockInRequest<D>>;
|
|
48
47
|
/**
|
|
49
48
|
* Variant of Structured Text document for API requests
|
|
50
49
|
*/
|
|
51
|
-
export type
|
|
50
|
+
export type DocumentInRequest<BlockItemTypeDefinition extends ItemTypeDefinition = ItemTypeDefinition, InlineBlockItemTypeDefinition extends ItemTypeDefinition = ItemTypeDefinition> = Document<BlockInRequest<BlockItemTypeDefinition>, BlockInRequest<InlineBlockItemTypeDefinition>>;
|
|
52
51
|
/**
|
|
53
52
|
* =============================================================================
|
|
54
53
|
* NESTED VARIANTS - Types for API responses with ?nested=true parameter
|
|
@@ -61,15 +60,15 @@ export type DocumentAsRequest<BlockItemDefinition extends ItemDefinition = ItemD
|
|
|
61
60
|
/**
|
|
62
61
|
* Variant of 'block' structured text node for ?nested=true API responses
|
|
63
62
|
*/
|
|
64
|
-
export type
|
|
63
|
+
export type BlockNodeInNestedResponse<D extends ItemTypeDefinition = ItemTypeDefinition> = Block<BlockInNestedResponse<D>>;
|
|
65
64
|
/**
|
|
66
65
|
* Variant of 'inlineBlock' structured text node for ?nested=true API responses
|
|
67
66
|
*/
|
|
68
|
-
export type
|
|
67
|
+
export type InlineBlockNodeInNestedResponse<D extends ItemTypeDefinition = ItemTypeDefinition> = InlineBlock<BlockInNestedResponse<D>>;
|
|
69
68
|
/**
|
|
70
69
|
* Variant of Structured Text document for ?nested=true API responses
|
|
71
70
|
*/
|
|
72
|
-
export type
|
|
71
|
+
export type DocumentInNestedResponse<BlockItemTypeDefinition extends ItemTypeDefinition = ItemTypeDefinition, InlineBlockItemTypeDefinition extends ItemTypeDefinition = ItemTypeDefinition> = Document<BlockInNestedResponse<BlockItemTypeDefinition>, BlockInNestedResponse<InlineBlockItemTypeDefinition>>;
|
|
73
72
|
/**
|
|
74
73
|
* =============================================================================
|
|
75
74
|
* MAIN APPLICATION TYPES
|
|
@@ -80,8 +79,8 @@ export type DocumentWithNestedBlocks<BlockItemDefinition extends ItemDefinition
|
|
|
80
79
|
* Can be null (empty field) or a document with blocks as string IDs
|
|
81
80
|
*/
|
|
82
81
|
export type StructuredTextFieldValue = Document | null;
|
|
83
|
-
export type
|
|
84
|
-
export type
|
|
82
|
+
export type StructuredTextFieldValueInRequest<BlockItemTypeDefinition extends ItemTypeDefinition = ItemTypeDefinition, InlineBlockItemTypeDefinition extends ItemTypeDefinition = ItemTypeDefinition> = DocumentInRequest<BlockItemTypeDefinition, InlineBlockItemTypeDefinition> | null;
|
|
83
|
+
export type StructuredTextFieldValueInNestedResponse<BlockItemTypeDefinition extends ItemTypeDefinition = ItemTypeDefinition, InlineBlockItemTypeDefinition extends ItemTypeDefinition = ItemTypeDefinition> = DocumentInNestedResponse<BlockItemTypeDefinition, InlineBlockItemTypeDefinition> | null;
|
|
85
84
|
/**
|
|
86
85
|
* Type guard for basic structured text field values (blocks as string IDs only).
|
|
87
86
|
* Checks for the expected structure and ensures all block/inlineBlock nodes have string IDs.
|
|
@@ -92,14 +91,14 @@ export declare function isLocalizedStructuredTextFieldValue(value: unknown): val
|
|
|
92
91
|
* Type guard for structured text field values in API request format.
|
|
93
92
|
* Allows blocks as string IDs, full objects with IDs, or objects without IDs.
|
|
94
93
|
*/
|
|
95
|
-
export declare function
|
|
96
|
-
export declare function
|
|
94
|
+
export declare function isStructuredTextFieldValueInRequest<BlockItemTypeDefinition extends ItemTypeDefinition = ItemTypeDefinition, InlineBlockItemTypeDefinition extends ItemTypeDefinition = ItemTypeDefinition>(value: unknown): value is StructuredTextFieldValueInRequest<BlockItemTypeDefinition, InlineBlockItemTypeDefinition>;
|
|
95
|
+
export declare function isLocalizedStructuredTextFieldValueInRequest<D extends ItemTypeDefinition = ItemTypeDefinition>(value: unknown): value is LocalizedFieldValue<StructuredTextFieldValueInRequest<D>>;
|
|
97
96
|
/**
|
|
98
97
|
* Type guard for structured text field values with nested blocks (?nested=true format).
|
|
99
98
|
* Ensures all block/inlineBlock nodes have full RawApiTypes.Item objects.
|
|
100
99
|
*/
|
|
101
|
-
export declare function
|
|
102
|
-
export declare function
|
|
100
|
+
export declare function isStructuredTextFieldValueInNestedResponse<D extends ItemTypeDefinition = ItemTypeDefinition>(value: unknown): value is StructuredTextFieldValueInNestedResponse<D>;
|
|
101
|
+
export declare function isLocalizedStructuredTextFieldValueInNestedResponse<D extends ItemTypeDefinition = ItemTypeDefinition>(value: unknown): value is LocalizedFieldValue<StructuredTextFieldValueInNestedResponse<D>>;
|
|
103
102
|
export type StructuredTextFieldValidators = {
|
|
104
103
|
/** Only accept references to block records of the specified block models */
|
|
105
104
|
structured_text_blocks: StructuredTextBlocksValidator;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { everyNode, isBlock, isDocument, isInlineBlock, } from 'datocms-structured-text-utils';
|
|
2
|
+
import { isValidId } from '../utilities/id';
|
|
3
|
+
import { isLocalizedFieldValue, } from '../utilities/normalizedFieldValues';
|
|
2
4
|
import { isItemId, isItemWithOptionalIdAndMeta, isItemWithOptionalMeta, } from './single_block';
|
|
3
5
|
/**
|
|
4
6
|
* Utility function to validate all block/inlineBlock nodes in a structured text document tree.
|
|
@@ -26,19 +28,18 @@ export function isStructuredTextFieldValue(value) {
|
|
|
26
28
|
}
|
|
27
29
|
// Check that all block/inlineBlock nodes have string item IDs
|
|
28
30
|
return validateAllBlockNodes(value.document, (node) => {
|
|
29
|
-
return typeof node.item === 'string';
|
|
31
|
+
return typeof node.item === 'string' && isValidId(node.item);
|
|
30
32
|
});
|
|
31
33
|
}
|
|
32
34
|
export function isLocalizedStructuredTextFieldValue(value) {
|
|
33
|
-
return (
|
|
34
|
-
value !== null &&
|
|
35
|
+
return (isLocalizedFieldValue(value) &&
|
|
35
36
|
Object.values(value).every(isStructuredTextFieldValue));
|
|
36
37
|
}
|
|
37
38
|
/**
|
|
38
39
|
* Type guard for structured text field values in API request format.
|
|
39
40
|
* Allows blocks as string IDs, full objects with IDs, or objects without IDs.
|
|
40
41
|
*/
|
|
41
|
-
export function
|
|
42
|
+
export function isStructuredTextFieldValueInRequest(value) {
|
|
42
43
|
if (value === null)
|
|
43
44
|
return true;
|
|
44
45
|
if (!isDocument(value)) {
|
|
@@ -54,16 +55,15 @@ export function isStructuredTextFieldValueAsRequest(value) {
|
|
|
54
55
|
return isItemWithOptionalIdAndMeta(item);
|
|
55
56
|
});
|
|
56
57
|
}
|
|
57
|
-
export function
|
|
58
|
-
return (
|
|
59
|
-
value
|
|
60
|
-
Object.values(value).every(isStructuredTextFieldValueAsRequest));
|
|
58
|
+
export function isLocalizedStructuredTextFieldValueInRequest(value) {
|
|
59
|
+
return (isLocalizedFieldValue(value) &&
|
|
60
|
+
Object.values(value).every(isStructuredTextFieldValueInRequest));
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
63
|
* Type guard for structured text field values with nested blocks (?nested=true format).
|
|
64
64
|
* Ensures all block/inlineBlock nodes have full RawApiTypes.Item objects.
|
|
65
65
|
*/
|
|
66
|
-
export function
|
|
66
|
+
export function isStructuredTextFieldValueInNestedResponse(value) {
|
|
67
67
|
if (value === null)
|
|
68
68
|
return true;
|
|
69
69
|
if (!isDocument(value)) {
|
|
@@ -76,9 +76,8 @@ export function isStructuredTextFieldValueWithNestedBlocks(value) {
|
|
|
76
76
|
return isItemWithOptionalMeta(item);
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
|
-
export function
|
|
80
|
-
return (
|
|
81
|
-
value
|
|
82
|
-
Object.values(value).every(isStructuredTextFieldValueWithNestedBlocks));
|
|
79
|
+
export function isLocalizedStructuredTextFieldValueInNestedResponse(value) {
|
|
80
|
+
return (isLocalizedFieldValue(value) &&
|
|
81
|
+
Object.values(value).every(isStructuredTextFieldValueInNestedResponse));
|
|
83
82
|
}
|
|
84
83
|
//# sourceMappingURL=structured_text.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"structured_text.js","sourceRoot":"","sources":["../../../src/fieldTypes/structured_text.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,SAAS,EACT,OAAO,EACP,UAAU,EACV,aAAa,GACd,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"structured_text.js","sourceRoot":"","sources":["../../../src/fieldTypes/structured_text.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,SAAS,EACT,OAAO,EACP,UAAU,EACV,aAAa,GACd,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAEL,qBAAqB,GACtB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAGL,QAAQ,EACR,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AA2HxB;;;GAGG;AACH,SAAS,qBAAqB,CAC5B,IAAgB,EAChB,QAAsD;IAEtD,OAAO,SAAS,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE;QACrC,wEAAwE;QACxE,IAAI,OAAO,CAAC,WAAW,CAAC,IAAI,aAAa,CAAC,WAAW,CAAC,EAAE;YACtD,OAAO,QAAQ,CAAC,WAAW,CAAC,CAAC;SAC9B;QACD,qDAAqD;QACrD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CACxC,KAAc;IAEd,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEhC,IAAI,CAAC,UAAU,CAAmB,KAAK,CAAC,EAAE;QACxC,OAAO,KAAK,CAAC;KACd;IAED,8DAA8D;IAC9D,OAAO,qBAAqB,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;QACpD,OAAO,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,mCAAmC,CACjD,KAAc;IAEd,OAAO,CACL,qBAAqB,CAAC,KAAK,CAAC;QAC5B,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,0BAA0B,CAAC,CACvD,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mCAAmC,CAIjD,KAAc;IAKd,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEhC,IAAI,CAAC,UAAU,CAAU,KAAK,CAAC,EAAE;QAC/B,OAAO,KAAK,CAAC;KACd;IAED,yEAAyE;IACzE,OAAO,qBAAqB,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;QACpD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAEvB,YAAY;QACZ,IAAI,QAAQ,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QAEhC,qCAAqC;QACrC,OAAO,2BAA2B,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,4CAA4C,CAG1D,KAAc;IAEd,OAAO,CACL,qBAAqB,CAAC,KAAK,CAAC;QAC5B,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAChE,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,0CAA0C,CAExD,KAAc;IACd,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEhC,IAAI,CAAC,UAAU,CAAU,KAAK,CAAC,EAAE;QAC/B,OAAO,KAAK,CAAC;KACd;IAED,gEAAgE;IAChE,OAAO,qBAAqB,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;QACpD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAEvB,2EAA2E;QAC3E,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,mDAAmD,CAGjE,KAAc;IAEd,OAAO,CACL,qBAAqB,CAAC,KAAK,CAAC;QAC5B,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,0CAA0C,CAAC,CACvE,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type LocalizedFieldValue } from '../utilities/normalizedFieldValues';
|
|
2
2
|
import type { MarkdownEditorConfiguration } from './appearance/markdown';
|
|
3
3
|
import type { TextareaEditorConfiguration } from './appearance/textarea';
|
|
4
4
|
import type { WysiwygEditorConfiguration } from './appearance/wysiwyg';
|