Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to disable link resolution for sync #2276

Open
MrNeilRobbins opened this issue Jul 9, 2024 · 0 comments
Open

Unable to disable link resolution for sync #2276

MrNeilRobbins opened this issue Jul 9, 2024 · 0 comments

Comments

@MrNeilRobbins
Copy link

Expected Behavior

sync should support both link resolution on and off.

Actual Behavior

withoutLinkResolution is always false when calling sync. This value appears to be hardcoded along with withAllLocales and withoutUnresolvableLinks.

These configuration values cannot be overridden because the default options takes precedent over the syncOptions being passed to the function. https://github.com/contentful/contentful.js/blob/master/lib/create-contentful-api.ts#L422-L424

Possible Solution

  1. Remove validateResolveLinksParam() so { resolveLinks: false } can be passed as an option

  2. OR swap order of options that combineOptions and change the type of argument syncOptions to be SyncOptions | ChainOptions

const combinedOptions = {
      ...options,
      ...syncOptions,
    }

Steps to Reproduce

Unable to disable link resolution when calling sync

const client = createClient({
      accessToken,
      environment,
      host,
      responseLogger,
      space
    }).withAllLocales.withoutLinkResolution;
const collection = await clientApi.sync({
      initial: true,
      limit: 1000
    })

Context

I don't need the entry links resolved when syncing. I'm upgrading from v9 to v10, and this is a breaking change. This downloads a lot more data then is needed. If this is not fixed, I'll need to transform the data to remove the resolved links to convert them to unresolved links.

Environment

  • Language Version: v18.20.0
  • Package Manager Version: 10.5.0
  • Operating System: Darwin 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000 arm6
  • Package Version: "contentful": "10.12.4"
  • Which API are you using?: <Delivery / Preview -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant