-
Notifications
You must be signed in to change notification settings - Fork 391
fix(auth): Address several auth typing inconsistencies #993
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
Conversation
(1) Typings are correct the way this is currently implemented. Perhaps we should just drop that field in the implementation type. |
src/auth.d.ts
Outdated
/** | ||
* The ability for SAML provider to perform request signing. | ||
*/ | ||
enableRequestSigning?: boolean; |
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.
We don't currently support this. I think we should remove it. I think we need the flexibility to have internal implementations not exposed externally. Many SDKs with auto-generated references already have the ability to set visibility on some APIs and attributes.
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.
FWIW, there's no built-in mechanism in TypeScript to hide members of an interface. Any library that's doing so is either using third-party tools or some sort of a hack. So we will have to do the same here (@MathBunny the undocumented --stripInternal
flag is probably our best bet here).
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.
Thanks, I agree. I verified the @internal
option and it worked as intended (updated the respective PR).
src/auth.d.ts
Outdated
* Whether the SAML provider can sign requests. If not provided, the existing | ||
* configuration's value is not modified. | ||
*/ | ||
enableRequestSigning?: boolean; |
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
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.
LGTM
During my work for refactoring auth to auto-generate typings I came across several inconsistencies in source and typing files. I'm not sure how to best address them or which require changes, but I did an attempt here.
1.
auth.ts
Observation: The
tenant
field is defined at the root of the object in the source while it's in thefirebase
scope in the typings.Source:
firebase-admin-node/src/auth/auth.ts
Lines 88 to 112 in 5e6ebfa
Typing:
firebase-admin-node/src/auth.d.ts
Lines 456 to 491 in e415188
2.
auth-config.ts
Observation: The
SAMLAuthProviderConfig
contains anenableRequestSigning
in the source which is absent in typings.Source:
firebase-admin-node/src/auth/auth-config.ts
Lines 42 to 50 in 5e6ebfa
Typing:
firebase-admin-node/src/auth.d.ts
Lines 1139 to 1177 in e415188
As an extension, a similar pattern can be found here for
SAMLAuthProviderConfig
:firebase-admin-node/src/auth/auth-config.ts
Lines 118 to 128 in 5e6ebfa
3.
user-import-builder.ts
Observation: The
tenantId
forUserImportRecord
is nullable in typings but not source.Source:
firebase-admin-node/src/auth/user-import-builder.ts
Lines 64 to 82 in 5e6ebfa
Typing:
firebase-admin-node/src/auth.d.ts
Lines 816 to 823 in e415188
4.
auth-config.ts
Observation: As a consequence from the third point, the
tenantId
field is nullable in one case so it should be propagated.Source:
firebase-admin-node/src/auth/user-import-builder.ts
Lines 95 to 118 in 5e6ebfa
firebase-admin-node/src/auth/user-import-builder.ts
Lines 216 to 229 in 5e6ebfa
This would be a compilation error:
5.
user-record.ts
The typings have
displayName
andenrollmentTime
as optional while not in the source.Source:
firebase-admin-node/src/auth/user-record.ts
Lines 149 to 153 in 5e6ebfa
Typing:
firebase-admin-node/src/auth.d.ts
Lines 80 to 106 in e415188