@datocms/cma-client 5.1.11 → 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.
Files changed (118) hide show
  1. package/README.md +40 -46
  2. package/dist/cjs/fieldTypes/file.js +6 -6
  3. package/dist/cjs/fieldTypes/gallery.js +7 -7
  4. package/dist/cjs/fieldTypes/rich_text.js +14 -12
  5. package/dist/cjs/fieldTypes/rich_text.js.map +1 -1
  6. package/dist/cjs/fieldTypes/schema.js +3 -0
  7. package/dist/cjs/fieldTypes/schema.js.map +1 -0
  8. package/dist/cjs/fieldTypes/single_block.js +13 -12
  9. package/dist/cjs/fieldTypes/single_block.js.map +1 -1
  10. package/dist/cjs/fieldTypes/structured_text.js +13 -12
  11. package/dist/cjs/fieldTypes/structured_text.js.map +1 -1
  12. package/dist/cjs/generated/Client.js +1 -1
  13. package/dist/cjs/generated/resources/Item.js.map +1 -1
  14. package/dist/cjs/generated/resources/ScheduledPublication.js.map +1 -1
  15. package/dist/cjs/generated/resources/ScheduledUnpublishing.js.map +1 -1
  16. package/dist/cjs/generated/resources/Upload.js.map +1 -1
  17. package/dist/cjs/index.js +1 -0
  18. package/dist/cjs/index.js.map +1 -1
  19. package/dist/cjs/utilities/buildBlockRecord.js +1 -46
  20. package/dist/cjs/utilities/buildBlockRecord.js.map +1 -1
  21. package/dist/cjs/utilities/duplicateBlockRecord.js +49 -0
  22. package/dist/cjs/utilities/duplicateBlockRecord.js.map +1 -0
  23. package/dist/cjs/utilities/inspectItem.js +50 -20
  24. package/dist/cjs/utilities/inspectItem.js.map +1 -1
  25. package/dist/cjs/utilities/nonRecursiveBlocks.js +1 -170
  26. package/dist/cjs/utilities/nonRecursiveBlocks.js.map +1 -1
  27. package/dist/cjs/utilities/recursiveBlocks.js +52 -112
  28. package/dist/cjs/utilities/recursiveBlocks.js.map +1 -1
  29. package/dist/esm/fieldTypes/file.d.ts +3 -3
  30. package/dist/esm/fieldTypes/file.js +3 -3
  31. package/dist/esm/fieldTypes/gallery.d.ts +5 -5
  32. package/dist/esm/fieldTypes/gallery.js +5 -5
  33. package/dist/esm/fieldTypes/rich_text.d.ts +8 -9
  34. package/dist/esm/fieldTypes/rich_text.js +9 -7
  35. package/dist/esm/fieldTypes/rich_text.js.map +1 -1
  36. package/dist/esm/fieldTypes/schema.d.ts +59 -0
  37. package/dist/esm/fieldTypes/schema.js +2 -0
  38. package/dist/esm/fieldTypes/schema.js.map +1 -0
  39. package/dist/esm/fieldTypes/single_block.d.ts +30 -15
  40. package/dist/esm/fieldTypes/single_block.js +8 -7
  41. package/dist/esm/fieldTypes/single_block.js.map +1 -1
  42. package/dist/esm/fieldTypes/structured_text.d.ts +14 -15
  43. package/dist/esm/fieldTypes/structured_text.js +8 -7
  44. package/dist/esm/fieldTypes/structured_text.js.map +1 -1
  45. package/dist/esm/generated/ApiTypes.d.ts +90 -980
  46. package/dist/esm/generated/Client.js +1 -1
  47. package/dist/esm/generated/RawApiTypes.d.ts +156 -999
  48. package/dist/esm/generated/resources/Field.d.ts +200 -200
  49. package/dist/esm/generated/resources/Item.d.ts +34 -34
  50. package/dist/esm/generated/resources/Item.js.map +1 -1
  51. package/dist/esm/generated/resources/ItemVersion.d.ts +3 -1
  52. package/dist/esm/generated/resources/ScheduledPublication.d.ts +3 -3
  53. package/dist/esm/generated/resources/ScheduledPublication.js.map +1 -1
  54. package/dist/esm/generated/resources/ScheduledUnpublishing.d.ts +3 -3
  55. package/dist/esm/generated/resources/ScheduledUnpublishing.js.map +1 -1
  56. package/dist/esm/generated/resources/Upload.d.ts +6 -6
  57. package/dist/esm/generated/resources/Upload.js.map +1 -1
  58. package/dist/esm/index.d.ts +1 -0
  59. package/dist/esm/index.js +1 -0
  60. package/dist/esm/index.js.map +1 -1
  61. package/dist/esm/utilities/buildBlockRecord.d.ts +3 -5
  62. package/dist/esm/utilities/buildBlockRecord.js +0 -44
  63. package/dist/esm/utilities/buildBlockRecord.js.map +1 -1
  64. package/dist/esm/utilities/duplicateBlockRecord.d.ts +6 -0
  65. package/dist/esm/utilities/duplicateBlockRecord.js +45 -0
  66. package/dist/esm/utilities/duplicateBlockRecord.js.map +1 -0
  67. package/dist/esm/utilities/inspectItem.d.ts +3 -3
  68. package/dist/esm/utilities/inspectItem.js +28 -21
  69. package/dist/esm/utilities/inspectItem.js.map +1 -1
  70. package/dist/esm/utilities/itemDefinition.d.ts +25 -27
  71. package/dist/esm/utilities/nonRecursiveBlocks.d.ts +10 -75
  72. package/dist/esm/utilities/nonRecursiveBlocks.js +1 -164
  73. package/dist/esm/utilities/nonRecursiveBlocks.js.map +1 -1
  74. package/dist/esm/utilities/recursiveBlocks.d.ts +53 -23
  75. package/dist/esm/utilities/recursiveBlocks.js +52 -112
  76. package/dist/esm/utilities/recursiveBlocks.js.map +1 -1
  77. package/dist/types/fieldTypes/file.d.ts +3 -3
  78. package/dist/types/fieldTypes/gallery.d.ts +5 -5
  79. package/dist/types/fieldTypes/rich_text.d.ts +8 -9
  80. package/dist/types/fieldTypes/schema.d.ts +59 -0
  81. package/dist/types/fieldTypes/single_block.d.ts +30 -15
  82. package/dist/types/fieldTypes/structured_text.d.ts +14 -15
  83. package/dist/types/generated/ApiTypes.d.ts +90 -980
  84. package/dist/types/generated/RawApiTypes.d.ts +156 -999
  85. package/dist/types/generated/resources/Field.d.ts +200 -200
  86. package/dist/types/generated/resources/Item.d.ts +34 -34
  87. package/dist/types/generated/resources/ItemVersion.d.ts +3 -1
  88. package/dist/types/generated/resources/ScheduledPublication.d.ts +3 -3
  89. package/dist/types/generated/resources/ScheduledUnpublishing.d.ts +3 -3
  90. package/dist/types/generated/resources/Upload.d.ts +6 -6
  91. package/dist/types/index.d.ts +1 -0
  92. package/dist/types/utilities/buildBlockRecord.d.ts +3 -5
  93. package/dist/types/utilities/duplicateBlockRecord.d.ts +6 -0
  94. package/dist/types/utilities/inspectItem.d.ts +3 -3
  95. package/dist/types/utilities/itemDefinition.d.ts +25 -27
  96. package/dist/types/utilities/nonRecursiveBlocks.d.ts +10 -75
  97. package/dist/types/utilities/recursiveBlocks.d.ts +53 -23
  98. package/package.json +3 -3
  99. package/src/fieldTypes/file.ts +6 -6
  100. package/src/fieldTypes/gallery.ts +10 -10
  101. package/src/fieldTypes/rich_text.ts +26 -24
  102. package/src/fieldTypes/schema.ts +657 -0
  103. package/src/fieldTypes/single_block.ts +61 -38
  104. package/src/fieldTypes/structured_text.ts +57 -51
  105. package/src/generated/ApiTypes.ts +217 -1880
  106. package/src/generated/Client.ts +1 -1
  107. package/src/generated/RawApiTypes.ts +272 -2113
  108. package/src/generated/resources/Item.ts +93 -187
  109. package/src/generated/resources/ScheduledPublication.ts +4 -15
  110. package/src/generated/resources/ScheduledUnpublishing.ts +4 -15
  111. package/src/generated/resources/Upload.ts +9 -32
  112. package/src/index.ts +1 -0
  113. package/src/utilities/buildBlockRecord.ts +4 -60
  114. package/src/utilities/duplicateBlockRecord.ts +52 -0
  115. package/src/utilities/inspectItem.ts +64 -52
  116. package/src/utilities/itemDefinition.ts +109 -98
  117. package/src/utilities/nonRecursiveBlocks.ts +25 -279
  118. package/src/utilities/recursiveBlocks.ts +337 -72
