@sanity/client 7.19.0 → 7.21.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/dist/index.browser.cjs +49 -10
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.d.cts +100 -24
- package/dist/index.browser.d.ts +100 -24
- package/dist/index.browser.js +49 -10
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +50 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +100 -24
- package/dist/index.d.ts +100 -24
- package/dist/index.js +50 -11
- package/dist/index.js.map +1 -1
- package/dist/stega.browser.d.cts +100 -24
- package/dist/stega.browser.d.ts +100 -24
- package/dist/stega.d.cts +100 -24
- package/dist/stega.d.ts +100 -24
- package/package.json +2 -2
- package/src/SanityClient.ts +38 -6
- package/src/data/live.ts +9 -0
- package/src/projects/ProjectsClient.ts +37 -36
- package/src/types.ts +62 -0
- package/umd/sanityClient.js +49 -10
- package/umd/sanityClient.min.js +2 -2
package/dist/stega.browser.d.cts
CHANGED
|
@@ -804,6 +804,32 @@ export declare interface ClientConfig {
|
|
|
804
804
|
* Lineage token for recursion control
|
|
805
805
|
*/
|
|
806
806
|
lineage?: string
|
|
807
|
+
/**
|
|
808
|
+
* A custom request handler that intercepts all HTTP requests made by the client.
|
|
809
|
+
*
|
|
810
|
+
* Useful for logging, adding custom headers, refreshing auth tokens, rate limiting, etc.
|
|
811
|
+
*
|
|
812
|
+
* When using `withConfig()`, the new handler **replaces** the previous one (it does not
|
|
813
|
+
* wrap it). To compose handlers, you can chain them manually:
|
|
814
|
+
*
|
|
815
|
+
* ```ts
|
|
816
|
+
* const parent = createClient({...config, _requestHandler: handlerA})
|
|
817
|
+
* const child = parent.withConfig({
|
|
818
|
+
* _requestHandler: (req, defaultRequester) =>
|
|
819
|
+
* handlerB(req, (opts) => handlerA(opts, defaultRequester)),
|
|
820
|
+
* })
|
|
821
|
+
* ```
|
|
822
|
+
*
|
|
823
|
+
* Setting `_requestHandler` to `undefined` via `withConfig()` removes the handler.
|
|
824
|
+
*
|
|
825
|
+
* Note: This only applies to HTTP requests. Real-time listener connections
|
|
826
|
+
* (`client.listen()`) use EventSource and are not intercepted by this handler.
|
|
827
|
+
*
|
|
828
|
+
* @internal
|
|
829
|
+
* @deprecated Don't use outside of Sanity internals
|
|
830
|
+
* @see {@link RequestHandler}
|
|
831
|
+
*/
|
|
832
|
+
_requestHandler?: RequestHandler
|
|
807
833
|
}
|
|
808
834
|
|
|
809
835
|
declare type ClientConfigResource =
|
|
@@ -2299,6 +2325,13 @@ export declare type ListenParams = {
|
|
|
2299
2325
|
[key: string]: Any
|
|
2300
2326
|
}
|
|
2301
2327
|
|
|
2328
|
+
declare type ListOptions = {
|
|
2329
|
+
includeMembers?: boolean
|
|
2330
|
+
includeFeatures?: boolean
|
|
2331
|
+
organizationId?: string
|
|
2332
|
+
onlyExplicitMembership?: boolean
|
|
2333
|
+
}
|
|
2334
|
+
|
|
2302
2335
|
/**
|
|
2303
2336
|
* @public
|
|
2304
2337
|
*/
|
|
@@ -2311,6 +2344,7 @@ export declare class LiveClient {
|
|
|
2311
2344
|
events({
|
|
2312
2345
|
includeDrafts,
|
|
2313
2346
|
tag: _tag,
|
|
2347
|
+
waitFor,
|
|
2314
2348
|
}?: {
|
|
2315
2349
|
includeDrafts?: boolean
|
|
2316
2350
|
/**
|
|
@@ -2319,6 +2353,11 @@ export declare class LiveClient {
|
|
|
2319
2353
|
* @defaultValue `undefined`
|
|
2320
2354
|
*/
|
|
2321
2355
|
tag?: string
|
|
2356
|
+
/**
|
|
2357
|
+
* Delays events until after a Sanity Function has processed them and called the callback endpoint.
|
|
2358
|
+
* When omitted, events are delivered immediately.
|
|
2359
|
+
*/
|
|
2360
|
+
waitFor?: 'function'
|
|
2322
2361
|
}): Observable<LiveEvent>
|
|
2323
2362
|
}
|
|
2324
2363
|
|
|
@@ -2862,19 +2901,13 @@ export declare class ObservableProjectsClient {
|
|
|
2862
2901
|
*
|
|
2863
2902
|
* @param options - Options for the list request
|
|
2864
2903
|
* - `includeMembers` - Whether to include members in the response (default: true)
|
|
2904
|
+
* - `includeFeatures` - Whether to include features in the response (default: true)
|
|
2865
2905
|
* - `organizationId` - ID of the organization to fetch projects for
|
|
2866
|
-
* - `onlyExplicitMembership` -
|
|
2867
|
-
*/
|
|
2868
|
-
list(
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
onlyExplicitMembership?: boolean
|
|
2872
|
-
}): Observable<SanityProject[]>
|
|
2873
|
-
list(options?: {
|
|
2874
|
-
includeMembers?: false
|
|
2875
|
-
organizationId?: string
|
|
2876
|
-
onlyExplicitMembership?: boolean
|
|
2877
|
-
}): Observable<Omit<SanityProject, 'members'>[]>
|
|
2906
|
+
* - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
|
|
2907
|
+
*/
|
|
2908
|
+
list<T extends ListOptions>(
|
|
2909
|
+
options?: T,
|
|
2910
|
+
): Observable<Omit<SanityProject, OmittedProjectFields<T>>[]>
|
|
2878
2911
|
/**
|
|
2879
2912
|
* Fetch a project by project ID
|
|
2880
2913
|
*
|
|
@@ -4035,6 +4068,18 @@ export declare class ObservableUsersClient {
|
|
|
4035
4068
|
): Observable<T extends 'me' ? CurrentSanityUser : SanityUser>
|
|
4036
4069
|
}
|
|
4037
4070
|
|
|
4071
|
+
declare type OmittedProjectFields<T extends ListOptions | undefined> =
|
|
4072
|
+
| (T extends {
|
|
4073
|
+
includeMembers: false
|
|
4074
|
+
}
|
|
4075
|
+
? 'members'
|
|
4076
|
+
: never)
|
|
4077
|
+
| (T extends {
|
|
4078
|
+
includeFeatures: false
|
|
4079
|
+
}
|
|
4080
|
+
? 'features'
|
|
4081
|
+
: never)
|
|
4082
|
+
|
|
4038
4083
|
/**
|
|
4039
4084
|
* The listener connection has been established
|
|
4040
4085
|
* note: it's usually a better option to use the 'welcome' event
|
|
@@ -4251,19 +4296,11 @@ export declare class ProjectsClient {
|
|
|
4251
4296
|
*
|
|
4252
4297
|
* @param options - Options for the list request
|
|
4253
4298
|
* - `includeMembers` - Whether to include members in the response (default: true)
|
|
4299
|
+
* - `includeFeatures` - Whether to include features in the response (default: true)
|
|
4254
4300
|
* - `organizationId` - ID of the organization to fetch projects for
|
|
4255
|
-
* - `onlyExplicitMembership` -
|
|
4256
|
-
*/
|
|
4257
|
-
list(options?:
|
|
4258
|
-
includeMembers?: true
|
|
4259
|
-
organizationId?: string
|
|
4260
|
-
onlyExplicitMembership?: boolean
|
|
4261
|
-
}): Promise<SanityProject[]>
|
|
4262
|
-
list(options?: {
|
|
4263
|
-
includeMembers?: false
|
|
4264
|
-
organizationId?: string
|
|
4265
|
-
onlyExplicitMembership?: boolean
|
|
4266
|
-
}): Promise<Omit<SanityProject, 'members'>[]>
|
|
4301
|
+
* - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
|
|
4302
|
+
*/
|
|
4303
|
+
list<T extends ListOptions>(options?: T): Promise<Omit<SanityProject, OmittedProjectFields<T>>[]>
|
|
4267
4304
|
/**
|
|
4268
4305
|
* Fetch a project by project ID
|
|
4269
4306
|
*
|
|
@@ -4946,6 +4983,44 @@ export declare interface ReplaceVersionAction {
|
|
|
4946
4983
|
*/
|
|
4947
4984
|
export declare const requester: Requester
|
|
4948
4985
|
|
|
4986
|
+
/**
|
|
4987
|
+
* A function that intercepts HTTP requests made by the client.
|
|
4988
|
+
*
|
|
4989
|
+
* Receives the resolved request options, a `defaultRequester` function that
|
|
4990
|
+
* executes the request through the normal pipeline, and a `client` instance
|
|
4991
|
+
* without a `_requestHandler` (to avoid recursive interception).
|
|
4992
|
+
*
|
|
4993
|
+
* The consumer can:
|
|
4994
|
+
* - Modify request options before calling `defaultRequester`
|
|
4995
|
+
* - Transform the response stream (e.g. via `pipe`)
|
|
4996
|
+
* - Skip `defaultRequester` entirely and return a custom Observable
|
|
4997
|
+
* - Use `client` to make additional requests (e.g. refresh an auth token on 401)
|
|
4998
|
+
*
|
|
4999
|
+
* When set via `withConfig()`, the new handler **replaces** (not wraps) the previous one.
|
|
5000
|
+
*
|
|
5001
|
+
* Note: This only applies to HTTP requests. Real-time listener connections
|
|
5002
|
+
* (`client.listen()`) use EventSource and are not intercepted by this handler.
|
|
5003
|
+
*
|
|
5004
|
+
* @param request - The resolved request options including `url`
|
|
5005
|
+
* @param defaultRequester - Executes the request through the normal pipeline
|
|
5006
|
+
* @param client - A client instance with the same configuration but without a `_requestHandler`,
|
|
5007
|
+
* useful for making side requests (e.g. token refresh) without triggering the handler recursively
|
|
5008
|
+
*
|
|
5009
|
+
* @internal
|
|
5010
|
+
* @deprecated Don't use outside of Sanity internals
|
|
5011
|
+
*/
|
|
5012
|
+
export declare type RequestHandler = (
|
|
5013
|
+
request: RequestOptions & {
|
|
5014
|
+
url: string
|
|
5015
|
+
},
|
|
5016
|
+
defaultRequester: (
|
|
5017
|
+
options: RequestOptions & {
|
|
5018
|
+
url: string
|
|
5019
|
+
},
|
|
5020
|
+
) => Observable<HttpRequestEvent>,
|
|
5021
|
+
client: SanityClient,
|
|
5022
|
+
) => Observable<HttpRequestEvent>
|
|
5023
|
+
|
|
4949
5024
|
/** @internal */
|
|
4950
5025
|
export declare interface RequestObservableOptions extends Omit<RequestOptions, 'url'> {
|
|
4951
5026
|
url?: string
|
|
@@ -5922,6 +5997,7 @@ export declare interface SanityProject {
|
|
|
5922
5997
|
pendingInvites?: number
|
|
5923
5998
|
maxRetentionDays?: number
|
|
5924
5999
|
members: SanityProjectMember[]
|
|
6000
|
+
features: string[]
|
|
5925
6001
|
metadata: {
|
|
5926
6002
|
cliInitializedAt?: string
|
|
5927
6003
|
color?: string
|
package/dist/stega.browser.d.ts
CHANGED
|
@@ -804,6 +804,32 @@ export declare interface ClientConfig {
|
|
|
804
804
|
* Lineage token for recursion control
|
|
805
805
|
*/
|
|
806
806
|
lineage?: string
|
|
807
|
+
/**
|
|
808
|
+
* A custom request handler that intercepts all HTTP requests made by the client.
|
|
809
|
+
*
|
|
810
|
+
* Useful for logging, adding custom headers, refreshing auth tokens, rate limiting, etc.
|
|
811
|
+
*
|
|
812
|
+
* When using `withConfig()`, the new handler **replaces** the previous one (it does not
|
|
813
|
+
* wrap it). To compose handlers, you can chain them manually:
|
|
814
|
+
*
|
|
815
|
+
* ```ts
|
|
816
|
+
* const parent = createClient({...config, _requestHandler: handlerA})
|
|
817
|
+
* const child = parent.withConfig({
|
|
818
|
+
* _requestHandler: (req, defaultRequester) =>
|
|
819
|
+
* handlerB(req, (opts) => handlerA(opts, defaultRequester)),
|
|
820
|
+
* })
|
|
821
|
+
* ```
|
|
822
|
+
*
|
|
823
|
+
* Setting `_requestHandler` to `undefined` via `withConfig()` removes the handler.
|
|
824
|
+
*
|
|
825
|
+
* Note: This only applies to HTTP requests. Real-time listener connections
|
|
826
|
+
* (`client.listen()`) use EventSource and are not intercepted by this handler.
|
|
827
|
+
*
|
|
828
|
+
* @internal
|
|
829
|
+
* @deprecated Don't use outside of Sanity internals
|
|
830
|
+
* @see {@link RequestHandler}
|
|
831
|
+
*/
|
|
832
|
+
_requestHandler?: RequestHandler
|
|
807
833
|
}
|
|
808
834
|
|
|
809
835
|
declare type ClientConfigResource =
|
|
@@ -2299,6 +2325,13 @@ export declare type ListenParams = {
|
|
|
2299
2325
|
[key: string]: Any
|
|
2300
2326
|
}
|
|
2301
2327
|
|
|
2328
|
+
declare type ListOptions = {
|
|
2329
|
+
includeMembers?: boolean
|
|
2330
|
+
includeFeatures?: boolean
|
|
2331
|
+
organizationId?: string
|
|
2332
|
+
onlyExplicitMembership?: boolean
|
|
2333
|
+
}
|
|
2334
|
+
|
|
2302
2335
|
/**
|
|
2303
2336
|
* @public
|
|
2304
2337
|
*/
|
|
@@ -2311,6 +2344,7 @@ export declare class LiveClient {
|
|
|
2311
2344
|
events({
|
|
2312
2345
|
includeDrafts,
|
|
2313
2346
|
tag: _tag,
|
|
2347
|
+
waitFor,
|
|
2314
2348
|
}?: {
|
|
2315
2349
|
includeDrafts?: boolean
|
|
2316
2350
|
/**
|
|
@@ -2319,6 +2353,11 @@ export declare class LiveClient {
|
|
|
2319
2353
|
* @defaultValue `undefined`
|
|
2320
2354
|
*/
|
|
2321
2355
|
tag?: string
|
|
2356
|
+
/**
|
|
2357
|
+
* Delays events until after a Sanity Function has processed them and called the callback endpoint.
|
|
2358
|
+
* When omitted, events are delivered immediately.
|
|
2359
|
+
*/
|
|
2360
|
+
waitFor?: 'function'
|
|
2322
2361
|
}): Observable<LiveEvent>
|
|
2323
2362
|
}
|
|
2324
2363
|
|
|
@@ -2862,19 +2901,13 @@ export declare class ObservableProjectsClient {
|
|
|
2862
2901
|
*
|
|
2863
2902
|
* @param options - Options for the list request
|
|
2864
2903
|
* - `includeMembers` - Whether to include members in the response (default: true)
|
|
2904
|
+
* - `includeFeatures` - Whether to include features in the response (default: true)
|
|
2865
2905
|
* - `organizationId` - ID of the organization to fetch projects for
|
|
2866
|
-
* - `onlyExplicitMembership` -
|
|
2867
|
-
*/
|
|
2868
|
-
list(
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
onlyExplicitMembership?: boolean
|
|
2872
|
-
}): Observable<SanityProject[]>
|
|
2873
|
-
list(options?: {
|
|
2874
|
-
includeMembers?: false
|
|
2875
|
-
organizationId?: string
|
|
2876
|
-
onlyExplicitMembership?: boolean
|
|
2877
|
-
}): Observable<Omit<SanityProject, 'members'>[]>
|
|
2906
|
+
* - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
|
|
2907
|
+
*/
|
|
2908
|
+
list<T extends ListOptions>(
|
|
2909
|
+
options?: T,
|
|
2910
|
+
): Observable<Omit<SanityProject, OmittedProjectFields<T>>[]>
|
|
2878
2911
|
/**
|
|
2879
2912
|
* Fetch a project by project ID
|
|
2880
2913
|
*
|
|
@@ -4035,6 +4068,18 @@ export declare class ObservableUsersClient {
|
|
|
4035
4068
|
): Observable<T extends 'me' ? CurrentSanityUser : SanityUser>
|
|
4036
4069
|
}
|
|
4037
4070
|
|
|
4071
|
+
declare type OmittedProjectFields<T extends ListOptions | undefined> =
|
|
4072
|
+
| (T extends {
|
|
4073
|
+
includeMembers: false
|
|
4074
|
+
}
|
|
4075
|
+
? 'members'
|
|
4076
|
+
: never)
|
|
4077
|
+
| (T extends {
|
|
4078
|
+
includeFeatures: false
|
|
4079
|
+
}
|
|
4080
|
+
? 'features'
|
|
4081
|
+
: never)
|
|
4082
|
+
|
|
4038
4083
|
/**
|
|
4039
4084
|
* The listener connection has been established
|
|
4040
4085
|
* note: it's usually a better option to use the 'welcome' event
|
|
@@ -4251,19 +4296,11 @@ export declare class ProjectsClient {
|
|
|
4251
4296
|
*
|
|
4252
4297
|
* @param options - Options for the list request
|
|
4253
4298
|
* - `includeMembers` - Whether to include members in the response (default: true)
|
|
4299
|
+
* - `includeFeatures` - Whether to include features in the response (default: true)
|
|
4254
4300
|
* - `organizationId` - ID of the organization to fetch projects for
|
|
4255
|
-
* - `onlyExplicitMembership` -
|
|
4256
|
-
*/
|
|
4257
|
-
list(options?:
|
|
4258
|
-
includeMembers?: true
|
|
4259
|
-
organizationId?: string
|
|
4260
|
-
onlyExplicitMembership?: boolean
|
|
4261
|
-
}): Promise<SanityProject[]>
|
|
4262
|
-
list(options?: {
|
|
4263
|
-
includeMembers?: false
|
|
4264
|
-
organizationId?: string
|
|
4265
|
-
onlyExplicitMembership?: boolean
|
|
4266
|
-
}): Promise<Omit<SanityProject, 'members'>[]>
|
|
4301
|
+
* - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
|
|
4302
|
+
*/
|
|
4303
|
+
list<T extends ListOptions>(options?: T): Promise<Omit<SanityProject, OmittedProjectFields<T>>[]>
|
|
4267
4304
|
/**
|
|
4268
4305
|
* Fetch a project by project ID
|
|
4269
4306
|
*
|
|
@@ -4946,6 +4983,44 @@ export declare interface ReplaceVersionAction {
|
|
|
4946
4983
|
*/
|
|
4947
4984
|
export declare const requester: Requester
|
|
4948
4985
|
|
|
4986
|
+
/**
|
|
4987
|
+
* A function that intercepts HTTP requests made by the client.
|
|
4988
|
+
*
|
|
4989
|
+
* Receives the resolved request options, a `defaultRequester` function that
|
|
4990
|
+
* executes the request through the normal pipeline, and a `client` instance
|
|
4991
|
+
* without a `_requestHandler` (to avoid recursive interception).
|
|
4992
|
+
*
|
|
4993
|
+
* The consumer can:
|
|
4994
|
+
* - Modify request options before calling `defaultRequester`
|
|
4995
|
+
* - Transform the response stream (e.g. via `pipe`)
|
|
4996
|
+
* - Skip `defaultRequester` entirely and return a custom Observable
|
|
4997
|
+
* - Use `client` to make additional requests (e.g. refresh an auth token on 401)
|
|
4998
|
+
*
|
|
4999
|
+
* When set via `withConfig()`, the new handler **replaces** (not wraps) the previous one.
|
|
5000
|
+
*
|
|
5001
|
+
* Note: This only applies to HTTP requests. Real-time listener connections
|
|
5002
|
+
* (`client.listen()`) use EventSource and are not intercepted by this handler.
|
|
5003
|
+
*
|
|
5004
|
+
* @param request - The resolved request options including `url`
|
|
5005
|
+
* @param defaultRequester - Executes the request through the normal pipeline
|
|
5006
|
+
* @param client - A client instance with the same configuration but without a `_requestHandler`,
|
|
5007
|
+
* useful for making side requests (e.g. token refresh) without triggering the handler recursively
|
|
5008
|
+
*
|
|
5009
|
+
* @internal
|
|
5010
|
+
* @deprecated Don't use outside of Sanity internals
|
|
5011
|
+
*/
|
|
5012
|
+
export declare type RequestHandler = (
|
|
5013
|
+
request: RequestOptions & {
|
|
5014
|
+
url: string
|
|
5015
|
+
},
|
|
5016
|
+
defaultRequester: (
|
|
5017
|
+
options: RequestOptions & {
|
|
5018
|
+
url: string
|
|
5019
|
+
},
|
|
5020
|
+
) => Observable<HttpRequestEvent>,
|
|
5021
|
+
client: SanityClient,
|
|
5022
|
+
) => Observable<HttpRequestEvent>
|
|
5023
|
+
|
|
4949
5024
|
/** @internal */
|
|
4950
5025
|
export declare interface RequestObservableOptions extends Omit<RequestOptions, 'url'> {
|
|
4951
5026
|
url?: string
|
|
@@ -5922,6 +5997,7 @@ export declare interface SanityProject {
|
|
|
5922
5997
|
pendingInvites?: number
|
|
5923
5998
|
maxRetentionDays?: number
|
|
5924
5999
|
members: SanityProjectMember[]
|
|
6000
|
+
features: string[]
|
|
5925
6001
|
metadata: {
|
|
5926
6002
|
cliInitializedAt?: string
|
|
5927
6003
|
color?: string
|
package/dist/stega.d.cts
CHANGED
|
@@ -804,6 +804,32 @@ export declare interface ClientConfig {
|
|
|
804
804
|
* Lineage token for recursion control
|
|
805
805
|
*/
|
|
806
806
|
lineage?: string
|
|
807
|
+
/**
|
|
808
|
+
* A custom request handler that intercepts all HTTP requests made by the client.
|
|
809
|
+
*
|
|
810
|
+
* Useful for logging, adding custom headers, refreshing auth tokens, rate limiting, etc.
|
|
811
|
+
*
|
|
812
|
+
* When using `withConfig()`, the new handler **replaces** the previous one (it does not
|
|
813
|
+
* wrap it). To compose handlers, you can chain them manually:
|
|
814
|
+
*
|
|
815
|
+
* ```ts
|
|
816
|
+
* const parent = createClient({...config, _requestHandler: handlerA})
|
|
817
|
+
* const child = parent.withConfig({
|
|
818
|
+
* _requestHandler: (req, defaultRequester) =>
|
|
819
|
+
* handlerB(req, (opts) => handlerA(opts, defaultRequester)),
|
|
820
|
+
* })
|
|
821
|
+
* ```
|
|
822
|
+
*
|
|
823
|
+
* Setting `_requestHandler` to `undefined` via `withConfig()` removes the handler.
|
|
824
|
+
*
|
|
825
|
+
* Note: This only applies to HTTP requests. Real-time listener connections
|
|
826
|
+
* (`client.listen()`) use EventSource and are not intercepted by this handler.
|
|
827
|
+
*
|
|
828
|
+
* @internal
|
|
829
|
+
* @deprecated Don't use outside of Sanity internals
|
|
830
|
+
* @see {@link RequestHandler}
|
|
831
|
+
*/
|
|
832
|
+
_requestHandler?: RequestHandler
|
|
807
833
|
}
|
|
808
834
|
|
|
809
835
|
declare type ClientConfigResource =
|
|
@@ -2299,6 +2325,13 @@ export declare type ListenParams = {
|
|
|
2299
2325
|
[key: string]: Any
|
|
2300
2326
|
}
|
|
2301
2327
|
|
|
2328
|
+
declare type ListOptions = {
|
|
2329
|
+
includeMembers?: boolean
|
|
2330
|
+
includeFeatures?: boolean
|
|
2331
|
+
organizationId?: string
|
|
2332
|
+
onlyExplicitMembership?: boolean
|
|
2333
|
+
}
|
|
2334
|
+
|
|
2302
2335
|
/**
|
|
2303
2336
|
* @public
|
|
2304
2337
|
*/
|
|
@@ -2311,6 +2344,7 @@ export declare class LiveClient {
|
|
|
2311
2344
|
events({
|
|
2312
2345
|
includeDrafts,
|
|
2313
2346
|
tag: _tag,
|
|
2347
|
+
waitFor,
|
|
2314
2348
|
}?: {
|
|
2315
2349
|
includeDrafts?: boolean
|
|
2316
2350
|
/**
|
|
@@ -2319,6 +2353,11 @@ export declare class LiveClient {
|
|
|
2319
2353
|
* @defaultValue `undefined`
|
|
2320
2354
|
*/
|
|
2321
2355
|
tag?: string
|
|
2356
|
+
/**
|
|
2357
|
+
* Delays events until after a Sanity Function has processed them and called the callback endpoint.
|
|
2358
|
+
* When omitted, events are delivered immediately.
|
|
2359
|
+
*/
|
|
2360
|
+
waitFor?: 'function'
|
|
2322
2361
|
}): Observable<LiveEvent>
|
|
2323
2362
|
}
|
|
2324
2363
|
|
|
@@ -2862,19 +2901,13 @@ export declare class ObservableProjectsClient {
|
|
|
2862
2901
|
*
|
|
2863
2902
|
* @param options - Options for the list request
|
|
2864
2903
|
* - `includeMembers` - Whether to include members in the response (default: true)
|
|
2904
|
+
* - `includeFeatures` - Whether to include features in the response (default: true)
|
|
2865
2905
|
* - `organizationId` - ID of the organization to fetch projects for
|
|
2866
|
-
* - `onlyExplicitMembership` -
|
|
2867
|
-
*/
|
|
2868
|
-
list(
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
onlyExplicitMembership?: boolean
|
|
2872
|
-
}): Observable<SanityProject[]>
|
|
2873
|
-
list(options?: {
|
|
2874
|
-
includeMembers?: false
|
|
2875
|
-
organizationId?: string
|
|
2876
|
-
onlyExplicitMembership?: boolean
|
|
2877
|
-
}): Observable<Omit<SanityProject, 'members'>[]>
|
|
2906
|
+
* - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
|
|
2907
|
+
*/
|
|
2908
|
+
list<T extends ListOptions>(
|
|
2909
|
+
options?: T,
|
|
2910
|
+
): Observable<Omit<SanityProject, OmittedProjectFields<T>>[]>
|
|
2878
2911
|
/**
|
|
2879
2912
|
* Fetch a project by project ID
|
|
2880
2913
|
*
|
|
@@ -4035,6 +4068,18 @@ export declare class ObservableUsersClient {
|
|
|
4035
4068
|
): Observable<T extends 'me' ? CurrentSanityUser : SanityUser>
|
|
4036
4069
|
}
|
|
4037
4070
|
|
|
4071
|
+
declare type OmittedProjectFields<T extends ListOptions | undefined> =
|
|
4072
|
+
| (T extends {
|
|
4073
|
+
includeMembers: false
|
|
4074
|
+
}
|
|
4075
|
+
? 'members'
|
|
4076
|
+
: never)
|
|
4077
|
+
| (T extends {
|
|
4078
|
+
includeFeatures: false
|
|
4079
|
+
}
|
|
4080
|
+
? 'features'
|
|
4081
|
+
: never)
|
|
4082
|
+
|
|
4038
4083
|
/**
|
|
4039
4084
|
* The listener connection has been established
|
|
4040
4085
|
* note: it's usually a better option to use the 'welcome' event
|
|
@@ -4251,19 +4296,11 @@ export declare class ProjectsClient {
|
|
|
4251
4296
|
*
|
|
4252
4297
|
* @param options - Options for the list request
|
|
4253
4298
|
* - `includeMembers` - Whether to include members in the response (default: true)
|
|
4299
|
+
* - `includeFeatures` - Whether to include features in the response (default: true)
|
|
4254
4300
|
* - `organizationId` - ID of the organization to fetch projects for
|
|
4255
|
-
* - `onlyExplicitMembership` -
|
|
4256
|
-
*/
|
|
4257
|
-
list(options?:
|
|
4258
|
-
includeMembers?: true
|
|
4259
|
-
organizationId?: string
|
|
4260
|
-
onlyExplicitMembership?: boolean
|
|
4261
|
-
}): Promise<SanityProject[]>
|
|
4262
|
-
list(options?: {
|
|
4263
|
-
includeMembers?: false
|
|
4264
|
-
organizationId?: string
|
|
4265
|
-
onlyExplicitMembership?: boolean
|
|
4266
|
-
}): Promise<Omit<SanityProject, 'members'>[]>
|
|
4301
|
+
* - `onlyExplicitMembership` - Whether to include only projects with explicit membership (default: false)
|
|
4302
|
+
*/
|
|
4303
|
+
list<T extends ListOptions>(options?: T): Promise<Omit<SanityProject, OmittedProjectFields<T>>[]>
|
|
4267
4304
|
/**
|
|
4268
4305
|
* Fetch a project by project ID
|
|
4269
4306
|
*
|
|
@@ -4946,6 +4983,44 @@ export declare interface ReplaceVersionAction {
|
|
|
4946
4983
|
*/
|
|
4947
4984
|
export declare const requester: Requester
|
|
4948
4985
|
|
|
4986
|
+
/**
|
|
4987
|
+
* A function that intercepts HTTP requests made by the client.
|
|
4988
|
+
*
|
|
4989
|
+
* Receives the resolved request options, a `defaultRequester` function that
|
|
4990
|
+
* executes the request through the normal pipeline, and a `client` instance
|
|
4991
|
+
* without a `_requestHandler` (to avoid recursive interception).
|
|
4992
|
+
*
|
|
4993
|
+
* The consumer can:
|
|
4994
|
+
* - Modify request options before calling `defaultRequester`
|
|
4995
|
+
* - Transform the response stream (e.g. via `pipe`)
|
|
4996
|
+
* - Skip `defaultRequester` entirely and return a custom Observable
|
|
4997
|
+
* - Use `client` to make additional requests (e.g. refresh an auth token on 401)
|
|
4998
|
+
*
|
|
4999
|
+
* When set via `withConfig()`, the new handler **replaces** (not wraps) the previous one.
|
|
5000
|
+
*
|
|
5001
|
+
* Note: This only applies to HTTP requests. Real-time listener connections
|
|
5002
|
+
* (`client.listen()`) use EventSource and are not intercepted by this handler.
|
|
5003
|
+
*
|
|
5004
|
+
* @param request - The resolved request options including `url`
|
|
5005
|
+
* @param defaultRequester - Executes the request through the normal pipeline
|
|
5006
|
+
* @param client - A client instance with the same configuration but without a `_requestHandler`,
|
|
5007
|
+
* useful for making side requests (e.g. token refresh) without triggering the handler recursively
|
|
5008
|
+
*
|
|
5009
|
+
* @internal
|
|
5010
|
+
* @deprecated Don't use outside of Sanity internals
|
|
5011
|
+
*/
|
|
5012
|
+
export declare type RequestHandler = (
|
|
5013
|
+
request: RequestOptions & {
|
|
5014
|
+
url: string
|
|
5015
|
+
},
|
|
5016
|
+
defaultRequester: (
|
|
5017
|
+
options: RequestOptions & {
|
|
5018
|
+
url: string
|
|
5019
|
+
},
|
|
5020
|
+
) => Observable<HttpRequestEvent>,
|
|
5021
|
+
client: SanityClient,
|
|
5022
|
+
) => Observable<HttpRequestEvent>
|
|
5023
|
+
|
|
4949
5024
|
/** @internal */
|
|
4950
5025
|
export declare interface RequestObservableOptions extends Omit<RequestOptions, 'url'> {
|
|
4951
5026
|
url?: string
|
|
@@ -5922,6 +5997,7 @@ export declare interface SanityProject {
|
|
|
5922
5997
|
pendingInvites?: number
|
|
5923
5998
|
maxRetentionDays?: number
|
|
5924
5999
|
members: SanityProjectMember[]
|
|
6000
|
+
features: string[]
|
|
5925
6001
|
metadata: {
|
|
5926
6002
|
cliInitializedAt?: string
|
|
5927
6003
|
color?: string
|