@datocms/cma-client 5.1.9 → 5.1.11
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 +575 -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 +4 -6
- package/dist/cjs/fieldTypes/rich_text.js.map +1 -1
- package/dist/cjs/fieldTypes/seo.js +2 -3
- package/dist/cjs/fieldTypes/seo.js.map +1 -1
- package/dist/cjs/fieldTypes/single_block.js +7 -7
- 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 +4 -6
- 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/Client.js.map +1 -1
- package/dist/cjs/generated/resources/Item.js.map +1 -1
- package/dist/cjs/generated/resources/Upload.js.map +1 -1
- package/dist/cjs/index.js +4 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/utilities/buildBlockRecord.js +8 -7
- package/dist/cjs/utilities/buildBlockRecord.js.map +1 -1
- package/dist/cjs/utilities/inspectItem.js +397 -0
- package/dist/cjs/utilities/inspectItem.js.map +1 -0
- package/dist/cjs/utilities/{blocks.js → nonRecursiveBlocks.js} +106 -111
- 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 +121 -80
- 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 +1 -1
- package/dist/esm/fieldTypes/rich_text.js +4 -6
- package/dist/esm/fieldTypes/rich_text.js.map +1 -1
- 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 +3 -3
- package/dist/esm/fieldTypes/single_block.js +7 -7
- 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 +1 -1
- package/dist/esm/fieldTypes/structured_text.js +4 -6
- 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/Client.js +1 -1
- package/dist/esm/generated/Client.js.map +1 -1
- package/dist/esm/generated/resources/Item.d.ts +46 -28
- package/dist/esm/generated/resources/Item.js.map +1 -1
- package/dist/esm/generated/resources/ScheduledPublication.d.ts +3 -3
- package/dist/esm/generated/resources/ScheduledUnpublishing.d.ts +3 -3
- package/dist/esm/generated/resources/Upload.d.ts +10 -4
- package/dist/esm/generated/resources/Upload.js.map +1 -1
- package/dist/esm/index.d.ts +4 -4
- package/dist/esm/index.js +4 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utilities/buildBlockRecord.d.ts +3 -3
- package/dist/esm/utilities/buildBlockRecord.js +9 -8
- package/dist/esm/utilities/buildBlockRecord.js.map +1 -1
- package/dist/esm/utilities/inspectItem.d.ts +8 -0
- package/dist/esm/utilities/inspectItem.js +393 -0
- package/dist/esm/utilities/inspectItem.js.map +1 -0
- package/dist/esm/utilities/itemDefinition.d.ts +36 -12
- package/dist/esm/utilities/nonRecursiveBlocks.d.ts +179 -0
- package/dist/esm/utilities/{blocks.js → nonRecursiveBlocks.js} +91 -96
- 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 +92 -9
- package/dist/esm/utilities/recursiveBlocks.js +113 -72
- 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 +1 -1
- package/dist/types/fieldTypes/seo.d.ts +1 -1
- package/dist/types/fieldTypes/single_block.d.ts +3 -3
- 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 +1 -1
- package/dist/types/fieldTypes/text.d.ts +1 -1
- package/dist/types/fieldTypes/video.d.ts +1 -1
- package/dist/types/generated/resources/Item.d.ts +46 -28
- 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 +10 -4
- package/dist/types/index.d.ts +4 -4
- package/dist/types/utilities/buildBlockRecord.d.ts +3 -3
- package/dist/types/utilities/inspectItem.d.ts +8 -0
- package/dist/types/utilities/itemDefinition.d.ts +36 -12
- package/dist/types/utilities/nonRecursiveBlocks.d.ts +179 -0
- package/dist/{esm/utilities/fieldValue.d.ts → types/utilities/normalizedFieldValues.d.ts} +15 -14
- package/dist/types/utilities/recursiveBlocks.d.ts +92 -9
- 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 +7 -7
- package/src/fieldTypes/seo.ts +5 -4
- package/src/fieldTypes/single_block.ts +12 -10
- package/src/fieldTypes/slug.ts +5 -4
- package/src/fieldTypes/string.ts +5 -3
- package/src/fieldTypes/structured_text.ts +7 -7
- package/src/fieldTypes/text.ts +5 -4
- package/src/fieldTypes/video.ts +5 -3
- package/src/generated/Client.ts +1 -1
- package/src/generated/resources/Item.ts +129 -92
- package/src/generated/resources/ScheduledPublication.ts +6 -6
- package/src/generated/resources/ScheduledUnpublishing.ts +6 -6
- package/src/generated/resources/Upload.ts +36 -10
- package/src/index.ts +4 -4
- package/src/utilities/buildBlockRecord.ts +24 -31
- package/src/utilities/inspectItem.ts +590 -0
- package/src/utilities/itemDefinition.ts +53 -35
- package/src/utilities/{blocks.ts → nonRecursiveBlocks.ts} +170 -136
- package/src/utilities/{fieldValue.ts → normalizedFieldValues.ts} +70 -30
- package/src/utilities/recursiveBlocks.ts +186 -171
- 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
|
@@ -51,15 +51,15 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
|
51
51
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
52
52
|
};
|
|
53
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
-
exports.
|
|
54
|
+
exports.nonRecursiveEveryBlockInNonLocalizedFieldValueAsync = exports.nonRecursiveEveryBlockInNonLocalizedFieldValue = exports.nonRecursiveSomeBlocksInNonLocalizedFieldValueAsync = exports.nonRecursiveSomeBlocksInNonLocalizedFieldValue = exports.nonRecursiveReduceBlocksInNonLocalizedFieldValueAsync = exports.nonRecursiveReduceBlocksInNonLocalizedFieldValue = exports.nonRecursiveFilterBlocksInNonLocalizedFieldValueAsync = exports.nonRecursiveFilterBlocksInNonLocalizedFieldValue = exports.nonRecursiveFindAllBlocksInNonLocalizedFieldValueAsync = exports.nonRecursiveFindAllBlocksInNonLocalizedFieldValue = exports.nonRecursiveMapBlocksInNonLocalizedFieldValueAsync = exports.nonRecursiveMapBlocksInNonLocalizedFieldValue = exports.nonRecursiveVisitBlocksInNonLocalizedFieldValueAsync = exports.nonRecursiveVisitBlocksInNonLocalizedFieldValue = void 0;
|
|
55
55
|
const datocms_structured_text_utils_1 = require("datocms-structured-text-utils");
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
const normalizedFieldValues_1 = require("./normalizedFieldValues");
|
|
57
|
+
function* iterateBlocks(fieldType, nonLocalizedFieldValue) {
|
|
58
|
+
if ((0, normalizedFieldValues_1.isLocalizedFieldValue)(nonLocalizedFieldValue)) {
|
|
59
|
+
throw new Error('A non-localized field value is required!');
|
|
60
|
+
}
|
|
61
61
|
if (fieldType === 'rich_text') {
|
|
62
|
-
const richTextValue =
|
|
62
|
+
const richTextValue = nonLocalizedFieldValue;
|
|
63
63
|
if (richTextValue) {
|
|
64
64
|
for (let index = 0; index < richTextValue.length; index++) {
|
|
65
65
|
const item = richTextValue[index];
|
|
@@ -69,14 +69,14 @@ function* iterateBlocks(field, value) {
|
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
71
|
if (fieldType === 'single_block') {
|
|
72
|
-
const singleBlockValue =
|
|
72
|
+
const singleBlockValue = nonLocalizedFieldValue;
|
|
73
73
|
if (singleBlockValue) {
|
|
74
74
|
yield { item: singleBlockValue, path: [] };
|
|
75
75
|
}
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
78
|
if (fieldType === 'structured_text') {
|
|
79
|
-
const structuredTextValue =
|
|
79
|
+
const structuredTextValue = nonLocalizedFieldValue;
|
|
80
80
|
if (structuredTextValue) {
|
|
81
81
|
const foundNodes = (0, datocms_structured_text_utils_1.collectNodes)(structuredTextValue.document, (node) => node.type === 'block' || node.type === 'inlineBlock');
|
|
82
82
|
for (const { node, path } of foundNodes) {
|
|
@@ -88,11 +88,10 @@ function* iterateBlocks(field, value) {
|
|
|
88
88
|
return;
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
function iterateBlocksAsync(
|
|
91
|
+
function iterateBlocksAsync(fieldType, nonLocalizedFieldValue) {
|
|
92
92
|
return __asyncGenerator(this, arguments, function* iterateBlocksAsync_1() {
|
|
93
|
-
const fieldType = getFieldType(field);
|
|
94
93
|
if (fieldType === 'rich_text') {
|
|
95
|
-
const richTextValue =
|
|
94
|
+
const richTextValue = nonLocalizedFieldValue;
|
|
96
95
|
if (richTextValue) {
|
|
97
96
|
for (let index = 0; index < richTextValue.length; index++) {
|
|
98
97
|
const item = richTextValue[index];
|
|
@@ -102,14 +101,14 @@ function iterateBlocksAsync(field, value) {
|
|
|
102
101
|
return yield __await(void 0);
|
|
103
102
|
}
|
|
104
103
|
if (fieldType === 'single_block') {
|
|
105
|
-
const singleBlockValue =
|
|
104
|
+
const singleBlockValue = nonLocalizedFieldValue;
|
|
106
105
|
if (singleBlockValue) {
|
|
107
106
|
yield yield __await({ item: singleBlockValue, path: [] });
|
|
108
107
|
}
|
|
109
108
|
return yield __await(void 0);
|
|
110
109
|
}
|
|
111
110
|
if (fieldType === 'structured_text') {
|
|
112
|
-
const structuredTextValue =
|
|
111
|
+
const structuredTextValue = nonLocalizedFieldValue;
|
|
113
112
|
if (structuredTextValue) {
|
|
114
113
|
const foundNodes = yield __await((0, datocms_structured_text_utils_1.collectNodesAsync)(structuredTextValue.document, (node) => __awaiter(this, void 0, void 0, function* () { return node.type === 'block' || node.type === 'inlineBlock'; })));
|
|
115
114
|
for (const { node, path } of foundNodes) {
|
|
@@ -126,30 +125,30 @@ function iterateBlocksAsync(field, value) {
|
|
|
126
125
|
* Visit every block in a field value, calling the visitor function for each block found.
|
|
127
126
|
* Supports rich text, single block, and structured text field types.
|
|
128
127
|
*
|
|
129
|
-
* @param
|
|
130
|
-
* @param
|
|
128
|
+
* @param fieldType - The type of DatoCMS field definition that determines how the value is processed
|
|
129
|
+
* @param nonLocalizedFieldValue - The non-localized field value containing blocks to visit
|
|
131
130
|
* @param visitor - Synchronous function called for each block. Receives the block item and its path
|
|
132
131
|
*/
|
|
133
|
-
function
|
|
134
|
-
for (const { item, path } of iterateBlocks(
|
|
132
|
+
function nonRecursiveVisitBlocksInNonLocalizedFieldValue(fieldType, nonLocalizedFieldValue, visitor) {
|
|
133
|
+
for (const { item, path } of iterateBlocks(fieldType, nonLocalizedFieldValue)) {
|
|
135
134
|
visitor(item, path);
|
|
136
135
|
}
|
|
137
136
|
}
|
|
138
|
-
exports.
|
|
137
|
+
exports.nonRecursiveVisitBlocksInNonLocalizedFieldValue = nonRecursiveVisitBlocksInNonLocalizedFieldValue;
|
|
139
138
|
/**
|
|
140
139
|
* Visit every block in a field value, calling the visitor function for each block found.
|
|
141
140
|
* Supports rich text, single block, and structured text field types.
|
|
142
141
|
*
|
|
143
|
-
* @param
|
|
144
|
-
* @param
|
|
142
|
+
* @param fieldType - The type of DatoCMS field definition that determines how the value is processed
|
|
143
|
+
* @param nonLocalizedFieldValue - The non-localized field value containing blocks to visit
|
|
145
144
|
* @param visitor - Asynchronous function called for each block. Receives the block item and its path
|
|
146
145
|
* @returns Promise that resolves when all blocks have been visited
|
|
147
146
|
*/
|
|
148
|
-
function
|
|
147
|
+
function nonRecursiveVisitBlocksInNonLocalizedFieldValueAsync(fieldType, nonLocalizedFieldValue, visitor) {
|
|
149
148
|
var _a, e_1, _b, _c;
|
|
150
149
|
return __awaiter(this, void 0, void 0, function* () {
|
|
151
150
|
try {
|
|
152
|
-
for (var _d = true, _e = __asyncValues(iterateBlocksAsync(
|
|
151
|
+
for (var _d = true, _e = __asyncValues(iterateBlocksAsync(fieldType, nonLocalizedFieldValue)), _f; _f = yield _e.next(), _a = _f.done, !_a;) {
|
|
153
152
|
_c = _f.value;
|
|
154
153
|
_d = false;
|
|
155
154
|
try {
|
|
@@ -170,31 +169,30 @@ function nonRecursiveVisitBlocksInFieldValueAsync(field, value, visitor) {
|
|
|
170
169
|
}
|
|
171
170
|
});
|
|
172
171
|
}
|
|
173
|
-
exports.
|
|
172
|
+
exports.nonRecursiveVisitBlocksInNonLocalizedFieldValueAsync = nonRecursiveVisitBlocksInNonLocalizedFieldValueAsync;
|
|
174
173
|
/**
|
|
175
174
|
* Transform blocks in a field value by applying a mapping function to each block.
|
|
176
175
|
* Creates a new field value structure with transformed blocks while preserving the original structure.
|
|
177
176
|
* Supports rich text, single block, and structured text field types.
|
|
178
177
|
*
|
|
179
|
-
* @param
|
|
180
|
-
* @param
|
|
178
|
+
* @param fieldType - The type of DatoCMS field definition that determines how the value is processed
|
|
179
|
+
* @param nonLocalizedFieldValue - The non-localized field value containing blocks to transform
|
|
181
180
|
* @param mapper - Synchronous function that transforms each block. Receives block item and path, returns new block
|
|
182
181
|
* @returns The new field value with transformed blocks
|
|
183
182
|
*/
|
|
184
|
-
function
|
|
185
|
-
const fieldType = getFieldType(field);
|
|
183
|
+
function nonRecursiveMapBlocksInNonLocalizedFieldValue(fieldType, nonLocalizedFieldValue, mapper) {
|
|
186
184
|
if (fieldType === 'rich_text') {
|
|
187
|
-
const richTextValue =
|
|
185
|
+
const richTextValue = nonLocalizedFieldValue;
|
|
188
186
|
return richTextValue
|
|
189
187
|
? richTextValue.map((item, index) => mapper(item, [index]))
|
|
190
188
|
: richTextValue;
|
|
191
189
|
}
|
|
192
190
|
if (fieldType === 'single_block') {
|
|
193
|
-
const singleBlockValue =
|
|
191
|
+
const singleBlockValue = nonLocalizedFieldValue;
|
|
194
192
|
return singleBlockValue ? mapper(singleBlockValue, []) : null;
|
|
195
193
|
}
|
|
196
194
|
if (fieldType === 'structured_text') {
|
|
197
|
-
const structuredTextValue =
|
|
195
|
+
const structuredTextValue = nonLocalizedFieldValue;
|
|
198
196
|
if (!structuredTextValue) {
|
|
199
197
|
return null;
|
|
200
198
|
}
|
|
@@ -208,34 +206,33 @@ function nonRecursiveMapBlocksInFieldValue(field, value, mapper) {
|
|
|
208
206
|
}),
|
|
209
207
|
};
|
|
210
208
|
}
|
|
211
|
-
return
|
|
209
|
+
return nonLocalizedFieldValue;
|
|
212
210
|
}
|
|
213
|
-
exports.
|
|
211
|
+
exports.nonRecursiveMapBlocksInNonLocalizedFieldValue = nonRecursiveMapBlocksInNonLocalizedFieldValue;
|
|
214
212
|
/**
|
|
215
213
|
* Transform blocks in a field value by applying a mapping function to each block.
|
|
216
214
|
* Creates a new field value structure with transformed blocks while preserving the original structure.
|
|
217
215
|
* Supports rich text, single block, and structured text field types.
|
|
218
216
|
*
|
|
219
|
-
* @param
|
|
220
|
-
* @param
|
|
217
|
+
* @param fieldType - The type of DatoCMS field definition that determines how the value is processed
|
|
218
|
+
* @param nonLocalizedFieldValue - The non-localized field value containing blocks to transform
|
|
221
219
|
* @param mapper - Asynchronous function that transforms each block. Receives block item and path, returns new block
|
|
222
220
|
* @returns Promise that resolves to the new field value with transformed blocks
|
|
223
221
|
*/
|
|
224
|
-
function
|
|
222
|
+
function nonRecursiveMapBlocksInNonLocalizedFieldValueAsync(fieldType, nonLocalizedFieldValue, mapper) {
|
|
225
223
|
return __awaiter(this, void 0, void 0, function* () {
|
|
226
|
-
const fieldType = getFieldType(field);
|
|
227
224
|
if (fieldType === 'rich_text') {
|
|
228
|
-
const richTextValue =
|
|
225
|
+
const richTextValue = nonLocalizedFieldValue;
|
|
229
226
|
return richTextValue
|
|
230
227
|
? yield Promise.all(richTextValue.map((item, index) => mapper(item, [index])))
|
|
231
228
|
: richTextValue;
|
|
232
229
|
}
|
|
233
230
|
if (fieldType === 'single_block') {
|
|
234
|
-
const singleBlockValue =
|
|
231
|
+
const singleBlockValue = nonLocalizedFieldValue;
|
|
235
232
|
return singleBlockValue ? yield mapper(singleBlockValue, []) : null;
|
|
236
233
|
}
|
|
237
234
|
if (fieldType === 'structured_text') {
|
|
238
|
-
const structuredTextValue =
|
|
235
|
+
const structuredTextValue = nonLocalizedFieldValue;
|
|
239
236
|
if (!structuredTextValue) {
|
|
240
237
|
return null;
|
|
241
238
|
}
|
|
@@ -249,44 +246,44 @@ function nonRecursiveMapBlocksInFieldValueAsync(field, value, mapper) {
|
|
|
249
246
|
})),
|
|
250
247
|
};
|
|
251
248
|
}
|
|
252
|
-
return
|
|
249
|
+
return nonLocalizedFieldValue;
|
|
253
250
|
});
|
|
254
251
|
}
|
|
255
|
-
exports.
|
|
252
|
+
exports.nonRecursiveMapBlocksInNonLocalizedFieldValueAsync = nonRecursiveMapBlocksInNonLocalizedFieldValueAsync;
|
|
256
253
|
/**
|
|
257
254
|
* Find all blocks that match the predicate function.
|
|
258
|
-
* Searches through all blocks in the field value and returns all matches.
|
|
255
|
+
* Searches through all blocks in the non-localized field value and returns all matches.
|
|
259
256
|
*
|
|
260
|
-
* @param
|
|
261
|
-
* @param
|
|
257
|
+
* @param fieldType - The type of DatoCMS field definition that determines how the value is processed
|
|
258
|
+
* @param nonLocalizedFieldValue - The non-localized field value containing blocks to search
|
|
262
259
|
* @param predicate - Synchronous function that tests each block. Should return true for matching blocks
|
|
263
260
|
* @returns Array of objects, each containing a matching block and its path
|
|
264
261
|
*/
|
|
265
|
-
function
|
|
262
|
+
function nonRecursiveFindAllBlocksInNonLocalizedFieldValue(fieldType, nonLocalizedFieldValue, predicate) {
|
|
266
263
|
const results = [];
|
|
267
|
-
for (const { item, path } of iterateBlocks(
|
|
264
|
+
for (const { item, path } of iterateBlocks(fieldType, nonLocalizedFieldValue)) {
|
|
268
265
|
if (predicate(item, path)) {
|
|
269
266
|
results.push({ item, path });
|
|
270
267
|
}
|
|
271
268
|
}
|
|
272
269
|
return results;
|
|
273
270
|
}
|
|
274
|
-
exports.
|
|
271
|
+
exports.nonRecursiveFindAllBlocksInNonLocalizedFieldValue = nonRecursiveFindAllBlocksInNonLocalizedFieldValue;
|
|
275
272
|
/**
|
|
276
273
|
* Find all blocks that match the predicate function.
|
|
277
|
-
* Searches through all blocks in the field value and returns all matches.
|
|
274
|
+
* Searches through all blocks in the non-localized field value and returns all matches.
|
|
278
275
|
*
|
|
279
|
-
* @param
|
|
280
|
-
* @param
|
|
276
|
+
* @param fieldType - The type of DatoCMS field definition that determines how the value is processed
|
|
277
|
+
* @param nonLocalizedFieldValue - The non-localized field value containing blocks to search
|
|
281
278
|
* @param predicate - Asynchronous function that tests each block. Should return true for matching blocks
|
|
282
279
|
* @returns Promise that resolves to an array of objects, each containing a matching block and its path
|
|
283
280
|
*/
|
|
284
|
-
function
|
|
281
|
+
function nonRecursiveFindAllBlocksInNonLocalizedFieldValueAsync(fieldType, nonLocalizedFieldValue, predicate) {
|
|
285
282
|
var _a, e_2, _b, _c;
|
|
286
283
|
return __awaiter(this, void 0, void 0, function* () {
|
|
287
284
|
const results = [];
|
|
288
285
|
try {
|
|
289
|
-
for (var _d = true, _e = __asyncValues(iterateBlocksAsync(
|
|
286
|
+
for (var _d = true, _e = __asyncValues(iterateBlocksAsync(fieldType, nonLocalizedFieldValue)), _f; _f = yield _e.next(), _a = _f.done, !_a;) {
|
|
290
287
|
_c = _f.value;
|
|
291
288
|
_d = false;
|
|
292
289
|
try {
|
|
@@ -310,30 +307,29 @@ function nonRecursiveFindAllBlocksInFieldValueAsync(field, value, predicate) {
|
|
|
310
307
|
return results;
|
|
311
308
|
});
|
|
312
309
|
}
|
|
313
|
-
exports.
|
|
310
|
+
exports.nonRecursiveFindAllBlocksInNonLocalizedFieldValueAsync = nonRecursiveFindAllBlocksInNonLocalizedFieldValueAsync;
|
|
314
311
|
/**
|
|
315
312
|
* Filter blocks in a field value, removing those that don't match the predicate.
|
|
316
313
|
* Creates a new field value containing only blocks that pass the predicate test.
|
|
317
314
|
* Preserves the original field value structure and hierarchy.
|
|
318
315
|
*
|
|
319
|
-
* @param
|
|
320
|
-
* @param
|
|
316
|
+
* @param fieldType - The type of DatoCMS field definition that determines how the value is processed
|
|
317
|
+
* @param nonLocalizedFieldValue - The non-localized field value containing blocks to filter
|
|
321
318
|
* @param predicate - Synchronous function that tests each block. Blocks returning false are removed
|
|
322
319
|
* @returns The new field value with filtered blocks
|
|
323
320
|
*/
|
|
324
|
-
function
|
|
325
|
-
const fieldType = getFieldType(field);
|
|
321
|
+
function nonRecursiveFilterBlocksInNonLocalizedFieldValue(fieldType, nonLocalizedFieldValue, predicate) {
|
|
326
322
|
if (fieldType === 'rich_text') {
|
|
327
323
|
const filteredItems = [];
|
|
328
|
-
for (const { item, path } of iterateBlocks(
|
|
324
|
+
for (const { item, path } of iterateBlocks(fieldType, nonLocalizedFieldValue)) {
|
|
329
325
|
if (predicate(item, path)) {
|
|
330
326
|
filteredItems.push(item);
|
|
331
327
|
}
|
|
332
328
|
}
|
|
333
|
-
return
|
|
329
|
+
return filteredItems;
|
|
334
330
|
}
|
|
335
331
|
if (fieldType === 'single_block') {
|
|
336
|
-
for (const { item, path } of iterateBlocks(
|
|
332
|
+
for (const { item, path } of iterateBlocks(fieldType, nonLocalizedFieldValue)) {
|
|
337
333
|
if (predicate(item, path)) {
|
|
338
334
|
return item;
|
|
339
335
|
}
|
|
@@ -341,7 +337,7 @@ function nonRecursiveFilterBlocksInFieldValue(field, value, predicate) {
|
|
|
341
337
|
return null;
|
|
342
338
|
}
|
|
343
339
|
if (fieldType === 'structured_text') {
|
|
344
|
-
const structuredTextValue =
|
|
340
|
+
const structuredTextValue = nonLocalizedFieldValue;
|
|
345
341
|
if (!structuredTextValue) {
|
|
346
342
|
return null;
|
|
347
343
|
}
|
|
@@ -358,27 +354,26 @@ function nonRecursiveFilterBlocksInFieldValue(field, value, predicate) {
|
|
|
358
354
|
}
|
|
359
355
|
: null;
|
|
360
356
|
}
|
|
361
|
-
return
|
|
357
|
+
return nonLocalizedFieldValue;
|
|
362
358
|
}
|
|
363
|
-
exports.
|
|
359
|
+
exports.nonRecursiveFilterBlocksInNonLocalizedFieldValue = nonRecursiveFilterBlocksInNonLocalizedFieldValue;
|
|
364
360
|
/**
|
|
365
361
|
* Filter blocks in a field value, removing those that don't match the predicate.
|
|
366
362
|
* Creates a new field value containing only blocks that pass the predicate test.
|
|
367
363
|
* Preserves the original field value structure and hierarchy.
|
|
368
364
|
*
|
|
369
|
-
* @param
|
|
370
|
-
* @param
|
|
365
|
+
* @param fieldType - The type of DatoCMS field definition that determines how the value is processed
|
|
366
|
+
* @param nonLocalizedFieldValue - The non-localized field value containing blocks to filter
|
|
371
367
|
* @param predicate - Asynchronous function that tests each block. Blocks returning false are removed
|
|
372
368
|
* @returns Promise that resolves to the new field value with filtered blocks
|
|
373
369
|
*/
|
|
374
|
-
function
|
|
370
|
+
function nonRecursiveFilterBlocksInNonLocalizedFieldValueAsync(fieldType, nonLocalizedFieldValue, predicate) {
|
|
375
371
|
var _a, e_3, _b, _c, _d, e_4, _e, _f;
|
|
376
372
|
return __awaiter(this, void 0, void 0, function* () {
|
|
377
|
-
const fieldType = getFieldType(field);
|
|
378
373
|
if (fieldType === 'rich_text') {
|
|
379
374
|
const filteredItems = [];
|
|
380
375
|
try {
|
|
381
|
-
for (var _g = true, _h = __asyncValues(iterateBlocksAsync(
|
|
376
|
+
for (var _g = true, _h = __asyncValues(iterateBlocksAsync(fieldType, nonLocalizedFieldValue)), _j; _j = yield _h.next(), _a = _j.done, !_a;) {
|
|
382
377
|
_c = _j.value;
|
|
383
378
|
_g = false;
|
|
384
379
|
try {
|
|
@@ -399,11 +394,11 @@ function nonRecursiveFilterBlocksInFieldValueAsync(field, value, predicate) {
|
|
|
399
394
|
}
|
|
400
395
|
finally { if (e_3) throw e_3.error; }
|
|
401
396
|
}
|
|
402
|
-
return
|
|
397
|
+
return filteredItems;
|
|
403
398
|
}
|
|
404
399
|
if (fieldType === 'single_block') {
|
|
405
400
|
try {
|
|
406
|
-
for (var _k = true, _l = __asyncValues(iterateBlocksAsync(
|
|
401
|
+
for (var _k = true, _l = __asyncValues(iterateBlocksAsync(fieldType, nonLocalizedFieldValue)), _m; _m = yield _l.next(), _d = _m.done, !_d;) {
|
|
407
402
|
_f = _m.value;
|
|
408
403
|
_k = false;
|
|
409
404
|
try {
|
|
@@ -427,7 +422,7 @@ function nonRecursiveFilterBlocksInFieldValueAsync(field, value, predicate) {
|
|
|
427
422
|
return null;
|
|
428
423
|
}
|
|
429
424
|
if (fieldType === 'structured_text') {
|
|
430
|
-
const structuredTextValue =
|
|
425
|
+
const structuredTextValue = nonLocalizedFieldValue;
|
|
431
426
|
if (!structuredTextValue) {
|
|
432
427
|
return null;
|
|
433
428
|
}
|
|
@@ -444,46 +439,46 @@ function nonRecursiveFilterBlocksInFieldValueAsync(field, value, predicate) {
|
|
|
444
439
|
}
|
|
445
440
|
: null;
|
|
446
441
|
}
|
|
447
|
-
return
|
|
442
|
+
return nonLocalizedFieldValue;
|
|
448
443
|
});
|
|
449
444
|
}
|
|
450
|
-
exports.
|
|
445
|
+
exports.nonRecursiveFilterBlocksInNonLocalizedFieldValueAsync = nonRecursiveFilterBlocksInNonLocalizedFieldValueAsync;
|
|
451
446
|
/**
|
|
452
447
|
* Reduce all blocks in a field value to a single value by applying a reducer function.
|
|
453
|
-
* Processes each block in the field value and accumulates the results into a single value.
|
|
448
|
+
* Processes each block in the non-localized field value and accumulates the results into a single value.
|
|
454
449
|
*
|
|
455
450
|
* @template R - The type of the accumulated result
|
|
456
|
-
* @param
|
|
457
|
-
* @param
|
|
451
|
+
* @param fieldType - The type of DatoCMS field definition that determines how the value is processed
|
|
452
|
+
* @param nonLocalizedFieldValue - The non-localized field value containing blocks to reduce
|
|
458
453
|
* @param reducer - Synchronous function that processes each block and updates the accumulator
|
|
459
454
|
* @param initialValue - The initial value for the accumulator
|
|
460
455
|
* @returns The final accumulated value
|
|
461
456
|
*/
|
|
462
|
-
function
|
|
457
|
+
function nonRecursiveReduceBlocksInNonLocalizedFieldValue(fieldType, nonLocalizedFieldValue, reducer, initialValue) {
|
|
463
458
|
let accumulator = initialValue;
|
|
464
|
-
for (const { item, path } of iterateBlocks(
|
|
459
|
+
for (const { item, path } of iterateBlocks(fieldType, nonLocalizedFieldValue)) {
|
|
465
460
|
accumulator = reducer(accumulator, item, path);
|
|
466
461
|
}
|
|
467
462
|
return accumulator;
|
|
468
463
|
}
|
|
469
|
-
exports.
|
|
464
|
+
exports.nonRecursiveReduceBlocksInNonLocalizedFieldValue = nonRecursiveReduceBlocksInNonLocalizedFieldValue;
|
|
470
465
|
/**
|
|
471
466
|
* Reduce all blocks in a field value to a single value by applying a reducer function.
|
|
472
|
-
* Processes each block in the field value and accumulates the results into a single value.
|
|
467
|
+
* Processes each block in the non-localized field value and accumulates the results into a single value.
|
|
473
468
|
*
|
|
474
469
|
* @template R - The type of the accumulated result
|
|
475
|
-
* @param
|
|
476
|
-
* @param
|
|
470
|
+
* @param fieldType - The type of DatoCMS field definition that determines how the value is processed
|
|
471
|
+
* @param nonLocalizedFieldValue - The non-localized field value containing blocks to reduce
|
|
477
472
|
* @param reducer - Asynchronous function that processes each block and updates the accumulator
|
|
478
473
|
* @param initialValue - The initial value for the accumulator
|
|
479
474
|
* @returns Promise that resolves to the final accumulated value
|
|
480
475
|
*/
|
|
481
|
-
function
|
|
476
|
+
function nonRecursiveReduceBlocksInNonLocalizedFieldValueAsync(fieldType, nonLocalizedFieldValue, reducer, initialValue) {
|
|
482
477
|
var _a, e_5, _b, _c;
|
|
483
478
|
return __awaiter(this, void 0, void 0, function* () {
|
|
484
479
|
let accumulator = initialValue;
|
|
485
480
|
try {
|
|
486
|
-
for (var _d = true, _e = __asyncValues(iterateBlocksAsync(
|
|
481
|
+
for (var _d = true, _e = __asyncValues(iterateBlocksAsync(fieldType, nonLocalizedFieldValue)), _f; _f = yield _e.next(), _a = _f.done, !_a;) {
|
|
487
482
|
_c = _f.value;
|
|
488
483
|
_d = false;
|
|
489
484
|
try {
|
|
@@ -505,39 +500,39 @@ function nonRecursiveReduceBlocksInFieldValueAsync(field, value, reducer, initia
|
|
|
505
500
|
return accumulator;
|
|
506
501
|
});
|
|
507
502
|
}
|
|
508
|
-
exports.
|
|
503
|
+
exports.nonRecursiveReduceBlocksInNonLocalizedFieldValueAsync = nonRecursiveReduceBlocksInNonLocalizedFieldValueAsync;
|
|
509
504
|
/**
|
|
510
|
-
* Check if any block in the field value matches the predicate function.
|
|
505
|
+
* Check if any block in the non-localized field value matches the predicate function.
|
|
511
506
|
* Returns true as soon as the first matching block is found (short-circuit evaluation).
|
|
512
507
|
*
|
|
513
|
-
* @param
|
|
514
|
-
* @param
|
|
508
|
+
* @param fieldType - The type of DatoCMS field definition that determines how the value is processed
|
|
509
|
+
* @param nonLocalizedFieldValue - The non-localized field value containing blocks to test
|
|
515
510
|
* @param predicate - Synchronous function that tests each block. Should return true for matching blocks
|
|
516
511
|
* @returns True if any block matches, false otherwise
|
|
517
512
|
*/
|
|
518
|
-
function
|
|
519
|
-
for (const { item, path } of iterateBlocks(
|
|
513
|
+
function nonRecursiveSomeBlocksInNonLocalizedFieldValue(fieldType, nonLocalizedFieldValue, predicate) {
|
|
514
|
+
for (const { item, path } of iterateBlocks(fieldType, nonLocalizedFieldValue)) {
|
|
520
515
|
if (predicate(item, path)) {
|
|
521
516
|
return true;
|
|
522
517
|
}
|
|
523
518
|
}
|
|
524
519
|
return false;
|
|
525
520
|
}
|
|
526
|
-
exports.
|
|
521
|
+
exports.nonRecursiveSomeBlocksInNonLocalizedFieldValue = nonRecursiveSomeBlocksInNonLocalizedFieldValue;
|
|
527
522
|
/**
|
|
528
|
-
* Check if any block in the field value matches the predicate function.
|
|
523
|
+
* Check if any block in the non-localized field value matches the predicate function.
|
|
529
524
|
* Returns true as soon as the first matching block is found (short-circuit evaluation).
|
|
530
525
|
*
|
|
531
|
-
* @param
|
|
532
|
-
* @param
|
|
526
|
+
* @param fieldType - The type of DatoCMS field definition that determines how the value is processed
|
|
527
|
+
* @param nonLocalizedFieldValue - The non-localized field value containing blocks to test
|
|
533
528
|
* @param predicate - Asynchronous function that tests each block. Should return true for matching blocks
|
|
534
529
|
* @returns Promise that resolves to true if any block matches, false otherwise
|
|
535
530
|
*/
|
|
536
|
-
function
|
|
531
|
+
function nonRecursiveSomeBlocksInNonLocalizedFieldValueAsync(fieldType, nonLocalizedFieldValue, predicate) {
|
|
537
532
|
var _a, e_6, _b, _c;
|
|
538
533
|
return __awaiter(this, void 0, void 0, function* () {
|
|
539
534
|
try {
|
|
540
|
-
for (var _d = true, _e = __asyncValues(iterateBlocksAsync(
|
|
535
|
+
for (var _d = true, _e = __asyncValues(iterateBlocksAsync(fieldType, nonLocalizedFieldValue)), _f; _f = yield _e.next(), _a = _f.done, !_a;) {
|
|
541
536
|
_c = _f.value;
|
|
542
537
|
_d = false;
|
|
543
538
|
try {
|
|
@@ -561,37 +556,37 @@ function nonRecursiveSomeBlocksInFieldValueAsync(field, value, predicate) {
|
|
|
561
556
|
return false;
|
|
562
557
|
});
|
|
563
558
|
}
|
|
564
|
-
exports.
|
|
559
|
+
exports.nonRecursiveSomeBlocksInNonLocalizedFieldValueAsync = nonRecursiveSomeBlocksInNonLocalizedFieldValueAsync;
|
|
565
560
|
/**
|
|
566
|
-
* Check if every block in the field value matches the predicate function.
|
|
561
|
+
* Check if every block in the non-localized field value matches the predicate function.
|
|
567
562
|
* Returns false as soon as the first non-matching block is found (short-circuit evaluation).
|
|
568
563
|
*
|
|
569
|
-
* @param
|
|
570
|
-
* @param
|
|
564
|
+
* @param fieldType - The type of DatoCMS field definition that determines how the value is processed
|
|
565
|
+
* @param nonLocalizedFieldValue - The non-localized field value containing blocks to test
|
|
571
566
|
* @param predicate - Synchronous function that tests each block. Should return true for valid blocks
|
|
572
567
|
* @returns True if all blocks match, false otherwise
|
|
573
568
|
*/
|
|
574
|
-
function
|
|
575
|
-
return !
|
|
569
|
+
function nonRecursiveEveryBlockInNonLocalizedFieldValue(fieldType, nonLocalizedFieldValue, predicate) {
|
|
570
|
+
return !nonRecursiveSomeBlocksInNonLocalizedFieldValue(fieldType, nonLocalizedFieldValue, (item, path) => {
|
|
576
571
|
return !predicate(item, path);
|
|
577
572
|
});
|
|
578
573
|
}
|
|
579
|
-
exports.
|
|
574
|
+
exports.nonRecursiveEveryBlockInNonLocalizedFieldValue = nonRecursiveEveryBlockInNonLocalizedFieldValue;
|
|
580
575
|
/**
|
|
581
|
-
* Check if every block in the field value matches the predicate function.
|
|
576
|
+
* Check if every block in the non-localized field value matches the predicate function.
|
|
582
577
|
* Returns false as soon as the first non-matching block is found (short-circuit evaluation).
|
|
583
578
|
*
|
|
584
|
-
* @param
|
|
585
|
-
* @param
|
|
579
|
+
* @param fieldType - The type of DatoCMS field definition that determines how the value is processed
|
|
580
|
+
* @param nonLocalizedFieldValue - The non-localized field value containing blocks to test
|
|
586
581
|
* @param predicate - Asynchronous function that tests each block. Should return true for valid blocks
|
|
587
582
|
* @returns Promise that resolves to true if all blocks match, false otherwise
|
|
588
583
|
*/
|
|
589
|
-
function
|
|
584
|
+
function nonRecursiveEveryBlockInNonLocalizedFieldValueAsync(fieldType, nonLocalizedFieldValue, predicate) {
|
|
590
585
|
return __awaiter(this, void 0, void 0, function* () {
|
|
591
|
-
return !(yield
|
|
586
|
+
return !(yield nonRecursiveSomeBlocksInNonLocalizedFieldValueAsync(fieldType, nonLocalizedFieldValue, (item, path) => __awaiter(this, void 0, void 0, function* () {
|
|
592
587
|
return !(yield predicate(item, path));
|
|
593
588
|
})));
|
|
594
589
|
});
|
|
595
590
|
}
|
|
596
|
-
exports.
|
|
597
|
-
//# sourceMappingURL=
|
|
591
|
+
exports.nonRecursiveEveryBlockInNonLocalizedFieldValueAsync = nonRecursiveEveryBlockInNonLocalizedFieldValueAsync;
|
|
592
|
+
//# sourceMappingURL=nonRecursiveBlocks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nonRecursiveBlocks.js","sourceRoot":"","sources":["../../../src/utilities/nonRecursiveBlocks.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iFAQuC;AAcvC,mEAAgE;AAehE,QAAQ,CAAC,CAAC,aAAa,CACrB,SAAuC,EACvC,sBAA+B;IAE/B,IAAI,IAAA,6CAAqB,EAAC,sBAAsB,CAAC,EAAE;QACjD,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;KAC7D;IAED,IAAI,SAAS,KAAK,WAAW,EAAE;QAC7B,MAAM,aAAa,GAAG,sBAA+C,CAAC;QACtE,IAAI,aAAa,EAAE;YACjB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;gBACzD,MAAM,IAAI,GAAG,aAAa,CAAC,KAAK,CAAE,CAAC;gBACnC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,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