@sanity/client 7.8.1 → 7.8.2

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.
@@ -1905,6 +1905,7 @@ export declare interface GroqAgentActionParam {
1905
1905
  type: 'groq'
1906
1906
  query: string
1907
1907
  params?: Record<string, string>
1908
+ perspective?: ClientPerspective
1908
1909
  }
1909
1910
 
1910
1911
  /**
@@ -4005,10 +4006,8 @@ export declare class ProjectsClient {
4005
4006
  declare interface PromptJsonResponse<T extends Record<string, Any> = Record<string, Any>> {
4006
4007
  /**
4007
4008
  *
4008
- * When true, the response body will be json according to the instruction.
4009
- * When false, the response is the raw text response to the instruction.
4010
- *
4011
- * Note: In addition to setting this to true, `instruction` MUST include the word 'JSON', or 'json' for this to work.
4009
+ * When format is 'json', the response will be json according to the instruction.
4010
+ * Note: In addition to setting this to 'json', `instruction` MUST include the word 'JSON', or 'json' for this to work.
4012
4011
  */
4013
4012
  format: 'json'
4014
4013
  }
@@ -4115,13 +4114,9 @@ declare interface PromptRequestBase {
4115
4114
 
4116
4115
  declare interface PromptTextResponse {
4117
4116
  /**
4118
- *
4119
- * When true, the response body will be json according to the instruction.
4120
- * When false, the response is the raw text response to the instruction.
4121
- *
4122
- * Note: In addition to setting this to true, `instruction` MUST include the word 'JSON', or 'json' for this to work.
4117
+ * When format is 'string', the response will be a raw text response to the instruction.
4123
4118
  */
4124
- format?: 'text'
4119
+ format?: 'string'
4125
4120
  }
4126
4121
 
4127
4122
  /**
@@ -1905,6 +1905,7 @@ export declare interface GroqAgentActionParam {
1905
1905
  type: 'groq'
1906
1906
  query: string
1907
1907
  params?: Record<string, string>
1908
+ perspective?: ClientPerspective
1908
1909
  }
1909
1910
 
1910
1911
  /**
@@ -4005,10 +4006,8 @@ export declare class ProjectsClient {
4005
4006
  declare interface PromptJsonResponse<T extends Record<string, Any> = Record<string, Any>> {
4006
4007
  /**
4007
4008
  *
4008
- * When true, the response body will be json according to the instruction.
4009
- * When false, the response is the raw text response to the instruction.
4010
- *
4011
- * Note: In addition to setting this to true, `instruction` MUST include the word 'JSON', or 'json' for this to work.
4009
+ * When format is 'json', the response will be json according to the instruction.
4010
+ * Note: In addition to setting this to 'json', `instruction` MUST include the word 'JSON', or 'json' for this to work.
4012
4011
  */
4013
4012
  format: 'json'
4014
4013
  }
@@ -4115,13 +4114,9 @@ declare interface PromptRequestBase {
4115
4114
 
4116
4115
  declare interface PromptTextResponse {
4117
4116
  /**
4118
- *
4119
- * When true, the response body will be json according to the instruction.
4120
- * When false, the response is the raw text response to the instruction.
4121
- *
4122
- * Note: In addition to setting this to true, `instruction` MUST include the word 'JSON', or 'json' for this to work.
4117
+ * When format is 'string', the response will be a raw text response to the instruction.
4123
4118
  */
4124
- format?: 'text'
4119
+ format?: 'string'
4125
4120
  }
4126
4121
 
4127
4122
  /**
package/dist/stega.d.cts CHANGED
@@ -1905,6 +1905,7 @@ export declare interface GroqAgentActionParam {
1905
1905
  type: 'groq'
1906
1906
  query: string
1907
1907
  params?: Record<string, string>
1908
+ perspective?: ClientPerspective
1908
1909
  }
1909
1910
 
1910
1911
  /**
@@ -4005,10 +4006,8 @@ export declare class ProjectsClient {
4005
4006
  declare interface PromptJsonResponse<T extends Record<string, Any> = Record<string, Any>> {
4006
4007
  /**
4007
4008
  *
4008
- * When true, the response body will be json according to the instruction.
4009
- * When false, the response is the raw text response to the instruction.
4010
- *
4011
- * Note: In addition to setting this to true, `instruction` MUST include the word 'JSON', or 'json' for this to work.
4009
+ * When format is 'json', the response will be json according to the instruction.
4010
+ * Note: In addition to setting this to 'json', `instruction` MUST include the word 'JSON', or 'json' for this to work.
4012
4011
  */
4013
4012
  format: 'json'
4014
4013
  }
