@sanity/client 7.15.0 → 7.17.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/_chunks-cjs/config.cjs.map +1 -1
- package/dist/_chunks-cjs/isRecord.cjs.map +1 -1
- package/dist/_chunks-cjs/resolveEditInfo.cjs +1 -1
- package/dist/_chunks-cjs/resolveEditInfo.cjs.map +1 -1
- package/dist/_chunks-cjs/stegaClean.cjs.map +1 -1
- package/dist/_chunks-cjs/stegaEncodeSourceMap.cjs +1 -1
- package/dist/_chunks-cjs/stegaEncodeSourceMap.cjs.map +1 -1
- package/dist/_chunks-es/config.js.map +1 -1
- package/dist/_chunks-es/isRecord.js.map +1 -1
- package/dist/_chunks-es/resolveEditInfo.js +1 -1
- package/dist/_chunks-es/resolveEditInfo.js.map +1 -1
- package/dist/_chunks-es/stegaClean.js.map +1 -1
- package/dist/_chunks-es/stegaEncodeSourceMap.js +1 -1
- package/dist/_chunks-es/stegaEncodeSourceMap.js.map +1 -1
- package/dist/csm.cjs.map +1 -1
- package/dist/csm.js.map +1 -1
- package/dist/index.browser.cjs +62 -4
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.d.cts +73 -28
- package/dist/index.browser.d.ts +73 -28
- package/dist/index.browser.js +63 -5
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +63 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +73 -28
- package/dist/index.d.ts +73 -28
- package/dist/index.js +64 -6
- package/dist/index.js.map +1 -1
- package/dist/media-library.cjs.map +1 -1
- package/dist/media-library.js.map +1 -1
- package/dist/stega.browser.cjs.map +1 -1
- package/dist/stega.browser.d.cts +73 -28
- package/dist/stega.browser.d.ts +73 -28
- package/dist/stega.browser.js +1 -1
- package/dist/stega.browser.js.map +1 -1
- package/dist/stega.cjs.map +1 -1
- package/dist/stega.d.cts +73 -28
- package/dist/stega.d.ts +73 -28
- package/dist/stega.js +1 -1
- package/dist/stega.js.map +1 -1
- package/package.json +1 -1
- package/src/datasets/DatasetsClient.ts +93 -8
- package/src/projects/ProjectsClient.ts +22 -2
- package/src/types.ts +27 -0
- package/umd/sanityClient.js +71 -13
- package/umd/sanityClient.min.js +2 -2
package/dist/stega.d.ts
CHANGED
|
@@ -1190,6 +1190,20 @@ export declare interface CurrentSanityUser {
|
|
|
1190
1190
|
/** @public */
|
|
1191
1191
|
export declare type DatasetAclMode = 'public' | 'private' | 'custom'
|
|
1192
1192
|
|
|
1193
|
+
/** @public */
|
|
1194
|
+
export declare type DatasetCreateOptions = {
|
|
1195
|
+
aclMode?: DatasetAclMode
|
|
1196
|
+
embeddings?: {
|
|
1197
|
+
enabled: boolean
|
|
1198
|
+
projection?: string
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
/** @public */
|
|
1203
|
+
export declare type DatasetEditOptions = {
|
|
1204
|
+
aclMode?: DatasetAclMode
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1193
1207
|
/** @public */
|
|
1194
1208
|
export declare type DatasetResponse = {
|
|
1195
1209
|
datasetName: string
|
|
@@ -1204,26 +1218,16 @@ export declare class DatasetsClient {
|
|
|
1204
1218
|
* Create a new dataset with the given name
|
|
1205
1219
|
*
|
|
1206
1220
|
* @param name - Name of the dataset to create
|
|
1207
|
-
* @param options - Options for the dataset
|
|
1221
|
+
* @param options - Options for the dataset, including optional embeddings configuration
|
|
1208
1222
|
*/
|
|
1209
|
-
create(
|
|
1210
|
-
name: string,
|
|
1211
|
-
options?: {
|
|
1212
|
-
aclMode?: DatasetAclMode
|
|
1213
|
-
},
|
|
1214
|
-
): Promise<DatasetResponse>
|
|
1223
|
+
create(name: string, options?: DatasetCreateOptions): Promise<DatasetResponse>
|
|
1215
1224
|
/**
|
|
1216
1225
|
* Edit a dataset with the given name
|
|
1217
1226
|
*
|
|
1218
1227
|
* @param name - Name of the dataset to edit
|
|
1219
1228
|
* @param options - New options for the dataset
|
|
1220
1229
|
*/
|
|
1221
|
-
edit(
|
|
1222
|
-
name: string,
|
|
1223
|
-
options?: {
|
|
1224
|
-
aclMode?: DatasetAclMode
|
|
1225
|
-
},
|
|
1226
|
-
): Promise<DatasetResponse>
|
|
1230
|
+
edit(name: string, options?: DatasetEditOptions): Promise<DatasetResponse>
|
|
1227
1231
|
/**
|
|
1228
1232
|
* Delete a dataset with the given name
|
|
1229
1233
|
*
|
|
@@ -1236,6 +1240,19 @@ export declare class DatasetsClient {
|
|
|
1236
1240
|
* Fetch a list of datasets for the configured project
|
|
1237
1241
|
*/
|
|
1238
1242
|
list(): Promise<DatasetsResponse>
|
|
1243
|
+
/**
|
|
1244
|
+
* Get embeddings settings for a dataset
|
|
1245
|
+
*
|
|
1246
|
+
* @param name - Name of the dataset
|
|
1247
|
+
*/
|
|
1248
|
+
getEmbeddingsSettings(name: string): Promise<EmbeddingsSettings>
|
|
1249
|
+
/**
|
|
1250
|
+
* Edit embeddings settings for a dataset
|
|
1251
|
+
*
|
|
1252
|
+
* @param name - Name of the dataset
|
|
1253
|
+
* @param settings - Embeddings settings to apply
|
|
1254
|
+
*/
|
|
1255
|
+
editEmbeddingsSettings(name: string, settings: EmbeddingsSettingsBody): Promise<void>
|
|
1239
1256
|
}
|
|
1240
1257
|
|
|
1241
1258
|
/** @public */
|
|
@@ -1434,6 +1451,19 @@ export declare interface EditReleaseAction {
|
|
|
1434
1451
|
patch: PatchOperations
|
|
1435
1452
|
}
|
|
1436
1453
|
|
|
1454
|
+
/** @public */
|
|
1455
|
+
export declare type EmbeddingsSettings = {
|
|
1456
|
+
enabled: boolean
|
|
1457
|
+
projection?: string
|
|
1458
|
+
status: string
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
/** @public */
|
|
1462
|
+
export declare type EmbeddingsSettingsBody = {
|
|
1463
|
+
enabled: boolean
|
|
1464
|
+
projection?: string
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1437
1467
|
/**
|
|
1438
1468
|
* @internal
|
|
1439
1469
|
*/
|
|
@@ -2717,26 +2747,16 @@ export declare class ObservableDatasetsClient {
|
|
|
2717
2747
|
* Create a new dataset with the given name
|
|
2718
2748
|
*
|
|
2719
2749
|
* @param name - Name of the dataset to create
|
|
2720
|
-
* @param options - Options for the dataset
|
|
2750
|
+
* @param options - Options for the dataset, including optional embeddings configuration
|
|
2721
2751
|
*/
|
|
2722
|
-
create(
|
|
2723
|
-
name: string,
|
|
2724
|
-
options?: {
|
|
2725
|
-
aclMode?: DatasetAclMode
|
|
2726
|
-
},
|
|
2727
|
-
): Observable<DatasetResponse>
|
|
2752
|
+
create(name: string, options?: DatasetCreateOptions): Observable<DatasetResponse>
|
|
2728
2753
|
/**
|
|
2729
2754
|
* Edit a dataset with the given name
|
|
2730
2755
|
*
|
|
2731
2756
|
* @param name - Name of the dataset to edit
|
|
2732
2757
|
* @param options - New options for the dataset
|
|
2733
2758
|
*/
|
|
2734
|
-
edit(
|
|
2735
|
-
name: string,
|
|
2736
|
-
options?: {
|
|
2737
|
-
aclMode?: DatasetAclMode
|
|
2738
|
-
},
|
|
2739
|
-
): Observable<DatasetResponse>
|
|
2759
|
+
edit(name: string, options?: DatasetEditOptions): Observable<DatasetResponse>
|
|
2740
2760
|
/**
|
|
2741
2761
|
* Delete a dataset with the given name
|
|
2742
2762
|
*
|
|
@@ -2749,6 +2769,19 @@ export declare class ObservableDatasetsClient {
|
|
|
2749
2769
|
* Fetch a list of datasets for the configured project
|
|
2750
2770
|
*/
|
|
2751
2771
|
list(): Observable<DatasetsResponse>
|
|
2772
|
+
/**
|
|
2773
|
+
* Get embeddings settings for a dataset
|
|
2774
|
+
*
|
|
2775
|
+
* @param name - Name of the dataset
|
|
2776
|
+
*/
|
|
2777
|
+
getEmbeddingsSettings(name: string): Observable<EmbeddingsSettings>
|
|
2778
|
+
/**
|
|
2779
|
+
* Edit embeddings settings for a dataset
|
|
2780
|
+
*
|
|
2781
|
+
* @param name - Name of the dataset
|
|
2782
|
+
* @param settings - Embeddings settings to apply
|
|
2783
|
+
*/
|
|
2784
|
+
editEmbeddingsSettings(name: string, settings: EmbeddingsSettingsBody): Observable<void>
|
|
2752
2785
|
}
|
|
2753
2786
|
|
|
2754
2787
|
/** @internal */
|
|
@@ -2830,11 +2863,17 @@ export declare class ObservableProjectsClient {
|
|
|
2830
2863
|
* @param options - Options for the list request
|
|
2831
2864
|
* - `includeMembers` - Whether to include members in the response (default: true)
|
|
2832
2865
|
* - `organizationId` - ID of the organization to fetch projects for
|
|
2866
|
+
* - `onlyExplicitMembership` - Only include projects where the user has explicit membership (default: false)
|
|
2833
2867
|
*/
|
|
2834
|
-
list(options?: {
|
|
2868
|
+
list(options?: {
|
|
2869
|
+
includeMembers?: true
|
|
2870
|
+
organizationId?: string
|
|
2871
|
+
onlyExplicitMembership?: boolean
|
|
2872
|
+
}): Observable<SanityProject[]>
|
|
2835
2873
|
list(options?: {
|
|
2836
2874
|
includeMembers?: false
|
|
2837
2875
|
organizationId?: string
|
|
2876
|
+
onlyExplicitMembership?: boolean
|
|
2838
2877
|
}): Observable<Omit<SanityProject, 'members'>[]>
|
|
2839
2878
|
/**
|
|
2840
2879
|
* Fetch a project by project ID
|
|
@@ -4213,11 +4252,17 @@ export declare class ProjectsClient {
|
|
|
4213
4252
|
* @param options - Options for the list request
|
|
4214
4253
|
* - `includeMembers` - Whether to include members in the response (default: true)
|
|
4215
4254
|
* - `organizationId` - ID of the organization to fetch projects for
|
|
4255
|
+
* - `onlyExplicitMembership` - Only include projects where the user has explicit membership (default: false)
|
|
4216
4256
|
*/
|
|
4217
|
-
list(options?: {
|
|
4257
|
+
list(options?: {
|
|
4258
|
+
includeMembers?: true
|
|
4259
|
+
organizationId?: string
|
|
4260
|
+
onlyExplicitMembership?: boolean
|
|
4261
|
+
}): Promise<SanityProject[]>
|
|
4218
4262
|
list(options?: {
|
|
4219
4263
|
includeMembers?: false
|
|
4220
4264
|
organizationId?: string
|
|
4265
|
+
onlyExplicitMembership?: boolean
|
|
4221
4266
|
}): Promise<Omit<SanityProject, 'members'>[]>
|
|
4222
4267
|
/**
|
|
4223
4268
|
* Fetch a project by project ID
|
package/dist/stega.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createClient as createClient$1, requester as requester$1, ObservableSanityClient, SanityClient } from "@sanity/client";
|
|
2
2
|
export * from "@sanity/client";
|
|
3
3
|
import { encodeIntoResult, stegaEncodeSourceMap } from "./_chunks-es/stegaEncodeSourceMap.js";
|
|
4
4
|
import { stegaClean, vercelStegaCleanAll } from "./_chunks-es/stegaClean.js";
|
package/dist/stega.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stega.js","sources":["../src/stega/index.ts"],"sourcesContent":["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 {stegaClean, 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":["originalRequester","originalCreateClient"],"mappings":";;;;AAiBO,MAAM,0BAA0B,aAAa;AAAC;AAM9C,MAAM,oCAAoC,uBAAuB;AAAC;
|
|
1
|
+
{"version":3,"file":"stega.js","sources":["../src/stega/index.ts"],"sourcesContent":["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 {stegaClean, 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":["originalRequester","originalCreateClient"],"mappings":";;;;AAiBO,MAAM,0BAA0B,aAAa;AAAC;AAM9C,MAAM,oCAAoC,uBAAuB;AAAC;AAMlE,MAAM,YAAYA,aAMZ,eAAeC;"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,15 @@ import {lastValueFrom, type Observable} from 'rxjs'
|
|
|
2
2
|
|
|
3
3
|
import {_request} from '../data/dataMethods'
|
|
4
4
|
import type {ObservableSanityClient, SanityClient} from '../SanityClient'
|
|
5
|
-
import type {
|
|
5
|
+
import type {
|
|
6
|
+
DatasetCreateOptions,
|
|
7
|
+
DatasetEditOptions,
|
|
8
|
+
DatasetResponse,
|
|
9
|
+
DatasetsResponse,
|
|
10
|
+
EmbeddingsSettings,
|
|
11
|
+
EmbeddingsSettingsBody,
|
|
12
|
+
HttpRequest,
|
|
13
|
+
} from '../types'
|
|
6
14
|
import * as validate from '../validators'
|
|
7
15
|
|
|
8
16
|
/** @internal */
|
|
@@ -18,9 +26,9 @@ export class ObservableDatasetsClient {
|
|
|
18
26
|
* Create a new dataset with the given name
|
|
19
27
|
*
|
|
20
28
|
* @param name - Name of the dataset to create
|
|
21
|
-
* @param options - Options for the dataset
|
|
29
|
+
* @param options - Options for the dataset, including optional embeddings configuration
|
|
22
30
|
*/
|
|
23
|
-
create(name: string, options?:
|
|
31
|
+
create(name: string, options?: DatasetCreateOptions): Observable<DatasetResponse> {
|
|
24
32
|
return _modify<DatasetResponse>(this.#client, this.#httpRequest, 'PUT', name, options)
|
|
25
33
|
}
|
|
26
34
|
|
|
@@ -30,7 +38,7 @@ export class ObservableDatasetsClient {
|
|
|
30
38
|
* @param name - Name of the dataset to edit
|
|
31
39
|
* @param options - New options for the dataset
|
|
32
40
|
*/
|
|
33
|
-
edit(name: string, options?:
|
|
41
|
+
edit(name: string, options?: DatasetEditOptions): Observable<DatasetResponse> {
|
|
34
42
|
return _modify<DatasetResponse>(this.#client, this.#httpRequest, 'PATCH', name, options)
|
|
35
43
|
}
|
|
36
44
|
|
|
@@ -60,6 +68,37 @@ export class ObservableDatasetsClient {
|
|
|
60
68
|
tag: null,
|
|
61
69
|
})
|
|
62
70
|
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Get embeddings settings for a dataset
|
|
74
|
+
*
|
|
75
|
+
* @param name - Name of the dataset
|
|
76
|
+
*/
|
|
77
|
+
getEmbeddingsSettings(name: string): Observable<EmbeddingsSettings> {
|
|
78
|
+
validate.resourceGuard('dataset', this.#client.config())
|
|
79
|
+
validate.dataset(name)
|
|
80
|
+
return _request<EmbeddingsSettings>(this.#client, this.#httpRequest, {
|
|
81
|
+
uri: _embeddingsSettingsUri(this.#client, name),
|
|
82
|
+
tag: null,
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Edit embeddings settings for a dataset
|
|
88
|
+
*
|
|
89
|
+
* @param name - Name of the dataset
|
|
90
|
+
* @param settings - Embeddings settings to apply
|
|
91
|
+
*/
|
|
92
|
+
editEmbeddingsSettings(name: string, settings: EmbeddingsSettingsBody): Observable<void> {
|
|
93
|
+
validate.resourceGuard('dataset', this.#client.config())
|
|
94
|
+
validate.dataset(name)
|
|
95
|
+
return _request<void>(this.#client, this.#httpRequest, {
|
|
96
|
+
method: 'PUT',
|
|
97
|
+
uri: _embeddingsSettingsUri(this.#client, name),
|
|
98
|
+
body: settings,
|
|
99
|
+
tag: null,
|
|
100
|
+
})
|
|
101
|
+
}
|
|
63
102
|
}
|
|
64
103
|
|
|
65
104
|
/** @internal */
|
|
@@ -75,9 +114,9 @@ export class DatasetsClient {
|
|
|
75
114
|
* Create a new dataset with the given name
|
|
76
115
|
*
|
|
77
116
|
* @param name - Name of the dataset to create
|
|
78
|
-
* @param options - Options for the dataset
|
|
117
|
+
* @param options - Options for the dataset, including optional embeddings configuration
|
|
79
118
|
*/
|
|
80
|
-
create(name: string, options?:
|
|
119
|
+
create(name: string, options?: DatasetCreateOptions): Promise<DatasetResponse> {
|
|
81
120
|
validate.resourceGuard('dataset', this.#client.config())
|
|
82
121
|
return lastValueFrom(
|
|
83
122
|
_modify<DatasetResponse>(this.#client, this.#httpRequest, 'PUT', name, options),
|
|
@@ -90,7 +129,7 @@ export class DatasetsClient {
|
|
|
90
129
|
* @param name - Name of the dataset to edit
|
|
91
130
|
* @param options - New options for the dataset
|
|
92
131
|
*/
|
|
93
|
-
edit(name: string, options?:
|
|
132
|
+
edit(name: string, options?: DatasetEditOptions): Promise<DatasetResponse> {
|
|
94
133
|
validate.resourceGuard('dataset', this.#client.config())
|
|
95
134
|
return lastValueFrom(
|
|
96
135
|
_modify<DatasetResponse>(this.#client, this.#httpRequest, 'PATCH', name, options),
|
|
@@ -123,6 +162,52 @@ export class DatasetsClient {
|
|
|
123
162
|
_request<DatasetsResponse>(this.#client, this.#httpRequest, {uri, tag: null}),
|
|
124
163
|
)
|
|
125
164
|
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Get embeddings settings for a dataset
|
|
168
|
+
*
|
|
169
|
+
* @param name - Name of the dataset
|
|
170
|
+
*/
|
|
171
|
+
getEmbeddingsSettings(name: string): Promise<EmbeddingsSettings> {
|
|
172
|
+
validate.resourceGuard('dataset', this.#client.config())
|
|
173
|
+
validate.dataset(name)
|
|
174
|
+
return lastValueFrom(
|
|
175
|
+
_request<EmbeddingsSettings>(this.#client, this.#httpRequest, {
|
|
176
|
+
uri: _embeddingsSettingsUri(this.#client, name),
|
|
177
|
+
tag: null,
|
|
178
|
+
}),
|
|
179
|
+
)
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Edit embeddings settings for a dataset
|
|
184
|
+
*
|
|
185
|
+
* @param name - Name of the dataset
|
|
186
|
+
* @param settings - Embeddings settings to apply
|
|
187
|
+
*/
|
|
188
|
+
editEmbeddingsSettings(name: string, settings: EmbeddingsSettingsBody): Promise<void> {
|
|
189
|
+
validate.resourceGuard('dataset', this.#client.config())
|
|
190
|
+
validate.dataset(name)
|
|
191
|
+
return lastValueFrom(
|
|
192
|
+
_request<void>(this.#client, this.#httpRequest, {
|
|
193
|
+
method: 'PUT',
|
|
194
|
+
uri: _embeddingsSettingsUri(this.#client, name),
|
|
195
|
+
body: settings,
|
|
196
|
+
tag: null,
|
|
197
|
+
}),
|
|
198
|
+
)
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function _embeddingsSettingsUri(
|
|
203
|
+
client: SanityClient | ObservableSanityClient,
|
|
204
|
+
name: string,
|
|
205
|
+
): string {
|
|
206
|
+
const config = client.config()
|
|
207
|
+
if (config.useProjectHostname === false) {
|
|
208
|
+
return `/projects/${config.projectId}/datasets/${name}/settings/embeddings`
|
|
209
|
+
}
|
|
210
|
+
return `/datasets/${name}/settings/embeddings`
|
|
126
211
|
}
|
|
127
212
|
|
|
128
213
|
function _modify<R = unknown>(
|
|
@@ -130,7 +215,7 @@ function _modify<R = unknown>(
|
|
|
130
215
|
httpRequest: HttpRequest,
|
|
131
216
|
method: 'DELETE' | 'PATCH' | 'PUT',
|
|
132
217
|
name: string,
|
|
133
|
-
options?:
|
|
218
|
+
options?: DatasetCreateOptions | DatasetEditOptions,
|
|
134
219
|
) {
|
|
135
220
|
validate.resourceGuard('dataset', client.config())
|
|
136
221
|
validate.dataset(name)
|
|
@@ -19,15 +19,22 @@ export class ObservableProjectsClient {
|
|
|
19
19
|
* @param options - Options for the list request
|
|
20
20
|
* - `includeMembers` - Whether to include members in the response (default: true)
|
|
21
21
|
* - `organizationId` - ID of the organization to fetch projects for
|
|
22
|
+
* - `onlyExplicitMembership` - Only include projects where the user has explicit membership (default: false)
|
|
22
23
|
*/
|
|
23
|
-
list(options?: {
|
|
24
|
+
list(options?: {
|
|
25
|
+
includeMembers?: true
|
|
26
|
+
organizationId?: string
|
|
27
|
+
onlyExplicitMembership?: boolean
|
|
28
|
+
}): Observable<SanityProject[]>
|
|
24
29
|
list(options?: {
|
|
25
30
|
includeMembers?: false
|
|
26
31
|
organizationId?: string
|
|
32
|
+
onlyExplicitMembership?: boolean
|
|
27
33
|
}): Observable<Omit<SanityProject, 'members'>[]>
|
|
28
34
|
list(options?: {
|
|
29
35
|
includeMembers?: boolean
|
|
30
36
|
organizationId?: string
|
|
37
|
+
onlyExplicitMembership?: boolean
|
|
31
38
|
}): Observable<SanityProject[] | Omit<SanityProject, 'members'>[]> {
|
|
32
39
|
const query: Record<string, string> = {}
|
|
33
40
|
const uri = '/projects'
|
|
@@ -37,6 +44,9 @@ export class ObservableProjectsClient {
|
|
|
37
44
|
if (options?.organizationId) {
|
|
38
45
|
query.organizationId = options.organizationId
|
|
39
46
|
}
|
|
47
|
+
if (options?.onlyExplicitMembership === true) {
|
|
48
|
+
query.onlyExplicitMembership = 'true'
|
|
49
|
+
}
|
|
40
50
|
|
|
41
51
|
return _request<SanityProject[]>(this.#client, this.#httpRequest, {uri, query})
|
|
42
52
|
}
|
|
@@ -66,15 +76,22 @@ export class ProjectsClient {
|
|
|
66
76
|
* @param options - Options for the list request
|
|
67
77
|
* - `includeMembers` - Whether to include members in the response (default: true)
|
|
68
78
|
* - `organizationId` - ID of the organization to fetch projects for
|
|
79
|
+
* - `onlyExplicitMembership` - Only include projects where the user has explicit membership (default: false)
|
|
69
80
|
*/
|
|
70
|
-
list(options?: {
|
|
81
|
+
list(options?: {
|
|
82
|
+
includeMembers?: true
|
|
83
|
+
organizationId?: string
|
|
84
|
+
onlyExplicitMembership?: boolean
|
|
85
|
+
}): Promise<SanityProject[]>
|
|
71
86
|
list(options?: {
|
|
72
87
|
includeMembers?: false
|
|
73
88
|
organizationId?: string
|
|
89
|
+
onlyExplicitMembership?: boolean
|
|
74
90
|
}): Promise<Omit<SanityProject, 'members'>[]>
|
|
75
91
|
list(options?: {
|
|
76
92
|
includeMembers?: boolean
|
|
77
93
|
organizationId?: string
|
|
94
|
+
onlyExplicitMembership?: boolean
|
|
78
95
|
}): Promise<SanityProject[] | Omit<SanityProject, 'members'>[]> {
|
|
79
96
|
const query: Record<string, string> = {}
|
|
80
97
|
const uri = '/projects'
|
|
@@ -84,6 +101,9 @@ export class ProjectsClient {
|
|
|
84
101
|
if (options?.organizationId) {
|
|
85
102
|
query.organizationId = options.organizationId
|
|
86
103
|
}
|
|
104
|
+
if (options?.onlyExplicitMembership === true) {
|
|
105
|
+
query.onlyExplicitMembership = 'true'
|
|
106
|
+
}
|
|
87
107
|
return lastValueFrom(_request<SanityProject[]>(this.#client, this.#httpRequest, {uri, query}))
|
|
88
108
|
}
|
|
89
109
|
|
package/src/types.ts
CHANGED
|
@@ -463,6 +463,33 @@ export type AuthProviderResponse = {providers: AuthProvider[]}
|
|
|
463
463
|
/** @public */
|
|
464
464
|
export type DatasetAclMode = 'public' | 'private' | 'custom'
|
|
465
465
|
|
|
466
|
+
/** @public */
|
|
467
|
+
export type DatasetCreateOptions = {
|
|
468
|
+
aclMode?: DatasetAclMode
|
|
469
|
+
embeddings?: {
|
|
470
|
+
enabled: boolean
|
|
471
|
+
projection?: string
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
/** @public */
|
|
476
|
+
export type DatasetEditOptions = {
|
|
477
|
+
aclMode?: DatasetAclMode
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
/** @public */
|
|
481
|
+
export type EmbeddingsSettings = {
|
|
482
|
+
enabled: boolean
|
|
483
|
+
projection?: string
|
|
484
|
+
status: string
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
/** @public */
|
|
488
|
+
export type EmbeddingsSettingsBody = {
|
|
489
|
+
enabled: boolean
|
|
490
|
+
projection?: string
|
|
491
|
+
}
|
|
492
|
+
|
|
466
493
|
/** @public */
|
|
467
494
|
export type DatasetResponse = {datasetName: string; aclMode: DatasetAclMode}
|
|
468
495
|
/** @public */
|
package/umd/sanityClient.js
CHANGED
|
@@ -1661,7 +1661,7 @@
|
|
|
1661
1661
|
function timer(dueTime, intervalOrScheduler, scheduler) {
|
|
1662
1662
|
if (scheduler === void 0) { scheduler = async; }
|
|
1663
1663
|
return new Observable(function (subscriber) {
|
|
1664
|
-
var due = isValidDate$1(dueTime) ?
|
|
1664
|
+
var due = isValidDate$1(dueTime) ? +dueTime - scheduler.now() : dueTime;
|
|
1665
1665
|
if (due < 0) {
|
|
1666
1666
|
due = 0;
|
|
1667
1667
|
}
|
|
@@ -1933,7 +1933,7 @@
|
|
|
1933
1933
|
}
|
|
1934
1934
|
function getVersionFromId$1(id) {
|
|
1935
1935
|
if (!isVersionId$1(id)) return;
|
|
1936
|
-
const [_versionPrefix, versionId
|
|
1936
|
+
const [_versionPrefix, versionId] = id.split(PATH_SEPARATOR$1);
|
|
1937
1937
|
return versionId;
|
|
1938
1938
|
}
|
|
1939
1939
|
function getPublishedId$1(id) {
|
|
@@ -3495,7 +3495,7 @@ ${selectionOpts}`);
|
|
|
3495
3495
|
* Create a new dataset with the given name
|
|
3496
3496
|
*
|
|
3497
3497
|
* @param name - Name of the dataset to create
|
|
3498
|
-
* @param options - Options for the dataset
|
|
3498
|
+
* @param options - Options for the dataset, including optional embeddings configuration
|
|
3499
3499
|
*/
|
|
3500
3500
|
create(name, options) {
|
|
3501
3501
|
return _modify(this.#client, this.#httpRequest, "PUT", name, options);
|
|
@@ -3529,6 +3529,31 @@ ${selectionOpts}`);
|
|
|
3529
3529
|
tag: null
|
|
3530
3530
|
});
|
|
3531
3531
|
}
|
|
3532
|
+
/**
|
|
3533
|
+
* Get embeddings settings for a dataset
|
|
3534
|
+
*
|
|
3535
|
+
* @param name - Name of the dataset
|
|
3536
|
+
*/
|
|
3537
|
+
getEmbeddingsSettings(name) {
|
|
3538
|
+
return resourceGuard("dataset", this.#client.config()), dataset(name), _request(this.#client, this.#httpRequest, {
|
|
3539
|
+
uri: _embeddingsSettingsUri(this.#client, name),
|
|
3540
|
+
tag: null
|
|
3541
|
+
});
|
|
3542
|
+
}
|
|
3543
|
+
/**
|
|
3544
|
+
* Edit embeddings settings for a dataset
|
|
3545
|
+
*
|
|
3546
|
+
* @param name - Name of the dataset
|
|
3547
|
+
* @param settings - Embeddings settings to apply
|
|
3548
|
+
*/
|
|
3549
|
+
editEmbeddingsSettings(name, settings) {
|
|
3550
|
+
return resourceGuard("dataset", this.#client.config()), dataset(name), _request(this.#client, this.#httpRequest, {
|
|
3551
|
+
method: "PUT",
|
|
3552
|
+
uri: _embeddingsSettingsUri(this.#client, name),
|
|
3553
|
+
body: settings,
|
|
3554
|
+
tag: null
|
|
3555
|
+
});
|
|
3556
|
+
}
|
|
3532
3557
|
}
|
|
3533
3558
|
class DatasetsClient {
|
|
3534
3559
|
#client;
|
|
@@ -3540,7 +3565,7 @@ ${selectionOpts}`);
|
|
|
3540
3565
|
* Create a new dataset with the given name
|
|
3541
3566
|
*
|
|
3542
3567
|
* @param name - Name of the dataset to create
|
|
3543
|
-
* @param options - Options for the dataset
|
|
3568
|
+
* @param options - Options for the dataset, including optional embeddings configuration
|
|
3544
3569
|
*/
|
|
3545
3570
|
create(name, options) {
|
|
3546
3571
|
return resourceGuard("dataset", this.#client.config()), lastValueFrom(
|
|
@@ -3577,6 +3602,39 @@ ${selectionOpts}`);
|
|
|
3577
3602
|
_request(this.#client, this.#httpRequest, { uri, tag: null })
|
|
3578
3603
|
);
|
|
3579
3604
|
}
|
|
3605
|
+
/**
|
|
3606
|
+
* Get embeddings settings for a dataset
|
|
3607
|
+
*
|
|
3608
|
+
* @param name - Name of the dataset
|
|
3609
|
+
*/
|
|
3610
|
+
getEmbeddingsSettings(name) {
|
|
3611
|
+
return resourceGuard("dataset", this.#client.config()), dataset(name), lastValueFrom(
|
|
3612
|
+
_request(this.#client, this.#httpRequest, {
|
|
3613
|
+
uri: _embeddingsSettingsUri(this.#client, name),
|
|
3614
|
+
tag: null
|
|
3615
|
+
})
|
|
3616
|
+
);
|
|
3617
|
+
}
|
|
3618
|
+
/**
|
|
3619
|
+
* Edit embeddings settings for a dataset
|
|
3620
|
+
*
|
|
3621
|
+
* @param name - Name of the dataset
|
|
3622
|
+
* @param settings - Embeddings settings to apply
|
|
3623
|
+
*/
|
|
3624
|
+
editEmbeddingsSettings(name, settings) {
|
|
3625
|
+
return resourceGuard("dataset", this.#client.config()), dataset(name), lastValueFrom(
|
|
3626
|
+
_request(this.#client, this.#httpRequest, {
|
|
3627
|
+
method: "PUT",
|
|
3628
|
+
uri: _embeddingsSettingsUri(this.#client, name),
|
|
3629
|
+
body: settings,
|
|
3630
|
+
tag: null
|
|
3631
|
+
})
|
|
3632
|
+
);
|
|
3633
|
+
}
|
|
3634
|
+
}
|
|
3635
|
+
function _embeddingsSettingsUri(client, name) {
|
|
3636
|
+
const config = client.config();
|
|
3637
|
+
return config.useProjectHostname === false ? `/projects/${config.projectId}/datasets/${name}/settings/embeddings` : `/datasets/${name}/settings/embeddings`;
|
|
3580
3638
|
}
|
|
3581
3639
|
function _modify(client, httpRequest, method, name, options) {
|
|
3582
3640
|
return resourceGuard("dataset", client.config()), dataset(name), _request(client, httpRequest, {
|
|
@@ -3668,7 +3726,7 @@ ${selectionOpts}`);
|
|
|
3668
3726
|
}
|
|
3669
3727
|
list(options) {
|
|
3670
3728
|
const query = {}, uri = "/projects";
|
|
3671
|
-
return options?.includeMembers === false && (query.includeMembers = "false"), options?.organizationId && (query.organizationId = options.organizationId), _request(this.#client, this.#httpRequest, { uri, query });
|
|
3729
|
+
return options?.includeMembers === false && (query.includeMembers = "false"), options?.organizationId && (query.organizationId = options.organizationId), options?.onlyExplicitMembership === true && (query.onlyExplicitMembership = "true"), _request(this.#client, this.#httpRequest, { uri, query });
|
|
3672
3730
|
}
|
|
3673
3731
|
/**
|
|
3674
3732
|
* Fetch a project by project ID
|
|
@@ -3687,7 +3745,7 @@ ${selectionOpts}`);
|
|
|
3687
3745
|
}
|
|
3688
3746
|
list(options) {
|
|
3689
3747
|
const query = {}, uri = "/projects";
|
|
3690
|
-
return options?.includeMembers === false && (query.includeMembers = "false"), options?.organizationId && (query.organizationId = options.organizationId), lastValueFrom(_request(this.#client, this.#httpRequest, { uri, query }));
|
|
3748
|
+
return options?.includeMembers === false && (query.includeMembers = "false"), options?.organizationId && (query.organizationId = options.organizationId), options?.onlyExplicitMembership === true && (query.onlyExplicitMembership = "true"), lastValueFrom(_request(this.#client, this.#httpRequest, { uri, query }));
|
|
3691
3749
|
}
|
|
3692
3750
|
/**
|
|
3693
3751
|
* Fetch a project by project ID
|
|
@@ -4977,7 +5035,7 @@ ${selectionOpts}`);
|
|
|
4977
5035
|
}
|
|
4978
5036
|
function getVersionFromId(id) {
|
|
4979
5037
|
if (!isVersionId(id)) return;
|
|
4980
|
-
const [_versionPrefix, versionId
|
|
5038
|
+
const [_versionPrefix, versionId] = id.split(PATH_SEPARATOR);
|
|
4981
5039
|
return versionId;
|
|
4982
5040
|
}
|
|
4983
5041
|
function getPublishedId(id) {
|
|
@@ -5277,7 +5335,7 @@ ${selectionOpts}`);
|
|
|
5277
5335
|
function requireEventsource () {
|
|
5278
5336
|
if (hasRequiredEventsource) return eventsource$1.exports;
|
|
5279
5337
|
hasRequiredEventsource = 1;
|
|
5280
|
-
(function (module, exports) {
|
|
5338
|
+
(function (module, exports$1) {
|
|
5281
5339
|
/*jslint indent: 2, vars: true, plusplus: true */
|
|
5282
5340
|
/*global setTimeout, clearTimeout */
|
|
5283
5341
|
|
|
@@ -6304,13 +6362,13 @@ ${selectionOpts}`);
|
|
|
6304
6362
|
|
|
6305
6363
|
(function (factory) {
|
|
6306
6364
|
{
|
|
6307
|
-
var v = factory(exports);
|
|
6365
|
+
var v = factory(exports$1);
|
|
6308
6366
|
if (v !== undefined) module.exports = v;
|
|
6309
6367
|
}
|
|
6310
|
-
})(function (exports) {
|
|
6311
|
-
exports.EventSourcePolyfill = EventSourcePolyfill;
|
|
6312
|
-
exports.NativeEventSource = NativeEventSource;
|
|
6313
|
-
exports.EventSource = R;
|
|
6368
|
+
})(function (exports$1) {
|
|
6369
|
+
exports$1.EventSourcePolyfill = EventSourcePolyfill;
|
|
6370
|
+
exports$1.NativeEventSource = NativeEventSource;
|
|
6371
|
+
exports$1.EventSource = R;
|
|
6314
6372
|
});
|
|
6315
6373
|
}(typeof globalThis === 'undefined' ? (typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : eventsource) : globalThis));
|
|
6316
6374
|
} (eventsource$1, eventsource$1.exports));
|