@sanity/agent-mutations 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,452 @@
1
+ import { InsertOperation, ManifestField, ManifestSchemaType, PatchOperations, ValidationContext, ValidationError, ValidationResult } from "@sanity/agent-schema";
2
+ import { SanityClient, Transaction } from "@sanity/client";
3
+ import { SanityDocumentLike } from "@sanity/types";
4
+ /** Patch operations structure */
5
+ interface PatchOperations$3 {
6
+ set?: Array<{
7
+ path: string;
8
+ value?: unknown;
9
+ }>;
10
+ unset?: string[];
11
+ append?: Array<{
12
+ path: string;
13
+ items: unknown[];
14
+ }>;
15
+ insertBefore?: InsertOperation[];
16
+ insertAfter?: InsertOperation[];
17
+ }
18
+ interface BuildTransactionOptions {
19
+ client: SanityClient;
20
+ documentId: string;
21
+ operations: PatchOperations$3;
22
+ setIfMissing: Record<string, unknown>;
23
+ }
24
+ /**
25
+ * Builds a Sanity transaction from patch operations and setIfMissing patches.
26
+ *
27
+ * The order of operations follows Sanity's recommended sequence:
28
+ * 1. setIfMissing - ensure parent paths exist
29
+ * 2. insertBefore/insertAfter - array shape changes (native insert semantics)
30
+ * 3. set - replace values at paths
31
+ * 4. unset - remove values at paths
32
+ * 5. append - insert items after the specified path (using insert: { after })
33
+ *
34
+ * This order ensures that:
35
+ * - Arrays exist before inserting into them
36
+ * - Insert operations don't conflict with set operations on the same array
37
+ *
38
+ * @param options - The transaction building options
39
+ * @returns A Sanity transaction ready to be committed
40
+ */
41
+ declare function buildPatchTransaction(options: BuildTransactionOptions): Transaction;
42
+ /**
43
+ * Check if an array field contains only primitive types
44
+ */
45
+ declare function isPrimitiveArray(field: ManifestField | undefined): boolean;
46
+ /**
47
+ * Check if a path contains numeric array index notation like [0], [1], etc.
48
+ */
49
+ declare function hasNumericIndex(path: string): boolean;
50
+ /**
51
+ * Parse a path with numeric index to extract components
52
+ * Finds the FIRST numeric index in the path, even if there's _key notation before it
53
+ * Example: "sections[0].bodyParagraphs[1]" → {basePath: "sections", index: 0, restPath: ".bodyParagraphs[1]"}
54
+ * Example: "sections[_key=="x"].bodyParagraphs[0]" → {basePath: "sections[_key=="x"].bodyParagraphs", index: 0, restPath: ""}
55
+ */
56
+ declare function parseArrayIndex(path: string): {
57
+ basePath: string;
58
+ index: number;
59
+ restPath: string;
60
+ } | null;
61
+ /**
62
+ * Navigate to an array in the document using a dot-notation path
63
+ * Example: "sections.bodyParagraphs" in document {sections: {bodyParagraphs: [...]}}
64
+ */
65
+ declare function getArrayAtPath(document: Record<string, unknown>, path: string): unknown[] | null;
66
+ /**
67
+ * Get the _key value at a specific index in an object array
68
+ * Returns null if the item doesn't have a _key or index is out of bounds
69
+ */
70
+ declare function getKeyAtIndex(array: unknown[], index: number): string | null;
71
+ /** Insert operation structure for insertBefore/insertAfter */
72
+ interface InsertOperation$1 {
73
+ arrayPath: string;
74
+ key: string;
75
+ items: unknown[];
76
+ }
77
+ /**
78
+ * Convert array index operations to proper format
79
+ * - Object arrays: [0] → [_key=="actualKey"]
80
+ * - Primitive arrays: All operations on same array are merged into single SET
81
+ */
82
+ declare function convertArrayIndexOperations(operations: {
83
+ set?: Array<{
84
+ path: string;
85
+ value?: unknown;
86
+ }>;
87
+ unset?: string[];
88
+ append?: Array<{
89
+ path: string;
90
+ items: unknown[];
91
+ }>;
92
+ insertBefore?: InsertOperation$1[];
93
+ insertAfter?: InsertOperation$1[];
94
+ }, typeSchema: ManifestSchemaType, allSchemas: ManifestSchemaType[], document: Record<string, unknown>): {
95
+ set?: Array<{
96
+ path: string;
97
+ value?: unknown;
98
+ }>;
99
+ unset?: string[];
100
+ append?: Array<{
101
+ path: string;
102
+ items: unknown[];
103
+ }>;
104
+ insertBefore?: InsertOperation$1[];
105
+ insertAfter?: InsertOperation$1[];
106
+ };
107
+ interface SkippedItem {
108
+ arrayPath: string;
109
+ index: number;
110
+ type: string | undefined;
111
+ reason: string;
112
+ }
113
+ interface FilterResult {
114
+ /** Whether any errors are structural (not per-item) — if true, caller should throw all errors */
115
+ hasStructuralErrors: boolean;
116
+ /** Items that were filtered out */
117
+ skippedItems: SkippedItem[];
118
+ /** Cleaned SET operations (invalid items removed from array values) */
119
+ set?: Array<{
120
+ path: string;
121
+ value?: unknown;
122
+ }>;
123
+ /** Cleaned APPEND operations */
124
+ append?: Array<{
125
+ path: string;
126
+ items: unknown[];
127
+ }>;
128
+ /** Cleaned INSERT operations */
129
+ insertBefore?: InsertOperation[];
130
+ insertAfter?: InsertOperation[];
131
+ }
132
+ /**
133
+ * Classify validation errors and filter invalid array items from operations.
134
+ *
135
+ * Errors with `itemIndex` and `arrayPath` are per-item — the invalid item can
136
+ * be removed and the rest of the array written successfully.
137
+ *
138
+ * Errors without these fields are structural — wrong path, not an array, etc.
139
+ * These cannot be fixed by filtering items.
140
+ */
141
+ declare function filterInvalidArrayItems(ops: {
142
+ set?: Array<{
143
+ path: string;
144
+ value?: unknown;
145
+ }>;
146
+ append?: Array<{
147
+ path: string;
148
+ items: unknown[];
149
+ }>;
150
+ insertBefore?: InsertOperation[];
151
+ insertAfter?: InsertOperation[];
152
+ }, errors: ValidationError[]): FilterResult;
153
+ /**
154
+ * Format a partial write error message that tells the agent exactly
155
+ * what was written and what needs to be fixed via insertAfter.
156
+ */
157
+ declare function formatPartialWriteError(skippedItems: SkippedItem[], totalItemsByPath: Map<string, number>): string;
158
+ /**
159
+ * Generate a random 12-character key for Sanity array items
160
+ * Uses lowercase letters and numbers only
161
+ */
162
+ declare function generateKey(): string;
163
+ /**
164
+ * Recursively add missing _key fields to all objects in arrays
165
+ * This ensures Sanity array items have proper keys for tracking and updates
166
+ *
167
+ * @param value - The value to process (can be any type)
168
+ * @param options - Optional configuration
169
+ * @param options.ensureRootKey - If true, ensure the top-level object has a _key (for array item replacements)
170
+ * @returns The same value with _key fields added to array items where missing
171
+ */
172
+ declare function addMissingKeys(value: unknown, options?: {
173
+ ensureRootKey?: boolean;
174
+ }): unknown;
175
+ /**
176
+ * Result of duplicate key regeneration
177
+ */
178
+ interface RegenerateDuplicateKeysResult {
179
+ value: unknown;
180
+ keyMapping: Map<string, string>;
181
+ duplicatesFound: number;
182
+ }
183
+ /**
184
+ * Regenerate only duplicate _key fields in a document
185
+ * This preserves unique keys and only regenerates keys that appear more than once.
186
+ * The first occurrence of a duplicate key is kept, subsequent occurrences are regenerated.
187
+ *
188
+ * @param value - The value to process (can be any type)
189
+ * @returns Object containing the transformed value, key mapping, and count of duplicates found
190
+ */
191
+ declare function regenerateDuplicateKeys(value: unknown): RegenerateDuplicateKeysResult;
192
+ /**
193
+ * Key mapping utilities for mutation tools.
194
+ * Handles transformation of paths and keys after key regeneration.
195
+ */
196
+ /**
197
+ * Normalize _key selector quote style from single quotes to double quotes.
198
+ * This ensures consistent path format across the codebase.
199
+ *
200
+ * @param path - The path to normalize
201
+ * @returns The path with single quotes converted to double quotes in _key selectors
202
+ *
203
+ * @example
204
+ * normalizeKeyQuotes("body[_key=='abc']") // "body[_key=\"abc\"]"
205
+ * normalizeKeyQuotes("body[_key==\"abc\"]") // "body[_key=\"abc\"]" (unchanged)
206
+ */
207
+ declare function normalizeKeyQuotes(path: string): string;
208
+ /**
209
+ * Transform a path string by replacing old key references with new ones based on the key mapping.
210
+ * This is used after key regeneration to ensure paths reference the correct regenerated keys.
211
+ *
212
+ * The function applies transformations iteratively until no more matches are found.
213
+ * This handles cases where multiple nested keys need to be replaced.
214
+ *
215
+ * The function tries multiple matching strategies per iteration:
216
+ * 1. Direct exact match of the full path
217
+ * 2. Longest prefix match - replaces the longest matching prefix with its mapped value
218
+ *
219
+ * @param path - The path string to transform (e.g., "content[_key=='oldKey'].image" or "content.0.image")
220
+ * @param keyMapping - Map of old paths to new paths from key regeneration
221
+ * @returns The transformed path with updated key references
222
+ *
223
+ * @example
224
+ * const keyMapping = new Map([
225
+ * ["content.0", "content[_key=='abc123']"],
226
+ * ["content[_key=='oldKey']", "content[_key=='abc123']"]
227
+ * ])
228
+ * transformPathWithKeyMapping("content.0.image", keyMapping)
229
+ * // Returns: "content[_key=='abc123'].image"
230
+ *
231
+ * transformPathWithKeyMapping("content[_key=='oldKey'].image", keyMapping)
232
+ * // Returns: "content[_key=='abc123'].image"
233
+ *
234
+ * // Multiple nested transformations:
235
+ * transformPathWithKeyMapping("content[_key=='old1'].media[_key=='old2'].asset", keyMapping)
236
+ * // Applies transformations iteratively until fully transformed
237
+ */
238
+ declare function transformPathWithKeyMapping(path: string, keyMapping?: Map<string, string>): string;
239
+ /**
240
+ * Map a single key through a key mapping.
241
+ * Used for transforming anchor keys in insertBefore/insertAfter operations.
242
+ *
243
+ * @param key - The key to map
244
+ * @param keyMapping - The key mapping (Record<string, string> or unknown)
245
+ * @returns The mapped key, or the original key if no mapping exists
246
+ */
247
+ declare function mapKeyThroughKeyMapping(key: string, keyMapping: unknown): string;
248
+ /** Patch operations structure (matches prepareOperations) */
249
+ interface PatchOperations$2 {
250
+ set?: Array<{
251
+ path: string;
252
+ value?: unknown;
253
+ }>;
254
+ unset?: string[];
255
+ append?: Array<{
256
+ path: string;
257
+ items: unknown[];
258
+ }>;
259
+ insertBefore?: Array<{
260
+ arrayPath: string;
261
+ key: string;
262
+ items: unknown[];
263
+ }>;
264
+ insertAfter?: Array<{
265
+ arrayPath: string;
266
+ key: string;
267
+ items: unknown[];
268
+ }>;
269
+ }
270
+ interface NormalizeOptions {
271
+ typeSchema: ManifestSchemaType;
272
+ allSchemas: ManifestSchemaType[];
273
+ }
274
+ /**
275
+ * Normalize internationalized array items in patch operations to match the
276
+ * schema's expected format (v4 or v5).
277
+ *
278
+ * This runs as a step in the prepareOperations pipeline, after key normalization
279
+ * and before validation. It inspects each operation's target field: if the field
280
+ * is an internationalized array, it checks each item and converts between v4/v5
281
+ * format as needed.
282
+ */
283
+ declare function normalizeInternationalizedArrays(operations: PatchOperations$2, options: NormalizeOptions): PatchOperations$2;
284
+ /** Patch operations structure */
285
+ interface PatchOperations$1 {
286
+ set?: Array<{
287
+ path: string;
288
+ value?: unknown;
289
+ }>;
290
+ unset?: string[];
291
+ append?: Array<{
292
+ path: string;
293
+ items: unknown[];
294
+ }>;
295
+ insertBefore?: InsertOperation[];
296
+ insertAfter?: InsertOperation[];
297
+ [key: string]: unknown;
298
+ }
299
+ /** Result of patch operations normalization */
300
+ interface PatchNormalizationResult<T = PatchOperations$1> {
301
+ normalized: T;
302
+ validationErrors: ValidationError[];
303
+ /** setIfMissing patches for parent paths (ensures nested paths exist) */
304
+ setIfMissing: Record<string, unknown>;
305
+ }
306
+ interface NormalizePatchOptions {
307
+ /** Whether to add _strengthenOnPublish metadata for draft/version references. Defaults to true. */
308
+ applyStrengthenOnPublish?: boolean;
309
+ /** The existing document state, used to resolve append positions */
310
+ existingDocument?: Record<string, unknown>;
311
+ }
312
+ /**
313
+ * Normalizes reference objects in patch operations with unified logic.
314
+ *
315
+ * Handles the patch tool's operation format:
316
+ * - set: Array of {path, value} objects
317
+ * - unset: Array of path strings (no normalization needed)
318
+ * - append: Array of {path, items} objects
319
+ *
320
+ * Also resolves append paths to use the last item's _key for reliable ordering,
321
+ * and regenerates duplicate keys.
322
+ *
323
+ * @param client - Sanity client for document lookups
324
+ * @param operations - The patch operations object
325
+ * @param documentType - The document type name
326
+ * @param fullSchema - The full Sanity schema array
327
+ * @param targetDocumentId - The ID of the document being patched
328
+ * @param options - Optional configuration
329
+ * @returns Result object with normalized operations and validation errors
330
+ */
331
+ declare function normalizePatchOperations<T extends PatchOperations$1>(client: SanityClient, operations: T, documentType: string, fullSchema: ManifestSchemaType[], targetDocumentId: string, options?: NormalizePatchOptions): Promise<PatchNormalizationResult<T>>;
332
+ interface SchemaFieldDefinition {
333
+ type?: string;
334
+ name?: string;
335
+ of?: Array<{
336
+ type?: string;
337
+ name?: string;
338
+ to?: Array<{
339
+ type: string;
340
+ }>;
341
+ weak?: boolean;
342
+ }>;
343
+ to?: Array<{
344
+ type: string;
345
+ }>;
346
+ weak?: boolean;
347
+ }
348
+ /**
349
+ * Gets the reference field definition from schema, handling nested paths.
350
+ * Uses resolveFieldSchema which has special handling for portable text
351
+ * block.markDefs and other complex nested structures.
352
+ */
353
+ declare function getReferenceFieldDefinition(fieldPath: string, typeSchema: ManifestSchemaType, fullSchema: ManifestSchemaType[]): SchemaFieldDefinition | null;
354
+ /**
355
+ * Gets the schema definition for items in an array field
356
+ * Returns null for union arrays (arrays with multiple types) to signal
357
+ * that items need individual schema matching based on their _type
358
+ */
359
+ declare function getArrayItemSchema(arrayFieldPath: string, typeSchema: ManifestSchemaType, fullSchema: ManifestSchemaType[]): SchemaFieldDefinition | null;
360
+ /**
361
+ * Clear the document cache.
362
+ * Should be called at the start of each normalization operation.
363
+ */
364
+ declare function clearDocumentCache(): void;
365
+ /**
366
+ * Recursively traverses an object/array and normalizes all reference objects
367
+ */
368
+ declare function traverseAndNormalize(client: SanityClient, value: unknown, currentPath: string, typeSchema: ManifestSchemaType | SchemaFieldDefinition, fullSchema: ManifestSchemaType[], targetDocumentId: string, validationErrors: ValidationError[], applyStrengthenOnPublish: boolean, parentObjectType?: string): Promise<unknown>;
369
+ /**
370
+ * Normalizes all reference objects in a document with unified logic.
371
+ *
372
+ * Performs all reference normalization in a single pass:
373
+ * - Schema-based weak reference detection
374
+ * - Draft/versioned ID conversion to published IDs
375
+ * - Validation with batch error collection
376
+ * - Adding _weak: true and _strengthenOnPublish metadata
377
+ *
378
+ * @param client - Sanity client for document lookups
379
+ * @param document - The document object to normalize (must have _type and _id)
380
+ * @param fullSchema - The full Sanity schema array
381
+ * @returns Result object with normalized document and validation errors
382
+ *
383
+ * @example
384
+ * ```typescript
385
+ * const result = await normalizeDocumentReferences(
386
+ * client,
387
+ * document,
388
+ * schema,
389
+ * )
390
+ *
391
+ * if (result.validationErrors.length > 0) {
392
+ * // Handle validation errors
393
+ * }
394
+ *
395
+ * const normalizedDoc = result.normalized
396
+ * ```
397
+ */
398
+ declare function normalizeDocumentReferences(client: SanityClient, document: SanityDocumentLike, schema: ManifestSchemaType[], applyStrengthenOnPublish?: boolean): Promise<{
399
+ normalized: SanityDocumentLike;
400
+ validationErrors: ValidationError[];
401
+ }>;
402
+ declare function acceptsFlatPortableText(fieldPath: string, typeSchema: ManifestSchemaType, allSchemas: ManifestSchemaType[]): boolean;
403
+ /**
404
+ * Stricter check: the field's array accepts ONLY block items (no custom block
405
+ * types like tableBlock, codeBlock, image, etc.).
406
+ *
407
+ * This is the bar for *deterministic* markdown conversion. When an array mixes
408
+ * `block` with custom types, markdown's tables/code fences/etc. have no faithful
409
+ * mechanical mapping onto those custom types — so the deterministic converter
410
+ * would silently lose them (tables → bullet lists, fences → plain paragraphs).
411
+ * Such fields are routed to the generative path instead, where the worker has
412
+ * the schema and a raw-Portable-Text tool to build the custom blocks correctly.
413
+ */
414
+ declare function acceptsOnlyFlatPortableText(fieldPath: string, typeSchema: ManifestSchemaType, allSchemas: ManifestSchemaType[]): boolean;
415
+ /**
416
+ * Check whether a document type has any array field that accepts block items.
417
+ * Used to decide whether to include the markdown tool for a worker.
418
+ */
419
+ declare function hasAnyFlatPortableTextField(typeSchema: ManifestSchemaType, allSchemas: ManifestSchemaType[]): boolean;
420
+ /** Options for preparing operations */
421
+ interface PrepareOperationsOptions {
422
+ /** Key mapping from duplicate key regeneration */
423
+ keyMapping?: Map<string, string>;
424
+ /** Schema for the document type */
425
+ typeSchema: ManifestSchemaType;
426
+ /** All schemas */
427
+ allSchemas: ManifestSchemaType[];
428
+ /** Current document state */
429
+ document: Record<string, unknown>;
430
+ }
431
+ /**
432
+ * Prepare patch operations for execution.
433
+ *
434
+ * This function:
435
+ * 1. Normalizes key quote style (single to double quotes)
436
+ * 2. Applies key mapping (if provided) to transform regenerated keys
437
+ * 3. Converts array indices to key selectors using document state
438
+ * 4. Converts append to set for arrays that don't exist on the document
439
+ * 5. Normalizes internationalized array items (v4 ↔ v5 format)
440
+ * 6. Adds missing _key fields to array items
441
+ *
442
+ * @param operations - Raw operations from tool params
443
+ * @param options - Preparation options including schema and document state
444
+ * @returns Prepared operations ready for validation and execution
445
+ */
446
+ declare function prepareOperations(operations: PatchOperations, options: PrepareOperationsOptions): PatchOperations;
447
+ /**
448
+ * Validate patch operations against the schema.
449
+ */
450
+ declare function validatePatchOperations(operations: PatchOperations, documentType: string, schema: ManifestSchemaType[], context: ValidationContext): Promise<ValidationResult>;
451
+ export { type SchemaFieldDefinition, acceptsFlatPortableText, acceptsOnlyFlatPortableText, addMissingKeys, buildPatchTransaction, clearDocumentCache, convertArrayIndexOperations, filterInvalidArrayItems, formatPartialWriteError, generateKey, getArrayAtPath, getArrayItemSchema, getKeyAtIndex, getReferenceFieldDefinition, hasAnyFlatPortableTextField, hasNumericIndex, isPrimitiveArray, mapKeyThroughKeyMapping, normalizeDocumentReferences, normalizeInternationalizedArrays, normalizeKeyQuotes, normalizePatchOperations, parseArrayIndex, prepareOperations, regenerateDuplicateKeys, transformPathWithKeyMapping, traverseAndNormalize, validatePatchOperations };
452
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/buildPatchTransaction.ts","../src/convertArrayIndices.ts","../src/filterInvalidArrayItems.ts","../src/generateKey.ts","../src/keyMapping.ts","../src/normalizeInternationalizedArrays.ts","../src/normalizePatchOperations.ts","../src/normalizeReferences.ts","../src/portableTextCompat.ts","../src/prepareOperations.ts","../src/validatePatchOperations.ts"],"mappings":";;;;UAkBU,iBAAA;EACR,GAAA,GAAM,KAAA;IAAQ,IAAA;IAAc,KAAA;EAAA;EAC5B,KAAA;EACA,MAAA,GAAS,KAAA;IAAQ,IAAA;IAAc,KAAA;EAAA;EAC/B,YAAA,GAAe,eAAA;EACf,WAAA,GAAc,eAAA;AAAA;AAAA,UAcN,uBAAA;EACR,MAAA,EAAQ,YAAA;EACR,UAAA;EACA,UAAA,EAAY,iBAAA;EACZ,YAAA,EAAc,MAAA;AAAA;;;;;;;;;;;AAkJhB;;;;;;;iBAAgB,qBAAA,CAAsB,OAAA,EAAS,uBAA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