-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
chore(platform): Extract relay into separate services #2823
Conversation
4009b81
to
88c8890
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to consider adding email
prefix to the relay workers.
The message forwarding is a neat trick probably taking care of a few
things along the way.
throw new BadRequestError({ | ||
message: `Could not find hidden address ${input.maskedEmail}`, | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could it be a NotFoundError
instead if the masked email doesn't have
a source account? The reason is any masked email account must have a
source account. It'd mean that masked address actually doesn't exist
in this case.
"scripts": { | ||
"build": "wrangler publish --dry-run --outdir=dist", | ||
"test": "echo \"Error: no test specified\" && exit 0", | ||
"dev:wrangler": "wrangler dev ", | ||
"dev": "run-p 'dev:*'", | ||
"deploy": "wrangler publish" | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be better to have same set of utility scripts for checks.
) as [string, string][] | ||
|
||
const envKeyPair = distEmailEntries.filter( | ||
([distributorEnvPrefix, _]) => distributorEnvPrefix === envPrefix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't know about array destructuring in arrow function parameter
list. Nice.
const sourceAccountURN = await node.storage.get<AccountURN>('source-account') | ||
if (!sourceAccountURN) | ||
throw new BadRequestError({ | ||
message: `Could not find hidden address ${input.maskedEmail}`, | ||
}) | ||
|
||
const sourceAccountNode = initAccountNodeByName( | ||
sourceAccountURN, | ||
ctx.env.Account | ||
) | ||
|
||
const name = (await sourceAccountNode.class.getNickname()) || '' | ||
const address = await sourceAccountNode.class.getAddress() | ||
|
||
if (!address) | ||
throw new InternalServerError({ | ||
message: `Could not find source address for masked email ${input.maskedEmail}`, | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to make this a wrapper for
account.getSourceAccount
procedure with implementing additional
checks that might be missing in getSourceAccount
and
EmailAccount.getSource
methods.
This would be a breaking change, right? |
Description
Splits the relay logic into a singleton distributor service and env-specific processor services. Creates new-patterned masked emails for existing masks, if they get re-authorized.
Related Issues
Testing
Checklist