feat(registry): add dataProvider.enabled config option - #1535
Merged
Conversation
Introduces a `dataProvider` namespace in the registry configuration with an `enabled` flag (default `true`). When set to `false`, the registry never fetches nor runs a component's `server.js`, even when one exists in the storage: every component is served through the same path already used by components that ship no data provider, with the request parameters passed through as the view model. The option is namespaced rather than flat so that the planned global fallback handler and data provider middleware can be added alongside it without a deprecation cycle.
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a
dataProvidernamespace to the registry configuration with anenabledflag (defaulttrue):When
enabledisfalse, the registry never fetches nor runs a component'sserver.js, even if one exists in the storage. Every component is served through the same path already used by components that ship no data provider: the request parameters are passed straight through as the view model, with_staticPath,_baseUrl,_componentNameand_componentVersionappended.Why namespaced rather than a flat boolean
Two related features are planned: a global fallback handler (logic injected for components that have no data provider, or when they're all disabled) and middleware wrapping whichever provider ends up running. Nesting now means those land as
dataProvider.fallbackanddataProvider.middlewarewithout a deprecation cycle — the sanitiser already carries shims fors3anddiscoveryand this avoids adding a third.serverwas deliberately avoided as a name: it is already taken by the HTTP server adapter config (server: { adapter, options }).dataProvideris also the term the codebase already uses (component.oc.files.dataProvider).Changes
src/types.ts—dataProvider: { enabled: boolean }onConfig.src/registry/domain/options-sanitiser.ts—RegistryOptionsoverrides it with an all-optional form (same pattern asdiscovery); default applied by spreading the user object so future keys survive.src/registry/domain/validators/registry-configuration.ts— signature accepts the pre-sanitised shape.src/registry/routes/helpers/get-component.ts— the existing "no data provider" branch now also triggers when the option is off.The check is
conf.dataProvider?.enabled === falserather than!conf.dataProvider?.enabled, because an absentdataProvidermust continue to mean enabled for any config object built without going through the sanitiser.Behaviour note
The props-only path emits
data = { component: { props: {...} } }, not bare props. That is pre-existing behaviour for components without aserver.js, but it does mean a view written against aserver.jsmodel sees a different shape once the option is flipped on an existing registry.Tests
registry-domain-options-sanitiser— default is{ enabled: true }; explicitfalseis preserved; a partial object is filled in.registry-routes-component— a component that does declare aserver.jsreturns 200, never callsrepository.getDataProvider, and yields the request parameters as the model.961 unit tests passing, lint and typecheck clean.