@sanity/export 3.45.0 → 3.45.2
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
package/src/export.js
CHANGED
|
@@ -10,6 +10,7 @@ const AssetHandler = require('./AssetHandler')
|
|
|
10
10
|
const debug = require('./debug')
|
|
11
11
|
const pipeAsync = require('./util/pipeAsync')
|
|
12
12
|
const filterDocuments = require('./filterDocuments')
|
|
13
|
+
const filterDocumentTypes = require('./filterDocumentTypes')
|
|
13
14
|
const getDocumentsStream = require('./getDocumentsStream')
|
|
14
15
|
const getDocumentCursorStream = require('./getDocumentCursorStream')
|
|
15
16
|
const logFirstChunk = require('./logFirstChunk')
|
|
@@ -155,6 +156,7 @@ async function exportDataset(opts) {
|
|
|
155
156
|
split(tryParseJson),
|
|
156
157
|
rejectOnApiError(),
|
|
157
158
|
filterDocuments(options.drafts),
|
|
159
|
+
filterDocumentTypes(options.types),
|
|
158
160
|
assetStreamHandler,
|
|
159
161
|
miss.through.obj((doc, _enc, callback) => {
|
|
160
162
|
if (options.filterDocument(doc)) {
|
package/src/filterDocuments.js
CHANGED
|
@@ -7,7 +7,7 @@ const isDraftOrVersion = (doc) => doc && doc._id && (
|
|
|
7
7
|
)
|
|
8
8
|
|
|
9
9
|
const isSystemDocument = (doc) => doc && doc._id && doc._id.indexOf('_.') === 0
|
|
10
|
-
const
|
|
10
|
+
const isReleaseDocument = (doc) => doc && doc._id && doc._id.indexOf('_.releases.') === 0
|
|
11
11
|
const isCursor = (doc) => doc && !doc._id && doc.nextCursor !== undefined
|
|
12
12
|
|
|
13
13
|
module.exports = (drafts) =>
|
|
@@ -23,7 +23,7 @@ module.exports = (drafts) =>
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
if (isSystemDocument(doc)) {
|
|
26
|
-
if (!drafts &&
|
|
26
|
+
if (!drafts && isReleaseDocument(doc)) {
|
|
27
27
|
return callback(null, doc)
|
|
28
28
|
}
|
|
29
29
|
debug('%s is a system document, skipping', doc && doc._id)
|
|
@@ -31,4 +31,4 @@ module.exports = (drafts) =>
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
return callback(null, doc)
|
|
34
|
-
})
|
|
34
|
+
})
|
|
@@ -75,8 +75,7 @@ function startStream(options, nextCursor) {
|
|
|
75
75
|
const url = new URL(baseUrl)
|
|
76
76
|
url.searchParams.set('nextCursor', nextCursor)
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
if (options.types && options.types.length > 0 && options.dataset) {
|
|
78
|
+
if (options.types && options.types.length > 0 ) {
|
|
80
79
|
url.searchParams.set('types', options.types.join())
|
|
81
80
|
}
|
|
82
81
|
const token = options.client.config().token
|
|
@@ -10,9 +10,8 @@ module.exports = (options) => {
|
|
|
10
10
|
: `/media-libraries/${options.mediaLibraryId}/export`,
|
|
11
11
|
)
|
|
12
12
|
|
|
13
|
-
// Type filtering is only supported for datasets.
|
|
14
13
|
const url = new URL(baseUrl)
|
|
15
|
-
if (options.types && options.types.length > 0
|
|
14
|
+
if (options.types && options.types.length > 0 ) {
|
|
16
15
|
url.searchParams.set('types', options.types.join())
|
|
17
16
|
}
|
|
18
17
|
|