@sanity/client 7.0.1-canary.2 → 7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +516 -40
- package/dist/_chunks-cjs/config.cjs +14 -0
- package/dist/_chunks-cjs/config.cjs.map +1 -1
- package/dist/_chunks-es/config.js +15 -1
- package/dist/_chunks-es/config.js.map +1 -1
- package/dist/index.browser.cjs +850 -7
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.d.cts +2601 -1622
- package/dist/index.browser.d.ts +2601 -1622
- package/dist/index.browser.js +852 -7
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +839 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2601 -1622
- package/dist/index.d.ts +2601 -1622
- package/dist/index.js +842 -9
- package/dist/index.js.map +1 -1
- package/dist/stega.browser.d.cts +2612 -1633
- package/dist/stega.browser.d.ts +2612 -1633
- package/dist/stega.d.cts +2612 -1633
- package/dist/stega.d.ts +2612 -1633
- package/package.json +3 -1
- package/src/SanityClient.ts +626 -1106
- package/src/agent/actions/AgentActionsClient.ts +111 -0
- package/src/agent/actions/commonTypes.ts +336 -0
- package/src/agent/actions/generate.ts +274 -0
- package/src/agent/actions/transform.ts +215 -0
- package/src/agent/actions/translate.ts +165 -0
- package/src/assets/AssetsClient.ts +2 -86
- package/src/data/dataMethods.ts +127 -3
- package/src/data/transaction.ts +1 -1
- package/src/datasets/DatasetsClient.ts +2 -64
- package/src/projects/ProjectsClient.ts +4 -46
- package/src/releases/ReleasesClient.ts +687 -0
- package/src/releases/createRelease.ts +53 -0
- package/src/types.ts +245 -1
- package/src/users/UsersClient.ts +2 -24
- package/src/util/createVersionId.ts +79 -0
- package/src/validators.ts +23 -1
- package/umd/sanityClient.js +915 -6
- package/umd/sanityClient.min.js +2 -2
|
@@ -17,91 +17,7 @@ import type {
|
|
|
17
17
|
import * as validators from '../validators'
|
|
18
18
|
|
|
19
19
|
/** @internal */
|
|
20
|
-
export
|
|
21
|
-
/**
|
|
22
|
-
* Uploads a file asset to the configured dataset
|
|
23
|
-
*
|
|
24
|
-
* @param assetType - Asset type (file)
|
|
25
|
-
* @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
|
|
26
|
-
* @param options - Options to use for the upload
|
|
27
|
-
*/
|
|
28
|
-
upload(
|
|
29
|
-
assetType: 'file',
|
|
30
|
-
body: UploadBody,
|
|
31
|
-
options?: UploadClientConfig,
|
|
32
|
-
): Observable<HttpRequestEvent<{document: SanityAssetDocument}>>
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Uploads an image asset to the configured dataset
|
|
36
|
-
*
|
|
37
|
-
* @param assetType - Asset type (image)
|
|
38
|
-
* @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
|
|
39
|
-
* @param options - Options to use for the upload
|
|
40
|
-
*/
|
|
41
|
-
upload(
|
|
42
|
-
assetType: 'image',
|
|
43
|
-
body: UploadBody,
|
|
44
|
-
options?: UploadClientConfig,
|
|
45
|
-
): Observable<HttpRequestEvent<{document: SanityImageAssetDocument}>>
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Uploads a file or an image asset to the configured dataset
|
|
49
|
-
*
|
|
50
|
-
* @param assetType - Asset type (file/image)
|
|
51
|
-
* @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
|
|
52
|
-
* @param options - Options to use for the upload
|
|
53
|
-
*/
|
|
54
|
-
upload(
|
|
55
|
-
assetType: 'file' | 'image',
|
|
56
|
-
body: UploadBody,
|
|
57
|
-
options?: UploadClientConfig,
|
|
58
|
-
): Observable<HttpRequestEvent<{document: SanityAssetDocument | SanityImageAssetDocument}>>
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/** @internal */
|
|
62
|
-
export interface AssetsClientType {
|
|
63
|
-
/**
|
|
64
|
-
* Uploads a file asset to the configured dataset
|
|
65
|
-
*
|
|
66
|
-
* @param assetType - Asset type (file)
|
|
67
|
-
* @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
|
|
68
|
-
* @param options - Options to use for the upload
|
|
69
|
-
*/
|
|
70
|
-
upload(
|
|
71
|
-
assetType: 'file',
|
|
72
|
-
body: UploadBody,
|
|
73
|
-
options?: UploadClientConfig,
|
|
74
|
-
): Promise<SanityAssetDocument>
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Uploads an image asset to the configured dataset
|
|
78
|
-
*
|
|
79
|
-
* @param assetType - Asset type (image)
|
|
80
|
-
* @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
|
|
81
|
-
* @param options - Options to use for the upload
|
|
82
|
-
*/
|
|
83
|
-
upload(
|
|
84
|
-
assetType: 'image',
|
|
85
|
-
body: UploadBody,
|
|
86
|
-
options?: UploadClientConfig,
|
|
87
|
-
): Promise<SanityImageAssetDocument>
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Uploads a file or an image asset to the configured dataset
|
|
91
|
-
*
|
|
92
|
-
* @param assetType - Asset type (file/image)
|
|
93
|
-
* @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
|
|
94
|
-
* @param options - Options to use for the upload
|
|
95
|
-
*/
|
|
96
|
-
upload(
|
|
97
|
-
assetType: 'file' | 'image',
|
|
98
|
-
body: UploadBody,
|
|
99
|
-
options?: UploadClientConfig,
|
|
100
|
-
): Promise<SanityAssetDocument | SanityImageAssetDocument>
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/** @internal */
|
|
104
|
-
export class ObservableAssetsClient implements ObservableAssetsClientType {
|
|
20
|
+
export class ObservableAssetsClient {
|
|
105
21
|
#client: ObservableSanityClient
|
|
106
22
|
#httpRequest: HttpRequest
|
|
107
23
|
constructor(client: ObservableSanityClient, httpRequest: HttpRequest) {
|
|
@@ -156,7 +72,7 @@ export class ObservableAssetsClient implements ObservableAssetsClientType {
|
|
|
156
72
|
}
|
|
157
73
|
|
|
158
74
|
/** @internal */
|
|
159
|
-
export class AssetsClient
|
|
75
|
+
export class AssetsClient {
|
|
160
76
|
#client: SanityClient
|
|
161
77
|
#httpRequest: HttpRequest
|
|
162
78
|
constructor(client: SanityClient, httpRequest: HttpRequest) {
|
package/src/data/dataMethods.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {getVersionFromId, getVersionId, isDraftId} from '@sanity/client/csm'
|
|
1
2
|
import {from, type MonoTypeOperatorFunction, Observable} from 'rxjs'
|
|
2
3
|
import {combineLatestWith, filter, map} from 'rxjs/operators'
|
|
3
4
|
|
|
@@ -12,6 +13,8 @@ import type {
|
|
|
12
13
|
Any,
|
|
13
14
|
BaseActionOptions,
|
|
14
15
|
BaseMutationOptions,
|
|
16
|
+
CreateVersionAction,
|
|
17
|
+
DiscardVersionAction,
|
|
15
18
|
FirstDocumentIdMutationOptions,
|
|
16
19
|
FirstDocumentMutationOptions,
|
|
17
20
|
HttpRequest,
|
|
@@ -25,11 +28,13 @@ import type {
|
|
|
25
28
|
MutationSelection,
|
|
26
29
|
QueryOptions,
|
|
27
30
|
RawQueryResponse,
|
|
31
|
+
ReplaceVersionAction,
|
|
28
32
|
RequestObservableOptions,
|
|
29
33
|
RequestOptions,
|
|
30
34
|
SanityDocument,
|
|
31
35
|
SingleActionResult,
|
|
32
36
|
SingleMutationResult,
|
|
37
|
+
UnpublishVersionAction,
|
|
33
38
|
} from '../types'
|
|
34
39
|
import {getSelection} from '../util/getSelection'
|
|
35
40
|
import * as validate from '../validators'
|
|
@@ -132,10 +137,36 @@ export function _getDocument<R extends Record<string, Any>>(
|
|
|
132
137
|
client: Client,
|
|
133
138
|
httpRequest: HttpRequest,
|
|
134
139
|
id: string,
|
|
135
|
-
opts: {signal?: AbortSignal; tag?: string} = {},
|
|
140
|
+
opts: {signal?: AbortSignal; tag?: string; releaseId?: string} = {},
|
|
136
141
|
): Observable<SanityDocument<R> | undefined> {
|
|
142
|
+
const getDocId = () => {
|
|
143
|
+
if (!opts.releaseId) {
|
|
144
|
+
return id
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const versionId = getVersionFromId(id)
|
|
148
|
+
if (!versionId) {
|
|
149
|
+
if (isDraftId(id)) {
|
|
150
|
+
throw new Error(
|
|
151
|
+
`The document ID (\`${id}\`) is a draft, but \`options.releaseId\` is set as \`${opts.releaseId}\``,
|
|
152
|
+
)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return getVersionId(id, opts.releaseId)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (versionId !== opts.releaseId) {
|
|
159
|
+
throw new Error(
|
|
160
|
+
`The document ID (\`${id}\`) is already a version of \`${versionId}\` release, but this does not match the provided \`options.releaseId\` (\`${opts.releaseId}\`)`,
|
|
161
|
+
)
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return id
|
|
165
|
+
}
|
|
166
|
+
const docId = getDocId()
|
|
167
|
+
|
|
137
168
|
const options = {
|
|
138
|
-
uri: _getDataUrl(client, 'doc',
|
|
169
|
+
uri: _getDataUrl(client, 'doc', docId),
|
|
139
170
|
json: true,
|
|
140
171
|
tag: opts.tag,
|
|
141
172
|
signal: opts.signal,
|
|
@@ -168,6 +199,27 @@ export function _getDocuments<R extends Record<string, Any>>(
|
|
|
168
199
|
)
|
|
169
200
|
}
|
|
170
201
|
|
|
202
|
+
/** @internal */
|
|
203
|
+
export function _getReleaseDocuments<R extends Record<string, Any>>(
|
|
204
|
+
client: ObservableSanityClient | SanityClient,
|
|
205
|
+
httpRequest: HttpRequest,
|
|
206
|
+
releaseId: string,
|
|
207
|
+
opts: BaseMutationOptions = {},
|
|
208
|
+
): Observable<RawQueryResponse<SanityDocument<R>[]>> {
|
|
209
|
+
return _dataRequest(
|
|
210
|
+
client,
|
|
211
|
+
httpRequest,
|
|
212
|
+
'query',
|
|
213
|
+
{
|
|
214
|
+
query: '*[sanity::partOfRelease($releaseId)]',
|
|
215
|
+
params: {
|
|
216
|
+
releaseId,
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
opts,
|
|
220
|
+
)
|
|
221
|
+
}
|
|
222
|
+
|
|
171
223
|
/** @internal */
|
|
172
224
|
export function _createIfNotExists<R extends Record<string, Any>>(
|
|
173
225
|
client: Client,
|
|
@@ -204,6 +256,26 @@ export function _createOrReplace<R extends Record<string, Any>>(
|
|
|
204
256
|
return _create<R>(client, httpRequest, doc, 'createOrReplace', options)
|
|
205
257
|
}
|
|
206
258
|
|
|
259
|
+
/** @internal */
|
|
260
|
+
export function _createVersion<R extends Record<string, Any>>(
|
|
261
|
+
client: ObservableSanityClient | SanityClient,
|
|
262
|
+
httpRequest: HttpRequest,
|
|
263
|
+
doc: IdentifiedSanityDocumentStub<R>,
|
|
264
|
+
publishedId: string,
|
|
265
|
+
options?: BaseActionOptions,
|
|
266
|
+
): Observable<SingleActionResult> {
|
|
267
|
+
validators.requireDocumentId('createVersion', doc)
|
|
268
|
+
validators.requireDocumentType('createVersion', doc)
|
|
269
|
+
|
|
270
|
+
const createVersionAction: CreateVersionAction = {
|
|
271
|
+
actionType: 'sanity.action.document.version.create',
|
|
272
|
+
publishedId,
|
|
273
|
+
document: doc,
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
return _action(client, httpRequest, createVersionAction, options)
|
|
277
|
+
}
|
|
278
|
+
|
|
207
279
|
/** @internal */
|
|
208
280
|
export function _delete<R extends Record<string, Any>>(
|
|
209
281
|
client: Client,
|
|
@@ -227,6 +299,58 @@ export function _delete<R extends Record<string, Any>>(
|
|
|
227
299
|
)
|
|
228
300
|
}
|
|
229
301
|
|
|
302
|
+
/** @internal */
|
|
303
|
+
export function _discardVersion(
|
|
304
|
+
client: ObservableSanityClient | SanityClient,
|
|
305
|
+
httpRequest: HttpRequest,
|
|
306
|
+
versionId: string,
|
|
307
|
+
purge: boolean = false,
|
|
308
|
+
options?: BaseActionOptions,
|
|
309
|
+
): Observable<SingleActionResult> {
|
|
310
|
+
const discardVersionAction: DiscardVersionAction = {
|
|
311
|
+
actionType: 'sanity.action.document.version.discard',
|
|
312
|
+
versionId,
|
|
313
|
+
purge,
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
return _action(client, httpRequest, discardVersionAction, options)
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/** @internal */
|
|
320
|
+
export function _replaceVersion<R extends Record<string, Any>>(
|
|
321
|
+
client: ObservableSanityClient | SanityClient,
|
|
322
|
+
httpRequest: HttpRequest,
|
|
323
|
+
doc: IdentifiedSanityDocumentStub<R>,
|
|
324
|
+
options?: BaseActionOptions,
|
|
325
|
+
): Observable<SingleActionResult> {
|
|
326
|
+
validators.requireDocumentId('replaceVersion', doc)
|
|
327
|
+
validators.requireDocumentType('replaceVersion', doc)
|
|
328
|
+
|
|
329
|
+
const replaceVersionAction: ReplaceVersionAction = {
|
|
330
|
+
actionType: 'sanity.action.document.version.replace',
|
|
331
|
+
document: doc,
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
return _action(client, httpRequest, replaceVersionAction, options)
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/** @internal */
|
|
338
|
+
export function _unpublishVersion(
|
|
339
|
+
client: ObservableSanityClient | SanityClient,
|
|
340
|
+
httpRequest: HttpRequest,
|
|
341
|
+
versionId: string,
|
|
342
|
+
publishedId: string,
|
|
343
|
+
options?: BaseActionOptions,
|
|
344
|
+
): Observable<SingleActionResult> {
|
|
345
|
+
const unpublishVersionAction: UnpublishVersionAction = {
|
|
346
|
+
actionType: 'sanity.action.document.version.unpublish',
|
|
347
|
+
versionId,
|
|
348
|
+
publishedId,
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
return _action(client, httpRequest, unpublishVersionAction, options)
|
|
352
|
+
}
|
|
353
|
+
|
|
230
354
|
/** @internal */
|
|
231
355
|
export function _mutate<R extends Record<string, Any>>(
|
|
232
356
|
client: Client,
|
|
@@ -549,7 +673,7 @@ const isDomExceptionSupported = Boolean(globalThis.DOMException)
|
|
|
549
673
|
|
|
550
674
|
/**
|
|
551
675
|
* @internal
|
|
552
|
-
* @param signal
|
|
676
|
+
* @param signal - The abort signal to use.
|
|
553
677
|
* Original source copied from https://github.com/sindresorhus/ky/blob/740732c78aad97e9aec199e9871bdbf0ae29b805/source/errors/DOMException.ts
|
|
554
678
|
* TODO: When targeting Node.js 18, use `signal.throwIfAborted()` (https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/throwIfAborted)
|
|
555
679
|
*/
|
package/src/data/transaction.ts
CHANGED
|
@@ -253,7 +253,7 @@ export class Transaction extends BaseTransaction {
|
|
|
253
253
|
return this._add({patch: patch.serialize()})
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
|
|
256
|
+
/*
|
|
257
257
|
* transaction.patch(
|
|
258
258
|
* {query: "*[_type == 'person' && points >= $threshold]", params: { threshold: 100 }},
|
|
259
259
|
* {dec: { points: 100 }, inc: { bonuses: 1 }}
|
|
@@ -6,69 +6,7 @@ import type {DatasetAclMode, DatasetResponse, DatasetsResponse, HttpRequest} fro
|
|
|
6
6
|
import * as validate from '../validators'
|
|
7
7
|
|
|
8
8
|
/** @internal */
|
|
9
|
-
export
|
|
10
|
-
/**
|
|
11
|
-
* Create a new dataset with the given name
|
|
12
|
-
*
|
|
13
|
-
* @param name - Name of the dataset to create
|
|
14
|
-
* @param options - Options for the dataset
|
|
15
|
-
*/
|
|
16
|
-
create(name: string, options?: {aclMode?: DatasetAclMode}): Observable<DatasetResponse>
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Edit a dataset with the given name
|
|
20
|
-
*
|
|
21
|
-
* @param name - Name of the dataset to edit
|
|
22
|
-
* @param options - New options for the dataset
|
|
23
|
-
*/
|
|
24
|
-
edit(name: string, options?: {aclMode?: DatasetAclMode}): Observable<DatasetResponse>
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Delete a dataset with the given name
|
|
28
|
-
*
|
|
29
|
-
* @param name - Name of the dataset to delete
|
|
30
|
-
*/
|
|
31
|
-
delete(name: string): Observable<{deleted: true}>
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Fetch a list of datasets for the configured project
|
|
35
|
-
*/
|
|
36
|
-
list(): Observable<DatasetsResponse>
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/** @internal */
|
|
40
|
-
export interface DatasetsClientType {
|
|
41
|
-
/**
|
|
42
|
-
* Create a new dataset with the given name
|
|
43
|
-
*
|
|
44
|
-
* @param name - Name of the dataset to create
|
|
45
|
-
* @param options - Options for the dataset
|
|
46
|
-
*/
|
|
47
|
-
create(name: string, options?: {aclMode?: DatasetAclMode}): Promise<DatasetResponse>
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Edit a dataset with the given name
|
|
51
|
-
*
|
|
52
|
-
* @param name - Name of the dataset to edit
|
|
53
|
-
* @param options - New options for the dataset
|
|
54
|
-
*/
|
|
55
|
-
edit(name: string, options?: {aclMode?: DatasetAclMode}): Promise<DatasetResponse>
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Delete a dataset with the given name
|
|
59
|
-
*
|
|
60
|
-
* @param name - Name of the dataset to delete
|
|
61
|
-
*/
|
|
62
|
-
delete(name: string): Promise<{deleted: true}>
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Fetch a list of datasets for the configured project
|
|
66
|
-
*/
|
|
67
|
-
list(): Promise<DatasetsResponse>
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/** @internal */
|
|
71
|
-
export class ObservableDatasetsClient implements ObservableDatasetsClientType {
|
|
9
|
+
export class ObservableDatasetsClient {
|
|
72
10
|
#client: ObservableSanityClient
|
|
73
11
|
#httpRequest: HttpRequest
|
|
74
12
|
constructor(client: ObservableSanityClient, httpRequest: HttpRequest) {
|
|
@@ -117,7 +55,7 @@ export class ObservableDatasetsClient implements ObservableDatasetsClientType {
|
|
|
117
55
|
}
|
|
118
56
|
|
|
119
57
|
/** @internal */
|
|
120
|
-
export class DatasetsClient
|
|
58
|
+
export class DatasetsClient {
|
|
121
59
|
#client: SanityClient
|
|
122
60
|
#httpRequest: HttpRequest
|
|
123
61
|
constructor(client: SanityClient, httpRequest: HttpRequest) {
|
|
@@ -6,49 +6,7 @@ import type {HttpRequest, SanityProject} from '../types'
|
|
|
6
6
|
import * as validate from '../validators'
|
|
7
7
|
|
|
8
8
|
/** @internal */
|
|
9
|
-
export
|
|
10
|
-
/**
|
|
11
|
-
* Fetch a list of projects the authenticated user has access to.
|
|
12
|
-
*
|
|
13
|
-
* @param options - Options for the list request
|
|
14
|
-
* @param options.includeMembers - Whether to include members in the response (default: true)
|
|
15
|
-
*/
|
|
16
|
-
list(options?: {includeMembers?: true}): Observable<SanityProject[]>
|
|
17
|
-
list(options?: {includeMembers?: false}): Observable<Omit<SanityProject, 'members'>[]>
|
|
18
|
-
list(options?: {
|
|
19
|
-
includeMembers?: boolean
|
|
20
|
-
}): Observable<SanityProject[] | Omit<SanityProject, 'members'>[]>
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Fetch a project by project ID
|
|
24
|
-
*
|
|
25
|
-
* @param projectId - ID of the project to fetch
|
|
26
|
-
*/
|
|
27
|
-
getById(projectId: string): Observable<SanityProject>
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/** @internal */
|
|
31
|
-
export interface ProjectsClientType {
|
|
32
|
-
/**
|
|
33
|
-
* Fetch a list of projects the authenticated user has access to.
|
|
34
|
-
*
|
|
35
|
-
* @param options - Options for the list request
|
|
36
|
-
* @param options.includeMembers - Whether to include members in the response (default: true)
|
|
37
|
-
*/
|
|
38
|
-
list(options?: {includeMembers?: true}): Promise<SanityProject[]>
|
|
39
|
-
list(options?: {includeMembers?: false}): Promise<Omit<SanityProject, 'members'>[]>
|
|
40
|
-
list(options?: {includeMembers?: boolean}): Promise<SanityProject[]>
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Fetch a project by project ID
|
|
44
|
-
*
|
|
45
|
-
* @param projectId - ID of the project to fetch
|
|
46
|
-
*/
|
|
47
|
-
getById(projectId: string): Promise<SanityProject>
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/** @internal */
|
|
51
|
-
export class ObservableProjectsClient implements ObservableProjectsClientType {
|
|
9
|
+
export class ObservableProjectsClient {
|
|
52
10
|
#client: ObservableSanityClient
|
|
53
11
|
#httpRequest: HttpRequest
|
|
54
12
|
constructor(client: ObservableSanityClient, httpRequest: HttpRequest) {
|
|
@@ -60,7 +18,7 @@ export class ObservableProjectsClient implements ObservableProjectsClientType {
|
|
|
60
18
|
* Fetch a list of projects the authenticated user has access to.
|
|
61
19
|
*
|
|
62
20
|
* @param options - Options for the list request
|
|
63
|
-
*
|
|
21
|
+
* - `includeMembers` - Whether to include members in the response (default: true)
|
|
64
22
|
*/
|
|
65
23
|
list(options?: {includeMembers?: true}): Observable<SanityProject[]>
|
|
66
24
|
list(options?: {includeMembers?: false}): Observable<Omit<SanityProject, 'members'>[]>
|
|
@@ -84,7 +42,7 @@ export class ObservableProjectsClient implements ObservableProjectsClientType {
|
|
|
84
42
|
}
|
|
85
43
|
|
|
86
44
|
/** @internal */
|
|
87
|
-
export class ProjectsClient
|
|
45
|
+
export class ProjectsClient {
|
|
88
46
|
#client: SanityClient
|
|
89
47
|
#httpRequest: HttpRequest
|
|
90
48
|
constructor(client: SanityClient, httpRequest: HttpRequest) {
|
|
@@ -96,7 +54,7 @@ export class ProjectsClient implements ProjectsClientType {
|
|
|
96
54
|
* Fetch a list of projects the authenticated user has access to.
|
|
97
55
|
*
|
|
98
56
|
* @param options - Options for the list request
|
|
99
|
-
*
|
|
57
|
+
* - `includeMembers` - Whether to include members in the response (default: true)
|
|
100
58
|
*/
|
|
101
59
|
list(options?: {includeMembers?: true}): Promise<SanityProject[]>
|
|
102
60
|
list(options?: {includeMembers?: false}): Promise<Omit<SanityProject, 'members'>[]>
|