@sanity/client 7.26.2 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -377
- package/dist/browserUpload-CQgx9YYo.js +86 -0
- package/dist/browserUpload-CQgx9YYo.js.map +1 -0
- package/dist/browserUpload-icWlVP15.js +86 -0
- package/dist/browserUpload-icWlVP15.js.map +1 -0
- package/dist/config-a8VajuEY.js +126 -0
- package/dist/config-a8VajuEY.js.map +1 -0
- package/dist/csm.d.ts +122 -335
- package/dist/csm.js +79 -91
- package/dist/csm.js.map +1 -1
- package/dist/dist-C9ExSk2R.js +73 -0
- package/dist/dist-C9ExSk2R.js.map +1 -0
- package/dist/dist-Z8cIRxoB.js +69 -0
- package/dist/dist-Z8cIRxoB.js.map +1 -0
- package/dist/index.d.ts +107 -6723
- package/dist/index.js +2822 -2847
- package/dist/index.js.map +1 -1
- package/dist/{index.d.cts → index.node.d.ts} +4291 -5328
- package/dist/index.node.js +3131 -0
- package/dist/index.node.js.map +1 -0
- package/dist/isRecord-Kfmt-nk-.js +7 -0
- package/dist/isRecord-Kfmt-nk-.js.map +1 -0
- package/dist/media-library.d.ts +9 -100
- package/dist/media-library.js +36 -14
- package/dist/media-library.js.map +1 -1
- package/dist/request-CJxcN16k.js +372 -0
- package/dist/request-CJxcN16k.js.map +1 -0
- package/dist/request-k7VS_NnC.js +354 -0
- package/dist/request-k7VS_NnC.js.map +1 -0
- package/dist/resolveEditInfo-sq7yF78q.js +325 -0
- package/dist/resolveEditInfo-sq7yF78q.js.map +1 -0
- package/dist/rolldown-runtime-vyAXikos.js +9 -0
- package/dist/stega.d.ts +78 -7137
- package/dist/stega.js +27 -20
- package/dist/stega.js.map +1 -1
- package/dist/stegaClean-C18wLWau.js +21 -0
- package/dist/stegaClean-C18wLWau.js.map +1 -0
- package/dist/stegaEncodeSourceMap-B2fGArSf.js +163 -0
- package/dist/stegaEncodeSourceMap-B2fGArSf.js.map +1 -0
- package/dist/stegaEncodeSourceMap-DkoIlutY.js +367 -0
- package/dist/stegaEncodeSourceMap-DkoIlutY.js.map +1 -0
- package/dist/{index.browser.d.cts → types-CUxZSgB2.d.ts} +3956 -5256
- package/dist/types-CfGzbXrl.d.ts +108 -0
- package/package.json +64 -141
- package/src/SanityClient.ts +82 -117
- package/src/agent/actions/AgentActionsClient.ts +12 -12
- package/src/agent/actions/commonTypes.ts +2 -1
- package/src/agent/actions/generate.ts +26 -6
- package/src/agent/actions/patch.ts +27 -7
- package/src/agent/actions/prompt.ts +19 -5
- package/src/agent/actions/transform.ts +23 -5
- package/src/agent/actions/translate.ts +23 -5
- package/src/assets/AssetsClient.ts +71 -23
- package/src/csm/applySourceDocuments.ts +3 -1
- package/src/csm/createEditUrl.ts +1 -1
- package/src/csm/draftUtils.ts +0 -1
- package/src/csm/index.ts +2 -2
- package/src/csm/studioPath.ts +2 -1
- package/src/csm/types.ts +8 -2
- package/src/data/dataMethods.ts +801 -349
- package/src/data/eventsource.ts +13 -10
- package/src/data/listen.ts +18 -23
- package/src/data/live.ts +44 -27
- package/src/data/resolveEventSourceFetch.ts +96 -0
- package/src/datasets/DatasetsClient.ts +58 -41
- package/src/defineCreateClient.ts +35 -23
- package/src/http/browserMiddleware.ts +7 -1
- package/src/http/browserUpload.ts +162 -0
- package/src/http/errors.ts +60 -6
- package/src/http/nodeMiddleware.ts +94 -30
- package/src/http/request.ts +310 -87
- package/src/http/requestOptions.ts +131 -15
- package/src/{index.browser.ts → index.node.ts} +9 -4
- package/src/index.ts +4 -3
- package/src/mediaLibrary/MediaLibraryVideoClient.ts +26 -11
- package/src/projects/ProjectsClient.ts +18 -16
- package/src/releases/ReleasesClient.ts +38 -33
- package/src/stega/index.ts +1 -2
- package/src/stega/stegaEncodeSourceMap.ts +5 -0
- package/src/stega/types.ts +2 -2
- package/src/types.ts +148 -105
- package/src/users/UsersClient.ts +10 -14
- package/src/util/shareReplayLatest.ts +1 -1
- package/src/warnings.ts +6 -1
- package/dist/_chunks-cjs/config.cjs +0 -206
- package/dist/_chunks-cjs/config.cjs.map +0 -1
- package/dist/_chunks-cjs/isRecord.cjs +0 -6
- package/dist/_chunks-cjs/isRecord.cjs.map +0 -1
- package/dist/_chunks-cjs/resolveEditInfo.cjs +0 -334
- package/dist/_chunks-cjs/resolveEditInfo.cjs.map +0 -1
- package/dist/_chunks-cjs/stegaClean.cjs +0 -46
- package/dist/_chunks-cjs/stegaClean.cjs.map +0 -1
- package/dist/_chunks-cjs/stegaEncodeSourceMap.cjs +0 -388
- package/dist/_chunks-cjs/stegaEncodeSourceMap.cjs.map +0 -1
- package/dist/_chunks-es/config.js +0 -207
- package/dist/_chunks-es/config.js.map +0 -1
- package/dist/_chunks-es/isRecord.js +0 -7
- package/dist/_chunks-es/isRecord.js.map +0 -1
- package/dist/_chunks-es/resolveEditInfo.js +0 -335
- package/dist/_chunks-es/resolveEditInfo.js.map +0 -1
- package/dist/_chunks-es/stegaClean.js +0 -47
- package/dist/_chunks-es/stegaClean.js.map +0 -1
- package/dist/_chunks-es/stegaEncodeSourceMap.js +0 -389
- package/dist/_chunks-es/stegaEncodeSourceMap.js.map +0 -1
- package/dist/csm.cjs +0 -99
- package/dist/csm.cjs.map +0 -1
- package/dist/csm.d.cts +0 -391
- package/dist/index.browser.cjs +0 -3106
- package/dist/index.browser.cjs.map +0 -1
- package/dist/index.browser.d.ts +0 -6802
- package/dist/index.browser.js +0 -3082
- package/dist/index.browser.js.map +0 -1
- package/dist/index.cjs +0 -2946
- package/dist/index.cjs.map +0 -1
- package/dist/media-library.cjs +0 -20
- package/dist/media-library.cjs.map +0 -1
- package/dist/media-library.d.cts +0 -117
- package/dist/stega.browser.cjs +0 -29
- package/dist/stega.browser.cjs.map +0 -1
- package/dist/stega.browser.d.cts +0 -7200
- package/dist/stega.browser.d.ts +0 -7200
- package/dist/stega.browser.js +0 -24
- package/dist/stega.browser.js.map +0 -1
- package/dist/stega.cjs +0 -29
- package/dist/stega.cjs.map +0 -1
- package/dist/stega.d.cts +0 -7200
- package/src/data/eventsourcePolyfill.ts +0 -7
- package/umd/.gitkeep +0 -1
- package/umd/sanityClient.js +0 -6543
- package/umd/sanityClient.min.js +0 -6
package/dist/media-library.cjs
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
3
|
-
function isSignedPlayback(item) {
|
|
4
|
-
return "token" in item;
|
|
5
|
-
}
|
|
6
|
-
function isSignedPlaybackInfo(playbackInfo) {
|
|
7
|
-
return isSignedPlayback(playbackInfo.stream);
|
|
8
|
-
}
|
|
9
|
-
function getPlaybackTokens(playbackInfo) {
|
|
10
|
-
if (isSignedPlaybackInfo(playbackInfo))
|
|
11
|
-
return {
|
|
12
|
-
stream: playbackInfo.stream.token,
|
|
13
|
-
thumbnail: playbackInfo.thumbnail.token,
|
|
14
|
-
storyboard: playbackInfo.storyboard.token,
|
|
15
|
-
animated: playbackInfo.animated.token
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
exports.getPlaybackTokens = getPlaybackTokens;
|
|
19
|
-
exports.isSignedPlaybackInfo = isSignedPlaybackInfo;
|
|
20
|
-
//# sourceMappingURL=media-library.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"media-library.cjs","sources":["../src/media-library.ts"],"sourcesContent":["import type {\n VideoPlaybackInfo,\n VideoPlaybackInfoItem,\n VideoPlaybackInfoItemSigned,\n VideoPlaybackInfoSigned,\n VideoPlaybackTokens,\n} from './types'\n\nexport type {VideoRenditionInfo, VideoRenditionInfoPublic, VideoRenditionInfoSigned} from './types'\nexport type {VideoSubtitleInfo, VideoSubtitleInfoPublic, VideoSubtitleInfoSigned} from './types'\n\n/**\n * Check if a playback info item (stream/thumbnail/etc) has a signed token\n * @internal\n */\nfunction isSignedPlayback(item: VideoPlaybackInfoItem): item is VideoPlaybackInfoItemSigned {\n return 'token' in item\n}\n\n/**\n * Check if the entire playback info response requires signed URLs\n * @public\n */\nexport function isSignedPlaybackInfo(\n playbackInfo: VideoPlaybackInfo,\n): playbackInfo is VideoPlaybackInfoSigned {\n return isSignedPlayback(playbackInfo.stream)\n}\n\n/**\n * Extract playback tokens from signed video playback info\n * @param playbackInfo - The video playback info\n * @returns The playback tokens or undefined if the response is not signed\n * @public\n * @example\n * const tokens = getPlaybackTokens(playbackInfo)\n * console.log(tokens)\n * ```json\n * {\n * stream: \"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...\",\n * thumbnail: \"eyJ0a2VuIjoiVGh1bWJuYWlsVG9rZW4tMTIz...\",\n * animated: \"eyJ0a2VuIjoiQW5pbWF0ZWRUb2tlbi1kZWY...\",\n * storyboard: \"eyJ0a2VuIjoiU3Rvcnlib2FyZFRva2VuLTc4...\"\n * }\n * ```\n */\nexport function getPlaybackTokens(\n playbackInfo: VideoPlaybackInfo,\n): VideoPlaybackTokens | undefined {\n if (isSignedPlaybackInfo(playbackInfo)) {\n return {\n stream: playbackInfo.stream.token,\n thumbnail: playbackInfo.thumbnail.token,\n storyboard: playbackInfo.storyboard.token,\n animated: playbackInfo.animated.token,\n }\n }\n\n return undefined\n}\n"],"names":[],"mappings":";;AAeA,SAAS,iBAAiB,MAAkE;AAC1F,SAAO,WAAW;AACpB;AAMO,SAAS,qBACd,cACyC;AACzC,SAAO,iBAAiB,aAAa,MAAM;AAC7C;AAmBO,SAAS,kBACd,cACiC;AACjC,MAAI,qBAAqB,YAAY;AACnC,WAAO;AAAA,MACL,QAAQ,aAAa,OAAO;AAAA,MAC5B,WAAW,aAAa,UAAU;AAAA,MAClC,YAAY,aAAa,WAAW;AAAA,MACpC,UAAU,aAAa,SAAS;AAAA,IAAA;AAKtC;;;"}
|
package/dist/media-library.d.cts
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Extract playback tokens from signed video playback info
|
|
3
|
-
* @param playbackInfo - The video playback info
|
|
4
|
-
* @returns The playback tokens or undefined if the response is not signed
|
|
5
|
-
* @public
|
|
6
|
-
* @example
|
|
7
|
-
* const tokens = getPlaybackTokens(playbackInfo)
|
|
8
|
-
* console.log(tokens)
|
|
9
|
-
* ```json
|
|
10
|
-
* {
|
|
11
|
-
* stream: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
|
|
12
|
-
* thumbnail: "eyJ0a2VuIjoiVGh1bWJuYWlsVG9rZW4tMTIz...",
|
|
13
|
-
* animated: "eyJ0a2VuIjoiQW5pbWF0ZWRUb2tlbi1kZWY...",
|
|
14
|
-
* storyboard: "eyJ0a2VuIjoiU3Rvcnlib2FyZFRva2VuLTc4..."
|
|
15
|
-
* }
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export declare function getPlaybackTokens(
|
|
19
|
-
playbackInfo: VideoPlaybackInfo,
|
|
20
|
-
): VideoPlaybackTokens | undefined
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Check if the entire playback info response requires signed URLs
|
|
24
|
-
* @public
|
|
25
|
-
*/
|
|
26
|
-
export declare function isSignedPlaybackInfo(
|
|
27
|
-
playbackInfo: VideoPlaybackInfo,
|
|
28
|
-
): playbackInfo is VideoPlaybackInfoSigned
|
|
29
|
-
|
|
30
|
-
/** @public */
|
|
31
|
-
declare interface VideoPlaybackInfo<
|
|
32
|
-
T extends VideoPlaybackInfoItem = VideoPlaybackInfoItem,
|
|
33
|
-
R extends VideoRenditionInfo = T extends VideoPlaybackInfoItemSigned
|
|
34
|
-
? VideoRenditionInfoSigned
|
|
35
|
-
: VideoRenditionInfo,
|
|
36
|
-
S extends VideoSubtitleInfo = T extends VideoPlaybackInfoItemSigned
|
|
37
|
-
? VideoSubtitleInfoSigned
|
|
38
|
-
: VideoSubtitleInfo,
|
|
39
|
-
> {
|
|
40
|
-
id: string
|
|
41
|
-
thumbnail: T
|
|
42
|
-
animated: T
|
|
43
|
-
storyboard: T
|
|
44
|
-
stream: T
|
|
45
|
-
duration: number
|
|
46
|
-
aspectRatio: number
|
|
47
|
-
renditions?: R[]
|
|
48
|
-
subtitles?: S[]
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/** @public */
|
|
52
|
-
declare type VideoPlaybackInfoItem = VideoPlaybackInfoItemPublic | VideoPlaybackInfoItemSigned
|
|
53
|
-
|
|
54
|
-
/** @public */
|
|
55
|
-
declare interface VideoPlaybackInfoItemPublic {
|
|
56
|
-
url: string
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/** @public */
|
|
60
|
-
declare interface VideoPlaybackInfoItemSigned extends VideoPlaybackInfoItemPublic {
|
|
61
|
-
token: string
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/** @public */
|
|
65
|
-
declare type VideoPlaybackInfoSigned = VideoPlaybackInfo<VideoPlaybackInfoItemSigned>
|
|
66
|
-
|
|
67
|
-
/** @public */
|
|
68
|
-
declare interface VideoPlaybackTokens {
|
|
69
|
-
stream?: string
|
|
70
|
-
thumbnail?: string
|
|
71
|
-
storyboard?: string
|
|
72
|
-
animated?: string
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/** @public */
|
|
76
|
-
export declare type VideoRenditionInfo = VideoRenditionInfoPublic | VideoRenditionInfoSigned
|
|
77
|
-
|
|
78
|
-
/** @public */
|
|
79
|
-
export declare interface VideoRenditionInfoPublic {
|
|
80
|
-
/** URL to the MP4 rendition (redirects to CDN) */
|
|
81
|
-
url: string
|
|
82
|
-
/** Resolution identifier, e.g. "1080p", "480p", "270p" */
|
|
83
|
-
resolution: '1080p' | '480p' | '270p' | (string & {})
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/** @public */
|
|
87
|
-
export declare interface VideoRenditionInfoSigned extends VideoRenditionInfoPublic {
|
|
88
|
-
/** Authentication token for signed playback */
|
|
89
|
-
token: string
|
|
90
|
-
/** Token expiration time in ISO 8601 format */
|
|
91
|
-
expiresAt: string
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/** @public */
|
|
95
|
-
export declare type VideoSubtitleInfo = VideoSubtitleInfoPublic | VideoSubtitleInfoSigned
|
|
96
|
-
|
|
97
|
-
/** @public */
|
|
98
|
-
export declare interface VideoSubtitleInfoPublic {
|
|
99
|
-
/** Subtitle track identifier */
|
|
100
|
-
trackId: string
|
|
101
|
-
/** ISO 639-1 language code */
|
|
102
|
-
languageCode: string
|
|
103
|
-
/** URL to the subtitle file */
|
|
104
|
-
url: string
|
|
105
|
-
/** Whether this track contains closed captions */
|
|
106
|
-
closedCaptions: boolean
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/** @public */
|
|
110
|
-
export declare interface VideoSubtitleInfoSigned extends VideoSubtitleInfoPublic {
|
|
111
|
-
/** Authentication token for signed playback */
|
|
112
|
-
token: string
|
|
113
|
-
/** Token expiration time in ISO 8601 format */
|
|
114
|
-
expiresAt: string
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export {}
|
package/dist/stega.browser.cjs
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
3
|
-
var client = require("@sanity/client"), stegaEncodeSourceMap = require("./_chunks-cjs/stegaEncodeSourceMap.cjs"), stegaClean = require("./_chunks-cjs/stegaClean.cjs");
|
|
4
|
-
function stegaBrand(result) {
|
|
5
|
-
return result;
|
|
6
|
-
}
|
|
7
|
-
class SanityStegaClient extends client.SanityClient {
|
|
8
|
-
}
|
|
9
|
-
class ObservableSanityStegaClient extends client.ObservableSanityClient {
|
|
10
|
-
}
|
|
11
|
-
const requester = client.requester, createClient = client.createClient;
|
|
12
|
-
exports.encodeIntoResult = stegaEncodeSourceMap.encodeIntoResult;
|
|
13
|
-
exports.stegaEncodeSourceMap = stegaEncodeSourceMap.stegaEncodeSourceMap;
|
|
14
|
-
exports.stegaClean = stegaClean.stegaClean;
|
|
15
|
-
exports.vercelStegaCleanAll = stegaClean.vercelStegaCleanAll;
|
|
16
|
-
exports.ObservableSanityStegaClient = ObservableSanityStegaClient;
|
|
17
|
-
exports.SanityStegaClient = SanityStegaClient;
|
|
18
|
-
exports.createClient = createClient;
|
|
19
|
-
exports.requester = requester;
|
|
20
|
-
exports.stegaBrand = stegaBrand;
|
|
21
|
-
Object.keys(client).forEach(function(k) {
|
|
22
|
-
k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k) && Object.defineProperty(exports, k, {
|
|
23
|
-
enumerable: !0,
|
|
24
|
-
get: function() {
|
|
25
|
-
return client[k];
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
//# sourceMappingURL=stega.browser.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stega.browser.cjs","sources":["../src/stega/stegaBrand.ts","../src/stega/index.ts"],"sourcesContent":["import type {Any, ClientReturn} from '@sanity/client'\n\n/**\n * A string that might contain stega-encoded data, and is unsafe to compare against string literals\n * until it's been cleaned with `stegaClean()`.\n *\n * The type intersects a template literal that has a human readable suffix, with a brand property\n * that holds the original string type:\n * - The suffix makes TypeScript report \"This comparison appears to be unintentional\" (TS2367) when\n * the string is compared to a literal (`===`, `switch` cases), and makes it unassignable to\n * literal unions like `'left' | 'right'`, while keeping it assignable to `string` so rendering,\n * interpolation and string methods keep working. The suffix is a type-level fiction, the runtime\n * value never ends with that text.\n * - The brand property preserves the original type so `stegaClean()` can recover it exactly. It's\n * a string-keyed property rather than a `unique symbol` so that branded types stay structurally\n * compatible across duplicated copies of `@sanity/client` in `node_modules`. It only exists in\n * the type system and is never present at runtime.\n *\n * @beta\n */\nexport type StegaString<T extends string = string> =\n `${T} (may contain hidden stega characters)` & {\n readonly ' stegaBrand': T\n }\n\n/**\n * Deeply brands the string properties of a query result as `StegaString`, marking them as\n * potentially containing stega-encoded data.\n *\n * String properties that the stega encoder is guaranteed to never encode keep their plain type:\n * - keys starting with `_` (`_id`, `_type`, `_createdAt`, `_updatedAt`, `_key`, `_ref`, `_rev` and\n * so on), which also preserves discriminated union narrowing on `_type`\n * - `slug.current` patterns: a `current` key directly under a `slug` key, as well as string valued\n * `slug` keys (covering `\"slug\": slug.current` projections)\n * - Portable Text internals: the encoder only visits `children` of `_type: 'block'` objects and\n * `text` of `_type: 'span'` objects, so properties like `style`, `listItem` and `marks` stay\n * plain\n * - symbol-keyed properties (like TypeGen's `internalGroqTypeReferenceTo` reference marker): JSON\n * can't contain symbol keys, so they only exist in the type system and are never encoded\n *\n * Every other string is assumed to be \"poisoned\", even if the runtime `filter` happens to skip it\n * (URLs, dates, keys ending in `Id`, denylisted keys). Being conservative is safe: the worst case\n * is a redundant `stegaClean()` call, whereas under-branding would hide real bugs.\n *\n * The `Key` and `ParentKey` type parameters track the key the current value is found under, and\n * the key of the object containing it, they're only used internally during recursion.\n *\n * @beta\n */\nexport type StegaBranded<\n T,\n Key extends PropertyKey = number,\n ParentKey extends PropertyKey = number,\n> = 0 extends 1 & T\n ? T\n : T extends string\n ? T extends {readonly ' stegaBrand': string}\n ? T\n : Key extends `_${string}` | 'slug' | symbol\n ? T\n : Key extends 'current'\n ? ParentKey extends 'slug'\n ? T\n : StegaString<T>\n : StegaString<T>\n : T extends number | bigint | boolean | null | undefined\n ? T\n : T extends Date | RegExp | ((...args: never[]) => unknown)\n ? T\n : T extends readonly unknown[]\n ? {[Index in keyof T]: StegaBranded<T[Index], number, number>}\n : T extends {_type: 'block'}\n ? {[K in keyof T]: K extends 'children' ? StegaBranded<T[K], K, Key> : T[K]}\n : T extends {_type: 'span'}\n ? {[K in keyof T]: K extends 'text' ? StegaBranded<T[K], K, Key> : T[K]}\n : T extends object\n ? {[K in keyof T]: StegaBranded<T[K], K, Key>}\n : T\n\n/**\n * Drop-in replacement for `ClientReturn` that brands the result strings as `StegaString`, for use\n * as the first generic of `client.fetch` when stega is enabled:\n * ```ts\n * import {createClient} from '@sanity/client'\n * import type {ClientReturnStega} from '@sanity/client/stega'\n *\n * const query = '*[_type == \"post\"][0]'\n * const post = await client.fetch<ClientReturnStega<typeof query>>(query)\n * ```\n * When the query is registered in the `SanityQueries` interface (for example by `sanity typegen`),\n * the result type is looked up and deeply branded with `StegaBranded`. Otherwise it falls back to\n * `Fallback`, which defaults to `any`, just like `ClientReturn`.\n *\n * @beta\n */\nexport type ClientReturnStega<GroqString extends string, Fallback = Any> = StegaBranded<\n ClientReturn<GroqString, Fallback>\n>\n\n/**\n * Marks strings in an already fetched query result as potentially containing stega-encoded data,\n * by re-typing them as `StegaString`. Comparing branded strings to string literals is a type error\n * until they're cleaned with `stegaClean()`, which recovers the original type.\n *\n * This is an identity function, it only changes the type of the input, not its value.\n * Prefer passing `ClientReturnStega` as the first generic to `client.fetch` when possible, and use\n * this function for data that has already been fetched.\n *\n * @beta\n */\nexport function stegaBrand<Result>(result: Result): StegaBranded<Result> {\n return result as StegaBranded<Result>\n}\n","export * from '@sanity/client'\nimport {\n createClient as originalCreateClient,\n ObservableSanityClient,\n requester as originalRequester,\n SanityClient,\n} from '@sanity/client'\n\nexport {encodeIntoResult} from './encodeIntoResult'\nexport {type ClientReturnStega, stegaBrand, type StegaBranded, type StegaString} from './stegaBrand'\nexport {stegaClean, type StegaCleaned, vercelStegaCleanAll} from './stegaClean'\nexport {stegaEncodeSourceMap} from './stegaEncodeSourceMap'\nexport * from './types'\n\n/**\n * @deprecated -- Use `import {SanityClient} from '@sanity/client'` instead\n * @public\n */\nexport class SanityStegaClient extends SanityClient {}\n\n/**\n * @deprecated -- Use `import {ObservableSanityClient} from '@sanity/client'` instead\n * @public\n */\nexport class ObservableSanityStegaClient extends ObservableSanityClient {}\n\n/**\n * @deprecated -- Use `import {requester} from '@sanity/client'` instead\n * @public\n */\nexport const requester = originalRequester\n\n/**\n * @deprecated -- Use `import {createClient} from '@sanity/client'` instead\n * @public\n */\nexport const createClient = originalCreateClient\n"],"names":["SanityClient","ObservableSanityClient","originalRequester","originalCreateClient"],"mappings":";;;AA8GO,SAAS,WAAmB,QAAsC;AACvE,SAAO;AACT;AC9FO,MAAM,0BAA0BA,OAAAA,aAAa;AAAC;AAM9C,MAAM,oCAAoCC,OAAAA,uBAAuB;AAAC;AAMlE,MAAM,YAAYC,OAAAA,WAMZ,eAAeC,OAAAA;;;;;;;;;;;;;;;;;;"}
|