Conversation
b796c1a to
1d6106b
Compare
|
|
||
| interface DomainTemplateResult { | ||
| template: Template | null; | ||
| brandId?: string; |
There was a problem hiding this comment.
could you please explain the reasoning of extending this interface ?
There was a problem hiding this comment.
It's odd - left from the previous implementation. I will remove it
| return {}; | ||
| } | ||
| if (typeof props === 'string') { | ||
| return JSON.parse(props) as DomainProps; |
There was a problem hiding this comment.
very rude we can use typeguard here
|
|
||
| scope | ||
| .get(include.api.route) | ||
| .matchHeader('x-request-brand', 'spaceship') |
There was a problem hiding this comment.
what is x-request-brand mean ?
There was a problem hiding this comment.
x-request-brand passes brand context from registry to include endpoints.
There was a problem hiding this comment.
x-ilc-request-brand ?
or something like that
There was a problem hiding this comment.
renamed to x-ilc-request-brand
| template = await getTemplateByDomain(String(domain), templateName); | ||
| const domainItem = await getDomainByName(domain); | ||
| if (domainItem) { | ||
| const domainProps = domainItem.props ? (parseJSON(domainItem.props) as Record<string, any>) : null; |
There was a problem hiding this comment.
This function accepts generic, and also prefer unknown over any
Coverage ReportIlc/serverCommit SHA:1e0fe1e16d65bb66c0eebc1cae06fc4680b5b761 Test coverage results 🧪File details
Ilc/clientCommit SHA:1e0fe1e16d65bb66c0eebc1cae06fc4680b5b761 Test coverage results 🧪File details
RegistryCommit SHA:1e0fe1e16d65bb66c0eebc1cae06fc4680b5b761 Test coverage results 🧪File details
|
Summary
Motivation
The original approach added a dedicated brandId column to router_domains, propagated it through SDK options, config injection, header filtering, and request fragments.
This was simplified to use the existing props JSON field on router_domains (e.g. props: { brandId: "spaceship" }), which:
into app configs (existing transformConfig.ts behavior)
The only place that needed explicit brandId extraction is template include fetching, where the registry sends x-request-brand header to include endpoints so they can return brand-specific content.
Changes
ILC (template caching & domain routing):
different routes use the same template
Registry (brand context for includes):
still get brand context