-
Notifications
You must be signed in to change notification settings - Fork 262
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
poc: Light idx factory for SIW gen3 #1460
Conversation
75f4532
to
f6eb338
Compare
a418ee9
to
0479e1e
Compare
5555ddd
to
8cac08e
Compare
@@ -1,6 +1,5 @@ | |||
import { warn, split2 } from '../util'; | |||
import * as remediators from './remediators'; | |||
import { RemediationValues, Remediator, RemediatorConstructor } from './remediators'; | |||
import { RemediationValues, Remediator, RemediatorConstructor } from './remediators/Base/Remediator'; |
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.
Just curious, what kind of size savings does this pattern of changing the path to a specific file rather than importing the barrel file yield? Does ESM tree shaking not take care of this?
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.
You are right. Changes like this don't make size savings for ESM bundle.
When I added idx-lite
CDN bundle in first commits, these changes reduced CDN bundle size.
|
||
// Factory | ||
export function createIdxAPI(sdk: OktaAuthIdxInterface): IdxAPI { | ||
const boundStartTransaction = startTransaction.bind(null, sdk); | ||
const baseApi = createBaseIdxAPI(sdk); |
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 understand the pattern being established here, however it adds complexity to an already complex pattern. I'd prefer this file to not change at all and
import { createBaseIdxAPI } from './baseApi';
become something like minimalApi
, where api
and minimalApi
would have redundant export statements and these mixins/factories would be completely isolated from each other. (The goal being to simply the factory/mixin pattern)
isTransactionMetaValid, | ||
saveTransactionMeta | ||
} from '../transactionMeta'; | ||
import { FlowIdentifier, BaseIdxAPI, OktaAuthIdxInterface, FlowSpecification } from '../types'; |
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.
See comment on /factory/api, but I am imaging this file as
import { FlowIdentifier, BaseIdxAPI, OktaAuthIdxInterface, FlowSpecification } from '../types'; | |
import { FlowIdentifier, MinimalIDXAPI, MinimalOAuthInterfaceForIDX, FlowSpecification } from '../types'; | |
export function createMinimalIdxAPI(sdk: MinimalOAuthInterfaceForIDX): MinimalIDXAPI { |
@@ -115,7 +114,7 @@ export function getAvailableSteps( | |||
): NextStep[] { | |||
const res: NextStep[] = []; | |||
|
|||
const remediatorMap: Record<string, RemediatorConstructor> = Object.values(remediators) | |||
const remediatorMap: Record<string, RemediatorConstructor> = Object.values(authClient.idx.allRemediators) |
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 understand why this is being done, but I am very wary of adding this map to the idx client itself. This then become part of the public contract and customers will start interfacing with it, which we really don't want them to
c6cb617
to
5ab8355
Compare
5ab8355
to
1d699f3
Compare
OKTA-656620
Changes:
TokenManager
and unnecessary API methods likestoreTokensFromRedirect
,signInWithRedirect
,isAuthenticated
,revokeAccessToken
,revokeRefreshToken
,signOut
mixinBaseOAuth
interact
,introspect
,poll
etc.createBaseIdxAPI
to constructauthClient.idx
allRemediators
andgetFlowSpecification
intoauthClient.idx
. IncreateIdxAPI()
it's initialized by importing from 'lib/idx/remediators' andlib/idx/flow
, increateBaseIdxAPI()
it's initialized with empty objects.mixinBaseOAuth
andmixinBaseIdx
to core, resulted light-weight class can be used by SIW gen3Size comparison:
Webpack bundle analyzer:
Before:
After:
siw-next-bundle-analyze.zip
Downstream to SIW:
https://github.com/okta/okta-signin-widget/compare/master...od-test-bundle-idx-lite
https://bacon-go.aue1e.saasure.net/commits?artifact=okta-signin-widget&branch=od-test-bundle-idx-lite&page=1&pageSize=6&tab=main