contentful-import 10.2.3 → 10.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
@@ -163,6 +163,14 @@ Skip updating existing content
163
163
 
164
164
  Skips content publishing. Creates content but does not publish it
165
165
 
166
+ #### `unpublishDraftLocales` [boolean] [default: false]
167
+
168
+ Unpublish locales that the content file marks as `draft` but that are still published in the destination.
169
+
170
+ Per-locale publishing is additive, so importing can add published locales but cannot demote one on its own. This only matters when importing over content that is already published — for a fresh import into a clean environment it makes no difference. Enable it to make repeated imports converge on exactly the state in the content file.
171
+
172
+ Note that this lets an import **unpublish** content in the destination, which is why it is opt-in.
173
+
166
174
  ### Assets
167
175
 
168
176
  #### `uploadAssets` [boolean] [default: false]
@@ -333,6 +341,7 @@ An entity that's published in the source is published in the destination on impo
333
341
  - Publishing strategy:
334
342
  - If an entity is in draft, it will be created as draft in the destination space.
335
343
  - If an entity is published and has pending changes (updated) in the source space, it will be published with the latest changes in the destination space.
344
+ - If an entry or asset was published for only some of its locales, only those locales are published in the destination space. This is read from `sys.fieldStatus` in the content file, which `contentful-export` writes automatically — existing export files already contain it, so no re-export is needed. Content files without `sys.fieldStatus` are published as a whole, as before.
336
345
 
337
346
  ## :warning: Limitations
338
347
 
@@ -342,6 +351,11 @@ An entity that's published in the source is published in the destination on impo
342
351
  - Imported webhooks with credentials will be imported as normal webhooks. Credentials should be added manually afterwards.
343
352
  - Imported webhooks with secret headers will be imported without these headers. Secret headers should be added manuall afterwards.
344
353
  - If you have custom UI extensions, you need to reinstall them manually in the new space.
354
+ - Per-locale publish state is restored, with three caveats:
355
+ - The destination has to support [locale-based publishing](https://www.contentful.com/help/localization/locale-based-publishing/), which means two things: the organization is entitled to it (it is not on every plan), and the destination environment has "Locale-based (un)publishing" selected under **Settings > Locales > Publishing options** — the default is "Publish all locales". The import checks the entitlement up front and detects an environment that publishes whole entities anyway, and in either case logs a warning and falls back to publishing every locale, exactly as it did before this feature. The import itself does not fail.
356
+ - A locale that was `changed` in the source space (published, with newer draft edits on top) is imported as `published`. Reconstructing `changed` needs two separate writes, which an import cannot express.
357
+ - Locale-scoped publishing only adds published locales. If an entry in the destination space is already published for a locale that should be draft, that locale stays published by default — importing into a clean environment is unaffected. Set [`unpublishDraftLocales`](#unpublishdraftlocales-boolean-default-false) to demote those locales as well.
358
+ - Locales that are published in the source space but do not exist in the destination environment are skipped. If none of an entity's published locales exist in the destination, the entity is left unpublished and a warning is logged.
345
359
 
346
360
  ## :memo: Changelog
347
361
 
package/dist/index.d.mts CHANGED
@@ -8,6 +8,7 @@ type RunContentfulImportParams = {
8
8
  skipContentModel?: boolean;
9
9
  skipLocales?: boolean;
10
10
  skipContentPublishing?: boolean;
11
+ unpublishDraftLocales?: boolean;
11
12
  skipAssetUpdates?: boolean;
12
13
  skipContentUpdates?: boolean;
13
14
  uploadAssets?: boolean;
package/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@ type RunContentfulImportParams = {
8
8
  skipContentModel?: boolean;
9
9
  skipLocales?: boolean;
10
10
  skipContentPublishing?: boolean;
11
+ unpublishDraftLocales?: boolean;
11
12
  skipAssetUpdates?: boolean;
12
13
  skipContentUpdates?: boolean;
13
14
  uploadAssets?: boolean;