@sanity/client 7.4.0-agent-actions.2 → 7.4.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 +0 -27
- package/dist/index.browser.cjs +1 -1
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.d.cts +2 -69
- package/dist/index.browser.d.ts +2 -69
- package/dist/index.browser.js +1 -1
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -69
- package/dist/index.d.ts +2 -69
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/stega.browser.d.cts +2 -69
- package/dist/stega.browser.d.ts +2 -69
- package/dist/stega.d.cts +2 -69
- package/dist/stega.d.ts +2 -69
- package/package.json +2 -2
- package/src/agent/actions/transform.ts +3 -78
- package/src/data/encodeQueryString.ts +1 -1
- package/src/types.ts +0 -2
- package/umd/sanityClient.js +1 -1
- package/umd/sanityClient.min.js +1 -1
package/README.md
CHANGED
|
@@ -122,7 +122,6 @@ export async function updateDocumentTitle(_id, title) {
|
|
|
122
122
|
- [Example: Using the async flag](#example-using-the-async-flag)
|
|
123
123
|
- [Transforming Documents](#transforming-documents)
|
|
124
124
|
- [Transforming images](#transforming-images)
|
|
125
|
-
- [Image descriptions](#image-descriptions)
|
|
126
125
|
- [Example: Field-based transformation](#example-field-based-transformation)
|
|
127
126
|
- [Translating Documents](#translating-documents)
|
|
128
127
|
- [Example: Storing language in a field](#example-storing-language-in-a-field)
|
|
@@ -2112,32 +2111,6 @@ Image transform can have per-path instructions, just like any other target paths
|
|
|
2112
2111
|
|
|
2113
2112
|
- `target: [{path: ['image', 'asset'], instruction: 'Make the sky blue' }`
|
|
2114
2113
|
|
|
2115
|
-
##### Image descriptions
|
|
2116
|
-
|
|
2117
|
-
## Image description
|
|
2118
|
-
|
|
2119
|
-
Images can be transformed to a textual description by targeting a `string`, `text` or Portable Text field (`array` with `block`)
|
|
2120
|
-
with `operation: {type: 'image-description'}`.
|
|
2121
|
-
|
|
2122
|
-
Custom instructions for image description targets will be used to generate the description.
|
|
2123
|
-
|
|
2124
|
-
###### Targeting image fields
|
|
2125
|
-
If a target is a descendant field of an image object, no `sourcePath` is required in the operation:
|
|
2126
|
-
|
|
2127
|
-
For example:
|
|
2128
|
-
- `target: {path: ['image', 'description'], operation: {type: 'image-description'} }`
|
|
2129
|
-
- `target: {path: ['array', {_key: 'abc'}, 'alt'], operation: {type: 'image-description'} } //assuming the item in the array on the key-ed path is an image`
|
|
2130
|
-
- `target: {path: ['image'], include: ['portableTextField'], operation: {type: 'image-description'}, instruction: 'Use formatting and headings to describe the image in great detail' }`
|
|
2131
|
-
|
|
2132
|
-
###### Targeting non-image fields
|
|
2133
|
-
If the target image description lives outside an image object, use the `sourcePath` option to specify the path to the image field.
|
|
2134
|
-
`sourcePath` must be an image or image asset field.
|
|
2135
|
-
|
|
2136
|
-
For example:
|
|
2137
|
-
- `target: {path: ['description'], operation: operation: {type: 'image-description', sourcePath: ['image', 'asset'] }`
|
|
2138
|
-
- `target: {path: ['wrapper', 'title'], operation: {type: 'image-description', sourcePath: ['array', {_key: 'abc'}, 'image'] }`
|
|
2139
|
-
- `target: {path: ['wrapper'], include: ['portableTextField'], operation: {type: 'image-description', sourcePath: ['image', 'asset'] }, instruction: 'Use formatting and headings to describe the image in great detail' }`
|
|
2140
|
-
|
|
2141
2114
|
##### Example: Field-based transformation
|
|
2142
2115
|
|
|
2143
2116
|
```ts
|
package/dist/index.browser.cjs
CHANGED
|
@@ -853,7 +853,7 @@ const encodeQueryString = ({
|
|
|
853
853
|
const searchParams = new URLSearchParams(), { tag, includeMutations, returnQuery, ...opts } = options;
|
|
854
854
|
tag && searchParams.append("tag", tag), searchParams.append("query", query);
|
|
855
855
|
for (const [key, value] of Object.entries(params))
|
|
856
|
-
searchParams.append(`$${key}`, JSON.stringify(value));
|
|
856
|
+
value !== void 0 && searchParams.append(`$${key}`, JSON.stringify(value));
|
|
857
857
|
for (const [key, value] of Object.entries(opts))
|
|
858
858
|
value && searchParams.append(key, `${value}`);
|
|
859
859
|
return returnQuery === !1 && searchParams.append("returnQuery", "false"), includeMutations === !1 && searchParams.append("includeMutations", "false"), `?${searchParams}`;
|