-
Notifications
You must be signed in to change notification settings - Fork 63
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: convert lib/sandboxes and sandboxSync to TS #1328
base: main
Are you sure you want to change the base?
Conversation
lib/sandboxes.ts
Outdated
'error' in err && | ||
err.error instanceof Error |
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 this if statement might be unreachable code. if the isSpecifiedError
is true, it is a HubSpotHttpError
which doesn't have a error
member on it
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.
Gotcha, I wasn't sure if we always knew the shape of HubSpotHttpError
s
* @param {Boolean} skipPrompt - Option to skip contact records prompt and return all available sync tasks | ||
* @returns {Array} Adjusted available sync task items | ||
*/ | ||
const getSyncTypesWithContactRecordsPrompt = async ( |
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.
This function wasn't being used anywhere
accountName: name, | ||
parentAccountName: uiAccountDescription(accountId), | ||
accountId, | ||
}) | ||
); | ||
logger.log(''); | ||
} else if ( |
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.
From what I can tell, all this code was unreachable. These cases were being handled ahead of time in validateSandboxUsageLimits
commands/sandbox/create.ts
Outdated
: typePrompt.type; | ||
|
||
// Check usage limits and exit if parent portal has no available sandboxes for the selected type | ||
try { | ||
console.log('validate usage limit'); |
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.
Leftover debugging log
lib/sandboxes.ts
Outdated
const id = getAccountIdentifier(accountConfig); | ||
const accountId = getAccountId(id); | ||
|
||
if (!accountId) { | ||
throw new Error(`${i18nKey}.create.failure.usageLimitFetch`); |
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.
This log needs the i18n()
function
lib/sandboxes.ts
Outdated
const { | ||
data: { usage }, | ||
} = await getSandboxUsageLimits(accountId); | ||
if (!usage) { | ||
throw new Error('Unable to fetch sandbox usage limits. Please try again.'); | ||
throw new Error(`${i18nKey}.create.failure.usageLimitFetch`); |
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.
Same here with i18n()
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.
Ooh good catch on these!
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.
Tested locally and everything lgtm 👍
Description and Context
This converts lib/sandboxes and lib/sandboxSync to TS
Who to Notify
@brandenrodgers @kemmerle @joe-yeager