Loading workspace insights... Statistics interval
7 days30 daysLatest CI Pipeline Executions
11023d46 Required a custom fields service on MemberBREADService
MemberBREADService's add() guarded its call into the custom fields service on
the request body carrying a custom_fields key. The custom fields service is a
required dependency of the members service, and boot constructs it before the
members service, so an instance without one cannot exist in a running Ghost
and the guard was protecting a state that cannot occur. The dependency is now
also inverted: the members service previously received the custom fields
module namespace and reached through it as customFieldsService.values on
every call, which meant depending on a module-level binding that is undefined
until init() runs, so it takes the values service itself as customFieldValues,
resolved once in services/members/api.js at construction. Custom fields is
initialised in initCore and the members API is built in initServices, so
construction is where boot order is expressed rather than each call site
late-binding through a namespace. The hand-written typedef restating the
service's shape is replaced by a reference to the real exported
CustomFieldValuesService type, matching how memberRepository and offersAPI are
already typed in that file, because a restated structural typedef can drift
from the service it describes and an imported one cannot. The unit fixtures
previously built a service that could not exist in production, and now build
it the way boot does, sharing a single stub so the factories in that file
cannot drift apart. Nothing enforces the dependency at runtime, because a
dependency that cannot be absent does not need a guard; making it non-optional
in the type system belongs with converting the file to TypeScript. No
behaviour change for any request. 11023d46 Required a custom fields service on MemberBREADService
MemberBREADService's add() guarded its call into the custom fields service on
the request body carrying a custom_fields key. The custom fields service is a
required dependency of the members service, and boot constructs it before the
members service, so an instance without one cannot exist in a running Ghost
and the guard was protecting a state that cannot occur. The dependency is now
also inverted: the members service previously received the custom fields
module namespace and reached through it as customFieldsService.values on
every call, which meant depending on a module-level binding that is undefined
until init() runs, so it takes the values service itself as customFieldValues,
resolved once in services/members/api.js at construction. Custom fields is
initialised in initCore and the members API is built in initServices, so
construction is where boot order is expressed rather than each call site
late-binding through a namespace. The hand-written typedef restating the
service's shape is replaced by a reference to the real exported
CustomFieldValuesService type, matching how memberRepository and offersAPI are
already typed in that file, because a restated structural typedef can drift
from the service it describes and an imported one cannot. The unit fixtures
previously built a service that could not exist in production, and now build
it the way boot does, sharing a single stub so the factories in that file
cannot drift apart. Nothing enforces the dependency at runtime, because a
dependency that cannot be absent does not need a guard; making it non-optional
in the type system belongs with converting the file to TypeScript. No
behaviour change for any request.