contentful-import 9.2.2 → 9.3.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.
package/README.md CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/contentful-import.svg)](https://www.npmjs.com/package/contentful-import)
4
4
  [![CircleCI](https://circleci.com/gh/contentful/contentful-import.svg?style=shield)](https://circleci.com/gh/contentful/contentful-import/?branch=master)
5
- [![Dependency Status](https://img.shields.io/david/contentful/contentful-import.svg)](https://david-dm.org/contentful/contentful-import)
6
- [![devDependency Status](https://img.shields.io/david/dev/contentful/contentful-import.svg)](https://david-dm.org/contentful/contentful-import#info=devDependencies)
7
5
 
8
6
  [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
9
7
 
@@ -146,6 +144,14 @@ Upload local asset files downloaded via the [downloadAssets](https://github.com/
146
144
 
147
145
  Path to a directory with an asset export made using the [downloadAssets](https://github.com/contentful/contentful-export#downloadassets-boolean) option of the export. Requires `uploadAssets`
148
146
 
147
+ #### `timeout` [number] [default: 3000]
148
+
149
+ Time between retries on asset processing
150
+
151
+ #### `retryLimit` [number] [default: 10]
152
+
153
+ Maximum number of retries for asset processing
154
+
149
155
  ### Connection
150
156
 
151
157
  #### `host` [string] [default: 'api.contentful.com']
@@ -178,6 +184,10 @@ Full path to the error log file
178
184
 
179
185
  Display progress in new lines instead of displaying a busy spinner and the status in the same line. Useful for CI.
180
186
 
187
+ ### `config` [string]
188
+
189
+ Path to a JSON file with the configuration options. This file will be merged with the options passed to the function. The options passed to the function will take precedence over the ones in the config file.
190
+
181
191
  ## :rescue_worker_helmet: Troubleshooting
182
192
 
183
193
  Unable to connect to Contentful through your Proxy? Try to set the `rawProxy` option to `true`.
package/dist/index.d.mts CHANGED
@@ -1,3 +1,26 @@
1
- declare function runContentfulImport(params: any): Promise<any>;
1
+ type RunContentfulImportParams = {
2
+ spaceId: string;
3
+ environmentId?: string;
4
+ managementToken: string;
5
+ contentFile?: string;
6
+ content?: object;
7
+ contentModelOnly?: boolean;
8
+ skipContentModel?: boolean;
9
+ skipLocales?: boolean;
10
+ skipContentPublishing?: boolean;
11
+ uploadAssets?: boolean;
12
+ assetsDirectory?: string;
13
+ host?: string;
14
+ proxy?: string;
15
+ rawProxy?: string;
16
+ rateLimit?: number;
17
+ headers?: object;
18
+ errorLogFile?: string;
19
+ useVerboseRenderer?: boolean;
20
+ timeout?: number;
21
+ retryLimit?: number;
22
+ config?: string;
23
+ };
24
+ declare function runContentfulImport(params: RunContentfulImportParams): Promise<any>;
2
25
 
3
26
  export { runContentfulImport as default };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,26 @@
1
- declare function runContentfulImport(params: any): Promise<any>;
1
+ type RunContentfulImportParams = {
2
+ spaceId: string;
3
+ environmentId?: string;
4
+ managementToken: string;
5
+ contentFile?: string;
6
+ content?: object;
7
+ contentModelOnly?: boolean;
8
+ skipContentModel?: boolean;
9
+ skipLocales?: boolean;
10
+ skipContentPublishing?: boolean;
11
+ uploadAssets?: boolean;
12
+ assetsDirectory?: string;
13
+ host?: string;
14
+ proxy?: string;
15
+ rawProxy?: string;
16
+ rateLimit?: number;
17
+ headers?: object;
18
+ errorLogFile?: string;
19
+ useVerboseRenderer?: boolean;
20
+ timeout?: number;
21
+ retryLimit?: number;
22
+ config?: string;
23
+ };
24
+ declare function runContentfulImport(params: RunContentfulImportParams): Promise<any>;
2
25
 
3
26
  export { runContentfulImport as default };
package/dist/index.js CHANGED
@@ -133,22 +133,26 @@ async function getDestinationData({
133
133
  ...sourceData
134
134
  };
135
135
  if (!skipContentModel) {
136
- const contentTypeIds = sourceData.contentTypes.map((e) => e.sys.id);
137
- result.contentTypes = batchedIdQuery({
138
- environment,
139
- type: "contentTypes",
140
- ids: contentTypeIds,
141
- requestQueue
142
- });
143
- if (!skipLocales) {
144
- const localeIds = sourceData.locales.map((e) => e.sys.id);
145
- result.locales = batchedIdQuery({
136
+ const contentTypeIds = sourceData.contentTypes?.map((e) => e.sys.id);
137
+ if (contentTypeIds) {
138
+ result.contentTypes = batchedIdQuery({
146
139
  environment,
147
- type: "locales",
148
- ids: localeIds,
140
+ type: "contentTypes",
141
+ ids: contentTypeIds,
149
142
  requestQueue
150
143
  });
151
144
  }
145
+ if (!skipLocales) {
146
+ const localeIds = sourceData.locales?.map((e) => e.sys.id);
147
+ if (localeIds) {
148
+ result.locales = batchedIdQuery({
149
+ environment,
150
+ type: "locales",
151
+ ids: localeIds,
152
+ requestQueue
153
+ });
154
+ }
155
+ }
152
156
  }
153
157
  result.tags = environment.getTags().then((response) => response.items).catch(() => {
154
158
  delete result.tags;
@@ -156,20 +160,24 @@ async function getDestinationData({
156
160
  if (contentModelOnly) {
157
161
  return import_bluebird.default.props(result);
158
162
  }
159
- const entryIds = sourceData.entries.map((e) => e.sys.id);
160
- const assetIds = sourceData.assets.map((e) => e.sys.id);
161
- result.entries = batchedIdQuery({
162
- environment,
163
- type: "entries",
164
- ids: entryIds,
165
- requestQueue
166
- });
167
- result.assets = batchedIdQuery({
168
- environment,
169
- type: "assets",
170
- ids: assetIds,
171
- requestQueue
172
- });
163
+ const entryIds = sourceData.entries?.map((e) => e.sys.id);
164
+ const assetIds = sourceData.assets?.map((e) => e.sys.id);
165
+ if (entryIds) {
166
+ result.entries = batchedIdQuery({
167
+ environment,
168
+ type: "entries",
169
+ ids: entryIds,
170
+ requestQueue
171
+ });
172
+ }
173
+ if (assetIds) {
174
+ result.assets = batchedIdQuery({
175
+ environment,
176
+ type: "assets",
177
+ ids: assetIds,
178
+ requestQueue
179
+ });
180
+ }
173
181
  result.webhooks = [];
174
182
  return import_bluebird.default.props(result);
175
183
  }
@@ -194,6 +202,8 @@ var ContentfulAssetError = class extends Error {
194
202
  this.filePath = filePath;
195
203
  }
196
204
  };
205
+ var ContentfulEntityError = class extends Error {
206
+ };
197
207
  var ContentfulMultiError = class extends Error {
198
208
  };
199
209
 
@@ -206,7 +216,10 @@ async function getAssetStreamForURL(url, assetsDirectory) {
206
216
  await stat(filePath);
207
217
  return import_fs.default.createReadStream(filePath);
208
218
  } catch (err) {
209
- const error = new ContentfulAssetError("Cannot open asset from filesystem", filePath);
219
+ const error = new ContentfulAssetError(
220
+ "Cannot open asset from filesystem",
221
+ filePath
222
+ );
210
223
  throw error;
211
224
  }
212
225
  }
@@ -214,7 +227,9 @@ async function processAssetForLocale(locale, asset, processingOptions) {
214
227
  try {
215
228
  return await asset.processForLocale(locale, processingOptions);
216
229
  } catch (err) {
217
- err.entity = asset;
230
+ if (err instanceof ContentfulEntityError) {
231
+ err.entity = asset;
232
+ }
218
233
  import_logging3.logEmitter.emit("error", err);
219
234
  throw err;
220
235
  }
@@ -333,12 +348,16 @@ async function createEntry({ entry, target, skipContentModel, destinationEntitie
333
348
  creationSuccessNotifier(operation, createdOrUpdatedEntry);
334
349
  return createdOrUpdatedEntry;
335
350
  } catch (err) {
336
- if (skipContentModel && err.name === "UnknownField") {
337
- const errors = (0, import_object.get)(JSON.parse(err.message), "details.errors");
338
- entry.transformed.fields = cleanupUnknownFields(entry.transformed.fields, errors);
339
- return createEntry({ entry, target, skipContentModel, destinationEntitiesById, requestQueue });
351
+ if (err instanceof Error) {
352
+ if (skipContentModel && err.name === "UnknownField") {
353
+ const errors = (0, import_object.get)(JSON.parse(err.message), "details.errors");
354
+ entry.transformed.fields = cleanupUnknownFields(entry.transformed.fields, errors);
355
+ return createEntry({ entry, target, skipContentModel, destinationEntitiesById, requestQueue });
356
+ }
357
+ }
358
+ if (err instanceof ContentfulEntityError) {
359
+ err.entity = entry;
340
360
  }
341
- err.entity = entry;
342
361
  import_logging4.logEmitter.emit("error", err);
343
362
  return null;
344
363
  }
@@ -443,7 +462,9 @@ async function archiveEntities({ entities, requestQueue }) {
443
462
  const archivedEntity = await entity2.archive();
444
463
  return archivedEntity;
445
464
  } catch (err) {
446
- err.entity = entity2;
465
+ if (err instanceof ContentfulEntityError) {
466
+ err.entity = entity2;
467
+ }
447
468
  import_logging5.logEmitter.emit("error", err);
448
469
  return null;
449
470
  }
@@ -462,7 +483,9 @@ async function runQueue(queue, result = [], requestQueue) {
462
483
  const publishedEntity = await requestQueue.add(() => entity.publish());
463
484
  publishedEntities.push(publishedEntity);
464
485
  } catch (err) {
465
- err.entity = entity;
486
+ if (err instanceof ContentfulEntityError) {
487
+ err.entity = entity;
488
+ }
466
489
  import_logging5.logEmitter.emit("error", err);
467
490
  }
468
491
  }
@@ -542,6 +565,9 @@ function pushToSpace({
542
565
  {
543
566
  title: "Importing Locales",
544
567
  task: (0, import_listr2.wrapTask)(async (ctx) => {
568
+ if (!destinationDataById.locales) {
569
+ return;
570
+ }
545
571
  const locales2 = await createLocales({
546
572
  context: { target: ctx.environment, type: "Locale" },
547
573
  entities: sourceData.locales,
@@ -555,6 +581,9 @@ function pushToSpace({
555
581
  {
556
582
  title: "Importing Content Types",
557
583
  task: (0, import_listr2.wrapTask)(async (ctx) => {
584
+ if (!destinationDataById.contentTypes) {
585
+ return;
586
+ }
558
587
  const contentTypes2 = await createEntities({
559
588
  context: { target: ctx.environment, type: "ContentType" },
560
589
  entities: sourceData.contentTypes,
@@ -580,13 +609,15 @@ function pushToSpace({
580
609
  {
581
610
  title: "Importing Tags",
582
611
  task: (0, import_listr2.wrapTask)(async (ctx) => {
583
- const tags2 = await createEntities({
584
- context: { target: ctx.environment, type: "Tag" },
585
- entities: sourceData.tags,
586
- destinationEntitiesById: destinationDataById.tags,
587
- requestQueue
588
- });
589
- ctx.data.tags = tags2;
612
+ if (sourceData.tags && destinationDataById.tags) {
613
+ const tags2 = await createEntities({
614
+ context: { target: ctx.environment, type: "Tag" },
615
+ entities: sourceData.tags,
616
+ destinationEntitiesById: destinationDataById.tags,
617
+ requestQueue
618
+ });
619
+ ctx.data.tags = tags2;
620
+ }
590
621
  }),
591
622
  // we remove `tags` from destination data if an error was thrown trying to access them
592
623
  // this means the user doesn't have access to this feature, skip importing tags
@@ -596,6 +627,9 @@ function pushToSpace({
596
627
  title: "Importing Editor Interfaces",
597
628
  task: (0, import_listr2.wrapTask)(async (ctx) => {
598
629
  const allEditorInterfacesBeingFetched = ctx.data.contentTypes.map(async (contentType) => {
630
+ if (!sourceData.editorInterfaces) {
631
+ return;
632
+ }
599
633
  const editorInterface = sourceData.editorInterfaces.find((editorInterface2) => {
600
634
  return editorInterface2.sys.contentType.sys.id === contentType.sys.id;
601
635
  });
@@ -611,7 +645,9 @@ function pushToSpace({
611
645
  const updatedEditorInterface = await requestQueue.add(() => ctEditorInterface.update());
612
646
  return updatedEditorInterface;
613
647
  } catch (err) {
614
- err.entity = editorInterface;
648
+ if (err instanceof ContentfulEntityError) {
649
+ err.entity = editorInterface;
650
+ }
615
651
  throw err;
616
652
  }
617
653
  });
@@ -658,6 +694,9 @@ function pushToSpace({
658
694
  {
659
695
  title: "Importing Assets",
660
696
  task: (0, import_listr2.wrapTask)(async (ctx) => {
697
+ if (!destinationDataById.assets) {
698
+ return;
699
+ }
661
700
  const assetsToProcess = await createEntities({
662
701
  context: { target: ctx.environment, type: "Asset" },
663
702
  entities: sourceData.assets,
@@ -738,6 +777,9 @@ function pushToSpace({
738
777
  {
739
778
  title: "Creating Web Hooks",
740
779
  task: (0, import_listr2.wrapTask)(async (ctx) => {
780
+ if (!sourceData.webhooks || !destinationDataById.webhooks) {
781
+ return;
782
+ }
741
783
  const webhooks2 = await createEntities({
742
784
  context: { target: ctx.space, type: "Webhook" },
743
785
  entities: sourceData.webhooks,
@@ -920,12 +962,14 @@ function sortLocales(locales2) {
920
962
  return sortByFallbackKey(localeByFallback);
921
963
  }
922
964
  function sortByFallbackKey(localeByFallback, key) {
923
- if (!localeByFallback[key]) {
965
+ if (!localeByFallback[`${key}`]) {
924
966
  return [];
925
967
  }
926
- const sortedLocales = localeByFallback[key];
968
+ const sortedLocales = localeByFallback[`${key}`];
927
969
  sortedLocales.forEach((locale) => {
928
- sortByFallbackKey(localeByFallback, locale.code).forEach((x) => sortedLocales.push(x));
970
+ sortByFallbackKey(localeByFallback, locale.code).forEach(
971
+ (x) => sortedLocales.push(x)
972
+ );
929
973
  });
930
974
  sortedLocales.forEach((locale) => {
931
975
  if (!locale.fallbackCode) {
package/dist/index.mjs CHANGED
@@ -113,22 +113,26 @@ async function getDestinationData({
113
113
  ...sourceData
114
114
  };
115
115
  if (!skipContentModel) {
116
- const contentTypeIds = sourceData.contentTypes.map((e) => e.sys.id);
117
- result.contentTypes = batchedIdQuery({
118
- environment,
119
- type: "contentTypes",
120
- ids: contentTypeIds,
121
- requestQueue
122
- });
123
- if (!skipLocales) {
124
- const localeIds = sourceData.locales.map((e) => e.sys.id);
125
- result.locales = batchedIdQuery({
116
+ const contentTypeIds = sourceData.contentTypes?.map((e) => e.sys.id);
117
+ if (contentTypeIds) {
118
+ result.contentTypes = batchedIdQuery({
126
119
  environment,
127
- type: "locales",
128
- ids: localeIds,
120
+ type: "contentTypes",
121
+ ids: contentTypeIds,
129
122
  requestQueue
130
123
  });
131
124
  }
125
+ if (!skipLocales) {
126
+ const localeIds = sourceData.locales?.map((e) => e.sys.id);
127
+ if (localeIds) {
128
+ result.locales = batchedIdQuery({
129
+ environment,
130
+ type: "locales",
131
+ ids: localeIds,
132
+ requestQueue
133
+ });
134
+ }
135
+ }
132
136
  }
133
137
  result.tags = environment.getTags().then((response) => response.items).catch(() => {
134
138
  delete result.tags;
@@ -136,20 +140,24 @@ async function getDestinationData({
136
140
  if (contentModelOnly) {
137
141
  return Promise2.props(result);
138
142
  }
139
- const entryIds = sourceData.entries.map((e) => e.sys.id);
140
- const assetIds = sourceData.assets.map((e) => e.sys.id);
141
- result.entries = batchedIdQuery({
142
- environment,
143
- type: "entries",
144
- ids: entryIds,
145
- requestQueue
146
- });
147
- result.assets = batchedIdQuery({
148
- environment,
149
- type: "assets",
150
- ids: assetIds,
151
- requestQueue
152
- });
143
+ const entryIds = sourceData.entries?.map((e) => e.sys.id);
144
+ const assetIds = sourceData.assets?.map((e) => e.sys.id);
145
+ if (entryIds) {
146
+ result.entries = batchedIdQuery({
147
+ environment,
148
+ type: "entries",
149
+ ids: entryIds,
150
+ requestQueue
151
+ });
152
+ }
153
+ if (assetIds) {
154
+ result.assets = batchedIdQuery({
155
+ environment,
156
+ type: "assets",
157
+ ids: assetIds,
158
+ requestQueue
159
+ });
160
+ }
153
161
  result.webhooks = [];
154
162
  return Promise2.props(result);
155
163
  }
@@ -174,6 +182,8 @@ var ContentfulAssetError = class extends Error {
174
182
  this.filePath = filePath;
175
183
  }
176
184
  };
185
+ var ContentfulEntityError = class extends Error {
186
+ };
177
187
  var ContentfulMultiError = class extends Error {
178
188
  };
179
189
 
@@ -186,7 +196,10 @@ async function getAssetStreamForURL(url, assetsDirectory) {
186
196
  await stat(filePath);
187
197
  return fs.createReadStream(filePath);
188
198
  } catch (err) {
189
- const error = new ContentfulAssetError("Cannot open asset from filesystem", filePath);
199
+ const error = new ContentfulAssetError(
200
+ "Cannot open asset from filesystem",
201
+ filePath
202
+ );
190
203
  throw error;
191
204
  }
192
205
  }
@@ -194,7 +207,9 @@ async function processAssetForLocale(locale, asset, processingOptions) {
194
207
  try {
195
208
  return await asset.processForLocale(locale, processingOptions);
196
209
  } catch (err) {
197
- err.entity = asset;
210
+ if (err instanceof ContentfulEntityError) {
211
+ err.entity = asset;
212
+ }
198
213
  logEmitter3.emit("error", err);
199
214
  throw err;
200
215
  }
@@ -313,12 +328,16 @@ async function createEntry({ entry, target, skipContentModel, destinationEntitie
313
328
  creationSuccessNotifier(operation, createdOrUpdatedEntry);
314
329
  return createdOrUpdatedEntry;
315
330
  } catch (err) {
316
- if (skipContentModel && err.name === "UnknownField") {
317
- const errors = get(JSON.parse(err.message), "details.errors");
318
- entry.transformed.fields = cleanupUnknownFields(entry.transformed.fields, errors);
319
- return createEntry({ entry, target, skipContentModel, destinationEntitiesById, requestQueue });
331
+ if (err instanceof Error) {
332
+ if (skipContentModel && err.name === "UnknownField") {
333
+ const errors = get(JSON.parse(err.message), "details.errors");
334
+ entry.transformed.fields = cleanupUnknownFields(entry.transformed.fields, errors);
335
+ return createEntry({ entry, target, skipContentModel, destinationEntitiesById, requestQueue });
336
+ }
337
+ }
338
+ if (err instanceof ContentfulEntityError) {
339
+ err.entity = entry;
320
340
  }
321
- err.entity = entry;
322
341
  logEmitter4.emit("error", err);
323
342
  return null;
324
343
  }
@@ -423,7 +442,9 @@ async function archiveEntities({ entities, requestQueue }) {
423
442
  const archivedEntity = await entity2.archive();
424
443
  return archivedEntity;
425
444
  } catch (err) {
426
- err.entity = entity2;
445
+ if (err instanceof ContentfulEntityError) {
446
+ err.entity = entity2;
447
+ }
427
448
  logEmitter5.emit("error", err);
428
449
  return null;
429
450
  }
@@ -442,7 +463,9 @@ async function runQueue(queue, result = [], requestQueue) {
442
463
  const publishedEntity = await requestQueue.add(() => entity.publish());
443
464
  publishedEntities.push(publishedEntity);
444
465
  } catch (err) {
445
- err.entity = entity;
466
+ if (err instanceof ContentfulEntityError) {
467
+ err.entity = entity;
468
+ }
446
469
  logEmitter5.emit("error", err);
447
470
  }
448
471
  }
@@ -522,6 +545,9 @@ function pushToSpace({
522
545
  {
523
546
  title: "Importing Locales",
524
547
  task: wrapTask(async (ctx) => {
548
+ if (!destinationDataById.locales) {
549
+ return;
550
+ }
525
551
  const locales2 = await createLocales({
526
552
  context: { target: ctx.environment, type: "Locale" },
527
553
  entities: sourceData.locales,
@@ -535,6 +561,9 @@ function pushToSpace({
535
561
  {
536
562
  title: "Importing Content Types",
537
563
  task: wrapTask(async (ctx) => {
564
+ if (!destinationDataById.contentTypes) {
565
+ return;
566
+ }
538
567
  const contentTypes2 = await createEntities({
539
568
  context: { target: ctx.environment, type: "ContentType" },
540
569
  entities: sourceData.contentTypes,
@@ -560,13 +589,15 @@ function pushToSpace({
560
589
  {
561
590
  title: "Importing Tags",
562
591
  task: wrapTask(async (ctx) => {
563
- const tags2 = await createEntities({
564
- context: { target: ctx.environment, type: "Tag" },
565
- entities: sourceData.tags,
566
- destinationEntitiesById: destinationDataById.tags,
567
- requestQueue
568
- });
569
- ctx.data.tags = tags2;
592
+ if (sourceData.tags && destinationDataById.tags) {
593
+ const tags2 = await createEntities({
594
+ context: { target: ctx.environment, type: "Tag" },
595
+ entities: sourceData.tags,
596
+ destinationEntitiesById: destinationDataById.tags,
597
+ requestQueue
598
+ });
599
+ ctx.data.tags = tags2;
600
+ }
570
601
  }),
571
602
  // we remove `tags` from destination data if an error was thrown trying to access them
572
603
  // this means the user doesn't have access to this feature, skip importing tags
@@ -576,6 +607,9 @@ function pushToSpace({
576
607
  title: "Importing Editor Interfaces",
577
608
  task: wrapTask(async (ctx) => {
578
609
  const allEditorInterfacesBeingFetched = ctx.data.contentTypes.map(async (contentType) => {
610
+ if (!sourceData.editorInterfaces) {
611
+ return;
612
+ }
579
613
  const editorInterface = sourceData.editorInterfaces.find((editorInterface2) => {
580
614
  return editorInterface2.sys.contentType.sys.id === contentType.sys.id;
581
615
  });
@@ -591,7 +625,9 @@ function pushToSpace({
591
625
  const updatedEditorInterface = await requestQueue.add(() => ctEditorInterface.update());
592
626
  return updatedEditorInterface;
593
627
  } catch (err) {
594
- err.entity = editorInterface;
628
+ if (err instanceof ContentfulEntityError) {
629
+ err.entity = editorInterface;
630
+ }
595
631
  throw err;
596
632
  }
597
633
  });
@@ -638,6 +674,9 @@ function pushToSpace({
638
674
  {
639
675
  title: "Importing Assets",
640
676
  task: wrapTask(async (ctx) => {
677
+ if (!destinationDataById.assets) {
678
+ return;
679
+ }
641
680
  const assetsToProcess = await createEntities({
642
681
  context: { target: ctx.environment, type: "Asset" },
643
682
  entities: sourceData.assets,
@@ -718,6 +757,9 @@ function pushToSpace({
718
757
  {
719
758
  title: "Creating Web Hooks",
720
759
  task: wrapTask(async (ctx) => {
760
+ if (!sourceData.webhooks || !destinationDataById.webhooks) {
761
+ return;
762
+ }
721
763
  const webhooks2 = await createEntities({
722
764
  context: { target: ctx.space, type: "Webhook" },
723
765
  entities: sourceData.webhooks,
@@ -900,12 +942,14 @@ function sortLocales(locales2) {
900
942
  return sortByFallbackKey(localeByFallback);
901
943
  }
902
944
  function sortByFallbackKey(localeByFallback, key) {
903
- if (!localeByFallback[key]) {
945
+ if (!localeByFallback[`${key}`]) {
904
946
  return [];
905
947
  }
906
- const sortedLocales = localeByFallback[key];
948
+ const sortedLocales = localeByFallback[`${key}`];
907
949
  sortedLocales.forEach((locale) => {
908
- sortByFallbackKey(localeByFallback, locale.code).forEach((x) => sortedLocales.push(x));
950
+ sortByFallbackKey(localeByFallback, locale.code).forEach(
951
+ (x) => sortedLocales.push(x)
952
+ );
909
953
  });
910
954
  sortedLocales.forEach((locale) => {
911
955
  if (!locale.fallbackCode) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentful-import",
3
- "version": "9.2.2",
3
+ "version": "9.3.0",
4
4
  "description": "this tool allows you to import JSON dump exported by contentful-export",
5
5
  "main": "dist/index.mjs",
6
6
  "typings": "dist/index.d.ts",
@@ -19,9 +19,10 @@
19
19
  },
20
20
  "scripts": {
21
21
  "build": "tsup",
22
- "build:watch": "babel lib --out-dir dist --watch",
23
22
  "clean": "rimraf dist && rimraf coverage",
24
- "lint": "eslint lib bin/contentful-import test && tsc",
23
+ "lint": "npm run lint:main && npm run lint:tests",
24
+ "lint:main": "eslint lib bin/contentful-import && tsc --project tsconfig.json",
25
+ "lint:tests": "eslint test && tsc --project tsconfig.test.json",
25
26
  "pretest": "npm run lint && npm run build",
26
27
  "test": "npm run test:unit && npm run test:integration",
27
28
  "test:unit": "jest --testPathPattern=test/unit --runInBand --coverage",
@@ -30,18 +31,7 @@
30
31
  "test:integration": "jest --testPathPattern=test/integration",
31
32
  "test:integration:debug": "node --inspect-brk ./node_modules/.bin/jest --runInBand --watch --testPathPattern=test/integration",
32
33
  "test:integration:watch": "npm run test:integration -- --watch",
33
- "test:simulate-ci": "trevor",
34
- "browser-coverage": "npm run test:cover && opener coverage/lcov-report/index.html",
35
34
  "semantic-release": "semantic-release",
36
- "devmanage:build": "pushd ../contentful-management.js && npm run build && popd",
37
- "devmanage:clean": "pushd ../contentful-management.js && npm run clean && popd",
38
- "devmanage:install": "npm run devmanage:build && rm -rf node_modules/contentful-management.js && npm install ../contentful-management.js && npm run devmanage:clean",
39
- "devmanage:uninstall": "npm run devmanage:clean && rimraf node_modules/contentful-management.js",
40
- "devdep:build": "pushd ../contentful-batch-libs && npm run build && popd",
41
- "devdep:clean": "pushd ../contentful-batch-libs && npm run clean && popd",
42
- "devdep:install": "npm run devdep:build && rm -rf node_modules/contentful-batch-libs && npm install ../contentful-batch-libs && npm run devdep:clean",
43
- "devdep:uninstall": "npm run devdep:clean && rimraf node_modules/contentful-batch-libs",
44
- "precommit": "npm run lint",
45
35
  "prepush": "npm run test:unit"
46
36
  },
47
37
  "repository": {
@@ -86,10 +76,6 @@
86
76
  "yargs": "^17.7.2"
87
77
  },
88
78
  "devDependencies": {
89
- "@babel/cli": "^7.23.0",
90
- "@babel/core": "^7.23.0",
91
- "@babel/plugin-proposal-object-rest-spread": "^7.20.7",
92
- "@babel/preset-env": "^7.22.20",
93
79
  "@types/jest": "^29.5.5",
94
80
  "@types/node": "^20.6.3",
95
81
  "@typescript-eslint/eslint-plugin": "^6.7.4",
@@ -103,7 +89,6 @@
103
89
  "eslint-plugin-node": "^11.1.0",
104
90
  "eslint-plugin-promise": "^6.1.1",
105
91
  "eslint-plugin-standard": "^5.0.0",
106
- "husky": "^8.0.3",
107
92
  "jest": "^29.7.0",
108
93
  "rimraf": "^5.0.5",
109
94
  "semantic-release": "^19.0.5",