@@ -4115,13 +4114,9 @@ declare interface PromptRequestBase {
4115
4114
 
4116
4115
  declare interface PromptTextResponse {
4117
4116
  /**
4118
- *
4119
- * When true, the response body will be json according to the instruction.
4120
- * When false, the response is the raw text response to the instruction.
4121
- *
4122
- * Note: In addition to setting this to true, `instruction` MUST include the word 'JSON', or 'json' for this to work.
4117
+ * When format is 'string', the response will be a raw text response to the instruction.
4123
4118
  */
4124
- format?: 'text'
4119
+ format?: 'string'
4125
4120
  }
4126
4121
 
4127
4122
  /**
package/dist/stega.d.ts CHANGED
@@ -1905,6 +1905,7 @@ export declare interface GroqAgentActionParam {
1905
1905
  type: 'groq'
1906
1906
  query: string
1907
1907
  params?: Record<string, string>
1908
+ perspective?: ClientPerspective
1908
1909
  }
1909
1910
 
1910
1911
  /**
@@ -4005,10 +4006,8 @@ export declare class ProjectsClient {
4005
4006
  declare interface PromptJsonResponse<T extends Record<string, Any> = Record<string, Any>> {
4006
4007
  /**
4007
4008
  *
4008
- * When true, the response body will be json according to the instruction.
4009
- * When false, the response is the raw text response to the instruction.
4010
- *
4011
- * Note: In addition to setting this to true, `instruction` MUST include the word 'JSON', or 'json' for this to work.
4009
+ * When format is 'json', the response will be json according to the instruction.
4010
+ * Note: In addition to setting this to 'json', `instruction` MUST include the word 'JSON', or 'json' for this to work.
4012
4011
  */
4013
4012
  format: 'json'
4014
4013
  }
@@ -4115,13 +4114,9 @@ declare interface PromptRequestBase {
4115
4114
 
4116
4115
  declare interface PromptTextResponse {
4117
4116
  /**
4118
- *
4119
- * When true, the response body will be json according to the instruction.
4120
- * When false, the response is the raw text response to the instruction.
4121
- *
4122
- * Note: In addition to setting this to true, `instruction` MUST include the word 'JSON', or 'json' for this to work.
4117
+ * When format is 'string', the response will be a raw text response to the instruction.
4123
4118
  */
4124
- format?: 'text'
4119
+ format?: 'string'
4125
4120
  }
4126
4121
 
4127
4122
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/client",
3
- "version": "7.8.1",
3
+ "version": "7.8.2",
4
4
  "description": "Client for retrieving, creating and patching data from Sanity.io",
5
5
  "keywords": [
6
6
  "sanity",
@@ -1,3 +1,5 @@
1
+ import type {ClientPerspective} from '@sanity/client'
2
+
1
3
  /**
2
4
  * Include a string in the instruction: do not have to escape $ signs in the string.
3
5
  *
@@ -128,6 +130,7 @@ export interface GroqAgentActionParam {
128
130
  type: 'groq'
129
131
  query: string
130
132
  params?: Record<string, string>
133
+ perspective?: ClientPerspective
131
134
  }
132
135
 
133
136
  /** @beta */
@@ -105,23 +105,17 @@ export interface PromptRequestBase {
105
105
  interface PromptJsonResponse<T extends Record<string, Any> = Record<string, Any>> {
106
106
  /**
107
107
  *
108
- * When true, the response body will be json according to the instruction.
109
- * When false, the response is the raw text response to the instruction.
110
- *
111
- * Note: In addition to setting this to true, `instruction` MUST include the word 'JSON', or 'json' for this to work.
108
+ * When format is 'json', the response will be json according to the instruction.
109
+ * Note: In addition to setting this to 'json', `instruction` MUST include the word 'JSON', or 'json' for this to work.
112
110
  */
113
111
  format: 'json'
114
112
  }
115
113
 
116
114
  interface PromptTextResponse {
117
115
  /**
118
- *
119
- * When true, the response body will be json according to the instruction.
120
- * When false, the response is the raw text response to the instruction.
121
- *
122
- * Note: In addition to setting this to true, `instruction` MUST include the word 'JSON', or 'json' for this to work.
116
+ * When format is 'string', the response will be a raw text response to the instruction.
123
117
  */
124
- format?: 'text'
118
+ format?: 'string'
125
119
  }
126
120
 
127
121
  /** @beta */
@@ -86,13 +86,41 @@ function isValidDate(dateString: string) {
86
86
  return /^\d{4}-\d{2}-\d{2}/.test(dateString) ? Boolean(Date.parse(dateString)) : false
87
87
  }
88
88
 
89
+ const allowedProtocols = new Set([
90
+ 'app:',
91
+ 'data:',
92
+ 'discord:',
93
+ 'file:',
94
+ 'ftp:',
95
+ 'ftps:',
96
+ 'geo:',
97
+ 'http:',
98
+ 'https:',
99
+ 'imap:',
100
+ 'javascript:',
101
+ 'magnet:',
102
+ 'mailto:',
103
+ 'maps:',
104
+ 'ms-excel:',
105
+ 'ms-powerpoint:',
106
+ 'ms-word:',
107
+ 'slack:',
108
+ 'sms:',
109
+ 'spotify:',
110
+ 'steam:',
111
+ 'teams:',
112
+ 'tel:',
113
+ 'vscode:',
114
+ 'zoom:',
115
+ ])
116
+
89
117
  function isValidURL(url: string) {
90
118
  try {
91
- new URL(url, url.startsWith('/') ? 'https://acme.com' : undefined)
119
+ const {protocol} = new URL(url, url.startsWith('/') ? 'https://acme.com' : undefined)
120
+ return allowedProtocols.has(protocol) || protocol.startsWith('web+')
92
121
  } catch {
93
122
  return false
94
123
  }
95
- return true
96
124
  }
97
125
 
98
126
  function hasTypeLike(path: ContentSourceMapParsedPath): boolean {
@@ -4964,13 +4964,40 @@ ${selectionOpts}`);
4964
4964
  function isValidDate(dateString) {
4965
4965
  return /^\d{4}-\d{2}-\d{2}/.test(dateString) ? !!Date.parse(dateString) : false;
4966
4966
  }
4967
+ const allowedProtocols = /* @__PURE__ */ new Set([
4968
+ "app:",
4969
+ "data:",
4970
+ "discord:",
4971
+ "file:",
4972
+ "ftp:",
4973
+ "ftps:",
4974
+ "geo:",
4975
+ "http:",
4976
+ "https:",
4977
+ "imap:",
4978
+ "javascript:",
4979
+ "magnet:",
4980
+ "mailto:",
4981
+ "maps:",
4982
+ "ms-excel:",
4983
+ "ms-powerpoint:",
4984
+ "ms-word:",
4985
+ "slack:",
4986
+ "sms:",
4987
+ "spotify:",
4988
+ "steam:",
4989
+ "teams:",
4990
+ "tel:",
4991
+ "vscode:",
4992
+ "zoom:"
4993
+ ]);
4967
4994
  function isValidURL(url) {
4968
4995
  try {
4969
- new URL(url, url.startsWith("/") ? "https://acme.com" : void 0);
4996
+ const { protocol } = new URL(url, url.startsWith("/") ? "https://acme.com" : void 0);
4997
+ return allowedProtocols.has(protocol) || protocol.startsWith("web+");
4970
4998
  } catch {
4971
4999
  return false;
4972
5000
  }
4973
- return true;
4974
5001
  }
4975
5002
  function hasTypeLike(path) {
4976
5003
  return path.some((segment) => typeof segment == "string" && segment.match(/type/i) !== null);