Skip to content
Merged
Show file tree
Hide file tree
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
42 changes: 21 additions & 21 deletions src/custom-token-exchange/v1/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,18 +251,18 @@ type CustomTokenExchangeV1Event = {
subject_token_type: string;
};
};
/** An object containing the user profile attributes to set. */
type SetUserByConnectionOptions = {
/** Behaviour to apply if no user with the specified user_id exists in the connection. Can be 'create_if_not_exists', which will cause a new user to be created using the supplied user attributes; or 'none', which will result in no user being created and an error being returned if no user exists. */
/** Options to control the behavior of the setUserByConnection command. */
type CustomTokenExchangeSetUserByConnectionOptions = {
/** Behavior to apply if no user with the specified user_id exists in the connection. */
creationBehavior: 'create_if_not_exists' | 'none';
/** Behaviour to apply if a user with specified user_id already exists in the connection. Can be 'replace', which results in the existing user's attributes being replaced with the specified user attributes; or 'none' which means the existing user will not be modified. */
/** Behavior to apply if a user with specified user_id already exists in the connection. */
updateBehavior: 'replace' | 'none';
};
/** An object containing the user profile attributes to set. */
type SetUserByConnectionUserAttributes = {
type CustomTokenExchangeSetUserByConnectionUserAttributes = {
/** The user's email. */
email?: string;
/** Whether this email address is verified (true) or unverified (false). User will receive a verification email after creation if email_verified is false or not specified. */
/** Whether this email address is verified (true) or unverified (false). */
email_verified?: boolean;
/** The user's family name(s). */
family_name?: string;
Expand All @@ -282,11 +282,23 @@ type SetUserByConnectionUserAttributes = {
user_id: string;
/** The user's username. */
username?: string;
/** Whether the user will receive a verification email after creation (true) or no email (false). Overrides behavior of email_verified parameter. */
/** Whether the user will receive a verification email after creation (true) or no email (false). */
verify_email?: boolean;
} & {
[additionalProperties: string]: any;
};
/** Recursively defines nested actor levels, terminating when the depth tuple is exhausted. */
type NestedActor<D extends unknown[] = [1, 2, 3, 4]> = D extends [unknown, ...infer Rest]
? {
sub: string;
act?: NestedActor<Rest>;
} & Record<string, any>
: never;
/** Nested actor representing a delegation chain. Max 5 levels (root + 4 nested). */
type ActorParams = {
sub: string;
act?: NestedActor;
} & Record<string, any>;
interface AccessAPI {
/**
* Mark the current token exchange as denied.
Expand Down Expand Up @@ -351,18 +363,6 @@ interface AccessAPI {
*/
rejectInvalidSubjectToken(reason: string): void;
}
/** Recursively defines nested actor levels, terminating when the depth tuple is exhausted. */
type NestedActor<D extends unknown[] = [1, 2, 3, 4]> = D extends [unknown, ...infer Rest]
? {
sub: string;
act?: NestedActor<Rest>;
} & Record<string, any>
: never;
/** Nested actor representing a delegation chain. Max 5 levels (root + 4 nested). */
type ActorParams = {
sub: string;
act?: NestedActor;
} & Record<string, any>;
interface AuthenticationAPI {
/**
* Indicate the user corresponding to the subject_token, by providing the userId. The token exchange request will issue tokens for this user.
Expand Down Expand Up @@ -493,8 +493,8 @@ interface AuthenticationAPI {
*/
setUserByConnection(
connection_name: string,
user_attributes: SetUserByConnectionUserAttributes,
options: SetUserByConnectionOptions
user_attributes: CustomTokenExchangeSetUserByConnectionUserAttributes,
options: CustomTokenExchangeSetUserByConnectionOptions
): void;
/**
* Set the organization for the user associated with the token exchange.
Expand Down
72 changes: 72 additions & 0 deletions src/post-login/v3/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,74 @@ interface AuthenticationAPI {
*/
setPrimaryUser(primary_user_id: string): void;
}
interface GroupsAPI {
/**
* Get the paginated list of the groups the user belongs to.
*
* @param params - An object containing pagination options.
* @param params.take - The number of groups to retrieve.
* @param params.from - The cursor for pagination.
*/
getUserGroups(params?: GetUserGroupsParams): Promise<ListUserGroupsResponse>;
/**
* Checks if the user is a member of any of the specified groups and provides details
* about the matching groups if the user is a member.
* @param groups - An array of group identifiers (IDs or names) to check membership against.
*/
hasGroupMembership(groups: string[]): Promise<CheckGroupMembershipResponse>;
}
type GetUserGroupsParams = {
take?: number;
from?: string;
};
type ListUserGroupsResponse = {
/** The list of user groups. */
groups: UserGroupMembership[];
/** A cursor for pagination. */
next?: string;
};
type UserGroupMembership = {
/** Unique identifier of the group. */
id: string;
/** Name of the Group */
name: string;
/** External identifier of the group, often used for SCIM synchronization. */
external_id?: string;
/** Identifier of the connection this group belongs to (if a connection group). */
connection_id?: string;
/** Identifier of the tenant this group belongs to. */
tenant_name: string;
/** Timestamp of when the group was created. */
created_at: string;
/** Timestamp of when the group was updated. */
updated_at: string;
/** Timestamp of when the group membership was added. */
membership_created_at: string;
/** The method with which the group was assigned to the user. */
assignment: string;
};
type CheckGroupMembershipResponse = {
/** Map of group identifiers (ID or name) to membership details including status and matching groups */
memberships: {
[key: string]: {
/** Whether the user is a member of this group */
is_member: boolean;
/** Array of matching groups when is_member is true */
matches?: {
/** Unique identifier of the group. */
id: string;
/** Name of the Group */
name: string;
/** Can be `connection`, `organization` or `tenant` */
group_type: string;
}[];
};
};
/** Map of group identifiers to error codes for groups that couldn't be checked */
errors?: {
[key: string]: string;
};
};
interface IdTokenAPI {
/**
* Set a custom claim on the ID Token that will be issued upon completion of the login flow.
Expand Down Expand Up @@ -1553,6 +1621,10 @@ interface PostLoginAPI {
* Make changes to the transaction.
*/
readonly transaction: TransactionAPI;
/**
* Get information about user groups membership.
*/
readonly groups: GroupsAPI;
}
interface PostLoginAction {
(event: Event, api: PostLoginAPI): Promise<void>;
Expand Down
147 changes: 73 additions & 74 deletions src/pre-user-registration/v2/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,79 @@ interface CacheAPI {
*/
set(key: string, value: string, options?: CacheSetOptions): CacheWriteResult;
}
interface AccessAPI {
/**
* Deny the user from being able to register. The signup flow will immediately stop following the
* completion of this action and no further Actions will be executed.
*
* @param reason An internal reason describing why this registration attempt is being denied. This value
* will appear in tenant logs.
*
* @param userMessage A human-readable explanation for rejecting the registration attempt. This may be presented
* directly in end-user interfaces.
*/
deny(reason: string, userMessage: string): PreUserRegistrationAPI;
}
interface ValidationAPI {
/**
* Deny the user from being able to register. The signup flow will immediately stop following the
* completion of this action and no further Actions will be executed.
*
* @param errorCode A customer defined error code describing why this registration attempt is being denied. This value
* will appear in tenant logs.
*
* @param errorMessage A customer defined explanation for rejecting the registration attempt. This may be presented
* directly in end-user interfaces.
*/
error(errorCode: string, errorMessage: string): PreUserRegistrationAPI;
}
interface UserAPI {
/**
* Set application-specific metadata for the user that is logging in.
*
* Note: This method should not be used in callbacks. Invoking this method won't update the metadata immediately.
* You can call this several times throughout multiple actions of the same flow and the engine will aggregate the
* changes and update the metadata at once before the flow is completed.
*
* @param key The metadata property to be set.
* @param value The value of the metadata property. This may be set to `null` to remove the
* metadata property.
*/
setAppMetadata(key: string, value: unknown): PreUserRegistrationAPI;
/**
* Set general metadata for the user that is logging in.
*
* Note: This method should not be used in callbacks. Invoking this method won't update the metadata immediately.
* You can call this several times throughout multiple actions of the same flow and the engine will aggregate the
* changes and update the metadata at once before the flow is completed.
*
* @param key The metadata property to be set.
* @param value The value of the metadata property. This may be set to `null` to remove the
* metadata property.
*/
setUserMetadata(key: string, value: unknown): PreUserRegistrationAPI;
}
/**
* Methods and utilities to help change the behavior of the login flow.
*/
interface PreUserRegistrationAPI {
/**
* Modify the access of the user that is logging in, such as rejecting the login attempt.
*/
readonly access: AccessAPI;
/**
* Make changes to the metadata of the user that is logging in.
*/
readonly user: UserAPI;
/**
* Store and retrieve data that persists across executions.
*/
readonly cache: CacheAPI;
/**
* Modify the access of the user that is logging in, such as rejecting the login attempt due to validation errors.
*/
readonly validation: ValidationAPI;
}
/** PreUserRegistrationV2Event */
type PreUserRegistrationV2Event = {
/** Details about authentication obtained during the pre user registration flow. */
Expand Down Expand Up @@ -309,80 +382,6 @@ type PreUserRegistrationV2Event = {
} & {
[additionalProperties: string]: any;
};
interface AccessAPI {
/**
* Deny the user from being able to register. The signup flow will immediately stop following the
* completion of this action and no further Actions will be executed.
*
* @param reason An internal reason describing why this registration attempt is being denied. This value
* will appear in tenant logs.
*
* @param userMessage A human-readable explanation for rejecting the registration attempt. This may be presented
* directly in end-user interfaces.
*/
deny(reason: string, userMessage: string): PreUserRegistrationAPI;
}
interface ValidationAPI {
/**
* Deny the user from being able to register. The signup flow will immediately stop following the
* completion of this action and no further Actions will be executed.
*
* @param errorCode A customer defined error code describing why this registration attempt is being denied. This value
* will appear in tenant logs.
*
* @param errorMessage A customer defined explanation for rejecting the registration attempt. This may be presented
* directly in end-user interfaces.
*/
error(errorCode: string, errorMessage: string): PreUserRegistrationAPI;
}
interface UserAPI {
/**
* Set application-specific metadata for the user that is logging in.
*
* Note: This method should not be used in callbacks. Invoking this method won't update the metadata immediately.
* You can call this several times throughout multiple actions of the same flow and the engine will aggregate the
* changes and update the metadata at once before the flow is completed.
*
* @param key The metadata property to be set.
* @param value The value of the metadata property. This may be set to `null` to remove the
* metadata property.
*/
setAppMetadata(key: string, value: unknown): PreUserRegistrationAPI;
/**
* Set general metadata for the user that is logging in.
*
* Note: This method should not be used in callbacks. Invoking this method won't update the metadata immediately.
* You can call this several times throughout multiple actions of the same flow and the engine will aggregate the
* changes and update the metadata at once before the flow is completed.
*
* @param key The metadata property to be set.
* @param value The value of the metadata property. This may be set to `null` to remove the
* metadata property.
*/
setUserMetadata(key: string, value: unknown): PreUserRegistrationAPI;
}
/**
* Methods and utilities to help change the behavior of the login flow.
*/
interface PreUserRegistrationAPI {
/**
* Modify the access of the user that is logging in, such as rejecting the login attempt.
*/
readonly access: AccessAPI;
/**
* Make changes to the metadata of the user that is logging in.
*/
readonly user: UserAPI;
/**
* Store and retrieve data that persists across executions.
*/
readonly cache: CacheAPI;
/**
* Modify the access of the user that is logging in, such as rejecting the login attempt due to validation errors.
* @interal
*/
readonly validation: ValidationAPI;
}
interface Configuration {}
interface Secrets {
[secretName: string]: string;
Expand Down
18 changes: 9 additions & 9 deletions src/send-phone-message/v2/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@ interface CacheAPI {
*/
set(key: string, value: string, options?: CacheSetOptions): CacheWriteResult;
}
/**
* Methods and utilities to help change the behavior of sending a phone message.
*/
interface SendPhoneMessageAPI {
/**
* Store and retrieve data that persists across executions.
*/
readonly cache: CacheAPI;
}
/** SendPhoneMessageV2Event */
type SendPhoneMessageV2Event = {
/** Information about the Client with which this transaction was initiated. */
Expand Down Expand Up @@ -233,15 +242,6 @@ type SendPhoneMessageV2Event = {
[additionalProperties: string]: any;
};
};
/**
* Methods and utilities to help change the behavior of sending a phone message.
*/
interface SendPhoneMessageAPI {
/**
* Store and retrieve data that persists across executions.
*/
readonly cache: CacheAPI;
}
interface Configuration {}
interface Secrets {
[secretName: string]: string;
Expand Down