@sanity/client 7.1.0 → 7.2.1
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 +814 -4
- package/umd/sanityClient.min.js +2 -2
package/dist/index.browser.d.cts
CHANGED
|
@@ -19,6 +19,8 @@ export declare type Action =
|
|
|
19
19
|
| DiscardAction
|
|
20
20
|
| PublishAction
|
|
21
21
|
| UnpublishAction
|
|
22
|
+
| VersionAction
|
|
23
|
+
| ReleaseAction
|
|
22
24
|
|
|
23
25
|
/** @internal */
|
|
24
26
|
export declare interface ActionError {
|
|
@@ -320,6 +322,16 @@ export declare interface ApiError {
|
|
|
320
322
|
statusCode: number
|
|
321
323
|
}
|
|
322
324
|
|
|
325
|
+
/**
|
|
326
|
+
* Archives an `active` release, and deletes all the release documents.
|
|
327
|
+
*
|
|
328
|
+
* @public
|
|
329
|
+
*/
|
|
330
|
+
export declare interface ArchiveReleaseAction {
|
|
331
|
+
actionType: 'sanity.action.release.archive'
|
|
332
|
+
releaseId: string
|
|
333
|
+
}
|
|
334
|
+
|
|
323
335
|
/** @public */
|
|
324
336
|
export declare type AssetMetadataType =
|
|
325
337
|
| 'location'
|
|
@@ -887,6 +899,29 @@ export declare type CreateAction = {
|
|
|
887
899
|
/** @public */
|
|
888
900
|
export declare const createClient: (config: ClientConfig) => SanityClient
|
|
889
901
|
|
|
902
|
+
/**
|
|
903
|
+
* Creates a new release under the given id, with metadata.
|
|
904
|
+
*
|
|
905
|
+
* @public
|
|
906
|
+
*/
|
|
907
|
+
export declare interface CreateReleaseAction {
|
|
908
|
+
actionType: 'sanity.action.release.create'
|
|
909
|
+
releaseId: string
|
|
910
|
+
metadata?: Partial<ReleaseDocument['metadata']>
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
/**
|
|
914
|
+
* Creates a new version of an existing document, attached to the release as given
|
|
915
|
+
* by `document._id`
|
|
916
|
+
*
|
|
917
|
+
* @public
|
|
918
|
+
*/
|
|
919
|
+
export declare interface CreateVersionAction {
|
|
920
|
+
actionType: 'sanity.action.document.version.create'
|
|
921
|
+
publishedId: string
|
|
922
|
+
document: IdentifiedSanityDocumentStub
|
|
923
|
+
}
|
|
924
|
+
|
|
890
925
|
/** @public */
|
|
891
926
|
export declare interface CurrentSanityUser {
|
|
892
927
|
id: string
|
|
@@ -982,6 +1017,16 @@ export declare type DeleteAction = {
|
|
|
982
1017
|
purge?: boolean
|
|
983
1018
|
}
|
|
984
1019
|
|
|
1020
|
+
/**
|
|
1021
|
+
* Deletes a `archived` or `published` release, and all the release documents versions.
|
|
1022
|
+
*
|
|
1023
|
+
* @public
|
|
1024
|
+
*/
|
|
1025
|
+
export declare interface DeleteReleaseAction {
|
|
1026
|
+
actionType: 'sanity.action.release.delete'
|
|
1027
|
+
releaseId: string
|
|
1028
|
+
}
|
|
1029
|
+
|
|
985
1030
|
/**
|
|
986
1031
|
* @public
|
|
987
1032
|
* @deprecated Use the named export `createClient` instead of the `default` export
|
|
@@ -999,6 +1044,7 @@ declare type DeprecatedPreviewDrafts = 'previewDrafts'
|
|
|
999
1044
|
* It is an error if it does not exist. If the purge flag is set, the document history is also deleted.
|
|
1000
1045
|
*
|
|
1001
1046
|
* @public
|
|
1047
|
+
* @deprecated Use {@link DiscardVersionAction} instead
|
|
1002
1048
|
*/
|
|
1003
1049
|
export declare type DiscardAction = {
|
|
1004
1050
|
actionType: 'sanity.action.document.discard'
|
|
@@ -1012,6 +1058,17 @@ export declare type DiscardAction = {
|
|
|
1012
1058
|
purge?: boolean
|
|
1013
1059
|
}
|
|
1014
1060
|
|
|
1061
|
+
/**
|
|
1062
|
+
* Delete a version of a document.
|
|
1063
|
+
*
|
|
1064
|
+
* @public
|
|
1065
|
+
*/
|
|
1066
|
+
export declare interface DiscardVersionAction {
|
|
1067
|
+
actionType: 'sanity.action.document.version.discard'
|
|
1068
|
+
versionId: string
|
|
1069
|
+
purge?: boolean
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1015
1072
|
/**
|
|
1016
1073
|
* The listener has been told to explicitly disconnect.
|
|
1017
1074
|
* This is a rare situation, but may occur if the API knows reconnect attempts will fail,
|
|
@@ -1066,6 +1123,15 @@ export declare interface DocumentAgentActionParam {
|
|
|
1066
1123
|
documentId?: string
|
|
1067
1124
|
}
|
|
1068
1125
|
|
|
1126
|
+
/** @internal */
|
|
1127
|
+
export declare type EditableReleaseDocument = Omit<
|
|
1128
|
+
PartialExcept<ReleaseDocument, '_id'>,
|
|
1129
|
+
'metadata' | '_type'
|
|
1130
|
+
> & {
|
|
1131
|
+
_id: string
|
|
1132
|
+
metadata: Partial<ReleaseDocument['metadata']>
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1069
1135
|
/**
|
|
1070
1136
|
* Modifies an existing draft document.
|
|
1071
1137
|
* It applies the given patch to the document referenced by draftId.
|
|
@@ -1089,6 +1155,17 @@ export declare type EditAction = {
|
|
|
1089
1155
|
patch: PatchOperations
|
|
1090
1156
|
}
|
|
1091
1157
|
|
|
1158
|
+
/**
|
|
1159
|
+
* Edits an existing release, updating the metadata.
|
|
1160
|
+
*
|
|
1161
|
+
* @public
|
|
1162
|
+
*/
|
|
1163
|
+
export declare interface EditReleaseAction {
|
|
1164
|
+
actionType: 'sanity.action.release.edit'
|
|
1165
|
+
releaseId: string
|
|
1166
|
+
patch: PatchOperations
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1092
1169
|
/** @public */
|
|
1093
1170
|
export declare interface ErrorProps {
|
|
1094
1171
|
message: string
|
|
@@ -2114,6 +2191,306 @@ export declare class ObservableProjectsClient {
|
|
|
2114
2191
|
getById(projectId: string): Observable<SanityProject>
|
|
2115
2192
|
}
|
|
2116
2193
|
|
|
2194
|
+
/** @public */
|
|
2195
|
+
declare class ObservableReleasesClient {
|
|
2196
|
+
#private
|
|
2197
|
+
constructor(client: ObservableSanityClient, httpRequest: HttpRequest)
|
|
2198
|
+
/**
|
|
2199
|
+
* @public
|
|
2200
|
+
*
|
|
2201
|
+
* Retrieve a release by id.
|
|
2202
|
+
*
|
|
2203
|
+
* @category Releases
|
|
2204
|
+
*
|
|
2205
|
+
* @param params - Release action parameters:
|
|
2206
|
+
* - `releaseId` - The id of the release to retrieve.
|
|
2207
|
+
* @param options - Additional query options including abort signal and query tag.
|
|
2208
|
+
* @returns An observable that resolves to the release document {@link ReleaseDocument}.
|
|
2209
|
+
*
|
|
2210
|
+
* @example Retrieving a release by id
|
|
2211
|
+
* ```ts
|
|
2212
|
+
* client.observable.releases.get({releaseId: 'my-release'}).pipe(
|
|
2213
|
+
* tap((release) => console.log(release)),
|
|
2214
|
+
* // {
|
|
2215
|
+
* // _id: '_.releases.my-release',
|
|
2216
|
+
* // name: 'my-release'
|
|
2217
|
+
* // _type: 'system.release',
|
|
2218
|
+
* // metadata: {releaseType: 'asap'},
|
|
2219
|
+
* // _createdAt: '2021-01-01T00:00:00.000Z',
|
|
2220
|
+
* // ...
|
|
2221
|
+
* // }
|
|
2222
|
+
* ).subscribe()
|
|
2223
|
+
* ```
|
|
2224
|
+
*/
|
|
2225
|
+
get(
|
|
2226
|
+
{
|
|
2227
|
+
releaseId,
|
|
2228
|
+
}: {
|
|
2229
|
+
releaseId: string
|
|
2230
|
+
},
|
|
2231
|
+
options?: {
|
|
2232
|
+
signal?: AbortSignal
|
|
2233
|
+
tag?: string
|
|
2234
|
+
},
|
|
2235
|
+
): Observable<ReleaseDocument | undefined>
|
|
2236
|
+
/**
|
|
2237
|
+
* @public
|
|
2238
|
+
*
|
|
2239
|
+
* Creates a new release under the given id, with metadata.
|
|
2240
|
+
*
|
|
2241
|
+
* @remarks
|
|
2242
|
+
* * If no releaseId is provided, a release id will be generated.
|
|
2243
|
+
* * If no metadata is provided, then an `undecided` releaseType will be used.
|
|
2244
|
+
*
|
|
2245
|
+
* @category Releases
|
|
2246
|
+
*
|
|
2247
|
+
* @param params - Release action parameters:
|
|
2248
|
+
* - `releaseId` - The id of the release to create.
|
|
2249
|
+
* - `metadata` - The metadata to associate with the release {@link ReleaseDocument}.
|
|
2250
|
+
* @param options - Additional action options.
|
|
2251
|
+
* @returns An observable that resolves to the `transactionId` and the release id and metadata.
|
|
2252
|
+
*
|
|
2253
|
+
* @example Creating a release with a custom id and metadata
|
|
2254
|
+
* ```ts
|
|
2255
|
+
* const releaseId = 'my-release'
|
|
2256
|
+
* const metadata: ReleaseDocument['metadata'] = {
|
|
2257
|
+
* releaseType: 'asap',
|
|
2258
|
+
* }
|
|
2259
|
+
*
|
|
2260
|
+
* client.observable.releases.create({releaseId, metadata}).pipe(
|
|
2261
|
+
* tap(({transactionId, releaseId, metadata}) => console.log(transactionId, releaseId, metadata)),
|
|
2262
|
+
* // {
|
|
2263
|
+
* // transactionId: 'transaction-id',
|
|
2264
|
+
* // releaseId: 'my-release',
|
|
2265
|
+
* // metadata: {releaseType: 'asap'},
|
|
2266
|
+
* // }
|
|
2267
|
+
* ).subscribe()
|
|
2268
|
+
* ```
|
|
2269
|
+
*
|
|
2270
|
+
* @example Creating a release with generated id and metadata
|
|
2271
|
+
* ```ts
|
|
2272
|
+
* client.observable.releases.create().pipe(
|
|
2273
|
+
* tap(({metadata}) => console.log(metadata)),
|
|
2274
|
+
* // {
|
|
2275
|
+
* // metadata: {releaseType: 'undecided'},
|
|
2276
|
+
* // }
|
|
2277
|
+
* ).subscribe()
|
|
2278
|
+
* ```
|
|
2279
|
+
*
|
|
2280
|
+
* @example Creating a release using a custom transaction id
|
|
2281
|
+
* ```ts
|
|
2282
|
+
* client.observable.releases.create({transactionId: 'my-transaction-id'}).pipe(
|
|
2283
|
+
* tap(({transactionId, metadata}) => console.log(transactionId, metadata)),
|
|
2284
|
+
* // {
|
|
2285
|
+
* // transactionId: 'my-transaction-id',
|
|
2286
|
+
* // metadata: {releaseType: 'undecided'},
|
|
2287
|
+
* // }
|
|
2288
|
+
* ).subscribe()
|
|
2289
|
+
* ```
|
|
2290
|
+
*/
|
|
2291
|
+
create(options: BaseActionOptions): Observable<
|
|
2292
|
+
SingleActionResult & {
|
|
2293
|
+
releaseId: string
|
|
2294
|
+
metadata: ReleaseDocument['metadata']
|
|
2295
|
+
}
|
|
2296
|
+
>
|
|
2297
|
+
create(
|
|
2298
|
+
release: {
|
|
2299
|
+
releaseId?: string
|
|
2300
|
+
metadata?: Partial<ReleaseDocument['metadata']>
|
|
2301
|
+
},
|
|
2302
|
+
options?: BaseActionOptions,
|
|
2303
|
+
): Observable<
|
|
2304
|
+
SingleActionResult & {
|
|
2305
|
+
releaseId: string
|
|
2306
|
+
metadata: ReleaseDocument['metadata']
|
|
2307
|
+
}
|
|
2308
|
+
>
|
|
2309
|
+
/**
|
|
2310
|
+
* @public
|
|
2311
|
+
*
|
|
2312
|
+
* Edits an existing release, updating the metadata.
|
|
2313
|
+
*
|
|
2314
|
+
* @category Releases
|
|
2315
|
+
*
|
|
2316
|
+
* @param params - Release action parameters:
|
|
2317
|
+
* - `releaseId` - The id of the release to edit.
|
|
2318
|
+
* - `patch` - The patch operation to apply on the release metadata {@link PatchMutationOperation}.
|
|
2319
|
+
* @param options - Additional action options.
|
|
2320
|
+
* @returns An observable that resolves to the `transactionId`.
|
|
2321
|
+
*/
|
|
2322
|
+
edit(
|
|
2323
|
+
{
|
|
2324
|
+
releaseId,
|
|
2325
|
+
patch,
|
|
2326
|
+
}: {
|
|
2327
|
+
releaseId: string
|
|
2328
|
+
patch: PatchOperations
|
|
2329
|
+
},
|
|
2330
|
+
options?: BaseActionOptions,
|
|
2331
|
+
): Observable<SingleActionResult>
|
|
2332
|
+
/**
|
|
2333
|
+
* @public
|
|
2334
|
+
*
|
|
2335
|
+
* Publishes all documents in a release at once. For larger releases the effect of the publish
|
|
2336
|
+
* will be visible immediately when querying but the removal of the `versions.<releasesId>.*`
|
|
2337
|
+
* documents and creation of the corresponding published documents with the new content may
|
|
2338
|
+
* take some time.
|
|
2339
|
+
*
|
|
2340
|
+
* During this period both the source and target documents are locked and cannot be
|
|
2341
|
+
* modified through any other means.
|
|
2342
|
+
*
|
|
2343
|
+
* @category Releases
|
|
2344
|
+
*
|
|
2345
|
+
* @param params - Release action parameters:
|
|
2346
|
+
* - `releaseId` - The id of the release to publish.
|
|
2347
|
+
* @param options - Additional action options.
|
|
2348
|
+
* @returns An observable that resolves to the `transactionId`.
|
|
2349
|
+
*/
|
|
2350
|
+
publish(
|
|
2351
|
+
{
|
|
2352
|
+
releaseId,
|
|
2353
|
+
}: {
|
|
2354
|
+
releaseId: string
|
|
2355
|
+
},
|
|
2356
|
+
options?: BaseActionOptions,
|
|
2357
|
+
): Observable<SingleActionResult>
|
|
2358
|
+
/**
|
|
2359
|
+
* @public
|
|
2360
|
+
*
|
|
2361
|
+
* An archive action removes an active release. The documents that comprise the release
|
|
2362
|
+
* are deleted and therefore no longer queryable.
|
|
2363
|
+
*
|
|
2364
|
+
* While the documents remain in retention the last version can still be accessed using document history endpoint.
|
|
2365
|
+
*
|
|
2366
|
+
* @category Releases
|
|
2367
|
+
*
|
|
2368
|
+
* @param params - Release action parameters:
|
|
2369
|
+
* - `releaseId` - The id of the release to archive.
|
|
2370
|
+
* @param options - Additional action options.
|
|
2371
|
+
* @returns An observable that resolves to the `transactionId`.
|
|
2372
|
+
*/
|
|
2373
|
+
archive(
|
|
2374
|
+
{
|
|
2375
|
+
releaseId,
|
|
2376
|
+
}: {
|
|
2377
|
+
releaseId: string
|
|
2378
|
+
},
|
|
2379
|
+
options?: BaseActionOptions,
|
|
2380
|
+
): Observable<SingleActionResult>
|
|
2381
|
+
/**
|
|
2382
|
+
* @public
|
|
2383
|
+
*
|
|
2384
|
+
* An unarchive action restores an archived release and all documents
|
|
2385
|
+
* with the content they had just prior to archiving.
|
|
2386
|
+
*
|
|
2387
|
+
* @category Releases
|
|
2388
|
+
*
|
|
2389
|
+
* @param params - Release action parameters:
|
|
2390
|
+
* - `releaseId` - The id of the release to unarchive.
|
|
2391
|
+
* @param options - Additional action options.
|
|
2392
|
+
* @returns An observable that resolves to the `transactionId`.
|
|
2393
|
+
*/
|
|
2394
|
+
unarchive(
|
|
2395
|
+
{
|
|
2396
|
+
releaseId,
|
|
2397
|
+
}: {
|
|
2398
|
+
releaseId: string
|
|
2399
|
+
},
|
|
2400
|
+
options?: BaseActionOptions,
|
|
2401
|
+
): Observable<SingleActionResult>
|
|
2402
|
+
/**
|
|
2403
|
+
* @public
|
|
2404
|
+
*
|
|
2405
|
+
* A schedule action queues a release for publishing at the given future time.
|
|
2406
|
+
* The release is locked such that no documents in the release can be modified and
|
|
2407
|
+
* no documents that it references can be deleted as this would make the publish fail.
|
|
2408
|
+
* At the given time, the same logic as for the publish action is triggered.
|
|
2409
|
+
*
|
|
2410
|
+
* @category Releases
|
|
2411
|
+
*
|
|
2412
|
+
* @param params - Release action parameters:
|
|
2413
|
+
* - `releaseId` - The id of the release to schedule.
|
|
2414
|
+
* - `publishAt` - The serialised date and time to publish the release. If the `publishAt` is in the past, the release will be published immediately.
|
|
2415
|
+
* @param options - Additional action options.
|
|
2416
|
+
* @returns An observable that resolves to the `transactionId`.
|
|
2417
|
+
*/
|
|
2418
|
+
schedule(
|
|
2419
|
+
{
|
|
2420
|
+
releaseId,
|
|
2421
|
+
publishAt,
|
|
2422
|
+
}: {
|
|
2423
|
+
releaseId: string
|
|
2424
|
+
publishAt: string
|
|
2425
|
+
},
|
|
2426
|
+
options?: BaseActionOptions,
|
|
2427
|
+
): Observable<SingleActionResult>
|
|
2428
|
+
/**
|
|
2429
|
+
* @public
|
|
2430
|
+
*
|
|
2431
|
+
* An unschedule action stops a release from being published.
|
|
2432
|
+
* The documents in the release are considered unlocked and can be edited again.
|
|
2433
|
+
* This may fail if another release is scheduled to be published after this one and
|
|
2434
|
+
* has a reference to a document created by this one.
|
|
2435
|
+
*
|
|
2436
|
+
* @category Releases
|
|
2437
|
+
*
|
|
2438
|
+
* @param params - Release action parameters:
|
|
2439
|
+
* - `releaseId` - The id of the release to unschedule.
|
|
2440
|
+
* @param options - Additional action options.
|
|
2441
|
+
* @returns An observable that resolves to the `transactionId`.
|
|
2442
|
+
*/
|
|
2443
|
+
unschedule(
|
|
2444
|
+
{
|
|
2445
|
+
releaseId,
|
|
2446
|
+
}: {
|
|
2447
|
+
releaseId: string
|
|
2448
|
+
},
|
|
2449
|
+
options?: BaseActionOptions,
|
|
2450
|
+
): Observable<SingleActionResult>
|
|
2451
|
+
/**
|
|
2452
|
+
* @public
|
|
2453
|
+
*
|
|
2454
|
+
* A delete action removes a published or archived release.
|
|
2455
|
+
* The backing system document will be removed from the dataset.
|
|
2456
|
+
*
|
|
2457
|
+
* @category Releases
|
|
2458
|
+
*
|
|
2459
|
+
* @param params - Release action parameters:
|
|
2460
|
+
* - `releaseId` - The id of the release to delete.
|
|
2461
|
+
* @param options - Additional action options.
|
|
2462
|
+
* @returns An observable that resolves to the `transactionId`.
|
|
2463
|
+
*/
|
|
2464
|
+
delete(
|
|
2465
|
+
{
|
|
2466
|
+
releaseId,
|
|
2467
|
+
}: {
|
|
2468
|
+
releaseId: string
|
|
2469
|
+
},
|
|
2470
|
+
options?: BaseActionOptions,
|
|
2471
|
+
): Observable<SingleActionResult>
|
|
2472
|
+
/**
|
|
2473
|
+
* @public
|
|
2474
|
+
*
|
|
2475
|
+
* Fetch the documents in a release by release id.
|
|
2476
|
+
*
|
|
2477
|
+
* @category Releases
|
|
2478
|
+
*
|
|
2479
|
+
* @param params - Release action parameters:
|
|
2480
|
+
* - `releaseId` - The id of the release to fetch documents for.
|
|
2481
|
+
* @param options - Additional mutation options {@link BaseMutationOptions}.
|
|
2482
|
+
* @returns An observable that resolves to the documents in the release.
|
|
2483
|
+
*/
|
|
2484
|
+
fetchDocuments(
|
|
2485
|
+
{
|
|
2486
|
+
releaseId,
|
|
2487
|
+
}: {
|
|
2488
|
+
releaseId: string
|
|
2489
|
+
},
|
|
2490
|
+
options?: BaseMutationOptions,
|
|
2491
|
+
): Observable<RawQueryResponse<SanityDocument[]>>
|
|
2492
|
+
}
|
|
2493
|
+
|
|
2117
2494
|
/** @public */
|
|
2118
2495
|
export declare class ObservableSanityClient {
|
|
2119
2496
|
#private
|
|
@@ -2125,6 +2502,7 @@ export declare class ObservableSanityClient {
|
|
|
2125
2502
|
agent: {
|
|
2126
2503
|
action: ObservableAgentsActionClient
|
|
2127
2504
|
}
|
|
2505
|
+
releases: ObservableReleasesClient
|
|
2128
2506
|
/**
|
|
2129
2507
|
* Instance properties
|
|
2130
2508
|
*/
|
|
@@ -2215,7 +2593,9 @@ export declare class ObservableSanityClient {
|
|
|
2215
2593
|
getDocument<R extends Record<string, Any> = Record<string, Any>>(
|
|
2216
2594
|
id: string,
|
|
2217
2595
|
options?: {
|
|
2596
|
+
signal?: AbortSignal
|
|
2218
2597
|
tag?: string
|
|
2598
|
+
releaseId?: string
|
|
2219
2599
|
},
|
|
2220
2600
|
): Observable<SanityDocument<R> | undefined>
|
|
2221
2601
|
/**
|
|
@@ -2398,6 +2778,90 @@ export declare class ObservableSanityClient {
|
|
|
2398
2778
|
document: IdentifiedSanityDocumentStub<R>,
|
|
2399
2779
|
options?: BaseMutationOptions,
|
|
2400
2780
|
): Observable<SanityDocument<R>>
|
|
2781
|
+
/**
|
|
2782
|
+
* @public
|
|
2783
|
+
*
|
|
2784
|
+
* Creates a new version of a published document.
|
|
2785
|
+
*
|
|
2786
|
+
* @remarks
|
|
2787
|
+
* * Requires a document with a `_type` property.
|
|
2788
|
+
* * Creating a version with no `releaseId` will create a new draft version of the published document.
|
|
2789
|
+
* * 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`.
|
|
2790
|
+
* * If the `document._id` is not defined, it will be generated from `publishedId` and `releaseId`.
|
|
2791
|
+
* * To create a version of an unpublished document, use the `client.create` method.
|
|
2792
|
+
*
|
|
2793
|
+
* @category Versions
|
|
2794
|
+
*
|
|
2795
|
+
* @param params - Version action parameters:
|
|
2796
|
+
* - `document` - The document to create as a new version (must include `_type`).
|
|
2797
|
+
* - `publishedId` - The ID of the published document being versioned.
|
|
2798
|
+
* - `releaseId` - The ID of the release to create the version for.
|
|
2799
|
+
* @param options - Additional action options.
|
|
2800
|
+
* @returns an observable that resolves to the `transactionId`.
|
|
2801
|
+
*
|
|
2802
|
+
* @example Creating a new version of a published document with a generated version ID
|
|
2803
|
+
* ```ts
|
|
2804
|
+
* client.observable.createVersion({
|
|
2805
|
+
* // The document does not need to include an `_id` property since it will be generated from `publishedId` and `releaseId`
|
|
2806
|
+
* document: {_type: 'myDocument', title: 'My Document'},
|
|
2807
|
+
* publishedId: 'myDocument',
|
|
2808
|
+
* releaseId: 'myRelease',
|
|
2809
|
+
* })
|
|
2810
|
+
*
|
|
2811
|
+
* // The following document will be created:
|
|
2812
|
+
* // {
|
|
2813
|
+
* // _id: 'versions.myRelease.myDocument',
|
|
2814
|
+
* // _type: 'myDocument',
|
|
2815
|
+
* // title: 'My Document',
|
|
2816
|
+
* // }
|
|
2817
|
+
* ```
|
|
2818
|
+
*
|
|
2819
|
+
* @example Creating a new version of a published document with a specified version ID
|
|
2820
|
+
* ```ts
|
|
2821
|
+
* client.observable.createVersion({
|
|
2822
|
+
* document: {_type: 'myDocument', _id: 'versions.myRelease.myDocument', title: 'My Document'},
|
|
2823
|
+
* // `publishedId` and `releaseId` are not required since `document._id` has been specified
|
|
2824
|
+
* })
|
|
2825
|
+
*
|
|
2826
|
+
* // The following document will be created:
|
|
2827
|
+
* // {
|
|
2828
|
+
* // _id: 'versions.myRelease.myDocument',
|
|
2829
|
+
* // _type: 'myDocument',
|
|
2830
|
+
* // title: 'My Document',
|
|
2831
|
+
* // }
|
|
2832
|
+
* ```
|
|
2833
|
+
*
|
|
2834
|
+
* @example Creating a new draft version of a published document
|
|
2835
|
+
* ```ts
|
|
2836
|
+
* client.observable.createVersion({
|
|
2837
|
+
* document: {_type: 'myDocument', title: 'My Document'},
|
|
2838
|
+
* publishedId: 'myDocument',
|
|
2839
|
+
* })
|
|
2840
|
+
*
|
|
2841
|
+
* // The following document will be created:
|
|
2842
|
+
* // {
|
|
2843
|
+
* // _id: 'drafts.myDocument',
|
|
2844
|
+
* // _type: 'myDocument',
|
|
2845
|
+
* // title: 'My Document',
|
|
2846
|
+
* // }
|
|
2847
|
+
* ```
|
|
2848
|
+
*/
|
|
2849
|
+
createVersion<R extends Record<string, Any>>(
|
|
2850
|
+
args: {
|
|
2851
|
+
document: SanityDocumentStub<R>
|
|
2852
|
+
publishedId: string
|
|
2853
|
+
releaseId?: string
|
|
2854
|
+
},
|
|
2855
|
+
options?: BaseActionOptions,
|
|
2856
|
+
): Observable<SingleActionResult | MultipleActionResult>
|
|
2857
|
+
createVersion<R extends Record<string, Any>>(
|
|
2858
|
+
args: {
|
|
2859
|
+
document: IdentifiedSanityDocumentStub<R>
|
|
2860
|
+
publishedId?: string
|
|
2861
|
+
releaseId?: string
|
|
2862
|
+
},
|
|
2863
|
+
options?: BaseActionOptions,
|
|
2864
|
+
): Observable<SingleActionResult | MultipleActionResult>
|
|
2401
2865
|
/**
|
|
2402
2866
|
* Deletes a document with the given document ID.
|
|
2403
2867
|
* Returns an observable that resolves to the deleted document.
|
|
@@ -2502,6 +2966,157 @@ export declare class ObservableSanityClient {
|
|
|
2502
2966
|
selection: MutationSelection,
|
|
2503
2967
|
options?: BaseMutationOptions,
|
|
2504
2968
|
): Observable<SanityDocument<R>>
|
|
2969
|
+
/**
|
|
2970
|
+
* @public
|
|
2971
|
+
*
|
|
2972
|
+
* Deletes the draft or release version of a document.
|
|
2973
|
+
*
|
|
2974
|
+
* @remarks
|
|
2975
|
+
* * Discarding a version with no `releaseId` will discard the draft version of the published document.
|
|
2976
|
+
* * If the draft or release version does not exist, any error will throw.
|
|
2977
|
+
*
|
|
2978
|
+
* @param params - Version action parameters:
|
|
2979
|
+
* - `releaseId` - The ID of the release to discard the document from.
|
|
2980
|
+
* - `publishedId` - The published ID of the document to discard.
|
|
2981
|
+
* @param purge - if `true` the document history is also discarded.
|
|
2982
|
+
* @param options - Additional action options.
|
|
2983
|
+
* @returns an observable that resolves to the `transactionId`.
|
|
2984
|
+
*
|
|
2985
|
+
* @example Discarding a release version of a document
|
|
2986
|
+
* ```ts
|
|
2987
|
+
* client.observable.discardVersion({publishedId: 'myDocument', releaseId: 'myRelease'})
|
|
2988
|
+
* // The document with the ID `versions.myRelease.myDocument` will be discarded.
|
|
2989
|
+
* ```
|
|
2990
|
+
*
|
|
2991
|
+
* @example Discarding a draft version of a document
|
|
2992
|
+
* ```ts
|
|
2993
|
+
* client.observable.discardVersion({publishedId: 'myDocument'})
|
|
2994
|
+
* // The document with the ID `drafts.myDocument` will be discarded.
|
|
2995
|
+
* ```
|
|
2996
|
+
*/
|
|
2997
|
+
discardVersion(
|
|
2998
|
+
{
|
|
2999
|
+
releaseId,
|
|
3000
|
+
publishedId,
|
|
3001
|
+
}: {
|
|
3002
|
+
releaseId?: string
|
|
3003
|
+
publishedId: string
|
|
3004
|
+
},
|
|
3005
|
+
purge?: boolean,
|
|
3006
|
+
options?: BaseActionOptions,
|
|
3007
|
+
): Observable<SingleActionResult | MultipleActionResult>
|
|
3008
|
+
/**
|
|
3009
|
+
* @public
|
|
3010
|
+
*
|
|
3011
|
+
* Replaces an existing version document.
|
|
3012
|
+
*
|
|
3013
|
+
* @remarks
|
|
3014
|
+
* * Requires a document with a `_type` property.
|
|
3015
|
+
* * 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`.
|
|
3016
|
+
* * If the `document._id` is not defined, it will be generated from `publishedId` and `releaseId`.
|
|
3017
|
+
* * Replacing a version with no `releaseId` will replace the draft version of the published document.
|
|
3018
|
+
* * At least one of the **version** or **published** documents must exist.
|
|
3019
|
+
*
|
|
3020
|
+
* @param params - Version action parameters:
|
|
3021
|
+
* - `document` - The new document to replace the version with.
|
|
3022
|
+
* - `releaseId` - The ID of the release where the document version is replaced.
|
|
3023
|
+
* - `publishedId` - The ID of the published document to replace.
|
|
3024
|
+
* @param options - Additional action options.
|
|
3025
|
+
* @returns an observable that resolves to the `transactionId`.
|
|
3026
|
+
*
|
|
3027
|
+
* @example Replacing a release version of a published document with a generated version ID
|
|
3028
|
+
* ```ts
|
|
3029
|
+
* client.observable.replaceVersion({
|
|
3030
|
+
* document: {_type: 'myDocument', title: 'My Document'},
|
|
3031
|
+
* publishedId: 'myDocument',
|
|
3032
|
+
* releaseId: 'myRelease',
|
|
3033
|
+
* })
|
|
3034
|
+
*
|
|
3035
|
+
* // The following document will be patched:
|
|
3036
|
+
* // {
|
|
3037
|
+
* // _id: 'versions.myRelease.myDocument',
|
|
3038
|
+
* // _type: 'myDocument',
|
|
3039
|
+
* // title: 'My Document',
|
|
3040
|
+
* // }
|
|
3041
|
+
* ```
|
|
3042
|
+
*
|
|
3043
|
+
* @example Replacing a release version of a published document with a specified version ID
|
|
3044
|
+
* ```ts
|
|
3045
|
+
* client.observable.replaceVersion({
|
|
3046
|
+
* document: {_type: 'myDocument', _id: 'versions.myRelease.myDocument', title: 'My Document'},
|
|
3047
|
+
* // `publishedId` and `releaseId` are not required since `document._id` has been specified
|
|
3048
|
+
* })
|
|
3049
|
+
*
|
|
3050
|
+
* // The following document will be patched:
|
|
3051
|
+
* // {
|
|
3052
|
+
* // _id: 'versions.myRelease.myDocument',
|
|
3053
|
+
* // _type: 'myDocument',
|
|
3054
|
+
* // title: 'My Document',
|
|
3055
|
+
* // }
|
|
3056
|
+
* ```
|
|
3057
|
+
*
|
|
3058
|
+
* @example Replacing a draft version of a published document
|
|
3059
|
+
* ```ts
|
|
3060
|
+
* client.observable.replaceVersion({
|
|
3061
|
+
* document: {_type: 'myDocument', title: 'My Document'},
|
|
3062
|
+
* publishedId: 'myDocument',
|
|
3063
|
+
* })
|
|
3064
|
+
*
|
|
3065
|
+
* // The following document will be patched:
|
|
3066
|
+
* // {
|
|
3067
|
+
* // _id: 'drafts.myDocument',
|
|
3068
|
+
* // _type: 'myDocument',
|
|
3069
|
+
* // title: 'My Document',
|
|
3070
|
+
* // }
|
|
3071
|
+
* ```
|
|
3072
|
+
*/
|
|
3073
|
+
replaceVersion<R extends Record<string, Any>>(
|
|
3074
|
+
args: {
|
|
3075
|
+
document: SanityDocumentStub<R>
|
|
3076
|
+
publishedId: string
|
|
3077
|
+
releaseId?: string
|
|
3078
|
+
},
|
|
3079
|
+
options?: BaseActionOptions,
|
|
3080
|
+
): Observable<SingleActionResult | MultipleActionResult>
|
|
3081
|
+
replaceVersion<R extends Record<string, Any>>(
|
|
3082
|
+
args: {
|
|
3083
|
+
document: IdentifiedSanityDocumentStub<R>
|
|
3084
|
+
publishedId?: string
|
|
3085
|
+
releaseId?: string
|
|
3086
|
+
},
|
|
3087
|
+
options?: BaseActionOptions,
|
|
3088
|
+
): Observable<SingleActionResult | MultipleActionResult>
|
|
3089
|
+
/**
|
|
3090
|
+
* @public
|
|
3091
|
+
*
|
|
3092
|
+
* Used to indicate when a document within a release should be unpublished when
|
|
3093
|
+
* the release is run.
|
|
3094
|
+
*
|
|
3095
|
+
* @remarks
|
|
3096
|
+
* * If the published document does not exist, an error will be thrown.
|
|
3097
|
+
*
|
|
3098
|
+
* @param params - Version action parameters:
|
|
3099
|
+
* - `releaseId` - The ID of the release to unpublish the document from.
|
|
3100
|
+
* - `publishedId` - The published ID of the document to unpublish.
|
|
3101
|
+
* @param options - Additional action options.
|
|
3102
|
+
* @returns an observable that resolves to the `transactionId`.
|
|
3103
|
+
*
|
|
3104
|
+
* @example Unpublishing a release version of a published document
|
|
3105
|
+
* ```ts
|
|
3106
|
+
* client.observable.unpublishVersion({publishedId: 'myDocument', releaseId: 'myRelease'})
|
|
3107
|
+
* // The document with the ID `versions.myRelease.myDocument` will be unpublished. when `myRelease` is run.
|
|
3108
|
+
* ```
|
|
3109
|
+
*/
|
|
3110
|
+
unpublishVersion(
|
|
3111
|
+
{
|
|
3112
|
+
releaseId,
|
|
3113
|
+
publishedId,
|
|
3114
|
+
}: {
|
|
3115
|
+
releaseId: string
|
|
3116
|
+
publishedId: string
|
|
3117
|
+
},
|
|
3118
|
+
options?: BaseActionOptions,
|
|
3119
|
+
): Observable<SingleActionResult | MultipleActionResult>
|
|
2505
3120
|
/**
|
|
2506
3121
|
* Perform mutation operations against the configured dataset
|
|
2507
3122
|
* Returns an observable that resolves to the first mutated document.
|
|
@@ -2703,6 +3318,9 @@ export declare type OpenEvent = {
|
|
|
2703
3318
|
type: 'open'
|
|
2704
3319
|
}
|
|
2705
3320
|
|
|
3321
|
+
/** @internal */
|
|
3322
|
+
export declare type PartialExcept<T, K extends keyof T> = Pick<T, K> & Partial<Omit<T, K>>
|
|
3323
|
+
|
|
2706
3324
|
/** @public */
|
|
2707
3325
|
export declare class Patch extends BasePatch {
|
|
2708
3326
|
#private
|
|
@@ -2840,6 +3458,16 @@ export declare type PublishAction = {
|
|
|
2840
3458
|
ifPublishedRevisionId?: string
|
|
2841
3459
|
}
|
|
2842
3460
|
|
|
3461
|
+
/**
|
|
3462
|
+
* Publishes all documents in a release at once.
|
|
3463
|
+
*
|
|
3464
|
+
* @public
|
|
3465
|
+
*/
|
|
3466
|
+
export declare interface PublishReleaseAction {
|
|
3467
|
+
actionType: 'sanity.action.release.publish'
|
|
3468
|
+
releaseId: string
|
|
3469
|
+
}
|
|
3470
|
+
|
|
2843
3471
|
/** @public */
|
|
2844
3472
|
export declare type QueryOptions =
|
|
2845
3473
|
| FilteredResponseQueryOptions
|
|
@@ -2938,17 +3566,373 @@ export declare type ReconnectEvent = {
|
|
|
2938
3566
|
type: 'reconnect'
|
|
2939
3567
|
}
|
|
2940
3568
|
|
|
3569
|
+
/** @public */
|
|
3570
|
+
export declare type ReleaseAction =
|
|
3571
|
+
| CreateReleaseAction
|
|
3572
|
+
| EditReleaseAction
|
|
3573
|
+
| PublishReleaseAction
|
|
3574
|
+
| ArchiveReleaseAction
|
|
3575
|
+
| UnarchiveReleaseAction
|
|
3576
|
+
| ScheduleReleaseAction
|
|
3577
|
+
| UnscheduleReleaseAction
|
|
3578
|
+
| DeleteReleaseAction
|
|
3579
|
+
|
|
3580
|
+
/** @internal */
|
|
3581
|
+
export declare interface ReleaseDocument extends SanityDocument {
|
|
3582
|
+
/**
|
|
3583
|
+
* typically
|
|
3584
|
+
* `_.releases.<name>`
|
|
3585
|
+
*/
|
|
3586
|
+
_id: string
|
|
3587
|
+
/**
|
|
3588
|
+
* where a release has _id `_.releases.foo`, the name is `foo`
|
|
3589
|
+
*/
|
|
3590
|
+
name: string
|
|
3591
|
+
_type: 'system.release'
|
|
3592
|
+
_createdAt: string
|
|
3593
|
+
_updatedAt: string
|
|
3594
|
+
_rev: string
|
|
3595
|
+
state: ReleaseState
|
|
3596
|
+
error?: {
|
|
3597
|
+
message: string
|
|
3598
|
+
}
|
|
3599
|
+
finalDocumentStates?: {
|
|
3600
|
+
/** Document ID */
|
|
3601
|
+
id: string
|
|
3602
|
+
}[]
|
|
3603
|
+
/**
|
|
3604
|
+
* If defined, it takes precedence over the intendedPublishAt, the state should be 'scheduled'
|
|
3605
|
+
*/
|
|
3606
|
+
publishAt?: string
|
|
3607
|
+
/**
|
|
3608
|
+
* If defined, it provides the time the release was actually published
|
|
3609
|
+
*/
|
|
3610
|
+
publishedAt?: string
|
|
3611
|
+
metadata: {
|
|
3612
|
+
title?: string
|
|
3613
|
+
description?: string
|
|
3614
|
+
intendedPublishAt?: string
|
|
3615
|
+
releaseType: ReleaseType
|
|
3616
|
+
}
|
|
3617
|
+
}
|
|
3618
|
+
|
|
2941
3619
|
/**
|
|
2942
3620
|
* @public
|
|
2943
3621
|
* @deprecated – The `r`-prefix is not required, use `string` instead
|
|
2944
3622
|
*/
|
|
2945
3623
|
export declare type ReleaseId = `r${string}`
|
|
2946
3624
|
|
|
3625
|
+
/** @public */
|
|
3626
|
+
declare class ReleasesClient {
|
|
3627
|
+
#private
|
|
3628
|
+
constructor(client: SanityClient, httpRequest: HttpRequest)
|
|
3629
|
+
/**
|
|
3630
|
+
* @public
|
|
3631
|
+
*
|
|
3632
|
+
* Retrieve a release by id.
|
|
3633
|
+
*
|
|
3634
|
+
* @category Releases
|
|
3635
|
+
*
|
|
3636
|
+
* @param params - Release action parameters:
|
|
3637
|
+
* - `releaseId` - The id of the release to retrieve.
|
|
3638
|
+
* @param options - Additional query options including abort signal and query tag.
|
|
3639
|
+
* @returns A promise that resolves to the release document {@link ReleaseDocument}.
|
|
3640
|
+
*
|
|
3641
|
+
* @example Retrieving a release by id
|
|
3642
|
+
* ```ts
|
|
3643
|
+
* const release = await client.releases.get({releaseId: 'my-release'})
|
|
3644
|
+
* console.log(release)
|
|
3645
|
+
* // {
|
|
3646
|
+
* // _id: '_.releases.my-release',
|
|
3647
|
+
* // name: 'my-release'
|
|
3648
|
+
* // _type: 'system.release',
|
|
3649
|
+
* // metadata: {releaseType: 'asap'},
|
|
3650
|
+
* // _createdAt: '2021-01-01T00:00:00.000Z',
|
|
3651
|
+
* // ...
|
|
3652
|
+
* // }
|
|
3653
|
+
* ```
|
|
3654
|
+
*/
|
|
3655
|
+
get(
|
|
3656
|
+
{
|
|
3657
|
+
releaseId,
|
|
3658
|
+
}: {
|
|
3659
|
+
releaseId: string
|
|
3660
|
+
},
|
|
3661
|
+
options?: {
|
|
3662
|
+
signal?: AbortSignal
|
|
3663
|
+
tag?: string
|
|
3664
|
+
},
|
|
3665
|
+
): Promise<ReleaseDocument | undefined>
|
|
3666
|
+
/**
|
|
3667
|
+
* @public
|
|
3668
|
+
*
|
|
3669
|
+
* Creates a new release under the given id, with metadata.
|
|
3670
|
+
*
|
|
3671
|
+
* @remarks
|
|
3672
|
+
* * If no releaseId is provided, a release id will be generated.
|
|
3673
|
+
* * If no metadata is provided, then an `undecided` releaseType will be used.
|
|
3674
|
+
*
|
|
3675
|
+
* @category Releases
|
|
3676
|
+
*
|
|
3677
|
+
* @param params - Release action parameters:
|
|
3678
|
+
* - `releaseId` - The id of the release to create.
|
|
3679
|
+
* - `metadata` - The metadata to associate with the release {@link ReleaseDocument}.
|
|
3680
|
+
* @param options - Additional action options.
|
|
3681
|
+
* @returns A promise that resolves to the `transactionId` and the release id and metadata.
|
|
3682
|
+
*
|
|
3683
|
+
* @example Creating a release with a custom id and metadata
|
|
3684
|
+
* ```ts
|
|
3685
|
+
* const releaseId = 'my-release'
|
|
3686
|
+
* const releaseMetadata: ReleaseDocument['metadata'] = {
|
|
3687
|
+
* releaseType: 'asap',
|
|
3688
|
+
* }
|
|
3689
|
+
*
|
|
3690
|
+
* const result =
|
|
3691
|
+
* await client.releases.create({releaseId, metadata: releaseMetadata})
|
|
3692
|
+
* console.log(result)
|
|
3693
|
+
* // {
|
|
3694
|
+
* // transactionId: 'transaction-id',
|
|
3695
|
+
* // releaseId: 'my-release',
|
|
3696
|
+
* // metadata: {releaseType: 'asap'},
|
|
3697
|
+
* // }
|
|
3698
|
+
* ```
|
|
3699
|
+
*
|
|
3700
|
+
* @example Creating a release with generated id and metadata
|
|
3701
|
+
* ```ts
|
|
3702
|
+
* const {metadata} = await client.releases.create()
|
|
3703
|
+
* console.log(metadata.releaseType) // 'undecided'
|
|
3704
|
+
* ```
|
|
3705
|
+
*
|
|
3706
|
+
* @example Creating a release with a custom transaction id
|
|
3707
|
+
* ```ts
|
|
3708
|
+
* const {transactionId, metadata} = await client.releases.create({transactionId: 'my-transaction-id'})
|
|
3709
|
+
* console.log(metadata.releaseType) // 'undecided'
|
|
3710
|
+
* console.log(transactionId) // 'my-transaction-id'
|
|
3711
|
+
* ```
|
|
3712
|
+
*/
|
|
3713
|
+
create(options: BaseActionOptions): Promise<
|
|
3714
|
+
SingleActionResult & {
|
|
3715
|
+
releaseId: string
|
|
3716
|
+
metadata: ReleaseDocument['metadata']
|
|
3717
|
+
}
|
|
3718
|
+
>
|
|
3719
|
+
create(
|
|
3720
|
+
release: {
|
|
3721
|
+
releaseId?: string
|
|
3722
|
+
metadata?: Partial<ReleaseDocument['metadata']>
|
|
3723
|
+
},
|
|
3724
|
+
options?: BaseActionOptions,
|
|
3725
|
+
): Promise<
|
|
3726
|
+
SingleActionResult & {
|
|
3727
|
+
releaseId: string
|
|
3728
|
+
metadata: ReleaseDocument['metadata']
|
|
3729
|
+
}
|
|
3730
|
+
>
|
|
3731
|
+
/**
|
|
3732
|
+
* @public
|
|
3733
|
+
*
|
|
3734
|
+
* Edits an existing release, updating the metadata.
|
|
3735
|
+
*
|
|
3736
|
+
* @category Releases
|
|
3737
|
+
*
|
|
3738
|
+
* @param params - Release action parameters:
|
|
3739
|
+
* - `releaseId` - The id of the release to edit.
|
|
3740
|
+
* - `patch` - The patch operation to apply on the release metadata {@link PatchMutationOperation}.
|
|
3741
|
+
* @param options - Additional action options.
|
|
3742
|
+
* @returns A promise that resolves to the `transactionId`.
|
|
3743
|
+
*/
|
|
3744
|
+
edit(
|
|
3745
|
+
{
|
|
3746
|
+
releaseId,
|
|
3747
|
+
patch,
|
|
3748
|
+
}: {
|
|
3749
|
+
releaseId: string
|
|
3750
|
+
patch: PatchOperations
|
|
3751
|
+
},
|
|
3752
|
+
options?: BaseActionOptions,
|
|
3753
|
+
): Promise<SingleActionResult>
|
|
3754
|
+
/**
|
|
3755
|
+
* @public
|
|
3756
|
+
*
|
|
3757
|
+
* Publishes all documents in a release at once. For larger releases the effect of the publish
|
|
3758
|
+
* will be visible immediately when querying but the removal of the `versions.<releasesId>.*`
|
|
3759
|
+
* documents and creation of the corresponding published documents with the new content may
|
|
3760
|
+
* take some time.
|
|
3761
|
+
*
|
|
3762
|
+
* During this period both the source and target documents are locked and cannot be
|
|
3763
|
+
* modified through any other means.
|
|
3764
|
+
*
|
|
3765
|
+
* @category Releases
|
|
3766
|
+
*
|
|
3767
|
+
* @param params - Release action parameters:
|
|
3768
|
+
* - `releaseId` - The id of the release to publish.
|
|
3769
|
+
* @param options - Additional action options.
|
|
3770
|
+
* @returns A promise that resolves to the `transactionId`.
|
|
3771
|
+
*/
|
|
3772
|
+
publish(
|
|
3773
|
+
{
|
|
3774
|
+
releaseId,
|
|
3775
|
+
}: {
|
|
3776
|
+
releaseId: string
|
|
3777
|
+
},
|
|
3778
|
+
options?: BaseActionOptions,
|
|
3779
|
+
): Promise<SingleActionResult>
|
|
3780
|
+
/**
|
|
3781
|
+
* @public
|
|
3782
|
+
*
|
|
3783
|
+
* An archive action removes an active release. The documents that comprise the release
|
|
3784
|
+
* are deleted and therefore no longer queryable.
|
|
3785
|
+
*
|
|
3786
|
+
* While the documents remain in retention the last version can still be accessed using document history endpoint.
|
|
3787
|
+
*
|
|
3788
|
+
* @category Releases
|
|
3789
|
+
*
|
|
3790
|
+
* @param params - Release action parameters:
|
|
3791
|
+
* - `releaseId` - The id of the release to archive.
|
|
3792
|
+
* @param options - Additional action options.
|
|
3793
|
+
* @returns A promise that resolves to the `transactionId`.
|
|
3794
|
+
*/
|
|
3795
|
+
archive(
|
|
3796
|
+
{
|
|
3797
|
+
releaseId,
|
|
3798
|
+
}: {
|
|
3799
|
+
releaseId: string
|
|
3800
|
+
},
|
|
3801
|
+
options?: BaseActionOptions,
|
|
3802
|
+
): Promise<SingleActionResult>
|
|
3803
|
+
/**
|
|
3804
|
+
* @public
|
|
3805
|
+
*
|
|
3806
|
+
* An unarchive action restores an archived release and all documents
|
|
3807
|
+
* with the content they had just prior to archiving.
|
|
3808
|
+
*
|
|
3809
|
+
* @category Releases
|
|
3810
|
+
*
|
|
3811
|
+
* @param params - Release action parameters:
|
|
3812
|
+
* - `releaseId` - The id of the release to unarchive.
|
|
3813
|
+
* @param options - Additional action options.
|
|
3814
|
+
* @returns A promise that resolves to the `transactionId`.
|
|
3815
|
+
*/
|
|
3816
|
+
unarchive(
|
|
3817
|
+
{
|
|
3818
|
+
releaseId,
|
|
3819
|
+
}: {
|
|
3820
|
+
releaseId: string
|
|
3821
|
+
},
|
|
3822
|
+
options?: BaseActionOptions,
|
|
3823
|
+
): Promise<SingleActionResult>
|
|
3824
|
+
/**
|
|
3825
|
+
* @public
|
|
3826
|
+
*
|
|
3827
|
+
* A schedule action queues a release for publishing at the given future time.
|
|
3828
|
+
* The release is locked such that no documents in the release can be modified and
|
|
3829
|
+
* no documents that it references can be deleted as this would make the publish fail.
|
|
3830
|
+
* At the given time, the same logic as for the publish action is triggered.
|
|
3831
|
+
*
|
|
3832
|
+
* @category Releases
|
|
3833
|
+
*
|
|
3834
|
+
* @param params - Release action parameters:
|
|
3835
|
+
* - `releaseId` - The id of the release to schedule.
|
|
3836
|
+
* - `publishAt` - The serialised date and time to publish the release. If the `publishAt` is in the past, the release will be published immediately.
|
|
3837
|
+
* @param options - Additional action options.
|
|
3838
|
+
* @returns A promise that resolves to the `transactionId`.
|
|
3839
|
+
*/
|
|
3840
|
+
schedule(
|
|
3841
|
+
{
|
|
3842
|
+
releaseId,
|
|
3843
|
+
publishAt,
|
|
3844
|
+
}: {
|
|
3845
|
+
releaseId: string
|
|
3846
|
+
publishAt: string
|
|
3847
|
+
},
|
|
3848
|
+
options?: BaseActionOptions,
|
|
3849
|
+
): Promise<SingleActionResult>
|
|
3850
|
+
/**
|
|
3851
|
+
* @public
|
|
3852
|
+
*
|
|
3853
|
+
* An unschedule action stops a release from being published.
|
|
3854
|
+
* The documents in the release are considered unlocked and can be edited again.
|
|
3855
|
+
* This may fail if another release is scheduled to be published after this one and
|
|
3856
|
+
* has a reference to a document created by this one.
|
|
3857
|
+
*
|
|
3858
|
+
* @category Releases
|
|
3859
|
+
*
|
|
3860
|
+
* @param params - Release action parameters:
|
|
3861
|
+
* - `releaseId` - The id of the release to unschedule.
|
|
3862
|
+
* @param options - Additional action options.
|
|
3863
|
+
* @returns A promise that resolves to the `transactionId`.
|
|
3864
|
+
*/
|
|
3865
|
+
unschedule(
|
|
3866
|
+
{
|
|
3867
|
+
releaseId,
|
|
3868
|
+
}: {
|
|
3869
|
+
releaseId: string
|
|
3870
|
+
},
|
|
3871
|
+
options?: BaseActionOptions,
|
|
3872
|
+
): Promise<SingleActionResult>
|
|
3873
|
+
/**
|
|
3874
|
+
* @public
|
|
3875
|
+
*
|
|
3876
|
+
* A delete action removes a published or archived release.
|
|
3877
|
+
* The backing system document will be removed from the dataset.
|
|
3878
|
+
*
|
|
3879
|
+
* @category Releases
|
|
3880
|
+
*
|
|
3881
|
+
* @param params - Release action parameters:
|
|
3882
|
+
* - `releaseId` - The id of the release to delete.
|
|
3883
|
+
* @param options - Additional action options.
|
|
3884
|
+
* @returns A promise that resolves to the `transactionId`.
|
|
3885
|
+
*/
|
|
3886
|
+
delete(
|
|
3887
|
+
{
|
|
3888
|
+
releaseId,
|
|
3889
|
+
}: {
|
|
3890
|
+
releaseId: string
|
|
3891
|
+
},
|
|
3892
|
+
options?: BaseActionOptions,
|
|
3893
|
+
): Promise<SingleActionResult>
|
|
3894
|
+
/**
|
|
3895
|
+
* @public
|
|
3896
|
+
*
|
|
3897
|
+
* Fetch the documents in a release by release id.
|
|
3898
|
+
*
|
|
3899
|
+
* @category Releases
|
|
3900
|
+
*
|
|
3901
|
+
* @param params - Release action parameters:
|
|
3902
|
+
* - `releaseId` - The id of the release to fetch documents for.
|
|
3903
|
+
* @param options - Additional mutation options {@link BaseMutationOptions}.
|
|
3904
|
+
* @returns A promise that resolves to the documents in the release.
|
|
3905
|
+
*/
|
|
3906
|
+
fetchDocuments(
|
|
3907
|
+
{
|
|
3908
|
+
releaseId,
|
|
3909
|
+
}: {
|
|
3910
|
+
releaseId: string
|
|
3911
|
+
},
|
|
3912
|
+
options?: BaseMutationOptions,
|
|
3913
|
+
): Promise<RawQueryResponse<SanityDocument[]>>
|
|
3914
|
+
}
|
|
3915
|
+
|
|
3916
|
+
/** @beta */
|
|
3917
|
+
export declare type ReleaseState =
|
|
3918
|
+
| 'active'
|
|
3919
|
+
| 'archiving'
|
|
3920
|
+
| 'unarchiving'
|
|
3921
|
+
| 'archived'
|
|
3922
|
+
| 'published'
|
|
3923
|
+
| 'publishing'
|
|
3924
|
+
| 'scheduled'
|
|
3925
|
+
| 'scheduling'
|
|
3926
|
+
|
|
3927
|
+
/** @internal */
|
|
3928
|
+
export declare type ReleaseType = 'asap' | 'scheduled' | 'undecided'
|
|
3929
|
+
|
|
2947
3930
|
/**
|
|
2948
3931
|
* Replaces an existing draft document.
|
|
2949
3932
|
* At least one of the draft or published versions of the document must exist.
|
|
2950
3933
|
*
|
|
2951
3934
|
* @public
|
|
3935
|
+
* @deprecated Use {@link ReplaceVersionAction} instead
|
|
2952
3936
|
*/
|
|
2953
3937
|
export declare type ReplaceDraftAction = {
|
|
2954
3938
|
actionType: 'sanity.action.document.replaceDraft'
|
|
@@ -2962,6 +3946,16 @@ export declare type ReplaceDraftAction = {
|
|
|
2962
3946
|
attributes: IdentifiedSanityDocumentStub
|
|
2963
3947
|
}
|
|
2964
3948
|
|
|
3949
|
+
/**
|
|
3950
|
+
* Replace an existing version of a document.
|
|
3951
|
+
*
|
|
3952
|
+
* @public
|
|
3953
|
+
*/
|
|
3954
|
+
export declare interface ReplaceVersionAction {
|
|
3955
|
+
actionType: 'sanity.action.document.version.replace'
|
|
3956
|
+
document: IdentifiedSanityDocumentStub
|
|
3957
|
+
}
|
|
3958
|
+
|
|
2965
3959
|
/** @public */
|
|
2966
3960
|
export declare const requester: Requester
|
|
2967
3961
|
|
|
@@ -3047,6 +4041,7 @@ export declare class SanityClient {
|
|
|
3047
4041
|
agent: {
|
|
3048
4042
|
action: AgentActionsClient
|
|
3049
4043
|
}
|
|
4044
|
+
releases: ReleasesClient
|
|
3050
4045
|
/**
|
|
3051
4046
|
* Observable version of the Sanity client, with the same configuration as the promise-based one
|
|
3052
4047
|
*/
|
|
@@ -3143,6 +4138,7 @@ export declare class SanityClient {
|
|
|
3143
4138
|
options?: {
|
|
3144
4139
|
signal?: AbortSignal
|
|
3145
4140
|
tag?: string
|
|
4141
|
+
releaseId?: string
|
|
3146
4142
|
},
|
|
3147
4143
|
): Promise<SanityDocument<R> | undefined>
|
|
3148
4144
|
/**
|
|
@@ -3326,6 +4322,90 @@ export declare class SanityClient {
|
|
|
3326
4322
|
document: IdentifiedSanityDocumentStub<R>,
|
|
3327
4323
|
options?: BaseMutationOptions,
|
|
3328
4324
|
): Promise<SanityDocument<R>>
|
|
4325
|
+
/**
|
|
4326
|
+
* @public
|
|
4327
|
+
*
|
|
4328
|
+
* Creates a new version of a published document.
|
|
4329
|
+
*
|
|
4330
|
+
* @remarks
|
|
4331
|
+
* * Requires a document with a `_type` property.
|
|
4332
|
+
* * Creating a version with no `releaseId` will create a new draft version of the published document.
|
|
4333
|
+
* * 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`.
|
|
4334
|
+
* * If the `document._id` is not defined, it will be generated from `publishedId` and `releaseId`.
|
|
4335
|
+
* * To create a version of an unpublished document, use the `client.create` method.
|
|
4336
|
+
*
|
|
4337
|
+
* @category Versions
|
|
4338
|
+
*
|
|
4339
|
+
* @param params - Version action parameters:
|
|
4340
|
+
* - `document` - The document to create as a new version (must include `_type`).
|
|
4341
|
+
* - `publishedId` - The ID of the published document being versioned.
|
|
4342
|
+
* - `releaseId` - The ID of the release to create the version for.
|
|
4343
|
+
* @param options - Additional action options.
|
|
4344
|
+
* @returns A promise that resolves to the `transactionId`.
|
|
4345
|
+
*
|
|
4346
|
+
* @example Creating a new version of a published document with a generated version ID
|
|
4347
|
+
* ```ts
|
|
4348
|
+
* const transactionId = await client.createVersion({
|
|
4349
|
+
* // The document does not need to include an `_id` property since it will be generated from `publishedId` and `releaseId`
|
|
4350
|
+
* document: {_type: 'myDocument', title: 'My Document'},
|
|
4351
|
+
* publishedId: 'myDocument',
|
|
4352
|
+
* releaseId: 'myRelease',
|
|
4353
|
+
* })
|
|
4354
|
+
*
|
|
4355
|
+
* // The following document will be created:
|
|
4356
|
+
* // {
|
|
4357
|
+
* // _id: 'versions.myRelease.myDocument',
|
|
4358
|
+
* // _type: 'myDocument',
|
|
4359
|
+
* // title: 'My Document',
|
|
4360
|
+
* // }
|
|
4361
|
+
* ```
|
|
4362
|
+
*
|
|
4363
|
+
* @example Creating a new version of a published document with a specified version ID
|
|
4364
|
+
* ```ts
|
|
4365
|
+
* const transactionId = await client.createVersion({
|
|
4366
|
+
* document: {_type: 'myDocument', _id: 'versions.myRelease.myDocument', title: 'My Document'},
|
|
4367
|
+
* // `publishedId` and `releaseId` are not required since `document._id` has been specified
|
|
4368
|
+
* })
|
|
4369
|
+
*
|
|
4370
|
+
* // The following document will be created:
|
|
4371
|
+
* // {
|
|
4372
|
+
* // _id: 'versions.myRelease.myDocument',
|
|
4373
|
+
* // _type: 'myDocument',
|
|
4374
|
+
* // title: 'My Document',
|
|
4375
|
+
* // }
|
|
4376
|
+
* ```
|
|
4377
|
+
*
|
|
4378
|
+
* @example Creating a new draft version of a published document
|
|
4379
|
+
* ```ts
|
|
4380
|
+
* const transactionId = await client.createVersion({
|
|
4381
|
+
* document: {_type: 'myDocument', title: 'My Document'},
|
|
4382
|
+
* publishedId: 'myDocument',
|
|
4383
|
+
* })
|
|
4384
|
+
*
|
|
4385
|
+
* // The following document will be created:
|
|
4386
|
+
* // {
|
|
4387
|
+
* // _id: 'drafts.myDocument',
|
|
4388
|
+
* // _type: 'myDocument',
|
|
4389
|
+
* // title: 'My Document',
|
|
4390
|
+
* // }
|
|
4391
|
+
* ```
|
|
4392
|
+
*/
|
|
4393
|
+
createVersion<R extends Record<string, Any>>(
|
|
4394
|
+
args: {
|
|
4395
|
+
document: SanityDocumentStub<R>
|
|
4396
|
+
publishedId: string
|
|
4397
|
+
releaseId?: string
|
|
4398
|
+
},
|
|
4399
|
+
options?: BaseActionOptions,
|
|
4400
|
+
): Promise<SingleActionResult | MultipleActionResult>
|
|
4401
|
+
createVersion<R extends Record<string, Any>>(
|
|
4402
|
+
args: {
|
|
4403
|
+
document: IdentifiedSanityDocumentStub<R>
|
|
4404
|
+
publishedId?: string
|
|
4405
|
+
releaseId?: string
|
|
4406
|
+
},
|
|
4407
|
+
options?: BaseActionOptions,
|
|
4408
|
+
): Promise<SingleActionResult | MultipleActionResult>
|
|
3329
4409
|
/**
|
|
3330
4410
|
* Deletes a document with the given document ID.
|
|
3331
4411
|
* Returns a promise that resolves to the deleted document.
|
|
@@ -3430,6 +4510,157 @@ export declare class SanityClient {
|
|
|
3430
4510
|
selection: MutationSelection,
|
|
3431
4511
|
options?: BaseMutationOptions,
|
|
3432
4512
|
): Promise<SanityDocument<R>>
|
|
4513
|
+
/**
|
|
4514
|
+
* @public
|
|
4515
|
+
*
|
|
4516
|
+
* Deletes the draft or release version of a document.
|
|
4517
|
+
*
|
|
4518
|
+
* @remarks
|
|
4519
|
+
* * Discarding a version with no `releaseId` will discard the draft version of the published document.
|
|
4520
|
+
* * If the draft or release version does not exist, any error will throw.
|
|
4521
|
+
*
|
|
4522
|
+
* @param params - Version action parameters:
|
|
4523
|
+
* - `releaseId` - The ID of the release to discard the document from.
|
|
4524
|
+
* - `publishedId` - The published ID of the document to discard.
|
|
4525
|
+
* @param purge - if `true` the document history is also discarded.
|
|
4526
|
+
* @param options - Additional action options.
|
|
4527
|
+
* @returns a promise that resolves to the `transactionId`.
|
|
4528
|
+
*
|
|
4529
|
+
* @example Discarding a release version of a document
|
|
4530
|
+
* ```ts
|
|
4531
|
+
* client.discardVersion({publishedId: 'myDocument', releaseId: 'myRelease'})
|
|
4532
|
+
* // The document with the ID `versions.myRelease.myDocument` will be discarded.
|
|
4533
|
+
* ```
|
|
4534
|
+
*
|
|
4535
|
+
* @example Discarding a draft version of a document
|
|
4536
|
+
* ```ts
|
|
4537
|
+
* client.discardVersion({publishedId: 'myDocument'})
|
|
4538
|
+
* // The document with the ID `drafts.myDocument` will be discarded.
|
|
4539
|
+
* ```
|
|
4540
|
+
*/
|
|
4541
|
+
discardVersion(
|
|
4542
|
+
{
|
|
4543
|
+
releaseId,
|
|
4544
|
+
publishedId,
|
|
4545
|
+
}: {
|
|
4546
|
+
releaseId?: string
|
|
4547
|
+
publishedId: string
|
|
4548
|
+
},
|
|
4549
|
+
purge?: boolean,
|
|
4550
|
+
options?: BaseActionOptions,
|
|
4551
|
+
): Promise<SingleActionResult | MultipleActionResult>
|
|
4552
|
+
/**
|
|
4553
|
+
* @public
|
|
4554
|
+
*
|
|
4555
|
+
* Replaces an existing version document.
|
|
4556
|
+
*
|
|
4557
|
+
* @remarks
|
|
4558
|
+
* * Requires a document with a `_type` property.
|
|
4559
|
+
* * 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`.
|
|
4560
|
+
* * If the `document._id` is not defined, it will be generated from `publishedId` and `releaseId`.
|
|
4561
|
+
* * Replacing a version with no `releaseId` will replace the draft version of the published document.
|
|
4562
|
+
* * At least one of the **version** or **published** documents must exist.
|
|
4563
|
+
*
|
|
4564
|
+
* @param params - Version action parameters:
|
|
4565
|
+
* - `document` - The new document to replace the version with.
|
|
4566
|
+
* - `releaseId` - The ID of the release where the document version is replaced.
|
|
4567
|
+
* - `publishedId` - The ID of the published document to replace.
|
|
4568
|
+
* @param options - Additional action options.
|
|
4569
|
+
* @returns a promise that resolves to the `transactionId`.
|
|
4570
|
+
*
|
|
4571
|
+
* @example Replacing a release version of a published document with a generated version ID
|
|
4572
|
+
* ```ts
|
|
4573
|
+
* await client.replaceVersion({
|
|
4574
|
+
* document: {_type: 'myDocument', title: 'My Document'},
|
|
4575
|
+
* publishedId: 'myDocument',
|
|
4576
|
+
* releaseId: 'myRelease',
|
|
4577
|
+
* })
|
|
4578
|
+
*
|
|
4579
|
+
* // The following document will be patched:
|
|
4580
|
+
* // {
|
|
4581
|
+
* // _id: 'versions.myRelease.myDocument',
|
|
4582
|
+
* // _type: 'myDocument',
|
|
4583
|
+
* // title: 'My Document',
|
|
4584
|
+
* // }
|
|
4585
|
+
* ```
|
|
4586
|
+
*
|
|
4587
|
+
* @example Replacing a release version of a published document with a specified version ID
|
|
4588
|
+
* ```ts
|
|
4589
|
+
* await client.replaceVersion({
|
|
4590
|
+
* document: {_type: 'myDocument', _id: 'versions.myRelease.myDocument', title: 'My Document'},
|
|
4591
|
+
* // `publishedId` and `releaseId` are not required since `document._id` has been specified
|
|
4592
|
+
* })
|
|
4593
|
+
*
|
|
4594
|
+
* // The following document will be patched:
|
|
4595
|
+
* // {
|
|
4596
|
+
* // _id: 'versions.myRelease.myDocument',
|
|
4597
|
+
* // _type: 'myDocument',
|
|
4598
|
+
* // title: 'My Document',
|
|
4599
|
+
* // }
|
|
4600
|
+
* ```
|
|
4601
|
+
*
|
|
4602
|
+
* @example Replacing a draft version of a published document
|
|
4603
|
+
* ```ts
|
|
4604
|
+
* await client.replaceVersion({
|
|
4605
|
+
* document: {_type: 'myDocument', title: 'My Document'},
|
|
4606
|
+
* publishedId: 'myDocument',
|
|
4607
|
+
* })
|
|
4608
|
+
*
|
|
4609
|
+
* // The following document will be patched:
|
|
4610
|
+
* // {
|
|
4611
|
+
* // _id: 'drafts.myDocument',
|
|
4612
|
+
* // _type: 'myDocument',
|
|
4613
|
+
* // title: 'My Document',
|
|
4614
|
+
* // }
|
|
4615
|
+
* ```
|
|
4616
|
+
*/
|
|
4617
|
+
replaceVersion<R extends Record<string, Any>>(
|
|
4618
|
+
args: {
|
|
4619
|
+
document: SanityDocumentStub<R>
|
|
4620
|
+
publishedId: string
|
|
4621
|
+
releaseId?: string
|
|
4622
|
+
},
|
|
4623
|
+
options?: BaseActionOptions,
|
|
4624
|
+
): Promise<SingleActionResult | MultipleActionResult>
|
|
4625
|
+
replaceVersion<R extends Record<string, Any>>(
|
|
4626
|
+
args: {
|
|
4627
|
+
document: IdentifiedSanityDocumentStub<R>
|
|
4628
|
+
publishedId?: string
|
|
4629
|
+
releaseId?: string
|
|
4630
|
+
},
|
|
4631
|
+
options?: BaseActionOptions,
|
|
4632
|
+
): Promise<SingleActionResult | MultipleActionResult>
|
|
4633
|
+
/**
|
|
4634
|
+
* @public
|
|
4635
|
+
*
|
|
4636
|
+
* Used to indicate when a document within a release should be unpublished when
|
|
4637
|
+
* the release is run.
|
|
4638
|
+
*
|
|
4639
|
+
* @remarks
|
|
4640
|
+
* * If the published document does not exist, an error will be thrown.
|
|
4641
|
+
*
|
|
4642
|
+
* @param params - Version action parameters:
|
|
4643
|
+
* - `releaseId` - The ID of the release to unpublish the document from.
|
|
4644
|
+
* - `publishedId` - The published ID of the document to unpublish.
|
|
4645
|
+
* @param options - Additional action options.
|
|
4646
|
+
* @returns a promise that resolves to the `transactionId`.
|
|
4647
|
+
*
|
|
4648
|
+
* @example Unpublishing a release version of a published document
|
|
4649
|
+
* ```ts
|
|
4650
|
+
* await client.unpublishVersion({publishedId: 'myDocument', releaseId: 'myRelease'})
|
|
4651
|
+
* // The document with the ID `versions.myRelease.myDocument` will be unpublished. when `myRelease` is run.
|
|
4652
|
+
* ```
|
|
4653
|
+
*/
|
|
4654
|
+
unpublishVersion(
|
|
4655
|
+
{
|
|
4656
|
+
releaseId,
|
|
4657
|
+
publishedId,
|
|
4658
|
+
}: {
|
|
4659
|
+
releaseId: string
|
|
4660
|
+
publishedId: string
|
|
4661
|
+
},
|
|
4662
|
+
options?: BaseActionOptions,
|
|
4663
|
+
): Promise<SingleActionResult | MultipleActionResult>
|
|
3433
4664
|
/**
|
|
3434
4665
|
* Perform mutation operations against the configured dataset
|
|
3435
4666
|
* Returns a promise that resolves to the first mutated document.
|
|
@@ -3470,7 +4701,7 @@ export declare class SanityClient {
|
|
|
3470
4701
|
* @param operations - Mutation operations to execute
|
|
3471
4702
|
* @param options - Mutation options
|
|
3472
4703
|
*/
|
|
3473
|
-
mutate<R extends Record<string, Any>>(
|
|
4704
|
+
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
3474
4705
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
3475
4706
|
options: AllDocumentIdsMutationOptions,
|
|
3476
4707
|
): Promise<MultipleMutationResult>
|
|
@@ -3686,6 +4917,17 @@ export declare interface SanityUser {
|
|
|
3686
4917
|
isCurrentUser: boolean
|
|
3687
4918
|
}
|
|
3688
4919
|
|
|
4920
|
+
/**
|
|
4921
|
+
* Queues release for publishing at the given future time.
|
|
4922
|
+
*
|
|
4923
|
+
* @public
|
|
4924
|
+
*/
|
|
4925
|
+
export declare interface ScheduleReleaseAction {
|
|
4926
|
+
actionType: 'sanity.action.release.schedule'
|
|
4927
|
+
releaseId: string
|
|
4928
|
+
publishAt: string
|
|
4929
|
+
}
|
|
4930
|
+
|
|
3689
4931
|
/** @public */
|
|
3690
4932
|
export declare class ServerError extends Error {
|
|
3691
4933
|
response: ErrorProps['response']
|
|
@@ -4164,6 +5406,16 @@ export declare interface TranslateTargetInclude extends AgentActionTargetInclude
|
|
|
4164
5406
|
include?: (AgentActionPathSegment | TranslateTargetInclude)[]
|
|
4165
5407
|
}
|
|
4166
5408
|
|
|
5409
|
+
/**
|
|
5410
|
+
* Unarchived an `archived` release, and restores all the release documents.
|
|
5411
|
+
*
|
|
5412
|
+
* @public
|
|
5413
|
+
*/
|
|
5414
|
+
export declare interface UnarchiveReleaseAction {
|
|
5415
|
+
actionType: 'sanity.action.release.unarchive'
|
|
5416
|
+
releaseId: string
|
|
5417
|
+
}
|
|
5418
|
+
|
|
4167
5419
|
/** @public */
|
|
4168
5420
|
export declare interface UnfilteredResponseQueryOptions extends ResponseQueryOptions {
|
|
4169
5421
|
filterResponse: false
|
|
@@ -4205,6 +5457,28 @@ export declare type UnpublishAction = {
|
|
|
4205
5457
|
publishedId: string
|
|
4206
5458
|
}
|
|
4207
5459
|
|
|
5460
|
+
/**
|
|
5461
|
+
* Identify that a version of a document should be unpublished when
|
|
5462
|
+
* the release that version is contained within is published.
|
|
5463
|
+
*
|
|
5464
|
+
* @public
|
|
5465
|
+
*/
|
|
5466
|
+
export declare interface UnpublishVersionAction {
|
|
5467
|
+
actionType: 'sanity.action.document.version.unpublish'
|
|
5468
|
+
versionId: string
|
|
5469
|
+
publishedId: string
|
|
5470
|
+
}
|
|
5471
|
+
|
|
5472
|
+
/**
|
|
5473
|
+
* Unschedules a `scheduled` release, stopping it from being published.
|
|
5474
|
+
*
|
|
5475
|
+
* @public
|
|
5476
|
+
*/
|
|
5477
|
+
export declare interface UnscheduleReleaseAction {
|
|
5478
|
+
actionType: 'sanity.action.release.unschedule'
|
|
5479
|
+
releaseId: string
|
|
5480
|
+
}
|
|
5481
|
+
|
|
4208
5482
|
export {unstable__adapter}
|
|
4209
5483
|
|
|
4210
5484
|
export {unstable__environment}
|
|
@@ -4292,6 +5566,13 @@ export declare function validateApiPerspective(
|
|
|
4292
5566
|
perspective: unknown,
|
|
4293
5567
|
): asserts perspective is ClientPerspective
|
|
4294
5568
|
|
|
5569
|
+
/** @public */
|
|
5570
|
+
export declare type VersionAction =
|
|
5571
|
+
| CreateVersionAction
|
|
5572
|
+
| DiscardVersionAction
|
|
5573
|
+
| ReplaceVersionAction
|
|
5574
|
+
| UnpublishVersionAction
|
|
5575
|
+
|
|
4295
5576
|
/**
|
|
4296
5577
|
* The listener has been established, and will start receiving events.
|
|
4297
5578
|
* Note that this is also emitted upon _reconnection_.
|