@@ -24,91 +24,42 @@
24
24
 
25
25
  import {
26
26
  type TreePath,
27
- collectNodes,
28
27
  collectNodesAsync,
29
- filterNodes,
30
28
  filterNodesAsync,
31
29
  mapNodes,
32
30
  mapNodesAsync,
33
31
  } from 'datocms-structured-text-utils';
34
32
  import type {
35
- BlockItemInARequest,
33
+ BlockInRequest,
36
34
  RichTextFieldValue,
37
- RichTextFieldValueAsRequest,
38
- RichTextFieldValueWithNestedBlocks,
35
+ RichTextFieldValueInNestedResponse,
36
+ RichTextFieldValueInRequest,
39
37
  SingleBlockFieldValue,
40
- SingleBlockFieldValueAsRequest,
41
- SingleBlockFieldValueWithNestedBlocks,
38
+ SingleBlockFieldValueInNestedResponse,
39
+ SingleBlockFieldValueInRequest,
42
40
  StructuredTextFieldValue,
43
- StructuredTextFieldValueAsRequest,
44
- StructuredTextFieldValueWithNestedBlocks,
41
+ StructuredTextFieldValueInNestedResponse,
42
+ StructuredTextFieldValueInRequest,
45
43
  } from '../fieldTypes';
46
44
  import type * as ApiTypes from '../generated/ApiTypes';
