@sanity/client 7.1.0 → 7.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.
- package/README.md +516 -40
- package/dist/_chunks-cjs/config.cjs +14 -0
- package/dist/_chunks-cjs/config.cjs.map +1 -1
- package/dist/_chunks-es/config.js +15 -1
- package/dist/_chunks-es/config.js.map +1 -1
- package/dist/index.browser.cjs +750 -5
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.d.cts +1282 -1
- package/dist/index.browser.d.ts +1282 -1
- package/dist/index.browser.js +752 -5
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +739 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1282 -1
- package/dist/index.d.ts +1282 -1
- package/dist/index.js +742 -7
- package/dist/index.js.map +1 -1
- package/dist/stega.browser.d.cts +1282 -1
- package/dist/stega.browser.d.ts +1282 -1
- package/dist/stega.d.cts +1282 -1
- package/dist/stega.d.ts +1282 -1
- package/package.json +2 -1
- package/src/SanityClient.ts +592 -4
- package/src/data/dataMethods.ts +126 -2
- package/src/releases/ReleasesClient.ts +687 -0
- package/src/releases/createRelease.ts +53 -0
- package/src/types.ts +215 -0
- package/src/util/createVersionId.ts +79 -0
- package/src/validators.ts +23 -1
- package/umd/sanityClient.js +815 -4
- package/umd/sanityClient.min.js +2 -2
package/dist/stega.browser.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export declare type Action =
|
|
|
13
13
|
| DiscardAction
|
|
14
14
|
| PublishAction
|
|
15
15
|
| UnpublishAction
|
|
16
|
+
| VersionAction
|
|
17
|
+
| ReleaseAction
|
|
16
18
|
|
|
17
19
|
/** @internal */
|
|
18
20
|
export declare interface ActionError {
|
|
@@ -314,6 +316,16 @@ export declare interface ApiError {
|
|
|
314
316
|
statusCode: number
|
|
315
317
|
}
|
|
316
318
|
|
|
319
|
+
/**
|
|
320
|
+
* Archives an `active` release, and deletes all the release documents.
|
|
321
|
+
*
|
|
322
|
+
* @public
|
|
323
|
+
*/
|
|
324
|
+
export declare interface ArchiveReleaseAction {
|
|
325
|
+
actionType: 'sanity.action.release.archive'
|
|
326
|
+
releaseId: string
|
|
327
|
+
}
|
|
328
|
+
|
|
317
329
|
/** @public */
|
|
318
330
|
export declare type AssetMetadataType =
|
|
319
331
|
| 'location'
|
|
@@ -986,6 +998,29 @@ export declare type CreateAction = {
|
|
|
986
998
|
*/
|
|
987
999
|
export declare const createClient: (config: ClientConfig_2) => SanityClient
|
|
988
1000
|
|
|
1001
|
+
/**
|
|
1002
|
+
* Creates a new release under the given id, with metadata.
|
|
1003
|
+
*
|
|
1004
|
+
* @public
|
|
1005
|
+
*/
|
|
1006
|
+
export declare interface CreateReleaseAction {
|
|
1007
|
+
actionType: 'sanity.action.release.create'
|
|
1008
|
+
releaseId: string
|
|
1009
|
+
metadata?: Partial<ReleaseDocument['metadata']>
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
/**
|
|
1013
|
+
* Creates a new version of an existing document, attached to the release as given
|
|
1014
|
+
* by `document._id`
|
|
1015
|
+
*
|
|
1016
|
+
* @public
|
|
1017
|
+
*/
|
|
1018
|
+
export declare interface CreateVersionAction {
|
|
1019
|
+
actionType: 'sanity.action.document.version.create'
|
|
1020
|
+
publishedId: string
|
|
1021
|
+
document: IdentifiedSanityDocumentStub
|
|
1022
|
+
}
|
|
1023
|
+
|
|
989
1024
|
/** @public */
|
|
990
1025
|
export declare interface CurrentSanityUser {
|
|
991
1026
|
id: string
|
|
@@ -1081,6 +1116,16 @@ export declare type DeleteAction = {
|
|
|
1081
1116
|
purge?: boolean
|
|
1082
1117
|
}
|
|
1083
1118
|
|
|
1119
|
+
/**
|
|
1120
|
+
* Deletes a `archived` or `published` release, and all the release documents versions.
|
|
1121
|
+
*
|
|
1122
|
+
* @public
|
|
1123
|
+
*/
|
|
1124
|
+
export declare interface DeleteReleaseAction {
|
|
1125
|
+
actionType: 'sanity.action.release.delete'
|
|
1126
|
+
releaseId: string
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1084
1129
|
/**
|
|
1085
1130
|
* @deprecated use 'drafts' instead
|
|
1086
1131
|
*/
|
|
@@ -1091,6 +1136,7 @@ declare type DeprecatedPreviewDrafts = 'previewDrafts'
|
|
|
1091
1136
|
* It is an error if it does not exist. If the purge flag is set, the document history is also deleted.
|
|
1092
1137
|
*
|
|
1093
1138
|
* @public
|
|
1139
|
+
* @deprecated Use {@link DiscardVersionAction} instead
|
|
1094
1140
|
*/
|
|
1095
1141
|
export declare type DiscardAction = {
|
|
1096
1142
|
actionType: 'sanity.action.document.discard'
|
|
@@ -1104,6 +1150,17 @@ export declare type DiscardAction = {
|
|
|
1104
1150
|
purge?: boolean
|
|
1105
1151
|
}
|
|
1106
1152
|
|
|
1153
|
+
/**
|
|
1154
|
+
* Delete a version of a document.
|
|
1155
|
+
*
|
|
1156
|
+
* @public
|
|
1157
|
+
*/
|
|
1158
|
+
export declare interface DiscardVersionAction {
|
|
1159
|
+
actionType: 'sanity.action.document.version.discard'
|
|
1160
|
+
versionId: string
|
|
1161
|
+
purge?: boolean
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1107
1164
|
/**
|
|
1108
1165
|
* The listener has been told to explicitly disconnect.
|
|
1109
1166
|
* This is a rare situation, but may occur if the API knows reconnect attempts will fail,
|
|
@@ -1158,6 +1215,15 @@ export declare interface DocumentAgentActionParam {
|
|
|
1158
1215
|
documentId?: string
|
|
1159
1216
|
}
|
|
1160
1217
|
|
|
1218
|
+
/** @internal */
|
|
1219
|
+
export declare type EditableReleaseDocument = Omit<
|
|
1220
|
+
PartialExcept<ReleaseDocument, '_id'>,
|
|
1221
|
+
'metadata' | '_type'
|
|
1222
|
+
> & {
|
|
1223
|
+
_id: string
|
|
1224
|
+
metadata: Partial<ReleaseDocument['metadata']>
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1161
1227
|
/**
|
|
1162
1228
|
* Modifies an existing draft document.
|
|
1163
1229
|
* It applies the given patch to the document referenced by draftId.
|
|
@@ -1181,6 +1247,17 @@ export declare type EditAction = {
|
|
|
1181
1247
|
patch: PatchOperations
|
|
1182
1248
|
}
|
|
1183
1249
|
|
|
1250
|
+
/**
|
|
1251
|
+
* Edits an existing release, updating the metadata.
|
|
1252
|
+
*
|
|
1253
|
+
* @public
|
|
1254
|
+
*/
|
|
1255
|
+
export declare interface EditReleaseAction {
|
|
1256
|
+
actionType: 'sanity.action.release.edit'
|
|
1257
|
+
releaseId: string
|
|
1258
|
+
patch: PatchOperations
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1184
1261
|
/**
|
|
1185
1262
|
* @internal
|
|
1186
1263
|
*/
|
|
@@ -2291,6 +2368,306 @@ export declare class ObservableProjectsClient {
|
|
|
2291
2368
|
getById(projectId: string): Observable<SanityProject>
|
|
2292
2369
|
}
|
|
2293
2370
|
|
|
2371
|
+
/** @public */
|
|
2372
|
+
declare class ObservableReleasesClient {
|
|
2373
|
+
#private
|
|
2374
|
+
constructor(client: ObservableSanityClient, httpRequest: HttpRequest)
|
|
2375
|
+
/**
|
|
2376
|
+
* @public
|
|
2377
|
+
*
|
|
2378
|
+
* Retrieve a release by id.
|
|
2379
|
+
*
|
|
2380
|
+
* @category Releases
|
|
2381
|
+
*
|
|
2382
|
+
* @param params - Release action parameters:
|
|
2383
|
+
* - `releaseId` - The id of the release to retrieve.
|
|
2384
|
+
* @param options - Additional query options including abort signal and query tag.
|
|
2385
|
+
* @returns An observable that resolves to the release document {@link ReleaseDocument}.
|
|
2386
|
+
*
|
|
2387
|
+
* @example Retrieving a release by id
|
|
2388
|
+
* ```ts
|
|
2389
|
+
* client.observable.releases.get({releaseId: 'my-release'}).pipe(
|
|
2390
|
+
* tap((release) => console.log(release)),
|
|
2391
|
+
* // {
|
|
2392
|
+
* // _id: '_.releases.my-release',
|
|
2393
|
+
* // name: 'my-release'
|
|
2394
|
+
* // _type: 'system.release',
|
|
2395
|
+
* // metadata: {releaseType: 'asap'},
|
|
2396
|
+
* // _createdAt: '2021-01-01T00:00:00.000Z',
|
|
2397
|
+
* // ...
|
|
2398
|
+
* // }
|
|
2399
|
+
* ).subscribe()
|
|
2400
|
+
* ```
|
|
2401
|
+
*/
|
|
2402
|
+
get(
|
|
2403
|
+
{
|
|
2404
|
+
releaseId,
|
|
2405
|
+
}: {
|
|
2406
|
+
releaseId: string
|
|
2407
|
+
},
|
|
2408
|
+
options?: {
|
|
2409
|
+
signal?: AbortSignal
|
|
2410
|
+
tag?: string
|
|
2411
|
+
},
|
|
2412
|
+
): Observable<ReleaseDocument | undefined>
|
|
2413
|
+
/**
|
|
2414
|
+
* @public
|
|
2415
|
+
*
|
|
2416
|
+
* Creates a new release under the given id, with metadata.
|
|
2417
|
+
*
|
|
2418
|
+
* @remarks
|
|
2419
|
+
* * If no releaseId is provided, a release id will be generated.
|
|
2420
|
+
* * If no metadata is provided, then an `undecided` releaseType will be used.
|
|
2421
|
+
*
|
|
2422
|
+
* @category Releases
|
|
2423
|
+
*
|
|
2424
|
+
* @param params - Release action parameters:
|
|
2425
|
+
* - `releaseId` - The id of the release to create.
|
|
2426
|
+
* - `metadata` - The metadata to associate with the release {@link ReleaseDocument}.
|
|
2427
|
+
* @param options - Additional action options.
|
|
2428
|
+
* @returns An observable that resolves to the `transactionId` and the release id and metadata.
|
|
2429
|
+
*
|
|
2430
|
+
* @example Creating a release with a custom id and metadata
|
|
2431
|
+
* ```ts
|
|
2432
|
+
* const releaseId = 'my-release'
|
|
2433
|
+
* const metadata: ReleaseDocument['metadata'] = {
|
|
2434
|
+
* releaseType: 'asap',
|
|
2435
|
+
* }
|
|
2436
|
+
*
|
|
2437
|
+
* client.observable.releases.create({releaseId, metadata}).pipe(
|
|
2438
|
+
* tap(({transactionId, releaseId, metadata}) => console.log(transactionId, releaseId, metadata)),
|
|
2439
|
+
* // {
|
|
2440
|
+
* // transactionId: 'transaction-id',
|
|
2441
|
+
* // releaseId: 'my-release',
|
|
2442
|
+
* // metadata: {releaseType: 'asap'},
|
|
2443
|
+
* // }
|
|
2444
|
+
* ).subscribe()
|
|
2445
|
+
* ```
|
|
2446
|
+
*
|
|
2447
|
+
* @example Creating a release with generated id and metadata
|
|
2448
|
+
* ```ts
|
|
2449
|
+
* client.observable.releases.create().pipe(
|
|
2450
|
+
* tap(({metadata}) => console.log(metadata)),
|
|
2451
|
+
* // {
|
|
2452
|
+
* // metadata: {releaseType: 'undecided'},
|
|
2453
|
+
* // }
|
|
2454
|
+
* ).subscribe()
|
|
2455
|
+
* ```
|
|
2456
|
+
*
|
|
2457
|
+
* @example Creating a release using a custom transaction id
|
|
2458
|
+
* ```ts
|
|
2459
|
+
* client.observable.releases.create({transactionId: 'my-transaction-id'}).pipe(
|
|
2460
|
+
* tap(({transactionId, metadata}) => console.log(transactionId, metadata)),
|
|
2461
|
+
* // {
|
|
2462
|
+
* // transactionId: 'my-transaction-id',
|
|
2463
|
+
* // metadata: {releaseType: 'undecided'},
|
|
2464
|
+
* // }
|
|
2465
|
+
* ).subscribe()
|
|
2466
|
+
* ```
|
|
2467
|
+
*/
|
|
2468
|
+
create(options: BaseActionOptions): Observable<
|
|
2469
|
+
SingleActionResult & {
|
|
2470
|
+
releaseId: string
|
|
2471
|
+
metadata: ReleaseDocument['metadata']
|
|
2472
|
+
}
|
|
2473
|
+
>
|
|
2474
|
+
create(
|
|
2475
|
+
release: {
|
|
2476
|
+
releaseId?: string
|
|
2477
|
+
metadata?: Partial<ReleaseDocument['metadata']>
|
|
2478
|
+
},
|
|
2479
|
+
options?: BaseActionOptions,
|
|
2480
|
+
): Observable<
|
|
2481
|
+
SingleActionResult & {
|
|
2482
|
+
releaseId: string
|
|
2483
|
+
metadata: ReleaseDocument['metadata']
|
|
2484
|
+
}
|
|
2485
|
+
>
|
|
2486
|
+
/**
|
|
2487
|
+
* @public
|
|
2488
|
+
*
|
|
2489
|
+
* Edits an existing release, updating the metadata.
|
|
2490
|
+
*
|
|
2491
|
+
* @category Releases
|
|
2492
|
+
*
|
|
2493
|
+
* @param params - Release action parameters:
|
|
2494
|
+
* - `releaseId` - The id of the release to edit.
|
|
2495
|
+
* - `patch` - The patch operation to apply on the release metadata {@link PatchMutationOperation}.
|
|
2496
|
+
* @param options - Additional action options.
|
|
2497
|
+
* @returns An observable that resolves to the `transactionId`.
|
|
2498
|
+
*/
|
|
2499
|
+
edit(
|
|
2500
|
+
{
|
|
2501
|
+
releaseId,
|
|
2502
|
+
patch,
|
|
2503
|
+
}: {
|
|
2504
|
+
releaseId: string
|
|
2505
|
+
patch: PatchOperations
|
|
2506
|
+
},
|
|
2507
|
+
options?: BaseActionOptions,
|
|
2508
|
+
): Observable<SingleActionResult>
|
|
2509
|
+
/**
|
|
2510
|
+
* @public
|
|
2511
|
+
*
|
|
2512
|
+
* Publishes all documents in a release at once. For larger releases the effect of the publish
|
|
2513
|
+
* will be visible immediately when querying but the removal of the `versions.<releasesId>.*`
|
|
2514
|
+
* documents and creation of the corresponding published documents with the new content may
|
|
2515
|
+
* take some time.
|
|
2516
|
+
*
|
|
2517
|
+
* During this period both the source and target documents are locked and cannot be
|
|
2518
|
+
* modified through any other means.
|
|
2519
|
+
*
|
|
2520
|
+
* @category Releases
|
|
2521
|
+
*
|
|
2522
|
+
* @param params - Release action parameters:
|
|
2523
|
+
* - `releaseId` - The id of the release to publish.
|
|
2524
|
+
* @param options - Additional action options.
|
|
2525
|
+
* @returns An observable that resolves to the `transactionId`.
|
|
2526
|
+
*/
|
|
2527
|
+
publish(
|
|
2528
|
+
{
|
|
2529
|
+
releaseId,
|
|
2530
|
+
}: {
|
|
2531
|
+
releaseId: string
|
|
2532
|
+
},
|
|
2533
|
+
options?: BaseActionOptions,
|
|
2534
|
+
): Observable<SingleActionResult>
|
|
2535
|
+
/**
|
|
2536
|
+
* @public
|
|
2537
|
+
*
|
|
2538
|
+
* An archive action removes an active release. The documents that comprise the release
|
|
2539
|
+
* are deleted and therefore no longer queryable.
|
|
2540
|
+
*
|
|
2541
|
+
* While the documents remain in retention the last version can still be accessed using document history endpoint.
|
|
2542
|
+
*
|
|
2543
|
+
* @category Releases
|
|
2544
|
+
*
|
|
2545
|
+
* @param params - Release action parameters:
|
|
2546
|
+
* - `releaseId` - The id of the release to archive.
|
|
2547
|
+
* @param options - Additional action options.
|
|
2548
|
+
* @returns An observable that resolves to the `transactionId`.
|
|
2549
|
+
*/
|
|
2550
|
+
archive(
|
|
2551
|
+
{
|
|
2552
|
+
releaseId,
|
|
2553
|
+
}: {
|
|
2554
|
+
releaseId: string
|
|
2555
|
+
},
|
|
2556
|
+
options?: BaseActionOptions,
|
|
2557
|
+
): Observable<SingleActionResult>
|
|
2558
|
+
/**
|
|
2559
|
+
* @public
|
|
2560
|
+
*
|
|
2561
|
+
* An unarchive action restores an archived release and all documents
|
|
2562
|
+
* with the content they had just prior to archiving.
|
|
2563
|
+
*
|
|
2564
|
+
* @category Releases
|
|
2565
|
+
*
|
|
2566
|
+
* @param params - Release action parameters:
|
|
2567
|
+
* - `releaseId` - The id of the release to unarchive.
|
|
2568
|
+
* @param options - Additional action options.
|
|
2569
|
+
* @returns An observable that resolves to the `transactionId`.
|
|
2570
|
+
*/
|
|
2571
|
+
unarchive(
|
|
2572
|
+
{
|
|
2573
|
+
releaseId,
|
|
2574
|
+
}: {
|
|
2575
|
+
releaseId: string
|
|
2576
|
+
},
|
|
2577
|
+
options?: BaseActionOptions,
|
|
2578
|
+
): Observable<SingleActionResult>
|
|
2579
|
+
/**
|
|
2580
|
+
* @public
|
|
2581
|
+
*
|
|
2582
|
+
* A schedule action queues a release for publishing at the given future time.
|
|
2583
|
+
* The release is locked such that no documents in the release can be modified and
|
|
2584
|
+
* no documents that it references can be deleted as this would make the publish fail.
|
|
2585
|
+
* At the given time, the same logic as for the publish action is triggered.
|
|
2586
|
+
*
|
|
2587
|
+
* @category Releases
|
|
2588
|
+
*
|
|
2589
|
+
* @param params - Release action parameters:
|
|
2590
|
+
* - `releaseId` - The id of the release to schedule.
|
|
2591
|
+
* - `publishAt` - The serialised date and time to publish the release. If the `publishAt` is in the past, the release will be published immediately.
|
|
2592
|
+
* @param options - Additional action options.
|
|
2593
|
+
* @returns An observable that resolves to the `transactionId`.
|
|
2594
|
+
*/
|
|
2595
|
+
schedule(
|
|
2596
|
+
{
|
|
2597
|
+
releaseId,
|
|
2598
|
+
publishAt,
|
|
2599
|
+
}: {
|
|
2600
|
+
releaseId: string
|
|
2601
|
+
publishAt: string
|
|
2602
|
+
},
|
|
2603
|
+
options?: BaseActionOptions,
|
|
2604
|
+
): Observable<SingleActionResult>
|
|
2605
|
+
/**
|
|
2606
|
+
* @public
|
|
2607
|
+
*
|
|
2608
|
+
* An unschedule action stops a release from being published.
|
|
2609
|
+
* The documents in the release are considered unlocked and can be edited again.
|
|
2610
|
+
* This may fail if another release is scheduled to be published after this one and
|
|
2611
|
+
* has a reference to a document created by this one.
|
|
2612
|
+
*
|
|
2613
|
+
* @category Releases
|
|
2614
|
+
*
|
|
2615
|
+
* @param params - Release action parameters:
|
|
2616
|
+
* - `releaseId` - The id of the release to unschedule.
|
|
2617
|
+
* @param options - Additional action options.
|
|
2618
|
+
* @returns An observable that resolves to the `transactionId`.
|
|
2619
|
+
*/
|
|
2620
|
+
unschedule(
|
|
2621
|
+
{
|
|
2622
|
+
releaseId,
|
|
2623
|
+
}: {
|
|
2624
|
+
releaseId: string
|
|
2625
|
+
},
|
|
2626
|
+
options?: BaseActionOptions,
|
|
2627
|
+
): Observable<SingleActionResult>
|
|
2628
|
+
/**
|
|
2629
|
+
* @public
|
|
2630
|
+
*
|
|
2631
|
+
* A delete action removes a published or archived release.
|
|
2632
|
+
* The backing system document will be removed from the dataset.
|
|
2633
|
+
*
|
|
2634
|
+
* @category Releases
|
|
2635
|
+
*
|
|
2636
|
+
* @param params - Release action parameters:
|
|
2637
|
+
* - `releaseId` - The id of the release to delete.
|
|
2638
|
+
* @param options - Additional action options.
|
|
2639
|
+
* @returns An observable that resolves to the `transactionId`.
|
|
2640
|
+
*/
|
|
2641
|
+
delete(
|
|
2642
|
+
{
|
|
2643
|
+
releaseId,
|
|
2644
|
+
}: {
|
|
2645
|
+
releaseId: string
|
|
2646
|
+
},
|
|
2647
|
+
options?: BaseActionOptions,
|
|
2648
|
+
): Observable<SingleActionResult>
|
|
2649
|
+
/**
|
|
2650
|
+
* @public
|
|
2651
|
+
*
|
|
2652
|
+
* Fetch the documents in a release by release id.
|
|
2653
|
+
*
|
|
2654
|
+
* @category Releases
|
|
2655
|
+
*
|
|
2656
|
+
* @param params - Release action parameters:
|
|
2657
|
+
* - `releaseId` - The id of the release to fetch documents for.
|
|
2658
|
+
* @param options - Additional mutation options {@link BaseMutationOptions}.
|
|
2659
|
+
* @returns An observable that resolves to the documents in the release.
|
|
2660
|
+
*/
|
|
2661
|
+
fetchDocuments(
|
|
2662
|
+
{
|
|
2663
|
+
releaseId,
|
|
2664
|
+
}: {
|
|
2665
|
+
releaseId: string
|
|
2666
|
+
},
|
|
2667
|
+
options?: BaseMutationOptions,
|
|
2668
|
+
): Observable<RawQueryResponse<SanityDocument[]>>
|
|
2669
|
+
}
|
|
2670
|
+
|
|
2294
2671
|
/** @public */
|
|
2295
2672
|
export declare class ObservableSanityClient {
|
|
2296
2673
|
#private
|
|
@@ -2302,6 +2679,7 @@ export declare class ObservableSanityClient {
|
|
|
2302
2679
|
agent: {
|
|
2303
2680
|
action: ObservableAgentsActionClient
|
|
2304
2681
|
}
|
|
2682
|
+
releases: ObservableReleasesClient
|
|
2305
2683
|
/**
|
|
2306
2684
|
* Instance properties
|
|
2307
2685
|
*/
|
|
@@ -2392,7 +2770,9 @@ export declare class ObservableSanityClient {
|
|
|
2392
2770
|
getDocument<R extends Record<string, Any> = Record<string, Any>>(
|
|
2393
2771
|
id: string,
|
|
2394
2772
|
options?: {
|
|
2773
|
+
signal?: AbortSignal
|
|
2395
2774
|
tag?: string
|
|
2775
|
+
releaseId?: string
|
|
2396
2776
|
},
|
|
2397
2777
|
): Observable<SanityDocument<R> | undefined>
|
|
2398
2778
|
/**
|
|
@@ -2575,6 +2955,90 @@ export declare class ObservableSanityClient {
|
|
|
2575
2955
|
document: IdentifiedSanityDocumentStub<R>,
|
|
2576
2956
|
options?: BaseMutationOptions,
|
|
2577
2957
|
): Observable<SanityDocument<R>>
|
|
2958
|
+
/**
|
|
2959
|
+
* @public
|
|
2960
|
+
*
|
|
2961
|
+
* Creates a new version of a published document.
|
|
2962
|
+
*
|
|
2963
|
+
* @remarks
|
|
2964
|
+
* * Requires a document with a `_type` property.
|
|
2965
|
+
* * Creating a version with no `releaseId` will create a new draft version of the published document.
|
|
2966
|
+
* * If the `document._id` is defined, it should be a draft or release version ID that matches the version ID generated from `publishedId` and `releaseId`.
|
|
2967
|
+
* * If the `document._id` is not defined, it will be generated from `publishedId` and `releaseId`.
|
|
2968
|
+
* * To create a version of an unpublished document, use the `client.create` method.
|
|
2969
|
+
*
|
|
2970
|
+
* @category Versions
|
|
2971
|
+
*
|
|
2972
|
+
* @param params - Version action parameters:
|
|
2973
|
+
* - `document` - The document to create as a new version (must include `_type`).
|
|
2974
|
+
* - `publishedId` - The ID of the published document being versioned.
|
|
2975
|
+
* - `releaseId` - The ID of the release to create the version for.
|
|
2976
|
+
* @param options - Additional action options.
|
|
2977
|
+
* @returns an observable that resolves to the `transactionId`.
|
|
2978
|
+
*
|
|
2979
|
+
* @example Creating a new version of a published document with a generated version ID
|
|
2980
|
+
* ```ts
|
|
2981
|
+
* client.observable.createVersion({
|
|
2982
|
+
* // The document does not need to include an `_id` property since it will be generated from `publishedId` and `releaseId`
|
|
2983
|
+
* document: {_type: 'myDocument', title: 'My Document'},
|
|
2984
|
+
* publishedId: 'myDocument',
|
|
2985
|
+
* releaseId: 'myRelease',
|
|
2986
|
+
* })
|
|
2987
|
+
*
|
|
2988
|
+
* // The following document will be created:
|
|
2989
|
+
* // {
|
|
2990
|
+
* // _id: 'versions.myRelease.myDocument',
|
|
2991
|
+
* // _type: 'myDocument',
|
|
2992
|
+
* // title: 'My Document',
|
|
2993
|
+
* // }
|
|
2994
|
+
* ```
|
|
2995
|
+
*
|
|
2996
|
+
* @example Creating a new version of a published document with a specified version ID
|
|
2997
|
+
* ```ts
|
|
2998
|
+
* client.observable.createVersion({
|
|
2999
|
+
* document: {_type: 'myDocument', _id: 'versions.myRelease.myDocument', title: 'My Document'},
|
|
3000
|
+
* // `publishedId` and `releaseId` are not required since `document._id` has been specified
|
|
3001
|
+
* })
|
|
3002
|
+
*
|
|
3003
|
+
* // The following document will be created:
|
|
3004
|
+
* // {
|
|
3005
|
+
* // _id: 'versions.myRelease.myDocument',
|
|
3006
|
+
* // _type: 'myDocument',
|
|
3007
|
+
* // title: 'My Document',
|
|
3008
|
+
* // }
|
|
3009
|
+
* ```
|
|
3010
|
+
*
|
|
3011
|
+
* @example Creating a new draft version of a published document
|
|
3012
|
+
* ```ts
|
|
3013
|
+
* client.observable.createVersion({
|
|
3014
|
+
* document: {_type: 'myDocument', title: 'My Document'},
|
|
3015
|
+
* publishedId: 'myDocument',
|
|
3016
|
+
* })
|
|
3017
|
+
*
|
|
3018
|
+
* // The following document will be created:
|
|
3019
|
+
* // {
|
|
3020
|
+
* // _id: 'drafts.myDocument',
|
|
3021
|
+
* // _type: 'myDocument',
|
|
3022
|
+
* // title: 'My Document',
|
|
3023
|
+
* // }
|
|
3024
|
+
* ```
|
|
3025
|
+
*/
|
|
3026
|
+
createVersion<R extends Record<string, Any>>(
|
|
3027
|
+
args: {
|
|
3028
|
+
document: SanityDocumentStub<R>
|
|
3029
|
+
publishedId: string
|
|
3030
|
+
releaseId?: string
|
|
3031
|
+
},
|
|
3032
|
+
options?: BaseActionOptions,
|
|
3033
|
+
): Observable<SingleActionResult | MultipleActionResult>
|
|
3034
|
+
createVersion<R extends Record<string, Any>>(
|
|
3035
|
+
args: {
|
|
3036
|
+
document: IdentifiedSanityDocumentStub<R>
|
|
3037
|
+
publishedId?: string
|
|
3038
|
+
releaseId?: string
|
|
3039
|
+
},
|
|
3040
|
+
options?: BaseActionOptions,
|
|
3041
|
+
): Observable<SingleActionResult | MultipleActionResult>
|
|
2578
3042
|
/**
|
|
2579
3043
|
* Deletes a document with the given document ID.
|
|
2580
3044
|
* Returns an observable that resolves to the deleted document.
|
|
@@ -2679,6 +3143,157 @@ export declare class ObservableSanityClient {
|
|
|
2679
3143
|
selection: MutationSelection,
|
|
2680
3144
|
options?: BaseMutationOptions,
|
|
2681
3145
|
): Observable<SanityDocument<R>>
|
|
3146
|
+
/**
|
|
3147
|
+
* @public
|
|
3148
|
+
*
|
|
3149
|
+
* Deletes the draft or release version of a document.
|
|
3150
|
+
*
|
|
3151
|
+
* @remarks
|
|
3152
|
+
* * Discarding a version with no `releaseId` will discard the draft version of the published document.
|
|
3153
|
+
* * If the draft or release version does not exist, any error will throw.
|
|
3154
|
+
*
|
|
3155
|
+
* @param params - Version action parameters:
|
|
3156
|
+
* - `releaseId` - The ID of the release to discard the document from.
|
|
3157
|
+
* - `publishedId` - The published ID of the document to discard.
|
|
3158
|
+
* @param purge - if `true` the document history is also discarded.
|
|
3159
|
+
* @param options - Additional action options.
|
|
3160
|
+
* @returns an observable that resolves to the `transactionId`.
|
|
3161
|
+
*
|
|
3162
|
+
* @example Discarding a release version of a document
|
|
3163
|
+
* ```ts
|
|
3164
|
+
* client.observable.discardVersion({publishedId: 'myDocument', releaseId: 'myRelease'})
|
|
3165
|
+
* // The document with the ID `versions.myRelease.myDocument` will be discarded.
|
|
3166
|
+
* ```
|
|
3167
|
+
*
|
|
3168
|
+
* @example Discarding a draft version of a document
|
|
3169
|
+
* ```ts
|
|
3170
|
+
* client.observable.discardVersion({publishedId: 'myDocument'})
|
|
3171
|
+
* // The document with the ID `drafts.myDocument` will be discarded.
|
|
3172
|
+
* ```
|
|
3173
|
+
*/
|
|
3174
|
+
discardVersion(
|
|
3175
|
+
{
|
|
3176
|
+
releaseId,
|
|
3177
|
+
publishedId,
|
|
3178
|
+
}: {
|
|
3179
|
+
releaseId?: string
|
|
3180
|
+
publishedId: string
|
|
3181
|
+
},
|
|
3182
|
+
purge?: boolean,
|
|
3183
|
+
options?: BaseActionOptions,
|
|
3184
|
+
): Observable<SingleActionResult | MultipleActionResult>
|
|
3185
|
+
/**
|
|
3186
|
+
* @public
|
|
3187
|
+
*
|
|
3188
|
+
* Replaces an existing version document.
|
|
3189
|
+
*
|
|
3190
|
+
* @remarks
|
|
3191
|
+
* * Requires a document with a `_type` property.
|
|
3192
|
+
* * If the `document._id` is defined, it should be a draft or release version ID that matches the version ID generated from `publishedId` and `releaseId`.
|
|
3193
|
+
* * If the `document._id` is not defined, it will be generated from `publishedId` and `releaseId`.
|
|
3194
|
+
* * Replacing a version with no `releaseId` will replace the draft version of the published document.
|
|
3195
|
+
* * At least one of the **version** or **published** documents must exist.
|
|
3196
|
+
*
|
|
3197
|
+
* @param params - Version action parameters:
|
|
3198
|
+
* - `document` - The new document to replace the version with.
|
|
3199
|
+
* - `releaseId` - The ID of the release where the document version is replaced.
|
|
3200
|
+
* - `publishedId` - The ID of the published document to replace.
|
|
3201
|
+
* @param options - Additional action options.
|
|
3202
|
+
* @returns an observable that resolves to the `transactionId`.
|
|
3203
|
+
*
|
|
3204
|
+
* @example Replacing a release version of a published document with a generated version ID
|
|
3205
|
+
* ```ts
|
|
3206
|
+
* client.observable.replaceVersion({
|
|
3207
|
+
* document: {_type: 'myDocument', title: 'My Document'},
|
|
3208
|
+
* publishedId: 'myDocument',
|
|
3209
|
+
* releaseId: 'myRelease',
|
|
3210
|
+
* })
|
|
3211
|
+
*
|
|
3212
|
+
* // The following document will be patched:
|
|
3213
|
+
* // {
|
|
3214
|
+
* // _id: 'versions.myRelease.myDocument',
|
|
3215
|
+
* // _type: 'myDocument',
|
|
3216
|
+
* // title: 'My Document',
|
|
3217
|
+
* // }
|
|
3218
|
+
* ```
|
|
3219
|
+
*
|
|
3220
|
+
* @example Replacing a release version of a published document with a specified version ID
|
|
3221
|
+
* ```ts
|
|
3222
|
+
* client.observable.replaceVersion({
|
|
3223
|
+
* document: {_type: 'myDocument', _id: 'versions.myRelease.myDocument', title: 'My Document'},
|
|
3224
|
+
* // `publishedId` and `releaseId` are not required since `document._id` has been specified
|
|
3225
|
+
* })
|
|
3226
|
+
*
|
|
3227
|
+
* // The following document will be patched:
|
|
3228
|
+
* // {
|
|
3229
|
+
* // _id: 'versions.myRelease.myDocument',
|
|
3230
|
+
* // _type: 'myDocument',
|
|
3231
|
+
* // title: 'My Document',
|
|
3232
|
+
* // }
|
|
3233
|
+
* ```
|
|
3234
|
+
*
|
|
3235
|
+
* @example Replacing a draft version of a published document
|
|
3236
|
+
* ```ts
|
|
3237
|
+
* client.observable.replaceVersion({
|
|
3238
|
+
* document: {_type: 'myDocument', title: 'My Document'},
|
|
3239
|
+
* publishedId: 'myDocument',
|
|
3240
|
+
* })
|
|
3241
|
+
*
|
|
3242
|
+
* // The following document will be patched:
|
|
3243
|
+
* // {
|
|
3244
|
+
* // _id: 'drafts.myDocument',
|
|
3245
|
+
* // _type: 'myDocument',
|
|
3246
|
+
* // title: 'My Document',
|
|
3247
|
+
* // }
|
|
3248
|
+
* ```
|
|
3249
|
+
*/
|
|
3250
|
+
replaceVersion<R extends Record<string, Any>>(
|
|
3251
|
+
args: {
|
|
3252
|
+
document: SanityDocumentStub<R>
|
|
3253
|
+
publishedId: string
|
|
3254
|
+
releaseId?: string
|
|
3255
|
+
},
|
|
3256
|
+
options?: BaseActionOptions,
|
|
3257
|
+
): Observable<SingleActionResult | MultipleActionResult>
|
|
3258
|
+
replaceVersion<R extends Record<string, Any>>(
|
|
3259
|
+
args: {
|
|
3260
|
+
document: IdentifiedSanityDocumentStub<R>
|
|
3261
|
+
publishedId?: string
|
|
3262
|
+
releaseId?: string
|
|
3263
|
+
},
|
|
3264
|
+
options?: BaseActionOptions,
|
|
3265
|
+
): Observable<SingleActionResult | MultipleActionResult>
|
|
3266
|
+
/**
|
|
3267
|
+
* @public
|
|
3268
|
+
*
|
|
3269
|
+
* Used to indicate when a document within a release should be unpublished when
|
|
3270
|
+
* the release is run.
|
|
3271
|
+
*
|
|
3272
|
+
* @remarks
|
|
3273
|
+
* * If the published document does not exist, an error will be thrown.
|
|
3274
|
+
*
|
|
3275
|
+
* @param params - Version action parameters:
|
|
3276
|
+
* - `releaseId` - The ID of the release to unpublish the document from.
|
|
3277
|
+
* - `publishedId` - The published ID of the document to unpublish.
|
|
3278
|
+
* @param options - Additional action options.
|
|
3279
|
+
* @returns an observable that resolves to the `transactionId`.
|
|
3280
|
+
*
|
|
3281
|
+
* @example Unpublishing a release version of a published document
|
|
3282
|
+
* ```ts
|
|
3283
|
+
* client.observable.unpublishVersion({publishedId: 'myDocument', releaseId: 'myRelease'})
|
|
3284
|
+
* // The document with the ID `versions.myRelease.myDocument` will be unpublished. when `myRelease` is run.
|
|
3285
|
+
* ```
|
|
3286
|
+
*/
|
|
3287
|
+
unpublishVersion(
|
|
3288
|
+
{
|
|
3289
|
+
releaseId,
|
|
3290
|
+
publishedId,
|
|
3291
|
+
}: {
|
|
3292
|
+
releaseId: string
|
|
3293
|
+
publishedId: string
|
|
3294
|
+
},
|
|
3295
|
+
options?: BaseActionOptions,
|
|
3296
|
+
): Observable<SingleActionResult | MultipleActionResult>
|
|
2682
3297
|
/**
|
|
2683
3298
|
* Perform mutation operations against the configured dataset
|
|
2684
3299
|
* Returns an observable that resolves to the first mutated document.
|
|
@@ -2886,6 +3501,9 @@ export declare type OpenEvent = {
|
|
|
2886
3501
|
type: 'open'
|
|
2887
3502
|
}
|
|
2888
3503
|
|
|
3504
|
+
/** @internal */
|
|
3505
|
+
export declare type PartialExcept<T, K extends keyof T> = Pick<T, K> & Partial<Omit<T, K>>
|
|
3506
|
+
|
|
2889
3507
|
/** @public */
|
|
2890
3508
|
export declare class Patch extends BasePatch {
|
|
2891
3509
|
#private
|
|
@@ -3023,6 +3641,16 @@ export declare type PublishAction = {
|
|
|
3023
3641
|
ifPublishedRevisionId?: string
|
|
3024
3642
|
}
|
|
3025
3643
|
|
|
3644
|
+
/**
|
|
3645
|
+
* Publishes all documents in a release at once.
|
|
3646
|
+
*
|
|
3647
|
+
* @public
|
|
3648
|
+
*/
|
|
3649
|
+
export declare interface PublishReleaseAction {
|
|
3650
|
+
actionType: 'sanity.action.release.publish'
|
|
3651
|
+
releaseId: string
|
|
3652
|
+
}
|
|
3653
|
+
|
|
3026
3654
|
/** @public */
|
|
3027
3655
|
export declare type QueryOptions =
|
|
3028
3656
|
| FilteredResponseQueryOptions
|
|
@@ -3121,17 +3749,373 @@ export declare type ReconnectEvent = {
|
|
|
3121
3749
|
type: 'reconnect'
|
|
3122
3750
|
}
|
|
3123
3751
|
|
|
3752
|
+
/** @public */
|
|
3753
|
+
export declare type ReleaseAction =
|
|
3754
|
+
| CreateReleaseAction
|
|
3755
|
+
| EditReleaseAction
|
|
3756
|
+
| PublishReleaseAction
|
|
3757
|
+
| ArchiveReleaseAction
|
|
3758
|
+
| UnarchiveReleaseAction
|
|
3759
|
+
| ScheduleReleaseAction
|
|
3760
|
+
| UnscheduleReleaseAction
|
|
3761
|
+
| DeleteReleaseAction
|
|
3762
|
+
|
|
3763
|
+
/** @internal */
|
|
3764
|
+
export declare interface ReleaseDocument extends SanityDocument {
|
|
3765
|
+
/**
|
|
3766
|
+
* typically
|
|
3767
|
+
* `_.releases.<name>`
|
|
3768
|
+
*/
|
|
3769
|
+
_id: string
|
|
3770
|
+
/**
|
|
3771
|
+
* where a release has _id `_.releases.foo`, the name is `foo`
|
|
3772
|
+
*/
|
|
3773
|
+
name: string
|
|
3774
|
+
_type: 'system.release'
|
|
3775
|
+
_createdAt: string
|
|
3776
|
+
_updatedAt: string
|
|
3777
|
+
_rev: string
|
|
3778
|
+
state: ReleaseState
|
|
3779
|
+
error?: {
|
|
3780
|
+
message: string
|
|
3781
|
+
}
|
|
3782
|
+
finalDocumentStates?: {
|
|
3783
|
+
/** Document ID */
|
|
3784
|
+
id: string
|
|
3785
|
+
}[]
|
|
3786
|
+
/**
|
|
3787
|
+
* If defined, it takes precedence over the intendedPublishAt, the state should be 'scheduled'
|
|
3788
|
+
*/
|
|
3789
|
+
publishAt?: string
|
|
3790
|
+
/**
|
|
3791
|
+
* If defined, it provides the time the release was actually published
|
|
3792
|
+
*/
|
|
3793
|
+
publishedAt?: string
|
|
3794
|
+
metadata: {
|
|
3795
|
+
title?: string
|
|
3796
|
+
description?: string
|
|
3797
|
+
intendedPublishAt?: string
|
|
3798
|
+
releaseType: ReleaseType
|
|
3799
|
+
}
|
|
3800
|
+
}
|
|
3801
|
+
|
|
3124
3802
|
/**
|
|
3125
3803
|
* @public
|
|
3126
3804
|
* @deprecated – The `r`-prefix is not required, use `string` instead
|
|
3127
3805
|
*/
|
|
3128
3806
|
export declare type ReleaseId = `r${string}`
|
|
3129
3807
|
|
|
3808
|
+
/** @public */
|
|
3809
|
+
declare class ReleasesClient {
|
|
3810
|
+
#private
|
|
3811
|
+
constructor(client: SanityClient, httpRequest: HttpRequest)
|
|
3812
|
+
/**
|
|
3813
|
+
* @public
|
|
3814
|
+
*
|
|
3815
|
+
* Retrieve a release by id.
|
|
3816
|
+
*
|
|
3817
|
+
* @category Releases
|
|
3818
|
+
*
|
|
3819
|
+
* @param params - Release action parameters:
|
|
3820
|
+
* - `releaseId` - The id of the release to retrieve.
|
|
3821
|
+
* @param options - Additional query options including abort signal and query tag.
|
|
3822
|
+
* @returns A promise that resolves to the release document {@link ReleaseDocument}.
|
|
3823
|
+
*
|
|
3824
|
+
* @example Retrieving a release by id
|
|
3825
|
+
* ```ts
|
|
3826
|
+
* const release = await client.releases.get({releaseId: 'my-release'})
|
|
3827
|
+
* console.log(release)
|
|
3828
|
+
* // {
|
|
3829
|
+
* // _id: '_.releases.my-release',
|
|
3830
|
+
* // name: 'my-release'
|
|
3831
|
+
* // _type: 'system.release',
|
|
3832
|
+
* // metadata: {releaseType: 'asap'},
|
|
3833
|
+
* // _createdAt: '2021-01-01T00:00:00.000Z',
|
|
3834
|
+
* // ...
|
|
3835
|
+
* // }
|
|
3836
|
+
* ```
|
|
3837
|
+
*/
|
|
3838
|
+
get(
|
|
3839
|
+
{
|
|
3840
|
+
releaseId,
|
|
3841
|
+
}: {
|
|
3842
|
+
releaseId: string
|
|
3843
|
+
},
|
|
3844
|
+
options?: {
|
|
3845
|
+
signal?: AbortSignal
|
|
3846
|
+
tag?: string
|
|
3847
|
+
},
|
|
3848
|
+
): Promise<ReleaseDocument | undefined>
|
|
3849
|
+
/**
|
|
3850
|
+
* @public
|
|
3851
|
+
*
|
|
3852
|
+
* Creates a new release under the given id, with metadata.
|
|
3853
|
+
*
|
|
3854
|
+
* @remarks
|
|
3855
|
+
* * If no releaseId is provided, a release id will be generated.
|
|
3856
|
+
* * If no metadata is provided, then an `undecided` releaseType will be used.
|
|
3857
|
+
*
|
|
3858
|
+
* @category Releases
|
|
3859
|
+
*
|
|
3860
|
+
* @param params - Release action parameters:
|
|
3861
|
+
* - `releaseId` - The id of the release to create.
|
|
3862
|
+
* - `metadata` - The metadata to associate with the release {@link ReleaseDocument}.
|
|
3863
|
+
* @param options - Additional action options.
|
|
3864
|
+
* @returns A promise that resolves to the `transactionId` and the release id and metadata.
|
|
3865
|
+
*
|
|
3866
|
+
* @example Creating a release with a custom id and metadata
|
|
3867
|
+
* ```ts
|
|
3868
|
+
* const releaseId = 'my-release'
|
|
3869
|
+
* const releaseMetadata: ReleaseDocument['metadata'] = {
|
|
3870
|
+
* releaseType: 'asap',
|
|
3871
|
+
* }
|
|
3872
|
+
*
|
|
3873
|
+
* const result =
|
|
3874
|
+
* await client.releases.create({releaseId, metadata: releaseMetadata})
|
|
3875
|
+
* console.log(result)
|
|
3876
|
+
* // {
|
|
3877
|
+
* // transactionId: 'transaction-id',
|
|
3878
|
+
* // releaseId: 'my-release',
|
|
3879
|
+
* // metadata: {releaseType: 'asap'},
|
|
3880
|
+
* // }
|
|
3881
|
+
* ```
|
|
3882
|
+
*
|
|
3883
|
+
* @example Creating a release with generated id and metadata
|
|
3884
|
+
* ```ts
|
|
3885
|
+
* const {metadata} = await client.releases.create()
|
|
3886
|
+
* console.log(metadata.releaseType) // 'undecided'
|
|
3887
|
+
* ```
|
|
3888
|
+
*
|
|
3889
|
+
* @example Creating a release with a custom transaction id
|
|
3890
|
+
* ```ts
|
|
3891
|
+
* const {transactionId, metadata} = await client.releases.create({transactionId: 'my-transaction-id'})
|
|
3892
|
+
* console.log(metadata.releaseType) // 'undecided'
|
|
3893
|
+
* console.log(transactionId) // 'my-transaction-id'
|
|
3894
|
+
* ```
|
|
3895
|
+
*/
|
|
3896
|
+
create(options: BaseActionOptions): Promise<
|
|
3897
|
+
SingleActionResult & {
|
|
3898
|
+
releaseId: string
|
|
3899
|
+
metadata: ReleaseDocument['metadata']
|
|
3900
|
+
}
|
|
3901
|
+
>
|
|
3902
|
+
create(
|
|
3903
|
+
release: {
|
|
3904
|
+
releaseId?: string
|
|
3905
|
+
metadata?: Partial<ReleaseDocument['metadata']>
|
|
3906
|
+
},
|
|
3907
|
+
options?: BaseActionOptions,
|
|
3908
|
+
): Promise<
|
|
3909
|
+
SingleActionResult & {
|
|
3910
|
+
releaseId: string
|
|
3911
|
+
metadata: ReleaseDocument['metadata']
|
|
3912
|
+
}
|
|
3913
|
+
>
|
|
3914
|
+
/**
|
|
3915
|
+
* @public
|
|
3916
|
+
*
|
|
3917
|
+
* Edits an existing release, updating the metadata.
|
|
3918
|
+
*
|
|
3919
|
+
* @category Releases
|
|
3920
|
+
*
|
|
3921
|
+
* @param params - Release action parameters:
|
|
3922
|
+
* - `releaseId` - The id of the release to edit.
|
|
3923
|
+
* - `patch` - The patch operation to apply on the release metadata {@link PatchMutationOperation}.
|
|
3924
|
+
* @param options - Additional action options.
|
|
3925
|
+
* @returns A promise that resolves to the `transactionId`.
|
|
3926
|
+
*/
|
|
3927
|
+
edit(
|
|
3928
|
+
{
|
|
3929
|
+
releaseId,
|
|
3930
|
+
patch,
|
|
3931
|
+
}: {
|
|
3932
|
+
releaseId: string
|
|
3933
|
+
patch: PatchOperations
|
|
3934
|
+
},
|
|
3935
|
+
options?: BaseActionOptions,
|
|
3936
|
+
): Promise<SingleActionResult>
|
|
3937
|
+
/**
|
|
3938
|
+
* @public
|
|
3939
|
+
*
|
|
3940
|
+
* Publishes all documents in a release at once. For larger releases the effect of the publish
|
|
3941
|
+
* will be visible immediately when querying but the removal of the `versions.<releasesId>.*`
|
|
3942
|
+
* documents and creation of the corresponding published documents with the new content may
|
|
3943
|
+
* take some time.
|
|
3944
|
+
*
|
|
3945
|
+
* During this period both the source and target documents are locked and cannot be
|
|
3946
|
+
* modified through any other means.
|
|
3947
|
+
*
|
|
3948
|
+
* @category Releases
|
|
3949
|
+
*
|
|
3950
|
+
* @param params - Release action parameters:
|
|
3951
|
+
* - `releaseId` - The id of the release to publish.
|
|
3952
|
+
* @param options - Additional action options.
|
|
3953
|
+
* @returns A promise that resolves to the `transactionId`.
|
|
3954
|
+
*/
|
|
3955
|
+
publish(
|
|
3956
|
+
{
|
|
3957
|
+
releaseId,
|
|
3958
|
+
}: {
|
|
3959
|
+
releaseId: string
|
|
3960
|
+
},
|
|
3961
|
+
options?: BaseActionOptions,
|
|
3962
|
+
): Promise<SingleActionResult>
|
|
3963
|
+
/**
|
|
3964
|
+
* @public
|
|
3965
|
+
*
|
|
3966
|
+
* An archive action removes an active release. The documents that comprise the release
|
|
3967
|
+
* are deleted and therefore no longer queryable.
|
|
3968
|
+
*
|
|
3969
|
+
* While the documents remain in retention the last version can still be accessed using document history endpoint.
|
|
3970
|
+
*
|
|
3971
|
+
* @category Releases
|
|
3972
|
+
*
|
|
3973
|
+
* @param params - Release action parameters:
|
|
3974
|
+
* - `releaseId` - The id of the release to archive.
|
|
3975
|
+
* @param options - Additional action options.
|
|
3976
|
+
* @returns A promise that resolves to the `transactionId`.
|
|
3977
|
+
*/
|
|
3978
|
+
archive(
|
|
3979
|
+
{
|
|
3980
|
+
releaseId,
|
|
3981
|
+
}: {
|
|
3982
|
+
releaseId: string
|
|
3983
|
+
},
|
|
3984
|
+
options?: BaseActionOptions,
|
|
3985
|
+
): Promise<SingleActionResult>
|
|
3986
|
+
/**
|
|
3987
|
+
* @public
|
|
3988
|
+
*
|
|
3989
|
+
* An unarchive action restores an archived release and all documents
|
|
3990
|
+
* with the content they had just prior to archiving.
|
|
3991
|
+
*
|
|
3992
|
+
* @category Releases
|
|
3993
|
+
*
|
|
3994
|
+
* @param params - Release action parameters:
|
|
3995
|
+
* - `releaseId` - The id of the release to unarchive.
|
|
3996
|
+
* @param options - Additional action options.
|
|
3997
|
+
* @returns A promise that resolves to the `transactionId`.
|
|
3998
|
+
*/
|
|
3999
|
+
unarchive(
|
|
4000
|
+
{
|
|
4001
|
+
releaseId,
|
|
4002
|
+
}: {
|
|
4003
|
+
releaseId: string
|
|
4004
|
+
},
|
|
4005
|
+
options?: BaseActionOptions,
|
|
4006
|
+
): Promise<SingleActionResult>
|
|
4007
|
+
/**
|
|
4008
|
+
* @public
|
|
4009
|
+
*
|
|
4010
|
+
* A schedule action queues a release for publishing at the given future time.
|
|
4011
|
+
* The release is locked such that no documents in the release can be modified and
|
|
4012
|
+
* no documents that it references can be deleted as this would make the publish fail.
|
|
4013
|
+
* At the given time, the same logic as for the publish action is triggered.
|
|
4014
|
+
*
|
|
4015
|
+
* @category Releases
|
|
4016
|
+
*
|
|
4017
|
+
* @param params - Release action parameters:
|
|
4018
|
+
* - `releaseId` - The id of the release to schedule.
|
|
4019
|
+
* - `publishAt` - The serialised date and time to publish the release. If the `publishAt` is in the past, the release will be published immediately.
|
|
4020
|
+
* @param options - Additional action options.
|
|
4021
|
+
* @returns A promise that resolves to the `transactionId`.
|
|
4022
|
+
*/
|
|
4023
|
+
schedule(
|
|
4024
|
+
{
|
|
4025
|
+
releaseId,
|
|
4026
|
+
publishAt,
|
|
4027
|
+
}: {
|
|
4028
|
+
releaseId: string
|
|
4029
|
+
publishAt: string
|
|
4030
|
+
},
|
|
4031
|
+
options?: BaseActionOptions,
|
|
4032
|
+
): Promise<SingleActionResult>
|
|
4033
|
+
/**
|
|
4034
|
+
* @public
|
|
4035
|
+
*
|
|
4036
|
+
* An unschedule action stops a release from being published.
|
|
4037
|
+
* The documents in the release are considered unlocked and can be edited again.
|
|
4038
|
+
* This may fail if another release is scheduled to be published after this one and
|
|
4039
|
+
* has a reference to a document created by this one.
|
|
4040
|
+
*
|
|
4041
|
+
* @category Releases
|
|
4042
|
+
*
|
|
4043
|
+
* @param params - Release action parameters:
|
|
4044
|
+
* - `releaseId` - The id of the release to unschedule.
|
|
4045
|
+
* @param options - Additional action options.
|
|
4046
|
+
* @returns A promise that resolves to the `transactionId`.
|
|
4047
|
+
*/
|
|
4048
|
+
unschedule(
|
|
4049
|
+
{
|
|
4050
|
+
releaseId,
|
|
4051
|
+
}: {
|
|
4052
|
+
releaseId: string
|
|
4053
|
+
},
|
|
4054
|
+
options?: BaseActionOptions,
|
|
4055
|
+
): Promise<SingleActionResult>
|
|
4056
|
+
/**
|
|
4057
|
+
* @public
|
|
4058
|
+
*
|
|
4059
|
+
* A delete action removes a published or archived release.
|
|
4060
|
+
* The backing system document will be removed from the dataset.
|
|
4061
|
+
*
|
|
4062
|
+
* @category Releases
|
|
4063
|
+
*
|
|
4064
|
+
* @param params - Release action parameters:
|
|
4065
|
+
* - `releaseId` - The id of the release to delete.
|
|
4066
|
+
* @param options - Additional action options.
|
|
4067
|
+
* @returns A promise that resolves to the `transactionId`.
|
|
4068
|
+
*/
|
|
4069
|
+
delete(
|
|
4070
|
+
{
|
|
4071
|
+
releaseId,
|
|
4072
|
+
}: {
|
|
4073
|
+
releaseId: string
|
|
4074
|
+
},
|
|
4075
|
+
options?: BaseActionOptions,
|
|
4076
|
+
): Promise<SingleActionResult>
|
|
4077
|
+
/**
|
|
4078
|
+
* @public
|
|
4079
|
+
*
|
|
4080
|
+
* Fetch the documents in a release by release id.
|
|
4081
|
+
*
|
|
4082
|
+
* @category Releases
|
|
4083
|
+
*
|
|
4084
|
+
* @param params - Release action parameters:
|
|
4085
|
+
* - `releaseId` - The id of the release to fetch documents for.
|
|
4086
|
+
* @param options - Additional mutation options {@link BaseMutationOptions}.
|
|
4087
|
+
* @returns A promise that resolves to the documents in the release.
|
|
4088
|
+
*/
|
|
4089
|
+
fetchDocuments(
|
|
4090
|
+
{
|
|
4091
|
+
releaseId,
|
|
4092
|
+
}: {
|
|
4093
|
+
releaseId: string
|
|
4094
|
+
},
|
|
4095
|
+
options?: BaseMutationOptions,
|
|
4096
|
+
): Promise<RawQueryResponse<SanityDocument[]>>
|
|
4097
|
+
}
|
|
4098
|
+
|
|
4099
|
+
/** @beta */
|
|
4100
|
+
export declare type ReleaseState =
|
|
4101
|
+
| 'active'
|
|
4102
|
+
| 'archiving'
|
|
4103
|
+
| 'unarchiving'
|
|
4104
|
+
| 'archived'
|
|
4105
|
+
| 'published'
|
|
4106
|
+
| 'publishing'
|
|
4107
|
+
| 'scheduled'
|
|
4108
|
+
| 'scheduling'
|
|
4109
|
+
|
|
4110
|
+
/** @internal */
|
|
4111
|
+
export declare type ReleaseType = 'asap' | 'scheduled' | 'undecided'
|
|
4112
|
+
|
|
3130
4113
|
/**
|
|
3131
4114
|
* Replaces an existing draft document.
|
|
3132
4115
|
* At least one of the draft or published versions of the document must exist.
|
|
3133
4116
|
*
|
|
3134
4117
|
* @public
|
|
4118
|
+
* @deprecated Use {@link ReplaceVersionAction} instead
|
|
3135
4119
|
*/
|
|
3136
4120
|
export declare type ReplaceDraftAction = {
|
|
3137
4121
|
actionType: 'sanity.action.document.replaceDraft'
|
|
@@ -3145,6 +4129,16 @@ export declare type ReplaceDraftAction = {
|
|
|
3145
4129
|
attributes: IdentifiedSanityDocumentStub
|
|
3146
4130
|
}
|
|
3147
4131
|
|
|
4132
|
+
/**
|
|
4133
|
+
* Replace an existing version of a document.
|
|
4134
|
+
*
|
|
4135
|
+
* @public
|
|
4136
|
+
*/
|
|
4137
|
+
export declare interface ReplaceVersionAction {
|
|
4138
|
+
actionType: 'sanity.action.document.version.replace'
|
|
4139
|
+
document: IdentifiedSanityDocumentStub
|
|
4140
|
+
}
|
|
4141
|
+
|
|
3148
4142
|
/**
|
|
3149
4143
|
* @deprecated -- Use `import {requester} from '@sanity/client'` instead
|
|
3150
4144
|
* @public
|
|
@@ -3236,6 +4230,7 @@ export declare class SanityClient {
|
|
|
3236
4230
|
agent: {
|
|
3237
4231
|
action: AgentActionsClient
|
|
3238
4232
|
}
|
|
4233
|
+
releases: ReleasesClient
|
|
3239
4234
|
/**
|
|
3240
4235
|
* Observable version of the Sanity client, with the same configuration as the promise-based one
|
|
3241
4236
|
*/
|
|
@@ -3332,6 +4327,7 @@ export declare class SanityClient {
|
|
|
3332
4327
|
options?: {
|
|
3333
4328
|
signal?: AbortSignal
|
|
3334
4329
|
tag?: string
|
|
4330
|
+
releaseId?: string
|
|
3335
4331
|
},
|
|
3336
4332
|
): Promise<SanityDocument<R> | undefined>
|
|
3337
4333
|
/**
|
|
@@ -3515,6 +4511,90 @@ export declare class SanityClient {
|
|
|
3515
4511
|
document: IdentifiedSanityDocumentStub<R>,
|
|
3516
4512
|
options?: BaseMutationOptions,
|
|
3517
4513
|
): Promise<SanityDocument<R>>
|
|
4514
|
+
/**
|
|
4515
|
+
* @public
|
|
4516
|
+
*
|
|
4517
|
+
* Creates a new version of a published document.
|
|
4518
|
+
*
|
|
4519
|
+
* @remarks
|
|
4520
|
+
* * Requires a document with a `_type` property.
|
|
4521
|
+
* * Creating a version with no `releaseId` will create a new draft version of the published document.
|
|
4522
|
+
* * If the `document._id` is defined, it should be a draft or release version ID that matches the version ID generated from `publishedId` and `releaseId`.
|
|
4523
|
+
* * If the `document._id` is not defined, it will be generated from `publishedId` and `releaseId`.
|
|
4524
|
+
* * To create a version of an unpublished document, use the `client.create` method.
|
|
4525
|
+
*
|
|
4526
|
+
* @category Versions
|
|
4527
|
+
*
|
|
4528
|
+
* @param params - Version action parameters:
|
|
4529
|
+
* - `document` - The document to create as a new version (must include `_type`).
|
|
4530
|
+
* - `publishedId` - The ID of the published document being versioned.
|
|
4531
|
+
* - `releaseId` - The ID of the release to create the version for.
|
|
4532
|
+
* @param options - Additional action options.
|
|
4533
|
+
* @returns A promise that resolves to the `transactionId`.
|
|
4534
|
+
*
|
|
4535
|
+
* @example Creating a new version of a published document with a generated version ID
|
|
4536
|
+
* ```ts
|
|
4537
|
+
* const transactionId = await client.createVersion({
|
|
4538
|
+
* // The document does not need to include an `_id` property since it will be generated from `publishedId` and `releaseId`
|
|
4539
|
+
* document: {_type: 'myDocument', title: 'My Document'},
|
|
4540
|
+
* publishedId: 'myDocument',
|
|
4541
|
+
* releaseId: 'myRelease',
|
|
4542
|
+
* })
|
|
4543
|
+
*
|
|
4544
|
+
* // The following document will be created:
|
|
4545
|
+
* // {
|
|
4546
|
+
* // _id: 'versions.myRelease.myDocument',
|
|
4547
|
+
* // _type: 'myDocument',
|
|
4548
|
+
* // title: 'My Document',
|
|
4549
|
+
* // }
|
|
4550
|
+
* ```
|
|
4551
|
+
*
|
|
4552
|
+
* @example Creating a new version of a published document with a specified version ID
|
|
4553
|
+
* ```ts
|
|
4554
|
+
* const transactionId = await client.createVersion({
|
|
4555
|
+
* document: {_type: 'myDocument', _id: 'versions.myRelease.myDocument', title: 'My Document'},
|
|
4556
|
+
* // `publishedId` and `releaseId` are not required since `document._id` has been specified
|
|
4557
|
+
* })
|
|
4558
|
+
*
|
|
4559
|
+
* // The following document will be created:
|
|
4560
|
+
* // {
|
|
4561
|
+
* // _id: 'versions.myRelease.myDocument',
|
|
4562
|
+
* // _type: 'myDocument',
|
|
4563
|
+
* // title: 'My Document',
|
|
4564
|
+
* // }
|
|
4565
|
+
* ```
|
|
4566
|
+
*
|
|
4567
|
+
* @example Creating a new draft version of a published document
|
|
4568
|
+
* ```ts
|
|
4569
|
+
* const transactionId = await client.createVersion({
|
|
4570
|
+
* document: {_type: 'myDocument', title: 'My Document'},
|
|
4571
|
+
* publishedId: 'myDocument',
|
|
4572
|
+
* })
|
|
4573
|
+
*
|
|
4574
|
+
* // The following document will be created:
|
|
4575
|
+
* // {
|
|
4576
|
+
* // _id: 'drafts.myDocument',
|
|
4577
|
+
* // _type: 'myDocument',
|
|
4578
|
+
* // title: 'My Document',
|
|
4579
|
+
* // }
|
|
4580
|
+
* ```
|
|
4581
|
+
*/
|
|
4582
|
+
createVersion<R extends Record<string, Any>>(
|
|
4583
|
+
args: {
|
|
4584
|
+
document: SanityDocumentStub<R>
|
|
4585
|
+
publishedId: string
|
|
4586
|
+
releaseId?: string
|
|
4587
|
+
},
|
|
4588
|
+
options?: BaseActionOptions,
|
|
4589
|
+
): Promise<SingleActionResult | MultipleActionResult>
|
|
4590
|
+
createVersion<R extends Record<string, Any>>(
|
|
4591
|
+
args: {
|
|
4592
|
+
document: IdentifiedSanityDocumentStub<R>
|
|
4593
|
+
publishedId?: string
|
|
4594
|
+
releaseId?: string
|
|
4595
|
+
},
|
|
4596
|
+
options?: BaseActionOptions,
|
|
4597
|
+
): Promise<SingleActionResult | MultipleActionResult>
|
|
3518
4598
|
/**
|
|
3519
4599
|
* Deletes a document with the given document ID.
|
|
3520
4600
|
* Returns a promise that resolves to the deleted document.
|
|
@@ -3619,6 +4699,157 @@ export declare class SanityClient {
|
|
|
3619
4699
|
selection: MutationSelection,
|
|
3620
4700
|
options?: BaseMutationOptions,
|
|
3621
4701
|
): Promise<SanityDocument<R>>
|
|
4702
|
+
/**
|
|
4703
|
+
* @public
|
|
4704
|
+
*
|
|
4705
|
+
* Deletes the draft or release version of a document.
|
|
4706
|
+
*
|
|
4707
|
+
* @remarks
|
|
4708
|
+
* * Discarding a version with no `releaseId` will discard the draft version of the published document.
|
|
4709
|
+
* * If the draft or release version does not exist, any error will throw.
|
|
4710
|
+
*
|
|
4711
|
+
* @param params - Version action parameters:
|
|
4712
|
+
* - `releaseId` - The ID of the release to discard the document from.
|
|
4713
|
+
* - `publishedId` - The published ID of the document to discard.
|
|
4714
|
+
* @param purge - if `true` the document history is also discarded.
|
|
4715
|
+
* @param options - Additional action options.
|
|
4716
|
+
* @returns a promise that resolves to the `transactionId`.
|
|
4717
|
+
*
|
|
4718
|
+
* @example Discarding a release version of a document
|
|
4719
|
+
* ```ts
|
|
4720
|
+
* client.discardVersion({publishedId: 'myDocument', releaseId: 'myRelease'})
|
|
4721
|
+
* // The document with the ID `versions.myRelease.myDocument` will be discarded.
|
|
4722
|
+
* ```
|
|
4723
|
+
*
|
|
4724
|
+
* @example Discarding a draft version of a document
|
|
4725
|
+
* ```ts
|
|
4726
|
+
* client.discardVersion({publishedId: 'myDocument'})
|
|
4727
|
+
* // The document with the ID `drafts.myDocument` will be discarded.
|
|
4728
|
+
* ```
|
|
4729
|
+
*/
|
|
4730
|
+
discardVersion(
|
|
4731
|
+
{
|
|
4732
|
+
releaseId,
|
|
4733
|
+
publishedId,
|
|
4734
|
+
}: {
|
|
4735
|
+
releaseId?: string
|
|
4736
|
+
publishedId: string
|
|
4737
|
+
},
|
|
4738
|
+
purge?: boolean,
|
|
4739
|
+
options?: BaseActionOptions,
|
|
4740
|
+
): Promise<SingleActionResult | MultipleActionResult>
|
|
4741
|
+
/**
|
|
4742
|
+
* @public
|
|
4743
|
+
*
|
|
4744
|
+
* Replaces an existing version document.
|
|
4745
|
+
*
|
|
4746
|
+
* @remarks
|
|
4747
|
+
* * Requires a document with a `_type` property.
|
|
4748
|
+
* * If the `document._id` is defined, it should be a draft or release version ID that matches the version ID generated from `publishedId` and `releaseId`.
|
|
4749
|
+
* * If the `document._id` is not defined, it will be generated from `publishedId` and `releaseId`.
|
|
4750
|
+
* * Replacing a version with no `releaseId` will replace the draft version of the published document.
|
|
4751
|
+
* * At least one of the **version** or **published** documents must exist.
|
|
4752
|
+
*
|
|
4753
|
+
* @param params - Version action parameters:
|
|
4754
|
+
* - `document` - The new document to replace the version with.
|
|
4755
|
+
* - `releaseId` - The ID of the release where the document version is replaced.
|
|
4756
|
+
* - `publishedId` - The ID of the published document to replace.
|
|
4757
|
+
* @param options - Additional action options.
|
|
4758
|
+
* @returns a promise that resolves to the `transactionId`.
|
|
4759
|
+
*
|
|
4760
|
+
* @example Replacing a release version of a published document with a generated version ID
|
|
4761
|
+
* ```ts
|
|
4762
|
+
* await client.replaceVersion({
|
|
4763
|
+
* document: {_type: 'myDocument', title: 'My Document'},
|
|
4764
|
+
* publishedId: 'myDocument',
|
|
4765
|
+
* releaseId: 'myRelease',
|
|
4766
|
+
* })
|
|
4767
|
+
*
|
|
4768
|
+
* // The following document will be patched:
|
|
4769
|
+
* // {
|
|
4770
|
+
* // _id: 'versions.myRelease.myDocument',
|
|
4771
|
+
* // _type: 'myDocument',
|
|
4772
|
+
* // title: 'My Document',
|
|
4773
|
+
* // }
|
|
4774
|
+
* ```
|
|
4775
|
+
*
|
|
4776
|
+
* @example Replacing a release version of a published document with a specified version ID
|
|
4777
|
+
* ```ts
|
|
4778
|
+
* await client.replaceVersion({
|
|
4779
|
+
* document: {_type: 'myDocument', _id: 'versions.myRelease.myDocument', title: 'My Document'},
|
|
4780
|
+
* // `publishedId` and `releaseId` are not required since `document._id` has been specified
|
|
4781
|
+
* })
|
|
4782
|
+
*
|
|
4783
|
+
* // The following document will be patched:
|
|
4784
|
+
* // {
|
|
4785
|
+
* // _id: 'versions.myRelease.myDocument',
|
|
4786
|
+
* // _type: 'myDocument',
|
|
4787
|
+
* // title: 'My Document',
|
|
4788
|
+
* // }
|
|
4789
|
+
* ```
|
|
4790
|
+
*
|
|
4791
|
+
* @example Replacing a draft version of a published document
|
|
4792
|
+
* ```ts
|
|
4793
|
+
* await client.replaceVersion({
|
|
4794
|
+
* document: {_type: 'myDocument', title: 'My Document'},
|
|
4795
|
+
* publishedId: 'myDocument',
|
|
4796
|
+
* })
|
|
4797
|
+
*
|
|
4798
|
+
* // The following document will be patched:
|
|
4799
|
+
* // {
|
|
4800
|
+
* // _id: 'drafts.myDocument',
|
|
4801
|
+
* // _type: 'myDocument',
|
|
4802
|
+
* // title: 'My Document',
|
|
4803
|
+
* // }
|
|
4804
|
+
* ```
|
|
4805
|
+
*/
|
|
4806
|
+
replaceVersion<R extends Record<string, Any>>(
|
|
4807
|
+
args: {
|
|
4808
|
+
document: SanityDocumentStub<R>
|
|
4809
|
+
publishedId: string
|
|
4810
|
+
releaseId?: string
|
|
4811
|
+
},
|
|
4812
|
+
options?: BaseActionOptions,
|
|
4813
|
+
): Promise<SingleActionResult | MultipleActionResult>
|
|
4814
|
+
replaceVersion<R extends Record<string, Any>>(
|
|
4815
|
+
args: {
|
|
4816
|
+
document: IdentifiedSanityDocumentStub<R>
|
|
4817
|
+
publishedId?: string
|
|
4818
|
+
releaseId?: string
|
|
4819
|
+
},
|
|
4820
|
+
options?: BaseActionOptions,
|
|
4821
|
+
): Promise<SingleActionResult | MultipleActionResult>
|
|
4822
|
+
/**
|
|
4823
|
+
* @public
|
|
4824
|
+
*
|
|
4825
|
+
* Used to indicate when a document within a release should be unpublished when
|
|
4826
|
+
* the release is run.
|
|
4827
|
+
*
|
|
4828
|
+
* @remarks
|
|
4829
|
+
* * If the published document does not exist, an error will be thrown.
|
|
4830
|
+
*
|
|
4831
|
+
* @param params - Version action parameters:
|
|
4832
|
+
* - `releaseId` - The ID of the release to unpublish the document from.
|
|
4833
|
+
* - `publishedId` - The published ID of the document to unpublish.
|
|
4834
|
+
* @param options - Additional action options.
|
|
4835
|
+
* @returns a promise that resolves to the `transactionId`.
|
|
4836
|
+
*
|
|
4837
|
+
* @example Unpublishing a release version of a published document
|
|
4838
|
+
* ```ts
|
|
4839
|
+
* await client.unpublishVersion({publishedId: 'myDocument', releaseId: 'myRelease'})
|
|
4840
|
+
* // The document with the ID `versions.myRelease.myDocument` will be unpublished. when `myRelease` is run.
|
|
4841
|
+
* ```
|
|
4842
|
+
*/
|
|
4843
|
+
unpublishVersion(
|
|
4844
|
+
{
|
|
4845
|
+
releaseId,
|
|
4846
|
+
publishedId,
|
|
4847
|
+
}: {
|
|
4848
|
+
releaseId: string
|
|
4849
|
+
publishedId: string
|
|
4850
|
+
},
|
|
4851
|
+
options?: BaseActionOptions,
|
|
4852
|
+
): Promise<SingleActionResult | MultipleActionResult>
|
|
3622
4853
|
/**
|
|
3623
4854
|
* Perform mutation operations against the configured dataset
|
|
3624
4855
|
* Returns a promise that resolves to the first mutated document.
|
|
@@ -3659,7 +4890,7 @@ export declare class SanityClient {
|
|
|
3659
4890
|
* @param operations - Mutation operations to execute
|
|
3660
4891
|
* @param options - Mutation options
|
|
3661
4892
|
*/
|
|
3662
|
-
mutate<R extends Record<string, Any>>(
|
|
4893
|
+
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
3663
4894
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
3664
4895
|
options: AllDocumentIdsMutationOptions,
|
|
3665
4896
|
): Promise<MultipleMutationResult>
|
|
@@ -3881,6 +5112,17 @@ export declare interface SanityUser {
|
|
|
3881
5112
|
isCurrentUser: boolean
|
|
3882
5113
|
}
|
|
3883
5114
|
|
|
5115
|
+
/**
|
|
5116
|
+
* Queues release for publishing at the given future time.
|
|
5117
|
+
*
|
|
5118
|
+
* @public
|
|
5119
|
+
*/
|
|
5120
|
+
export declare interface ScheduleReleaseAction {
|
|
5121
|
+
actionType: 'sanity.action.release.schedule'
|
|
5122
|
+
releaseId: string
|
|
5123
|
+
publishAt: string
|
|
5124
|
+
}
|
|
5125
|
+
|
|
3884
5126
|
/** @public */
|
|
3885
5127
|
export declare class ServerError extends Error {
|
|
3886
5128
|
response: ErrorProps['response']
|
|
@@ -4422,6 +5664,16 @@ export declare interface TranslateTargetInclude extends AgentActionTargetInclude
|
|
|
4422
5664
|
include?: (AgentActionPathSegment | TranslateTargetInclude)[]
|
|
4423
5665
|
}
|
|
4424
5666
|
|
|
5667
|
+
/**
|
|
5668
|
+
* Unarchived an `archived` release, and restores all the release documents.
|
|
5669
|
+
*
|
|
5670
|
+
* @public
|
|
5671
|
+
*/
|
|
5672
|
+
export declare interface UnarchiveReleaseAction {
|
|
5673
|
+
actionType: 'sanity.action.release.unarchive'
|
|
5674
|
+
releaseId: string
|
|
5675
|
+
}
|
|
5676
|
+
|
|
4425
5677
|
/** @public */
|
|
4426
5678
|
export declare interface UnfilteredResponseQueryOptions extends ResponseQueryOptions {
|
|
4427
5679
|
filterResponse: false
|
|
@@ -4463,6 +5715,28 @@ export declare type UnpublishAction = {
|
|
|
4463
5715
|
publishedId: string
|
|
4464
5716
|
}
|
|
4465
5717
|
|
|
5718
|
+
/**
|
|
5719
|
+
* Identify that a version of a document should be unpublished when
|
|
5720
|
+
* the release that version is contained within is published.
|
|
5721
|
+
*
|
|
5722
|
+
* @public
|
|
5723
|
+
*/
|
|
5724
|
+
export declare interface UnpublishVersionAction {
|
|
5725
|
+
actionType: 'sanity.action.document.version.unpublish'
|
|
5726
|
+
versionId: string
|
|
5727
|
+
publishedId: string
|
|
5728
|
+
}
|
|
5729
|
+
|
|
5730
|
+
/**
|
|
5731
|
+
* Unschedules a `scheduled` release, stopping it from being published.
|
|
5732
|
+
*
|
|
5733
|
+
* @public
|
|
5734
|
+
*/
|
|
5735
|
+
export declare interface UnscheduleReleaseAction {
|
|
5736
|
+
actionType: 'sanity.action.release.unschedule'
|
|
5737
|
+
releaseId: string
|
|
5738
|
+
}
|
|
5739
|
+
|
|
4466
5740
|
export {unstable__adapter}
|
|
4467
5741
|
|
|
4468
5742
|
export {unstable__environment}
|
|
@@ -4558,6 +5832,13 @@ export declare function validateApiPerspective(
|
|
|
4558
5832
|
*/
|
|
4559
5833
|
export declare const vercelStegaCleanAll: typeof stegaClean
|
|
4560
5834
|
|
|
5835
|
+
/** @public */
|
|
5836
|
+
export declare type VersionAction =
|
|
5837
|
+
| CreateVersionAction
|
|
5838
|
+
| DiscardVersionAction
|
|
5839
|
+
| ReplaceVersionAction
|
|
5840
|
+
| UnpublishVersionAction
|
|
5841
|
+
|
|
4561
5842
|
/**
|
|
4562
5843
|
* The listener has been established, and will start receiving events.
|
|
4563
5844
|
* Note that this is also emitted upon _reconnection_.
|