@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.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { getIt } from "get-it";
|
|
2
2
|
import { adapter, environment } from "get-it";
|
|
3
3
|
import { retry, jsonRequest, jsonResponse, progress, observable, debug, headers, agent } from "get-it/middleware";
|
|
4
|
-
import { Observable, defer, of, isObservable, mergeMap, from, lastValueFrom, shareReplay, catchError, concat, throwError, timer, tap, finalize, share, merge, EMPTY } from "rxjs";
|
|
4
|
+
import { Observable, defer, of, isObservable, mergeMap, from, lastValueFrom, shareReplay, catchError, concat, throwError, timer, tap, finalize, share, merge, EMPTY, map as map$1, firstValueFrom } from "rxjs";
|
|
5
5
|
import { stegaClean } from "./_chunks-es/stegaClean.js";
|
|
6
6
|
import { combineLatestWith, map, filter, finalize as finalize$1 } from "rxjs/operators";
|
|
7
|
-
import {
|
|
7
|
+
import { getVersionFromId, isDraftId, getVersionId, getDraftId, isVersionId, getPublishedId } from "@sanity/client/csm";
|
|
8
|
+
import { customAlphabet } from "nanoid";
|
|
9
|
+
import { validateObject, validateInsert, requireDocumentId, validateDocumentId, requireDocumentType, resourceConfig, hasDataset, requestTag, printPreviewDraftsDeprecationWarning, validateApiPerspective, printCdnPreviewDraftsWarning, validateAssetType, resourceGuard, dataset, validateVersionIdMatch, defaultConfig, initConfig, printNoDefaultExport } from "./_chunks-es/config.js";
|
|
8
10
|
class ClientError extends Error {
|
|
9
11
|
response;
|
|
10
12
|
statusCode = 400;
|
|
@@ -619,8 +621,24 @@ function _fetch(client, httpRequest, _stega, query, _params = {}, options = {})
|
|
|
619
621
|
) : $request.pipe(map(mapResponse));
|
|
620
622
|
}
|
|
621
623
|
function _getDocument(client, httpRequest, id, opts = {}) {
|
|
622
|
-
const
|
|
623
|
-
|
|
624
|
+
const docId = (() => {
|
|
625
|
+
if (!opts.releaseId)
|
|
626
|
+
return id;
|
|
627
|
+
const versionId = getVersionFromId(id);
|
|
628
|
+
if (!versionId) {
|
|
629
|
+
if (isDraftId(id))
|
|
630
|
+
throw new Error(
|
|
631
|
+
`The document ID (\`${id}\`) is a draft, but \`options.releaseId\` is set as \`${opts.releaseId}\``
|
|
632
|
+
);
|
|
633
|
+
return getVersionId(id, opts.releaseId);
|
|
634
|
+
}
|
|
635
|
+
if (versionId !== opts.releaseId)
|
|
636
|
+
throw new Error(
|
|
637
|
+
`The document ID (\`${id}\`) is already a version of \`${versionId}\` release, but this does not match the provided \`options.releaseId\` (\`${opts.releaseId}\`)`
|
|
638
|
+
);
|
|
639
|
+
return id;
|
|
640
|
+
})(), options = {
|
|
641
|
+
uri: _getDataUrl(client, "doc", docId),
|
|
624
642
|
json: !0,
|
|
625
643
|
tag: opts.tag,
|
|
626
644
|
signal: opts.signal
|
|
@@ -645,12 +663,33 @@ function _getDocuments(client, httpRequest, ids, opts = {}) {
|
|
|
645
663
|
})
|
|
646
664
|
);
|
|
647
665
|
}
|
|
666
|
+
function _getReleaseDocuments(client, httpRequest, releaseId, opts = {}) {
|
|
667
|
+
return _dataRequest(
|
|
668
|
+
client,
|
|
669
|
+
httpRequest,
|
|
670
|
+
"query",
|
|
671
|
+
{
|
|
672
|
+
query: "*[sanity::partOfRelease($releaseId)]",
|
|
673
|
+
params: {
|
|
674
|
+
releaseId
|
|
675
|
+
}
|
|
676
|
+
},
|
|
677
|
+
opts
|
|
678
|
+
);
|
|
679
|
+
}
|
|
648
680
|
function _createIfNotExists(client, httpRequest, doc, options) {
|
|
649
681
|
return requireDocumentId("createIfNotExists", doc), _create(client, httpRequest, doc, "createIfNotExists", options);
|
|
650
682
|
}
|
|
651
683
|
function _createOrReplace(client, httpRequest, doc, options) {
|
|
652
684
|
return requireDocumentId("createOrReplace", doc), _create(client, httpRequest, doc, "createOrReplace", options);
|
|
653
685
|
}
|
|
686
|
+
function _createVersion(client, httpRequest, doc, publishedId, options) {
|
|
687
|
+
return requireDocumentId("createVersion", doc), requireDocumentType("createVersion", doc), _action(client, httpRequest, {
|
|
688
|
+
actionType: "sanity.action.document.version.create",
|
|
689
|
+
publishedId,
|
|
690
|
+
document: doc
|
|
691
|
+
}, options);
|
|
692
|
+
}
|
|
654
693
|
function _delete(client, httpRequest, selection, options) {
|
|
655
694
|
return _dataRequest(
|
|
656
695
|
client,
|
|
@@ -660,6 +699,26 @@ function _delete(client, httpRequest, selection, options) {
|
|
|
660
699
|
options
|
|
661
700
|
);
|
|
662
701
|
}
|
|
702
|
+
function _discardVersion(client, httpRequest, versionId, purge = !1, options) {
|
|
703
|
+
return _action(client, httpRequest, {
|
|
704
|
+
actionType: "sanity.action.document.version.discard",
|
|
705
|
+
versionId,
|
|
706
|
+
purge
|
|
707
|
+
}, options);
|
|
708
|
+
}
|
|
709
|
+
function _replaceVersion(client, httpRequest, doc, options) {
|
|
710
|
+
return requireDocumentId("replaceVersion", doc), requireDocumentType("replaceVersion", doc), _action(client, httpRequest, {
|
|
711
|
+
actionType: "sanity.action.document.version.replace",
|
|
712
|
+
document: doc
|
|
713
|
+
}, options);
|
|
714
|
+
}
|
|
715
|
+
function _unpublishVersion(client, httpRequest, versionId, publishedId, options) {
|
|
716
|
+
return _action(client, httpRequest, {
|
|
717
|
+
actionType: "sanity.action.document.version.unpublish",
|
|
718
|
+
versionId,
|
|
719
|
+
publishedId
|
|
720
|
+
}, options);
|
|
721
|
+
}
|
|
663
722
|
function _mutate(client, httpRequest, mutations, options) {
|
|
664
723
|
let mut;
|
|
665
724
|
mutations instanceof Patch || mutations instanceof ObservablePatch ? mut = { patch: mutations.serialize() } : mutations instanceof Transaction || mutations instanceof ObservableTransaction ? mut = mutations.serialize() : mut = mutations;
|
|
@@ -1262,6 +1321,498 @@ class ProjectsClient {
|
|
|
1262
1321
|
);
|
|
1263
1322
|
}
|
|
1264
1323
|
}
|
|
1324
|
+
const generateReleaseId = customAlphabet(
|
|
1325
|
+
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
|
|
1326
|
+
8
|
|
1327
|
+
), getDocumentVersionId = (publishedId, releaseId) => releaseId ? getVersionId(publishedId, releaseId) : getDraftId(publishedId);
|
|
1328
|
+
function deriveDocumentVersionId(op, {
|
|
1329
|
+
releaseId,
|
|
1330
|
+
publishedId,
|
|
1331
|
+
document
|
|
1332
|
+
}) {
|
|
1333
|
+
if (publishedId && document._id) {
|
|
1334
|
+
const versionId = getDocumentVersionId(publishedId, releaseId);
|
|
1335
|
+
return validateVersionIdMatch(versionId, document), versionId;
|
|
1336
|
+
}
|
|
1337
|
+
if (document._id) {
|
|
1338
|
+
const isDraft = isDraftId(document._id), isVersion = isVersionId(document._id);
|
|
1339
|
+
if (!isDraft && !isVersion)
|
|
1340
|
+
throw new Error(
|
|
1341
|
+
`\`${op}()\` requires a document with an \`_id\` that is a version or draft ID`
|
|
1342
|
+
);
|
|
1343
|
+
if (releaseId) {
|
|
1344
|
+
if (isDraft)
|
|
1345
|
+
throw new Error(
|
|
1346
|
+
`\`${op}()\` was called with a document ID (\`${document._id}\`) that is a draft ID, but a release ID (\`${releaseId}\`) was also provided.`
|
|
1347
|
+
);
|
|
1348
|
+
const builtVersionId = getVersionFromId(document._id);
|
|
1349
|
+
if (builtVersionId !== releaseId)
|
|
1350
|
+
throw new Error(
|
|
1351
|
+
`\`${op}()\` was called with a document ID (\`${document._id}\`) that is a version ID, but the release ID (\`${releaseId}\`) does not match the document's version ID (\`${builtVersionId}\`).`
|
|
1352
|
+
);
|
|
1353
|
+
}
|
|
1354
|
+
return document._id;
|
|
1355
|
+
}
|
|
1356
|
+
if (publishedId)
|
|
1357
|
+
return getDocumentVersionId(publishedId, releaseId);
|
|
1358
|
+
throw new Error(`\`${op}()\` requires either a publishedId or a document with an \`_id\``);
|
|
1359
|
+
}
|
|
1360
|
+
const getArgs = (releaseOrOptions, maybeOptions) => {
|
|
1361
|
+
if (typeof releaseOrOptions == "object" && releaseOrOptions !== null && ("releaseId" in releaseOrOptions || "metadata" in releaseOrOptions)) {
|
|
1362
|
+
const { releaseId = generateReleaseId(), metadata = {} } = releaseOrOptions;
|
|
1363
|
+
return [releaseId, metadata, maybeOptions];
|
|
1364
|
+
}
|
|
1365
|
+
return [generateReleaseId(), {}, releaseOrOptions];
|
|
1366
|
+
}, createRelease = (releaseOrOptions, maybeOptions) => {
|
|
1367
|
+
const [releaseId, metadata, options] = getArgs(releaseOrOptions, maybeOptions), finalMetadata = {
|
|
1368
|
+
...metadata,
|
|
1369
|
+
releaseType: metadata.releaseType || "undecided"
|
|
1370
|
+
};
|
|
1371
|
+
return { action: {
|
|
1372
|
+
actionType: "sanity.action.release.create",
|
|
1373
|
+
releaseId,
|
|
1374
|
+
metadata: finalMetadata
|
|
1375
|
+
}, options };
|
|
1376
|
+
};
|
|
1377
|
+
class ObservableReleasesClient {
|
|
1378
|
+
#client;
|
|
1379
|
+
#httpRequest;
|
|
1380
|
+
constructor(client, httpRequest) {
|
|
1381
|
+
this.#client = client, this.#httpRequest = httpRequest;
|
|
1382
|
+
}
|
|
1383
|
+
/**
|
|
1384
|
+
* @public
|
|
1385
|
+
*
|
|
1386
|
+
* Retrieve a release by id.
|
|
1387
|
+
*
|
|
1388
|
+
* @category Releases
|
|
1389
|
+
*
|
|
1390
|
+
* @param params - Release action parameters:
|
|
1391
|
+
* - `releaseId` - The id of the release to retrieve.
|
|
1392
|
+
* @param options - Additional query options including abort signal and query tag.
|
|
1393
|
+
* @returns An observable that resolves to the release document {@link ReleaseDocument}.
|
|
1394
|
+
*
|
|
1395
|
+
* @example Retrieving a release by id
|
|
1396
|
+
* ```ts
|
|
1397
|
+
* client.observable.releases.get({releaseId: 'my-release'}).pipe(
|
|
1398
|
+
* tap((release) => console.log(release)),
|
|
1399
|
+
* // {
|
|
1400
|
+
* // _id: '_.releases.my-release',
|
|
1401
|
+
* // name: 'my-release'
|
|
1402
|
+
* // _type: 'system.release',
|
|
1403
|
+
* // metadata: {releaseType: 'asap'},
|
|
1404
|
+
* // _createdAt: '2021-01-01T00:00:00.000Z',
|
|
1405
|
+
* // ...
|
|
1406
|
+
* // }
|
|
1407
|
+
* ).subscribe()
|
|
1408
|
+
* ```
|
|
1409
|
+
*/
|
|
1410
|
+
get({ releaseId }, options) {
|
|
1411
|
+
return _getDocument(
|
|
1412
|
+
this.#client,
|
|
1413
|
+
this.#httpRequest,
|
|
1414
|
+
`_.releases.${releaseId}`,
|
|
1415
|
+
options
|
|
1416
|
+
);
|
|
1417
|
+
}
|
|
1418
|
+
create(releaseOrOptions, maybeOptions) {
|
|
1419
|
+
const { action, options } = createRelease(releaseOrOptions, maybeOptions), { releaseId, metadata } = action;
|
|
1420
|
+
return _action(this.#client, this.#httpRequest, action, options).pipe(
|
|
1421
|
+
map$1((actionResult) => ({
|
|
1422
|
+
...actionResult,
|
|
1423
|
+
releaseId,
|
|
1424
|
+
metadata
|
|
1425
|
+
}))
|
|
1426
|
+
);
|
|
1427
|
+
}
|
|
1428
|
+
/**
|
|
1429
|
+
* @public
|
|
1430
|
+
*
|
|
1431
|
+
* Edits an existing release, updating the metadata.
|
|
1432
|
+
*
|
|
1433
|
+
* @category Releases
|
|
1434
|
+
*
|
|
1435
|
+
* @param params - Release action parameters:
|
|
1436
|
+
* - `releaseId` - The id of the release to edit.
|
|
1437
|
+
* - `patch` - The patch operation to apply on the release metadata {@link PatchMutationOperation}.
|
|
1438
|
+
* @param options - Additional action options.
|
|
1439
|
+
* @returns An observable that resolves to the `transactionId`.
|
|
1440
|
+
*/
|
|
1441
|
+
edit({ releaseId, patch }, options) {
|
|
1442
|
+
const editAction = {
|
|
1443
|
+
actionType: "sanity.action.release.edit",
|
|
1444
|
+
releaseId,
|
|
1445
|
+
patch
|
|
1446
|
+
};
|
|
1447
|
+
return _action(this.#client, this.#httpRequest, editAction, options);
|
|
1448
|
+
}
|
|
1449
|
+
/**
|
|
1450
|
+
* @public
|
|
1451
|
+
*
|
|
1452
|
+
* Publishes all documents in a release at once. For larger releases the effect of the publish
|
|
1453
|
+
* will be visible immediately when querying but the removal of the `versions.<releasesId>.*`
|
|
1454
|
+
* documents and creation of the corresponding published documents with the new content may
|
|
1455
|
+
* take some time.
|
|
1456
|
+
*
|
|
1457
|
+
* During this period both the source and target documents are locked and cannot be
|
|
1458
|
+
* modified through any other means.
|
|
1459
|
+
*
|
|
1460
|
+
* @category Releases
|
|
1461
|
+
*
|
|
1462
|
+
* @param params - Release action parameters:
|
|
1463
|
+
* - `releaseId` - The id of the release to publish.
|
|
1464
|
+
* @param options - Additional action options.
|
|
1465
|
+
* @returns An observable that resolves to the `transactionId`.
|
|
1466
|
+
*/
|
|
1467
|
+
publish({ releaseId }, options) {
|
|
1468
|
+
const publishAction = {
|
|
1469
|
+
actionType: "sanity.action.release.publish",
|
|
1470
|
+
releaseId
|
|
1471
|
+
};
|
|
1472
|
+
return _action(this.#client, this.#httpRequest, publishAction, options);
|
|
1473
|
+
}
|
|
1474
|
+
/**
|
|
1475
|
+
* @public
|
|
1476
|
+
*
|
|
1477
|
+
* An archive action removes an active release. The documents that comprise the release
|
|
1478
|
+
* are deleted and therefore no longer queryable.
|
|
1479
|
+
*
|
|
1480
|
+
* While the documents remain in retention the last version can still be accessed using document history endpoint.
|
|
1481
|
+
*
|
|
1482
|
+
* @category Releases
|
|
1483
|
+
*
|
|
1484
|
+
* @param params - Release action parameters:
|
|
1485
|
+
* - `releaseId` - The id of the release to archive.
|
|
1486
|
+
* @param options - Additional action options.
|
|
1487
|
+
* @returns An observable that resolves to the `transactionId`.
|
|
1488
|
+
*/
|
|
1489
|
+
archive({ releaseId }, options) {
|
|
1490
|
+
const archiveAction = {
|
|
1491
|
+
actionType: "sanity.action.release.archive",
|
|
1492
|
+
releaseId
|
|
1493
|
+
};
|
|
1494
|
+
return _action(this.#client, this.#httpRequest, archiveAction, options);
|
|
1495
|
+
}
|
|
1496
|
+
/**
|
|
1497
|
+
* @public
|
|
1498
|
+
*
|
|
1499
|
+
* An unarchive action restores an archived release and all documents
|
|
1500
|
+
* with the content they had just prior to archiving.
|
|
1501
|
+
*
|
|
1502
|
+
* @category Releases
|
|
1503
|
+
*
|
|
1504
|
+
* @param params - Release action parameters:
|
|
1505
|
+
* - `releaseId` - The id of the release to unarchive.
|
|
1506
|
+
* @param options - Additional action options.
|
|
1507
|
+
* @returns An observable that resolves to the `transactionId`.
|
|
1508
|
+
*/
|
|
1509
|
+
unarchive({ releaseId }, options) {
|
|
1510
|
+
const unarchiveAction = {
|
|
1511
|
+
actionType: "sanity.action.release.unarchive",
|
|
1512
|
+
releaseId
|
|
1513
|
+
};
|
|
1514
|
+
return _action(this.#client, this.#httpRequest, unarchiveAction, options);
|
|
1515
|
+
}
|
|
1516
|
+
/**
|
|
1517
|
+
* @public
|
|
1518
|
+
*
|
|
1519
|
+
* A schedule action queues a release for publishing at the given future time.
|
|
1520
|
+
* The release is locked such that no documents in the release can be modified and
|
|
1521
|
+
* no documents that it references can be deleted as this would make the publish fail.
|
|
1522
|
+
* At the given time, the same logic as for the publish action is triggered.
|
|
1523
|
+
*
|
|
1524
|
+
* @category Releases
|
|
1525
|
+
*
|
|
1526
|
+
* @param params - Release action parameters:
|
|
1527
|
+
* - `releaseId` - The id of the release to schedule.
|
|
1528
|
+
* - `publishAt` - The serialised date and time to publish the release. If the `publishAt` is in the past, the release will be published immediately.
|
|
1529
|
+
* @param options - Additional action options.
|
|
1530
|
+
* @returns An observable that resolves to the `transactionId`.
|
|
1531
|
+
*/
|
|
1532
|
+
schedule({ releaseId, publishAt }, options) {
|
|
1533
|
+
const scheduleAction = {
|
|
1534
|
+
actionType: "sanity.action.release.schedule",
|
|
1535
|
+
releaseId,
|
|
1536
|
+
publishAt
|
|
1537
|
+
};
|
|
1538
|
+
return _action(this.#client, this.#httpRequest, scheduleAction, options);
|
|
1539
|
+
}
|
|
1540
|
+
/**
|
|
1541
|
+
* @public
|
|
1542
|
+
*
|
|
1543
|
+
* An unschedule action stops a release from being published.
|
|
1544
|
+
* The documents in the release are considered unlocked and can be edited again.
|
|
1545
|
+
* This may fail if another release is scheduled to be published after this one and
|
|
1546
|
+
* has a reference to a document created by this one.
|
|
1547
|
+
*
|
|
1548
|
+
* @category Releases
|
|
1549
|
+
*
|
|
1550
|
+
* @param params - Release action parameters:
|
|
1551
|
+
* - `releaseId` - The id of the release to unschedule.
|
|
1552
|
+
* @param options - Additional action options.
|
|
1553
|
+
* @returns An observable that resolves to the `transactionId`.
|
|
1554
|
+
*/
|
|
1555
|
+
unschedule({ releaseId }, options) {
|
|
1556
|
+
const unscheduleAction = {
|
|
1557
|
+
actionType: "sanity.action.release.unschedule",
|
|
1558
|
+
releaseId
|
|
1559
|
+
};
|
|
1560
|
+
return _action(this.#client, this.#httpRequest, unscheduleAction, options);
|
|
1561
|
+
}
|
|
1562
|
+
/**
|
|
1563
|
+
* @public
|
|
1564
|
+
*
|
|
1565
|
+
* A delete action removes a published or archived release.
|
|
1566
|
+
* The backing system document will be removed from the dataset.
|
|
1567
|
+
*
|
|
1568
|
+
* @category Releases
|
|
1569
|
+
*
|
|
1570
|
+
* @param params - Release action parameters:
|
|
1571
|
+
* - `releaseId` - The id of the release to delete.
|
|
1572
|
+
* @param options - Additional action options.
|
|
1573
|
+
* @returns An observable that resolves to the `transactionId`.
|
|
1574
|
+
*/
|
|
1575
|
+
delete({ releaseId }, options) {
|
|
1576
|
+
const deleteAction = {
|
|
1577
|
+
actionType: "sanity.action.release.delete",
|
|
1578
|
+
releaseId
|
|
1579
|
+
};
|
|
1580
|
+
return _action(this.#client, this.#httpRequest, deleteAction, options);
|
|
1581
|
+
}
|
|
1582
|
+
/**
|
|
1583
|
+
* @public
|
|
1584
|
+
*
|
|
1585
|
+
* Fetch the documents in a release by release id.
|
|
1586
|
+
*
|
|
1587
|
+
* @category Releases
|
|
1588
|
+
*
|
|
1589
|
+
* @param params - Release action parameters:
|
|
1590
|
+
* - `releaseId` - The id of the release to fetch documents for.
|
|
1591
|
+
* @param options - Additional mutation options {@link BaseMutationOptions}.
|
|
1592
|
+
* @returns An observable that resolves to the documents in the release.
|
|
1593
|
+
*/
|
|
1594
|
+
fetchDocuments({ releaseId }, options) {
|
|
1595
|
+
return _getReleaseDocuments(this.#client, this.#httpRequest, releaseId, options);
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1598
|
+
class ReleasesClient {
|
|
1599
|
+
#client;
|
|
1600
|
+
#httpRequest;
|
|
1601
|
+
constructor(client, httpRequest) {
|
|
1602
|
+
this.#client = client, this.#httpRequest = httpRequest;
|
|
1603
|
+
}
|
|
1604
|
+
/**
|
|
1605
|
+
* @public
|
|
1606
|
+
*
|
|
1607
|
+
* Retrieve a release by id.
|
|
1608
|
+
*
|
|
1609
|
+
* @category Releases
|
|
1610
|
+
*
|
|
1611
|
+
* @param params - Release action parameters:
|
|
1612
|
+
* - `releaseId` - The id of the release to retrieve.
|
|
1613
|
+
* @param options - Additional query options including abort signal and query tag.
|
|
1614
|
+
* @returns A promise that resolves to the release document {@link ReleaseDocument}.
|
|
1615
|
+
*
|
|
1616
|
+
* @example Retrieving a release by id
|
|
1617
|
+
* ```ts
|
|
1618
|
+
* const release = await client.releases.get({releaseId: 'my-release'})
|
|
1619
|
+
* console.log(release)
|
|
1620
|
+
* // {
|
|
1621
|
+
* // _id: '_.releases.my-release',
|
|
1622
|
+
* // name: 'my-release'
|
|
1623
|
+
* // _type: 'system.release',
|
|
1624
|
+
* // metadata: {releaseType: 'asap'},
|
|
1625
|
+
* // _createdAt: '2021-01-01T00:00:00.000Z',
|
|
1626
|
+
* // ...
|
|
1627
|
+
* // }
|
|
1628
|
+
* ```
|
|
1629
|
+
*/
|
|
1630
|
+
get({ releaseId }, options) {
|
|
1631
|
+
return lastValueFrom(
|
|
1632
|
+
_getDocument(
|
|
1633
|
+
this.#client,
|
|
1634
|
+
this.#httpRequest,
|
|
1635
|
+
`_.releases.${releaseId}`,
|
|
1636
|
+
options
|
|
1637
|
+
)
|
|
1638
|
+
);
|
|
1639
|
+
}
|
|
1640
|
+
async create(releaseOrOptions, maybeOptions) {
|
|
1641
|
+
const { action, options } = createRelease(releaseOrOptions, maybeOptions), { releaseId, metadata } = action;
|
|
1642
|
+
return { ...await lastValueFrom(
|
|
1643
|
+
_action(this.#client, this.#httpRequest, action, options)
|
|
1644
|
+
), releaseId, metadata };
|
|
1645
|
+
}
|
|
1646
|
+
/**
|
|
1647
|
+
* @public
|
|
1648
|
+
*
|
|
1649
|
+
* Edits an existing release, updating the metadata.
|
|
1650
|
+
*
|
|
1651
|
+
* @category Releases
|
|
1652
|
+
*
|
|
1653
|
+
* @param params - Release action parameters:
|
|
1654
|
+
* - `releaseId` - The id of the release to edit.
|
|
1655
|
+
* - `patch` - The patch operation to apply on the release metadata {@link PatchMutationOperation}.
|
|
1656
|
+
* @param options - Additional action options.
|
|
1657
|
+
* @returns A promise that resolves to the `transactionId`.
|
|
1658
|
+
*/
|
|
1659
|
+
edit({ releaseId, patch }, options) {
|
|
1660
|
+
const editAction = {
|
|
1661
|
+
actionType: "sanity.action.release.edit",
|
|
1662
|
+
releaseId,
|
|
1663
|
+
patch
|
|
1664
|
+
};
|
|
1665
|
+
return lastValueFrom(_action(this.#client, this.#httpRequest, editAction, options));
|
|
1666
|
+
}
|
|
1667
|
+
/**
|
|
1668
|
+
* @public
|
|
1669
|
+
*
|
|
1670
|
+
* Publishes all documents in a release at once. For larger releases the effect of the publish
|
|
1671
|
+
* will be visible immediately when querying but the removal of the `versions.<releasesId>.*`
|
|
1672
|
+
* documents and creation of the corresponding published documents with the new content may
|
|
1673
|
+
* take some time.
|
|
1674
|
+
*
|
|
1675
|
+
* During this period both the source and target documents are locked and cannot be
|
|
1676
|
+
* modified through any other means.
|
|
1677
|
+
*
|
|
1678
|
+
* @category Releases
|
|
1679
|
+
*
|
|
1680
|
+
* @param params - Release action parameters:
|
|
1681
|
+
* - `releaseId` - The id of the release to publish.
|
|
1682
|
+
* @param options - Additional action options.
|
|
1683
|
+
* @returns A promise that resolves to the `transactionId`.
|
|
1684
|
+
*/
|
|
1685
|
+
publish({ releaseId }, options) {
|
|
1686
|
+
const publishAction = {
|
|
1687
|
+
actionType: "sanity.action.release.publish",
|
|
1688
|
+
releaseId
|
|
1689
|
+
};
|
|
1690
|
+
return lastValueFrom(_action(this.#client, this.#httpRequest, publishAction, options));
|
|
1691
|
+
}
|
|
1692
|
+
/**
|
|
1693
|
+
* @public
|
|
1694
|
+
*
|
|
1695
|
+
* An archive action removes an active release. The documents that comprise the release
|
|
1696
|
+
* are deleted and therefore no longer queryable.
|
|
1697
|
+
*
|
|
1698
|
+
* While the documents remain in retention the last version can still be accessed using document history endpoint.
|
|
1699
|
+
*
|
|
1700
|
+
* @category Releases
|
|
1701
|
+
*
|
|
1702
|
+
* @param params - Release action parameters:
|
|
1703
|
+
* - `releaseId` - The id of the release to archive.
|
|
1704
|
+
* @param options - Additional action options.
|
|
1705
|
+
* @returns A promise that resolves to the `transactionId`.
|
|
1706
|
+
*/
|
|
1707
|
+
archive({ releaseId }, options) {
|
|
1708
|
+
const archiveAction = {
|
|
1709
|
+
actionType: "sanity.action.release.archive",
|
|
1710
|
+
releaseId
|
|
1711
|
+
};
|
|
1712
|
+
return lastValueFrom(_action(this.#client, this.#httpRequest, archiveAction, options));
|
|
1713
|
+
}
|
|
1714
|
+
/**
|
|
1715
|
+
* @public
|
|
1716
|
+
*
|
|
1717
|
+
* An unarchive action restores an archived release and all documents
|
|
1718
|
+
* with the content they had just prior to archiving.
|
|
1719
|
+
*
|
|
1720
|
+
* @category Releases
|
|
1721
|
+
*
|
|
1722
|
+
* @param params - Release action parameters:
|
|
1723
|
+
* - `releaseId` - The id of the release to unarchive.
|
|
1724
|
+
* @param options - Additional action options.
|
|
1725
|
+
* @returns A promise that resolves to the `transactionId`.
|
|
1726
|
+
*/
|
|
1727
|
+
unarchive({ releaseId }, options) {
|
|
1728
|
+
const unarchiveAction = {
|
|
1729
|
+
actionType: "sanity.action.release.unarchive",
|
|
1730
|
+
releaseId
|
|
1731
|
+
};
|
|
1732
|
+
return lastValueFrom(_action(this.#client, this.#httpRequest, unarchiveAction, options));
|
|
1733
|
+
}
|
|
1734
|
+
/**
|
|
1735
|
+
* @public
|
|
1736
|
+
*
|
|
1737
|
+
* A schedule action queues a release for publishing at the given future time.
|
|
1738
|
+
* The release is locked such that no documents in the release can be modified and
|
|
1739
|
+
* no documents that it references can be deleted as this would make the publish fail.
|
|
1740
|
+
* At the given time, the same logic as for the publish action is triggered.
|
|
1741
|
+
*
|
|
1742
|
+
* @category Releases
|
|
1743
|
+
*
|
|
1744
|
+
* @param params - Release action parameters:
|
|
1745
|
+
* - `releaseId` - The id of the release to schedule.
|
|
1746
|
+
* - `publishAt` - The serialised date and time to publish the release. If the `publishAt` is in the past, the release will be published immediately.
|
|
1747
|
+
* @param options - Additional action options.
|
|
1748
|
+
* @returns A promise that resolves to the `transactionId`.
|
|
1749
|
+
*/
|
|
1750
|
+
schedule({ releaseId, publishAt }, options) {
|
|
1751
|
+
const scheduleAction = {
|
|
1752
|
+
actionType: "sanity.action.release.schedule",
|
|
1753
|
+
releaseId,
|
|
1754
|
+
publishAt
|
|
1755
|
+
};
|
|
1756
|
+
return lastValueFrom(_action(this.#client, this.#httpRequest, scheduleAction, options));
|
|
1757
|
+
}
|
|
1758
|
+
/**
|
|
1759
|
+
* @public
|
|
1760
|
+
*
|
|
1761
|
+
* An unschedule action stops a release from being published.
|
|
1762
|
+
* The documents in the release are considered unlocked and can be edited again.
|
|
1763
|
+
* This may fail if another release is scheduled to be published after this one and
|
|
1764
|
+
* has a reference to a document created by this one.
|
|
1765
|
+
*
|
|
1766
|
+
* @category Releases
|
|
1767
|
+
*
|
|
1768
|
+
* @param params - Release action parameters:
|
|
1769
|
+
* - `releaseId` - The id of the release to unschedule.
|
|
1770
|
+
* @param options - Additional action options.
|
|
1771
|
+
* @returns A promise that resolves to the `transactionId`.
|
|
1772
|
+
*/
|
|
1773
|
+
unschedule({ releaseId }, options) {
|
|
1774
|
+
const unscheduleAction = {
|
|
1775
|
+
actionType: "sanity.action.release.unschedule",
|
|
1776
|
+
releaseId
|
|
1777
|
+
};
|
|
1778
|
+
return lastValueFrom(_action(this.#client, this.#httpRequest, unscheduleAction, options));
|
|
1779
|
+
}
|
|
1780
|
+
/**
|
|
1781
|
+
* @public
|
|
1782
|
+
*
|
|
1783
|
+
* A delete action removes a published or archived release.
|
|
1784
|
+
* The backing system document will be removed from the dataset.
|
|
1785
|
+
*
|
|
1786
|
+
* @category Releases
|
|
1787
|
+
*
|
|
1788
|
+
* @param params - Release action parameters:
|
|
1789
|
+
* - `releaseId` - The id of the release to delete.
|
|
1790
|
+
* @param options - Additional action options.
|
|
1791
|
+
* @returns A promise that resolves to the `transactionId`.
|
|
1792
|
+
*/
|
|
1793
|
+
delete({ releaseId }, options) {
|
|
1794
|
+
const deleteAction = {
|
|
1795
|
+
actionType: "sanity.action.release.delete",
|
|
1796
|
+
releaseId
|
|
1797
|
+
};
|
|
1798
|
+
return lastValueFrom(_action(this.#client, this.#httpRequest, deleteAction, options));
|
|
1799
|
+
}
|
|
1800
|
+
/**
|
|
1801
|
+
* @public
|
|
1802
|
+
*
|
|
1803
|
+
* Fetch the documents in a release by release id.
|
|
1804
|
+
*
|
|
1805
|
+
* @category Releases
|
|
1806
|
+
*
|
|
1807
|
+
* @param params - Release action parameters:
|
|
1808
|
+
* - `releaseId` - The id of the release to fetch documents for.
|
|
1809
|
+
* @param options - Additional mutation options {@link BaseMutationOptions}.
|
|
1810
|
+
* @returns A promise that resolves to the documents in the release.
|
|
1811
|
+
*/
|
|
1812
|
+
fetchDocuments({ releaseId }, options) {
|
|
1813
|
+
return lastValueFrom(_getReleaseDocuments(this.#client, this.#httpRequest, releaseId, options));
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1265
1816
|
class ObservableUsersClient {
|
|
1266
1817
|
#client;
|
|
1267
1818
|
#httpRequest;
|
|
@@ -1307,6 +1858,7 @@ class ObservableSanityClient {
|
|
|
1307
1858
|
projects;
|
|
1308
1859
|
users;
|
|
1309
1860
|
agent;
|
|
1861
|
+
releases;
|
|
1310
1862
|
/**
|
|
1311
1863
|
* Private properties
|
|
1312
1864
|
*/
|
|
@@ -1319,7 +1871,7 @@ class ObservableSanityClient {
|
|
|
1319
1871
|
constructor(httpRequest, config = defaultConfig) {
|
|
1320
1872
|
this.config(config), this.#httpRequest = httpRequest, this.assets = new ObservableAssetsClient(this, this.#httpRequest), this.datasets = new ObservableDatasetsClient(this, this.#httpRequest), this.live = new LiveClient(this), this.projects = new ObservableProjectsClient(this, this.#httpRequest), this.users = new ObservableUsersClient(this, this.#httpRequest), this.agent = {
|
|
1321
1873
|
action: new ObservableAgentsActionClient(this, this.#httpRequest)
|
|
1322
|
-
};
|
|
1874
|
+
}, this.releases = new ObservableReleasesClient(this, this.#httpRequest);
|
|
1323
1875
|
}
|
|
1324
1876
|
/**
|
|
1325
1877
|
* Clone the client - returns a new instance
|
|
@@ -1392,9 +1944,96 @@ class ObservableSanityClient {
|
|
|
1392
1944
|
createOrReplace(document, options) {
|
|
1393
1945
|
return _createOrReplace(this, this.#httpRequest, document, options);
|
|
1394
1946
|
}
|
|
1947
|
+
createVersion({
|
|
1948
|
+
document,
|
|
1949
|
+
publishedId,
|
|
1950
|
+
releaseId
|
|
1951
|
+
}, options) {
|
|
1952
|
+
const documentVersionId = deriveDocumentVersionId("createVersion", {
|
|
1953
|
+
document,
|
|
1954
|
+
publishedId,
|
|
1955
|
+
releaseId
|
|
1956
|
+
}), documentVersion = { ...document, _id: documentVersionId }, versionPublishedId = publishedId || getPublishedId(document._id);
|
|
1957
|
+
return _createVersion(
|
|
1958
|
+
this,
|
|
1959
|
+
this.#httpRequest,
|
|
1960
|
+
documentVersion,
|
|
1961
|
+
versionPublishedId,
|
|
1962
|
+
options
|
|
1963
|
+
);
|
|
1964
|
+
}
|
|
1395
1965
|
delete(selection, options) {
|
|
1396
1966
|
return _delete(this, this.#httpRequest, selection, options);
|
|
1397
1967
|
}
|
|
1968
|
+
/**
|
|
1969
|
+
* @public
|
|
1970
|
+
*
|
|
1971
|
+
* Deletes the draft or release version of a document.
|
|
1972
|
+
*
|
|
1973
|
+
* @remarks
|
|
1974
|
+
* * Discarding a version with no `releaseId` will discard the draft version of the published document.
|
|
1975
|
+
* * If the draft or release version does not exist, any error will throw.
|
|
1976
|
+
*
|
|
1977
|
+
* @param params - Version action parameters:
|
|
1978
|
+
* - `releaseId` - The ID of the release to discard the document from.
|
|
1979
|
+
* - `publishedId` - The published ID of the document to discard.
|
|
1980
|
+
* @param purge - if `true` the document history is also discarded.
|
|
1981
|
+
* @param options - Additional action options.
|
|
1982
|
+
* @returns an observable that resolves to the `transactionId`.
|
|
1983
|
+
*
|
|
1984
|
+
* @example Discarding a release version of a document
|
|
1985
|
+
* ```ts
|
|
1986
|
+
* client.observable.discardVersion({publishedId: 'myDocument', releaseId: 'myRelease'})
|
|
1987
|
+
* // The document with the ID `versions.myRelease.myDocument` will be discarded.
|
|
1988
|
+
* ```
|
|
1989
|
+
*
|
|
1990
|
+
* @example Discarding a draft version of a document
|
|
1991
|
+
* ```ts
|
|
1992
|
+
* client.observable.discardVersion({publishedId: 'myDocument'})
|
|
1993
|
+
* // The document with the ID `drafts.myDocument` will be discarded.
|
|
1994
|
+
* ```
|
|
1995
|
+
*/
|
|
1996
|
+
discardVersion({ releaseId, publishedId }, purge, options) {
|
|
1997
|
+
const documentVersionId = getDocumentVersionId(publishedId, releaseId);
|
|
1998
|
+
return _discardVersion(this, this.#httpRequest, documentVersionId, purge, options);
|
|
1999
|
+
}
|
|
2000
|
+
replaceVersion({
|
|
2001
|
+
document,
|
|
2002
|
+
publishedId,
|
|
2003
|
+
releaseId
|
|
2004
|
+
}, options) {
|
|
2005
|
+
const documentVersionId = deriveDocumentVersionId("replaceVersion", {
|
|
2006
|
+
document,
|
|
2007
|
+
publishedId,
|
|
2008
|
+
releaseId
|
|
2009
|
+
}), documentVersion = { ...document, _id: documentVersionId };
|
|
2010
|
+
return _replaceVersion(this, this.#httpRequest, documentVersion, options);
|
|
2011
|
+
}
|
|
2012
|
+
/**
|
|
2013
|
+
* @public
|
|
2014
|
+
*
|
|
2015
|
+
* Used to indicate when a document within a release should be unpublished when
|
|
2016
|
+
* the release is run.
|
|
2017
|
+
*
|
|
2018
|
+
* @remarks
|
|
2019
|
+
* * If the published document does not exist, an error will be thrown.
|
|
2020
|
+
*
|
|
2021
|
+
* @param params - Version action parameters:
|
|
2022
|
+
* - `releaseId` - The ID of the release to unpublish the document from.
|
|
2023
|
+
* - `publishedId` - The published ID of the document to unpublish.
|
|
2024
|
+
* @param options - Additional action options.
|
|
2025
|
+
* @returns an observable that resolves to the `transactionId`.
|
|
2026
|
+
*
|
|
2027
|
+
* @example Unpublishing a release version of a published document
|
|
2028
|
+
* ```ts
|
|
2029
|
+
* client.observable.unpublishVersion({publishedId: 'myDocument', releaseId: 'myRelease'})
|
|
2030
|
+
* // The document with the ID `versions.myRelease.myDocument` will be unpublished. when `myRelease` is run.
|
|
2031
|
+
* ```
|
|
2032
|
+
*/
|
|
2033
|
+
unpublishVersion({ releaseId, publishedId }, options) {
|
|
2034
|
+
const versionId = getVersionId(publishedId, releaseId);
|
|
2035
|
+
return _unpublishVersion(this, this.#httpRequest, versionId, publishedId, options);
|
|
2036
|
+
}
|
|
1398
2037
|
mutate(operations, options) {
|
|
1399
2038
|
return _mutate(this, this.#httpRequest, operations, options);
|
|
1400
2039
|
}
|
|
@@ -1459,6 +2098,7 @@ class SanityClient {
|
|
|
1459
2098
|
projects;
|
|
1460
2099
|
users;
|
|
1461
2100
|
agent;
|
|
2101
|
+
releases;
|
|
1462
2102
|
/**
|
|
1463
2103
|
* Observable version of the Sanity client, with the same configuration as the promise-based one
|
|
1464
2104
|
*/
|
|
@@ -1475,7 +2115,7 @@ class SanityClient {
|
|
|
1475
2115
|
constructor(httpRequest, config = defaultConfig) {
|
|
1476
2116
|
this.config(config), this.#httpRequest = httpRequest, this.assets = new AssetsClient(this, this.#httpRequest), this.datasets = new DatasetsClient(this, this.#httpRequest), this.live = new LiveClient(this), this.projects = new ProjectsClient(this, this.#httpRequest), this.users = new UsersClient(this, this.#httpRequest), this.agent = {
|
|
1477
2117
|
action: new AgentActionsClient(this, this.#httpRequest)
|
|
1478
|
-
}, this.observable = new ObservableSanityClient(httpRequest, config);
|
|
2118
|
+
}, this.releases = new ReleasesClient(this, this.#httpRequest), this.observable = new ObservableSanityClient(httpRequest, config);
|
|
1479
2119
|
}
|
|
1480
2120
|
/**
|
|
1481
2121
|
* Clone the client - returns a new instance
|
|
@@ -1556,9 +2196,104 @@ class SanityClient {
|
|
|
1556
2196
|
_createOrReplace(this, this.#httpRequest, document, options)
|
|
1557
2197
|
);
|
|
1558
2198
|
}
|
|
2199
|
+
createVersion({
|
|
2200
|
+
document,
|
|
2201
|
+
publishedId,
|
|
2202
|
+
releaseId
|
|
2203
|
+
}, options) {
|
|
2204
|
+
const documentVersionId = deriveDocumentVersionId("createVersion", {
|
|
2205
|
+
document,
|
|
2206
|
+
publishedId,
|
|
2207
|
+
releaseId
|
|
2208
|
+
}), documentVersion = { ...document, _id: documentVersionId }, versionPublishedId = publishedId || getPublishedId(document._id);
|
|
2209
|
+
return firstValueFrom(
|
|
2210
|
+
_createVersion(
|
|
2211
|
+
this,
|
|
2212
|
+
this.#httpRequest,
|
|
2213
|
+
documentVersion,
|
|
2214
|
+
versionPublishedId,
|
|
2215
|
+
options
|
|
2216
|
+
)
|
|
2217
|
+
);
|
|
2218
|
+
}
|
|
1559
2219
|
delete(selection, options) {
|
|
1560
2220
|
return lastValueFrom(_delete(this, this.#httpRequest, selection, options));
|
|
1561
2221
|
}
|
|
2222
|
+
/**
|
|
2223
|
+
* @public
|
|
2224
|
+
*
|
|
2225
|
+
* Deletes the draft or release version of a document.
|
|
2226
|
+
*
|
|
2227
|
+
* @remarks
|
|
2228
|
+
* * Discarding a version with no `releaseId` will discard the draft version of the published document.
|
|
2229
|
+
* * If the draft or release version does not exist, any error will throw.
|
|
2230
|
+
*
|
|
2231
|
+
* @param params - Version action parameters:
|
|
2232
|
+
* - `releaseId` - The ID of the release to discard the document from.
|
|
2233
|
+
* - `publishedId` - The published ID of the document to discard.
|
|
2234
|
+
* @param purge - if `true` the document history is also discarded.
|
|
2235
|
+
* @param options - Additional action options.
|
|
2236
|
+
* @returns a promise that resolves to the `transactionId`.
|
|
2237
|
+
*
|
|
2238
|
+
* @example Discarding a release version of a document
|
|
2239
|
+
* ```ts
|
|
2240
|
+
* client.discardVersion({publishedId: 'myDocument', releaseId: 'myRelease'})
|
|
2241
|
+
* // The document with the ID `versions.myRelease.myDocument` will be discarded.
|
|
2242
|
+
* ```
|
|
2243
|
+
*
|
|
2244
|
+
* @example Discarding a draft version of a document
|
|
2245
|
+
* ```ts
|
|
2246
|
+
* client.discardVersion({publishedId: 'myDocument'})
|
|
2247
|
+
* // The document with the ID `drafts.myDocument` will be discarded.
|
|
2248
|
+
* ```
|
|
2249
|
+
*/
|
|
2250
|
+
discardVersion({ releaseId, publishedId }, purge, options) {
|
|
2251
|
+
const documentVersionId = getDocumentVersionId(publishedId, releaseId);
|
|
2252
|
+
return lastValueFrom(
|
|
2253
|
+
_discardVersion(this, this.#httpRequest, documentVersionId, purge, options)
|
|
2254
|
+
);
|
|
2255
|
+
}
|
|
2256
|
+
replaceVersion({
|
|
2257
|
+
document,
|
|
2258
|
+
publishedId,
|
|
2259
|
+
releaseId
|
|
2260
|
+
}, options) {
|
|
2261
|
+
const documentVersionId = deriveDocumentVersionId("replaceVersion", {
|
|
2262
|
+
document,
|
|
2263
|
+
publishedId,
|
|
2264
|
+
releaseId
|
|
2265
|
+
}), documentVersion = { ...document, _id: documentVersionId };
|
|
2266
|
+
return firstValueFrom(
|
|
2267
|
+
_replaceVersion(this, this.#httpRequest, documentVersion, options)
|
|
2268
|
+
);
|
|
2269
|
+
}
|
|
2270
|
+
/**
|
|
2271
|
+
* @public
|
|
2272
|
+
*
|
|
2273
|
+
* Used to indicate when a document within a release should be unpublished when
|
|
2274
|
+
* the release is run.
|
|
2275
|
+
*
|
|
2276
|
+
* @remarks
|
|
2277
|
+
* * If the published document does not exist, an error will be thrown.
|
|
2278
|
+
*
|
|
2279
|
+
* @param params - Version action parameters:
|
|
2280
|
+
* - `releaseId` - The ID of the release to unpublish the document from.
|
|
2281
|
+
* - `publishedId` - The published ID of the document to unpublish.
|
|
2282
|
+
* @param options - Additional action options.
|
|
2283
|
+
* @returns a promise that resolves to the `transactionId`.
|
|
2284
|
+
*
|
|
2285
|
+
* @example Unpublishing a release version of a published document
|
|
2286
|
+
* ```ts
|
|
2287
|
+
* await client.unpublishVersion({publishedId: 'myDocument', releaseId: 'myRelease'})
|
|
2288
|
+
* // The document with the ID `versions.myRelease.myDocument` will be unpublished. when `myRelease` is run.
|
|
2289
|
+
* ```
|
|
2290
|
+
*/
|
|
2291
|
+
unpublishVersion({ releaseId, publishedId }, options) {
|
|
2292
|
+
const versionId = getVersionId(publishedId, releaseId);
|
|
2293
|
+
return lastValueFrom(
|
|
2294
|
+
_unpublishVersion(this, this.#httpRequest, versionId, publishedId, options)
|
|
2295
|
+
);
|
|
2296
|
+
}
|
|
1562
2297
|
mutate(operations, options) {
|
|
1563
2298
|
return lastValueFrom(_mutate(this, this.#httpRequest, operations, options));
|
|
1564
2299
|
}
|
|
@@ -1651,7 +2386,7 @@ function defineDeprecatedCreateClient(createClient2) {
|
|
|
1651
2386
|
return printNoDefaultExport(), createClient2(config);
|
|
1652
2387
|
};
|
|
1653
2388
|
}
|
|
1654
|
-
var name = "@sanity/client", version = "7.1
|
|
2389
|
+
var name = "@sanity/client", version = "7.2.1";
|
|
1655
2390
|
const middleware = [
|
|
1656
2391
|
debug({ verbose: !0, namespace: "sanity:client" }),
|
|
1657
2392
|
headers({ "User-Agent": `${name} ${version}` }),
|