@sanity/migrate
Advanced tools
Comparing version 3.29.2-pt-input.68 to 3.30.0
@@ -368,5 +368,14 @@ 'use strict'; | ||
} | ||
function wrapDocumentsIteratorProducer(factory) { | ||
function documents() { | ||
return factory(); | ||
} | ||
documents[Symbol.asyncIterator] = () => { | ||
throw new Error('The migration is attempting to iterate over the "documents" function, please call the function instead:\n\n // BAD:\n for await (const document of documents) {\n // ...\n }\n\n // GOOD: \u{1F447} This is a function and has to be called\n for await (const document of documents()) {\n // ...\n }\n '); | ||
}; | ||
return documents; | ||
} | ||
function collectMigrationMutations(migration, documents, context) { | ||
const migrate = normalizeMigrateDefinition(migration); | ||
return migrate(documents, context); | ||
return migrate(wrapDocumentsIteratorProducer(documents), context); | ||
} | ||
@@ -373,0 +382,0 @@ const MUTATION_ENDPOINT_MAX_BODY_SIZE = 1024 * 256; |
@@ -353,5 +353,14 @@ import { fromString } from '@sanity/util/paths'; | ||
} | ||
function wrapDocumentsIteratorProducer(factory) { | ||
function documents() { | ||
return factory(); | ||
} | ||
documents[Symbol.asyncIterator] = () => { | ||
throw new Error('The migration is attempting to iterate over the "documents" function, please call the function instead:\n\n // BAD:\n for await (const document of documents) {\n // ...\n }\n\n // GOOD: \u{1F447} This is a function and has to be called\n for await (const document of documents()) {\n // ...\n }\n '); | ||
}; | ||
return documents; | ||
} | ||
function collectMigrationMutations(migration, documents, context) { | ||
const migrate = normalizeMigrateDefinition(migration); | ||
return migrate(documents, context); | ||
return migrate(wrapDocumentsIteratorProducer(documents), context); | ||
} | ||
@@ -358,0 +367,0 @@ const MUTATION_ENDPOINT_MAX_BODY_SIZE = 1024 * 256; |
@@ -368,5 +368,14 @@ 'use strict'; | ||
} | ||
function wrapDocumentsIteratorProducer(factory) { | ||
function documents() { | ||
return factory(); | ||
} | ||
documents[Symbol.asyncIterator] = () => { | ||
throw new Error('The migration is attempting to iterate over the "documents" function, please call the function instead:\n\n // BAD:\n for await (const document of documents) {\n // ...\n }\n\n // GOOD: \u{1F447} This is a function and has to be called\n for await (const document of documents()) {\n // ...\n }\n '); | ||
}; | ||
return documents; | ||
} | ||
function collectMigrationMutations(migration, documents, context) { | ||
const migrate = normalizeMigrateDefinition(migration); | ||
return migrate(documents, context); | ||
return migrate(wrapDocumentsIteratorProducer(documents), context); | ||
} | ||
@@ -373,0 +382,0 @@ const MUTATION_ENDPOINT_MAX_BODY_SIZE = 1024 * 256; |
{ | ||
"name": "@sanity/migrate", | ||
"version": "3.29.2-pt-input.68+d84b142938", | ||
"version": "3.30.0", | ||
"description": "Tooling for running data migrations on Sanity.io projects", | ||
@@ -67,5 +67,5 @@ "keywords": [ | ||
"@bjoerge/mutiny": "^0.5.1", | ||
"@sanity/client": "^6.12.4", | ||
"@sanity/types": "3.29.2-pt-input.68+d84b142938", | ||
"@sanity/util": "3.29.2-pt-input.68+d84b142938", | ||
"@sanity/client": "^6.13.3", | ||
"@sanity/types": "3.30.0", | ||
"@sanity/util": "3.30.0", | ||
"arrify": "^2.0.1", | ||
@@ -86,3 +86,3 @@ "debug": "^4.3.4", | ||
}, | ||
"gitHead": "d84b1429380a76e9815808e9b7c85fd8d3c8cd62" | ||
"gitHead": "c29014a64236b29cc4fbcf5e2c57ca66083bdc43" | ||
} |
@@ -6,2 +6,28 @@ import {type SanityDocument} from '@sanity/types' | ||
async function* empty() {} | ||
function wrapDocumentsIteratorProducer(factory: () => AsyncIterableIterator<SanityDocument>) { | ||
function documents() { | ||
return factory() | ||
} | ||
;(documents as any)[Symbol.asyncIterator] = () => { | ||
throw new Error( | ||
`The migration is attempting to iterate over the "documents" function, please call the function instead: | ||
// BAD: | ||
for await (const document of documents) { | ||
// ... | ||
} | ||
// GOOD: 👇 This is a function and has to be called | ||
for await (const document of documents()) { | ||
// ... | ||
} | ||
`, | ||
) | ||
} | ||
return documents | ||
} | ||
export function collectMigrationMutations( | ||
@@ -13,3 +39,3 @@ migration: Migration, | ||
const migrate = normalizeMigrateDefinition(migration) | ||
return migrate(documents, context) | ||
return migrate(wrapDocumentsIteratorProducer(documents), context) | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
3
6179124
88
7926
+ Added@sanity/types@3.30.0(transitive)
+ Added@sanity/util@3.30.0(transitive)
+ Added@types/prop-types@15.7.13(transitive)
+ Added@types/react@18.3.10(transitive)
+ Addedcsstype@3.1.3(transitive)
+ Addeddom-walk@0.1.2(transitive)
+ Addedget-random-values@1.2.2(transitive)
+ Addedget-random-values-esm@1.0.0(transitive)
+ Addedglobal@4.4.0(transitive)
+ Addedmin-document@2.19.0(transitive)
+ Addedmoment@2.30.1(transitive)
+ Addedprocess@0.11.10(transitive)
Updated@sanity/client@^6.13.3
Updated@sanity/types@3.30.0
Updated@sanity/util@3.30.0