@sanity/export 3.41.2 → 3.42.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/LICENSE +1 -1
- package/package.json +3 -3
- package/src/AssetHandler.js +17 -0
- package/src/export.js +6 -4
package/LICENSE
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/export",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.42.1",
|
|
4
4
|
"description": "Export Sanity documents and assets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"test": "jest --verbose"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@sanity/client": "^6.
|
|
34
|
-
"@sanity/util": "3.
|
|
33
|
+
"@sanity/client": "^6.24.1",
|
|
34
|
+
"@sanity/util": "3.68.3",
|
|
35
35
|
"archiver": "^7.0.0",
|
|
36
36
|
"debug": "^4.3.4",
|
|
37
37
|
"get-it": "^8.6.2",
|
package/src/AssetHandler.js
CHANGED
|
@@ -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) {
|