@sanity/export 3.41.2 → 3.42.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/export",
3
- "version": "3.41.2",
3
+ "version": "3.42.0",
4
4
  "description": "Export Sanity documents and assets",
5
5
  "keywords": [
6
6
  "sanity",
@@ -112,6 +112,20 @@ class AssetHandler {
112
112
  try {
113
113
  return await this.downloadAsset(assetDoc, dstPath)
114
114
  } catch (err) {
115
+ // Ignore inaccessible assets
116
+ switch (err.statusCode) {
117
+ case 401:
118
+ case 403:
119
+ case 404:
120
+ console.warn(
121
+ `⚠ Asset failed with HTTP %d (ignoring): %s`,
122
+ err.statusCode,
123
+ assetDoc._id,
124
+ )
125
+ return true
126
+ default:
127
+ }
128
+
115
129
  debug(
116
130
  `Error downloading asset %s (destination: %s), attempt %d`,
117
131
  assetDoc._id,
@@ -179,6 +193,9 @@ class AssetHandler {
179
193
  // eslint-disable-next-line max-statements
180
194
  async downloadAsset(assetDoc, dstPath) {
181
195
  const {url} = assetDoc
196
+
197
+ debug('Downloading asset %s', url)
198
+
182
199
  const options = this.getAssetRequestOptions(assetDoc)
183
200
 
184
201
  let stream
package/src/export.js CHANGED
@@ -35,6 +35,12 @@ async function exportDataset(opts) {
35
35
  : zlib.constants.Z_NO_COMPRESSION,
36
36
  },
37
37
  })
38
+ archive.on('warning', (err) => {
39
+ debug('Archive warning: %s', err.message)
40
+ })
41
+ archive.on('entry', (entry) => {
42
+ debug('Adding archive entry: %s', entry.name)
43
+ })
38
44
 
39
45
  const slugDate = new Date()
40
46
  .toISOString()
@@ -232,10 +238,6 @@ async function exportDataset(opts) {
232
238
  await archive.finalize()
233
239
  })
234
240
 
235
- archive.on('warning', (err) => {
236
- debug('Archive warning: %s', err.message)
237
- })
238
-
239
241
  miss.pipe(archive, outputStream, onComplete)
240
242
 
241
243
  async function onComplete(err) {