Skip to content

fix: device attributes type #14520

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

Merged
merged 4 commits into from
Aug 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/auth/src/providers/cognito/types/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
AWSAuthUser,
AuthCodeDeliveryDetails,
AuthDevice,
AuthUserAttribute,
} from '../../../types';
import { AuthProvider } from '../../../types/inputs';

Expand Down Expand Up @@ -89,11 +88,15 @@ export type AutoSignInEventData =
| {
event: 'autoSignIn';
};

type DeviceAttributeKey = 'device_status' | 'device_name' | 'last_ip_used';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @soberm for looking into this so quickly. It looks like this may not be the full list of predefined attributes (based on the existing type). There also seem to be some custom attributes involved. Could you double check this with the reviewers?

export type UserAttributeKey = AuthStandardAttributeKey | CustomAttribute;

export type AuthStandardAttributeKey =

export type CustomAttribute = string & NonNullable<unknown>;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @kturczyski-lz, will double check but the previous type mistakenly used UserAttributes and not DeviceAttributes which are different.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, yeah, sorry, I actually see only those 3 keys in the result. I assumed the old type wasn’t simply ported to the new structure.


/**
* Holds the device specific information along with it's id and name.
*/
export type AWSAuthDevice = AuthDevice & {
attributes: AuthUserAttribute<UserAttributeKey>;
attributes: Partial<Record<DeviceAttributeKey, string>> &
Record<string, string>;
createDate?: Date;
lastAuthenticatedDate?: Date;
lastModifiedDate?: Date;
Expand Down
Loading