@sanity/client 8.1.0 → 8.2.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.
@@ -1224,6 +1224,462 @@ declare function _listen<R extends Record<string, Any> = Record<string, Any>>(th
1224
1224
  * @public
1225
1225
  */
1226
1226
  declare function _listen<R extends Record<string, Any> = Record<string, Any>, Opts extends ListenOptions | ResumableListenOptions = ListenOptions | ResumableListenOptions>(this: SanityClient | ObservableSanityClient, query: string, params?: ListenParams, options?: Opts): Observable<ListenEventFromOptions<R, Opts>>;
1227
+ /** @internal */
1228
+ declare const possibleRequestOptions: readonly ['headers', 'signal', 'tag', 'timeout', 'token'];
1229
+ /**
1230
+ * Request options honored by the collaboration comments methods.
1231
+ *
1232
+ * @alpha
1233
+ */
1234
+ type CollaborationCommentsRequestOptions = Pick<RequestOptions, (typeof possibleRequestOptions)[number]>;
1235
+ /**
1236
+ * Options for collaboration comments write methods.
1237
+ *
1238
+ * @alpha
1239
+ */
1240
+ type CollaborationCommentsWriteOptions = CollaborationCommentsRequestOptions & {
1241
+ /** Transaction ID to associate the write with */
1242
+ transactionId?: string;
1243
+ };
1244
+ /**
1245
+ * Listener options for `collaboration.comments.listen`.
1246
+ *
1247
+ * `includeAllVersions` is left out: comments are stored as `sanity.comment`
1248
+ * documents with no drafts or versions, so it would never make a difference.
1249
+ *
1250
+ * @alpha
1251
+ */
1252
+ type CollaborationCommentsListenOptions = Omit<ListenOptions, 'includeAllVersions'> | Omit<ResumableListenOptions, 'includeAllVersions'>;
1253
+ /**
1254
+ * Status of a comment thread. Replies always share the status of their parent comment.
1255
+ *
1256
+ * @alpha
1257
+ */
1258
+ type CollaborationCommentStatus = 'open' | 'resolved';
1259
+ /**
1260
+ * Emoji short names that can be used as comment reactions.
1261
+ *
1262
+ * @alpha
1263
+ */
1264
+ type CollaborationCommentReactionShortName = ':-1:' | ':+1:' | ':eyes:' | ':heart:' | ':heavy_plus_sign:' | ':rocket:';
1265
+ /**
1266
+ * A single Portable Text block, as used in comment messages and content snapshots.
1267
+ *
1268
+ * @alpha
1269
+ */
1270
+ interface CollaborationCommentPortableTextBlock {
1271
+ _type: string;
1272
+ children: Array<{
1273
+ _type: string;
1274
+ [key: string]: Any;
1275
+ }>;
1276
+ [key: string]: Any;
1277
+ }
1278
+ /**
1279
+ * Comment message, as an array of Portable Text blocks.
1280
+ *
1281
+ * @alpha
1282
+ */
1283
+ type CollaborationCommentMessage = CollaborationCommentPortableTextBlock[];
1284
+ /**
1285
+ * The text an inline comment was anchored to, resolved by the API when the
1286
+ * comment was created.
1287
+ *
1288
+ * Holds one entry per Portable Text block the selection spans, keyed by the
1289
+ * block it came from. `text` is the plain text of that block with the selected
1290
+ * part wrapped in the marker characters `\uF000` (start) and `\uF001` (end).
1291
+ *
1292
+ * @alpha
1293
+ */
1294
+ interface CollaborationCommentSelection {
1295
+ type: 'text';
1296
+ value: {
1297
+ _key: string;
1298
+ text: string;
1299
+ }[];
1300
+ }
1301
+ /**
1302
+ * A comment document, as stored by the Comments API.
1303
+ *
1304
+ * @alpha
1305
+ */
1306
+ interface CollaborationCommentDocument extends SanityDocument {
1307
+ _type: 'sanity.comment';
1308
+ _system?: {
1309
+ /** ID of the user that created the comment */
1310
+ createdBy?: string;
1311
+ };
1312
+ /** ID shared by a top-level comment and all of its replies */
1313
+ threadId?: string;
1314
+ /** Set on replies, pointing to the comment being replied to */
1315
+ parentCommentId?: string;
1316
+ message: CollaborationCommentMessage;
1317
+ reactions: {
1318
+ _key: string;
1319
+ shortName: CollaborationCommentReactionShortName;
1320
+ userId: string;
1321
+ addedAt: string;
1322
+ }[];
1323
+ /** Arbitrary metadata stored with the comment by the creating application */
1324
+ context?: Record<string, unknown>;
1325
+ target: {
1326
+ /** Global document reference (`resourceType:resourceId:documentId`, using the published document ID) */
1327
+ document: {
1328
+ _ref: `${string}:${string}:${string}`;
1329
+ _type: 'globalDocumentReference';
1330
+ _weak: true;
1331
+ };
1332
+ documentType: string;
1333
+ /** The exact document ID the comment was created against, e.g. a draft or version ID */
1334
+ sourceDocumentId: string;
1335
+ documentRevisionId?: string;
1336
+ /**
1337
+ * Set for field and inline comments. `field` is the `path` the comment was
1338
+ * created with; `selection` is set for inline comments only.
1339
+ */
1340
+ path?: {
1341
+ field: string;
1342
+ selection?: CollaborationCommentSelection;
1343
+ };
1344
+ };
1345
+ /**
1346
+ * Copy of the commented content, as it looked when the comment was created.
1347
+ * Set for inline comments only, and holds just the selected fragment of each
1348
+ * Portable Text block the selection spans.
1349
+ */
1350
+ contentSnapshot?: CollaborationCommentPortableTextBlock[];
1351
+ status: CollaborationCommentStatus;
1352
+ /** Set when the message has been updated after creation */
1353
+ lastEditedAt?: string;
1354
+ }
1355
+ /**
1356
+ * Inline text selection within a Portable Text field.
1357
+ * Each endpoint pairs the `_key` of a Portable Text block with a character
1358
+ * offset into that block's plain text.
1359
+ *
1360
+ * @alpha
1361
+ */
1362
+ interface CollaborationCommentRange {
1363
+ start: {
1364
+ _key: string;
1365
+ offset: number;
1366
+ };
1367
+ end: {
1368
+ _key: string;
1369
+ offset: number;
1370
+ };
1371
+ }
1372
+ /**
1373
+ * Target for a top-level comment. Inline selections require both `path` and
1374
+ * `range`; field-level comments may set `path` alone.
1375
+ *
1376
+ * The created comment stores this in a different shape: `path` becomes
1377
+ * `target.path.field`, and `range` is resolved against the document into
1378
+ * `target.path.selection` and `contentSnapshot` rather than being stored.
1379
+ *
1380
+ * @alpha
1381
+ */
1382
+ type CollaborationCommentTarget = {
1383
+ documentId: string;
1384
+ documentType: string;
1385
+ documentRevisionId?: string;
1386
+ } & ({
1387
+ /** Path to the field containing the inline comment selection */
1388
+ path: string;
1389
+ range: CollaborationCommentRange;
1390
+ } | {
1391
+ /** Path to the commented field */
1392
+ path?: string;
1393
+ range?: never;
1394
+ });
1395
+ /**
1396
+ * Comment to create with `collaboration.comments.create`.
1397
+ *
1398
+ * A top-level comment requires `target`; a reply requires `parentCommentId` (never both).
1399
+ * Replies inherit `target`, `status`, and `threadId` from the parent comment.
1400
+ *
1401
+ * ### Examples
1402
+ *
1403
+ * #### Top-level comment
1404
+ * ```ts
1405
+ * // `message` is an array of Portable Text blocks
1406
+ * await client.collaboration.comments.create({
1407
+ * message,
1408
+ * target: {documentId: 'doc-1', documentType: 'article'},
1409
+ * })
1410
+ * ```
1411
+ *
1412
+ * #### Reply
1413
+ * ```ts
1414
+ * await client.collaboration.comments.create({
1415
+ * message,
1416
+ * parentCommentId: 'comment-1',
1417
+ * })
1418
+ * ```
1419
+ *
1420
+ * @alpha
1421
+ */
1422
+ type CollaborationCommentCreate = {
1423
+ /** Provide to control the ID of the created comment document */
1424
+ _id?: string;
1425
+ message: CollaborationCommentMessage;
1426
+ context?: Record<string, unknown>;
1427
+ } & ({
1428
+ target: CollaborationCommentTarget;
1429
+ threadId?: string;
1430
+ parentCommentId?: never;
1431
+ } | {
1432
+ parentCommentId: string;
1433
+ target?: never;
1434
+ threadId?: never;
1435
+ });
1436
+ /**
1437
+ * Fields that can be updated on an existing comment.
1438
+ *
1439
+ * @alpha
1440
+ */
1441
+ interface CollaborationCommentUpdate {
1442
+ /** Replaces the current message */
1443
+ message?: CollaborationCommentMessage;
1444
+ /** Cascades to the comment's replies */
1445
+ status?: CollaborationCommentStatus;
1446
+ /**
1447
+ * Re-anchors the comment within the field and source document it already
1448
+ * targets. Pass `null` to remove the selection and leave a field-level
1449
+ * comment.
1450
+ */
1451
+ range?: CollaborationCommentRange | null;
1452
+ }
1453
+ /**
1454
+ * Comments on the configured organization resource.
1455
+ *
1456
+ * Requires `collaboration.organizationId`, plus either `resource` or `projectId` and `dataset`.
1457
+ *
1458
+ * @alpha
1459
+ */
1460
+ declare class ObservableCollaborationCommentsClient {
1461
+ #private;
1462
+ constructor(client: ObservableSanityClient, httpRequest: HttpRequest);
1463
+ /**
1464
+ * Create a comment or reply on the configured resource.
1465
+ *
1466
+ * A top-level comment requires `target`; a reply requires `parentCommentId` (never both).
1467
+ * Replies inherit `target`, `status`, and `threadId` from the parent comment.
1468
+ *
1469
+ * @param body - Comment to create
1470
+ * @param options - Optional request options
1471
+ * @returns The created comment
1472
+ */
1473
+ create(body: CollaborationCommentCreate, options?: CollaborationCommentsWriteOptions): Observable<CollaborationCommentDocument>;
1474
+ /**
1475
+ * Update an existing comment.
1476
+ *
1477
+ * Updating `status` cascades to the comment's replies.
1478
+ *
1479
+ * @param id - Comment document ID
1480
+ * @param body - Fields to update
1481
+ * @param options - Optional request options
1482
+ * @returns The updated comment
1483
+ */
1484
+ update(id: string, body: CollaborationCommentUpdate, options?: CollaborationCommentsWriteOptions): Observable<CollaborationCommentDocument>;
1485
+ /**
1486
+ * Delete a comment and its replies.
1487
+ *
1488
+ * @param id - Comment document ID
1489
+ * @param options - Optional request options
1490
+ * @returns Mutation result, where `documentIds` covers the comment and every deleted reply
1491
+ */
1492
+ delete(id: string, options?: CollaborationCommentsWriteOptions): Observable<MultipleMutationResult>;
1493
+ /**
1494
+ * Add the current user's reaction to a comment.
1495
+ *
1496
+ * @param id - Comment document ID
1497
+ * @param shortName - Emoji short name, for example `:+1:`
1498
+ * @param options - Optional request options
1499
+ * @returns The comment, with the reaction applied
1500
+ */
1501
+ addReaction(id: string, shortName: CollaborationCommentReactionShortName, options?: CollaborationCommentsWriteOptions): Observable<CollaborationCommentDocument>;
1502
+ /**
1503
+ * Remove the current user's reaction from a comment.
1504
+ *
1505
+ * @param id - Comment document ID
1506
+ * @param shortName - Emoji short name, for example `:+1:`
1507
+ * @param options - Optional request options
1508
+ * @returns The comment, with the reaction removed
1509
+ */
1510
+ removeReaction(id: string, shortName: CollaborationCommentReactionShortName, options?: CollaborationCommentsWriteOptions): Observable<CollaborationCommentDocument>;
1511
+ /**
1512
+ * Build the global document reference used by `target.document._ref`, for use in
1513
+ * queries and listeners.
1514
+ *
1515
+ * The reference is built from the configured `resource` and the published ID of
1516
+ * the given document ID, since comment references always use published IDs.
1517
+ *
1518
+ * @example
1519
+ * ```ts
1520
+ * client.collaboration.comments.listen(
1521
+ * '*[_type == "sanity.comment" && target.document._ref == $ref]',
1522
+ * {ref: client.collaboration.comments.getTargetDocumentRef('doc-1')},
1523
+ * )
1524
+ * ```
1525
+ *
1526
+ * @param documentId - Document ID, in published, draft or version form
1527
+ * @returns Global document reference, of the form `resourceType:resourceId:documentId`
1528
+ */
1529
+ getTargetDocumentRef(documentId: string): CollaborationCommentDocument['target']['document']['_ref'];
1530
+ /**
1531
+ * Fetch comments on the configured resource.
1532
+ *
1533
+ * Takes the same `query` and `params` as `client.fetch`, and switches from a
1534
+ * GET to a POST for queries too large for the request URL in the same way,
1535
+ * but queries the comments endpoint, which accepts none of the query options
1536
+ * `client.fetch` does (`perspective`, `useCdn`, `filterResponse`,
1537
+ * `resultSourceMap`, stega).
1538
+ *
1539
+ * The query runs against the organization store, which is not scoped to
1540
+ * comments, so filter on `_type == "sanity.comment"`.
1541
+ *
1542
+ * @param query - GROQ-query to perform
1543
+ * @param params - Optional query parameters
1544
+ * @param options - Optional request options
1545
+ */
1546
+ fetch<R = unknown>(query: string, params?: QueryParams, options?: CollaborationCommentsRequestOptions): Observable<R>;
1547
+ /**
1548
+ * Listen for changes to comments on the configured resource.
1549
+ *
1550
+ * Mirrors `client.listen(query, params)`, and emits mutation events.
1551
+ *
1552
+ * @param query - GROQ-filter to listen to changes for
1553
+ * @param params - Optional query parameters
1554
+ */
1555
+ listen(query: string, params?: QueryParams): Observable<MutationEvent<CollaborationCommentDocument>>;
1556
+ /**
1557
+ * Listen for changes to comments on the configured resource.
1558
+ *
1559
+ * Mirrors `client.listen(query, params, options)`.
1560
+ *
1561
+ * @param query - GROQ-filter to listen to changes for
1562
+ * @param params - Optional query parameters
1563
+ * @param options - The same listener options `client.listen` takes, forwarded
1564
+ * to the organization store's listener
1565
+ */
1566
+ listen<Opts extends CollaborationCommentsListenOptions>(query: string, params: QueryParams | undefined, options: Opts): Observable<ListenEventFromOptions<CollaborationCommentDocument, Opts>>;
1567
+ }
1568
+ /**
1569
+ * Comments on the configured organization resource.
1570
+ *
1571
+ * Requires `collaboration.organizationId`, plus either `resource` or `projectId` and `dataset`.
1572
+ *
1573
+ * @alpha
1574
+ */
1575
+ declare class CollaborationCommentsClient {
1576
+ #private;
1577
+ constructor(client: SanityClient, httpRequest: HttpRequest);
1578
+ /**
1579
+ * Create a comment or reply on the configured resource.
1580
+ *
1581
+ * A top-level comment requires `target`; a reply requires `parentCommentId` (never both).
1582
+ * Replies inherit `target`, `status`, and `threadId` from the parent comment.
1583
+ *
1584
+ * @param body - Comment to create
1585
+ * @param options - Optional request options
1586
+ * @returns The created comment
1587
+ */
1588
+ create(body: CollaborationCommentCreate, options?: CollaborationCommentsWriteOptions): Promise<CollaborationCommentDocument>;
1589
+ /**
1590
+ * Update an existing comment.
1591
+ *
1592
+ * Updating `status` cascades to the comment's replies.
1593
+ *
1594
+ * @param id - Comment document ID
1595
+ * @param body - Fields to update
1596
+ * @param options - Optional request options
1597
+ * @returns The updated comment
1598
+ */
1599
+ update(id: string, body: CollaborationCommentUpdate, options?: CollaborationCommentsWriteOptions): Promise<CollaborationCommentDocument>;
1600
+ /**
1601
+ * Delete a comment and its replies.
1602
+ *
1603
+ * @param id - Comment document ID
1604
+ * @param options - Optional request options
1605
+ * @returns Mutation result, where `documentIds` covers the comment and every deleted reply
1606
+ */
1607
+ delete(id: string, options?: CollaborationCommentsWriteOptions): Promise<MultipleMutationResult>;
1608
+ /**
1609
+ * Add the current user's reaction to a comment.
1610
+ *
1611
+ * @param id - Comment document ID
1612
+ * @param shortName - Emoji short name, for example `:+1:`
1613
+ * @param options - Optional request options
1614
+ * @returns The comment, with the reaction applied
1615
+ */
1616
+ addReaction(id: string, shortName: CollaborationCommentReactionShortName, options?: CollaborationCommentsWriteOptions): Promise<CollaborationCommentDocument>;
1617
+ /**
1618
+ * Remove the current user's reaction from a comment.
1619
+ *
1620
+ * @param id - Comment document ID
1621
+ * @param shortName - Emoji short name, for example `:+1:`
1622
+ * @param options - Optional request options
1623
+ * @returns The comment, with the reaction removed
1624
+ */
1625
+ removeReaction(id: string, shortName: CollaborationCommentReactionShortName, options?: CollaborationCommentsWriteOptions): Promise<CollaborationCommentDocument>;
1626
+ /**
1627
+ * Build the global document reference used by `target.document._ref`, for use in
1628
+ * queries and listeners.
1629
+ *
1630
+ * The reference is built from the configured `resource` and the published ID of
1631
+ * the given document ID, since comment references always use published IDs.
1632
+ *
1633
+ * @example
1634
+ * ```ts
1635
+ * const comments = await client.collaboration.comments.fetch(
1636
+ * '*[_type == "sanity.comment" && target.document._ref == $ref]',
1637
+ * {ref: client.collaboration.comments.getTargetDocumentRef('doc-1')},
1638
+ * )
1639
+ * ```
1640
+ *
1641
+ * @param documentId - Document ID, in published, draft or version form
1642
+ * @returns Global document reference, of the form `resourceType:resourceId:documentId`
1643
+ */
1644
+ getTargetDocumentRef(documentId: string): CollaborationCommentDocument['target']['document']['_ref'];
1645
+ /**
1646
+ * Fetch comments on the configured resource.
1647
+ *
1648
+ * Takes the same `query` and `params` as `client.fetch`, and switches from a
1649
+ * GET to a POST for queries too large for the request URL in the same way,
1650
+ * but queries the comments endpoint, which accepts none of the query options
1651
+ * `client.fetch` does (`perspective`, `useCdn`, `filterResponse`,
1652
+ * `resultSourceMap`, stega).
1653
+ *
1654
+ * The query runs against the organization store, which is not scoped to
1655
+ * comments, so filter on `_type == "sanity.comment"`.
1656
+ *
1657
+ * @param query - GROQ-query to perform
1658
+ * @param params - Optional query parameters
1659
+ * @param options - Optional request options
1660
+ */
1661
+ fetch<R = unknown>(query: string, params?: QueryParams, options?: CollaborationCommentsRequestOptions): Promise<R>;
1662
+ /**
1663
+ * Listen for changes to comments on the configured resource.
1664
+ *
1665
+ * Mirrors `client.listen(query, params)`, and emits mutation events.
1666
+ *
1667
+ * @param query - GROQ-filter to listen to changes for
1668
+ * @param params - Optional query parameters
1669
+ */
1670
+ listen(query: string, params?: QueryParams): Observable<MutationEvent<CollaborationCommentDocument>>;
1671
+ /**
1672
+ * Listen for changes to comments on the configured resource.
1673
+ *
1674
+ * Mirrors `client.listen(query, params, options)`.
1675
+ *
1676
+ * @param query - GROQ-filter to listen to changes for
1677
+ * @param params - Optional query parameters
1678
+ * @param options - The same listener options `client.listen` takes, forwarded
1679
+ * to the organization store's listener
1680
+ */
1681
+ listen<Opts extends CollaborationCommentsListenOptions>(query: string, params: QueryParams | undefined, options: Opts): Observable<ListenEventFromOptions<CollaborationCommentDocument, Opts>>;
1682
+ }
1227
1683
  /**
1228
1684
  * @public
1229
1685
  */
@@ -2351,6 +2807,10 @@ declare class ObservableSanityClient {
2351
2807
  agent: {
2352
2808
  action: ObservableAgentsActionClient;
2353
2809
  };
2810
+ collaboration: {
2811
+ /** @alpha */
2812
+ comments: ObservableCollaborationCommentsClient;
2813
+ };
2354
2814
  functions: ObservableFunctionsClient;
2355
2815
  releases: ObservableReleasesClient;
2356
2816
  /**
@@ -2981,6 +3441,10 @@ declare class SanityClient {
2981
3441
  agent: {
2982
3442
  action: AgentActionsClient;
2983
3443
  };
3444
+ collaboration: {
3445
+ /** @alpha */
3446
+ comments: CollaborationCommentsClient;
3447
+ };
2984
3448
  functions: FunctionsClient;
2985
3449
  releases: ReleasesClient;
2986
3450
  /**
@@ -4109,6 +4573,16 @@ interface ClientConfig {
4109
4573
  * ID of the organization owning the blueprints stack
4110
4574
  */
4111
4575
  organizationId?: string;
4576
+ /**
4577
+ * Organization-scoped configuration for collaboration APIs.
4578
+ *
4579
+ * Currently this is used by `collaboration.comments` methods.
4580
+ *
4581
+ * @alpha
4582
+ */
4583
+ collaboration?: {
4584
+ organizationId?: string;
4585
+ };
4112
4586
  }
