@jungvonmatt/contentful-migrations 5.2.0 → 5.2.3
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/index.d.ts +18 -0
- package/index.js +6 -6
- package/lib/backend.js +1 -1
- package/lib/helpers/validation.js +1 -3
- package/package.json +2 -1
package/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type Migration, { MigrationContext, MigrationFunction } from "contentful-migration";
|
|
2
|
+
import type { LocaleHelpers } from "./lib/helpers/locale";
|
|
3
|
+
import type { ValidationHelpers } from "./lib/helpers/validation";
|
|
4
|
+
|
|
5
|
+
export interface MigrationHelpers {
|
|
6
|
+
locale: LocaleHelpers,
|
|
7
|
+
validation: ValidationHelpers
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type EnhancedMigrationFunction = (
|
|
11
|
+
migration: Migration,
|
|
12
|
+
context?: MigrationContext,
|
|
13
|
+
helpers?: MigrationHelpers
|
|
14
|
+
) => void;
|
|
15
|
+
|
|
16
|
+
export function withHelpers(cb: EnhancedMigrationFunction): MigrationFunction;
|
|
17
|
+
export { getLocaleHelpers } from "./lib/helpers/locale";
|
|
18
|
+
export { getValidationHelpers } from "./lib/helpers/validation";
|
package/index.js
CHANGED
|
@@ -11,16 +11,16 @@
|
|
|
11
11
|
* });
|
|
12
12
|
*
|
|
13
13
|
*/
|
|
14
|
-
const {
|
|
15
|
-
const {
|
|
14
|
+
const { getValidationHelpers } = require('./lib/helpers/validation');
|
|
15
|
+
const { getLocaleHelpers } = require('./lib/helpers/locale');
|
|
16
16
|
|
|
17
17
|
// Export wrapper
|
|
18
18
|
module.exports.withHelpers = (cb) => (migration, context) => {
|
|
19
|
-
const locale =
|
|
20
|
-
const validation =
|
|
19
|
+
const locale = getLocaleHelpers(migration, context);
|
|
20
|
+
const validation = getValidationHelpers(migration, context);
|
|
21
21
|
|
|
22
22
|
return cb(migration, context, { locale, validation });
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
module.exports.
|
|
26
|
-
module.exports.
|
|
25
|
+
module.exports.getValidationHelpers = getValidationHelpers;
|
|
26
|
+
module.exports.getLocaleHelpers = getLocaleHelpers;
|
package/lib/backend.js
CHANGED
|
@@ -294,7 +294,7 @@ const migrateToTagStorage = async (config) => {
|
|
|
294
294
|
const getMigrationVersions = async (config) => {
|
|
295
295
|
const { migrationContentTypeId } = config;
|
|
296
296
|
const client = await getEnvironment(config);
|
|
297
|
-
const { items } = await client.getEntries({ content_type: migrationContentTypeId });
|
|
297
|
+
const { items } = await client.getEntries({ content_type: migrationContentTypeId, limit: 1000 });
|
|
298
298
|
|
|
299
299
|
return (items || []).map((item) => parseInt(item.sys.id, 10));
|
|
300
300
|
};
|
|
@@ -67,9 +67,7 @@ const getValidationHelpers = (migration, context) => {
|
|
|
67
67
|
if (type === TYPE_ARRAY) {
|
|
68
68
|
const ct = migration.editContentType(contentTypeId);
|
|
69
69
|
ct.editField(fieldId).items({ ...items, validations: method(items?.validations ?? [], validationKey, typeIds) });
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (type === TYPE_LINK) {
|
|
70
|
+
} else {
|
|
73
71
|
const ct = migration.editContentType(contentTypeId);
|
|
74
72
|
ct.editField(fieldId).validations(method(validations ?? [], validationKey, typeIds));
|
|
75
73
|
}
|
package/package.json
CHANGED