@sanity/client 6.22.3-canary.1 → 6.22.3
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/index.browser.cjs.map +1 -1
- package/dist/index.browser.d.cts +2 -7
- package/dist/index.browser.d.ts +2 -7
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -7
- package/dist/index.d.ts +2 -7
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/src/data/live.ts +1 -1
- package/src/defineCreateClient.ts +1 -1
- package/src/http/errors.ts +2 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/client",
|
|
3
|
-
"version": "6.22.3
|
|
3
|
+
"version": "6.22.3",
|
|
4
4
|
"description": "Client for retrieving, creating and patching data from Sanity.io",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -154,6 +154,7 @@
|
|
|
154
154
|
"vitest": "2.1.4",
|
|
155
155
|
"vitest-github-actions-reporter": "0.11.1"
|
|
156
156
|
},
|
|
157
|
+
"packageManager": "npm@10.5.2",
|
|
157
158
|
"engines": {
|
|
158
159
|
"node": ">=14.18"
|
|
159
160
|
}
|
package/src/data/live.ts
CHANGED
|
@@ -158,7 +158,7 @@ export class LiveClient {
|
|
|
158
158
|
}
|
|
159
159
|
} catch {
|
|
160
160
|
// If the request fails, then we assume it was due to CORS, and we rethrow a special error that allows special handling in userland
|
|
161
|
-
throw new CorsOriginError({projectId})
|
|
161
|
+
throw new CorsOriginError({projectId: projectId!})
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
const evs = new EventSourceImplementation(url.toString(), esOptions)
|
|
@@ -5,7 +5,7 @@ import type {Any, ClientConfig, HttpRequest} from './types'
|
|
|
5
5
|
|
|
6
6
|
export * from './data/patch'
|
|
7
7
|
export * from './data/transaction'
|
|
8
|
-
export {ClientError, CorsOriginError,
|
|
8
|
+
export {ClientError, CorsOriginError, ServerError} from './http/errors'
|
|
9
9
|
export * from './SanityClient'
|
|
10
10
|
export * from './types'
|
|
11
11
|
|
package/src/http/errors.ts
CHANGED
|
@@ -107,17 +107,12 @@ function stringifyBody(body: Any, res: Any) {
|
|
|
107
107
|
return isJson ? JSON.stringify(body, null, 2) : body
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
/** @public */
|
|
111
|
-
export interface CorsOriginErrorOptions {
|
|
112
|
-
projectId?: string
|
|
113
|
-
}
|
|
114
|
-
|
|
115
110
|
/** @public */
|
|
116
111
|
export class CorsOriginError extends Error {
|
|
117
|
-
projectId
|
|
112
|
+
projectId: string
|
|
118
113
|
addOriginUrl?: URL
|
|
119
114
|
|
|
120
|
-
constructor({projectId}:
|
|
115
|
+
constructor({projectId}: {projectId: string}) {
|
|
121
116
|
super('CorsOriginError')
|
|
122
117
|
this.name = 'CorsOriginError'
|
|
123
118
|
this.projectId = projectId
|