@sanity/client 8.1.0 → 8.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 +171 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +408 -61
- package/dist/index.js.map +1 -1
- package/dist/index.node.d.ts +650 -2
- package/dist/index.node.js +379 -19
- package/dist/index.node.js.map +1 -1
- package/dist/media-library.d.ts +1 -1
- package/dist/{types-BODIEY7F.d.ts → types-nJhm5Nyq.d.ts} +651 -3
- package/package.json +1 -1
- package/src/SanityClient.ts +20 -0
- package/src/collaboration/CollaborationCommentsClient.ts +387 -0
- package/src/collaboration/comments.ts +313 -0
- package/src/collaboration/types.ts +252 -0
- package/src/data/dataMethods.ts +7 -1
- package/src/data/listen.ts +20 -5
- package/src/types.ts +234 -0
package/src/types.ts
CHANGED
|
@@ -304,6 +304,16 @@ export interface ClientConfig {
|
|
|
304
304
|
* ID of the organization owning the blueprints stack
|
|
305
305
|
*/
|
|
306
306
|
organizationId?: string
|
|
307
|
+
/**
|
|
308
|
+
* Organization-scoped configuration for collaboration APIs.
|
|
309
|
+
*
|
|
310
|
+
* Currently this is used by `collaboration.comments` methods.
|
|
311
|
+
*
|
|
312
|
+
* @alpha
|
|
313
|
+
*/
|
|
314
|
+
collaboration?: {
|
|
315
|
+
organizationId?: string
|
|
316
|
+
}
|
|
307
317
|
}
|
|
308
318
|
|
|
309
319
|
/** @public */
|
|
@@ -840,6 +850,17 @@ export type VersionAction =
|
|
|
840
850
|
| ReplaceVersionAction
|
|
841
851
|
| UnpublishVersionAction
|
|
842
852
|
|
|
853
|
+
/**
|
|
854
|
+
* @public
|
|
855
|
+
* @beta
|
|
856
|
+
*/
|
|
857
|
+
export type VariantAction =
|
|
858
|
+
| CreateVariantAction
|
|
859
|
+
| EditVariantAction
|
|
860
|
+
| DeleteVariantAction
|
|
861
|
+
| PublishVariantAction
|
|
862
|
+
| UnpublishVariantAction
|
|
863
|
+
|
|
843
864
|
/** @public */
|
|
844
865
|
export type Action =
|
|
845
866
|
| CreateAction
|
|
@@ -850,6 +871,7 @@ export type Action =
|
|
|
850
871
|
| PublishAction
|
|
851
872
|
| UnpublishAction
|
|
852
873
|
| VersionAction
|
|
874
|
+
| VariantAction
|
|
853
875
|
| ReleaseAction
|
|
854
876
|
| VariantDefinitionAction
|
|
855
877
|
|
|
@@ -1009,6 +1031,203 @@ export interface UnpublishVersionAction {
|
|
|
1009
1031
|
publishedId: string
|
|
1010
1032
|
}
|
|
1011
1033
|
|
|
1034
|
+
/**
|
|
1035
|
+
* Creates a variant of a document, either by supplying the full document
|
|
1036
|
+
* content, or the base ID of a document to copy.
|
|
1037
|
+
*
|
|
1038
|
+
* @public
|
|
1039
|
+
* @beta
|
|
1040
|
+
*/
|
|
1041
|
+
export type CreateVariantAction = {
|
|
1042
|
+
actionType: 'sanity.action.document.variant.create'
|
|
1043
|
+
|
|
1044
|
+
/**
|
|
1045
|
+
* ID of the document group to create a variant in. Must be a published
|
|
1046
|
+
* document ID, without a `drafts.` or `versions.` prefix.
|
|
1047
|
+
*/
|
|
1048
|
+
publishedId: string
|
|
1049
|
+
|
|
1050
|
+
/**
|
|
1051
|
+
* Name of the variant definition this document belongs to, as in
|
|
1052
|
+
* `_.variants.{variantName}`. Must be a bare name, not a full document ID.
|
|
1053
|
+
*/
|
|
1054
|
+
variantId: string
|
|
1055
|
+
|
|
1056
|
+
/**
|
|
1057
|
+
* Source bundle: `'drafts'`, or a release id.
|
|
1058
|
+
*
|
|
1059
|
+
* Defaults to the published bundle.
|
|
1060
|
+
*/
|
|
1061
|
+
bundleId?: 'drafts' | (string & {})
|
|
1062
|
+
} & (
|
|
1063
|
+
| {
|
|
1064
|
+
/**
|
|
1065
|
+
* The full document content. Requires a `_type` property.
|
|
1066
|
+
*/
|
|
1067
|
+
document: SanityDocumentStub
|
|
1068
|
+
baseId?: never
|
|
1069
|
+
ifBaseRevisionId?: never
|
|
1070
|
+
}
|
|
1071
|
+
| {
|
|
1072
|
+
/**
|
|
1073
|
+
* ID of an existing document to copy the content from.
|
|
1074
|
+
*/
|
|
1075
|
+
baseId: string
|
|
1076
|
+
|
|
1077
|
+
/**
|
|
1078
|
+
* When set, the action fails unless the current revision of the base
|
|
1079
|
+
* document matches this value.
|
|
1080
|
+
*/
|
|
1081
|
+
ifBaseRevisionId?: string
|
|
1082
|
+
document?: never
|
|
1083
|
+
}
|
|
1084
|
+
)
|
|
1085
|
+
|
|
1086
|
+
/**
|
|
1087
|
+
* Modifies a variant version of a document by applying a patch.
|
|
1088
|
+
*
|
|
1089
|
+
* If no such variant document exists it is first created, by copying the
|
|
1090
|
+
* variant's published sibling, or the published document if the variant was
|
|
1091
|
+
* never published.
|
|
1092
|
+
*
|
|
1093
|
+
* @public
|
|
1094
|
+
* @beta
|
|
1095
|
+
*/
|
|
1096
|
+
export interface EditVariantAction {
|
|
1097
|
+
actionType: 'sanity.action.document.variant.edit'
|
|
1098
|
+
|
|
1099
|
+
/**
|
|
1100
|
+
* ID of the document group the variant belongs to. Must be a published
|
|
1101
|
+
* document ID, without a `drafts.` or `versions.` prefix.
|
|
1102
|
+
*/
|
|
1103
|
+
publishedId: string
|
|
1104
|
+
|
|
1105
|
+
/**
|
|
1106
|
+
* Name of the variant definition this document belongs to, as in
|
|
1107
|
+
* `_.variants.{variantName}`. Must be a bare name, not a full document ID.
|
|
1108
|
+
*/
|
|
1109
|
+
variantId: string
|
|
1110
|
+
|
|
1111
|
+
/**
|
|
1112
|
+
* Source bundle: `'drafts'`, or a release id.
|
|
1113
|
+
*
|
|
1114
|
+
* Defaults to the published bundle.
|
|
1115
|
+
*/
|
|
1116
|
+
bundleId?: 'drafts' | (string & {})
|
|
1117
|
+
|
|
1118
|
+
/**
|
|
1119
|
+
* Patch operations to apply.
|
|
1120
|
+
*/
|
|
1121
|
+
patch: PatchOperations
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
/**
|
|
1125
|
+
* Deletes a variant of a document.
|
|
1126
|
+
*
|
|
1127
|
+
* @public
|
|
1128
|
+
* @beta
|
|
1129
|
+
*/
|
|
1130
|
+
export interface DeleteVariantAction {
|
|
1131
|
+
actionType: 'sanity.action.document.variant.delete'
|
|
1132
|
+
|
|
1133
|
+
/**
|
|
1134
|
+
* ID of the document group the variant belongs to. Must be a published
|
|
1135
|
+
* document ID, without a `drafts.` or `versions.` prefix.
|
|
1136
|
+
*/
|
|
1137
|
+
publishedId: string
|
|
1138
|
+
|
|
1139
|
+
/**
|
|
1140
|
+
* Name of the variant definition this document belongs to, as in
|
|
1141
|
+
* `_.variants.{variantName}`. Must be a bare name, not a full document ID.
|
|
1142
|
+
*/
|
|
1143
|
+
variantId: string
|
|
1144
|
+
|
|
1145
|
+
/**
|
|
1146
|
+
* Source bundle: `'drafts'`, or a release id.
|
|
1147
|
+
*
|
|
1148
|
+
* Defaults to the published bundle.
|
|
1149
|
+
*/
|
|
1150
|
+
bundleId?: 'drafts' | (string & {})
|
|
1151
|
+
|
|
1152
|
+
/**
|
|
1153
|
+
* Delete document history.
|
|
1154
|
+
*/
|
|
1155
|
+
purge?: boolean
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
/**
|
|
1159
|
+
* Publishes a variant version of a document, replacing the published variant
|
|
1160
|
+
* and removing the source variant document.
|
|
1161
|
+
*
|
|
1162
|
+
* @public
|
|
1163
|
+
* @beta
|
|
1164
|
+
*/
|
|
1165
|
+
export interface PublishVariantAction {
|
|
1166
|
+
actionType: 'sanity.action.document.variant.publish'
|
|
1167
|
+
|
|
1168
|
+
/**
|
|
1169
|
+
* ID of the document group the variant belongs to. Must be a published
|
|
1170
|
+
* document ID, without a `drafts.` or `versions.` prefix.
|
|
1171
|
+
*/
|
|
1172
|
+
publishedId: string
|
|
1173
|
+
|
|
1174
|
+
/**
|
|
1175
|
+
* Name of the variant definition this document belongs to, as in
|
|
1176
|
+
* `_.variants.{variantName}`. Must be a bare name, not a full document ID.
|
|
1177
|
+
*/
|
|
1178
|
+
variantId: string
|
|
1179
|
+
|
|
1180
|
+
/**
|
|
1181
|
+
* Bundle to publish from: `'drafts'`, or a release id.
|
|
1182
|
+
*/
|
|
1183
|
+
bundleId: 'drafts' | (string & {})
|
|
1184
|
+
|
|
1185
|
+
/**
|
|
1186
|
+
* When set, publishing fails unless the current revision of the source
|
|
1187
|
+
* variant document matches this value.
|
|
1188
|
+
*/
|
|
1189
|
+
ifVersionRevisionId?: string
|
|
1190
|
+
|
|
1191
|
+
/**
|
|
1192
|
+
* When set, publishing fails unless the current revision of the published
|
|
1193
|
+
* variant document matches this value.
|
|
1194
|
+
*/
|
|
1195
|
+
ifPublishedVariantRevisionId?: string
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
/**
|
|
1199
|
+
* Unpublishes a variant version of a document.
|
|
1200
|
+
*
|
|
1201
|
+
* By default the published variant is removed and preserved as a draft
|
|
1202
|
+
* variant. When a release id is given as the `bundleId`, the deletion is
|
|
1203
|
+
* instead staged in that release, and takes effect when it is published.
|
|
1204
|
+
*
|
|
1205
|
+
* @public
|
|
1206
|
+
* @beta
|
|
1207
|
+
*/
|
|
1208
|
+
export interface UnpublishVariantAction {
|
|
1209
|
+
actionType: 'sanity.action.document.variant.unpublish'
|
|
1210
|
+
|
|
1211
|
+
/**
|
|
1212
|
+
* ID of the document group the variant belongs to. Must be a published
|
|
1213
|
+
* document ID, without a `drafts.` or `versions.` prefix.
|
|
1214
|
+
*/
|
|
1215
|
+
publishedId: string
|
|
1216
|
+
|
|
1217
|
+
/**
|
|
1218
|
+
* Name of the variant definition this document belongs to, as in
|
|
1219
|
+
* `_.variants.{variantName}`. Must be a bare name, not a full document ID.
|
|
1220
|
+
*/
|
|
1221
|
+
variantId: string
|
|
1222
|
+
|
|
1223
|
+
/**
|
|
1224
|
+
* The content release in which to stage the unpublish.
|
|
1225
|
+
*
|
|
1226
|
+
* By default, the currently published document is unpublished immediately.
|
|
1227
|
+
*/
|
|
1228
|
+
bundleId?: string
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1012
1231
|
/**
|
|
1013
1232
|
* Creates a new `system.variant` definition document.
|
|
1014
1233
|
*
|
|
@@ -2079,6 +2298,21 @@ export type {
|
|
|
2079
2298
|
TranslateTargetInclude,
|
|
2080
2299
|
} from './agent/actions/translate'
|
|
2081
2300
|
export type {InvokeFunctionEvent, InvokeFunctionRequest} from './functions/invoke'
|
|
2301
|
+
export type {
|
|
2302
|
+
CollaborationCommentCreate,
|
|
2303
|
+
CollaborationCommentDocument,
|
|
2304
|
+
CollaborationCommentMessage,
|
|
2305
|
+
CollaborationCommentPortableTextBlock,
|
|
2306
|
+
CollaborationCommentReactionShortName,
|
|
2307
|
+
CollaborationCommentSelection,
|
|
2308
|
+
CollaborationCommentsListenOptions,
|
|
2309
|
+
CollaborationCommentsRequestOptions,
|
|
2310
|
+
CollaborationCommentStatus,
|
|
2311
|
+
CollaborationCommentsWriteOptions,
|
|
2312
|
+
CollaborationCommentTarget,
|
|
2313
|
+
CollaborationCommentUpdate,
|
|
2314
|
+
CollaborationCommentRange,
|
|
2315
|
+
} from './collaboration/types'
|
|
2082
2316
|
export type {
|
|
2083
2317
|
ContentSourceMapParsedPath,
|
|
2084
2318
|
ContentSourceMapParsedPathKeyedSegment,
|