@sanity/export 3.45.3 → 4.0.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/README.md +2 -2
- package/package.json +11 -9
- package/src/filterDocuments.js +3 -5
- package/src/getDocumentCursorStream.js +7 -5
- package/src/getDocumentsStream.js +2 -2
package/README.md
CHANGED
|
@@ -61,12 +61,12 @@ exportDataset({
|
|
|
61
61
|
|
|
62
62
|
// A custom filter function for controlling which documents are exported.
|
|
63
63
|
// Optional, default: `() => true`
|
|
64
|
-
filterDocument: document => (document.title ?? '').includes('capybara'),
|
|
64
|
+
filterDocument: (document) => (document.title ?? '').includes('capybara'),
|
|
65
65
|
|
|
66
66
|
// A custom transformation function for controlling how each document is exported.
|
|
67
67
|
// Caution: customising this option may result in an archive being produced that is impossible to import.
|
|
68
68
|
// Optional, default: `document => document`
|
|
69
|
-
transformDocument: document => ({
|
|
69
|
+
transformDocument: (document) => ({
|
|
70
70
|
...document,
|
|
71
71
|
title: document.title ?? 'capybara',
|
|
72
72
|
}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/export",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "Export Sanity documents and assets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
},
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"author": "Sanity.io <hello@sanity.io>",
|
|
24
|
+
"type": "commonjs",
|
|
25
|
+
"exports": "./src/export.js",
|
|
24
26
|
"main": "./src/export.js",
|
|
25
27
|
"files": [
|
|
26
28
|
"src"
|
|
@@ -30,19 +32,19 @@
|
|
|
30
32
|
"test": "jest --verbose"
|
|
31
33
|
},
|
|
32
34
|
"dependencies": {
|
|
33
|
-
"@sanity/client": "^
|
|
34
|
-
"@sanity/util": "3.
|
|
35
|
+
"@sanity/client": "^7.8.2",
|
|
36
|
+
"@sanity/util": "^4.3.0",
|
|
35
37
|
"archiver": "^7.0.0",
|
|
36
38
|
"debug": "^4.3.4",
|
|
37
|
-
"get-it": "^8.6.
|
|
39
|
+
"get-it": "^8.6.10",
|
|
40
|
+
"json-stream-stringify": "^2.0.2",
|
|
38
41
|
"lodash": "^4.17.21",
|
|
39
42
|
"mississippi": "^4.0.0",
|
|
40
43
|
"p-queue": "^2.3.0",
|
|
41
44
|
"rimraf": "^6.0.1",
|
|
42
45
|
"split2": "^4.2.0",
|
|
43
46
|
"tar": "^7.0.1",
|
|
44
|
-
"yaml": "^2.4.2"
|
|
45
|
-
"json-stream-stringify": "^2.0.2"
|
|
47
|
+
"yaml": "^2.4.2"
|
|
46
48
|
},
|
|
47
49
|
"devDependencies": {
|
|
48
50
|
"@jest/globals": "^29.7.0",
|
|
@@ -53,13 +55,13 @@
|
|
|
53
55
|
"eslint-plugin-prettier": "^5.1.3",
|
|
54
56
|
"jest": "^29.7.0",
|
|
55
57
|
"nock": "^13.5.4",
|
|
56
|
-
"prettier": "^3.2
|
|
57
|
-
"prettier-plugin-packagejson": "^2.5.
|
|
58
|
+
"prettier": "^3.6.2",
|
|
59
|
+
"prettier-plugin-packagejson": "^2.5.19",
|
|
58
60
|
"string-to-stream": "^1.1.0",
|
|
59
61
|
"tar": "^7.0.1"
|
|
60
62
|
},
|
|
61
63
|
"engines": {
|
|
62
|
-
"node": ">=
|
|
64
|
+
"node": ">=20.19 <22 || >=22.12"
|
|
63
65
|
},
|
|
64
66
|
"publishConfig": {
|
|
65
67
|
"access": "public",
|
package/src/filterDocuments.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
const miss = require('mississippi')
|
|
2
2
|
const debug = require('./debug')
|
|
3
3
|
|
|
4
|
-
const isDraftOrVersion = (doc) =>
|
|
5
|
-
doc._id.indexOf('drafts.') === 0 ||
|
|
6
|
-
doc._id.indexOf('versions.') === 0
|
|
7
|
-
)
|
|
4
|
+
const isDraftOrVersion = (doc) =>
|
|
5
|
+
doc && doc._id && (doc._id.indexOf('drafts.') === 0 || doc._id.indexOf('versions.') === 0)
|
|
8
6
|
|
|
9
7
|
const isSystemDocument = (doc) => doc && doc._id && doc._id.indexOf('_.') === 0
|
|
10
8
|
const isReleaseDocument = (doc) => doc && doc._id && doc._id.indexOf('_.releases.') === 0
|
|
@@ -31,4 +29,4 @@ module.exports = (drafts) =>
|
|
|
31
29
|
}
|
|
32
30
|
|
|
33
31
|
return callback(null, doc)
|
|
34
|
-
})
|
|
32
|
+
})
|
|
@@ -75,7 +75,7 @@ function startStream(options, nextCursor) {
|
|
|
75
75
|
const url = new URL(baseUrl)
|
|
76
76
|
url.searchParams.set('nextCursor', nextCursor)
|
|
77
77
|
|
|
78
|
-
if (options.types && options.types.length > 0
|
|
78
|
+
if (options.types && options.types.length > 0) {
|
|
79
79
|
url.searchParams.set('types', options.types.join())
|
|
80
80
|
}
|
|
81
81
|
const token = options.client.config().token
|
|
@@ -86,9 +86,11 @@ function startStream(options, nextCursor) {
|
|
|
86
86
|
|
|
87
87
|
debug('Starting stream with cursor "%s"', nextCursor)
|
|
88
88
|
|
|
89
|
-
return requestStream({url: url.toString(), headers, maxRetries: options.maxRetries}).then(
|
|
90
|
-
|
|
89
|
+
return requestStream({url: url.toString(), headers, maxRetries: options.maxRetries}).then(
|
|
90
|
+
(res) => {
|
|
91
|
+
debug('Got stream with HTTP %d', res.statusCode)
|
|
91
92
|
|
|
92
|
-
|
|
93
|
-
|
|
93
|
+
return res
|
|
94
|
+
},
|
|
95
|
+
)
|
|
94
96
|
}
|
|
@@ -9,9 +9,9 @@ module.exports = (options) => {
|
|
|
9
9
|
? `/data/export/${options.dataset}`
|
|
10
10
|
: `/media-libraries/${options.mediaLibraryId}/export`,
|
|
11
11
|
)
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
const url = new URL(baseUrl)
|
|
14
|
-
if (options.types && options.types.length > 0
|
|
14
|
+
if (options.types && options.types.length > 0) {
|
|
15
15
|
url.searchParams.set('types', options.types.join())
|
|
16
16
|
}
|
|
17
17
|
|