47
- import { isLocalizedFieldValue } from './normalizedFieldValues';
48
45
 
49
46
  type PossibleRichTextValue =
50
47
  | RichTextFieldValue
51
- | RichTextFieldValueAsRequest
52
- | RichTextFieldValueWithNestedBlocks;
48
+ | RichTextFieldValueInRequest
49
+ | RichTextFieldValueInNestedResponse;
53
50
  type PossibleSingleBlockValue =
54
51
  | SingleBlockFieldValue
55
- | SingleBlockFieldValueAsRequest
56
- | SingleBlockFieldValueWithNestedBlocks;
52
+ | SingleBlockFieldValueInRequest
53
+ | SingleBlockFieldValueInNestedResponse;
57
54
  type PossibleStructuredTextValue =
58
55
  | StructuredTextFieldValue
59
- | StructuredTextFieldValueAsRequest
60
- | StructuredTextFieldValueWithNestedBlocks;
61
-
62
- function* iterateBlocks(
63
- fieldType: ApiTypes.Field['field_type'],
64
- nonLocalizedFieldValue: unknown,
65
- ): Generator<{ item: BlockItemInARequest; path: TreePath }> {
66
- if (isLocalizedFieldValue(nonLocalizedFieldValue)) {
67
- throw new Error('A non-localized field value is required!');
68
- }
69
-
70
- if (fieldType === 'rich_text') {
71
- const richTextValue = nonLocalizedFieldValue as PossibleRichTextValue;
72
- if (richTextValue) {
73
- for (let index = 0; index < richTextValue.length; index++) {
74
- const item = richTextValue[index]!;
75
- yield { item, path: [index] };
76
- }
77
- }
78
- return;
79
- }
80
-
81
- if (fieldType === 'single_block') {
82
- const singleBlockValue = nonLocalizedFieldValue as PossibleSingleBlockValue;
83
- if (singleBlockValue) {
84
- yield { item: singleBlockValue, path: [] };
85
- }
86
- return;
87
- }
88
-
89
- if (fieldType === 'structured_text') {
90
- const structuredTextValue =
91
- nonLocalizedFieldValue as PossibleStructuredTextValue;
92
- if (structuredTextValue) {
93
- const foundNodes = collectNodes(
94
- structuredTextValue.document,
95
- (node) => node.type === 'block' || node.type === 'inlineBlock',
96
- );
97
-
98
- for (const { node, path } of foundNodes) {
99
- if (node.type === 'block' || node.type === 'inlineBlock') {
100
- yield { item: node.item, path };
101
- }
102
- }
103
- }
104
- return;
105
- }
106
- }
56
+ | StructuredTextFieldValueInRequest
57
+ | StructuredTextFieldValueInNestedResponse;
107
58
 
