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
-
Remove validateResolveLinksParam() so { resolveLinks: false } can be passed as an option
-
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 -->
Expected Behavior
syncshould support both link resolution on and off.Actual Behavior
withoutLinkResolutionis always false when callingsync. This value appears to be hardcoded along withwithAllLocalesandwithoutUnresolvableLinks.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
Remove validateResolveLinksParam() so { resolveLinks: false } can be passed as an option
OR swap order of options that combineOptions and change the type of argument
syncOptionsto beSyncOptions | ChainOptionsSteps to Reproduce
Unable to disable link resolution when calling
syncContext
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