@sanity/client 7.7.0 → 7.8.1
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 +6 -1
- package/dist/_chunks-cjs/config.cjs +3 -0
- package/dist/_chunks-cjs/config.cjs.map +1 -1
- package/dist/_chunks-es/config.js +3 -0
- package/dist/_chunks-es/config.js.map +1 -1
- package/dist/index.browser.cjs +46 -3
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.d.cts +44 -24
- package/dist/index.browser.d.ts +44 -24
- package/dist/index.browser.js +46 -3
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +45 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +44 -24
- package/dist/index.d.ts +44 -24
- package/dist/index.js +46 -5
- package/dist/index.js.map +1 -1
- package/dist/stega.browser.d.cts +44 -24
- package/dist/stega.browser.d.ts +44 -24
- package/dist/stega.d.cts +44 -24
- package/dist/stega.d.ts +44 -24
- package/package.json +1 -1
- package/src/SanityClient.ts +61 -21
- package/src/data/dataMethods.ts +39 -2
- package/src/types.ts +19 -5
- package/src/warnings.ts +4 -0
- package/umd/sanityClient.js +46 -3
- package/umd/sanityClient.min.js +2 -2
package/dist/stega.browser.d.cts
CHANGED
|
@@ -1104,16 +1104,29 @@ export declare interface CreateReleaseAction {
|
|
|
1104
1104
|
}
|
|
1105
1105
|
|
|
1106
1106
|
/**
|
|
1107
|
-
* Creates a new version of an existing document
|
|
1108
|
-
*
|
|
1107
|
+
* Creates a new version of an existing document.
|
|
1108
|
+
*
|
|
1109
|
+
* If the `document` is provided, the version is created from the document
|
|
1110
|
+
* attached to the release as given by `document._id`
|
|
1111
|
+
*
|
|
1112
|
+
* If the `baseId` and `versionId` are provided, the version is created from the base document
|
|
1113
|
+
* and the version is attached to the release as given by `publishedId` and `versionId`
|
|
1109
1114
|
*
|
|
1110
1115
|
* @public
|
|
1111
1116
|
*/
|
|
1112
|
-
export declare
|
|
1117
|
+
export declare type CreateVersionAction = {
|
|
1113
1118
|
actionType: 'sanity.action.document.version.create'
|
|
1114
1119
|
publishedId: string
|
|
1115
|
-
|
|
1116
|
-
|
|
1120
|
+
} & (
|
|
1121
|
+
| {
|
|
1122
|
+
document: IdentifiedSanityDocumentStub
|
|
1123
|
+
}
|
|
1124
|
+
| {
|
|
1125
|
+
baseId: string
|
|
1126
|
+
versionId: string
|
|
1127
|
+
ifBaseRevisionId?: string
|
|
1128
|
+
}
|
|
1129
|
+
)
|
|
1117
1130
|
|
|
1118
1131
|
/** @public */
|
|
1119
1132
|
export declare interface CurrentSanityUser {
|
|
@@ -1122,6 +1135,7 @@ export declare interface CurrentSanityUser {
|
|
|
1122
1135
|
email: string
|
|
1123
1136
|
profileImage: string | null
|
|
1124
1137
|
role: string
|
|
1138
|
+
provider: string
|
|
1125
1139
|
}
|
|
1126
1140
|
|
|
1127
1141
|
/** @public */
|
|
@@ -3296,6 +3310,15 @@ export declare class ObservableSanityClient {
|
|
|
3296
3310
|
},
|
|
3297
3311
|
options?: BaseActionOptions,
|
|
3298
3312
|
): Observable<SingleActionResult | MultipleActionResult>
|
|
3313
|
+
createVersion(
|
|
3314
|
+
args: {
|
|
3315
|
+
baseId: string
|
|
3316
|
+
releaseId: string
|
|
3317
|
+
publishedId: string
|
|
3318
|
+
ifBaseRevisionId?: string
|
|
3319
|
+
},
|
|
3320
|
+
options?: BaseActionOptions,
|
|
3321
|
+
): Observable<SingleActionResult | MultipleActionResult>
|
|
3299
3322
|
/**
|
|
3300
3323
|
* Deletes a document with the given document ID.
|
|
3301
3324
|
* Returns an observable that resolves to the deleted document.
|
|
@@ -5023,7 +5046,8 @@ export declare class SanityClient {
|
|
|
5023
5046
|
* Creates a new version of a published document.
|
|
5024
5047
|
*
|
|
5025
5048
|
* @remarks
|
|
5026
|
-
* *
|
|
5049
|
+
* * The preferred approach is to use `baseId` to refer to the existing published document, but it is also possible to provide a complete `document` instead.
|
|
5050
|
+
* * If `document` is provided, it must have a `_type` property.
|
|
5027
5051
|
* * Creating a version with no `releaseId` will create a new draft version of the published document.
|
|
5028
5052
|
* * If the `document._id` is defined, it should be a draft or release version ID that matches the version ID generated from `publishedId` and `releaseId`.
|
|
5029
5053
|
* * If the `document._id` is not defined, it will be generated from `publishedId` and `releaseId`.
|
|
@@ -5032,17 +5056,18 @@ export declare class SanityClient {
|
|
|
5032
5056
|
* @category Versions
|
|
5033
5057
|
*
|
|
5034
5058
|
* @param params - Version action parameters:
|
|
5059
|
+
* - `baseId` - The ID of the published document from which to create a new version from.
|
|
5060
|
+
* - `ifBaseRevisionId` - If `baseId` is provided, this ensures the `baseId`'s revision Id is as expected before creating the new version from it.
|
|
5035
5061
|
* - `document` - The document to create as a new version (must include `_type`).
|
|
5036
5062
|
* - `publishedId` - The ID of the published document being versioned.
|
|
5037
5063
|
* - `releaseId` - The ID of the release to create the version for.
|
|
5038
5064
|
* @param options - Additional action options.
|
|
5039
5065
|
* @returns A promise that resolves to the `transactionId`.
|
|
5040
5066
|
*
|
|
5041
|
-
* @example Creating a new version of a published document
|
|
5067
|
+
* @example Creating a new version of a published document
|
|
5042
5068
|
* ```ts
|
|
5043
5069
|
* const transactionId = await client.createVersion({
|
|
5044
|
-
*
|
|
5045
|
-
* document: {_type: 'myDocument', title: 'My Document'},
|
|
5070
|
+
* baseId: 'myDocument',
|
|
5046
5071
|
* publishedId: 'myDocument',
|
|
5047
5072
|
* releaseId: 'myRelease',
|
|
5048
5073
|
* })
|
|
@@ -5055,25 +5080,11 @@ export declare class SanityClient {
|
|
|
5055
5080
|
* // }
|
|
5056
5081
|
* ```
|
|
5057
5082
|
*
|
|
5058
|
-
* @example Creating a new version of a published document with a specified version ID
|
|
5059
|
-
* ```ts
|
|
5060
|
-
* const transactionId = await client.createVersion({
|
|
5061
|
-
* document: {_type: 'myDocument', _id: 'versions.myRelease.myDocument', title: 'My Document'},
|
|
5062
|
-
* // `publishedId` and `releaseId` are not required since `document._id` has been specified
|
|
5063
|
-
* })
|
|
5064
|
-
*
|
|
5065
|
-
* // The following document will be created:
|
|
5066
|
-
* // {
|
|
5067
|
-
* // _id: 'versions.myRelease.myDocument',
|
|
5068
|
-
* // _type: 'myDocument',
|
|
5069
|
-
* // title: 'My Document',
|
|
5070
|
-
* // }
|
|
5071
|
-
* ```
|
|
5072
5083
|
*
|
|
5073
5084
|
* @example Creating a new draft version of a published document
|
|
5074
5085
|
* ```ts
|
|
5075
5086
|
* const transactionId = await client.createVersion({
|
|
5076
|
-
*
|
|
5087
|
+
* baseId: 'myDocument',
|
|
5077
5088
|
* publishedId: 'myDocument',
|
|
5078
5089
|
* })
|
|
5079
5090
|
*
|
|
@@ -5101,6 +5112,15 @@ export declare class SanityClient {
|
|
|
5101
5112
|
},
|
|
5102
5113
|
options?: BaseActionOptions,
|
|
5103
5114
|
): Promise<SingleActionResult | MultipleActionResult>
|
|
5115
|
+
createVersion(
|
|
5116
|
+
args: {
|
|
5117
|
+
publishedId: string
|
|
5118
|
+
baseId: string
|
|
5119
|
+
releaseId: string
|
|
5120
|
+
ifBaseRevisionId?: string
|
|
5121
|
+
},
|
|
5122
|
+
options?: BaseActionOptions,
|
|
5123
|
+
): Promise<SingleActionResult | MultipleActionResult>
|
|
5104
5124
|
/**
|
|
5105
5125
|
* Deletes a document with the given document ID.
|
|
5106
5126
|
* Returns a promise that resolves to the deleted document.
|
package/dist/stega.browser.d.ts
CHANGED
|
@@ -1104,16 +1104,29 @@ export declare interface CreateReleaseAction {
|
|
|
1104
1104
|
}
|
|
1105
1105
|
|
|
1106
1106
|
/**
|
|
1107
|
-
* Creates a new version of an existing document
|
|
1108
|
-
*
|
|
1107
|
+
* Creates a new version of an existing document.
|
|
1108
|
+
*
|
|
1109
|
+
* If the `document` is provided, the version is created from the document
|
|
1110
|
+
* attached to the release as given by `document._id`
|
|
1111
|
+
*
|
|
1112
|
+
* If the `baseId` and `versionId` are provided, the version is created from the base document
|
|
1113
|
+
* and the version is attached to the release as given by `publishedId` and `versionId`
|
|
1109
1114
|
*
|
|
1110
1115
|
* @public
|
|
1111
1116
|
*/
|
|
1112
|
-
export declare
|
|
1117
|
+
export declare type CreateVersionAction = {
|
|
1113
1118
|
actionType: 'sanity.action.document.version.create'
|
|
1114
1119
|
publishedId: string
|
|
1115
|
-
|
|
1116
|
-
|
|
1120
|
+
} & (
|
|
1121
|
+
| {
|
|
1122
|
+
document: IdentifiedSanityDocumentStub
|
|
1123
|
+
}
|
|
1124
|
+
| {
|
|
1125
|
+
baseId: string
|
|
1126
|
+
versionId: string
|
|
1127
|
+
ifBaseRevisionId?: string
|
|
1128
|
+
}
|
|
1129
|
+
)
|
|
1117
1130
|
|
|
1118
1131
|
/** @public */
|
|
1119
1132
|
export declare interface CurrentSanityUser {
|
|
@@ -1122,6 +1135,7 @@ export declare interface CurrentSanityUser {
|
|
|
1122
1135
|
email: string
|
|
1123
1136
|
profileImage: string | null
|
|
1124
1137
|
role: string
|
|
1138
|
+
provider: string
|
|
1125
1139
|
}
|
|
1126
1140
|
|
|
1127
1141
|
/** @public */
|
|
@@ -3296,6 +3310,15 @@ export declare class ObservableSanityClient {
|
|
|
3296
3310
|
},
|
|
3297
3311
|
options?: BaseActionOptions,
|
|
3298
3312
|
): Observable<SingleActionResult | MultipleActionResult>
|
|
3313
|
+
createVersion(
|
|
3314
|
+
args: {
|
|
3315
|
+
baseId: string
|
|
3316
|
+
releaseId: string
|
|
3317
|
+
publishedId: string
|
|
3318
|
+
ifBaseRevisionId?: string
|
|
3319
|
+
},
|
|
3320
|
+
options?: BaseActionOptions,
|
|
3321
|
+
): Observable<SingleActionResult | MultipleActionResult>
|
|
3299
3322
|
/**
|
|
3300
3323
|
* Deletes a document with the given document ID.
|
|
3301
3324
|
* Returns an observable that resolves to the deleted document.
|
|
@@ -5023,7 +5046,8 @@ export declare class SanityClient {
|
|
|
5023
5046
|
* Creates a new version of a published document.
|
|
5024
5047
|
*
|
|
5025
5048
|
* @remarks
|
|
5026
|
-
* *
|
|
5049
|
+
* * The preferred approach is to use `baseId` to refer to the existing published document, but it is also possible to provide a complete `document` instead.
|
|
5050
|
+
* * If `document` is provided, it must have a `_type` property.
|
|
5027
5051
|
* * Creating a version with no `releaseId` will create a new draft version of the published document.
|
|
5028
5052
|
* * If the `document._id` is defined, it should be a draft or release version ID that matches the version ID generated from `publishedId` and `releaseId`.
|
|
5029
5053
|
* * If the `document._id` is not defined, it will be generated from `publishedId` and `releaseId`.
|
|
@@ -5032,17 +5056,18 @@ export declare class SanityClient {
|
|
|
5032
5056
|
* @category Versions
|
|
5033
5057
|
*
|
|
5034
5058
|
* @param params - Version action parameters:
|
|
5059
|
+
* - `baseId` - The ID of the published document from which to create a new version from.
|
|
5060
|
+
* - `ifBaseRevisionId` - If `baseId` is provided, this ensures the `baseId`'s revision Id is as expected before creating the new version from it.
|
|
5035
5061
|
* - `document` - The document to create as a new version (must include `_type`).
|
|
5036
5062
|
* - `publishedId` - The ID of the published document being versioned.
|
|
5037
5063
|
* - `releaseId` - The ID of the release to create the version for.
|
|
5038
5064
|
* @param options - Additional action options.
|
|
5039
5065
|
* @returns A promise that resolves to the `transactionId`.
|
|
5040
5066
|
*
|
|
5041
|
-
* @example Creating a new version of a published document
|
|
5067
|
+
* @example Creating a new version of a published document
|
|
5042
5068
|
* ```ts
|
|
5043
5069
|
* const transactionId = await client.createVersion({
|
|
5044
|
-
*
|
|
5045
|
-
* document: {_type: 'myDocument', title: 'My Document'},
|
|
5070
|
+
* baseId: 'myDocument',
|
|
5046
5071
|
* publishedId: 'myDocument',
|
|
5047
5072
|
* releaseId: 'myRelease',
|
|
5048
5073
|
* })
|
|
@@ -5055,25 +5080,11 @@ export declare class SanityClient {
|
|
|
5055
5080
|
* // }
|
|
5056
5081
|
* ```
|
|
5057
5082
|
*
|
|
5058
|
-
* @example Creating a new version of a published document with a specified version ID
|
|
5059
|
-
* ```ts
|
|
5060
|
-
* const transactionId = await client.createVersion({
|
|
5061
|
-
* document: {_type: 'myDocument', _id: 'versions.myRelease.myDocument', title: 'My Document'},
|
|
5062
|
-
* // `publishedId` and `releaseId` are not required since `document._id` has been specified
|
|
5063
|
-
* })
|
|
5064
|
-
*
|
|
5065
|
-
* // The following document will be created:
|
|
5066
|
-
* // {
|
|
5067
|
-
* // _id: 'versions.myRelease.myDocument',
|
|
5068
|
-
* // _type: 'myDocument',
|
|
5069
|
-
* // title: 'My Document',
|
|
5070
|
-
* // }
|
|
5071
|
-
* ```
|
|
5072
5083
|
*
|
|
5073
5084
|
* @example Creating a new draft version of a published document
|
|
5074
5085
|
* ```ts
|
|
5075
5086
|
* const transactionId = await client.createVersion({
|
|
5076
|
-
*
|
|
5087
|
+
* baseId: 'myDocument',
|
|
5077
5088
|
* publishedId: 'myDocument',
|
|
5078
5089
|
* })
|
|
5079
5090
|
*
|
|
@@ -5101,6 +5112,15 @@ export declare class SanityClient {
|
|
|
5101
5112
|
},
|
|
5102
5113
|
options?: BaseActionOptions,
|
|
5103
5114
|
): Promise<SingleActionResult | MultipleActionResult>
|
|
5115
|
+
createVersion(
|
|
5116
|
+
args: {
|
|
5117
|
+
publishedId: string
|
|
5118
|
+
baseId: string
|
|
5119
|
+
releaseId: string
|
|
5120
|
+
ifBaseRevisionId?: string
|
|
5121
|
+
},
|
|
5122
|
+
options?: BaseActionOptions,
|
|
5123
|
+
): Promise<SingleActionResult | MultipleActionResult>
|
|
5104
5124
|
/**
|
|
5105
5125
|
* Deletes a document with the given document ID.
|
|
5106
5126
|
* Returns a promise that resolves to the deleted document.
|
package/dist/stega.d.cts
CHANGED
|
@@ -1104,16 +1104,29 @@ export declare interface CreateReleaseAction {
|
|
|
1104
1104
|
}
|
|
1105
1105
|
|
|
1106
1106
|
/**
|
|
1107
|
-
* Creates a new version of an existing document
|
|
1108
|
-
*
|
|
1107
|
+
* Creates a new version of an existing document.
|
|
1108
|
+
*
|
|
1109
|
+
* If the `document` is provided, the version is created from the document
|
|
1110
|
+
* attached to the release as given by `document._id`
|
|
1111
|
+
*
|
|
1112
|
+
* If the `baseId` and `versionId` are provided, the version is created from the base document
|
|
1113
|
+
* and the version is attached to the release as given by `publishedId` and `versionId`
|
|
1109
1114
|
*
|
|
1110
1115
|
* @public
|
|
1111
1116
|
*/
|
|
1112
|
-
export declare
|
|
1117
|
+
export declare type CreateVersionAction = {
|
|
1113
1118
|
actionType: 'sanity.action.document.version.create'
|
|
1114
1119
|
publishedId: string
|
|
1115
|
-
|
|
1116
|
-
|
|
1120
|
+
} & (
|
|
1121
|
+
| {
|
|
1122
|
+
document: IdentifiedSanityDocumentStub
|
|
1123
|
+
}
|
|
1124
|
+
| {
|
|
1125
|
+
baseId: string
|
|
1126
|
+
versionId: string
|
|
1127
|
+
ifBaseRevisionId?: string
|
|
1128
|
+
}
|
|
1129
|
+
)
|
|
1117
1130
|
|
|
1118
1131
|
/** @public */
|
|
1119
1132
|
export declare interface CurrentSanityUser {
|
|
@@ -1122,6 +1135,7 @@ export declare interface CurrentSanityUser {
|
|
|
1122
1135
|
email: string
|
|
1123
1136
|
profileImage: string | null
|
|
1124
1137
|
role: string
|
|
1138
|
+
provider: string
|
|
1125
1139
|
}
|
|
1126
1140
|
|
|
1127
1141
|
/** @public */
|
|
@@ -3296,6 +3310,15 @@ export declare class ObservableSanityClient {
|
|
|
3296
3310
|
},
|
|
3297
3311
|
options?: BaseActionOptions,
|
|
3298
3312
|
): Observable<SingleActionResult | MultipleActionResult>
|
|
3313
|
+
createVersion(
|
|
3314
|
+
args: {
|
|
3315
|
+
baseId: string
|
|
3316
|
+
releaseId: string
|
|
3317
|
+
publishedId: string
|
|
3318
|
+
ifBaseRevisionId?: string
|
|
3319
|
+
},
|
|
3320
|
+
options?: BaseActionOptions,
|
|
3321
|
+
): Observable<SingleActionResult | MultipleActionResult>
|
|
3299
3322
|
/**
|
|
3300
3323
|
* Deletes a document with the given document ID.
|
|
3301
3324
|
* Returns an observable that resolves to the deleted document.
|
|
@@ -5023,7 +5046,8 @@ export declare class SanityClient {
|
|
|
5023
5046
|
* Creates a new version of a published document.
|
|
5024
5047
|
*
|
|
5025
5048
|
* @remarks
|
|
5026
|
-
* *
|
|
5049
|
+
* * The preferred approach is to use `baseId` to refer to the existing published document, but it is also possible to provide a complete `document` instead.
|
|
5050
|
+
* * If `document` is provided, it must have a `_type` property.
|
|
5027
5051
|
* * Creating a version with no `releaseId` will create a new draft version of the published document.
|
|
5028
5052
|
* * If the `document._id` is defined, it should be a draft or release version ID that matches the version ID generated from `publishedId` and `releaseId`.
|
|
5029
5053
|
* * If the `document._id` is not defined, it will be generated from `publishedId` and `releaseId`.
|
|
@@ -5032,17 +5056,18 @@ export declare class SanityClient {
|
|
|
5032
5056
|
* @category Versions
|
|
5033
5057
|
*
|
|
5034
5058
|
* @param params - Version action parameters:
|
|
5059
|
+
* - `baseId` - The ID of the published document from which to create a new version from.
|
|
5060
|
+
* - `ifBaseRevisionId` - If `baseId` is provided, this ensures the `baseId`'s revision Id is as expected before creating the new version from it.
|
|
5035
5061
|
* - `document` - The document to create as a new version (must include `_type`).
|
|
5036
5062
|
* - `publishedId` - The ID of the published document being versioned.
|
|
5037
5063
|
* - `releaseId` - The ID of the release to create the version for.
|
|
5038
5064
|
* @param options - Additional action options.
|
|
5039
5065
|
* @returns A promise that resolves to the `transactionId`.
|
|
5040
5066
|
*
|
|
5041
|
-
* @example Creating a new version of a published document
|
|
5067
|
+
* @example Creating a new version of a published document
|
|
5042
5068
|
* ```ts
|
|
5043
5069
|
* const transactionId = await client.createVersion({
|
|
5044
|
-
*
|
|
5045
|
-
* document: {_type: 'myDocument', title: 'My Document'},
|
|
5070
|
+
* baseId: 'myDocument',
|
|
5046
5071
|
* publishedId: 'myDocument',
|
|
5047
5072
|
* releaseId: 'myRelease',
|
|
5048
5073
|
* })
|
|
@@ -5055,25 +5080,11 @@ export declare class SanityClient {
|
|
|
5055
5080
|
* // }
|
|
5056
5081
|
* ```
|
|
5057
5082
|
*
|
|
5058
|
-
* @example Creating a new version of a published document with a specified version ID
|
|
5059
|
-
* ```ts
|
|
5060
|
-
* const transactionId = await client.createVersion({
|
|
5061
|
-
* document: {_type: 'myDocument', _id: 'versions.myRelease.myDocument', title: 'My Document'},
|
|
5062
|
-
* // `publishedId` and `releaseId` are not required since `document._id` has been specified
|
|
5063
|
-
* })
|
|
5064
|
-
*
|
|
5065
|
-
* // The following document will be created:
|
|
5066
|
-
* // {
|
|
5067
|
-
* // _id: 'versions.myRelease.myDocument',
|
|
5068
|
-
* // _type: 'myDocument',
|
|
5069
|
-
* // title: 'My Document',
|
|
5070
|
-
* // }
|
|
5071
|
-
* ```
|
|
5072
5083
|
*
|
|
5073
5084
|
* @example Creating a new draft version of a published document
|
|
5074
5085
|
* ```ts
|
|
5075
5086
|
* const transactionId = await client.createVersion({
|
|
5076
|
-
*
|
|
5087
|
+
* baseId: 'myDocument',
|
|
5077
5088
|
* publishedId: 'myDocument',
|
|
5078
5089
|
* })
|
|
5079
5090
|
*
|
|
@@ -5101,6 +5112,15 @@ export declare class SanityClient {
|
|
|
5101
5112
|
},
|
|
5102
5113
|
options?: BaseActionOptions,
|
|
5103
5114
|
): Promise<SingleActionResult | MultipleActionResult>
|
|
5115
|
+
createVersion(
|
|
5116
|
+
args: {
|
|
5117
|
+
publishedId: string
|
|
5118
|
+
baseId: string
|
|
5119
|
+
releaseId: string
|
|
5120
|
+
ifBaseRevisionId?: string
|
|
5121
|
+
},
|
|
5122
|
+
options?: BaseActionOptions,
|
|
5123
|
+
): Promise<SingleActionResult | MultipleActionResult>
|
|
5104
5124
|
/**
|
|
5105
5125
|
* Deletes a document with the given document ID.
|
|
5106
5126
|
* Returns a promise that resolves to the deleted document.
|
package/dist/stega.d.ts
CHANGED
|
@@ -1104,16 +1104,29 @@ export declare interface CreateReleaseAction {
|
|
|
1104
1104
|
}
|
|
1105
1105
|
|
|
1106
1106
|
/**
|
|
1107
|
-
* Creates a new version of an existing document
|
|
1108
|
-
*
|
|
1107
|
+
* Creates a new version of an existing document.
|
|
1108
|
+
*
|
|
1109
|
+
* If the `document` is provided, the version is created from the document
|
|
1110
|
+
* attached to the release as given by `document._id`
|
|
1111
|
+
*
|
|
1112
|
+
* If the `baseId` and `versionId` are provided, the version is created from the base document
|
|
1113
|
+
* and the version is attached to the release as given by `publishedId` and `versionId`
|
|
1109
1114
|
*
|
|
1110
1115
|
* @public
|
|
1111
1116
|
*/
|
|
1112
|
-
export declare
|
|
1117
|
+
export declare type CreateVersionAction = {
|
|
1113
1118
|
actionType: 'sanity.action.document.version.create'
|
|
1114
1119
|
publishedId: string
|
|
1115
|
-
|
|
1116
|
-
|
|
1120
|
+
} & (
|
|
1121
|
+
| {
|
|
1122
|
+
document: IdentifiedSanityDocumentStub
|
|
1123
|
+
}
|
|
1124
|
+
| {
|
|
1125
|
+
baseId: string
|
|
1126
|
+
versionId: string
|
|
1127
|
+
ifBaseRevisionId?: string
|
|
1128
|
+
}
|
|
1129
|
+
)
|
|
1117
1130
|
|
|
1118
1131
|
/** @public */
|
|
1119
1132
|
export declare interface CurrentSanityUser {
|
|
@@ -1122,6 +1135,7 @@ export declare interface CurrentSanityUser {
|
|
|
1122
1135
|
email: string
|
|
1123
1136
|
profileImage: string | null
|
|
1124
1137
|
role: string
|
|
1138
|
+
provider: string
|
|
1125
1139
|
}
|
|
1126
1140
|
|
|
1127
1141
|
/** @public */
|
|
@@ -3296,6 +3310,15 @@ export declare class ObservableSanityClient {
|
|
|
3296
3310
|
},
|
|
3297
3311
|
options?: BaseActionOptions,
|
|
3298
3312
|
): Observable<SingleActionResult | MultipleActionResult>
|
|
3313
|
+
createVersion(
|
|
3314
|
+
args: {
|
|
3315
|
+
baseId: string
|
|
3316
|
+
releaseId: string
|
|
3317
|
+
publishedId: string
|
|
3318
|
+
ifBaseRevisionId?: string
|
|
3319
|
+
},
|
|
3320
|
+
options?: BaseActionOptions,
|
|
3321
|
+
): Observable<SingleActionResult | MultipleActionResult>
|
|
3299
3322
|
/**
|
|
3300
3323
|
* Deletes a document with the given document ID.
|
|
3301
3324
|
* Returns an observable that resolves to the deleted document.
|
|
@@ -5023,7 +5046,8 @@ export declare class SanityClient {
|
|
|
5023
5046
|
* Creates a new version of a published document.
|
|
5024
5047
|
*
|
|
5025
5048
|
* @remarks
|
|
5026
|
-
* *
|
|
5049
|
+
* * The preferred approach is to use `baseId` to refer to the existing published document, but it is also possible to provide a complete `document` instead.
|
|
5050
|
+
* * If `document` is provided, it must have a `_type` property.
|
|
5027
5051
|
* * Creating a version with no `releaseId` will create a new draft version of the published document.
|
|
5028
5052
|
* * If the `document._id` is defined, it should be a draft or release version ID that matches the version ID generated from `publishedId` and `releaseId`.
|
|
5029
5053
|
* * If the `document._id` is not defined, it will be generated from `publishedId` and `releaseId`.
|
|
@@ -5032,17 +5056,18 @@ export declare class SanityClient {
|
|
|
5032
5056
|
* @category Versions
|
|
5033
5057
|
*
|
|
5034
5058
|
* @param params - Version action parameters:
|
|
5059
|
+
* - `baseId` - The ID of the published document from which to create a new version from.
|
|
5060
|
+
* - `ifBaseRevisionId` - If `baseId` is provided, this ensures the `baseId`'s revision Id is as expected before creating the new version from it.
|
|
5035
5061
|
* - `document` - The document to create as a new version (must include `_type`).
|
|
5036
5062
|
* - `publishedId` - The ID of the published document being versioned.
|
|
5037
5063
|
* - `releaseId` - The ID of the release to create the version for.
|
|
5038
5064
|
* @param options - Additional action options.
|
|
5039
5065
|
* @returns A promise that resolves to the `transactionId`.
|
|
5040
5066
|
*
|
|
5041
|
-
* @example Creating a new version of a published document
|
|
5067
|
+
* @example Creating a new version of a published document
|
|
5042
5068
|
* ```ts
|
|
5043
5069
|
* const transactionId = await client.createVersion({
|
|
5044
|
-
*
|
|
5045
|
-
* document: {_type: 'myDocument', title: 'My Document'},
|
|
5070
|
+
* baseId: 'myDocument',
|
|
5046
5071
|
* publishedId: 'myDocument',
|
|
5047
5072
|
* releaseId: 'myRelease',
|
|
5048
5073
|
* })
|
|
@@ -5055,25 +5080,11 @@ export declare class SanityClient {
|
|
|
5055
5080
|
* // }
|
|
5056
5081
|
* ```
|
|
5057
5082
|
*
|
|
5058
|
-
* @example Creating a new version of a published document with a specified version ID
|
|
5059
|
-
* ```ts
|
|
5060
|
-
* const transactionId = await client.createVersion({
|
|
5061
|
-
* document: {_type: 'myDocument', _id: 'versions.myRelease.myDocument', title: 'My Document'},
|
|
5062
|
-
* // `publishedId` and `releaseId` are not required since `document._id` has been specified
|
|
5063
|
-
* })
|
|
5064
|
-
*
|
|
5065
|
-
* // The following document will be created:
|
|
5066
|
-
* // {
|
|
5067
|
-
* // _id: 'versions.myRelease.myDocument',
|
|
5068
|
-
* // _type: 'myDocument',
|
|
5069
|
-
* // title: 'My Document',
|
|
5070
|
-
* // }
|
|
5071
|
-
* ```
|
|
5072
5083
|
*
|
|
5073
5084
|
* @example Creating a new draft version of a published document
|
|
5074
5085
|
* ```ts
|
|
5075
5086
|
* const transactionId = await client.createVersion({
|
|
5076
|
-
*
|
|
5087
|
+
* baseId: 'myDocument',
|
|
5077
5088
|
* publishedId: 'myDocument',
|
|
5078
5089
|
* })
|
|
5079
5090
|
*
|
|
@@ -5101,6 +5112,15 @@ export declare class SanityClient {
|
|
|
5101
5112
|
},
|
|
5102
5113
|
options?: BaseActionOptions,
|
|
5103
5114
|
): Promise<SingleActionResult | MultipleActionResult>
|
|
5115
|
+
createVersion(
|
|
5116
|
+
args: {
|
|
5117
|
+
publishedId: string
|
|
5118
|
+
baseId: string
|
|
5119
|
+
releaseId: string
|
|
5120
|
+
ifBaseRevisionId?: string
|
|
5121
|
+
},
|
|
5122
|
+
options?: BaseActionOptions,
|
|
5123
|
+
): Promise<SingleActionResult | MultipleActionResult>
|
|
5104
5124
|
/**
|
|
5105
5125
|
* Deletes a document with the given document ID.
|
|
5106
5126
|
* Returns a promise that resolves to the deleted document.
|