108
59
  async function* iterateBlocksAsync(
109
60
  fieldType: ApiTypes.Field['field_type'],
110
61
  nonLocalizedFieldValue: unknown,
111
- ): AsyncGenerator<{ item: BlockItemInARequest; path: TreePath }> {
62
+ ): AsyncGenerator<{ item: BlockInRequest; path: TreePath }> {
112
63
  if (fieldType === 'rich_text') {
113
64
  const richTextValue = nonLocalizedFieldValue as PossibleRichTextValue;
114
65
  if (richTextValue) {
@@ -147,27 +98,6 @@ async function* iterateBlocksAsync(
147
98
  }
148
99
  }
149
100
 
150
- /**
151
- * Visit every block in a field value, calling the visitor function for each block found.
152
- * Supports rich text, single block, and structured text field types.
153
- *
154
- * @param fieldType - The type of DatoCMS field definition that determines how the value is processed
155
- * @param nonLocalizedFieldValue - The non-localized field value containing blocks to visit
156
- * @param visitor - Synchronous function called for each block. Receives the block item and its path
157
- */
158
- export function nonRecursiveVisitBlocksInNonLocalizedFieldValue(
159
- fieldType: ApiTypes.Field['field_type'],
160
- nonLocalizedFieldValue: unknown,
161
- visitor: (item: BlockItemInARequest, path: TreePath) => void,
162
- ): void {
163
- for (const { item, path } of iterateBlocks(
164
- fieldType,
165
- nonLocalizedFieldValue,
166
- )) {
167
- visitor(item, path);
168
- }
169
- }
170
-
171
101
  /**
172
102
  * Visit every block in a field value, calling the visitor function for each block found.
173
103
  * Supports rich text, single block, and structured text field types.
@@ -180,7 +110,7 @@ export function nonRecursiveVisitBlocksInNonLocalizedFieldValue(
180
110
  export async function nonRecursiveVisitBlocksInNonLocalizedFieldValueAsync(
181
111
  fieldType: ApiTypes.Field['field_type'],
182
112
  nonLocalizedFieldValue: unknown,
183
- visitor: (item: BlockItemInARequest, path: TreePath) => Promise<void>,
113
+ visitor: (item: BlockInRequest, path: TreePath) => Promise<void>,
184
114
  ): Promise<void> {
185
115
  for await (const { item, path } of iterateBlocksAsync(
186
116
  fieldType,
@@ -203,7 +133,7 @@ export async function nonRecursiveVisitBlocksInNonLocalizedFieldValueAsync(
203
133
  export function nonRecursiveMapBlocksInNonLocalizedFieldValue(
204
134
  fieldType: ApiTypes.Field['field_type'],
205
135
  nonLocalizedFieldValue: unknown,
206
- mapper: (item: BlockItemInARequest, path: TreePath) => BlockItemInARequest,
136
+ mapper: (item: BlockInRequest, path: TreePath) => BlockInRequest,
207
137
  ): unknown {
208
138
  if (fieldType === 'rich_text') {
209
139
  const richTextValue = nonLocalizedFieldValue as PossibleRichTextValue;
@@ -256,10 +186,7 @@ export function nonRecursiveMapBlocksInNonLocalizedFieldValue(
256
186
  export async function nonRecursiveMapBlocksInNonLocalizedFieldValueAsync(
257
187
  fieldType: ApiTypes.Field['field_type'],
258
188
  nonLocalizedFieldValue: unknown,
259
- mapper: (
260
- item: BlockItemInARequest,
261
- path: TreePath,
262
- ) => Promise<BlockItemInARequest>,
189
+ mapper: (item: BlockInRequest, path: TreePath) => Promise<BlockInRequest>,
263
190
  ): Promise<unknown> {
264
191
  if (fieldType === 'rich_text') {
265
192
  const richTextValue = nonLocalizedFieldValue as PossibleRichTextValue;
@@ -301,34 +228,6 @@ export async function nonRecursiveMapBlocksInNonLocalizedFieldValueAsync(
301
228
  return nonLocalizedFieldValue;
302
229
  }
303
230
 
304
- /**
305
- * Find all blocks that match the predicate function.
306
- * Searches through all blocks in the non-localized field value and returns all matches.
307
- *
308
- * @param fieldType - The type of DatoCMS field definition that determines how the value is processed
309
- * @param nonLocalizedFieldValue - The non-localized field value containing blocks to search
310
- * @param predicate - Synchronous function that tests each block. Should return true for matching blocks
311
- * @returns Array of objects, each containing a matching block and its path
312
- */
313
- export function nonRecursiveFindAllBlocksInNonLocalizedFieldValue(
314
- fieldType: ApiTypes.Field['field_type'],
315
- nonLocalizedFieldValue: unknown,
316
- predicate: (item: BlockItemInARequest, path: TreePath) => boolean,
317
- ): Array<{ item: BlockItemInARequest; path: TreePath }> {
318
- const results: Array<{ item: BlockItemInARequest; path: TreePath }> = [];
319
-
320
- for (const { item, path } of iterateBlocks(
321
- fieldType,
322
- nonLocalizedFieldValue,
323
- )) {
324
- if (predicate(item, path)) {
325
- results.push({ item, path });
326
- }
327
- }
328
-
329
- return results;
330
- }
331
-
332
231
  /**
333
232
  * Find all blocks that match the predicate function.
334
233
  * Searches through all blocks in the non-localized field value and returns all matches.
@@ -341,9 +240,9 @@ export function nonRecursiveFindAllBlocksInNonLocalizedFieldValue(
341
240
  export async function nonRecursiveFindAllBlocksInNonLocalizedFieldValueAsync(
342
241
  fieldType: ApiTypes.Field['field_type'],
343
242
  nonLocalizedFieldValue: unknown,
344
- predicate: (item: BlockItemInARequest, path: TreePath) => Promise<boolean>,
345
- ): Promise<Array<{ item: BlockItemInARequest; path: TreePath }>> {
346
- const results: Array<{ item: BlockItemInARequest; path: TreePath }> = [];
243
+ predicate: (item: BlockInRequest, path: TreePath) => Promise<boolean>,
244
+ ): Promise<Array<{ item: BlockInRequest; path: TreePath }>> {
245
+ const results: Array<{ item: BlockInRequest; path: TreePath }> = [];
347
246
 
348
247
  for await (const { item, path } of iterateBlocksAsync(
349
248
  fieldType,
@@ -357,77 +256,6 @@ export async function nonRecursiveFindAllBlocksInNonLocalizedFieldValueAsync(
357
256
  return results;
358
257
  }
359
258
 
360
- /**
361
- * Filter blocks in a field value, removing those that don't match the predicate.
362
- * Creates a new field value containing only blocks that pass the predicate test.
363
- * Preserves the original field value structure and hierarchy.
364
- *
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
367
- * @param predicate - Synchronous function that tests each block. Blocks returning false are removed
368
- * @returns The new field value with filtered blocks
369
- */
370
- export function nonRecursiveFilterBlocksInNonLocalizedFieldValue(
371
- fieldType: ApiTypes.Field['field_type'],
372
- nonLocalizedFieldValue: unknown,
373
- predicate: (item: BlockItemInARequest, path: TreePath) => boolean,
374
- ): unknown {
375
- if (fieldType === 'rich_text') {
376
- const filteredItems: BlockItemInARequest[] = [];
377
-
378
- for (const { item, path } of iterateBlocks(
379
- fieldType,
380
- nonLocalizedFieldValue,
381
- )) {
382
- if (predicate(item, path)) {
383
- filteredItems.push(item);
384
- }
385
- }
386
-
387
- return filteredItems;
388
- }
389
-
390
- if (fieldType === 'single_block') {
391
- for (const { item, path } of iterateBlocks(
392
- fieldType,
393
- nonLocalizedFieldValue,
394
- )) {
395
- if (predicate(item, path)) {
396
- return item;
397
- }
398
- }
399
- return null;
400
- }
401
-
402
- if (fieldType === 'structured_text') {
403
- const structuredTextValue =
404
- nonLocalizedFieldValue as PossibleStructuredTextValue;
405
-
406
- if (!structuredTextValue) {
407
- return null;
408
- }
409
-
410
- const filteredDocument = filterNodes(
411
- structuredTextValue.document,
412
- (node, _parent, path) => {
413
- if (node.type === 'block' || node.type === 'inlineBlock') {
414
- return predicate(node.item, path);
415
- }
416
- return true;
417
- },
418
- );
419
-
420
- return filteredDocument
421
- ? {
422
- schema: 'dast',
423
- document: filteredDocument,
424
- }
425
- : null;
426
- }
427
-
428
- return nonLocalizedFieldValue;
429
- }
430
-
431
259
  /**
432
260
  * Filter blocks in a field value, removing those that don't match the predicate.
433
261
  * Creates a new field value containing only blocks that pass the predicate test.
@@ -441,10 +269,10 @@ export function nonRecursiveFilterBlocksInNonLocalizedFieldValue(
441
269
  export async function nonRecursiveFilterBlocksInNonLocalizedFieldValueAsync(
442
270
  fieldType: ApiTypes.Field['field_type'],
443
271
  nonLocalizedFieldValue: unknown,
444
- predicate: (item: BlockItemInARequest, path: TreePath) => Promise<boolean>,
272
+ predicate: (item: BlockInRequest, path: TreePath) => Promise<boolean>,
445
273
  ): Promise<unknown> {
446
274
  if (fieldType === 'rich_text') {
447
- const filteredItems: BlockItemInARequest[] = [];
275
+ const filteredItems: BlockInRequest[] = [];
448
276
 
449
277
  for await (const { item, path } of iterateBlocksAsync(
450
278
  fieldType,
@@ -499,35 +327,6 @@ export async function nonRecursiveFilterBlocksInNonLocalizedFieldValueAsync(
499
327
  return nonLocalizedFieldValue;
500
328
  }
501
329
 
502
- /**
503
- * Reduce all blocks in a field value to a single value by applying a reducer function.
504
- * Processes each block in the non-localized field value and accumulates the results into a single value.
505
- *
506
- * @template R - The type of the accumulated result
507
- * @param fieldType - The type of DatoCMS field definition that determines how the value is processed
508
- * @param nonLocalizedFieldValue - The non-localized field value containing blocks to reduce
509
- * @param reducer - Synchronous function that processes each block and updates the accumulator
510
- * @param initialValue - The initial value for the accumulator
511
- * @returns The final accumulated value
512
- */
513
- export function nonRecursiveReduceBlocksInNonLocalizedFieldValue<R>(
514
- fieldType: ApiTypes.Field['field_type'],
515
- nonLocalizedFieldValue: unknown,
516
- reducer: (accumulator: R, item: BlockItemInARequest, path: TreePath) => R,
517
- initialValue: R,
518
- ): R {
519
- let accumulator = initialValue;
520
-
521
- for (const { item, path } of iterateBlocks(
522
- fieldType,
523
- nonLocalizedFieldValue,
524
- )) {
525
- accumulator = reducer(accumulator, item, path);
526
- }
527
-
528
- return accumulator;
529
- }
530
-
531
330
  /**
532
331
  * Reduce all blocks in a field value to a single value by applying a reducer function.
533
332
  * Processes each block in the non-localized field value and accumulates the results into a single value.
@@ -542,11 +341,7 @@ export function nonRecursiveReduceBlocksInNonLocalizedFieldValue<R>(
542
341
  export async function nonRecursiveReduceBlocksInNonLocalizedFieldValueAsync<R>(
543
342
  fieldType: ApiTypes.Field['field_type'],
544
343
  nonLocalizedFieldValue: unknown,
545
- reducer: (
546
- accumulator: R,
547
- item: BlockItemInARequest,
548
- path: TreePath,
549
- ) => Promise<R>,
344
+ reducer: (accumulator: R, item: BlockInRequest, path: TreePath) => Promise<R>,
550
345
  initialValue: R,
551
346
  ): Promise<R> {
552
347
  let accumulator = initialValue;
@@ -561,32 +356,6 @@ export async function nonRecursiveReduceBlocksInNonLocalizedFieldValueAsync<R>(
561
356
  return accumulator;
562
357
  }
563
358
 
564
- /**
565
- * Check if any block in the non-localized field value matches the predicate function.
566
- * Returns true as soon as the first matching block is found (short-circuit evaluation).
567
- *
568
- * @param fieldType - The type of DatoCMS field definition that determines how the value is processed
569
- * @param nonLocalizedFieldValue - The non-localized field value containing blocks to test
570
- * @param predicate - Synchronous function that tests each block. Should return true for matching blocks
571
- * @returns True if any block matches, false otherwise
572
- */
573
- export function nonRecursiveSomeBlocksInNonLocalizedFieldValue(
574
- fieldType: ApiTypes.Field['field_type'],
575
- nonLocalizedFieldValue: unknown,
576
- predicate: (item: BlockItemInARequest, path: TreePath) => boolean,
577
- ): boolean {
578
- for (const { item, path } of iterateBlocks(
579
- fieldType,
580
- nonLocalizedFieldValue,
581
- )) {
582
- if (predicate(item, path)) {
583
- return true;
584
- }
585
- }
586
-
587
- return false;
588
- }
589
-
590
359
  /**
591
360
  * Check if any block in the non-localized field value matches the predicate function.
592
361
  * Returns true as soon as the first matching block is found (short-circuit evaluation).
@@ -599,7 +368,7 @@ export function nonRecursiveSomeBlocksInNonLocalizedFieldValue(
599
368
  export async function nonRecursiveSomeBlocksInNonLocalizedFieldValueAsync(
600
369
  fieldType: ApiTypes.Field['field_type'],
601
370
  nonLocalizedFieldValue: unknown,
602
- predicate: (item: BlockItemInARequest, path: TreePath) => Promise<boolean>,
371
+ predicate: (item: BlockInRequest, path: TreePath) => Promise<boolean>,
603
372
  ): Promise<boolean> {
604
373
  for await (const { item, path } of iterateBlocksAsync(
605
374
  fieldType,
@@ -613,29 +382,6 @@ export async function nonRecursiveSomeBlocksInNonLocalizedFieldValueAsync(
613
382
  return false;
614
383
  }
615
384
 
616
- /**
617
- * Check if every block in the non-localized field value matches the predicate function.
618
- * Returns false as soon as the first non-matching block is found (short-circuit evaluation).
619
- *
620
- * @param fieldType - The type of DatoCMS field definition that determines how the value is processed
621
- * @param nonLocalizedFieldValue - The non-localized field value containing blocks to test
622
- * @param predicate - Synchronous function that tests each block. Should return true for valid blocks
623
- * @returns True if all blocks match, false otherwise
624
- */
625
- export function nonRecursiveEveryBlockInNonLocalizedFieldValue(
626
- fieldType: ApiTypes.Field['field_type'],
627
- nonLocalizedFieldValue: unknown,
628
- predicate: (item: BlockItemInARequest, path: TreePath) => boolean,
629
- ): boolean {
630
- return !nonRecursiveSomeBlocksInNonLocalizedFieldValue(
631
- fieldType,
632
- nonLocalizedFieldValue,
633
- (item, path) => {
634
- return !predicate(item, path);
635
- },
636
- );
637
- }
638
-
639
385
  /**
640
386
  * Check if every block in the non-localized field value matches the predicate function.
641
387
  * Returns false as soon as the first non-matching block is found (short-circuit evaluation).
@@ -648,7 +394,7 @@ export function nonRecursiveEveryBlockInNonLocalizedFieldValue(
648
394
  export async function nonRecursiveEveryBlockInNonLocalizedFieldValueAsync(
649
395
  fieldType: ApiTypes.Field['field_type'],
650
396
  nonLocalizedFieldValue: unknown,
651
- predicate: (item: BlockItemInARequest, path: TreePath) => Promise<boolean>,
397
+ predicate: (item: BlockInRequest, path: TreePath) => Promise<boolean>,
652
398
  ): Promise<boolean> {
653
399
  return !(await nonRecursiveSomeBlocksInNonLocalizedFieldValueAsync(
654
400
  fieldType,