@sanity/export 3.37.3-cds-unstable.27 → 3.37.4

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2016 - 2024 Sanity.io
3
+ Copyright (c) 2024 - 2024 Sanity.io
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/export",
3
- "version": "3.37.3-cds-unstable.27+a9843a2384",
3
+ "version": "3.37.4",
4
4
  "description": "Export Sanity documents and assets",
5
5
  "keywords": [
6
6
  "sanity",
@@ -13,12 +13,11 @@
13
13
  ],
14
14
  "homepage": "https://www.sanity.io/",
15
15
  "bugs": {
16
- "url": "https://github.com/sanity-io/sanity/issues"
16
+ "url": "https://github.com/sanity-io/export/issues"
17
17
  },
18
18
  "repository": {
19
19
  "type": "git",
20
- "url": "git+https://github.com/sanity-io/sanity.git",
21
- "directory": "packages/@sanity/export"
20
+ "url": "git+https://github.com/sanity-io/export.git"
22
21
  },
23
22
  "license": "MIT",
24
23
  "author": "Sanity.io <hello@sanity.io>",
@@ -31,10 +30,10 @@
31
30
  "test": "jest"
32
31
  },
33
32
  "dependencies": {
34
- "@sanity/util": "3.37.3-cds-unstable.27+a9843a2384",
33
+ "@sanity/util": "3.37.2",
35
34
  "archiver": "^7.0.0",
36
35
  "debug": "^4.3.4",
37
- "get-it": "^8.4.18",
36
+ "get-it": "^8.4.21",
38
37
  "lodash": "^4.17.21",
39
38
  "mississippi": "^4.0.0",
40
39
  "p-queue": "^2.3.0",
@@ -43,13 +42,21 @@
43
42
  },
44
43
  "devDependencies": {
45
44
  "@jest/globals": "^29.7.0",
45
+ "@sanity/semantic-release-preset": "^4.1.7",
46
+ "eslint": "^8.57.0",
47
+ "eslint-config-prettier": "^9.1.0",
48
+ "eslint-config-sanity": "^7.1.2",
49
+ "eslint-plugin-prettier": "^5.1.3",
50
+ "jest": "^29.7.0",
51
+ "prettier": "^3.2.5",
52
+ "prettier-plugin-packagejson": "^2.5.0",
46
53
  "string-to-stream": "^1.1.0"
47
54
  },
48
55
  "engines": {
49
56
  "node": ">=18"
50
57
  },
51
58
  "publishConfig": {
52
- "access": "public"
53
- },
54
- "gitHead": "a9843a2384fafc656ab5a15d3ce63b2f223c52b0"
59
+ "access": "public",
60
+ "provenance": true
61
+ }
55
62
  }
@@ -180,6 +180,13 @@ class AssetHandler {
180
180
  try {
181
181
  stream = await requestStream(options)
182
182
  } catch (err) {
183
+ const message = 'Failed to create asset stream'
184
+ if (typeof err.message === 'string') {
185
+ // try to re-assign the error message so the stack trace is more visible
186
+ err.message = `${message}: ${err.message}`
187
+ throw err
188
+ }
189
+
183
190
  throw new Error('Failed create asset stream', {cause: err})
184
191
  }
185
192
 
@@ -194,7 +201,14 @@ class AssetHandler {
194
201
 
195
202
  throw new Error(errMsg)
196
203
  } catch (err) {
197
- throw new Error('Failed to parse error response from asset stream', {cause: err})
204
+ const message = 'Failed to parse error response from asset stream'
205
+ if (typeof err.message === 'string') {
206
+ // try to re-assign the error message so the stack trace is more visible
207
+ err.message = `${message}: ${err.message}`
208
+ throw err
209
+ }
210
+
211
+ throw new Error(message, {cause: err})
198
212
  }
199
213
  }
200
214
 
@@ -211,7 +225,14 @@ class AssetHandler {
211
225
  md5 = res.md5
212
226
  size = res.size
213
227
  } catch (err) {
214
- throw new Error('Failed to write asset stream to filesystem', {cause: err})
228
+ const message = 'Failed to write asset stream to filesystem'
229
+
230
+ if (typeof err.message === 'string') {
231
+ err.message = `${message}: ${err.message}`
232
+ throw err
233
+ }
234
+
235
+ throw new Error(message, {cause: err})
215
236
  }
216
237
 
217
238
  // Verify it against our downloaded stream to make sure we have the same copy
@@ -238,8 +259,6 @@ class AssetHandler {
238
259
  contentLength &&
239
260
  parseInt(contentLength, 10) !== size &&
240
261
  `Asset should be ${contentLength} bytes, got ${size}`,
241
-
242
- `Did not succeed after ${attemptNum} attempts.`,
243
262
  ]
244
263
 
245
264
  const detailsString = `Details:\n - ${details.filter(Boolean).join('\n - ')}`
package/src/export.js CHANGED
@@ -63,6 +63,7 @@ function exportDataset(opts) {
63
63
  assetStreamHandler = options.assets ? assetHandler.rewriteAssets : assetHandler.stripAssets
64
64
  }
65
65
 
66
+ // eslint-disable-next-line no-async-promise-executor
66
67
  return new Promise(async (resolve, reject) => {
67
68
  miss.finished(archive, async (archiveErr) => {
68
69
  if (archiveErr) {
@@ -1,5 +1,4 @@
1
1
  const {getIt} = require('get-it')
2
- // eslint-disable-next-line import/extensions
3
2
  const {keepAlive, promise} = require('get-it/middleware')
4
3
  const debug = require('./debug')
5
4