4113
4587
  /** @public */
4114
4588
  interface InitializedClientConfig extends ClientConfig {
@@ -4590,8 +5064,13 @@ type ReleaseAction = CreateReleaseAction | EditReleaseAction | PublishReleaseAct
4590
5064
  type VariantDefinitionAction = CreateVariantDefinitionAction | EditVariantDefinitionAction | DeleteVariantDefinitionAction;
4591
5065
  /** @public */
4592
5066
  type VersionAction = CreateVersionAction | DiscardVersionAction | ReplaceVersionAction | UnpublishVersionAction;
5067
+ /**
5068
+ * @public
5069
+ * @beta
5070
+ */
5071
+ type VariantAction = CreateVariantAction | EditVariantAction | DeleteVariantAction | PublishVariantAction | UnpublishVariantAction;
4593
5072
  /** @public */
4594
- type Action = CreateAction | ReplaceDraftAction | EditAction | DeleteAction | DiscardAction | PublishAction | UnpublishAction | VersionAction | ReleaseAction | VariantDefinitionAction;
5073
+ type Action = CreateAction | ReplaceDraftAction | EditAction | DeleteAction | DiscardAction | PublishAction | UnpublishAction | VersionAction | VariantAction | ReleaseAction | VariantDefinitionAction;
4595
5074
  /** @public */
4596
5075
  type ImportReleaseAction = {
4597
5076
  actionType: 'sanity.action.release.import';
@@ -4730,6 +5209,175 @@ interface UnpublishVersionAction {
4730
5209
  versionId: string;
4731
5210
  publishedId: string;
4732
5211
  }
5212
+ /**
5213
+ * Creates a variant of a document, either by supplying the full document
5214
+ * content, or the base ID of a document to copy.
5215
+ *
5216
+ * @public
5217
+ * @beta
5218
+ */
5219
+ type CreateVariantAction = {
5220
+ actionType: 'sanity.action.document.variant.create';
5221
+ /**
5222
+ * ID of the document group to create a variant in. Must be a published
5223
+ * document ID, without a `drafts.` or `versions.` prefix.
5224
+ */
5225
+ publishedId: string;
5226
+ /**
5227
+ * Name of the variant definition this document belongs to, as in
5228
+ * `_.variants.{variantName}`. Must be a bare name, not a full document ID.
5229
+ */
5230
+ variantId: string;
5231
+ /**
5232
+ * Source bundle: `'drafts'`, or a release id.
5233
+ *
5234
+ * Defaults to the published bundle.
5235
+ */
5236
+ bundleId?: 'drafts' | (string & {});
5237
+ } & ({
5238
+ /**
5239
+ * The full document content. Requires a `_type` property.
5240
+ */
5241
+ document: SanityDocumentStub;
5242
+ baseId?: never;
5243
+ ifBaseRevisionId?: never;
5244
+ } | {
5245
+ /**
5246
+ * ID of an existing document to copy the content from.
5247
+ */
5248
+ baseId: string;
5249
+ /**
5250
+ * When set, the action fails unless the current revision of the base
5251
+ * document matches this value.
5252
+ */
5253
+ ifBaseRevisionId?: string;
5254
+ document?: never;
5255
+ });
5256
+ /**
5257
+ * Modifies a variant version of a document by applying a patch.
5258
+ *
5259
+ * If no such variant document exists it is first created, by copying the
5260
+ * variant's published sibling, or the published document if the variant was
5261
+ * never published.
5262
+ *
5263
+ * @public
5264
+ * @beta
5265
+ */
5266
+ interface EditVariantAction {
5267
+ actionType: 'sanity.action.document.variant.edit';
5268
+ /**
5269
+ * ID of the document group the variant belongs to. Must be a published
5270
+ * document ID, without a `drafts.` or `versions.` prefix.
5271
+ */
5272
+ publishedId: string;
5273
+ /**
5274
+ * Name of the variant definition this document belongs to, as in
5275
+ * `_.variants.{variantName}`. Must be a bare name, not a full document ID.
5276
+ */
5277
+ variantId: string;
5278
+ /**
5279
+ * Source bundle: `'drafts'`, or a release id.
5280
+ *
5281
+ * Defaults to the published bundle.
5282
+ */
5283
+ bundleId?: 'drafts' | (string & {});
5284
+ /**
5285
+ * Patch operations to apply.
5286
+ */
5287
+ patch: PatchOperations;
5288
+ }
5289
+ /**
5290
+ * Deletes a variant of a document.
5291
+ *
5292
+ * @public
5293
+ * @beta
5294
+ */
5295
+ interface DeleteVariantAction {
5296
+ actionType: 'sanity.action.document.variant.delete';
5297
+ /**
5298
+ * ID of the document group the variant belongs to. Must be a published
5299
+ * document ID, without a `drafts.` or `versions.` prefix.
5300
+ */
5301
+ publishedId: string;
5302
+ /**
5303
+ * Name of the variant definition this document belongs to, as in
5304
+ * `_.variants.{variantName}`. Must be a bare name, not a full document ID.
5305
+ */
5306
+ variantId: string;
5307
+ /**
5308
+ * Source bundle: `'drafts'`, or a release id.
5309
+ *
5310
+ * Defaults to the published bundle.
5311
+ */
5312
+ bundleId?: 'drafts' | (string & {});
5313
+ /**
5314
+ * Delete document history.
5315
+ */
5316
+ purge?: boolean;
5317
+ }
5318
+ /**
5319
+ * Publishes a variant version of a document, replacing the published variant
5320
+ * and removing the source variant document.
5321
+ *
5322
+ * @public
5323
+ * @beta
5324
+ */
5325
+ interface PublishVariantAction {
5326
+ actionType: 'sanity.action.document.variant.publish';
5327
+ /**
5328
+ * ID of the document group the variant belongs to. Must be a published
5329
+ * document ID, without a `drafts.` or `versions.` prefix.
5330
+ */
5331
+ publishedId: string;
5332
+ /**
5333
+ * Name of the variant definition this document belongs to, as in
5334
+ * `_.variants.{variantName}`. Must be a bare name, not a full document ID.
5335
+ */
5336
+ variantId: string;
5337
+ /**
5338
+ * Bundle to publish from: `'drafts'`, or a release id.
5339
+ */
5340
+ bundleId: 'drafts' | (string & {});
5341
+ /**
5342
+ * When set, publishing fails unless the current revision of the source
5343
+ * variant document matches this value.
5344
+ */
5345
+ ifVersionRevisionId?: string;
5346
+ /**
5347
+ * When set, publishing fails unless the current revision of the published
5348
+ * variant document matches this value.
5349
+ */
5350
+ ifPublishedVariantRevisionId?: string;
5351
+ }
5352
+ /**
5353
+ * Unpublishes a variant version of a document.
5354
+ *
5355
+ * By default the published variant is removed and preserved as a draft
5356
+ * variant. When a release id is given as the `bundleId`, the deletion is
5357
+ * instead staged in that release, and takes effect when it is published.
5358
+ *
5359
+ * @public
5360
+ * @beta
5361
+ */
5362
+ interface UnpublishVariantAction {
5363
+ actionType: 'sanity.action.document.variant.unpublish';
5364
+ /**
5365
+ * ID of the document group the variant belongs to. Must be a published
5366
+ * document ID, without a `drafts.` or `versions.` prefix.
5367
+ */
5368
+ publishedId: string;
5369
+ /**
5370
+ * Name of the variant definition this document belongs to, as in
5371
+ * `_.variants.{variantName}`. Must be a bare name, not a full document ID.
5372
+ */
5373
+ variantId: string;
5374
+ /**
5375
+ * The content release in which to stage the unpublish.
5376
+ *
5377
+ * By default, the currently published document is unpublished immediately.
5378
+ */
5379
+ bundleId?: string;
5380
+ }
4733
5381
  /**
4734
5382
  * Creates a new `system.variant` definition document.
4735
5383
  *
@@ -5998,5 +6646,5 @@ declare const createClient: (config: ClientConfig) => SanityClient;
5998
6646
  * @deprecated Use the named export `createClient` instead of the `default` export
5999
6647
  */
6000
6648
  declare const deprecatedCreateClient: (config: ClientConfig) => SanityClient;
6001
- export { Action, ActionError, ActionErrorItem, type AgentActionParam, type AgentActionParams, type AgentActionPath, type AgentActionPathSegment, type AgentActionTarget, AllDocumentIdsMutationOptions, AllDocumentsMutationOptions, AnimatedImageFormat, AnimatedTransformOptions, Any, ApiError, ArchiveReleaseAction, AssetMetadataType, type AssetsClient, AttributeSet, AuthProvider, AuthProviderResponse, BaseActionOptions, BaseMutationOptions, BasePatch, BaseTransaction, ChannelError, ChannelErrorEvent, ClientConfig, ClientError, ClientPerspective, ClientReturn, ClientVariant, ClientVariantConditions, ConnectionFailedError, type ConstantAgentActionParam, ContentSourceMap, ContentSourceMapDocument, ContentSourceMapDocumentBase, ContentSourceMapDocumentValueSource, ContentSourceMapDocuments, ContentSourceMapLiteralSource, ContentSourceMapMapping, ContentSourceMapMappings, type ContentSourceMapParsedPath, type ContentSourceMapParsedPathKeyedSegment, ContentSourceMapPaths, ContentSourceMapRemoteDocument, ContentSourceMapSource, ContentSourceMapUnknownSource, ContentSourceMapValueMapping, CorsOriginError, CreateAction, CreateReleaseAction, CreateVariantDefinitionAction, CreateVersionAction, CurrentSanityUser, DatasetAclMode, DatasetCreateOptions, DatasetEditOptions, DatasetResponse, type DatasetsClient, DatasetsResponse, DeleteAction, DeleteReleaseAction, DeleteVariantDefinitionAction, DiscardAction, DiscardVersionAction, DisconnectError, DisconnectEvent, type DocumentAgentActionParam, EXPERIMENTAL_API_WARNING, EditAction, EditReleaseAction, EditVariantDefinitionAction, EditableReleaseDocument, EmbeddingsSettings, EmbeddingsSettingsBody, ErrorProps, type EventSourceEvent, type EventSourceInstance, type FieldAgentActionParam, type FilterDefault, FilteredResponseQueryOptions, FirstDocumentIdMutationOptions, FirstDocumentMutationOptions, FitMode, type GenerateInstruction, type GenerateOperation, type GenerateTarget, type GenerateTargetDocument, type GenerateTargetInclude, type GroqAgentActionParam, type HttpError, HttpRequest, IdentifiedSanityDocumentStub, type ImageDescriptionOperation, ImportReleaseAction, InitializedClientConfig, type InitializedStegaConfig, InsertPatch, type InvokeFunctionEvent, type InvokeFunctionRequest, ListenEvent, ListenEventName, ListenOptions, ListenParams, type LiveClient, LiveEvent, LiveEventGoAway, LiveEventMessage, LiveEventReconnect, LiveEventRestart, LiveEventWelcome, type Logger, MediaLibraryAssetDocument, MediaLibraryAssetInstanceIdentifier, MediaLibraryAssetVersion, MediaLibraryPlaybackInfoOptions, type MediaLibraryVideoClient, MediaLibraryVideoPlaybackTransformations, MessageError, MessageParseError, MultipleActionResult, MultipleMutationResult, Mutation, MutationError, MutationErrorItem, MutationEvent, MutationOperation, MutationSelection, MutationSelectionQueryParams, type ObservableAssetsClient, type ObservableDatasetsClient, type ObservableMediaLibraryVideoClient, ObservablePatch, ObservablePatchBuilder, type ObservableProjectsClient, ObservableSanityClient, ObservableTransaction, type ObservableUsersClient, OpenEvent, PartialExcept, Patch, PatchBuilder, type PatchDocument, PatchMutationOperation, type PatchOperation, PatchOperations, PatchSelection, type PatchTarget, type ProjectsClient, type PromptRequest, PublishAction, PublishReleaseAction, QueryOptions, QueryParams, QueryParseError, QueryWithoutParams, RawQueryResponse, RawQuerylessQueryResponse, RawRequestOptions, ReconnectEvent, ReleaseAction, ReleaseCardinality, ReleaseDocument, ReleaseId, ReleaseState, ReleaseType, ReplaceDraftAction, ReplaceVersionAction, RequestHandler, RequestHandlerOptions, RequestObservableOptions, RequestOptions, RequestUrlOptions, Requester, ResetEvent, type ResolveStudioUrl, ResponseQueryOptions, ResumableListenEventNames, ResumableListenOptions, SanityAssetDocument, SanityClient, SanityDocument, SanityDocumentStub, SanityImageAssetDocument, SanityImagePalette, SanityProject, SanityProjectMember, SanityQueries, SanityReference, SanityUser, ScheduleReleaseAction, ServerError, type ServerSentEvent, SingleActionResult, SingleMutationResult, StackablePerspective, type StegaConfig, type StegaConfigRequiredKeys, StillImageFormat, StoryboardTransformOptions, type StudioBaseRoute, type StudioBaseUrl, type StudioUrl, SyncTag, ThumbnailTransformOptions, type TimeoutErrorLike, Transaction, TransactionAllDocumentIdsMutationOptions, TransactionAllDocumentsMutationOptions, TransactionFirstDocumentIdMutationOptions, TransactionFirstDocumentMutationOptions, TransactionMutationOptions, type TransformDocument, type TransformOperation, type TransformTarget, type TransformTargetDocument, type TransformTargetInclude, type TranslateDocument, type TranslateTarget, type TranslateTargetInclude, UnarchiveReleaseAction, UnfilteredResponseQueryOptions, UnfilteredResponseWithoutQuery, UnpublishAction, UnpublishVersionAction, UnscheduleReleaseAction, UploadBody, UploadClientConfig, UploadEvent, UploadProgressEvent, UploadResponseEvent, type UsersClient, VariantDefinitionAction, VersionAction, VideoPlaybackInfo, VideoPlaybackInfoItem, VideoPlaybackInfoItemPublic, VideoPlaybackInfoItemSigned, VideoPlaybackInfoPublic, VideoPlaybackInfoSigned, VideoPlaybackTokens, VideoRenditionInfo, VideoRenditionInfoPublic, VideoRenditionInfoSigned, VideoSubtitleInfo, VideoSubtitleInfoPublic, VideoSubtitleInfoSigned, WelcomeBackEvent, WelcomeEvent, type _listen, connectEventSource, createClient, deprecatedCreateClient as default, formatQueryParseError, isHttpError, isQueryParseError, isTimeoutError, requester, validateApiPerspective };
6649
+ export { Action, ActionError, ActionErrorItem, type AgentActionParam, type AgentActionParams, type AgentActionPath, type AgentActionPathSegment, type AgentActionTarget, AllDocumentIdsMutationOptions, AllDocumentsMutationOptions, AnimatedImageFormat, AnimatedTransformOptions, Any, ApiError, ArchiveReleaseAction, AssetMetadataType, type AssetsClient, AttributeSet, AuthProvider, AuthProviderResponse, BaseActionOptions, BaseMutationOptions, BasePatch, BaseTransaction, ChannelError, ChannelErrorEvent, ClientConfig, ClientError, ClientPerspective, ClientReturn, ClientVariant, ClientVariantConditions, type CollaborationCommentCreate, type CollaborationCommentDocument, type CollaborationCommentMessage, type CollaborationCommentPortableTextBlock, type CollaborationCommentRange, type CollaborationCommentReactionShortName, type CollaborationCommentSelection, type CollaborationCommentStatus, type CollaborationCommentTarget, type CollaborationCommentUpdate, type CollaborationCommentsClient, type CollaborationCommentsListenOptions, type CollaborationCommentsRequestOptions, type CollaborationCommentsWriteOptions, ConnectionFailedError, type ConstantAgentActionParam, ContentSourceMap, ContentSourceMapDocument, ContentSourceMapDocumentBase, ContentSourceMapDocumentValueSource, ContentSourceMapDocuments, ContentSourceMapLiteralSource, ContentSourceMapMapping, ContentSourceMapMappings, type ContentSourceMapParsedPath, type ContentSourceMapParsedPathKeyedSegment, ContentSourceMapPaths, ContentSourceMapRemoteDocument, ContentSourceMapSource, ContentSourceMapUnknownSource, ContentSourceMapValueMapping, CorsOriginError, CreateAction, CreateReleaseAction, CreateVariantAction, CreateVariantDefinitionAction, CreateVersionAction, CurrentSanityUser, DatasetAclMode, DatasetCreateOptions, DatasetEditOptions, DatasetResponse, type DatasetsClient, DatasetsResponse, DeleteAction, DeleteReleaseAction, DeleteVariantAction, DeleteVariantDefinitionAction, DiscardAction, DiscardVersionAction, DisconnectError, DisconnectEvent, type DocumentAgentActionParam, EXPERIMENTAL_API_WARNING, EditAction, EditReleaseAction, EditVariantAction, EditVariantDefinitionAction, EditableReleaseDocument, EmbeddingsSettings, EmbeddingsSettingsBody, ErrorProps, type EventSourceEvent, type EventSourceInstance, type FieldAgentActionParam, type FilterDefault, FilteredResponseQueryOptions, FirstDocumentIdMutationOptions, FirstDocumentMutationOptions, FitMode, type GenerateInstruction, type GenerateOperation, type GenerateTarget, type GenerateTargetDocument, type GenerateTargetInclude, type GroqAgentActionParam, type HttpError, HttpRequest, IdentifiedSanityDocumentStub, type ImageDescriptionOperation, ImportReleaseAction, InitializedClientConfig, type InitializedStegaConfig, InsertPatch, type InvokeFunctionEvent, type InvokeFunctionRequest, ListenEvent, ListenEventName, ListenOptions, ListenParams, type LiveClient, LiveEvent, LiveEventGoAway, LiveEventMessage, LiveEventReconnect, LiveEventRestart, LiveEventWelcome, type Logger, MediaLibraryAssetDocument, MediaLibraryAssetInstanceIdentifier, MediaLibraryAssetVersion, MediaLibraryPlaybackInfoOptions, type MediaLibraryVideoClient, MediaLibraryVideoPlaybackTransformations, MessageError, MessageParseError, MultipleActionResult, MultipleMutationResult, Mutation, MutationError, MutationErrorItem, MutationEvent, MutationOperation, MutationSelection, MutationSelectionQueryParams, type ObservableAssetsClient, type ObservableCollaborationCommentsClient, type ObservableDatasetsClient, type ObservableMediaLibraryVideoClient, ObservablePatch, ObservablePatchBuilder, type ObservableProjectsClient, ObservableSanityClient, ObservableTransaction, type ObservableUsersClient, OpenEvent, PartialExcept, Patch, PatchBuilder, type PatchDocument, PatchMutationOperation, type PatchOperation, PatchOperations, PatchSelection, type PatchTarget, type ProjectsClient, type PromptRequest, PublishAction, PublishReleaseAction, PublishVariantAction, QueryOptions, QueryParams, QueryParseError, QueryWithoutParams, RawQueryResponse, RawQuerylessQueryResponse, RawRequestOptions, ReconnectEvent, ReleaseAction, ReleaseCardinality, ReleaseDocument, ReleaseId, ReleaseState, ReleaseType, ReplaceDraftAction, ReplaceVersionAction, RequestHandler, RequestHandlerOptions, RequestObservableOptions, RequestOptions, RequestUrlOptions, Requester, ResetEvent, type ResolveStudioUrl, ResponseQueryOptions, ResumableListenEventNames, ResumableListenOptions, SanityAssetDocument, SanityClient, SanityDocument, SanityDocumentStub, SanityImageAssetDocument, SanityImagePalette, SanityProject, SanityProjectMember, SanityQueries, SanityReference, SanityUser, ScheduleReleaseAction, ServerError, type ServerSentEvent, SingleActionResult, SingleMutationResult, StackablePerspective, type StegaConfig, type StegaConfigRequiredKeys, StillImageFormat, StoryboardTransformOptions, type StudioBaseRoute, type StudioBaseUrl, type StudioUrl, SyncTag, ThumbnailTransformOptions, type TimeoutErrorLike, Transaction, TransactionAllDocumentIdsMutationOptions, TransactionAllDocumentsMutationOptions, TransactionFirstDocumentIdMutationOptions, TransactionFirstDocumentMutationOptions, TransactionMutationOptions, type TransformDocument, type TransformOperation, type TransformTarget, type TransformTargetDocument, type TransformTargetInclude, type TranslateDocument, type TranslateTarget, type TranslateTargetInclude, UnarchiveReleaseAction, UnfilteredResponseQueryOptions, UnfilteredResponseWithoutQuery, UnpublishAction, UnpublishVariantAction, UnpublishVersionAction, UnscheduleReleaseAction, UploadBody, UploadClientConfig, UploadEvent, UploadProgressEvent, UploadResponseEvent, type UsersClient, VariantAction, VariantDefinitionAction, VersionAction, VideoPlaybackInfo, VideoPlaybackInfoItem, VideoPlaybackInfoItemPublic, VideoPlaybackInfoItemSigned, VideoPlaybackInfoPublic, VideoPlaybackInfoSigned, VideoPlaybackTokens, VideoRenditionInfo, VideoRenditionInfoPublic, VideoRenditionInfoSigned, VideoSubtitleInfo, VideoSubtitleInfoPublic, VideoSubtitleInfoSigned, WelcomeBackEvent, WelcomeEvent, type _listen, connectEventSource, createClient, deprecatedCreateClient as default, formatQueryParseError, isHttpError, isQueryParseError, isTimeoutError, requester, validateApiPerspective };
6002
6650
  //# sourceMappingURL=index.node.d.ts.map