Socket
Socket
Sign inDemoInstall

@sanity/migrate

Package Overview
Dependencies
Maintainers
44
Versions
183
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sanity/migrate - npm Package Compare versions

Comparing version 3.29.2-pt-input.68 to 3.30.0

11

./lib/_exports/index.js

@@ -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;

10

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc