@jungvonmatt/contentful-migrations 5.5.3 → 5.6.0

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.
Files changed (2) hide show
  1. package/lib/contentful.js +12 -6
  2. package/package.json +4 -4
package/lib/contentful.js CHANGED
@@ -63,16 +63,22 @@ const getContentName = (node, displayField) => {
63
63
  };
64
64
 
65
65
  const getClient = async (options) => {
66
- const { accessToken } = options || {};
66
+ const { accessToken, host } = options || {};
67
67
 
68
68
  if (client) {
69
69
  return client;
70
70
  }
71
71
 
72
+ const params = {
73
+ accessToken,
74
+ };
75
+
76
+ if (host) {
77
+ params.host = host;
78
+ }
79
+
72
80
  if (accessToken) {
73
- client = await contentful.createClient({
74
- accessToken,
75
- });
81
+ client = await contentful.createClient(params);
76
82
  return client;
77
83
  }
78
84
 
@@ -170,7 +176,7 @@ const getEnvironment = async (options) => {
170
176
  throw new Error(`Environment "${targetEnvironmentId}" is not available in space "${spaceId}"`);
171
177
  } else {
172
178
  throw new Error(
173
- 'Missing environment id. Use -e <environment-id> or set environment variable CONTENTFUL_ENVIRONMENT_ID'
179
+ 'Missing environment id. Use -e <environment-id> or set environment variable CONTENTFUL_ENVIRONMENT_ID',
174
180
  );
175
181
  }
176
182
 
@@ -263,7 +269,7 @@ const getLinkedEntries = (entries, allEntries, options) => {
263
269
  const entryIds = (entries || []).map((entry) => getContentId(entry));
264
270
  const linkedIds = (entries || []).reduce((result, entry) => [...result, ...getLinkedIds(entry, LINK_TYPE_ENTRY)], []);
265
271
  const newIds = linkedIds.filter(
266
- (id) => !collectedIds.includes(id) && !entryIds.includes(id) && includeIds.includes(id)
272
+ (id) => !collectedIds.includes(id) && !entryIds.includes(id) && includeIds.includes(id),
267
273
  );
268
274
  const newEntries = allEntries.filter((entry) => newIds.includes(getContentId(entry)));
269
275
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jungvonmatt/contentful-migrations",
3
- "version": "5.5.3",
3
+ "version": "5.6.0",
4
4
  "description": "Helper to handle migrations in contentful",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -40,9 +40,9 @@
40
40
  "cli-progress": "^3.11.2",
41
41
  "commander": "^8.3.0",
42
42
  "common-tags": "^1.8.2",
43
- "contentful-cli": "^1.14.21",
44
- "contentful-import": "^8.3.6",
45
- "contentful-management": "^10.40.0",
43
+ "contentful-cli": "^3.3.13",
44
+ "contentful-import": "^9.4.58",
45
+ "contentful-management": "^11.31.7",
46
46
  "contentful-migration": "^4.17.2",
47
47
  "cosmiconfig": "^8.0.0",
48
48
  "deep-diff": "^1.0.2",