From 895ca53717b130053b799ba037d2d82b7f7f5655 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Tue, 29 Apr 2025 14:00:25 +0530 Subject: [PATCH 01/64] Add init script for generating the schema --- lib/core/5.3/schema.d.ts | 10946 +++++++++++++++++++++++++++++++++++ package.json | 4 +- scripts/generate-schema.js | 82 + 3 files changed, 11031 insertions(+), 1 deletion(-) create mode 100644 lib/core/5.3/schema.d.ts create mode 100644 scripts/generate-schema.js diff --git a/lib/core/5.3/schema.d.ts b/lib/core/5.3/schema.d.ts new file mode 100644 index 000000000..3a45b6642 --- /dev/null +++ b/lib/core/5.3/schema.d.ts @@ -0,0 +1,10946 @@ +/** + * This file was auto-generated by openapi-typescript. + * Do not make direct changes to the file. + */ + +export interface paths { + "/recipe/accountlinking/user/primary/check": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Check if primary user can be created for given user id + * */ + get: operations["canCreatePrimaryUser"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/accountlinking/user/link/check": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Check if accounts can be linked for given primary and recipe user id + * */ + get: operations["canLinkAccounts"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/accountlinking/user/primary": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Create a primary user for given user id + * */ + post: operations["createPrimaryUser"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/accountlinking/user/link": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Link accounts for given primary and recipe user id + * */ + post: operations["linkAccounts"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/accountlinking/user/unlink": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Unlink accounts for given recipe user id + * */ + post: operations["unlinkAccounts"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/totp/device": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** @description Update the name of a TOTP device for a user. + * */ + put: operations["updateTotpDeviceName"]; + /** @description Add a TOTP device for a user and enable TOTP if not already enabled. + * */ + post: operations["createTotpDevice"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/totp/device/list": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Retrieve a list of TOTP devices for a user. + * */ + get: operations["getTotpDevices"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/totp/device/import": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Add a TOTP device for a user and enable TOTP if not already enabled. + * */ + post: operations["importTotpDevice"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/totp/device/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Remove a TOTP device for a user. If all devices are removed, TOTP is disabled for the user. + * */ + post: operations["removeTotpDevice"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/totp/verify": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Check if a TOTP code is valid against any of the TOTP devices for a user. + * */ + post: operations["verifyTotpCode"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/totp/device/verify": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Mark a TOTP device as verified if the given TOTP code is valid for that device. + * */ + post: operations["verifyTotpDevice"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/userid/map": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Retrieve a UserIdMapping + * */ + get: operations["userIdMappingGetMapping"]; + put?: never; + /** @description Create a mapping between a SuperTokens userId and an external userId. + * */ + post: operations["userIdMappingCreateMapping"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/userid/map/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Delete a mapping between a SuperTokens userId and an external userId. + * */ + post: operations["userIdMappingRemoveMapping"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/userid/external-user-id-info": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** @description Update or delete externalUserIdInfo + * */ + put: operations["userIdMappingUpateExternalUserIdInfo"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/signinup/code/check": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Tries to check if the passed userInputCode+deviceId combo or the linkCode is valid + * */ + post: operations["passwordlessCheckCode"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/signinup/code/consume": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Tries to consume the passed userInputCode+deviceId combo or the linkCode to sign the user in + * */ + post: operations["passwordlessTryUseCode"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/signinup/code": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Starts a sign in process by requesting a linkCode and a deviceId + userInputCode combination the user can use to sign in. + * Passing the optional deviceId signifies a resend code flow. + * */ + post: operations["passwordlessStartSignIn"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/signinup/code/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Revokes a code by id + * */ + post: operations["passwordlessRevokeCode"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/signinup/codes": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Lists all active passwordless codes of the user + * */ + get: operations["passwordlessListCodes"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/signinup/codes/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Revokes all codes issued for the user + * */ + post: operations["passwordlessRevokeAllCodesOfUser"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/user\u2800\u2800": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * @deprecated + * @description Get a user's information. + * + * API is tenant specific if querying by email or phone number. + * If querying by userId, tenantId will be ignored. + * + * Note that there is an invisible character at the end of the path, this was to avoid a conflict with the OpenAPI spec. + * + */ + get: operations["passwordlessGetUser"]; + /** @description Update a user's information. + * If the email or phoneNumber is set to null the previous value will be deleted. If they are not set (i.e., undefined/missing from the request), they are left as-is. + * */ + put: operations["passwordlessPutUser"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/signin": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Signin a user with email ID and password + * */ + post: operations["emailPasswordSignin"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/signup": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Signup a user with email ID and password + * */ + post: operations["emailPasswordSignup"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/user": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * @deprecated + * @description Get a user's information + * + * API is tenant specific if querying by email. + * If querying by userId, tenantId will be ignored. + * + */ + get: operations["emailPasswordGetUser"]; + /** @description Update a user's information + * */ + put: operations["emailPasswordPutUser"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/user/password/reset/token": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Generate a new reset password token for this user + * */ + post: operations["emailPasswordGetPasswordResetToken"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/user/password/reset": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * @deprecated + * @description Reset a password using password reset token + * + */ + post: operations["emailPasswordGetPasswordReset"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/user/passwordhash/import": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Import a user with email ID and password hash + * */ + post: operations["userImport"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/user/password/reset/token/consume": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Consume a password reset token + * */ + post: operations["emailPasswordResetPasswordConsumeToken"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/signinup": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Signin/up a user + * */ + post: operations["thirdPartySigninup"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/user\u2800": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * @deprecated + * @description Get a user's information. + * + * API is tenant specific if querying by email. + * If querying by userId, tenantId will be ignored. + * + * Note that there is an invisible character at the end of the path, this was to avoid a conflict with the OpenAPI spec. + * + */ + get: operations["thirdPartyGetUser"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/users/by-email": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * @deprecated + * @description Get all users accounts associated with given email + * + */ + get: operations["thirdPartyGetUsersByEmail"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/user/email/verify/token": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Generate a new email verification token for this user + * */ + post: operations["emailVerificationVerifyToken"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/user/email/verify/token/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Remove all unused email verification tokens for this user + * */ + post: operations["emailVerificationVerifyTokenRemove"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/user/email/verify": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Verify an email + * */ + post: operations["emailVerificationVerify"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/user/email/verify": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Check if an email is verified + * */ + get: operations["emailVerificationVerifyGet"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/user/email/verify/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Unverify an email + * */ + post: operations["emailVerificationVerifyRemove"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/user/metadata": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Gets the stored metadata object of the user + * */ + get: operations["userMetadataRead"]; + /** @description Updates the metadata object stored about the user by doing a shallow merge of the stored and the update JSONs + * and removing properties set to null on the root level of the update object. The merged object is then reserialized and stored. + * + * e.g.: + * - stored: `{ "preferences": { "theme":"dark" }, "notifications": { "email": true }, "todos": ["example"] }` + * + * - update: `{ "notifications": { "sms": true }, "todos": null }` + * + * - result: `{ "preferences": { "theme":"dark" }, "notifications": { "sms": true } }` + * */ + put: operations["userMetadataUpdate"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/user/metadata/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Removes the entire metadata JSON stored about the user. + * */ + post: operations["userMetadataDelete"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/user/role": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** @description Creates a User Role mapping + * */ + put: operations["addUserRole"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/user/role/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Removes a User Role mapping + * */ + post: operations["removeUserRole"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/user/roles": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Retrive the roles associated with the user. + * */ + get: operations["getUserRoles"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/role/users": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Retrive the users associated with the role. + * */ + get: operations["getRoleUsers"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/role": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** @description Creates a role with permissions, can also be used to add permissions to a role + * */ + put: operations["putRole"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/role/permissions": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Retrive the permissions associated with a role + * */ + get: operations["getRolePermissions"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/role/permissions/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Removes permissions mapped to a role, if no permissions are passed all permissions mapped to the role are removed + * */ + post: operations["removeRolePermissions"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/permission/roles": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Retrive the roles associated with the permission + * */ + get: operations["getPermissionRoles"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/role/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Deletes a role + * */ + post: operations["removeRole"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/roles": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Retrive all created roles + * */ + get: operations["getRoles"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/session": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Create a new Session + * */ + post: operations["createNewSession"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/session": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get user and session information for a given session handle + * */ + get: operations["getSessionInfo"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/session/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Delete a sesion + * + * If revoking session by `userId`, the sessions are cleared across all tenants by default. + * + * Note: If `revokeAcrossAllTenants` is set to `true`, this API can only be called from `public` tenant. + * */ + post: operations["deleteSession"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/session/verify": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Verify a Session + * */ + post: operations["verifySession"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/session/refresh": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Refresh a Session + * */ + post: operations["refreshSession"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/session/user": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get session handles for a user + * + * By default, the session handles are fetched across all tenants. Set `fetchAcrossAllTenants` to `false` to get sessionHandles for the user for a particular tenant. + * + * Note: If `fetchAcrossAllTenants` is set to `true`, this API can only be called from `public` tenant. + * */ + get: operations["getUserSessionHandles"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/session/regenerate": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Regenerate a session + * */ + post: operations["regenerateSession"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/session/data": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * @deprecated + * @description Get session data + * + */ + get: operations["getSessionData"]; + /** @description Change session data + * */ + put: operations["putSessionData"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/jwt": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Create a signed JWT + * */ + post: operations["createSignedJWT"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/jwt/jwks": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * @deprecated + * @description Retrieve JWKs for JWT verification, containing both static and dynamic keys. + * + */ + get: { + parameters: { + query?: never; + header?: { + /** @example jwt */ + rid?: components["parameters"]["jwtRID"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Retrieve JWKs for JWT verification, containing both static and dynamic keys. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @enum {string} */ + status?: "OK"; + keys?: components["schemas"]["jwk"][]; + }; + }; + }; + 400: components["responses"]["400"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/.well-known/jwks.json": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Retrieve JWKs for JWT verification, containing both static and dynamic keys. + * */ + get: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Retrieve JWKs for JWT verification, containing both static and dynamic keys. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + keys?: components["schemas"]["jwk"][]; + }; + }; + }; + 400: components["responses"]["400"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/jwt/data": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * @deprecated + * @description Get JWT data for a session + * + */ + get: operations["getJWTData"]; + /** @description Change JWT data for a session + * */ + put: operations["putJWTData"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/dashboard/user": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** @description Update a user's email or password + * */ + put: operations["updateDashboardUser"]; + /** @description Create a dashboard user + * */ + post: operations["createDashboardUser"]; + /** @description Delete a dashboard user with their userId or email + * */ + delete: operations["deleteDashboardUser"]; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/dashboard/users": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get a list of call the dashboard users + * */ + get: operations["getAllDashboardUsers"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/dashboard/session/verify": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Verify a Dashboard user's sessionId + * */ + post: operations["verifyDashboardUserSession"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/dashboard/session": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post?: never; + /** @description Revoke a Dashboard user's session + * */ + delete: operations["RevokeDashboardUsersSession"]; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/dashboard/signin": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Signin a Dashboard user + * */ + post: operations["signInDashboardUser"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/dashboard/user/sessions": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get a list of the sessions for the dashboard user + * */ + get: operations["getAllSessionsForDashboardUser"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/apiversion": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get a list of compatible CDI versions + * */ + get: operations["getApiVersion"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/config": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get path to the loaded config file + * */ + get: operations["getConfig"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Return a simple hello message + * */ + get: operations["getHelloOnRootPath"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//hello": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Return a simple hello message + * */ + get: operations["getHello"]; + /** @description Return a simple hello message + * */ + put: operations["putHello"]; + /** @description Return a simple hello message + * */ + post: operations["postHello"]; + /** @description Return a simple hello message + * */ + delete: operations["deleteHello"]; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/telemetry": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Returns the telemetryID if it exists + * */ + get: operations["getTelemetry"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//users/count": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get number of users. + * + * API is tenant specific if `includeAllTenants` is false. + * Else, `tenantId` is ignored. + * */ + get: operations["getUsersCount"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/users/count/active": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get number of active users. + * */ + get: operations["getActiveUsersCount"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//users": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description User Pagination + * */ + get: operations["getUsers"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/user/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Delete user + * */ + post: operations["deleteUser"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/user/search/tags": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Retrieve available tags for search + * */ + get: operations["getSearchTags"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/ee/featureflag": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get a list of the enabled enterprise features + * */ + get: operations["getFeatureFlag"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/ee/license": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Retrieve license key + * */ + get: operations["getLicense"]; + /** @description Set or sync license key + * */ + put: operations["setLicense"]; + post?: never; + /** @description Delete license key + * */ + delete: operations["deleteLicense"]; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/user/id": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get user id from email or phone number + * */ + get: operations["getUserId"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//users/by-accountinfo": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get users by email, phoneNumber or thirdParty info + * */ + get: operations["getUsersByAccountInfo"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/requests/stats": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get requests stats for last 24 hours + * + * `averageRequestsPerSecond` and `peakRequestsPerSecond` would countain `1440` values corresponding to `now - 1440 minutes` until `now - 1 minute`. + * + * A value of `-1` would mean that there is no data for that minute. + * */ + get: operations["getRequestsStats"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/multitenancy/connectionuridomain": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** + * @deprecated + * @description This API is deprecated. Please use the v2 version of this API. In the v2 version of the API, the login methods are no longer enabled using the `emailPasswordEnabled`, `thirdPartyEnabled` and `passwordlessEnabled` inputs. Instead, they are enabled using factorIds (such as emailpassword, otp-email, etc) specified in the `firstFactors` and `requiredSecondaryFactors` inputs. Please refer [Multitenancy Docs](https://supertokens.com/docs/multitenancy/new-tenant) to know the list of factorIds available. + * + * Note: This deprecated API still accepts those `emailPasswordEnabled`, `thirdPartyEnabled` and `passwordlessEnabled` inputs for backward compatibility. + * + * Create or update a connection uri domain. + * + * SuperTokens subscription license key is required, if not using the base connection uri domain. + * + * This request must originate from public app and public tenant on the base + * connection uri domain. + * + * If creating a new connection uri domain, only the login methods set to true will be enabled and rest will be disabled by default. + * + * `firstFactors` and `requiredSecondaryFactors` can be set to null to remove all entries in the core, or a non empty string array to be updated in the core. Setting of empty array is disallowed. + * + * Note: the create/update will fail if a login method is not enabled and a relavant factor is added to either `firstFactors` or `requiredSecondaryFactors`. For example, `emailPasswordEnabled` cannot be set to `false` if `emailpassword` is present in the `firstFactors` array. + * + * If updating an existing connection uri domain, + * 1. core will keep the existing state of login methods and only update the ones that are specified in the request body. + * 2. Core config will be merged into existing config. To delete a key in the config, use a null value + * + * Note: The core config must contain a unique connection to the storage layer, because sharing of database between 2 different connection uri domains is not allowed. + * + * Note: Updation of core config is not allowed for the default connectionUriDomain. In order to update config for the default connectionUriDomain, you must edit the config.yaml or the docker env directly. + * + */ + put: operations["createOrUpdateConnectionURIDomainPUT"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/multitenancy/connectionuridomain/v2": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** @description Create or update a connection uri domain. + * + * SuperTokens subscription license key is required, if not using the base connection uri domain. + * + * This request must originate from public app and public tenant on the base + * connection uri domain. + * + * The `firstFactors` can be set to following values: + * + * - `null`: When set to `null`, all the login methods will be available for the connection URI domain (public app, public tenant). + * - `[]` (empty array): No login methods will be enabled for the connection URI domain (public app, public tenant). + * - `['factor1', 'factor2', ...]` (non-empty array): The list of login methods to enable for the connection URI domain (public app, public tenant). For eg. if this is set to `['emailpassword', 'thirdparty']`, the users of the tenant will be able to login using emailpassword and third party providers. + * + * List of built-in first factors are as follows: + * + * - Email password auth: `emailpassword` + * - Social login / enterprise SSO auth: `thirdparty` + * - Passwordless: + * - With email OTP: `otp-email` + * - With SMS OTP: `otp-phone` + * - With email magic link: `link-email` + * - With SMS magic link: `link-phone` + * + * If first factors are not specified while creating a new connection uri domain, all the login methods will be enabled by default. + * + * The `requiredSecondaryFactors` can be set to following values: + * - `null`: When set to `null`, no secondary factors will be required for the users of the connection URI domain (public app, public tenant). + * - `['factor1', 'factor2', ...]` (non-empty array): The list of factors that the users of the connection URI domain (public app, public tenant) must complete post the first factor login. For eg. if this is set to `['otp-phone', 'totp']`, the users of the tenant will be required to complete either phone OTP or TOTP post the first factor login. + * + * List of built-in secondary factors are as follows: + * + * - Email password auth: `emailpassword` + * - Social login / enterprise SSO auth: `thirdparty` + * - Passwordless: + * - With email OTP: `otp-email` + * - With SMS OTP: `otp-phone` + * - With email magic link: `link-email` + * - With SMS magic link: `link-phone` + * - Time based OTP: `totp` + * + * If updating an existing connection uri domain, + * 1. core will keep the existing state of login methods and only update the ones that are specified in the request body. + * 2. Core config will be merged into existing config. To delete a key in the config, use a null value + * + * Note: The core config must contain a unique connection to the storage layer, because sharing of database between 2 different connection uri domains is not allowed. + * + * Note: Updation of core config is not allowed for the default connectionUriDomain. In order to update config for the default connectionUriDomain, you must edit the config.yaml or the docker env directly. + * */ + put: operations["createOrUpdateConnectionURIDomainV2PUT"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/multitenancy/connectionuridomain/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Delete a connection uri domain. + * + * Deletion of base connection uri domain is not allowed. + * + * The request must originate from base connection uri domain and public app and tenant. + * + * Note: There should be no apps or tenants (other than the public app and public tenant) belonging to the connection uri domain to be able to delete it. + * */ + post: operations["deleteConnectionUriDomainPOST"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/multitenancy/connectionuridomain/list": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * @deprecated + * @description This API is deprecated. Please use the v2 version of this API. In the v2 version of the API, the login methods are no longer enabled using the `emailPasswordEnabled`, `thirdPartyEnabled` and `passwordlessEnabled` inputs. Instead, they are enabled using factorIds (such as emailpassword, otp-email, etc) specified in the `firstFactors` and `requiredSecondaryFactors` inputs. Please refer [Multitenancy Docs](https://supertokens.com/docs/multitenancy/new-tenant) to know the list of factorIds available. + * + * Note: This deprecated API still returns `emailPasswordEnabled`, `thirdPartyEnabled` and `passwordlessEnabled` values for backward compatibility, and it's values are derived from the `firstFactors` and `requiredSecondaryFactors` configured for the tenant. The detailed computation of the values as per CDI version is described here: https://github.com/supertokens/supertokens-core/issues/979#issuecomment-2099971371 + * + * Get a list of all connection uri domains. + * + * Request must originate from base connection uri domain and public app and tenant. + * + */ + get: operations["connectionUriDomainListGET"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/multitenancy/connectionuridomain/list/v2": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get a list of all connection uri domains. + * + * The value of `firstFactors` can be as follows: + * - `null`: When set to `null`, the SDK will use firstFactors defined in the SDK + * - `[]` (empty array): No first factors would be enabled for the tenant + * - non-empty array: The first factors that are enabled for the tenant + * + * Request must originate from base connection uri domain and public app and tenant. + * */ + get: operations["connectionUriDomainListV2GET"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/multitenancy/app": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** + * @deprecated + * @description This API is deprecated. Please use the v2 version of this API. In the v2 version of the API, the login methods are no longer enabled using the `emailPasswordEnabled`, `thirdPartyEnabled` and `passwordlessEnabled` inputs. Instead, they are enabled using factorIds (such as emailpassword, otp-email, etc) specified in the `firstFactors` and `requiredSecondaryFactors` inputs. Please refer [Multitenancy Docs](https://supertokens.com/docs/multitenancy/new-tenant) to know the list of factorIds available. + * + * Note: This deprecated API still accepts those `emailPasswordEnabled`, `thirdPartyEnabled` and `passwordlessEnabled` inputs for backward compatibility. + * + * Create or update an app. + * + * SuperTokens subscription license key is required. + * + * If creating a new app, only the login methods set to true will be enabled and rest will be disabled by default. + * + * `firstFactors` and `requiredSecondaryFactors` can be set to null to remove all entries in the core, or a non empty string array to be updated in the core. Setting of empty array is disallowed. + * + * Note: the create/update will fail if a login method is not enabled and a relavant factor is added to either `firstFactors` or `requiredSecondaryFactors`. For example, `emailPasswordEnabled` cannot be set to `false` if `emailpassword` is present in the `firstFactors` array. + * + * If updating an existing app, + * 1. core will keep the existing state of login methods and only update the ones that are specified in the request body. + * 2. Core config will be merged into existing config. To delete a key in the config, use a null value + * + * Note: the newly created app will use the same connection uri domain from which + * this request originates and the request must originate from public app and public tenant. + * + * Note: Updation of core config is not allowed for the default connectionUriDomain, public app. In order to update config for the default connectionUriDomain and public app, you must edit the config.yaml or the docker env directly. + * + */ + put: operations["createOrUpdateAppPUT"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/multitenancy/app/v2": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** @description Create or update an app. + * + * SuperTokens subscription license key is required. + * + * The `firstFactors` can be set to following values: + * + * - `null`: When set to `null`, all the login methods will be available for the app (public tenant). + * - `[]` (empty array): No login methods will be enabled for the app (public tenant). + * - `['factor1', 'factor2', ...]` (non-empty array): The list of login methods to enable for the app (public tenant). For eg. if this is set to `['emailpassword', 'thirdparty']`, the users of the tenant will be able to login using emailpassword and third party providers. + * + * List of built-in first factors are as follows: + * + * - Email password auth: `emailpassword` + * - Social login / enterprise SSO auth: `thirdparty` + * - Passwordless: + * - With email OTP: `otp-email` + * - With SMS OTP: `otp-phone` + * - With email magic link: `link-email` + * - With SMS magic link: `link-phone` + * + * If first factors are not specified while creating a new app, all the login methods will be enabled by default. + * + * The `requiredSecondaryFactors` can be set to following values: + * - `null`: When set to `null`, no secondary factors will be required for the users of the app (public tenant). + * - `['factor1', 'factor2', ...]` (non-empty array): The list of factors that the users of the app (public tenant) must complete post the first factor login. For eg. if this is set to `['otp-phone', 'totp']`, the users of the tenant will be required to complete either phone OTP or TOTP post the first factor login. + * + * List of built-in secondary factors are as follows: + * + * - Email password auth: `emailpassword` + * - Social login / enterprise SSO auth: `thirdparty` + * - Passwordless: + * - With email OTP: `otp-email` + * - With SMS OTP: `otp-phone` + * - With email magic link: `link-email` + * - With SMS magic link: `link-phone` + * - Time based OTP: `totp` + * + * If updating an existing app, + * 1. core will keep the existing state of login methods and only update the ones that are specified in the request body. + * 2. Core config will be merged into existing config. To delete a key in the config, use a null value + * + * Note: the newly created app will use the same connection uri domain from which + * this request originates and the request must originate from public app and public tenant. + * + * Note: Updation of core config is not allowed for the default connectionUriDomain, public app. In order to update config for the default connectionUriDomain and public app, you must edit the config.yaml or the docker env directly. + * */ + put: operations["createOrUpdateAppV2PUT"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/multitenancy/app/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Delete an app. + * + * Request must originate from public app and tenant. + * + * Note: No tenants (other than the public tenant) must belong to the app to be able to delete it. + * */ + post: operations["deleteAppPOST"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/multitenancy/app/list": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * @deprecated + * @description This API is deprecated. Please use the v2 version of this API. In the v2 version of the API, the login methods are no longer enabled using the `emailPasswordEnabled`, `thirdPartyEnabled` and `passwordlessEnabled` inputs. Instead, they are enabled using factorIds (such as emailpassword, otp-email, etc) specified in the `firstFactors` and `requiredSecondaryFactors` inputs. Please refer [Multitenancy Docs](https://supertokens.com/docs/multitenancy/new-tenant) to know the list of factorIds available. + * + * Note: This deprecated API still returns `emailPasswordEnabled`, `thirdPartyEnabled` and `passwordlessEnabled` values for backward compatibility, and it's values are derived from the `firstFactors` and `requiredSecondaryFactors` configured for the tenant. The detailed computation of the values as per CDI version is described here: https://github.com/supertokens/supertokens-core/issues/979#issuecomment-2099971371 + * + * Get a list of all apps in a connection uri domain. + * + * Request must originate from public app and tenant. + * + */ + get: operations["appListGET"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/multitenancy/app/list/v2": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get a list of all apps in a connection uri domain. + * + * The value of `firstFactors` can be as follows: + * - `null`: When set to `null`, the SDK will use firstFactors defined in the SDK + * - `[]` (empty array): No first factors would be enabled for the tenant + * - non-empty array: The first factors that are enabled for the tenant + * + * Request must originate from public app and tenant. + * */ + get: operations["appListV2GET"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/multitenancy/tenant": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** + * @deprecated + * @description This API is deprecated. Please use the v2 version of this API. In the v2 version of the API, the login methods are no longer enabled using the `emailPasswordEnabled`, `thirdPartyEnabled` and `passwordlessEnabled` inputs. Instead, they are enabled using factorIds (such as emailpassword, otp-email, etc) specified in the `firstFactors` and `requiredSecondaryFactors` inputs. Please refer [Multitenancy Docs](https://supertokens.com/docs/multitenancy/new-tenant) to know the list of factorIds available. + * + * Note: This deprecated API still accepts those `emailPasswordEnabled`, `thirdPartyEnabled` and `passwordlessEnabled` inputs for backward compatibility. + * + * Creates or updates a tenant. + * + * SuperTokens subscription license key is required. + * + * If creating a new tenant, only the login methods set to true will be enabled and rest will be disabled by default. + * + * `firstFactors` and `requiredSecondaryFactors` can be set to null to remove all entries in the core, or a non empty string array to be updated in the core. Setting of empty array is disallowed. + * + * Note: the create/update will fail if a login method is not enabled and a relavant factor is added to either `firstFactors` or `requiredSecondaryFactors`. For example, `emailPasswordEnabled` cannot be set to `false` if `emailpassword` is present in the `firstFactors` array. + * + * If updating an existing tenant, + * 1. core will keep the existing state of login methods and only update the ones that are specified in the request body. + * 2. Core config will be merged into existing config. To delete a key in the config, use a null value + * + * The request must originate from public tenant, and the new tenant will use connectionUriDomain and app from which the request originates. + * + * Note: Updation of core config is not allowed for the default connectionUriDomain, public app and tenant. In order to update config for the default connectionUriDomain, public app and tenant, you must edit the config.yaml or the docker env directly. + * + */ + put: operations["createOrUpdateTenantPUT"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/multitenancy/tenant/v2": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** @description Creates or updates a tenant. + * + * SuperTokens subscription license key is required. + * + * The `firstFactors` can be set to following values: + * + * - `null`: When set to `null`, all the login methods will be available for the tenant. + * - `[]` (empty array): No login methods will be enabled for the tenant. + * - `['factor1', 'factor2', ...]` (non-empty array): The list of login methods to enable for the tenant. For eg. if this is set to `['emailpassword', 'thirdparty']`, the users of the tenant will be able to login using emailpassword and third party providers. + * + * List of built-in first factors are as follows: + * + * - Email password auth: `emailpassword` + * - Social login / enterprise SSO auth: `thirdparty` + * - Passwordless: + * - With email OTP: `otp-email` + * - With SMS OTP: `otp-phone` + * - With email magic link: `link-email` + * - With SMS magic link: `link-phone` + * + * If first factors are not specified while creating a new tenant, all the login methods will be disabled by default. + * + * The `requiredSecondaryFactors` can be set to following values: + * - `null`: When set to `null`, no secondary factors will be required for the users of the tenant. + * - `['factor1', 'factor2', ...]` (non-empty array): The list of factors that the users of the tenant must complete post the first factor login. For eg. if this is set to `['otp-phone', 'totp']`, the users of the tenant will be required to complete either phone OTP or TOTP post the first factor login. + * + * List of built-in secondary factors are as follows: + * + * - Email password auth: `emailpassword` + * - Social login / enterprise SSO auth: `thirdparty` + * - Passwordless: + * - With email OTP: `otp-email` + * - With SMS OTP: `otp-phone` + * - With email magic link: `link-email` + * - With SMS magic link: `link-phone` + * - Time based OTP: `totp` + * + * If updating an existing tenant, + * 1. core will keep the existing state of login methods and only update the ones that are specified in the request body. + * 2. Core config will be merged into existing config. To delete a key in the config, use a null value + * + * The request must originate from public tenant, and the new tenant will use connectionUriDomain and app from which the request originates. + * + * Note: Updation of core config is not allowed for the default connectionUriDomain, public app and tenant. In order to update config for the default connectionUriDomain, public app and tenant, you must edit the config.yaml or the docker env directly. + * */ + put: operations["createOrUpdateTenantV2PUT"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/multitenancy/tenant": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * @deprecated + * @description This API is deprecated. Please use the v2 version of this API. In the v2 version of the API, the login methods are no longer enabled using the `emailPasswordEnabled`, `thirdPartyEnabled` and `passwordlessEnabled` inputs. Instead, they are enabled using factorIds (such as emailpassword, otp-email, etc) specified in the `firstFactors` and `requiredSecondaryFactors` inputs. Please refer [Multitenancy Docs](https://supertokens.com/docs/multitenancy/new-tenant) to know the list of factorIds available. + * + * Note: This deprecated API still returns `emailPasswordEnabled`, `thirdPartyEnabled` and `passwordlessEnabled` values for backward compatibility, and it's values are derived from the `firstFactors` and `requiredSecondaryFactors` configured for the tenant. The detailed computation of the values as per CDI version is described here: https://github.com/supertokens/supertokens-core/issues/979#issuecomment-2099971371 + * + * Get a tenant config of the tenant specified by the url prefix. + * + * SuperTokens subscription license key is required if querying any tenant other than the base tenant. + * + * Returns recipes with their enabled flag and recipe specific configs saved in core + * + */ + get: operations["tenantConfigGet"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/multitenancy/tenant/v2": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get a tenant config of the tenant specified by the url prefix. + * + * The value of `firstFactors` can be as follows: + * - `null`: When set to `null`, the SDK will use firstFactors defined in the SDK + * - `[]` (empty array): No first factors would be enabled for the tenant + * - non-empty array: The first factors that are enabled for the tenant + * + * SuperTokens subscription license key is required if querying any tenant other than the base tenant. + * + * Returns recipes with their enabled flag and recipe specific configs saved in core + * */ + get: operations["tenantConfigV2Get"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/dashboard/tenant/core-config": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get the core config of the tenant specified by the url prefix, along with the metadata of each of the fields. + * */ + get: operations["tenantCoreConfigForDashboardGET"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/multitenancy/tenant/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Delete a tenant. + * + * Request must originate from public tenant. + * */ + post: operations["deleteTenantPOST"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/multitenancy/tenant/list": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * @deprecated + * @description This API is deprecated. Please use the v2 version of this API. In the v2 version of the API, the login methods are no longer enabled using the `emailPasswordEnabled`, `thirdPartyEnabled` and `passwordlessEnabled` inputs. Instead, they are enabled using factorIds (such as emailpassword, otp-email, etc) specified in the `firstFactors` and `requiredSecondaryFactors` inputs. Please refer [Multitenancy Docs](https://supertokens.com/docs/multitenancy/new-tenant) to know the list of factorIds available. + * + * Note: This deprecated API still returns `emailPasswordEnabled`, `thirdPartyEnabled` and `passwordlessEnabled` values for backward compatibility, and it's values are derived from the `firstFactors` and `requiredSecondaryFactors` configured for the tenant. The detailed computation of the values as per CDI version is described here: https://github.com/supertokens/supertokens-core/issues/979#issuecomment-2099971371 + * + * Get a list of all tenants in an app. + * + * Request must originate from public tenant. + * + */ + get: operations["tenantListGET"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/multitenancy/tenant/list/v2": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get a list of all tenants in an app. + * + * The value of `firstFactors` can be as follows: + * - `null`: When set to `null`, the SDK will use firstFactors defined in the SDK + * - `[]` (empty array): No first factors would be enabled for the tenant + * - non-empty array: The first factors that are enabled for the tenant + * + * Request must originate from public tenant. + * */ + get: operations["tenantListV2GET"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/multitenancy/config/thirdparty": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** @description Creates or updates ThirdParty Provider Config for a tenant. + * + * If `skipValidation` is set to true, the config will be saved without any validation. + * + * If the config already exists for the given `tenantId` and `thirdPartyId`, the config in the core will be completely replaced with the config provided in the request body. + * + * **Validations done by the core:** + * + * `thirdPartyId` and `name` are required + * + * Common to all providers: + * - `clients` list: + * - can be undefined or empty + * - if contains 1 element, clientType can be empty or undefined + * - if contains more than 1 element, clientType must be defined and unique + * - for each element in `clients`: + * - `clientId` must not be empty + * + * Built-in provider's specific validation is invoked if the `thirdPartyId` starts with the provider's id + * + * Apple (id: apple): + * - `clients` + * - if it contains elements, each of them are validated as follows: + * - `clientSecret` must be empty or undefined + * - `additionalConfig` should contain the following keys: + * - `keyId` must be a non empty string + * - `teamId` must be a non empty string + * - `privateKey` must be a non empty string + * + * Google Workspaces (id: google-workspaces): + * - `clients` + * - if it contains elements, each of them are validated as follows: + * - `additionalConfig` may contain the key `hd` + * - `hd` is optional + * - if specified, it must be either `"*"`, or a valid domain + * + * Boxy SAML (id: boxy-saml): + * - `clients` + * - `additionalConfig` in the each element must contain `boxyURL` and must be non-empty string + * */ + put: operations["createOrUpdateTenantConfigPUT"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/multitenancy/config/thirdparty/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Delete ThirdParty Provider config for a tenant. + * */ + post: operations["deleteTenantConfigPOST"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/multitenancy/tenant/user": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Add user's association with the tenant. + * + * User will be added to the tenant based on the url prefix of the request. + * + * Note: To associate a user to a tenant, the tenant must be in the same database + * and user must already exist in the app + * */ + post: operations["addUserToTenant"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/multitenancy/tenant/user/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Remove user's association with the tenant + * + * User will be removed from the tenant based on the url prefix of the request. + * */ + post: operations["removeUserFromTenant"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/clients": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get OAuth2 Client + * */ + get: operations["getOAuth2Client"]; + /** @description Update OAuth2 Client + * */ + put: operations["updateOAuth2Client"]; + /** @description Create OAuth2 Client + * */ + post: operations["createOAuth2Client"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/clients/list": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description List OAuth2 Clients + * */ + get: operations["listOAuth2Clients"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/clients/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Remove OAuth2 Client + * */ + post: operations["removeOAuth2Client"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/auth/requests/consent": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get OAuth2 Consent Request + * */ + get: operations["getOAuth2ConsentRequest"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/auth/requests/consent/accept": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** @description Accept OAuth2 Consent Request + * */ + put: operations["acceptOAuth2ConsentRequest"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/auth/requests/consent/reject": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** @description Reject OAuth2 Consent Request + * */ + put: operations["rejectOAuth2ConsentRequest"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/auth/requests/login": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get OAuth2 Login Request + * */ + get: operations["getOAuth2LoginRequest"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/auth/requests/login/accept": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** @description Accept OAuth2 Login Request + * */ + put: operations["acceptOAuth2LoginRequest"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/auth/requests/login/reject": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** @description Reject OAuth2 Login Request + * */ + put: operations["rejectOAuth2LoginRequest"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/auth/requests/logout/accept": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** @description Accept OAuth2 Logout Request + * */ + put: operations["acceptOAuth2LogoutRequest"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/auth/requests/logout/reject": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** @description Reject OAuth2 Logout Request + * */ + put: operations["rejectOAuth2LogoutRequest"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/session/revoke": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Revoke OAuth2 Session + * */ + post: operations["revokeOAuth2Session"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/token/revoke": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Revoke OAuth2 Token + * */ + post: operations["revokeOAuth2Token"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/tokens/revoke": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Revoke OAuth2 Token + * */ + post: operations["revokeOAuth2Tokens"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/auth": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get OAuth2 Auth + * */ + get: operations["getOAuth2Auth"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/token": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Get OAuth2 Token + * */ + post: operations["getOAuth2Token"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/sessions/logout": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get OAuth2 Sessions Logout + * */ + get: operations["getOAuth2SessionsLogout"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/introspect": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Introspect OAuth2 Token + * */ + post: operations["introspectOAuth2Token"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/bulk-import/users": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Paginated API to get bulk import users + * */ + get: operations["getBulkImportUsers"]; + put?: never; + /** @description Add users for bulk import. Maximum 10000 users can be added in one request. + * */ + post: operations["addBulkImportUsers"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/bulk-import/users/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Delete bulk import users by id. Multiple ids can be passed in the request body. + * */ + post: operations["deleteBulkImportUsers"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/webauthn/user/credential": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get the WebAuthn credential for the user. */ + get: operations["getWebAuthNCredential"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/webauthn/user/credential/list": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description List credentials that were created by the user. */ + get: operations["listWebAuthNCredentials"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/webauthn/options": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get the WebAuthn options. */ + get: operations["getWebAuthNOptions"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/webauthn/user/recover": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Recover the user using the WebAuthn credential. */ + get: operations["recoverWebAuthNUser"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/webauthn/options/register": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Generate the webauthn options for registration. */ + post: operations["generateRegistrationOptions"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/webauthn/options/signin": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Generate the webauthn options for signin. */ + post: operations["generateSigninOptions"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/webauthn/user/credential/register": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Register a new credential for the user */ + post: operations["registerWebAuthNCredential"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/webauthn/signup": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Sign up the user using the WebAuthn credential. */ + post: operations["signUpWebAuthNUser"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/webauthn/signin": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Sign in the user using the WebAuthn credential. */ + post: operations["signInWebAuthNUser"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/webauthn/user/recover/token": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Generate a token to recover the user. */ + post: operations["generateTokenForRecovery"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/webauthn/user/recover/token/consume": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Consume the token to recover the user. */ + post: operations["consumeWebAuthNToken"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/webauthn/user/email": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** @description Update the email of the user. */ + put: operations["updateEmail"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/webauthn/user/credential/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post?: never; + /** @description Remove the WebAuthn credential for the user. */ + delete: operations["removeWebAuthNCredential"]; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/webauthn/options/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post?: never; + /** @description Remove the WebAuthn options. */ + delete: operations["removeWebAuthNOptions"]; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; +} +export type webhooks = Record; +export interface components { + schemas: { + authRecipeUser: { + id?: components["schemas"]["userId"]; + /** @example true */ + isPrimaryUser?: boolean; + tenantIds?: components["schemas"]["tenantId"][]; + timeJoined?: components["schemas"]["timeJoined"]; + emails?: components["schemas"]["email"][]; + phoneNumbers?: components["schemas"]["phoneNumber"][]; + webauthn?: { + credentialIds?: string[]; + }; + thirdParty?: { + id?: components["schemas"]["thirdPartyId"]; + userId?: components["schemas"]["thirdPartyUserId"]; + }[]; + loginMethods?: { + tenantIds?: components["schemas"]["tenantId"][]; + recipeUserId?: components["schemas"]["userId"]; + /** @example true */ + verified?: boolean; + timeJoined?: components["schemas"]["timeJoined"]; + recipeId?: components["schemas"]["recipeId"]; + email?: components["schemas"]["email"]; + phoneNumber?: components["schemas"]["phoneNumber"]; + thirdParty?: { + id?: components["schemas"]["thirdPartyId"]; + userId?: components["schemas"]["thirdPartyUserId"]; + }; + webauthn?: { + credentialIds?: string[]; + }; + }[]; + }; + /** @enum {string} */ + recipeId: "emailpassword" | "passwordless" | "thirdparty" | "webauthn"; + /** @example ZTRiOTBjNz...jI5MTZlODkxw */ + token: string; + emailVerificationVerifyTokenRequest: { + userId?: components["schemas"]["userId"]; + email?: components["schemas"]["email"]; + }; + /** @example google */ + thirdPartyId: string; + /** @example 106347997792363870000 */ + thirdPartyUserId: string; + thirdPartyEmail: { + id?: components["schemas"]["email"]; + isVerified?: components["schemas"]["isVerified"]; + }; + /** @example true */ + isVerified: boolean; + /** @example johndoe@gmail.com */ + email: string; + /** @example password123 */ + password: string; + /** @example fa7a0841-b533-4478-95533-0fde890c3483 */ + userId: string; + /** @example admin */ + role: string; + /** @example 1623918032231 */ + timeJoined: number; + /** @example ZmE3YTA4ND...OzE2MjM5MTgwMzIyMzE= */ + paginationToken: string; + /** @example +14155552671 */ + phoneNumber: string; + /** + * @description Uniquely identifies a code + * @example QZ0Mx9zG9cfqNXmPI0I/67r9bpKghUBDQZeMMbayi+I= + */ + codeId: string; + /** + * @description A random identifier that should be stored on the device that started the sign in process. + * @example TU/52WOcktSv99zqaAZuWJG9BSoS0aRLfCbep8rFEwk= + */ + deviceId: string; + /** + * @description A random identifier that can be used to identify the login attempt/device. + * @example kFmkPQEAJtACiT2w/K8fndEuNm+XozJXSZSlWEr+iGs= + */ + preAuthSessionId: string; + /** + * @description This can be used to authenticate the user when paired with the deviceId + * @example 456123 + */ + userInputCode: string; + /** + * @description URL-safe string that can be used to authenticate the user, without the deviceId + * @example b10lbT_SnDC4flA6Fn7pE5TtG5k5NfigLef4QMBeGA8 + */ + linkCode: string; + /** + * @description The maximum lifetime of the code in milliseconds + * @example 900000 + */ + codeLifetime: number; + /** @enum {string} */ + statusOK: "OK"; + oauthClient: { + /** @example stcl_c6dd9189-33b8-4ec0-8aea-a0ffdaf75fcb */ + clientId?: string; + /** @example Hello */ + clientName?: string; + /** @example T98n1YIMWqr4wOM.~bV4HOPFmO */ + clientSecret?: string; + /** @example [ + * "http://localhost:3000/auth/callback/ory" + * ] */ + redirectUris?: string[]; + /** @example [ + * "authorization_code", + * "refresh_token" + * ] */ + grantTypes?: string[]; + /** @example [ + * "code", + * "id_token" + * ] */ + responseTypes?: string[]; + /** @example offline_access openid email */ + scope?: string; + /** @example [] */ + audience?: string[]; + /** @example */ + policyUri?: string; + /** @example [] */ + allowedCorsOrigins?: string[]; + /** @example */ + tosUri?: string; + /** @example */ + clientUri?: string; + /** @example */ + logoUri?: string; + /** @example client_secret_post */ + tokenEndpointAuthMethod?: string; + /** + * Format: date-time + * @example 2025-02-24T08:14:40Z + */ + createdAt?: string; + /** + * Format: date-time + * @example 2025-02-24T08:14:40.362463Z + */ + updatedAt?: string; + /** @example [ + * "http://localhost:3000" + * ] */ + postLogoutRedirectUris?: string[]; + /** @example {} */ + metadata?: { + [key: string]: unknown; + }; + /** @example 1h0m0s */ + authorizationCodeGrantAccessTokenLifespan?: string | null; + /** @example 1h0m0s */ + authorizationCodeGrantIdTokenLifespan?: string | null; + /** @example 1h0m0s */ + authorizationCodeGrantRefreshTokenLifespan?: string | null; + /** @example 1h0m0s */ + clientCredentialsGrantAccessTokenLifespan?: string | null; + /** @example 1h0m0s */ + implicitGrantAccessTokenLifespan?: string | null; + /** @example 1h0m0s */ + implicitGrantIdTokenLifespan?: string | null; + /** @example 1h0m0s */ + refreshTokenGrantIdTokenLifespan?: string | null; + /** @example 1h0m0s */ + refreshTokenGrantAccessTokenLifespan?: string | null; + /** @example 1h0m0s */ + refreshTokenGrantRefreshTokenLifespan?: string | null; + /** @example false */ + enableRefreshTokenRotation?: boolean; + }; + /** + * @description should be a JSON object (not a JSON literal nor an array) + * @example { + * "preferences": { + * "theme": "dark" + * }, + * "notifications": { + * "email": true + * }, + * "todos": [ + * "example" + * ] + * } + */ + userMetadata: Record; + /** + * @description should be a JSON object (not a JSON literal nor an array) + * @example { + * "notifications": { + * "sms": true + * }, + * "todos": null + * } + */ + userMetadataUpdate: Record; + /** + * @description should be a JSON object (not a JSON literal nor an array) + * @example { + * "test": 123 + * } + */ + userDataInJWT: Record; + /** + * @description should be a JSON object (not a JSON literal nor an array) + * @example { + * "test": 123 + * } + */ + userDataInDatabase: Record; + /** @example false */ + enableAntiCsrf: boolean; + /** @example 68en6gd6-865b-4af6-ba00-96e5c153257d */ + handle: string; + /** @example Error Message */ + message: string; + session: { + handle?: components["schemas"]["handle"]; + userId?: components["schemas"]["userId"]; + userDataInJWT?: components["schemas"]["userDataInJWT"]; + tenantId?: components["schemas"]["tenantId"]; + recipeUserId?: components["schemas"]["userId"]; + }; + cookieInfo: { + token?: components["schemas"]["token"]; + expiry?: components["schemas"]["expiry"]; + createdTime?: components["schemas"]["timeCreated"]; + }; + /** @example 1637262633029 */ + expiry: number; + /** @example 1637262633029 */ + timeCreated: number; + sessionHandles: components["schemas"]["handle"][]; + /** + * @description The payload of the JWT, should be a JSON object. + * @example { + * "custom-claim": "" + * } + */ + createJWTPayload: Record; + /** + * @description The algorithm to use when creating the JWT. + * @enum {string} + */ + createJWTAlgorithm: "RS256"; + /** + * @description This is used as the value for the issuer claim in the JWT payload. + * @example https://api.test.com/ + */ + jwksDomain: string; + /** + * @description Duration in seconds, used to calculate JWT expiry + * @example 86400 + */ + jwtValidity: number; + /** @description A JWK that can be used to verify a JWT */ + jwk: { + alg?: components["schemas"]["createJWTAlgorithm"]; + /** @example RSA */ + kty?: string; + /** @example sig */ + use?: string; + /** @description Unique identifier for the JWK */ + kid?: string; + /** @description X.509 Certificate Chain */ + x5c?: string[]; + }; + unauthorisedMessageResponse: { + status?: components["schemas"]["unauthorisedResponse"]; + message?: components["schemas"]["message"]; + }; + /** @enum {string} */ + helloResponse: "Hello"; + statusOKResponse: { + /** @enum {string} */ + status?: "OK"; + }; + wrongCredentialsResponse: { + /** @enum {string} */ + status?: "WRONG_CREDENTIALS_ERROR"; + }; + unknownUserIdResponse: { + /** @enum {string} */ + status?: "UNKNOWN_USER_ID_ERROR"; + }; + unknownRoleResponse: { + /** @enum {string} */ + status?: "UNKNOWN_ROLE_ERROR"; + }; + /** @enum {string} */ + tokenTheftResponse: "TOKEN_THEFT_DETECTED"; + /** @enum {string} */ + unauthorisedResponse: "UNAUTHORISED"; + /** @enum {string} */ + tryRefreshTokenResponse: "TRY_REFRESH_TOKEN"; + /** @enum {string} */ + internalError: "Internal Error"; + /** @enum {string} */ + notFound: "Not Found"; + /** @enum {string} */ + methodNotSupported: "Method not supported"; + invalidJSON: string; + /** @enum {string} */ + requestUnauthorised: "Invalid API key"; + /** @enum {string} */ + licenseError: "License Error"; + /** @example customer1 */ + tenantId: string; + thirdPartyProviderConfig: { + thirdPartyId: string; + name?: string; + clients?: { + clientType?: string; + clientId?: string; + clientSecret?: string; + scope?: string[]; + forcePKCE?: boolean; + additionalConfig?: Record; + }[]; + authorizationEndpoint?: string; + authorizationEndpointQueryParams?: Record; + tokenEndpoint?: string; + tokenEndpointBodyParams?: Record; + userInfoEndpoint?: string; + userInfoEndpointQueryParams?: Record; + userInfoEndpointHeaders?: Record; + jwksURI?: string; + oidcDiscoveryEndpoint?: string; + /** @default true */ + requireEmail: boolean; + userInfoMap?: { + fromIdTokenPayload?: { + userId?: string; + email?: string; + emailVerified?: string; + }; + fromUserInfoAPI?: { + userId?: string; + email?: string; + emailVerified?: string; + }; + }; + }; + firstFactors: string[]; + requiredSecondaryFactors: string[]; + tenantInput: { + emailPasswordEnabled?: boolean; + thirdPartyEnabled?: boolean; + passwordlessEnabled?: boolean; + firstFactors?: components["schemas"]["firstFactors"]; + requiredSecondaryFactors?: components["schemas"]["requiredSecondaryFactors"]; + coreConfig?: Record; + }; + tenantInputV2: { + firstFactors?: components["schemas"]["firstFactors"]; + requiredSecondaryFactors?: components["schemas"]["requiredSecondaryFactors"]; + coreConfig?: Record; + }; + tenantConfig: { + tenantId: components["schemas"]["tenantId"]; + emailPassword: { + enabled: boolean; + }; + thirdParty: { + enabled: boolean; + providers?: components["schemas"]["thirdPartyProviderConfig"][]; + }; + passwordless: { + enabled: boolean; + }; + firstFactors?: components["schemas"]["firstFactors"]; + requiredSecondaryFactors?: components["schemas"]["requiredSecondaryFactors"]; + coreConfig: Record; + }; + /** @example $argon2d$v=19$m=12,t=3,p=1$aGI4enNvMmd0Zm0wMDAwMA$r6p7qbr6HD+8CD7sBi4HVw */ + passwordHash: string; + /** @enum {string} */ + hashingAlgorithm: "argon2" | "bcrypt" | "firebase_scrypt"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + bulkImportUserId: string; + /** @enum {string} */ + bulkImportUserStatus: "NEW" | "PROCESSING" | "FAILED"; + bulkImportUserRole: { + role: components["schemas"]["role"]; + tenantIds: components["schemas"]["tenantId"][]; + }; + bulkImportTotpDevice: { + /** @example 2PRXZWZAYYDAWCD */ + secretKey: string; + /** @example 0 */ + skew?: number; + /** @example 30 */ + period?: number; + /** @example My Authy App */ + deviceName?: string; + }; + bulkImportUserLoginMethodFields: { + /** @description List of tenant IDs this login method is associated with */ + tenantIds?: components["schemas"]["tenantId"][]; + /** @description Indicates whether the email is verified */ + isVerified?: boolean; + /** @description Indicates whether the login method is the primary login method */ + isPrimary?: boolean; + /** @description Time joined in milliseconds since the epoch */ + timeJoinedInMSSinceEpoch?: number; + }; + bulkImportUserEmailPasswordLoginMethod: components["schemas"]["bulkImportUserLoginMethodFields"] & { + /** @example emailpassword */ + recipeId?: string; + email: components["schemas"]["email"]; + passwordHash: components["schemas"]["passwordHash"]; + /** @example passwordExample */ + plainTextPassword?: string; + hashingAlgorithm: components["schemas"]["hashingAlgorithm"]; + }; + addBulkImportUserLoginMethodResponse: { + /** @example emailpassword */ + recipeId: string; + userId: components["schemas"]["userId"]; + tenants: components["schemas"]["tenantId"][]; + email: components["schemas"]["email"]; + thirdpartyId?: components["schemas"]["thirdPartyId"]; + thirdpartyUserId?: components["schemas"]["thirdPartyUserId"]; + phoneNumber?: components["schemas"]["phoneNumber"]; + }; + bulkImportUserThirdPartyLoginMethod: components["schemas"]["bulkImportUserLoginMethodFields"] & { + /** @example thirdparty */ + recipeId?: string; + thirdPartyId: components["schemas"]["thirdPartyId"]; + thirdPartyUserId: components["schemas"]["thirdPartyUserId"]; + }; + bulkImportUserPasswordlessLoginMethod: (components["schemas"]["bulkImportUserLoginMethodFields"] & { + /** @example passwordless */ + recipeId?: string; + }) & + (components["schemas"]["email"] | components["schemas"]["phoneNumber"]); + bulkImportUser: { + externalUserId?: components["schemas"]["userId"]; + userMetadata?: components["schemas"]["userMetadata"][]; + userRoles?: components["schemas"]["bulkImportUserRole"][]; + totpDevices?: components["schemas"]["bulkImportTotpDevice"][]; + loginMethods?: ( + | components["schemas"]["bulkImportUserEmailPasswordLoginMethod"] + | components["schemas"]["bulkImportUserThirdPartyLoginMethod"] + | components["schemas"]["bulkImportUserPasswordlessLoginMethod"] + )[]; + }; + addBulkImportUserResponse: { + userId?: components["schemas"]["userId"]; + loginMethods?: components["schemas"]["addBulkImportUserLoginMethodResponse"][]; + }; + bulkImportUserResponse: { + id?: components["schemas"]["bulkImportUserId"]; + status?: components["schemas"]["bulkImportUserStatus"]; + createdAt?: components["schemas"]["timeJoined"]; + updatedAt?: components["schemas"]["timeJoined"]; + } & (components["schemas"]["bulkImportUser"] & Record); + tenantConfigV2: { + tenantId: components["schemas"]["tenantId"]; + thirdParty: { + providers?: components["schemas"]["thirdPartyProviderConfig"][]; + }; + firstFactors?: components["schemas"]["firstFactors"]; + requiredSecondaryFactors?: components["schemas"]["requiredSecondaryFactors"]; + coreConfig: Record; + }; + oauthError: { + /** @enum {string} */ + status: "OAUTH_ERROR"; + error: string; + errorDescription: string; + statusCode: number; + }; + }; + responses: { + /** @description error code 400 */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "text/plain": components["schemas"]["invalidJSON"]; + }; + }; + /** @description error code 401 */ + 401: { + headers: { + [name: string]: unknown; + }; + content: { + "text/plain": components["schemas"]["requestUnauthorised"]; + }; + }; + /** @description error code 402 */ + 402: { + headers: { + [name: string]: unknown; + }; + content: { + "text/plain": components["schemas"]["licenseError"]; + }; + }; + /** @description error code 404 */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "text/plain": components["schemas"]["notFound"]; + }; + }; + /** @description error code 405 */ + 405: { + headers: { + [name: string]: unknown; + }; + content: { + "text/plain": components["schemas"]["methodNotSupported"]; + }; + }; + /** @description error code 500 */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "text/plain": components["schemas"]["internalError"]; + }; + }; + /** @description return a simple hello message */ + hello: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["helloResponse"]; + }; + }; + }; + parameters: { + /** @example emailpassword */ + rid: string; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + "api-key": string; + /** @example thirdparty */ + thirdPartyRid: string; + /** @example passwordless */ + passwordlessRid: string; + /** @example emailverification */ + emailVerificationRid: string; + /** @example multitenancy */ + multitenancyRid: string; + /** @example oauth */ + oauthRid: string; + /** @example usermetadata */ + userMetadataRid: string; + /** @example userroles */ + userRolesRid: string; + /** @example session */ + sessionRid: string; + /** @example jwt */ + jwtRID: string; + /** @example useridmapping */ + userIdMappingRid: string; + /** @example dashboard */ + dashboardRid: string; + /** @example totp */ + totpRid: string; + /** @example accountlinking */ + accountLinkingRid: string; + /** @example webauthn */ + webauthnRid: string; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version": string; + /** @example ZmE3YTA4NDEtY...MjM5MTgwMzIyMzE= */ + paginationToken: string; + /** @example 1 */ + limit: number; + timeJoinedOrder: "ASC" | "DESC"; + email: string; + userId: string; + userIdRequired: string; + roleRequired: string; + permissionRequired: string; + /** @description The param should take an array of comma seperated strings */ + includeRecipeIds: string; + bulkImportUserStatus: components["schemas"]["bulkImportUserStatus"]; + }; + requestBodies: never; + headers: never; + pathItems: never; +} +export type $defs = Record; +export interface operations { + canCreatePrimaryUser: { + parameters: { + query: { + recipeUserId: string; + }; + header?: { + /** @example accountlinking */ + rid?: components["parameters"]["accountLinkingRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Indicates success with the status and canCreatePrimaryUser properties */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example true */ + wasAlreadyAPrimaryUser?: boolean; + } + | { + /** @enum {string} */ + status?: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + } + | { + /** @enum {string} */ + status?: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + canLinkAccounts: { + parameters: { + query: { + primaryUserId: string; + recipeUserId: string; + }; + header?: { + /** @example accountlinking */ + rid?: components["parameters"]["accountLinkingRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Indicates success with the status prop */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example true */ + accountsAlreadyLinked?: boolean; + } + | { + /** @enum {string} */ + status?: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + } + | { + /** @enum {string} */ + status?: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + } + | { + /** @enum {string} */ + status?: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + createPrimaryUser: { + parameters: { + query?: never; + header?: { + /** @example accountlinking */ + rid?: components["parameters"]["accountLinkingRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId: string; + }; + }; + }; + responses: { + /** @description Indicates success with the status and primaryUserId properties */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example true */ + wasAlreadyAPrimaryUser?: boolean; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status?: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + } + | { + /** @enum {string} */ + status?: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + linkAccounts: { + parameters: { + query?: never; + header?: { + /** @example accountlinking */ + rid?: components["parameters"]["accountLinkingRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId: string; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId: string; + }; + }; + }; + responses: { + /** @description Indicates success with the status and accountsAlreadyLinked properties */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example true */ + accountsAlreadyLinked?: boolean; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status?: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + } + | { + /** @enum {string} */ + status?: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + user?: components["schemas"]["authRecipeUser"]; + description?: string; + } + | { + /** @enum {string} */ + status?: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + unlinkAccounts: { + parameters: { + query?: never; + header?: { + /** @example accountlinking */ + rid?: components["parameters"]["accountLinkingRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId: string; + }; + }; + }; + responses: { + /** @description Indicates success with the status and accountsUnlinked properties */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + /** @example true */ + wasRecipeUserDeleted?: boolean; + /** @example true */ + wasLinked?: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + updateTotpDeviceName: { + parameters: { + query?: never; + header?: { + /** @example totp */ + rid?: components["parameters"]["totpRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + userId: components["schemas"]["userId"]; + /** @example My Authy App */ + existingDeviceName: string; + /** @example A better name for my TOTP device */ + newDeviceName: string; + }; + }; + }; + responses: { + /** @description Indicates success with the status property */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + } + | { + /** @enum {string} */ + status?: "UNKNOWN_DEVICE_ERROR"; + } + | { + /** @enum {string} */ + status?: "DEVICE_ALREADY_EXISTS_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + createTotpDevice: { + parameters: { + query?: never; + header?: { + /** @example totp */ + rid?: components["parameters"]["totpRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + userId: components["schemas"]["userId"]; + /** @example My Authy App */ + deviceName?: string; + /** @example 0 */ + skew: number; + /** @example 30 */ + period: number; + }; + }; + }; + responses: { + /** @description Indicates success with the status and secret properties */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example JBSWY3DPEHPK3PXP */ + secret?: string; + /** @example d1 */ + deviceName?: string; + } + | { + /** @enum {string} */ + status?: "DEVICE_ALREADY_EXISTS_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getTotpDevices: { + parameters: { + query: { + userId: string; + }; + header?: { + /** @example totp */ + rid?: components["parameters"]["totpRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Retrives all TOTP devices */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + devices?: { + name?: string; + period?: number; + skew?: number; + verified?: boolean; + }[]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + importTotpDevice: { + parameters: { + query?: never; + header?: { + /** @example totp */ + rid?: components["parameters"]["totpRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + userId: components["schemas"]["userId"]; + /** @example My Authy App */ + deviceName?: string; + /** @example 0 */ + skew: number; + /** @example 30 */ + period: number; + /** @example BSWY3DPEMOWNFUWJLDIWNDNDPONBIUFG */ + secretKey: string; + }; + }; + }; + responses: { + /** @description Indicates success with the status and secret properties */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example d1 */ + deviceName?: string; + } + | { + /** @enum {string} */ + status?: "DEVICE_ALREADY_EXISTS_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + removeTotpDevice: { + parameters: { + query?: never; + header?: { + /** @example totp */ + rid?: components["parameters"]["totpRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + userId: components["schemas"]["userId"]; + /** @example My Authy App */ + deviceName: string; + }; + }; + }; + responses: { + /** @description Indicates success with the status property */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + /** @example true */ + didDeviceExist?: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + verifyTotpCode: { + parameters: { + query?: never; + header?: { + /** @example totp */ + rid?: components["parameters"]["totpRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + userId: components["schemas"]["userId"]; + /** @example 123456 */ + totp: string; + /** @example false */ + allowUnverifiedDevices: boolean; + }; + }; + }; + responses: { + /** @description Indicates success with the status property */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + } + | { + /** @enum {string} */ + status?: "INVALID_TOTP_ERROR"; + /** @example 2 */ + currentNumberOfFailedAttempts?: number; + /** @example 5 */ + maxNumberOfFailedAttempts?: number; + } + | { + /** @enum {string} */ + status?: "UNKNOWN_USER_ID_ERROR"; + } + | { + /** @enum {string} */ + status?: "LIMIT_REACHED_ERROR"; + /** @example 90000 */ + retryAfterMs?: number; + /** @example 2 */ + currentNumberOfFailedAttempts?: number; + /** @example 5 */ + maxNumberOfFailedAttempts?: number; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + verifyTotpDevice: { + parameters: { + query?: never; + header?: { + /** @example totp */ + rid?: components["parameters"]["totpRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + userId: components["schemas"]["userId"]; + /** @example My Authy App */ + deviceName: string; + /** @example 123456 */ + totp: string; + }; + }; + }; + responses: { + /** @description Indicates success with the status property */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example false */ + wasAlreadyVerified?: boolean; + } + | { + /** @enum {string} */ + status?: "UNKNOWN_DEVICE_ERROR"; + } + | { + /** @enum {string} */ + status?: "INVALID_TOTP_ERROR"; + /** @example 2 */ + currentNumberOfFailedAttempts?: number; + /** @example 5 */ + maxNumberOfFailedAttempts?: number; + } + | { + /** @enum {string} */ + status?: "LIMIT_REACHED_ERROR"; + /** @example 90000 */ + retryAfterMs?: number; + /** @example 2 */ + currentNumberOfFailedAttempts?: number; + /** @example 5 */ + maxNumberOfFailedAttempts?: number; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + userIdMappingGetMapping: { + parameters: { + query: { + userId: string; + userIdType?: "SUPERTOKENS" | "EXTERNAL" | "ANY"; + }; + header?: { + /** @example useridmapping */ + rid?: components["parameters"]["userIdMappingRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Retrives a userId mapping */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status: components["schemas"]["statusOK"]; + superTokensUserId: components["schemas"]["userId"]; + /** @example externalId */ + externalUserId: string; + /** @example Info about external userId */ + externalUserIdInfo?: string; + } + | { + /** @enum {string} */ + status?: "UNKNOWN_MAPPING_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + userIdMappingCreateMapping: { + parameters: { + query?: never; + header?: { + /** @example useridmapping */ + rid?: components["parameters"]["userIdMappingRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + superTokensUserId: components["schemas"]["userId"]; + /** @example externalId */ + externalUserId: string; + /** @example Info about external userId */ + externalUserIdInfo?: string; + force?: boolean; + }; + }; + }; + responses: { + /** @description Indicates success with the status property */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + } + | { + /** @enum {string} */ + status?: "UNKNOWN_SUPERTOKENS_USER_ID_ERROR"; + } + | { + /** @enum {string} */ + status?: "USER_ID_MAPPING_ALREADY_EXISTS_ERROR"; + doesSuperTokensUserIdExist?: boolean; + doesExternalUserIdExist?: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + userIdMappingRemoveMapping: { + parameters: { + query?: never; + header?: { + /** @example useridmapping */ + rid?: components["parameters"]["userIdMappingRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + userId: components["schemas"]["userId"]; + /** @enum {string} */ + userIdType?: "SUPERTOKENS" | "EXTERNAL" | "ANY"; + force?: boolean; + }; + }; + }; + responses: { + /** @description Indicates success with the status property */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + didMappingExist?: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + userIdMappingUpateExternalUserIdInfo: { + parameters: { + query?: never; + header?: { + /** @example useridmapping */ + rid?: components["parameters"]["userIdMappingRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + userId: components["schemas"]["userId"]; + /** @enum {string} */ + userIdType?: "SUPERTOKENS" | "EXTERNAL" | "ANY"; + /** @example new external userId info */ + externalUserIdInfo: string | null; + }; + }; + }; + responses: { + /** @description Indicates success with the status property */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + } + | { + /** @enum {string} */ + status?: "UNKNOWN_MAPPING_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + passwordlessCheckCode: { + parameters: { + query?: never; + header?: { + /** @example passwordless */ + rid?: components["parameters"]["passwordlessRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": + | { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + linkCode: components["schemas"]["linkCode"]; + } + | { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + deviceId: components["schemas"]["deviceId"]; + userInputCode: components["schemas"]["userInputCode"]; + }; + }; + }; + responses: { + /** @description Indicates success with the status property */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + consumedDevice?: { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + /** @example 2 */ + failedCodeInputAttemptCount: number; + email?: components["schemas"]["email"]; + phoneNumber?: components["schemas"]["phoneNumber"]; + }; + } + | { + /** @enum {string} */ + status?: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR"; + /** @example 2 */ + failedCodeInputAttemptCount?: number; + /** @example 5 */ + maximumCodeInputAttempts?: number; + } + | { + /** @enum {string} */ + status?: "RESTART_FLOW_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + passwordlessTryUseCode: { + parameters: { + query?: never; + header?: { + /** @example passwordless */ + rid?: components["parameters"]["passwordlessRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": + | { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + linkCode: components["schemas"]["linkCode"]; + } + | { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + deviceId: components["schemas"]["deviceId"]; + userInputCode: components["schemas"]["userInputCode"]; + }; + }; + }; + responses: { + /** @description Indicates success with the status property */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example true */ + createdNewUser?: boolean; + user?: components["schemas"]["authRecipeUser"]; + recipeUserId?: components["schemas"]["userId"]; + consumedDevice?: { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + /** @example 2 */ + failedCodeInputAttemptCount: number; + email?: components["schemas"]["email"]; + phoneNumber?: components["schemas"]["phoneNumber"]; + }; + } + | { + /** @enum {string} */ + status?: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR"; + /** @example 2 */ + failedCodeInputAttemptCount?: number; + /** @example 5 */ + maximumCodeInputAttempts?: number; + } + | { + /** @enum {string} */ + status?: "RESTART_FLOW_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + passwordlessStartSignIn: { + parameters: { + query?: never; + header?: { + /** @example passwordless */ + rid?: components["parameters"]["passwordlessRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": + | { + email: components["schemas"]["email"]; + userInputCode?: components["schemas"]["userInputCode"]; + } + | { + phoneNumber: components["schemas"]["phoneNumber"]; + userInputCode?: components["schemas"]["userInputCode"]; + } + | { + deviceId: components["schemas"]["deviceId"]; + userInputCode?: components["schemas"]["userInputCode"]; + }; + }; + }; + responses: { + /** @description Starts the passwordless login process */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + preAuthSessionId?: components["schemas"]["preAuthSessionId"]; + codeId?: components["schemas"]["codeId"]; + deviceId?: components["schemas"]["deviceId"]; + userInputCode?: components["schemas"]["userInputCode"]; + linkCode?: components["schemas"]["linkCode"]; + timeCreated?: components["schemas"]["timeCreated"]; + codeLifetime?: components["schemas"]["codeLifetime"]; + } + | { + /** @enum {string} */ + status?: "RESTART_FLOW_ERROR" | "USER_INPUT_CODE_ALREADY_USED_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + passwordlessRevokeCode: { + parameters: { + query?: never; + header?: { + /** @example passwordless */ + rid?: components["parameters"]["passwordlessRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": + | { + codeId: components["schemas"]["codeId"]; + } + | { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + }; + }; + }; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + passwordlessListCodes: { + parameters: { + query?: { + /** @description Use this parameter to get information about all devices associated with an email (without the other query params) */ + email?: string; + /** @description Use this parameter to get information about all devices associated with a phoneNumber (without the other query params) */ + phoneNumber?: components["schemas"]["phoneNumber"]; + /** @description Use this parameter to get information about a single device (without the other query params) */ + deviceId?: components["schemas"]["deviceId"]; + /** @description Use this parameter to get information about a single device (without the other query params) */ + preAuthSessionId?: components["schemas"]["preAuthSessionId"]; + }; + header?: { + /** @example passwordless */ + rid?: components["parameters"]["passwordlessRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description List of all active passwordless codes of the user */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + devices?: { + preAuthSessionId?: components["schemas"]["preAuthSessionId"]; + /** @example 2 */ + failedCodeInputAttemptCount?: number; + email?: components["schemas"]["email"]; + phoneNumber?: components["schemas"]["phoneNumber"]; + codes?: { + codeId?: components["schemas"]["codeId"]; + timeCreated?: components["schemas"]["timeCreated"]; + codeLifetime?: components["schemas"]["codeLifetime"]; + }[]; + }[]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + passwordlessRevokeAllCodesOfUser: { + parameters: { + query?: never; + header?: { + /** @example passwordless */ + rid?: components["parameters"]["passwordlessRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": + | { + email: components["schemas"]["email"]; + } + | { + phoneNumber: components["schemas"]["phoneNumber"]; + }; + }; + }; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + passwordlessGetUser: { + parameters: { + query?: { + userId?: components["parameters"]["userId"]; + /** @description Use exactly one of phoneNumber, email or userId */ + email?: components["schemas"]["email"]; + /** @description Use exactly one of phoneNumber, email or userId */ + phoneNumber?: components["schemas"]["phoneNumber"]; + }; + header?: { + /** @example passwordless */ + rid?: components["parameters"]["passwordlessRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Get a user's information. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status?: "UNKNOWN_USER_ID_ERROR" | "UNKNOWN_EMAIL_ERROR" | "UNKNOWN_PHONE_NUMBER_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + passwordlessPutUser: { + parameters: { + query?: never; + header?: { + /** @example passwordless */ + rid?: components["parameters"]["passwordlessRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + recipeUserId?: components["schemas"]["userId"]; + email?: components["schemas"]["email"] & unknown; + phoneNumber?: components["schemas"]["phoneNumber"] & unknown; + }; + }; + }; + responses: { + /** @description update user's information */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + /** @enum {string} */ + status?: + | "OK" + | "UNKNOWN_USER_ID_ERROR" + | "EMAIL_ALREADY_EXISTS_ERROR" + | "PHONE_NUMBER_ALREADY_EXISTS_ERROR"; + } + | { + /** @enum {string} */ + status?: "EMAIL_CHANGE_NOT_ALLOWED_ERROR" | "PHONE_NUMBER_CHANGE_NOT_ALLOWED_ERROR"; + reason?: string; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + emailPasswordSignin: { + parameters: { + query?: never; + header?: { + /** @example emailpassword */ + rid?: components["parameters"]["rid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + email?: components["schemas"]["email"]; + password?: components["schemas"]["password"]; + }; + }; + }; + responses: { + /** @description signin response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + recipeUserId?: components["schemas"]["userId"]; + } + | components["schemas"]["wrongCredentialsResponse"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + emailPasswordSignup: { + parameters: { + query?: never; + header?: { + /** @example emailpassword */ + rid?: components["parameters"]["rid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + email?: components["schemas"]["email"]; + password?: components["schemas"]["password"]; + }; + }; + }; + responses: { + /** @description signup response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + recipeUserId?: components["schemas"]["userId"]; + } + | { + /** @enum {string} */ + status?: "EMAIL_ALREADY_EXISTS_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + emailPasswordGetUser: { + parameters: { + query?: { + /** @description use either email or userId, not both */ + email?: components["schemas"]["email"]; + /** @description use either email or userId, not both */ + userId?: components["schemas"]["userId"]; + }; + header?: { + /** @example emailpassword */ + rid?: components["parameters"]["rid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description get user's information */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status?: "UNKNOWN_USER_ID_ERROR" | "UNKNOWN_EMAIL_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + emailPasswordPutUser: { + parameters: { + query?: never; + header?: { + /** @example emailpassword */ + rid?: components["parameters"]["rid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + recipeUserId?: components["schemas"]["userId"]; + email?: components["schemas"]["email"]; + password?: components["schemas"]["password"]; + }; + }; + }; + responses: { + /** @description update user's information */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + /** @enum {string} */ + status?: "OK" | "UNKNOWN_USER_ID_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR"; + } + | { + /** @enum {string} */ + status?: "EMAIL_CHANGE_NOT_ALLOWED_ERROR"; + reason?: string; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + emailPasswordGetPasswordResetToken: { + parameters: { + query?: never; + header?: { + /** @example emailpassword */ + rid?: components["parameters"]["rid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + userId: components["schemas"]["userId"]; + email: components["schemas"]["email"]; + }; + }; + }; + responses: { + /** @description Generate a new reset password token for this user */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + token?: components["schemas"]["token"]; + } + | components["schemas"]["unknownUserIdResponse"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + emailPasswordGetPasswordReset: { + parameters: { + query?: never; + header?: { + /** @example emailpassword */ + rid?: components["parameters"]["rid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @enum {string} */ + method?: "token"; + token?: components["schemas"]["token"]; + /** @example newpassword123 */ + newPassword?: string; + }; + }; + }; + responses: { + /** @description Reset a password using password reset token */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + userId?: components["schemas"]["userId"]; + } + | { + /** @enum {string} */ + status?: "RESET_PASSWORD_INVALID_TOKEN_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + userImport: { + parameters: { + query?: never; + header?: { + /** @example emailpassword */ + rid?: components["parameters"]["rid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + email?: components["schemas"]["email"]; + passwordHash?: components["schemas"]["passwordHash"]; + hashingAlgorithm?: components["schemas"]["hashingAlgorithm"]; + }; + }; + }; + responses: { + /** @description import user response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + didUserAlreadyExist?: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + emailPasswordResetPasswordConsumeToken: { + parameters: { + query?: never; + header?: { + /** @example emailpassword */ + rid?: components["parameters"]["rid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + token?: components["schemas"]["token"]; + }; + }; + }; + responses: { + /** @description Consume a password reset token */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + userId?: components["schemas"]["userId"]; + email?: components["schemas"]["email"]; + } + | { + /** @enum {string} */ + status?: "RESET_PASSWORD_INVALID_TOKEN_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + thirdPartySigninup: { + parameters: { + query?: never; + header?: { + /** @example thirdparty */ + rid?: components["parameters"]["thirdPartyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + thirdPartyId?: components["schemas"]["thirdPartyId"]; + thirdPartyUserId?: components["schemas"]["thirdPartyUserId"]; + email?: components["schemas"]["thirdPartyEmail"]; + }; + }; + }; + responses: { + /** @description Signin/up a user */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example true */ + createdNewUser?: boolean; + user?: components["schemas"]["authRecipeUser"]; + recipeUserId?: components["schemas"]["userId"]; + } + | { + /** @enum {string} */ + status?: "EMAIL_CHANGE_NOT_ALLOWED_ERROR"; + reason?: string; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + thirdPartyGetUser: { + parameters: { + query?: { + userId?: components["parameters"]["userId"]; + /** @description Either use userId or thirdPartyId and thirdPartyUserId */ + thirdPartyId?: components["schemas"]["thirdPartyId"]; + /** @description Either use userId or thirdPartyId and thirdPartyUserId */ + thirdPartyUserId?: components["schemas"]["thirdPartyUserId"]; + }; + header?: { + /** @example thirdparty */ + rid?: components["parameters"]["thirdPartyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Get a user's information. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status?: "UNKNOWN_USER_ID_ERROR" | "UNKNOWN_THIRD_PARTY_USER_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + thirdPartyGetUsersByEmail: { + parameters: { + query: { + /** @description User's email */ + email: string; + }; + header?: { + /** @example thirdparty */ + rid?: components["parameters"]["thirdPartyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Get all users associated with given email */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + users?: components["schemas"]["authRecipeUser"][]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 500: components["responses"]["500"]; + }; + }; + emailVerificationVerifyToken: { + parameters: { + query?: never; + header?: { + /** @example emailverification */ + rid?: components["parameters"]["emailVerificationRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": components["schemas"]["emailVerificationVerifyTokenRequest"]; + }; + }; + responses: { + /** @description Generate a new email verification token for this user */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + token?: components["schemas"]["token"]; + } + | { + /** @enum {string} */ + status?: "EMAIL_ALREADY_VERIFIED_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + emailVerificationVerifyTokenRemove: { + parameters: { + query?: never; + header?: { + /** @example emailverification */ + rid?: components["parameters"]["emailVerificationRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": components["schemas"]["emailVerificationVerifyTokenRequest"]; + }; + }; + responses: { + /** @description OK response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @enum {string} */ + status?: "OK"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + emailVerificationVerify: { + parameters: { + query?: never; + header?: { + /** @example emailverification */ + rid?: components["parameters"]["emailVerificationRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @enum {string} */ + method?: "token"; + token?: components["schemas"]["token"]; + }; + }; + }; + responses: { + /** @description Verify an email */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + userId?: components["schemas"]["userId"]; + email?: components["schemas"]["email"]; + } + | { + /** @enum {string} */ + status?: "EMAIL_VERIFICATION_INVALID_TOKEN_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + emailVerificationVerifyGet: { + parameters: { + query?: { + userId?: components["parameters"]["userId"]; + email?: components["parameters"]["email"]; + }; + header?: { + /** @example emailverification */ + rid?: components["parameters"]["emailVerificationRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Verify an email */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + isVerified?: components["schemas"]["isVerified"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + emailVerificationVerifyRemove: { + parameters: { + query?: never; + header?: { + /** @example emailverification */ + rid?: components["parameters"]["emailVerificationRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": components["schemas"]["emailVerificationVerifyTokenRequest"]; + }; + }; + responses: { + /** @description OK response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @enum {string} */ + status?: "OK"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + userMetadataRead: { + parameters: { + query: { + userId: components["parameters"]["userIdRequired"]; + }; + header?: { + /** @example usermetadata */ + rid?: components["parameters"]["userMetadataRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + metadata?: components["schemas"]["userMetadata"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + userMetadataUpdate: { + parameters: { + query?: never; + header?: { + /** @example usermetadata */ + rid?: components["parameters"]["userMetadataRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + userId?: components["schemas"]["userId"]; + metadataUpdate?: components["schemas"]["userMetadataUpdate"]; + }; + }; + }; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + metadata?: components["schemas"]["userMetadata"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + userMetadataDelete: { + parameters: { + query?: never; + header?: { + /** @example usermetadata */ + rid?: components["parameters"]["userMetadataRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + userId?: components["schemas"]["userId"]; + }; + }; + }; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + addUserRole: { + parameters: { + query?: never; + header?: { + /** @example userroles */ + rid?: components["parameters"]["userRolesRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + userId: components["schemas"]["userId"]; + role: components["schemas"]["role"]; + }; + }; + }; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example true */ + didUserAlreadyHaveRole?: boolean; + } + | components["schemas"]["unknownRoleResponse"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + removeUserRole: { + parameters: { + query?: never; + header?: { + /** @example userroles */ + rid?: components["parameters"]["userRolesRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + userId: components["schemas"]["userId"]; + role: components["schemas"]["role"]; + }; + }; + }; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example true */ + didUserHaveRole?: boolean; + } + | components["schemas"]["unknownRoleResponse"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getUserRoles: { + parameters: { + query: { + userId: components["parameters"]["userIdRequired"]; + }; + header?: { + /** @example userroles */ + rid?: components["parameters"]["userRolesRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + roles?: components["schemas"]["role"][]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getRoleUsers: { + parameters: { + query: { + role: components["parameters"]["roleRequired"]; + }; + header?: { + /** @example userroles */ + rid?: components["parameters"]["userRolesRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + users?: components["schemas"]["userId"][]; + } + | components["schemas"]["unknownRoleResponse"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + putRole: { + parameters: { + query?: never; + header?: { + /** @example userroles */ + rid?: components["parameters"]["userRolesRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + role: components["schemas"]["role"]; + permissions?: string[]; + }; + }; + }; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + /** @example true */ + createdNewRole?: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getRolePermissions: { + parameters: { + query: { + role: components["parameters"]["roleRequired"]; + }; + header?: { + /** @example userroles */ + rid?: components["parameters"]["userRolesRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + permissions?: string[]; + } + | components["schemas"]["unknownRoleResponse"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + removeRolePermissions: { + parameters: { + query?: never; + header?: { + /** @example userroles */ + rid?: components["parameters"]["userRolesRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + role: components["schemas"]["role"]; + permissions?: string[]; + }; + }; + }; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + } + | components["schemas"]["unknownRoleResponse"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getPermissionRoles: { + parameters: { + query: { + permission: components["parameters"]["permissionRequired"]; + }; + header?: { + /** @example userroles */ + rid?: components["parameters"]["userRolesRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + roles?: string[]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + removeRole: { + parameters: { + query?: never; + header?: { + /** @example userroles */ + rid?: components["parameters"]["userRolesRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + role: components["schemas"]["role"]; + }; + }; + }; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + /** @example true */ + didRoleExist?: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getRoles: { + parameters: { + query?: never; + header?: { + /** @example userroles */ + rid?: components["parameters"]["userRolesRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + roles?: string[]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + createNewSession: { + parameters: { + query?: never; + header?: { + /** @example session */ + rid?: components["parameters"]["sessionRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + userId?: components["schemas"]["userId"]; + userDataInJWT?: components["schemas"]["userDataInJWT"]; + userDataInDatabase?: components["schemas"]["userDataInDatabase"]; + enableAntiCsrf?: components["schemas"]["enableAntiCsrf"]; + /** + * @description Decides if the token should be signed with a dynamic or static key, defaults to true + * @example false + */ + useDynamicSigningKey?: boolean; + }; + }; + }; + responses: { + /** @description Create a new Session */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + session?: components["schemas"]["session"]; + accessToken?: components["schemas"]["cookieInfo"]; + refreshToken?: components["schemas"]["cookieInfo"]; + antiCsrfToken?: components["schemas"]["token"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getSessionInfo: { + parameters: { + query?: { + sessionHandle?: components["schemas"]["handle"]; + }; + header?: { + /** @example session */ + rid?: components["parameters"]["sessionRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Get user and session information for a given session handle */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + userDataInDatabase?: components["schemas"]["userDataInDatabase"]; + userDataInJWT?: components["schemas"]["userDataInJWT"]; + userId?: components["schemas"]["userId"]; + expiry?: components["schemas"]["expiry"]; + timeCreated?: components["schemas"]["timeCreated"]; + sessionHandle?: components["schemas"]["handle"]; + tenantId?: components["schemas"]["tenantId"]; + } + | components["schemas"]["unauthorisedMessageResponse"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + deleteSession: { + parameters: { + query?: never; + header?: { + /** @example session */ + rid?: components["parameters"]["sessionRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": + | { + sessionHandles?: components["schemas"]["sessionHandles"]; + } + | { + userId: components["schemas"]["userId"]; + revokeAcrossAllTenants?: boolean; + }; + }; + }; + responses: { + /** @description Delete a session */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + sessionHandlesRevoked?: components["schemas"]["sessionHandles"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + verifySession: { + parameters: { + query?: never; + header?: { + /** @example session */ + rid?: components["parameters"]["sessionRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + accessToken?: components["schemas"]["token"]; + enableAntiCsrf?: components["schemas"]["enableAntiCsrf"]; + /** @example false */ + doAntiCsrfCheck?: boolean; + /** + * @description Decides if we always check if the session exists in the DB or just do token validation, defaults to false. + * @example false + */ + checkDatabase?: boolean; + antiCsrfToken?: components["schemas"]["token"]; + }; + }; + }; + responses: { + /** @description Verify a session */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + session?: components["schemas"]["session"]; + accessToken?: components["schemas"]["cookieInfo"]; + } + | components["schemas"]["unauthorisedMessageResponse"] + | { + status?: components["schemas"]["tryRefreshTokenResponse"]; + message?: components["schemas"]["message"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + refreshSession: { + parameters: { + query?: never; + header?: { + /** @example session */ + rid?: components["parameters"]["sessionRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + refreshToken: components["schemas"]["token"]; + enableAntiCsrf: components["schemas"]["enableAntiCsrf"]; + antiCsrfToken?: components["schemas"]["token"]; + useDynamicSigningKey: boolean; + }; + }; + }; + responses: { + /** @description Refresh a session */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + session?: components["schemas"]["session"]; + accessToken?: components["schemas"]["cookieInfo"]; + refreshToken?: components["schemas"]["cookieInfo"]; + antiCsrfToken?: components["schemas"]["token"]; + } + | { + status?: components["schemas"]["tokenTheftResponse"]; + session?: { + handle?: components["schemas"]["handle"]; + userId?: components["schemas"]["userId"]; + }; + } + | components["schemas"]["unauthorisedMessageResponse"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getUserSessionHandles: { + parameters: { + query?: { + userId?: components["parameters"]["userId"]; + fetchAcrossAllTenants?: "true" | "false"; + }; + header?: { + /** @example session */ + rid?: components["parameters"]["sessionRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Get user Session Handles */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + sessionHandles?: components["schemas"]["sessionHandles"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + regenerateSession: { + parameters: { + query?: never; + header?: { + /** @example session */ + rid?: components["parameters"]["sessionRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + accessToken?: components["schemas"]["token"]; + userDataInJWT?: components["schemas"]["userDataInJWT"]; + }; + }; + }; + responses: { + /** @description Regenerate user session */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + session?: components["schemas"]["session"]; + accessToken?: components["schemas"]["cookieInfo"]; + } + | components["schemas"]["unauthorisedMessageResponse"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getSessionData: { + parameters: { + query?: { + /** @description Users session handle */ + sessionHandle?: components["schemas"]["handle"]; + }; + header?: { + /** @example session */ + rid?: components["parameters"]["sessionRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Get Session Data */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + userDataInDatabase?: components["schemas"]["userDataInDatabase"]; + } + | components["schemas"]["unauthorisedMessageResponse"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + putSessionData: { + parameters: { + query?: never; + header?: { + /** @example session */ + rid?: components["parameters"]["sessionRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + sessionHandle?: components["schemas"]["handle"]; + userDataInDatabase?: components["schemas"]["userDataInDatabase"]; + }; + }; + }; + responses: { + /** @description Change Session Data */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | components["schemas"]["statusOKResponse"] + | components["schemas"]["unauthorisedMessageResponse"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + createSignedJWT: { + parameters: { + query?: never; + header?: { + /** @example jwt */ + rid?: components["parameters"]["jwtRID"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + payload?: components["schemas"]["createJWTPayload"]; + algorithm?: components["schemas"]["createJWTAlgorithm"]; + jwksDomain?: components["schemas"]["jwksDomain"]; + validity?: components["schemas"]["jwtValidity"]; + /** + * @description Decides if the token should be signed with a dynamic or static key, defaults to true + * @example true + */ + useStaticSigningKey?: boolean; + }; + }; + }; + responses: { + /** @description Create a signed JWT */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c */ + jwt?: string; + } + | { + /** @enum {string} */ + status?: "UNSUPPORTED_ALGORITHM_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getJWTData: { + parameters: { + query?: { + /** @description Users session handle */ + sessionHandle?: components["schemas"]["handle"]; + }; + header?: { + /** @example session */ + rid?: components["parameters"]["sessionRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Get JWT Data */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + userDataInJWT?: components["schemas"]["userDataInJWT"]; + } + | components["schemas"]["unauthorisedMessageResponse"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + putJWTData: { + parameters: { + query?: never; + header?: { + /** @example session */ + rid?: components["parameters"]["sessionRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + sessionHandle?: components["schemas"]["handle"]; + userDataInJWT?: components["schemas"]["userDataInJWT"]; + }; + }; + }; + responses: { + /** @description Change JWT Data for a session */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | components["schemas"]["statusOKResponse"] + | components["schemas"]["unauthorisedMessageResponse"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + updateDashboardUser: { + parameters: { + query?: never; + header?: { + /** @example dashboard */ + rid?: components["parameters"]["dashboardRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": + | { + /** @example test@example.com */ + email?: string; + /** @example password@123 */ + newPassword?: string; + /** @example test2@example.com */ + newEmail?: string; + } + | { + /** @example ue21r-fw32r3-d121-d1 */ + userId?: string; + /** @example password@123 */ + newPassword?: string; + /** @example test2@example.com */ + newEmail?: string; + }; + }; + }; + responses: { + /** @description Indicates success with the status property */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + /** @enum {string} */ + status?: "OK"; + user?: { + /** @example r23r-f235th54-g3413gf-r32dr2 */ + userId?: string; + /** @example test@example.com */ + email?: string; + /** @example 391238234792 */ + timeCreated?: number; + }; + } + | { + /** @enum {string} */ + status?: "EMAIL_ALREADY_EXISTS_ERROR"; + } + | { + /** @enum {string} */ + status?: "PASSWORD_WEAK_ERROR"; + /** @example Your password must have at least 8 characters */ + message?: string; + } + | { + /** @enum {string} */ + status?: "INVALID_EMAIL_ERROR"; + } + | { + /** @enum {string} */ + status?: "UNKNOWN_USER_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + createDashboardUser: { + parameters: { + query?: never; + header?: { + /** @example dashboard */ + rid?: components["parameters"]["dashboardRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example test@example.com */ + email?: string; + /** @example password@123 */ + password?: string; + }; + }; + }; + responses: { + /** @description Indicates success with the status property */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + /** @enum {string} */ + status?: "OK"; + user?: { + /** @example example-userid */ + userId?: string; + /** @example test@example.com */ + email?: string; + /** @example 1231321231 */ + timeCreated?: number; + }; + } + | { + /** @enum {string} */ + status?: "EMAIL_ALREADY_EXISTS_ERROR"; + } + | { + /** @enum {string} */ + status?: "PASSWORD_WEAK_ERROR"; + /** @example Your password must have at least 8 characters */ + message?: string; + } + | { + /** @enum {string} */ + status?: "INVALID_EMAIL_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + /** @description Indicates ayment required */ + 402: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @enum {string} */ + status?: "USER_LIMIT_REACHED_ERROR"; + /** @example You have reached the free limit for creating users, please purchase the dashboard feature to create new users */ + message?: string; + }; + }; + }; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + deleteDashboardUser: { + parameters: { + query?: { + email?: string; + userId?: string; + }; + header?: { + /** @example dashboard */ + rid?: components["parameters"]["dashboardRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Indicates success with the status property */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + didUserExist?: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getAllDashboardUsers: { + parameters: { + query?: never; + header?: { + /** @example dashboard */ + rid?: components["parameters"]["dashboardRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description get a list of dashboard users */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @enum {string} */ + status?: "OK"; + users?: { + /** @example test@example.com */ + email?: string; + /** @example uf2323-f223r233-f23-f23-f2f32 */ + userId?: string; + /** @example 16382348324 */ + timeCreated?: number; + /** @example false */ + isSuspended?: boolean; + }[]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + verifyDashboardUserSession: { + parameters: { + query?: never; + header?: { + /** @example dashboard */ + rid?: components["parameters"]["dashboardRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example rf32f-f32342f-32f-323r2f3-23 */ + sessionId?: string; + }; + }; + }; + responses: { + /** @description Indicates success with the status property */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + /** @enum {string} */ + status?: "OK"; + email?: string; + } + | { + /** @enum {string} */ + status?: "USER_SUSPENDED_ERROR"; + /** @example You have crossed the free dashboard user limit. Please purchase the dashboard feature or login with a valid user account */ + message?: string; + } + | { + /** @enum {string} */ + status?: "INVAlID_SESSION_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + RevokeDashboardUsersSession: { + parameters: { + query?: { + sessionId?: string; + }; + header?: { + /** @example dashboard */ + rid?: components["parameters"]["dashboardRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Indicates success with the status property */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + signInDashboardUser: { + parameters: { + query?: never; + header?: { + /** @example dashboard */ + rid?: components["parameters"]["dashboardRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example test@example.com */ + email?: string; + /** @example password@123 */ + password?: string; + }; + }; + }; + responses: { + /** @description Indicates success with the status property */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + /** @enum {string} */ + status?: "OK"; + /** @example null */ + sessionId?: string; + } + | { + /** @enum {string} */ + status?: "USER_SUSPENDED_ERROR"; + /** @example You have crossed the free dashboard user limit. Please purchase the dashboard feature or login with a valid user account */ + message?: string; + } + | { + /** @enum {string} */ + status?: "INVAlID_CREDENTIALS_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getAllSessionsForDashboardUser: { + parameters: { + query?: { + userId?: string; + }; + header?: { + /** @example dashboard */ + rid?: components["parameters"]["dashboardRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description get a list of sessions for dashboard user */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + sessions?: { + userId?: components["schemas"]["userId"]; + /** @example fni29f-f23f23-f2fq32qt-h35evf */ + sessionId?: string; + /** @example 16382348324 */ + timeCreated?: number; + /** @example 16382348324 */ + expiry?: number; + }[]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getApiVersion: { + parameters: { + query?: { + websiteDomain?: string; + apiDomain?: string; + }; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description get api version */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + versions?: string[]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getConfig: { + parameters: { + query?: { + pid?: string; + }; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description get api version */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example /usr/lib/supertokens/config.yaml */ + path?: string; + } + | { + /** @enum {string} */ + status?: "NOT_ALLOWED"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getHelloOnRootPath: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: components["responses"]["hello"]; + 500: components["responses"]["500"]; + }; + }; + getHello: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: components["responses"]["hello"]; + 500: components["responses"]["500"]; + }; + }; + putHello: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: components["responses"]["hello"]; + 500: components["responses"]["500"]; + }; + }; + postHello: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: components["responses"]["hello"]; + 500: components["responses"]["500"]; + }; + }; + deleteHello: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: components["responses"]["hello"]; + 500: components["responses"]["500"]; + }; + }; + getTelemetry: { + parameters: { + query?: never; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Returns the telemetryID if it exists */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + /** @enum {boolean} */ + exists?: true; + /** @example 99c87c72-1807-22d-9b39-7a88f95re56c */ + telemetryId?: string; + } + | { + /** @example [ + * false + * ] */ + exists?: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getUsersCount: { + parameters: { + query?: { + /** @description The param should take an array of comma seperated strings */ + includeRecipeIds?: components["parameters"]["includeRecipeIds"]; + /** @description if set to true, will count users across all tenants in the app */ + includeAllTenants?: boolean; + }; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Get number of users */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + /** @example 1000000 */ + count?: number; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getActiveUsersCount: { + parameters: { + query: { + since: number; + }; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Get number of active users */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + /** @example 100000 */ + count?: number; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getUsers: { + parameters: { + query?: { + /** @description The param should take an array of comma seperated strings */ + includeRecipeIds?: components["parameters"]["includeRecipeIds"]; + /** @example ZmE3YTA4NDEtY...MjM5MTgwMzIyMzE= */ + paginationToken?: components["parameters"]["paginationToken"]; + /** @example 1 */ + limit?: components["parameters"]["limit"]; + timeJoinedOrder?: components["parameters"]["timeJoinedOrder"]; + email?: string; + phone?: number; + recipe?: string; + provider?: string; + }; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description User Pagination */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + users?: { + user?: components["schemas"]["authRecipeUser"]; + }[]; + nextPaginationToken?: components["schemas"]["paginationToken"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + deleteUser: { + parameters: { + query?: never; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + userId: components["schemas"]["userId"]; + /** @example true */ + removeAllLinkedAccounts?: boolean; + }; + }; + }; + responses: { + /** @description Returns OK if the operation succeeded (even if the user didn't exist before the call) */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 500: components["responses"]["500"]; + }; + }; + getSearchTags: { + parameters: { + query?: never; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Returns available tags for search */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + tags?: string[]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getFeatureFlag: { + parameters: { + query?: never; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + /** @example [ + * "feature_1", + * "feature_2" + * ] */ + features?: string[]; + usageStats?: Record; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getLicense: { + parameters: { + query?: never; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example eyJhbGciOiJIUzI1NiIsIn... */ + licenseKey?: string; + } + | { + /** @enum {string} */ + status?: "NO_LICENSE_KEY_FOUND_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 500: components["responses"]["500"]; + }; + }; + setLicense: { + parameters: { + query?: never; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example eyJhbGciOiJIUzI1NiIsIn... */ + licenseKey?: string; + }; + }; + }; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + } + | { + /** @enum {string} */ + status?: "MISSING_EE_FOLDER_ERROR"; + } + | { + /** @enum {string} */ + status?: "INVALID_LICENSE_KEY_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 500: components["responses"]["500"]; + }; + }; + deleteLicense: { + parameters: { + query?: never; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 500: components["responses"]["500"]; + }; + }; + getUserId: { + parameters: { + query?: { + userId?: components["parameters"]["userId"]; + }; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status?: "UNKNOWN_USER_ID_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getUsersByAccountInfo: { + parameters: { + query: { + email?: string; + phoneNumber?: string; + thirdPartyId?: string; + thirdPartyUserId?: string; + doUnionOfAccountInfo: boolean; + }; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + users?: components["schemas"]["authRecipeUser"][]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getRequestsStats: { + parameters: { + query?: never; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + /** @example 16382348 */ + atMinute?: number; + averageRequestsPerSecond?: number[]; + peakRequestsPerSecond?: number[]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + createOrUpdateConnectionURIDomainPUT: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example core-1234.supertokens.io:3567 */ + connectionUriDomain: string; + } & components["schemas"]["tenantInput"]; + }; + }; + responses: { + /** @description Create or Update connection uri domain result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + createdNew: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + createOrUpdateConnectionURIDomainV2PUT: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example core-1234.supertokens.io:3567 */ + connectionUriDomain: string; + } & components["schemas"]["tenantInputV2"]; + }; + }; + responses: { + /** @description Create or Update connection uri domain result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + createdNew: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + deleteConnectionUriDomainPOST: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example core-1234.supertokens.io:3567 */ + connectionUriDomain: string; + }; + }; + }; + responses: { + /** @description Remove connection uri domain result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + didExist: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + connectionUriDomainListGET: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description List of connection uri domains */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + connectionUriDomains: { + /** @example core-1234.supertokens.io:3567 */ + connectionUriDomain?: string; + apps?: { + /** @example app1 */ + appId?: string; + tenants?: components["schemas"]["tenantConfig"][]; + }[]; + }[]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + connectionUriDomainListV2GET: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description List of connection uri domains */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + connectionUriDomains: { + /** @example core-1234.supertokens.io:3567 */ + connectionUriDomain?: string; + apps?: { + /** @example app1 */ + appId?: string; + tenants?: components["schemas"]["tenantConfigV2"][]; + }[]; + }[]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + createOrUpdateAppPUT: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example app1 */ + appId: string; + } & components["schemas"]["tenantInput"]; + }; + }; + responses: { + /** @description Create or Update app result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + createdNew: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + createOrUpdateAppV2PUT: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example app1 */ + appId: string; + } & components["schemas"]["tenantInputV2"]; + }; + }; + responses: { + /** @description Create or Update app result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + createdNew: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + deleteAppPOST: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example app1 */ + appId: string; + }; + }; + }; + responses: { + /** @description Remove app result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + didExist: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + appListGET: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description List of apps */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + apps: { + /** @example app1 */ + appId?: string; + tenants?: components["schemas"]["tenantConfig"][]; + }[]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + appListV2GET: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description List of apps */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + apps: { + /** @example app1 */ + appId?: string; + tenants?: components["schemas"]["tenantConfigV2"][]; + }[]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + createOrUpdateTenantPUT: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + tenantId: components["schemas"]["tenantId"]; + } & components["schemas"]["tenantInput"]; + }; + }; + responses: { + /** @description Create or Update tenant result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + createdNew: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + createOrUpdateTenantV2PUT: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + tenantId: components["schemas"]["tenantId"]; + } & components["schemas"]["tenantInputV2"]; + }; + }; + responses: { + /** @description Create or Update tenant result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + createdNew: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + tenantConfigGet: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Tenant config result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | ({ + status?: components["schemas"]["statusOK"]; + } & components["schemas"]["tenantConfig"]) + | { + /** @enum {string} */ + status?: "TENANT_NOT_FOUND_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + tenantConfigV2Get: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Tenant config result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | ({ + status?: components["schemas"]["statusOK"]; + } & components["schemas"]["tenantConfigV2"]) + | { + /** @enum {string} */ + status?: "TENANT_NOT_FOUND_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + tenantCoreConfigForDashboardGET: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Tenant core config result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + config: { + /** @example password_reset_token_lifetime */ + key?: string; + /** + * @example number + * @enum {string|null} + */ + valueType?: "string" | "number" | "boolean" | null; + /** @example 3600000 */ + value?: (string | number | boolean) | null; + /** @example Time in milliseconds for how long a password reset token / link is valid for. [Default: 3600000 (1 hour)] */ + description?: string; + isDifferentAcrossTenants?: boolean; + possibleValues?: string[] | null; + /** @example false */ + isNullable?: boolean; + /** @example 3600000 */ + defaultValue?: (string | number | boolean) | null; + /** @example false */ + isPluginProperty?: boolean; + /** @example false */ + isPluginPropertyEditable?: boolean; + }[]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + deleteTenantPOST: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + tenantId: components["schemas"]["tenantId"]; + }; + }; + }; + responses: { + /** @description Remove tenant result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + didExist: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + tenantListGET: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description List of tenants */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + tenants: components["schemas"]["tenantConfig"][]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + tenantListV2GET: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description List of tenants */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + tenants: components["schemas"]["tenantConfigV2"][]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + createOrUpdateTenantConfigPUT: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + config: components["schemas"]["thirdPartyProviderConfig"]; + /** @example false */ + skipValidation?: boolean; + }; + }; + }; + responses: { + /** @description Create or Update result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status: components["schemas"]["statusOK"]; + createdNew: boolean; + } + | { + /** @enum {string} */ + status: "CONFIG_VALIDATION_ERROR"; + reason: string; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + deleteTenantConfigPOST: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + thirdPartyId: components["schemas"]["thirdPartyId"]; + }; + }; + }; + responses: { + /** @description Remove thirdParty config result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + didConfigExist?: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + addUserToTenant: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + recipeUserId: components["schemas"]["userId"]; + }; + }; + }; + responses: { + /** @description Association result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status: components["schemas"]["statusOK"]; + wasAlreadyAssociated: boolean; + } + | { + /** @enum {string} */ + status: + | "UNKNOWN_USER_ID_ERROR" + | "EMAIL_ALREADY_EXISTS_ERROR" + | "PHONE_NUMBER_ALREADY_EXISTS_ERROR" + | "THIRD_PARTY_USER_ALREADY_EXISTS_ERROR"; + } + | { + /** @enum {string} */ + status?: "ASSOCIATION_NOT_ALLOWED_ERROR"; + reason?: string; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + removeUserFromTenant: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + recipeUserId: components["schemas"]["userId"]; + }; + }; + }; + responses: { + /** @description Disassociation result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + wasAssociated: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getOAuth2Client: { + parameters: { + query: { + /** @example abcd */ + clientId: string; + }; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OAuth2 Client Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | ({ + status?: components["schemas"]["statusOK"]; + } & components["schemas"]["oauthClient"]) + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + updateOAuth2Client: { + parameters: { + query?: never; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": components["schemas"]["oauthClient"]; + }; + }; + responses: { + /** @description OAuth2 Client Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | ({ + status?: components["schemas"]["statusOK"]; + } & components["schemas"]["oauthClient"]) + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + createOAuth2Client: { + parameters: { + query?: never; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": components["schemas"]["oauthClient"]; + }; + }; + responses: { + /** @description OAuth2 Client Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | ({ + status?: components["schemas"]["statusOK"]; + } & components["schemas"]["oauthClient"]) + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + listOAuth2Clients: { + parameters: { + query?: { + pageSize?: number; + pageToken?: string; + clientName?: string; + }; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OAuth2 Client Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + clients?: components["schemas"]["oauthClient"][]; + nextPaginationToken?: string; + } + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + removeOAuth2Client: { + parameters: { + query?: never; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example stcl_c6dd9189-33b8-4ec0-8aea-a0ffdaf75fcb */ + clientId?: string; + }; + }; + }; + responses: { + /** @description OAuth2 Client Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example true */ + didExist?: boolean; + } + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getOAuth2ConsentRequest: { + parameters: { + query: { + consentChallenge: string; + }; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OAuth2 Consent Request Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + client?: components["schemas"]["oauthClient"]; + requestedScope?: string[]; + requestedAudience?: string[]; + requestedClaims?: { + idToken?: { + property1?: string; + property2?: string; + }; + }; + loginHint?: string; + uiLocales?: string[]; + acrValues?: string[]; + subject?: string; + requestUrl?: string; + skip?: boolean; + clientId?: string; + redirectUri?: string; + forceSubjectIdentifier?: string; + requestedAccessTokenAudience?: string[]; + context?: Record; + sessionId?: string; + loginSessionId?: string; + loginChallenge?: string; + loginRequestedAt?: string; + consentRequestedAt?: string; + consentChallenge?: string; + consentSkip?: boolean; + consentRemember?: boolean; + consentRememberFor?: number; + consentError?: { + name?: string; + description?: string; + }; + consentErrorDebug?: string; + consentErrorDescription?: string; + consentErrorHint?: string; + consentErrorCode?: string; + consentStatusCode?: number; + sessionIdToken?: { + property1?: string; + property2?: string; + }; + sessionAccessToken?: { + property1?: string; + property2?: string; + }; + sessionToken?: { + property1?: string; + property2?: string; + }; + } + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + acceptOAuth2ConsentRequest: { + parameters: { + query: { + consentChallenge: string; + }; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + context?: Record; + grantAccessTokenAudience?: string[]; + grantScope?: string[]; + /** + * Format: date-time + * @example 2019-08-24T14:15:22Z + */ + handledAt?: string; + remember?: boolean; + rememberFor?: number; + session?: { + accessToken?: { + [key: string]: unknown; + }; + idToken?: { + [key: string]: unknown; + }; + }; + }; + }; + }; + responses: { + /** @description OAuth2 Consent Request Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example {apiDomain}/oauth/consent?... */ + redirectTo?: string; + } + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + rejectOAuth2ConsentRequest: { + parameters: { + query: { + consentChallenge: string; + }; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + error?: string; + errorDebug?: string; + errorDescription?: string; + errorHint?: string; + /** @example 400 */ + statusCode?: number; + }; + }; + }; + responses: { + /** @description OAuth2 Consent Request Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example {apiDomain}/oauth/consent?... */ + redirectTo?: string; + } + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getOAuth2LoginRequest: { + parameters: { + query: { + loginChallenge: string; + }; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OAuth2 Login Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + challenge?: string; + client?: components["schemas"]["oauthClient"]; + oidcContext?: { + acrValues?: string[]; + display?: string; + idTokenHintClaims?: Record; + loginHint?: string; + uiLocales?: string[]; + requestUrl?: string; + requestedAccessTokenAudience?: string[]; + requestedScope?: string[]; + sessionId?: string; + skip?: boolean; + subject?: string; + }; + } + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + acceptOAuth2LoginRequest: { + parameters: { + query: { + loginChallenge: string; + }; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + acr?: string; + amr?: string[]; + context?: string | null; + /** @example true */ + extendSessionLifespan?: boolean; + forceSubjectIdentifier?: string; + identityProviderSessionId?: string; + /** @example true */ + remember?: boolean; + /** @example 0 */ + rememberFor?: number; + subject: string; + }; + }; + }; + responses: { + /** @description OAuth2 Login Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example {apiDomain}/oauth/login?... */ + redirectTo?: string; + } + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + rejectOAuth2LoginRequest: { + parameters: { + query: { + loginChallenge: string; + }; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + error?: string; + errorDebug?: string; + errorDescription?: string; + errorHint?: string; + /** @example 0 */ + statusCode?: number; + }; + }; + }; + responses: { + /** @description OAuth2 Login Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example {apiDomain}/oauth/login?... */ + redirectTo?: string; + } + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + acceptOAuth2LogoutRequest: { + parameters: { + query?: never; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + challenge?: string; + }; + }; + }; + responses: { + /** @description OAuth2 Logout Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example {apiDomain}/oauth/logout?... */ + redirectTo?: string; + } + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + rejectOAuth2LogoutRequest: { + parameters: { + query?: never; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + challenge?: string; + }; + }; + }; + responses: { + /** @description OAuth2 Logout Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + } + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + revokeOAuth2Session: { + parameters: { + query?: never; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + sessionHandle?: string; + }; + }; + }; + responses: { + /** @description OAuth2 Session Revocation Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example true */ + didExist?: boolean; + } + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + revokeOAuth2Token: { + parameters: { + query?: never; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + token?: string; + }; + }; + }; + responses: { + /** @description OAuth2 Token Revocation Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example true */ + didExist?: boolean; + } + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + revokeOAuth2Tokens: { + parameters: { + query?: never; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example stcl_fed7cff0-cc6e-406e-b7a6-766148675a4a */ + client_id?: string; + }; + }; + }; + responses: { + /** @description OAuth2 Token Revocation Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example true */ + didExist?: boolean; + } + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getOAuth2Auth: { + parameters: { + query?: never; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OAuth2 Auth Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | ({ + status?: components["schemas"]["statusOK"]; + } & components["schemas"]["oauthClient"]) + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getOAuth2Token: { + parameters: { + query?: never; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example https://api.auth.com */ + iss?: string; + /** @example {} */ + inputBody?: Record; + /** @example false */ + useStaticSigningKey?: boolean; + /** @example Bearer 1234567890 */ + authorizationHeader?: string; + }; + }; + }; + responses: { + /** @description OAuth2 Token Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example eyJraWQiOiJzLTBjZmVmMDdkLWQ2NDktNGIwOC04MTVjLWJkYjZlYTczNWQyZCIsInR5cCI6IkpXVCIsImFsZyI6IlJTMjU2In0.eyJpYXQiOjE3NDAzODU5MzcsImV4cCI6MTc0MDM4OTUzOCwiY2xpZW50X2lkIjoic3RjbF82NWUwODc1Mi0yYzU5LTQ5NjQtOTM0Yy02OTIwZDJmMDZlNjIiLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjMwMDEvYXV0aCIsImp0aSI6Ijc1NTc2MmFmLTUwYTUtNDc1ZS04YWRkLTg3MDA1ZmU3YWJlNiIsIm5iZiI6MTc0MDM4NTkzNywic2NwIjpbIm9wZW5pZCIsIm9mZmxpbmVfYWNjZXNzIl0sInN1YiI6InNvbWV1c2VyaWQiLCJzdHQiOjEsImdpZCI6ImRjOGQ0OGUzLTcwOTgtNDhhNi1hYjU0LTgxMWMyODQ4N2I4MiIsInRJZCI6InB1YmxpYyIsInJzdWIiOiJzb21ldXNlcmlkIiwic2Vzc2lvbkhhbmRsZSI6InNlc3Npb24taGFuZGxlIn0.DgVgtD2gXgzHrDsC2lIUBa-wsYm8KO4Pg8L1Ov3aSBVgjwtjiCO40ldjBZ9qKdQBq5Qqk0ElAZNj6Bzc40ESfQumLH3_N2XtOj568s71JPuEOIg5hs9XAdK4vYfXMhVQRWn9iPUKHKrpRVf73IIH0mpkN8i6_MhcDoMMOuG5XPlXajG9VOyoY_5saHA61-uTafZLdAgKqnmYGvS8KmNEcEbBWLGwFB4QQKiDAUvatIi5n3juFBUxyt9t6DrqT1D04shesRppa0XhCZbCFBv1dixSrprdtqKhlPOrMgvOGNZ3cBLbYBOG9zoJRD5YlVMGw-j_pE7IbvpDWKL7tTJS1Q */ + access_token: string; + /** @example 3599 */ + expires_in?: number; + /** @example eyJraWQiOiJzLTBjZmVmMDdkLWQ2NDktNGIwOC04MTVjLWJkYjZlYTczNWQyZCIsInR5cCI6IkpXVCIsImFsZyI6IlJTMjU2In0.eyJpYXQiOjE3NDAzODU5MzgsImV4cCI6MTc0MDM4OTUzOCwiYXRfaGFzaCI6IkNxOGNCSk01Nm5FcG9aaWREcnZvLVEiLCJhdWQiOiJzdGNsXzY1ZTA4NzUyLTJjNTktNDk2NC05MzRjLTY5MjBkMmYwNmU2MiIsImF1dGhfdGltZSI6MTc0MDM4NTkzNywiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDozMDAxL2F1dGgiLCJqdGkiOiIxZDA5OGUxZi04ZGIxLTQyNzUtYmMzYS0zYTA4NjdjOWE2NTAiLCJyYXQiOjE3NDAzODU3MzEsInNpZCI6InNlc3Npb24taGFuZGxlIiwic3ViIjoic29tZXVzZXJpZCIsInN0dCI6MiwiZ2lkIjoiYzk1OTVjYjItMWFjOS00MDI0LWFjNjMtNDJlZDEyODliY2RmIn0.PGsemf1qpLF-cE_616NHvKsRmanFiyba0yqF2j5fy87AWD5McI405A4eqi-wAlKsDxC-MPpuW8bx-08YUhs3x6ku4aFaDyA-M-Xhc65fJJ4SCPVaUL7qlUwl7wJwNs2rMRW3Ayyj4MDSlW5uqm39_K_bBqod2Qj1yqck-N0g78qh86uEcyX6Al3d5KSln1B21nwDsEgegk3xzE8lFMCQUTpZEYb5-1v2D0Bu_PblBfOCjA6mBtT1IIQkmSE27FvkTUS1H50EUyhFP4JH30kP3bUnQ9pOqGMTe405N2ruKtPyWsXHLPlQ4hcJCLO5GT5ZgtUjfz6Y3mCM9l69uDYDHg */ + id_token?: string; + /** @example st_rt_d7LI9mGYHF2TAaVEFJi7fqOWo8ZQ8zEGpuxhHQs0R18.UZ0nbTuuYuDD8G54PCD8AKHdsh9cezu8BTxVlTy7pYw */ + refresh_token?: string; + /** @example openid offline_access */ + scope?: string; + /** @example bearer */ + token_type?: string; + } + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getOAuth2SessionsLogout: { + parameters: { + query?: { + clientId?: string; + idTokenHint?: string; + postLogoutRedirectUri?: string; + state?: string; + }; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OAuth2 Sessions Logout Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example {apiDomain}/oauth/logout?... */ + redirectTo?: string; + } + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + introspectOAuth2Token: { + parameters: { + query?: never; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + token: string; + }; + }; + }; + responses: { + /** @description OAuth2 Token Introspection Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + active?: boolean; + /** @example 1740992368 */ + iat?: number; + /** @example 1740995969 */ + exp?: number; + /** @example stcl_fed7cff0-cc6e-406e-b7a6-766148675a4a */ + client_id?: string; + /** @example http://localhost:3001/auth */ + iss?: string; + /** @example 1c229efe-c55b-44c1-98cf-9fa3a366502e */ + jti?: string; + /** @example 1740992368 */ + nbf?: number; + /** @example [ + * "openid", + * "offline_access" + * ] */ + scp?: string[]; + /** @example 137d053d-0d69-4dea-8a19-06ddbdfa4f96 */ + sub?: string; + /** @example 1 */ + stt?: number; + /** @example 87bcc2d8-f159-4e10-a097-0898179a2d7d */ + sessionHandle?: string; + /** @example 137d053d-0d69-4dea-8a19-06ddbdfa4f96 */ + rsub?: string; + /** @example public */ + tId?: string; + /** @example 575b7130-d982-4945-be49-3ecde2a49eaa */ + gid?: string; + /** @example Bearer */ + token_type?: string; + /** @example access_token */ + token_use?: string; + } + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getBulkImportUsers: { + parameters: { + query?: { + /** @example ZmE3YTA4NDEtY...MjM5MTgwMzIyMzE= */ + paginationToken?: components["parameters"]["paginationToken"]; + /** @example 1 */ + limit?: components["parameters"]["limit"]; + status?: components["parameters"]["bulkImportUserStatus"]; + }; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Paginated Bulk Import Users */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + users?: components["schemas"]["bulkImportUserResponse"][]; + nextPaginationToken?: components["schemas"]["paginationToken"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + addBulkImportUsers: { + parameters: { + query?: never; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + users: components["schemas"]["bulkImportUser"][]; + }; + }; + }; + responses: { + /** @description Bulk Import Users added successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + users?: components["schemas"]["addBulkImportUserResponse"]; + }; + }; + }; + /** @description One or more users have invalid schema */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @example Data has missing or invalid fields. Please check the users field for more details. */ + error?: string; + users?: { + /** + * @description Index of the user in the users array that has invalid schema + * @example 0 + */ + index?: number; + errors?: string[]; + }[]; + }; + }; + }; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + deleteBulkImportUsers: { + parameters: { + query?: never; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @description List of bulk import user ids to be deleted */ + ids: components["schemas"]["bulkImportUserId"][]; + }; + }; + }; + responses: { + /** @description Bulk Import Users deleted successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @description List of ids that were successfully deleted */ + deletedIds?: components["schemas"]["bulkImportUserId"][]; + /** + * @description List of ids that were invalid + * @example [] + */ + invalidIds?: components["schemas"]["bulkImportUserId"][]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getWebAuthNCredential: { + parameters: { + query: { + recipeUserId: string; + webauthnCredentialId: string; + }; + header?: { + /** @example webauthn */ + rid?: components["parameters"]["webauthnRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description WebAuthn credential result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + credential?: { + /** @example ea7a0931-b533-4478-9253-0fde890ca23 */ + webauthnCredentialId?: string; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId?: string; + /** @example example.com */ + relyingPartyId?: string; + /** @example 1741793746 */ + createdAt?: number; + /** @example 1741793746 */ + updatedAt?: number; + }; + } + | { + /** @enum {string} */ + status?: "CREDENTIAL_NOT_FOUND_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + listWebAuthNCredentials: { + parameters: { + query: { + recipeUserId: string; + }; + header?: { + /** @example webauthn */ + rid?: components["parameters"]["webauthnRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description WebAuthn credentials list result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + credentials?: { + /** @example ea7a0931-b533-4478-9253-0fde890ca23 */ + webauthnCredentialId?: string; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId?: string; + /** @example example.com */ + relyingPartyId?: string; + /** @example 1741793746 */ + createdAt?: number; + /** @example 1741793746 */ + updatedAt?: number; + }[]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getWebAuthNOptions: { + parameters: { + query: { + webauthnGeneratedOptionsId: string; + }; + header?: { + /** @example webauthn */ + rid?: components["parameters"]["webauthnRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description WebAuthn options result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + webauthnGeneratedOptionsId?: string; + /** @example example.com */ + relyingPartyId?: string; + /** @example Example */ + relyingPartyName?: string; + /** @example TQvEVDV8B64w_2zIifzKaPzBPfthqpx2uJkq_2PIB0k */ + challenge?: string; + /** @example 10000 */ + timeout?: number; + /** @example http://example.com */ + origin?: string; + /** @example email@example.com */ + email?: string; + /** @example required */ + userVerification?: string; + /** @example true */ + userPresence?: boolean; + /** @example 1741793746 */ + createdAt?: number; + /** @example 1741793746 */ + expiresAt?: number; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + recoverWebAuthNUser: { + parameters: { + query: { + token: string; + }; + header?: { + /** @example webauthn */ + rid?: components["parameters"]["webauthnRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description AuthRecipeUser for the token */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId?: string; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status?: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + generateRegistrationOptions: { + parameters: { + query?: never; + header?: { + /** @example webauthn */ + rid?: components["parameters"]["webauthnRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + email: components["schemas"]["email"]; + /** @example John Doe */ + displayName?: string; + /** @example example.com */ + relyingPartyId: string; + /** @example Example */ + relyingPartyName: string; + /** @example http://example.com */ + origin: string; + /** @example 10000 */ + timeout?: number; + /** @example preferred */ + userVerification?: string; + /** @example false */ + userPresence?: boolean; + /** @example none */ + attestation?: string; + /** @example required */ + residentKey?: string; + supportedAlgorithmIDs?: number[]; + }; + }; + }; + responses: { + /** @description The generated register options response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + webauthnGeneratedOptionsId?: string; + rp?: { + /** @example example.com */ + id?: string; + /** @example Example */ + name?: string; + }; + user?: { + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + id?: string; + /** @example John Doe */ + name?: string; + /** @example John Doe */ + displayName?: string; + }; + email?: components["schemas"]["email"]; + /** @example TQvEVDV8B64w_2zIifzKaPzBPfthqpx2uJkq_2PIB0k */ + challenge?: string; + /** @example 10000 */ + timeout?: number; + /** @example none */ + attestation?: string; + /** @example 1741793746 */ + createdAt?: number; + /** @example 1741793746 */ + expiresAt?: number; + pubKeyCredParams?: { + /** @example public-key */ + type?: string; + /** @example -7 */ + alg?: number; + }[]; + excludeCredentials?: { + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + id?: string; + transport?: string[]; + }[]; + authenticatorSelection?: { + /** @example preferred */ + userVerification?: string; + /** @example true */ + requireResidentKey?: boolean; + }; + } + | { + /** @enum {string} */ + status?: "INVALID_OPTIONS_ERROR"; + reason?: string; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + generateSigninOptions: { + parameters: { + query?: never; + header?: { + /** @example webauthn */ + rid?: components["parameters"]["webauthnRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example example.com */ + relyingPartyId: string; + /** @example Example */ + relyingPartyName: string; + /** @example http://example.com */ + origin: string; + /** @example 10000 */ + timeout: number; + /** @example preferred */ + userVerification: string; + /** @example false */ + userPresence: boolean; + }; + }; + }; + responses: { + /** @description AuthRecipeUser for the token */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + webauthnGeneratedOptionsId?: string; + /** @example example.com */ + relyingPartyId?: string; + /** @example TQvEVDV8B64w_2zIifzKaPzBPfthqpx2uJkq_2PIB0k */ + challenge?: string; + /** @example 10000 */ + timeout?: number; + /** @example required */ + userVerification?: string; + /** @example true */ + userPresence?: boolean; + /** @example 1741793746 */ + createdAt?: number; + /** @example 1741793746 */ + expiresAt?: number; + } + | { + /** @enum {string} */ + status?: "INVALID_OPTIONS_ERROR"; + reason?: string; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + registerWebAuthNCredential: { + parameters: { + query?: never; + header?: { + /** @example webauthn */ + rid?: components["parameters"]["webauthnRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + recipeUserId?: components["schemas"]["userId"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + webauthnGeneratedOptionsId?: string; + /** @description Credential returned by the browser */ + credential?: Record; + }; + }; + }; + responses: { + /** @description The stored credential */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + webauthnCredentialId?: string; + /** @example example.com */ + relyingPartyId?: string; + /** @example Example */ + relyingPartyName?: string; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId?: string; + email?: components["schemas"]["email"]; + } + | { + /** @enum {string} */ + status?: + | "INVALID_OPTIONS_ERROR" + | "INVALID_AUTHENTICATOR_ERROR" + | "INVALID_CREDENTIALS_ERROR"; + reason?: string; + } + | { + /** @enum {string} */ + status?: + | "OPTIONS_NOT_FOUND_ERROR" + | "CREDENTIAL_ALREADY_EXISTS_ERROR" + | "UNKNOWN_USER_ID_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + signUpWebAuthNUser: { + parameters: { + query?: never; + header?: { + /** @example webauthn */ + rid?: components["parameters"]["webauthnRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + webauthnGeneratedOptionsId?: string; + /** @description Credential returned by the browser */ + credential?: Record; + }; + }; + }; + responses: { + /** @description The signup result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + webauthnCredentialId?: string; + /** @example example.com */ + relyingPartyId?: string; + /** @example Example */ + relyingPartyName?: string; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId?: string; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status?: + | "INVALID_OPTIONS_ERROR" + | "INVALID_AUTHENTICATOR_ERROR" + | "INVALID_CREDENTIALS_ERROR"; + reason?: string; + } + | { + /** @enum {string} */ + status?: "OPTIONS_NOT_FOUND_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + signInWebAuthNUser: { + parameters: { + query?: never; + header?: { + /** @example webauthn */ + rid?: components["parameters"]["webauthnRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + webauthnGeneratedOptionsId?: string; + /** @description Credential returned by the browser */ + credential?: Record; + }; + }; + }; + responses: { + /** @description The stored credential */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId?: string; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status?: + | "INVALID_OPTIONS_ERROR" + | "INVALID_AUTHENTICATOR_ERROR" + | "INVALID_CREDENTIALS_ERROR"; + reason?: string; + } + | { + /** @enum {string} */ + status?: + | "OPTIONS_NOT_FOUND_ERROR" + | "CREDENTIAL_NOT_FOUND_ERROR" + | "UNKNOWN_USER_ID_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + generateTokenForRecovery: { + parameters: { + query?: never; + header?: { + /** @example webauthn */ + rid?: components["parameters"]["webauthnRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + userId: components["schemas"]["userId"]; + email: components["schemas"]["email"]; + }; + }; + }; + responses: { + /** @description WebAuthn options result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example ZmE3YTA4NDEtYjUzMy00NDc4LTkyNTMtMGZkZTg5MGM1NzY */ + token?: string; + } + | { + /** @enum {string} */ + status?: "UNKNOWN_USER_ID_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + consumeWebAuthNToken: { + parameters: { + query?: never; + header?: { + /** @example webauthn */ + rid?: components["parameters"]["webauthnRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example ZmE3YTA4NDEtYjUzMy00NDc4LTkyNTMtMGZkZTg5MGM1NzY */ + token: string; + }; + }; + }; + responses: { + /** @description Consume token result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + userId?: components["schemas"]["userId"]; + email?: components["schemas"]["email"]; + } + | { + /** @enum {string} */ + status?: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + updateEmail: { + parameters: { + query?: never; + header?: { + /** @example webauthn */ + rid?: components["parameters"]["webauthnRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + recipeUserId: components["schemas"]["userId"]; + email: components["schemas"]["email"]; + }; + }; + }; + responses: { + /** @description Update email result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + } + | { + /** @enum {string} */ + status?: + | "UNKNOWN_USER_ID_ERROR" + | "EMAIL_ALREADY_EXISTS_ERROR" + | "USER_WITH_EMAIL_ALREADY_EXISTS_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + removeWebAuthNCredential: { + parameters: { + query: { + recipeUserId: string; + webauthnCredentialId: string; + }; + header?: { + /** @example webauthn */ + rid?: components["parameters"]["webauthnRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Delete credential result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + } + | { + /** @enum {string} */ + status?: "CREDENTIAL_NOT_FOUND_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + removeWebAuthNOptions: { + parameters: { + query: { + webauthnGeneratedOptionsId: string; + }; + header?: { + /** @example webauthn */ + rid?: components["parameters"]["webauthnRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Delete options result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + } + | { + /** @enum {string} */ + status?: "OPTIONS_NOT_FOUND_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; +} diff --git a/package.json b/package.json index 1bc5a0a41..8376ece46 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,8 @@ "build-pretty": "npm run build && npm run pretty && npm run pretty", "pretty-check": "npx pretty-quick --check .", "set-up-hooks": "cp hooks/pre-commit.sh .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit", - "build-docs": "rm -rf ./docs && npx typedoc --out ./docs --tsconfig ./lib/tsconfig.json ./lib/ts/index.ts ./lib/ts/**/index.ts ./lib/ts/**/*/index.ts" + "build-docs": "rm -rf ./docs && npx typedoc --out ./docs --tsconfig ./lib/tsconfig.json ./lib/ts/index.ts ./lib/ts/**/index.ts ./lib/ts/**/*/index.ts", + "build-core-types": "node scripts/generate-schema.js" }, "keywords": [ "auth", @@ -175,6 +176,7 @@ "next": "^14.0.4", "next-test-api-route-handler": "^3.1.10", "nock": "11.7.0", + "node-fetch": "^3.3.2", "nyc": "^15.1.0", "otpauth": "9.1.5", "prettier": "2.0.5", diff --git a/scripts/generate-schema.js b/scripts/generate-schema.js new file mode 100644 index 000000000..33792c803 --- /dev/null +++ b/scripts/generate-schema.js @@ -0,0 +1,82 @@ +// scripts/generate-schemas.js +const fs = require("fs/promises"); +const path = require("path"); +const { exec } = require("child_process"); + +// Dynamic import for node-fetch because it’s an ESM module +const fetch = (...args) => import("node-fetch").then(({ default: fetch }) => fetch(...args)); + +const coreJsonPath = path.join(__dirname, "..", "coreDriverInterfaceSupported.json"); +const specsDir = path.join(__dirname, "..", "specs"); +const libDir = path.join(__dirname, "..", "lib", "core"); + +const BASE_URL = "https://raw.githubusercontent.com/supertokens/core-driver-interface/refs/heads"; + +async function run() { + const file = await fs.readFile(coreJsonPath, "utf-8"); + const json = JSON.parse(file); + const versions = json.versions; + + console.log("📁 Creating specs directory..."); + await fs.mkdir(specsDir, { recursive: true }); + + try { + for (const version of versions) { + const url = `${BASE_URL}/${version}/api_spec.yaml`; + const specPath = path.join(specsDir, `api_spec_${version}.yaml`); + + console.log(`📥 Downloading: ${url}`); + const res = await fetch(url); + if (!res.ok) { + console.error(`❌ Failed to fetch ${url}: ${res.statusText}`); + continue; + } + + const specContent = await res.text(); + await fs.writeFile(specPath, specContent, "utf-8"); + console.log(`✅ Saved to ${specPath}`); + } + + for (const version of versions) { + const inputPath = path.join(specsDir, `api_spec_${version}.yaml`); + const outputDir = path.join(libDir, version); + const outputPath = path.join(outputDir, "schema.d.ts"); + + await fs.mkdir(outputDir, { recursive: true }); + + console.log(`🔧 Generating schema for version ${version}...`); + await execPromise(`npx openapi-typescript ${inputPath} -o ${outputPath}`); + + // Post-process: remove `/appid-/` + console.log(`🧹 Cleaning appid from ${outputPath}`); + let schemaContent = await fs.readFile(outputPath, "utf-8"); + schemaContent = schemaContent.replace(/\/appid-[^/]+/g, ""); + await fs.writeFile(outputPath, schemaContent, "utf-8"); + console.log(`✅ Cleaned ${outputPath}`); + } + } finally { + console.log("🧹 Cleaning up specs directory..."); + await fs.rm(specsDir, { recursive: true, force: true }); + console.log("✅ Specs directory deleted."); + } + + console.log("🎉 All done!"); +} + +function execPromise(command) { + return new Promise((resolve, reject) => { + exec(command, (err, stdout, stderr) => { + if (err) { + console.error(`Error: ${stderr}`); + reject(err); + } else { + resolve(stdout); + } + }); + }); +} + +run().catch((err) => { + console.error("Unhandled error:", err); + process.exit(1); +}); From 7df8b4a3c691ebc9de80b6cf72bfa6f118d6cd37 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Tue, 29 Apr 2025 14:08:31 +0530 Subject: [PATCH 02/64] Add type definitions for inferring response body and request body from schema --- lib/core/paths.ts | 29 +++++++++++++++++++++++++ lib/core/types.ts | 27 +++++++++++++++++++++++ lib/core/{ => versions}/5.3/schema.d.ts | 0 scripts/generate-schema.js | 2 +- 4 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 lib/core/paths.ts create mode 100644 lib/core/types.ts rename lib/core/{ => versions}/5.3/schema.d.ts (100%) diff --git a/lib/core/paths.ts b/lib/core/paths.ts new file mode 100644 index 000000000..b7f4883fd --- /dev/null +++ b/lib/core/paths.ts @@ -0,0 +1,29 @@ +import { paths as pathsV5_3 } from "./versions/5.3/schema"; + +// NOTE: Uncomment the following code if there +// are more than one CDI versions being used. +// E.g. usage: export type paths = MergePaths; + +// type MergePaths = { +// [K in keyof P1 | keyof P2]: +// K extends keyof P1 +// ? K extends keyof P2 +// ? MergeMethods +// : P1[K] +// : K extends keyof P2 +// ? P2[K] +// : never; +// }; + +// type MergeMethods = { +// [K in keyof M1 | keyof M2]: +// K extends keyof M1 +// ? K extends keyof M2 +// ? M1[K] | M2[K] +// : M1[K] +// : K extends keyof M2 +// ? M2[K] +// : never; +// }; + +export type paths = pathsV5_3; diff --git a/lib/core/types.ts b/lib/core/types.ts new file mode 100644 index 000000000..c7c236fb3 --- /dev/null +++ b/lib/core/types.ts @@ -0,0 +1,27 @@ +/** + * This file contains the types for providing automatic type inference + * for core related method calls that is generated from the OpenAPI spec. + * + * This file is not needed for the core driver interface to work, but it is + * useful for providing type inference for the core related method calls. + */ + +import { paths } from "./paths"; + +export type Method = "get" | "post" | "put" | "delete" | "patch"; + +export type ExtractMethodType

= M extends keyof paths[P] ? paths[P][M] : never; + +export type RequestBody

= ExtractMethodType extends { + requestBody?: infer ReqBody; +} + ? ReqBody extends { content: { "application/json": infer R } } + ? R | undefined + : undefined + : undefined; + +export type ResponseBody

= ExtractMethodType extends { + responses: { 200: { content: { "application/json": infer R } } }; +} + ? R + : unknown; diff --git a/lib/core/5.3/schema.d.ts b/lib/core/versions/5.3/schema.d.ts similarity index 100% rename from lib/core/5.3/schema.d.ts rename to lib/core/versions/5.3/schema.d.ts diff --git a/scripts/generate-schema.js b/scripts/generate-schema.js index 33792c803..9f6911c0f 100644 --- a/scripts/generate-schema.js +++ b/scripts/generate-schema.js @@ -8,7 +8,7 @@ const fetch = (...args) => import("node-fetch").then(({ default: fetch }) => fet const coreJsonPath = path.join(__dirname, "..", "coreDriverInterfaceSupported.json"); const specsDir = path.join(__dirname, "..", "specs"); -const libDir = path.join(__dirname, "..", "lib", "core"); +const libDir = path.join(__dirname, "..", "lib", "core", "versions"); const BASE_URL = "https://raw.githubusercontent.com/supertokens/core-driver-interface/refs/heads"; From 7ca8a96d235685e59eab92747eed93d4ddd1af33 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Wed, 30 Apr 2025 14:43:57 +0530 Subject: [PATCH 03/64] Refactor querier to use inferred types in network methods --- lib/core/types.ts | 73 ++++++++++++++++++++------ lib/ts/querier.ts | 117 ++++++++++++++++++++++++++---------------- lib/ts/supertokens.ts | 51 +++++++++--------- 3 files changed, 159 insertions(+), 82 deletions(-) diff --git a/lib/core/types.ts b/lib/core/types.ts index c7c236fb3..aad43e9df 100644 --- a/lib/core/types.ts +++ b/lib/core/types.ts @@ -10,18 +10,61 @@ import { paths } from "./paths"; export type Method = "get" | "post" | "put" | "delete" | "patch"; -export type ExtractMethodType

= M extends keyof paths[P] ? paths[P][M] : never; - -export type RequestBody

= ExtractMethodType extends { - requestBody?: infer ReqBody; -} - ? ReqBody extends { content: { "application/json": infer R } } - ? R | undefined - : undefined - : undefined; - -export type ResponseBody

= ExtractMethodType extends { - responses: { 200: { content: { "application/json": infer R } } }; -} - ? R - : unknown; +// Type to extract the method type from the paths object +type ExtractMethodTypeWithUndefined

= M extends keyof paths[P] + ? paths[P][M] + : never; +export type ExtractMethodType

= Exclude< + ExtractMethodTypeWithUndefined, + undefined +>; + +// Type to ensure that the `status` is a required field instead of +// it being optional. We should use this until the spec is not updated. +// TODO: Remove if we decide to go ahead with MakeAllRequired +// type MakeStatusRequired = T extends { status?: infer S } +// ? Omit & { status: S } +// : T; + +// Type to make all fields required. This should be used only if +// it is absolutely guaranteed that the fields are not optional. +type MakeAllRequired = { + [K in keyof T]-?: NonNullable; +}; + +// Wrapper around MakeAllRequired to ensure that it is applied recursively +// to all unions. +type DeepRequireAllFields = T extends any ? MakeAllRequired : never; + +// Type to extract the request body from the method type +export type RequestBody

= + ExtractMethodType extends { + requestBody?: infer ReqBody; + } + ? ReqBody extends { content: { "application/json": infer R } } + ? R | undefined + : undefined + : undefined; + +// Type to extract the response body from the method type +export type UncleanedResponseBody

= + ExtractMethodType extends { + responses: { 200: { content: { "application/json": infer R } } }; + } + ? R + : unknown; + +// Type to clean the response body from the method type +export type ResponseBody

= DeepRequireAllFields>; + +// Type to extract the path parameters from the method type +// and enforce them through inference +type ExtractPathParams = T extends `${string}<${infer Param}>${infer Rest}` + ? Param | ExtractPathParams + : never; + +type PathParamsObject = + ExtractPathParams extends never ? undefined : { [K in ExtractPathParams]: string }; + +// Type to handle the path parameter +export type PathParam

= P | { path: P; params: PathParamsObject

}; diff --git a/lib/ts/querier.ts b/lib/ts/querier.ts index 4d1263e36..b1f3b18fd 100644 --- a/lib/ts/querier.ts +++ b/lib/ts/querier.ts @@ -23,6 +23,9 @@ import { UserContext } from "./types"; import { NetworkInterceptor } from "./types"; import SuperTokens from "./supertokens"; +import { PathParam, RequestBody, ResponseBody } from "../core/types"; +import { paths } from "../core/paths"; + export class Querier { private static initCalled = false; private static hosts: { domain: NormalisedURLDomain; basePath: NormalisedURLPath }[] | undefined = undefined; @@ -43,7 +46,7 @@ export class Querier { // to support multiple rIds per API private constructor( hosts: { domain: NormalisedURLDomain; basePath: NormalisedURLPath }[] | undefined, - rIdToCore?: string + rIdToCore?: string, ) { this.__hosts = hosts; this.rIdToCore = rIdToCore; @@ -86,7 +89,7 @@ export class Querier { headers: headers, params: queryParamsObj, }, - userContext + userContext, ); url = request.url; headers = request.headers; @@ -98,13 +101,13 @@ export class Querier { }); return response; }, - this.__hosts?.length || 0 + this.__hosts?.length || 0, ); let cdiSupportedByServer: string[] = response.versions; let supportedVersion = getLargestVersionFromIntersection(cdiSupportedByServer, cdiSupported); if (supportedVersion === undefined) { throw Error( - "The running SuperTokens core version is not compatible with this NodeJS SDK. Please visit https://supertokens.io/docs/community/compatibility to find the right versions" + "The running SuperTokens core version is not compatible with this NodeJS SDK. Please visit https://supertokens.io/docs/community/compatibility to find the right versions", ); } Querier.apiVersion = supportedVersion; @@ -137,7 +140,7 @@ export class Querier { hosts?: { domain: NormalisedURLDomain; basePath: NormalisedURLPath }[], apiKey?: string, networkInterceptor?: NetworkInterceptor, - disableCache?: boolean + disableCache?: boolean, ) { if (!Querier.initCalled) { logDebugMessage("querier initialized"); @@ -152,9 +155,26 @@ export class Querier { } } + private getPath =

(path: PathParam

): NormalisedURLPath => { + const template = typeof path === "string" ? path : path.path; + const params = typeof path === "string" ? {} : (path.params ?? {}); + + let populated = String(template); + for (const [key, value] of Object.entries(params)) { + populated = populated.replace(new RegExp(`<${key}>\\b`, "g"), String(value)); + } + + return new NormalisedURLPath(populated); + }; + // path should start with "/" - sendPostRequest = async (path: NormalisedURLPath, body: any, userContext: UserContext): Promise => { + sendPostRequest = async

( + template: PathParam

, + body: RequestBody, + userContext: UserContext, + ): Promise> => { this.invalidateCoreCallCache(userContext); + const path = this.getPath(template); const { body: respBody } = await this.sendRequestHelper( path, @@ -186,7 +206,7 @@ export class Querier { headers: headers, body: body, }, - userContext + userContext, ); url = request.url; headers = request.headers; @@ -200,19 +220,20 @@ export class Querier { headers, }); }, - this.__hosts?.length || 0 + this.__hosts?.length || 0, ); return respBody; }; // path should start with "/" - sendDeleteRequest = async ( - path: NormalisedURLPath, - body: any, + sendDeleteRequest = async

( + template: PathParam

, + body: RequestBody, params: any | undefined, - userContext: UserContext - ): Promise => { + userContext: UserContext, + ): Promise> => { this.invalidateCoreCallCache(userContext); + const path = this.getPath(template); const { body: respBody } = await this.sendRequestHelper( path, @@ -241,7 +262,7 @@ export class Querier { params: params, body: body, }, - userContext + userContext, ); url = request.url; headers = request.headers; @@ -263,17 +284,18 @@ export class Querier { headers, }); }, - this.__hosts?.length || 0 + this.__hosts?.length || 0, ); return respBody; }; // path should start with "/" - sendGetRequest = async ( - path: NormalisedURLPath, + sendGetRequest = async

( + template: PathParam

, params: Record, - userContext: UserContext - ): Promise => { + userContext: UserContext, + ): Promise> => { + const path = this.getPath(template); const { body: respBody } = await this.sendRequestHelper( path, "GET", @@ -335,7 +357,7 @@ export class Querier { headers: headers, params: params, }, - userContext + userContext, ); url = request.url; headers = request.headers; @@ -345,7 +367,7 @@ export class Querier { } const finalURL = new URL(url); const searchParams = new URLSearchParams( - Object.entries(params).filter(([_, value]) => value !== undefined) as string[][] + Object.entries(params).filter(([_, value]) => value !== undefined) as string[][], ); finalURL.search = searchParams.toString(); @@ -374,18 +396,19 @@ export class Querier { return response; }, - this.__hosts?.length || 0 + this.__hosts?.length || 0, ); return respBody; }; - sendGetRequestWithResponseHeaders = async ( - path: NormalisedURLPath, + sendGetRequestWithResponseHeaders = async

( + template: PathParam

, params: Record, inpHeaders: Record | undefined, - userContext: UserContext - ): Promise<{ body: any; headers: Headers }> => { + userContext: UserContext, + ): Promise<{ body: ResponseBody; headers: Headers }> => { + const path = this.getPath(template); return await this.sendRequestHelper( path, "GET", @@ -414,7 +437,7 @@ export class Querier { headers: headers, params: params, }, - userContext + userContext, ); url = request.url; headers = request.headers; @@ -424,7 +447,7 @@ export class Querier { } const finalURL = new URL(url); const searchParams = new URLSearchParams( - Object.entries(params).filter(([_, value]) => value !== undefined) as string[][] + Object.entries(params).filter(([_, value]) => value !== undefined) as string[][], ); finalURL.search = searchParams.toString(); return doFetch(finalURL.toString(), { @@ -432,18 +455,19 @@ export class Querier { headers, }); }, - this.__hosts?.length || 0 + this.__hosts?.length || 0, ); }; // path should start with "/" - sendPutRequest = async ( - path: NormalisedURLPath, - body: any, + sendPutRequest = async

( + template: PathParam

, + body: RequestBody, params: Record, - userContext: UserContext - ): Promise => { + userContext: UserContext, + ): Promise> => { this.invalidateCoreCallCache(userContext); + const path = this.getPath(template); const { body: respBody } = await this.sendRequestHelper( path, @@ -472,7 +496,7 @@ export class Querier { body: body, params: params, }, - userContext + userContext, ); url = request.url; headers = request.headers; @@ -483,7 +507,7 @@ export class Querier { const finalURL = new URL(url); const searchParams = new URLSearchParams( - Object.entries(params).filter(([_, value]) => value !== undefined) as string[][] + Object.entries(params).filter(([_, value]) => value !== undefined) as string[][], ); finalURL.search = searchParams.toString(); @@ -493,14 +517,19 @@ export class Querier { headers, }); }, - this.__hosts?.length || 0 + this.__hosts?.length || 0, ); return respBody; }; // path should start with "/" - sendPatchRequest = async (path: NormalisedURLPath, body: any, userContext: UserContext): Promise => { + sendPatchRequest = async

( + template: PathParam

, + body: RequestBody, + userContext: UserContext, + ): Promise> => { this.invalidateCoreCallCache(userContext); + const path = this.getPath(template); const { body: respBody } = await this.sendRequestHelper( path, @@ -528,7 +557,7 @@ export class Querier { headers: headers, body: body, }, - userContext + userContext, ); url = request.url; headers = request.headers; @@ -543,7 +572,7 @@ export class Querier { headers, }); }, - this.__hosts?.length || 0 + this.__hosts?.length || 0, ); return respBody; }; @@ -580,11 +609,11 @@ export class Querier { method: string, requestFunc: (url: string) => Promise, numberOfTries: number, - retryInfoMap?: Record + retryInfoMap?: Record, ): Promise => { if (this.__hosts === undefined) { throw Error( - "No SuperTokens core available to query. Please pass supertokens > connectionURI to the init function, or override all the functions of the recipe you are using." + "No SuperTokens core available to query. Please pass supertokens > connectionURI to the init function, or override all the functions of the recipe you are using.", ); } if (numberOfTries === 0) { @@ -623,7 +652,7 @@ export class Querier { return { body: await response.clone().text(), headers: response.headers }; } return { body: await response.clone().json(), headers: response.headers }; - } catch (err) { + } catch (err: any) { if ( err.message !== undefined && (err.message.includes("Failed to fetch") || @@ -658,7 +687,7 @@ export class Querier { "' with status code: " + err.status + " and message: " + - (await err.text()) + (await err.text()), ); } diff --git a/lib/ts/supertokens.ts b/lib/ts/supertokens.ts index 145266186..1bb8de28d 100644 --- a/lib/ts/supertokens.ts +++ b/lib/ts/supertokens.ts @@ -59,14 +59,14 @@ export default class SuperTokens { config.appInfo.origin === undefined ? undefined : typeof config.appInfo.origin === "string" - ? config.appInfo.origin - : "function"; + ? config.appInfo.origin + : "function"; logDebugMessage( "appInfo: " + JSON.stringify({ ...config.appInfo, origin: originToPrint, - }) + }), ); this.framework = config.framework !== undefined ? config.framework : "express"; @@ -86,7 +86,7 @@ export default class SuperTokens { }), config.supertokens?.apiKey, config.supertokens?.networkInterceptor, - config.supertokens?.disableCoreCallCache + config.supertokens?.disableCoreCallCache, ); if (config.recipeList === undefined || config.recipeList.length === 0) { throw new Error("Please provide at least one recipe to the supertokens.init function call"); @@ -209,7 +209,7 @@ export default class SuperTokens { response: BaseResponse, path: NormalisedURLPath, method: HTTPMethod, - userContext: UserContext + userContext: UserContext, ) => { return await matchedRecipe.handleAPIRequest(id, tenantId, request, response, path, method, userContext); }; @@ -230,13 +230,13 @@ export default class SuperTokens { getUserCount = async ( includeRecipeIds: string[] | undefined, tenantId: string | undefined, - userContext: UserContext + userContext: UserContext, ): Promise => { let querier = Querier.getNewInstanceOrThrowError(undefined); let apiVersion = await querier.getAPIVersion(userContext); if (maxVersion(apiVersion, "2.7") === "2.7") { throw new Error( - "Please use core version >= 3.5 to call this function. Otherwise, you can call .getUserCount() instead (for example, EmailPassword.getUserCount())" + "Please use core version >= 3.5 to call this function. Otherwise, you can call .getUserCount() instead (for example, EmailPassword.getUserCount())", ); } let includeRecipeIdsStr = undefined; @@ -245,12 +245,17 @@ export default class SuperTokens { } let response = await querier.sendGetRequest( - new NormalisedURLPath(`/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/users/count`), + { + path: "//users/count", + params: { + tenantId: tenantId === undefined ? DEFAULT_TENANT_ID : tenantId, + }, + }, { includeRecipeIds: includeRecipeIdsStr, includeAllTenants: tenantId === undefined, }, - userContext + userContext, ); return Number(response.count); }; @@ -276,14 +281,14 @@ export default class SuperTokens { if (maxVersion("2.15", cdiVersion) === cdiVersion) { // create userId mapping is only available >= CDI 2.15 return await querier.sendPostRequest( - new NormalisedURLPath("/recipe/userid/map"), + "/recipe/userid/map", { superTokensUserId: input.superTokensUserId, externalUserId: input.externalUserId, externalUserIdInfo: input.externalUserIdInfo, force: input.force, }, - input.userContext + input.userContext, ); } else { throw new global.Error("Please upgrade the SuperTokens core to >= 3.15.0"); @@ -310,12 +315,12 @@ export default class SuperTokens { if (maxVersion("2.15", cdiVersion) === cdiVersion) { // create userId mapping is only available >= CDI 2.15 let response = await querier.sendGetRequest( - new NormalisedURLPath("/recipe/userid/map"), + "/recipe/userid/map", { userId: input.userId, userIdType: input.userIdType, }, - input.userContext + input.userContext, ); return response; } else { @@ -336,13 +341,13 @@ export default class SuperTokens { let cdiVersion = await querier.getAPIVersion(input.userContext); if (maxVersion("2.15", cdiVersion) === cdiVersion) { return await querier.sendPostRequest( - new NormalisedURLPath("/recipe/userid/map/remove"), + "/recipe/userid/map/remove", { userId: input.userId, userIdType: input.userIdType, force: input.force, }, - input.userContext + input.userContext, ); } else { throw new global.Error("Please upgrade the SuperTokens core to >= 3.15.0"); @@ -361,14 +366,14 @@ export default class SuperTokens { let cdiVersion = await querier.getAPIVersion(input.userContext); if (maxVersion("2.15", cdiVersion) === cdiVersion) { return await querier.sendPutRequest( - new NormalisedURLPath("/recipe/userid/external-user-id-info"), + "/recipe/userid/external-user-id-info", { userId: input.userId, userIdType: input.userIdType, - externalUserIdInfo: input.externalUserIdInfo, + externalUserIdInfo: input.externalUserIdInfo || null, }, {}, - input.userContext + input.userContext, ); } else { throw new global.Error("Please upgrade the SuperTokens core to >= 3.15.0"); @@ -384,7 +389,7 @@ export default class SuperTokens { if (!path.startsWith(this.appInfo.apiBasePath)) { logDebugMessage( "middleware: Not handling because request path did not start with config path. Request path: " + - path.getAsStringDangerous() + path.getAsStringDangerous(), ); return false; } @@ -411,7 +416,7 @@ export default class SuperTokens { " with path: " + path.getAsStringDangerous() + " and method: " + - method + method, ); let idResult = await recipeModules[i].returnAPIIdIfCanHandleRequest(path, method, userContext); if (idResult !== undefined) { @@ -440,7 +445,7 @@ export default class SuperTokens { response, path, method, - userContext + userContext, ); if (!requestHandled) { logDebugMessage("middleware: Not handled because API returned requestHandled as false"); @@ -512,7 +517,7 @@ export default class SuperTokens { idResult = currIdResult; } else { throw new Error( - "Two recipes have matched the same API path and method! This is a bug in the SDK. Please contact support." + "Two recipes have matched the same API path and method! This is a bug in the SDK. Please contact support.", ); } } @@ -531,7 +536,7 @@ export default class SuperTokens { response, path, method, - userContext + userContext, ); if (!requestHandled) { logDebugMessage("middleware: Not handled because API returned requestHandled as false"); From bd35f005ef25006de84ec1af26295634f3e8319e Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Wed, 30 Apr 2025 15:28:35 +0530 Subject: [PATCH 04/64] Update all querier references to avoid usage of NormalisedURLPath --- .../accountlinking/recipeImplementation.ts | 126 ++++++++++-------- lib/ts/recipe/dashboard/api/analytics.ts | 2 +- .../api/multitenancy/getTenantInfo.ts | 7 +- lib/ts/recipe/dashboard/api/search/tagsGet.ts | 3 +- lib/ts/recipe/dashboard/api/signIn.ts | 4 +- lib/ts/recipe/dashboard/api/signOut.ts | 5 +- .../recipe/dashboard/recipeImplementation.ts | 2 +- .../emailpassword/recipeImplementation.ts | 37 +++-- .../emailverification/recipeImplementation.ts | 25 +++- lib/ts/recipe/jwt/recipeImplementation.ts | 4 +- .../multitenancy/recipeImplementation.ts | 54 +++++--- .../oauth2provider/recipeImplementation.ts | 43 +++--- .../passwordless/recipeImplementation.ts | 72 ++++++++-- lib/ts/recipe/session/recipeImplementation.ts | 2 +- lib/ts/recipe/session/sessionFunctions.ts | 54 ++++++-- .../recipe/thirdparty/recipeImplementation.ts | 7 +- lib/ts/recipe/totp/recipeImplementation.ts | 22 ++- .../usermetadata/recipeImplementation.ts | 6 +- .../recipe/userroles/recipeImplementation.ts | 42 ++++-- .../recipe/webauthn/recipeImplementation.ts | 102 +++++++++----- 20 files changed, 406 insertions(+), 213 deletions(-) diff --git a/lib/ts/recipe/accountlinking/recipeImplementation.ts b/lib/ts/recipe/accountlinking/recipeImplementation.ts index 79b4357ce..2655d1096 100644 --- a/lib/ts/recipe/accountlinking/recipeImplementation.ts +++ b/lib/ts/recipe/accountlinking/recipeImplementation.ts @@ -55,7 +55,12 @@ export default function getRecipeImplementation( includeRecipeIdsStr = includeRecipeIds.join(","); } let response = await querier.sendGetRequest( - new NormalisedURLPath(`${tenantId ?? "public"}/users`), + { + path: "//users", + params: { + tenantId: tenantId ?? "public", + }, + }, { includeRecipeIds: includeRecipeIdsStr, timeJoinedOrder: timeJoinedOrder, @@ -81,19 +86,19 @@ export default function getRecipeImplementation( } ): Promise< | { - status: "OK"; - wasAlreadyAPrimaryUser: boolean; - } + status: "OK"; + wasAlreadyAPrimaryUser: boolean; + } | { - status: - | "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR" - | "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - primaryUserId: string; - description: string; - } + status: + | "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR" + | "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + primaryUserId: string; + description: string; + } > { return await querier.sendGetRequest( - new NormalisedURLPath("/recipe/accountlinking/user/primary/check"), + "/recipe/accountlinking/user/primary/check", { recipeUserId: recipeUserId.getAsString(), }, @@ -112,22 +117,22 @@ export default function getRecipeImplementation( } ): Promise< | { - status: "OK"; - user: User; - wasAlreadyAPrimaryUser: boolean; - } + status: "OK"; + user: User; + wasAlreadyAPrimaryUser: boolean; + } | { - status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; - primaryUserId: string; - } + status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; + primaryUserId: string; + } | { - status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - primaryUserId: string; - description: string; - } + status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + primaryUserId: string; + description: string; + } > { let response = await querier.sendPostRequest( - new NormalisedURLPath("/recipe/accountlinking/user/primary"), + "/recipe/accountlinking/user/primary", { recipeUserId: recipeUserId.getAsString(), }, @@ -152,25 +157,25 @@ export default function getRecipeImplementation( } ): Promise< | { - status: "OK"; - accountsAlreadyLinked: boolean; - } + status: "OK"; + accountsAlreadyLinked: boolean; + } | { - status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - description: string; - primaryUserId: string; - } + status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + description: string; + primaryUserId: string; + } | { - status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - primaryUserId: string; - description: string; - } + status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + primaryUserId: string; + description: string; + } | { - status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; - } + status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; + } > { let result = await querier.sendGetRequest( - new NormalisedURLPath("/recipe/accountlinking/user/link/check"), + ("/recipe/accountlinking/user/link/check"), { recipeUserId: recipeUserId.getAsString(), primaryUserId, @@ -194,26 +199,26 @@ export default function getRecipeImplementation( } ): Promise< | { - status: "OK"; - accountsAlreadyLinked: boolean; - user: User; - } + status: "OK"; + accountsAlreadyLinked: boolean; + user: User; + } | { - status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - user: User; - primaryUserId: string; - } + status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + user: User; + primaryUserId: string; + } | { - status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - primaryUserId: string; - description: string; - } + status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + primaryUserId: string; + description: string; + } | { - status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; - } + status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; + } > { const accountsLinkingResult = await querier.sendPostRequest( - new NormalisedURLPath("/recipe/accountlinking/user/link"), + "/recipe/accountlinking/user/link", { recipeUserId: recipeUserId.getAsString(), primaryUserId, @@ -221,6 +226,10 @@ export default function getRecipeImplementation( userContext ); + if (accountsLinkingResult.status === "OK") { + accountsLinkingResult.user = new User(accountsLinkingResult.user); + } + if ( ["OK", "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"].includes( accountsLinkingResult.status @@ -276,7 +285,7 @@ export default function getRecipeImplementation( wasLinked: boolean; }> { let accountsUnlinkingResult = await querier.sendPostRequest( - new NormalisedURLPath("/recipe/accountlinking/user/unlink"), + "/recipe/accountlinking/user/unlink", { recipeUserId: recipeUserId.getAsString(), }, @@ -287,7 +296,7 @@ export default function getRecipeImplementation( getUser: async function (this: RecipeInterface, { userId, userContext }): Promise { let result = await querier.sendGetRequest( - new NormalisedURLPath("/user/id"), + "/user/id", { userId, }, @@ -314,7 +323,12 @@ export default function getRecipeImplementation( } ): Promise { let result = await querier.sendGetRequest( - new NormalisedURLPath(`${tenantId ?? "public"}/users/by-accountinfo`), + { + path: "//users/by-accountinfo", + params: { + tenantId: tenantId ?? "public", + }, + }, { email: accountInfo.email, phoneNumber: accountInfo.phoneNumber, @@ -343,7 +357,7 @@ export default function getRecipeImplementation( status: "OK"; }> { return await querier.sendPostRequest( - new NormalisedURLPath("/user/remove"), + ("/user/remove"), { userId, removeAllLinkedAccounts, diff --git a/lib/ts/recipe/dashboard/api/analytics.ts b/lib/ts/recipe/dashboard/api/analytics.ts index c7830273d..4ceb3a928 100644 --- a/lib/ts/recipe/dashboard/api/analytics.ts +++ b/lib/ts/recipe/dashboard/api/analytics.ts @@ -59,7 +59,7 @@ export default async function analyticsPost( let numberOfUsers: number; try { let querier = Querier.getNewInstanceOrThrowError(options.recipeId); - let response = await querier.sendGetRequest(new NormalisedURLPath("/telemetry"), {}, userContext); + let response = await querier.sendGetRequest("/telemetry", {}, userContext); if (response.exists) { telemetryId = response.telemetryId; } diff --git a/lib/ts/recipe/dashboard/api/multitenancy/getTenantInfo.ts b/lib/ts/recipe/dashboard/api/multitenancy/getTenantInfo.ts index c03a04093..84258fc5b 100644 --- a/lib/ts/recipe/dashboard/api/multitenancy/getTenantInfo.ts +++ b/lib/ts/recipe/dashboard/api/multitenancy/getTenantInfo.ts @@ -82,7 +82,12 @@ export default async function getTenantInfo( let querier = Querier.getNewInstanceOrThrowError(options.recipeId); let coreConfig = await querier.sendGetRequest( - new NormalisedURLPath(`/${tenantId}/recipe/dashboard/tenant/core-config`), + { + path: "//recipe/dashboard/tenant/core-config", + params: { + tenantId, + }, + }, {}, userContext ); diff --git a/lib/ts/recipe/dashboard/api/search/tagsGet.ts b/lib/ts/recipe/dashboard/api/search/tagsGet.ts index 8d380c109..420b39654 100644 --- a/lib/ts/recipe/dashboard/api/search/tagsGet.ts +++ b/lib/ts/recipe/dashboard/api/search/tagsGet.ts @@ -15,7 +15,6 @@ import { APIInterface, APIOptions } from "../../types"; import { Querier } from "../../../../querier"; -import NormalisedURLPath from "../../../../normalisedURLPath"; import { UserContext } from "../../../../types"; type TagsResponse = { status: "OK"; tags: string[] }; @@ -27,6 +26,6 @@ export const getSearchTags = async ( userContext: UserContext ): Promise => { let querier = Querier.getNewInstanceOrThrowError(options.recipeId); - let tagsResponse = await querier.sendGetRequest(new NormalisedURLPath("/user/search/tags"), {}, userContext); + let tagsResponse = await querier.sendGetRequest("/user/search/tags", {}, userContext); return tagsResponse; }; diff --git a/lib/ts/recipe/dashboard/api/signIn.ts b/lib/ts/recipe/dashboard/api/signIn.ts index 96df122c3..dcc193325 100644 --- a/lib/ts/recipe/dashboard/api/signIn.ts +++ b/lib/ts/recipe/dashboard/api/signIn.ts @@ -43,8 +43,8 @@ export default async function signIn(_: APIInterface, options: APIOptions, userC } let querier = Querier.getNewInstanceOrThrowError(undefined); - const signInResponse = await querier.sendPostRequest( - new NormalisedURLPath("/recipe/dashboard/signin"), + const signInResponse = await querier.sendPostRequest( + "/recipe/dashboard/signin", { email, password, diff --git a/lib/ts/recipe/dashboard/api/signOut.ts b/lib/ts/recipe/dashboard/api/signOut.ts index 12128d166..7dc199d16 100644 --- a/lib/ts/recipe/dashboard/api/signOut.ts +++ b/lib/ts/recipe/dashboard/api/signOut.ts @@ -16,7 +16,6 @@ import { APIInterface, APIOptions } from "../types"; import { send200Response } from "../../../utils"; import { Querier } from "../../../querier"; -import NormalisedURLPath from "../../../normalisedURLPath"; import { UserContext } from "../../../types"; export default async function signOut( @@ -31,8 +30,8 @@ export default async function signOut( const sessionIdFormAuthHeader = options.req.getHeaderValue("authorization")?.split(" ")[1]; let querier = Querier.getNewInstanceOrThrowError(undefined); const sessionDeleteResponse = await querier.sendDeleteRequest( - new NormalisedURLPath("/recipe/dashboard/session"), - {}, + "/recipe/dashboard/session", + undefined, { sessionId: sessionIdFormAuthHeader }, userContext ); diff --git a/lib/ts/recipe/dashboard/recipeImplementation.ts b/lib/ts/recipe/dashboard/recipeImplementation.ts index 446c2047c..155b7c973 100644 --- a/lib/ts/recipe/dashboard/recipeImplementation.ts +++ b/lib/ts/recipe/dashboard/recipeImplementation.ts @@ -35,7 +35,7 @@ export default function getRecipeImplementation(): RecipeInterface { let querier = Querier.getNewInstanceOrThrowError(undefined); const authHeaderValue = input.req.getHeaderValue("authorization")?.split(" ")[1]; const sessionVerificationResponse = await querier.sendPostRequest( - new NormalisedURLPath("/recipe/dashboard/session/verify"), + "/recipe/dashboard/session/verify", { sessionId: authHeaderValue, }, diff --git a/lib/ts/recipe/emailpassword/recipeImplementation.ts b/lib/ts/recipe/emailpassword/recipeImplementation.ts index 1c883021c..082f83437 100644 --- a/lib/ts/recipe/emailpassword/recipeImplementation.ts +++ b/lib/ts/recipe/emailpassword/recipeImplementation.ts @@ -82,9 +82,12 @@ export default function getRecipeInterface( | { status: "EMAIL_ALREADY_EXISTS_ERROR" } > { const resp = await querier.sendPostRequest( - new NormalisedURLPath( - `/${input.tenantId === undefined ? DEFAULT_TENANT_ID : input.tenantId}/recipe/signup` - ), + { + path: "//recipe/signup", + params: { + tenantId: input.tenantId === undefined ? DEFAULT_TENANT_ID : input.tenantId, + }, + }, { email: input.email, password: input.password, @@ -168,7 +171,12 @@ export default function getRecipeInterface( | { status: "WRONG_CREDENTIALS_ERROR" } > { const response = await querier.sendPostRequest( - new NormalisedURLPath(`/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/signin`), + { + path: "//recipe/signin", + params: { + tenantId: tenantId === undefined ? DEFAULT_TENANT_ID : tenantId, + }, + }, { email, password, @@ -202,9 +210,12 @@ export default function getRecipeInterface( }): Promise<{ status: "OK"; token: string } | { status: "UNKNOWN_USER_ID_ERROR" }> { // the input user ID can be a recipe or a primary user ID. return await querier.sendPostRequest( - new NormalisedURLPath( - `/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/user/password/reset/token` - ), + { + path: "//recipe/user/password/reset/token", + params: { + tenantId: tenantId === undefined ? DEFAULT_TENANT_ID : tenantId, + }, + }, { userId, email, @@ -230,11 +241,13 @@ export default function getRecipeInterface( | { status: "RESET_PASSWORD_INVALID_TOKEN_ERROR" } > { return await querier.sendPostRequest( - new NormalisedURLPath( - `/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/user/password/reset/token/consume` - ), { - method: "token", + path: "//recipe/user/password/reset/token/consume", + params: { + tenantId: tenantId === undefined ? DEFAULT_TENANT_ID : tenantId, + }, + }, + { token, }, userContext @@ -319,7 +332,7 @@ export default function getRecipeInterface( // an update email API (post login update). let response = await querier.sendPutRequest( - new NormalisedURLPath(`/recipe/user`), + "/recipe/user", { recipeUserId: input.recipeUserId.getAsString(), email: input.email, diff --git a/lib/ts/recipe/emailverification/recipeImplementation.ts b/lib/ts/recipe/emailverification/recipeImplementation.ts index b597aef0e..abaf99bd1 100644 --- a/lib/ts/recipe/emailverification/recipeImplementation.ts +++ b/lib/ts/recipe/emailverification/recipeImplementation.ts @@ -30,7 +30,12 @@ export default function getRecipeInterface( | { status: "EMAIL_ALREADY_VERIFIED_ERROR" } > { let response = await querier.sendPostRequest( - new NormalisedURLPath(`/${tenantId}/recipe/user/email/verify/token`), + { + path: "//recipe/user/email/verify/token", + params: { + tenantId, + }, + }, { userId: recipeUserId.getAsString(), email, @@ -56,7 +61,12 @@ export default function getRecipeInterface( userContext, }): Promise<{ status: "OK"; user: UserEmailInfo } | { status: "EMAIL_VERIFICATION_INVALID_TOKEN_ERROR" }> { let response = await querier.sendPostRequest( - new NormalisedURLPath(`/${tenantId}/recipe/user/email/verify`), + { + path: "//recipe/user/email/verify", + params: { + tenantId, + }, + }, { method: "token", token, @@ -113,7 +123,7 @@ export default function getRecipeInterface( userContext: UserContext; }): Promise { let response = await querier.sendGetRequest( - new NormalisedURLPath("/recipe/user/email/verify"), + "/recipe/user/email/verify", { userId: recipeUserId.getAsString(), email, @@ -130,7 +140,12 @@ export default function getRecipeInterface( userContext: UserContext; }): Promise<{ status: "OK" }> { await querier.sendPostRequest( - new NormalisedURLPath(`/${input.tenantId}/recipe/user/email/verify/token/remove`), + { + path: "//recipe/user/email/verify/token/remove", + params: { + tenantId: input.tenantId, + }, + }, { userId: input.recipeUserId.getAsString(), email: input.email, @@ -146,7 +161,7 @@ export default function getRecipeInterface( userContext: UserContext; }): Promise<{ status: "OK" }> { await querier.sendPostRequest( - new NormalisedURLPath("/recipe/user/email/verify/remove"), + "/recipe/user/email/verify/remove", { userId: input.recipeUserId.getAsString(), email: input.email, diff --git a/lib/ts/recipe/jwt/recipeImplementation.ts b/lib/ts/recipe/jwt/recipeImplementation.ts index fa937c881..aade7b227 100644 --- a/lib/ts/recipe/jwt/recipeImplementation.ts +++ b/lib/ts/recipe/jwt/recipeImplementation.ts @@ -51,7 +51,7 @@ export default function getRecipeInterface( } let response = await querier.sendPostRequest( - new NormalisedURLPath("/recipe/jwt"), + "/recipe/jwt", { payload: payload ?? {}, validity: validitySeconds, @@ -76,7 +76,7 @@ export default function getRecipeInterface( getJWKS: async function ({ userContext }): Promise<{ keys: JsonWebKey[]; validityInSeconds?: number }> { const { body, headers } = await querier.sendGetRequestWithResponseHeaders( - new NormalisedURLPath("/.well-known/jwks.json"), + "/.well-known/jwks.json", {}, undefined, userContext diff --git a/lib/ts/recipe/multitenancy/recipeImplementation.ts b/lib/ts/recipe/multitenancy/recipeImplementation.ts index d3694647a..b0516a50c 100644 --- a/lib/ts/recipe/multitenancy/recipeImplementation.ts +++ b/lib/ts/recipe/multitenancy/recipeImplementation.ts @@ -1,6 +1,5 @@ import { RecipeInterface } from "./"; import { Querier } from "../../querier"; -import NormalisedURLPath from "../../normalisedURLPath"; import { DEFAULT_TENANT_ID } from "./constants"; export default function getRecipeInterface(querier: Querier): RecipeInterface { @@ -11,7 +10,7 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { createOrUpdateTenant: async function ({ tenantId, config, userContext }) { let response = await querier.sendPutRequest( - new NormalisedURLPath(`/recipe/multitenancy/tenant/v2`), + "/recipe/multitenancy/tenant/v2", { tenantId, ...config, @@ -25,7 +24,7 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { deleteTenant: async function ({ tenantId, userContext }) { let response = await querier.sendPostRequest( - new NormalisedURLPath(`/recipe/multitenancy/tenant/remove`), + "/recipe/multitenancy/tenant/remove", { tenantId, }, @@ -37,9 +36,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { getTenant: async function ({ tenantId, userContext }) { let response = await querier.sendGetRequest( - new NormalisedURLPath( - `/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/multitenancy/tenant/v2` - ), + { + path: "//recipe/multitenancy/tenant/v2", + params: { + tenantId: tenantId === undefined ? DEFAULT_TENANT_ID : tenantId, + }, + }, {}, userContext ); @@ -53,7 +55,7 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { listAllTenants: async function ({ userContext }) { let response = await querier.sendGetRequest( - new NormalisedURLPath(`/recipe/multitenancy/tenant/list/v2`), + "/recipe/multitenancy/tenant/list/v2", {}, userContext ); @@ -62,9 +64,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { createOrUpdateThirdPartyConfig: async function ({ tenantId, config, skipValidation, userContext }) { let response = await querier.sendPutRequest( - new NormalisedURLPath( - `/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/multitenancy/config/thirdparty` - ), + { + path: "//recipe/multitenancy/config/thirdparty", + params: { + tenantId: tenantId === undefined ? DEFAULT_TENANT_ID : tenantId, + }, + }, { config, skipValidation, @@ -77,11 +82,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { deleteThirdPartyConfig: async function ({ tenantId, thirdPartyId, userContext }) { let response = await querier.sendPostRequest( - new NormalisedURLPath( - `/${ - tenantId === undefined ? DEFAULT_TENANT_ID : tenantId - }/recipe/multitenancy/config/thirdparty/remove` - ), + { + path: "//recipe/multitenancy/config/thirdparty/remove", + params: { + tenantId: tenantId === undefined ? DEFAULT_TENANT_ID : tenantId, + }, + }, { thirdPartyId, }, @@ -92,9 +98,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { associateUserToTenant: async function ({ tenantId, recipeUserId, userContext }) { let response = await querier.sendPostRequest( - new NormalisedURLPath( - `/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/multitenancy/tenant/user` - ), + { + path: "//recipe/multitenancy/tenant/user", + params: { + tenantId: tenantId === undefined ? DEFAULT_TENANT_ID : tenantId, + }, + }, { recipeUserId: recipeUserId.getAsString(), }, @@ -105,9 +114,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { disassociateUserFromTenant: async function ({ tenantId, recipeUserId, userContext }) { let response = await querier.sendPostRequest( - new NormalisedURLPath( - `/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/multitenancy/tenant/user/remove` - ), + { + path: "//recipe/multitenancy/tenant/user/remove", + params: { + tenantId: tenantId === undefined ? DEFAULT_TENANT_ID : tenantId, + }, + }, { recipeUserId: recipeUserId.getAsString(), }, diff --git a/lib/ts/recipe/oauth2provider/recipeImplementation.ts b/lib/ts/recipe/oauth2provider/recipeImplementation.ts index ee2b1a99f..0a8cdfae0 100644 --- a/lib/ts/recipe/oauth2provider/recipeImplementation.ts +++ b/lib/ts/recipe/oauth2provider/recipeImplementation.ts @@ -14,7 +14,6 @@ */ import * as jose from "jose"; -import NormalisedURLPath from "../../normalisedURLPath"; import { Querier } from "../../querier"; import { JSONObject, NormalisedAppinfo } from "../../types"; import { @@ -61,7 +60,7 @@ export default function getRecipeInterface( return { getLoginRequest: async function (this: RecipeInterface, input) { const resp = await querier.sendGetRequest( - new NormalisedURLPath("/recipe/oauth/auth/requests/login"), + "/recipe/oauth/auth/requests/login", { loginChallenge: input.challenge }, input.userContext ); @@ -88,7 +87,7 @@ export default function getRecipeInterface( }, acceptLoginRequest: async function (this: RecipeInterface, input): Promise<{ redirectTo: string }> { const resp = await querier.sendPutRequest( - new NormalisedURLPath(`/recipe/oauth/auth/requests/login/accept`), + "/recipe/oauth/auth/requests/login/accept", { acr: input.acr, amr: input.amr, @@ -109,7 +108,7 @@ export default function getRecipeInterface( }, rejectLoginRequest: async function (this: RecipeInterface, input): Promise<{ redirectTo: string }> { const resp = await querier.sendPutRequest( - new NormalisedURLPath(`/recipe/oauth/auth/requests/login/reject`), + "/recipe/oauth/auth/requests/login/reject", { error: input.error.error, errorDescription: input.error.errorDescription, @@ -127,7 +126,7 @@ export default function getRecipeInterface( }, getConsentRequest: async function (this: RecipeInterface, input): Promise { const resp = await querier.sendGetRequest( - new NormalisedURLPath("/recipe/oauth/auth/requests/consent"), + "/recipe/oauth/auth/requests/consent", { consentChallenge: input.challenge }, input.userContext ); @@ -149,7 +148,7 @@ export default function getRecipeInterface( }, acceptConsentRequest: async function (this: RecipeInterface, input): Promise<{ redirectTo: string }> { const resp = await querier.sendPutRequest( - new NormalisedURLPath(`/recipe/oauth/auth/requests/consent/accept`), + "/recipe/oauth/auth/requests/consent/accept", { context: input.context, grantAccessTokenAudience: input.grantAccessTokenAudience, @@ -175,7 +174,7 @@ export default function getRecipeInterface( rejectConsentRequest: async function (this: RecipeInterface, input) { const resp = await querier.sendPutRequest( - new NormalisedURLPath(`/recipe/oauth/auth/requests/consent/reject`), + "/recipe/oauth/auth/requests/consent/reject", { error: input.error.error, errorDescription: input.error.errorDescription, @@ -274,7 +273,7 @@ export default function getRecipeInterface( } const resp = await querier.sendPostRequest( - new NormalisedURLPath(`/recipe/oauth/auth`), + "/recipe/oauth/auth", { params: { ...input.params, @@ -455,7 +454,7 @@ export default function getRecipeInterface( } const res = await querier.sendPostRequest( - new NormalisedURLPath(`/recipe/oauth/token`), + "/recipe/oauth/token", body, input.userContext ); @@ -482,7 +481,7 @@ export default function getRecipeInterface( getOAuth2Clients: async function (input) { let response = await querier.sendGetRequestWithResponseHeaders( - new NormalisedURLPath(`/recipe/oauth/clients/list`), + "/recipe/oauth/clients/list", { pageSize: input.pageSize, clientName: input.clientName, @@ -508,7 +507,7 @@ export default function getRecipeInterface( }, getOAuth2Client: async function (input) { let response = await querier.sendGetRequestWithResponseHeaders( - new NormalisedURLPath(`/recipe/oauth/clients`), + "/recipe/oauth/clients", { clientId: input.clientId }, {}, input.userContext @@ -535,7 +534,7 @@ export default function getRecipeInterface( }, createOAuth2Client: async function (input) { let response = await querier.sendPostRequest( - new NormalisedURLPath(`/recipe/oauth/clients`), + "/recipe/oauth/clients", copyAndCleanRequestBodyInput(input), input.userContext ); @@ -555,7 +554,7 @@ export default function getRecipeInterface( }, updateOAuth2Client: async function (input) { let response = await querier.sendPutRequest( - new NormalisedURLPath(`/recipe/oauth/clients`), + "/recipe/oauth/clients", copyAndCleanRequestBodyInput(input), { clientId: input.clientId }, input.userContext @@ -576,7 +575,7 @@ export default function getRecipeInterface( }, deleteOAuth2Client: async function (input) { let response = await querier.sendPostRequest( - new NormalisedURLPath(`/recipe/oauth/clients/remove`), + "/recipe/oauth/clients/remove", { clientId: input.clientId }, input.userContext ); @@ -669,7 +668,7 @@ export default function getRecipeInterface( if (input.checkDatabase) { let response = await querier.sendPostRequest( - new NormalisedURLPath(`/recipe/oauth/introspect`), + "/recipe/oauth/introspect", { token: input.token, }, @@ -699,7 +698,7 @@ export default function getRecipeInterface( } const res = await querier.sendPostRequest( - new NormalisedURLPath(`/recipe/oauth/token/revoke`), + "/recipe/oauth/token/revoke", requestBody, input.userContext ); @@ -717,7 +716,7 @@ export default function getRecipeInterface( }, revokeTokensBySessionHandle: async function (this: RecipeInterface, input) { await querier.sendPostRequest( - new NormalisedURLPath(`/recipe/oauth/session/revoke`), + "/recipe/oauth/session/revoke", { sessionHandle: input.sessionHandle }, input.userContext ); @@ -726,7 +725,7 @@ export default function getRecipeInterface( }, revokeTokensByClientId: async function (this: RecipeInterface, input) { await querier.sendPostRequest( - new NormalisedURLPath(`/recipe/oauth/tokens/revoke`), + "/recipe/oauth/tokens/revoke", { clientId: input.clientId }, input.userContext ); @@ -756,7 +755,7 @@ export default function getRecipeInterface( // For tokens that passed local validation or if it's a refresh token, // validate the token with the database by calling the core introspection endpoint const res = await querier.sendPostRequest( - new NormalisedURLPath(`/recipe/oauth/introspect`), + "/recipe/oauth/introspect", { token, scope: scopes ? scopes.join(" ") : undefined, @@ -782,7 +781,7 @@ export default function getRecipeInterface( */ const resp = await querier.sendGetRequest( - new NormalisedURLPath(`/recipe/oauth/sessions/logout`), + "/recipe/oauth/sessions/logout", { clientId: input.params.client_id, idTokenHint: input.params.id_token_hint, @@ -847,7 +846,7 @@ export default function getRecipeInterface( }, acceptLogoutRequest: async function (this: RecipeInterface, input) { const resp = await querier.sendPutRequest( - new NormalisedURLPath(`/recipe/oauth/auth/requests/logout/accept`), + "/recipe/oauth/auth/requests/logout/accept", { challenge: input.challenge }, {}, input.userContext @@ -877,7 +876,7 @@ export default function getRecipeInterface( }, rejectLogoutRequest: async function (this: RecipeInterface, input) { const resp = await querier.sendPutRequest( - new NormalisedURLPath(`/recipe/oauth/auth/requests/logout/reject`), + "/recipe/oauth/auth/requests/logout/reject", {}, { challenge: input.challenge }, input.userContext diff --git a/lib/ts/recipe/passwordless/recipeImplementation.ts b/lib/ts/recipe/passwordless/recipeImplementation.ts index 1732a61b8..4191268e8 100644 --- a/lib/ts/recipe/passwordless/recipeImplementation.ts +++ b/lib/ts/recipe/passwordless/recipeImplementation.ts @@ -26,7 +26,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { return { consumeCode: async function (this: RecipeInterface, input) { const response = await querier.sendPostRequest( - new NormalisedURLPath(`/${input.tenantId}/recipe/signinup/code/consume`), + { + path: "//recipe/signinup/code/consume", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -70,7 +75,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { checkCode: async function (this: RecipeInterface, input) { let response = await querier.sendPostRequest( - new NormalisedURLPath(`/${input.tenantId}/recipe/signinup/code/check`), + { + path: "//recipe/signinup/code/check", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -86,7 +96,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { createCode: async function (input) { let response = await querier.sendPostRequest( - new NormalisedURLPath(`/${input.tenantId}/recipe/signinup/code`), + { + path: "//recipe/signinup/code", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -94,7 +109,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { }, createNewCodeForDevice: async function (input) { let response = await querier.sendPostRequest( - new NormalisedURLPath(`/${input.tenantId}/recipe/signinup/code`), + { + path: "//recipe/signinup/code", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -102,7 +122,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { }, listCodesByDeviceId: async function (input) { let response = await querier.sendGetRequest( - new NormalisedURLPath(`/${input.tenantId}/recipe/signinup/codes`), + { + path: "//recipe/signinup/codes", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -110,7 +135,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { }, listCodesByEmail: async function (input) { let response = await querier.sendGetRequest( - new NormalisedURLPath(`/${input.tenantId}/recipe/signinup/codes`), + { + path: "//recipe/signinup/codes", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -118,7 +148,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { }, listCodesByPhoneNumber: async function (input) { let response = await querier.sendGetRequest( - new NormalisedURLPath(`/${input.tenantId}/recipe/signinup/codes`), + { + path: "//recipe/signinup/codes", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -126,7 +161,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { }, listCodesByPreAuthSessionId: async function (input) { let response = await querier.sendGetRequest( - new NormalisedURLPath(`/${input.tenantId}/recipe/signinup/codes`), + { + path: "//recipe/signinup/codes", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -134,7 +174,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { }, revokeAllCodes: async function (input) { await querier.sendPostRequest( - new NormalisedURLPath(`/${input.tenantId}/recipe/signinup/codes/remove`), + { + path: "//recipe/signinup/codes/remove", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -144,7 +189,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { }, revokeCode: async function (input) { await querier.sendPostRequest( - new NormalisedURLPath(`/${input.tenantId}/recipe/signinup/code/remove`), + { + path: "//recipe/signinup/code/remove", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -187,7 +237,7 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { } } let response = await querier.sendPutRequest( - new NormalisedURLPath(`/recipe/user`), + "/recipe/user", copyAndRemoveUserContextAndTenantId(input), {}, input.userContext diff --git a/lib/ts/recipe/session/recipeImplementation.ts b/lib/ts/recipe/session/recipeImplementation.ts index 359c843ee..7f5e752b5 100644 --- a/lib/ts/recipe/session/recipeImplementation.ts +++ b/lib/ts/recipe/session/recipeImplementation.ts @@ -345,7 +345,7 @@ export default function getRecipeInterface( : input.newAccessTokenPayload; let response = await querier.sendPostRequest( - new NormalisedURLPath("/recipe/session/regenerate"), + "/recipe/session/regenerate", { accessToken: input.accessToken, userDataInJWT: newAccessTokenPayload, diff --git a/lib/ts/recipe/session/sessionFunctions.ts b/lib/ts/recipe/session/sessionFunctions.ts index 9c0b1bc40..f5a781a2c 100644 --- a/lib/ts/recipe/session/sessionFunctions.ts +++ b/lib/ts/recipe/session/sessionFunctions.ts @@ -51,7 +51,12 @@ export async function createNewSession( enableAntiCsrf: !disableAntiCsrf && helpers.config.antiCsrfFunctionOrString === "VIA_TOKEN", }; let response = await helpers.querier.sendPostRequest( - new NormalisedURLPath(`/${tenantId}/recipe/session`), + { + path: "//recipe/session", + params: { + tenantId: tenantId, + }, + }, requestBody, userContext ); @@ -242,7 +247,7 @@ export async function getSession( }; let response = await helpers.querier.sendPostRequest( - new NormalisedURLPath("/recipe/session/verify"), + "/recipe/session/verify", requestBody, userContext ); @@ -293,7 +298,7 @@ export async function getSessionInformation( throw new Error("Please use core version >= 3.5 to call this function."); } let response = await helpers.querier.sendGetRequest( - new NormalisedURLPath(`/recipe/session`), + "/recipe/session", { sessionHandle, }, @@ -347,7 +352,7 @@ export async function refreshSession( } let response = await helpers.querier.sendPostRequest( - new NormalisedURLPath("/recipe/session/refresh"), + "/recipe/session/refresh", requestBody, userContext ); @@ -409,13 +414,29 @@ export async function revokeAllSessionsForUser( tenantId = DEFAULT_TENANT_ID; } - let response = await helpers.querier.sendPostRequest( - new NormalisedURLPath(revokeAcrossAllTenants ? `/recipe/session/remove` : `/${tenantId}/recipe/session/remove`), + const body = { + userId, + revokeSessionsForLinkedAccounts, + revokeAcrossAllTenants, + }; + + if (revokeAcrossAllTenants) { + const response = await helpers.querier.sendPostRequest( + "/recipe/session/remove", + body, + userContext + ); + return response.sessionHandlesRevoked; + } + + const response = await helpers.querier.sendPostRequest( { - userId, - revokeSessionsForLinkedAccounts, - revokeAcrossAllTenants, + path: "//recipe/session/remove", + params: { + tenantId: tenantId, + }, }, + body, userContext ); return response.sessionHandlesRevoked; @@ -436,7 +457,12 @@ export async function getAllSessionHandlesForUser( tenantId = DEFAULT_TENANT_ID; } let response = await helpers.querier.sendGetRequest( - new NormalisedURLPath(fetchAcrossAllTenants ? `/recipe/session/user` : `/${tenantId}/recipe/session/user`), + fetchAcrossAllTenants ? "/recipe/session/user" : { + path: "//recipe/session/user", + params: { + tenantId: tenantId, + }, + }, { userId, fetchSessionsForAllLinkedAccounts, @@ -457,7 +483,7 @@ export async function revokeSession( userContext: UserContext ): Promise { let response = await helpers.querier.sendPostRequest( - new NormalisedURLPath("/recipe/session/remove"), + "/recipe/session/remove", { sessionHandles: [sessionHandle], }, @@ -476,7 +502,7 @@ export async function revokeMultipleSessions( userContext: UserContext ): Promise { let response = await helpers.querier.sendPostRequest( - new NormalisedURLPath(`/recipe/session/remove`), + "/recipe/session/remove", { sessionHandles, }, @@ -496,7 +522,7 @@ export async function updateSessionDataInDatabase( ): Promise { newSessionData = newSessionData === null || newSessionData === undefined ? {} : newSessionData; let response = await helpers.querier.sendPutRequest( - new NormalisedURLPath(`/recipe/session/data`), + "/recipe/session/data", { sessionHandle, userDataInDatabase: newSessionData, @@ -519,7 +545,7 @@ export async function updateAccessTokenPayload( newAccessTokenPayload = newAccessTokenPayload === null || newAccessTokenPayload === undefined ? {} : newAccessTokenPayload; let response = await helpers.querier.sendPutRequest( - new NormalisedURLPath("/recipe/jwt/data"), + "/recipe/jwt/data", { sessionHandle, userDataInJWT: newAccessTokenPayload, diff --git a/lib/ts/recipe/thirdparty/recipeImplementation.ts b/lib/ts/recipe/thirdparty/recipeImplementation.ts index 6225009bd..58dfc19d5 100644 --- a/lib/ts/recipe/thirdparty/recipeImplementation.ts +++ b/lib/ts/recipe/thirdparty/recipeImplementation.ts @@ -54,7 +54,12 @@ export default function getRecipeImplementation(querier: Querier, providers: Pro } } let response = await querier.sendPostRequest( - new NormalisedURLPath(`/${tenantId}/recipe/signinup`), + { + path: "//recipe/signinup", + params: { + tenantId: tenantId, + }, + }, { thirdPartyId, thirdPartyUserId, diff --git a/lib/ts/recipe/totp/recipeImplementation.ts b/lib/ts/recipe/totp/recipeImplementation.ts index a87a35c39..4ce109d0e 100644 --- a/lib/ts/recipe/totp/recipeImplementation.ts +++ b/lib/ts/recipe/totp/recipeImplementation.ts @@ -88,7 +88,7 @@ export default function getRecipeInterface(querier: Querier, config: TypeNormali } const response = await querier.sendPostRequest( - new NormalisedURLPath("/recipe/totp/device"), + "/recipe/totp/device", { userId: input.userId, deviceName: input.deviceName, @@ -117,7 +117,7 @@ export default function getRecipeInterface(querier: Querier, config: TypeNormali userContext: UserContext; }) => { return querier.sendPutRequest( - new NormalisedURLPath("/recipe/totp/device"), + "/recipe/totp/device", { userId: input.userId, existingDeviceName: input.existingDeviceName, @@ -130,7 +130,7 @@ export default function getRecipeInterface(querier: Querier, config: TypeNormali listDevices: (input: { userId: string; userContext: UserContext }) => { return querier.sendGetRequest( - new NormalisedURLPath("/recipe/totp/device/list"), + "/recipe/totp/device/list", { userId: input.userId, }, @@ -140,7 +140,7 @@ export default function getRecipeInterface(querier: Querier, config: TypeNormali removeDevice: (input: { userId: string; deviceName: string; userContext: UserContext }) => { return querier.sendPostRequest( - new NormalisedURLPath("/recipe/totp/device/remove"), + "/recipe/totp/device/remove", { userId: input.userId, deviceName: input.deviceName, @@ -157,7 +157,12 @@ export default function getRecipeInterface(querier: Querier, config: TypeNormali userContext: UserContext; }) => { return querier.sendPostRequest( - new NormalisedURLPath(`${input.tenantId}/recipe/totp/device/verify`), + { + path: "//recipe/totp/device/verify", + params: { + tenantId: input.tenantId, + }, + }, { userId: input.userId, deviceName: input.deviceName, @@ -169,7 +174,12 @@ export default function getRecipeInterface(querier: Querier, config: TypeNormali verifyTOTP: (input: { tenantId: string; userId: string; totp: string; userContext: UserContext }) => { return querier.sendPostRequest( - new NormalisedURLPath(`${input.tenantId}/recipe/totp/verify`), + { + path: "//recipe/totp/verify", + params: { + tenantId: input.tenantId, + }, + }, { userId: input.userId, totp: input.totp, diff --git a/lib/ts/recipe/usermetadata/recipeImplementation.ts b/lib/ts/recipe/usermetadata/recipeImplementation.ts index 2ab9d24e2..e2cc0c4f4 100644 --- a/lib/ts/recipe/usermetadata/recipeImplementation.ts +++ b/lib/ts/recipe/usermetadata/recipeImplementation.ts @@ -20,12 +20,12 @@ import { Querier } from "../../querier"; export default function getRecipeInterface(querier: Querier): RecipeInterface { return { getUserMetadata: function ({ userId, userContext }) { - return querier.sendGetRequest(new NormalisedURLPath("/recipe/user/metadata"), { userId }, userContext); + return querier.sendGetRequest("/recipe/user/metadata", { userId }, userContext); }, updateUserMetadata: function ({ userId, metadataUpdate, userContext }) { return querier.sendPutRequest( - new NormalisedURLPath("/recipe/user/metadata"), + "/recipe/user/metadata", { userId, metadataUpdate, @@ -37,7 +37,7 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { clearUserMetadata: function ({ userId, userContext }) { return querier.sendPostRequest( - new NormalisedURLPath("/recipe/user/metadata/remove"), + "/recipe/user/metadata/remove", { userId, }, diff --git a/lib/ts/recipe/userroles/recipeImplementation.ts b/lib/ts/recipe/userroles/recipeImplementation.ts index 7141a8bfe..eb7248411 100644 --- a/lib/ts/recipe/userroles/recipeImplementation.ts +++ b/lib/ts/recipe/userroles/recipeImplementation.ts @@ -22,7 +22,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { return { addRoleToUser: function ({ userId, role, tenantId, userContext }) { return querier.sendPutRequest( - new NormalisedURLPath(`/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/user/role`), + { + path: "//recipe/user/role", + params: { + tenantId: tenantId, + }, + }, { userId, role }, {}, userContext @@ -31,9 +36,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { removeUserRole: function ({ userId, role, tenantId, userContext }) { return querier.sendPostRequest( - new NormalisedURLPath( - `/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/user/role/remove` - ), + { + path: "//recipe/user/role/remove", + params: { + tenantId: tenantId, + }, + }, { userId, role }, userContext ); @@ -41,7 +49,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { getRolesForUser: function ({ userId, tenantId, userContext }) { return querier.sendGetRequest( - new NormalisedURLPath(`/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/user/roles`), + { + path: "//recipe/user/roles", + params: { + tenantId: tenantId, + }, + }, { userId }, userContext ); @@ -49,7 +62,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { getUsersThatHaveRole: function ({ role, tenantId, userContext }) { return querier.sendGetRequest( - new NormalisedURLPath(`/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/role/users`), + { + path: "//recipe/role/users", + params: { + tenantId: tenantId, + }, + }, { role }, userContext ); @@ -57,7 +75,7 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { createNewRoleOrAddPermissions: function ({ role, permissions, userContext }) { return querier.sendPutRequest( - new NormalisedURLPath("/recipe/role"), + "/recipe/role", { role, permissions }, {}, userContext @@ -65,12 +83,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { }, getPermissionsForRole: function ({ role, userContext }) { - return querier.sendGetRequest(new NormalisedURLPath("/recipe/role/permissions"), { role }, userContext); + return querier.sendGetRequest("/recipe/role/permissions", { role }, userContext); }, removePermissionsFromRole: function ({ role, permissions, userContext }) { return querier.sendPostRequest( - new NormalisedURLPath("/recipe/role/permissions/remove"), + "/recipe/role/permissions/remove", { role, permissions, @@ -81,18 +99,18 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { getRolesThatHavePermission: function ({ permission, userContext }) { return querier.sendGetRequest( - new NormalisedURLPath("/recipe/permission/roles"), + "/recipe/permission/roles", { permission }, userContext ); }, deleteRole: function ({ role, userContext }) { - return querier.sendPostRequest(new NormalisedURLPath("/recipe/role/remove"), { role }, userContext); + return querier.sendPostRequest("/recipe/role/remove", { role }, userContext); }, getAllRoles: function ({ userContext }) { - return querier.sendGetRequest(new NormalisedURLPath("/recipe/roles"), {}, userContext); + return querier.sendGetRequest("/recipe/roles", {}, userContext); }, }; } diff --git a/lib/ts/recipe/webauthn/recipeImplementation.ts b/lib/ts/recipe/webauthn/recipeImplementation.ts index 796be8130..2ca7db652 100644 --- a/lib/ts/recipe/webauthn/recipeImplementation.ts +++ b/lib/ts/recipe/webauthn/recipeImplementation.ts @@ -88,9 +88,12 @@ export default function getRecipeInterface( } return await querier.sendPostRequest( - new NormalisedURLPath( - `/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/webauthn/options/register` - ), + { + path: "//recipe/webauthn/options/register", + params: { + tenantId: tenantId, + }, + }, { email, displayName, @@ -119,9 +122,12 @@ export default function getRecipeInterface( userContext, }) { return await querier.sendPostRequest( - new NormalisedURLPath( - `/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/webauthn/options/signin` - ), + { + path: "//recipe/webauthn/options/signin", + params: { + tenantId: tenantId, + }, + }, { userVerification, userPresence, @@ -215,9 +221,12 @@ export default function getRecipeInterface( verifyCredentials: async function ({ credential, webauthnGeneratedOptionsId, tenantId, userContext }) { const response = await querier.sendPostRequest( - new NormalisedURLPath( - `/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/webauthn/signin` - ), + { + path: "//recipe/webauthn/signin", + params: { + tenantId: tenantId, + }, + }, { credential, webauthnGeneratedOptionsId, @@ -238,9 +247,12 @@ export default function getRecipeInterface( createNewRecipeUser: async function (input) { const resp = await querier.sendPostRequest( - new NormalisedURLPath( - `/${input.tenantId === undefined ? DEFAULT_TENANT_ID : input.tenantId}/recipe/webauthn/signup` - ), + { + path: "//recipe/webauthn/signup", + params: { + tenantId: input.tenantId, + }, + }, { webauthnGeneratedOptionsId: input.webauthnGeneratedOptionsId, credential: input.credential, @@ -261,9 +273,12 @@ export default function getRecipeInterface( generateRecoverAccountToken: async function ({ userId, email, tenantId, userContext }) { return await querier.sendPostRequest( - new NormalisedURLPath( - `/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/webauthn/user/recover/token` - ), + { + path: "//recipe/webauthn/user/recover/token", + params: { + tenantId: tenantId, + }, + }, { userId, email, @@ -274,11 +289,12 @@ export default function getRecipeInterface( consumeRecoverAccountToken: async function ({ token, tenantId, userContext }) { return await querier.sendPostRequest( - new NormalisedURLPath( - `/${ - tenantId === undefined ? DEFAULT_TENANT_ID : tenantId - }/recipe/webauthn/user/recover/token/consume` - ), + { + path: "//recipe/webauthn/user/recover/token/consume", + params: { + tenantId: tenantId, + }, + }, { token, }, @@ -288,7 +304,7 @@ export default function getRecipeInterface( registerCredential: async function ({ webauthnGeneratedOptionsId, credential, userContext, recipeUserId }) { return await querier.sendPostRequest( - new NormalisedURLPath(`/recipe/webauthn/user/credential/register`), + "/recipe/webauthn/user/credential/register", { recipeUserId, webauthnGeneratedOptionsId, @@ -300,9 +316,12 @@ export default function getRecipeInterface( getUserFromRecoverAccountToken: async function ({ token, tenantId, userContext }) { const resp = await querier.sendGetRequest( - new NormalisedURLPath( - `/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/webauthn/user/recover` - ), + { + path: "//recipe/webauthn/user/recover", + params: { + tenantId: tenantId, + }, + }, { token }, userContext ); @@ -320,7 +339,7 @@ export default function getRecipeInterface( removeCredential: async function ({ webauthnCredentialId, recipeUserId, userContext }) { return await querier.sendDeleteRequest( - new NormalisedURLPath(`/recipe/webauthn/user/credential/remove`), + "/recipe/webauthn/user/credential/remove", {}, { recipeUserId, webauthnCredentialId }, userContext @@ -329,7 +348,7 @@ export default function getRecipeInterface( getCredential: async function ({ webauthnCredentialId, recipeUserId, userContext }) { const resp = await querier.sendGetRequest( - new NormalisedURLPath(`/recipe/webauthn/user/credential`), + "/recipe/webauthn/user/credential", { webauthnCredentialId, recipeUserId }, userContext ); @@ -346,7 +365,7 @@ export default function getRecipeInterface( listCredentials: async function ({ recipeUserId, userContext }) { return await querier.sendGetRequest( - new NormalisedURLPath(`/recipe/webauthn/user/credential/list`), + "/recipe/webauthn/user/credential/list", { recipeUserId }, userContext ); @@ -354,10 +373,13 @@ export default function getRecipeInterface( removeGeneratedOptions: async function ({ webauthnGeneratedOptionsId, tenantId, userContext }) { return await querier.sendDeleteRequest( - new NormalisedURLPath( - `/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/webauthn/options/remove` - ), - {}, + { + path: "//recipe/webauthn/options/remove", + params: { + tenantId: tenantId, + }, + }, + undefined, { webauthnGeneratedOptionsId }, userContext ); @@ -365,9 +387,12 @@ export default function getRecipeInterface( getGeneratedOptions: async function ({ webauthnGeneratedOptionsId, tenantId, userContext }) { return await querier.sendGetRequest( - new NormalisedURLPath( - `/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/webauthn/options` - ), + { + path: "//recipe/webauthn/options", + params: { + tenantId: tenantId, + }, + }, { webauthnGeneratedOptionsId }, userContext ); @@ -375,9 +400,12 @@ export default function getRecipeInterface( updateUserEmail: async function ({ email, recipeUserId, tenantId, userContext }) { return await querier.sendPutRequest( - new NormalisedURLPath( - `/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/webauthn/user/email` - ), + { + path: "//recipe/webauthn/user/email", + params: { + tenantId: tenantId, + }, + }, { email, recipeUserId }, {}, userContext From 9a6f0a56633968e3994a713a5af6bd907909e658 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Tue, 6 May 2025 12:51:56 +0530 Subject: [PATCH 05/64] Add fixes for webauthn schema issues --- .../recipe/webauthn/recipeImplementation.ts | 2 +- scripts/generate-schema.js | 39 +++++++++++++++++-- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/lib/ts/recipe/webauthn/recipeImplementation.ts b/lib/ts/recipe/webauthn/recipeImplementation.ts index 2ca7db652..74731f664 100644 --- a/lib/ts/recipe/webauthn/recipeImplementation.ts +++ b/lib/ts/recipe/webauthn/recipeImplementation.ts @@ -340,7 +340,7 @@ export default function getRecipeInterface( removeCredential: async function ({ webauthnCredentialId, recipeUserId, userContext }) { return await querier.sendDeleteRequest( "/recipe/webauthn/user/credential/remove", - {}, + undefined, { recipeUserId, webauthnCredentialId }, userContext ); diff --git a/scripts/generate-schema.js b/scripts/generate-schema.js index 9f6911c0f..b312702bf 100644 --- a/scripts/generate-schema.js +++ b/scripts/generate-schema.js @@ -13,6 +13,36 @@ const libDir = path.join(__dirname, "..", "lib", "core", "versions"); const BASE_URL = "https://raw.githubusercontent.com/supertokens/core-driver-interface/refs/heads"; async function run() { + const localFilePath = process.argv[2]; + const localVersion = process.argv[3]; + + if (localFilePath && localVersion) { + await processLocalSpec(localFilePath, localVersion); + } else { + await processRemoteSpecs(); + } +} + +async function processLocalSpec(filePath, version) { + const outputDir = path.join(libDir, version); + const outputPath = path.join(outputDir, "schema.d.ts"); + + await fs.mkdir(outputDir, { recursive: true }); + + console.log(`📄 Using local spec file: ${filePath}`); + await execPromise(`npx openapi-typescript ${filePath} -o ${outputPath}`); + + let schemaContent = await fs.readFile(outputPath, "utf-8"); + schemaContent = schemaContent + .replace(/\/appid-[^/]+/g, "") + .replace(/Record/g, "Record") + .replace(/\bstatus\?\s*:/g, "status:"); + await fs.writeFile(outputPath, schemaContent, "utf-8"); + + console.log(`✅ Generated and cleaned schema for local version ${version}`); +} + +async function processRemoteSpecs() { const file = await fs.readFile(coreJsonPath, "utf-8"); const json = JSON.parse(file); const versions = json.versions; @@ -47,11 +77,14 @@ async function run() { console.log(`🔧 Generating schema for version ${version}...`); await execPromise(`npx openapi-typescript ${inputPath} -o ${outputPath}`); - // Post-process: remove `/appid-/` - console.log(`🧹 Cleaning appid from ${outputPath}`); + console.log(`🧹 Post-processing ${outputPath}...`); let schemaContent = await fs.readFile(outputPath, "utf-8"); - schemaContent = schemaContent.replace(/\/appid-[^/]+/g, ""); + schemaContent = schemaContent + .replace(/\/appid-[^/]+/g, "") + .replace(/Record/g, "Record") + .replace(/\bstatus\?\s*:/g, "status:"); await fs.writeFile(outputPath, schemaContent, "utf-8"); + console.log(`✅ Cleaned ${outputPath}`); } } finally { From 8bb464b42e3721de00c285a5005a42deef7e6a98 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Tue, 6 May 2025 12:53:06 +0530 Subject: [PATCH 06/64] Update the local API spec based on the updated version --- lib/core/versions/5.3/schema.d.ts | 2405 +++++++++++++---------------- 1 file changed, 1075 insertions(+), 1330 deletions(-) diff --git a/lib/core/versions/5.3/schema.d.ts b/lib/core/versions/5.3/schema.d.ts index 3a45b6642..3e526f0b9 100644 --- a/lib/core/versions/5.3/schema.d.ts +++ b/lib/core/versions/5.3/schema.d.ts @@ -1130,7 +1130,7 @@ export interface paths { content: { "application/json": { /** @enum {string} */ - status?: "OK"; + status: "OK"; keys?: components["schemas"]["jwk"][]; }; }; @@ -2705,7 +2705,7 @@ export interface paths { patch?: never; trace?: never; }; - "//recipe/webauthn/user/credential": { + "/recipe/webauthn/user/credential": { parameters: { query?: never; header?: never; @@ -2722,7 +2722,7 @@ export interface paths { patch?: never; trace?: never; }; - "//recipe/webauthn/user/credential/list": { + "/recipe/webauthn/user/credential/list": { parameters: { query?: never; header?: never; @@ -2807,7 +2807,7 @@ export interface paths { patch?: never; trace?: never; }; - "//recipe/webauthn/user/credential/register": { + "/recipe/webauthn/user/credential/register": { parameters: { query?: never; header?: never; @@ -2909,7 +2909,7 @@ export interface paths { patch?: never; trace?: never; }; - "//recipe/webauthn/user/credential/remove": { + "/recipe/webauthn/user/credential/remove": { parameters: { query?: never; header?: never; @@ -2944,7 +2944,7 @@ export interface paths { trace?: never; }; } -export type webhooks = Record; +export type webhooks = Record; export interface components { schemas: { authRecipeUser: { @@ -3044,6 +3044,8 @@ export interface components { codeLifetime: number; /** @enum {string} */ statusOK: "OK"; + /** @enum {string} */ + userVerification: "preferred" | "required" | "discouraged"; oauthClient: { /** @example stcl_c6dd9189-33b8-4ec0-8aea-a0ffdaf75fcb */ clientId?: string; @@ -3134,7 +3136,7 @@ export interface components { * ] * } */ - userMetadata: Record; + userMetadata: Record; /** * @description should be a JSON object (not a JSON literal nor an array) * @example { @@ -3144,21 +3146,21 @@ export interface components { * "todos": null * } */ - userMetadataUpdate: Record; + userMetadataUpdate: Record; /** * @description should be a JSON object (not a JSON literal nor an array) * @example { * "test": 123 * } */ - userDataInJWT: Record; + userDataInJWT: Record; /** * @description should be a JSON object (not a JSON literal nor an array) * @example { * "test": 123 * } */ - userDataInDatabase: Record; + userDataInDatabase: Record; /** @example false */ enableAntiCsrf: boolean; /** @example 68en6gd6-865b-4af6-ba00-96e5c153257d */ @@ -3188,7 +3190,7 @@ export interface components { * "custom-claim": "" * } */ - createJWTPayload: Record; + createJWTPayload: Record; /** * @description The algorithm to use when creating the JWT. * @enum {string} @@ -3217,26 +3219,26 @@ export interface components { x5c?: string[]; }; unauthorisedMessageResponse: { - status?: components["schemas"]["unauthorisedResponse"]; + status: components["schemas"]["unauthorisedResponse"]; message?: components["schemas"]["message"]; }; /** @enum {string} */ helloResponse: "Hello"; statusOKResponse: { /** @enum {string} */ - status?: "OK"; + status: "OK"; }; wrongCredentialsResponse: { /** @enum {string} */ - status?: "WRONG_CREDENTIALS_ERROR"; + status: "WRONG_CREDENTIALS_ERROR"; }; unknownUserIdResponse: { /** @enum {string} */ - status?: "UNKNOWN_USER_ID_ERROR"; + status: "UNKNOWN_USER_ID_ERROR"; }; unknownRoleResponse: { /** @enum {string} */ - status?: "UNKNOWN_ROLE_ERROR"; + status: "UNKNOWN_ROLE_ERROR"; }; /** @enum {string} */ tokenTheftResponse: "TOKEN_THEFT_DETECTED"; @@ -3266,15 +3268,15 @@ export interface components { clientSecret?: string; scope?: string[]; forcePKCE?: boolean; - additionalConfig?: Record; + additionalConfig?: Record; }[]; authorizationEndpoint?: string; - authorizationEndpointQueryParams?: Record; + authorizationEndpointQueryParams?: Record; tokenEndpoint?: string; - tokenEndpointBodyParams?: Record; + tokenEndpointBodyParams?: Record; userInfoEndpoint?: string; - userInfoEndpointQueryParams?: Record; - userInfoEndpointHeaders?: Record; + userInfoEndpointQueryParams?: Record; + userInfoEndpointHeaders?: Record; jwksURI?: string; oidcDiscoveryEndpoint?: string; /** @default true */ @@ -3300,12 +3302,12 @@ export interface components { passwordlessEnabled?: boolean; firstFactors?: components["schemas"]["firstFactors"]; requiredSecondaryFactors?: components["schemas"]["requiredSecondaryFactors"]; - coreConfig?: Record; + coreConfig?: Record; }; tenantInputV2: { firstFactors?: components["schemas"]["firstFactors"]; requiredSecondaryFactors?: components["schemas"]["requiredSecondaryFactors"]; - coreConfig?: Record; + coreConfig?: Record; }; tenantConfig: { tenantId: components["schemas"]["tenantId"]; @@ -3321,7 +3323,7 @@ export interface components { }; firstFactors?: components["schemas"]["firstFactors"]; requiredSecondaryFactors?: components["schemas"]["requiredSecondaryFactors"]; - coreConfig: Record; + coreConfig: Record; }; /** @example $argon2d$v=19$m=12,t=3,p=1$aGI4enNvMmd0Zm0wMDAwMA$r6p7qbr6HD+8CD7sBi4HVw */ passwordHash: string; @@ -3383,18 +3385,13 @@ export interface components { bulkImportUserPasswordlessLoginMethod: (components["schemas"]["bulkImportUserLoginMethodFields"] & { /** @example passwordless */ recipeId?: string; - }) & - (components["schemas"]["email"] | components["schemas"]["phoneNumber"]); + }) & (components["schemas"]["email"] | components["schemas"]["phoneNumber"]); bulkImportUser: { externalUserId?: components["schemas"]["userId"]; userMetadata?: components["schemas"]["userMetadata"][]; userRoles?: components["schemas"]["bulkImportUserRole"][]; totpDevices?: components["schemas"]["bulkImportTotpDevice"][]; - loginMethods?: ( - | components["schemas"]["bulkImportUserEmailPasswordLoginMethod"] - | components["schemas"]["bulkImportUserThirdPartyLoginMethod"] - | components["schemas"]["bulkImportUserPasswordlessLoginMethod"] - )[]; + loginMethods?: (components["schemas"]["bulkImportUserEmailPasswordLoginMethod"] | components["schemas"]["bulkImportUserThirdPartyLoginMethod"] | components["schemas"]["bulkImportUserPasswordlessLoginMethod"])[]; }; addBulkImportUserResponse: { userId?: components["schemas"]["userId"]; @@ -3402,10 +3399,10 @@ export interface components { }; bulkImportUserResponse: { id?: components["schemas"]["bulkImportUserId"]; - status?: components["schemas"]["bulkImportUserStatus"]; + status: components["schemas"]["bulkImportUserStatus"]; createdAt?: components["schemas"]["timeJoined"]; updatedAt?: components["schemas"]["timeJoined"]; - } & (components["schemas"]["bulkImportUser"] & Record); + } & (components["schemas"]["bulkImportUser"] & Record); tenantConfigV2: { tenantId: components["schemas"]["tenantId"]; thirdParty: { @@ -3413,7 +3410,7 @@ export interface components { }; firstFactors?: components["schemas"]["firstFactors"]; requiredSecondaryFactors?: components["schemas"]["requiredSecondaryFactors"]; - coreConfig: Record; + coreConfig: Record; }; oauthError: { /** @enum {string} */ @@ -3544,7 +3541,7 @@ export interface components { headers: never; pathItems: never; } -export type $defs = Record; +export type $defs = Record; export interface operations { canCreatePrimaryUser: { parameters: { @@ -3573,26 +3570,23 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example true */ - wasAlreadyAPrimaryUser?: boolean; - } - | { - /** @enum {string} */ - status?: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId?: string; - description?: string; - } - | { - /** @enum {string} */ - status?: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId?: string; - description?: string; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example true */ + wasAlreadyAPrimaryUser?: boolean; + } | { + /** @enum {string} */ + status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + } | { + /** @enum {string} */ + status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + }; }; }; 400: components["responses"]["400"]; @@ -3629,30 +3623,26 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example true */ - accountsAlreadyLinked?: boolean; - } - | { - /** @enum {string} */ - status?: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId?: string; - description?: string; - } - | { - /** @enum {string} */ - status?: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId?: string; - description?: string; - } - | { - /** @enum {string} */ - status?: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example true */ + accountsAlreadyLinked?: boolean; + } | { + /** @enum {string} */ + status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + } | { + /** @enum {string} */ + status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + } | { + /** @enum {string} */ + status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; + }; }; }; 400: components["responses"]["400"]; @@ -3693,27 +3683,24 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example true */ - wasAlreadyAPrimaryUser?: boolean; - user?: components["schemas"]["authRecipeUser"]; - } - | { - /** @enum {string} */ - status?: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId?: string; - description?: string; - } - | { - /** @enum {string} */ - status?: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId?: string; - description?: string; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example true */ + wasAlreadyAPrimaryUser?: boolean; + user?: components["schemas"]["authRecipeUser"]; + } | { + /** @enum {string} */ + status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + } | { + /** @enum {string} */ + status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + }; }; }; 400: components["responses"]["400"]; @@ -3757,32 +3744,28 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example true */ - accountsAlreadyLinked?: boolean; - user?: components["schemas"]["authRecipeUser"]; - } - | { - /** @enum {string} */ - status?: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId?: string; - description?: string; - } - | { - /** @enum {string} */ - status?: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId?: string; - user?: components["schemas"]["authRecipeUser"]; - description?: string; - } - | { - /** @enum {string} */ - status?: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example true */ + accountsAlreadyLinked?: boolean; + user?: components["schemas"]["authRecipeUser"]; + } | { + /** @enum {string} */ + status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + } | { + /** @enum {string} */ + status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + user?: components["schemas"]["authRecipeUser"]; + description?: string; + } | { + /** @enum {string} */ + status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; + }; }; }; 400: components["responses"]["400"]; @@ -3825,7 +3808,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; /** @example true */ wasRecipeUserDeleted?: boolean; /** @example true */ @@ -3874,18 +3857,15 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - } - | { - /** @enum {string} */ - status?: "UNKNOWN_DEVICE_ERROR"; - } - | { - /** @enum {string} */ - status?: "DEVICE_ALREADY_EXISTS_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + } | { + /** @enum {string} */ + status: "UNKNOWN_DEVICE_ERROR"; + } | { + /** @enum {string} */ + status: "DEVICE_ALREADY_EXISTS_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -3931,18 +3911,16 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example JBSWY3DPEHPK3PXP */ - secret?: string; - /** @example d1 */ - deviceName?: string; - } - | { - /** @enum {string} */ - status?: "DEVICE_ALREADY_EXISTS_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example JBSWY3DPEHPK3PXP */ + secret?: string; + /** @example d1 */ + deviceName?: string; + } | { + /** @enum {string} */ + status: "DEVICE_ALREADY_EXISTS_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -4034,16 +4012,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example d1 */ - deviceName?: string; - } - | { - /** @enum {string} */ - status?: "DEVICE_ALREADY_EXISTS_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example d1 */ + deviceName?: string; + } | { + /** @enum {string} */ + status: "DEVICE_ALREADY_EXISTS_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -4086,7 +4062,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; /** @example true */ didDeviceExist?: boolean; }; @@ -4133,32 +4109,28 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - } - | { - /** @enum {string} */ - status?: "INVALID_TOTP_ERROR"; - /** @example 2 */ - currentNumberOfFailedAttempts?: number; - /** @example 5 */ - maxNumberOfFailedAttempts?: number; - } - | { - /** @enum {string} */ - status?: "UNKNOWN_USER_ID_ERROR"; - } - | { - /** @enum {string} */ - status?: "LIMIT_REACHED_ERROR"; - /** @example 90000 */ - retryAfterMs?: number; - /** @example 2 */ - currentNumberOfFailedAttempts?: number; - /** @example 5 */ - maxNumberOfFailedAttempts?: number; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + } | { + /** @enum {string} */ + status: "INVALID_TOTP_ERROR"; + /** @example 2 */ + currentNumberOfFailedAttempts?: number; + /** @example 5 */ + maxNumberOfFailedAttempts?: number; + } | { + /** @enum {string} */ + status: "UNKNOWN_USER_ID_ERROR"; + } | { + /** @enum {string} */ + status: "LIMIT_REACHED_ERROR"; + /** @example 90000 */ + retryAfterMs?: number; + /** @example 2 */ + currentNumberOfFailedAttempts?: number; + /** @example 5 */ + maxNumberOfFailedAttempts?: number; + }; }; }; 400: components["responses"]["400"]; @@ -4202,34 +4174,30 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example false */ - wasAlreadyVerified?: boolean; - } - | { - /** @enum {string} */ - status?: "UNKNOWN_DEVICE_ERROR"; - } - | { - /** @enum {string} */ - status?: "INVALID_TOTP_ERROR"; - /** @example 2 */ - currentNumberOfFailedAttempts?: number; - /** @example 5 */ - maxNumberOfFailedAttempts?: number; - } - | { - /** @enum {string} */ - status?: "LIMIT_REACHED_ERROR"; - /** @example 90000 */ - retryAfterMs?: number; - /** @example 2 */ - currentNumberOfFailedAttempts?: number; - /** @example 5 */ - maxNumberOfFailedAttempts?: number; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example false */ + wasAlreadyVerified?: boolean; + } | { + /** @enum {string} */ + status: "UNKNOWN_DEVICE_ERROR"; + } | { + /** @enum {string} */ + status: "INVALID_TOTP_ERROR"; + /** @example 2 */ + currentNumberOfFailedAttempts?: number; + /** @example 5 */ + maxNumberOfFailedAttempts?: number; + } | { + /** @enum {string} */ + status: "LIMIT_REACHED_ERROR"; + /** @example 90000 */ + retryAfterMs?: number; + /** @example 2 */ + currentNumberOfFailedAttempts?: number; + /** @example 5 */ + maxNumberOfFailedAttempts?: number; + }; }; }; 400: components["responses"]["400"]; @@ -4266,19 +4234,17 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status: components["schemas"]["statusOK"]; - superTokensUserId: components["schemas"]["userId"]; - /** @example externalId */ - externalUserId: string; - /** @example Info about external userId */ - externalUserIdInfo?: string; - } - | { - /** @enum {string} */ - status?: "UNKNOWN_MAPPING_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + superTokensUserId: components["schemas"]["userId"]; + /** @example externalId */ + externalUserId: string; + /** @example Info about external userId */ + externalUserIdInfo?: string; + } | { + /** @enum {string} */ + status: "UNKNOWN_MAPPING_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -4323,20 +4289,17 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - } - | { - /** @enum {string} */ - status?: "UNKNOWN_SUPERTOKENS_USER_ID_ERROR"; - } - | { - /** @enum {string} */ - status?: "USER_ID_MAPPING_ALREADY_EXISTS_ERROR"; - doesSuperTokensUserIdExist?: boolean; - doesExternalUserIdExist?: boolean; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + } | { + /** @enum {string} */ + status: "UNKNOWN_SUPERTOKENS_USER_ID_ERROR"; + } | { + /** @enum {string} */ + status: "USER_ID_MAPPING_ALREADY_EXISTS_ERROR"; + doesSuperTokensUserIdExist?: boolean; + doesExternalUserIdExist?: boolean; + }; }; }; 400: components["responses"]["400"]; @@ -4380,7 +4343,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; didMappingExist?: boolean; }; }; @@ -4426,14 +4389,12 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - } - | { - /** @enum {string} */ - status?: "UNKNOWN_MAPPING_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + } | { + /** @enum {string} */ + status: "UNKNOWN_MAPPING_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -4461,16 +4422,14 @@ export interface operations { }; requestBody?: { content: { - "application/json": - | { - preAuthSessionId: components["schemas"]["preAuthSessionId"]; - linkCode: components["schemas"]["linkCode"]; - } - | { - preAuthSessionId: components["schemas"]["preAuthSessionId"]; - deviceId: components["schemas"]["deviceId"]; - userInputCode: components["schemas"]["userInputCode"]; - }; + "application/json": { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + linkCode: components["schemas"]["linkCode"]; + } | { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + deviceId: components["schemas"]["deviceId"]; + userInputCode: components["schemas"]["userInputCode"]; + }; }; }; responses: { @@ -4480,29 +4439,26 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - consumedDevice?: { - preAuthSessionId: components["schemas"]["preAuthSessionId"]; - /** @example 2 */ - failedCodeInputAttemptCount: number; - email?: components["schemas"]["email"]; - phoneNumber?: components["schemas"]["phoneNumber"]; - }; - } - | { - /** @enum {string} */ - status?: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR"; - /** @example 2 */ - failedCodeInputAttemptCount?: number; - /** @example 5 */ - maximumCodeInputAttempts?: number; - } - | { - /** @enum {string} */ - status?: "RESTART_FLOW_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + consumedDevice?: { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + /** @example 2 */ + failedCodeInputAttemptCount: number; + email?: components["schemas"]["email"]; + phoneNumber?: components["schemas"]["phoneNumber"]; + }; + } | { + /** @enum {string} */ + status: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR"; + /** @example 2 */ + failedCodeInputAttemptCount?: number; + /** @example 5 */ + maximumCodeInputAttempts?: number; + } | { + /** @enum {string} */ + status: "RESTART_FLOW_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -4530,16 +4486,14 @@ export interface operations { }; requestBody?: { content: { - "application/json": - | { - preAuthSessionId: components["schemas"]["preAuthSessionId"]; - linkCode: components["schemas"]["linkCode"]; - } - | { - preAuthSessionId: components["schemas"]["preAuthSessionId"]; - deviceId: components["schemas"]["deviceId"]; - userInputCode: components["schemas"]["userInputCode"]; - }; + "application/json": { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + linkCode: components["schemas"]["linkCode"]; + } | { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + deviceId: components["schemas"]["deviceId"]; + userInputCode: components["schemas"]["userInputCode"]; + }; }; }; responses: { @@ -4549,33 +4503,30 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example true */ - createdNewUser?: boolean; - user?: components["schemas"]["authRecipeUser"]; - recipeUserId?: components["schemas"]["userId"]; - consumedDevice?: { - preAuthSessionId: components["schemas"]["preAuthSessionId"]; - /** @example 2 */ - failedCodeInputAttemptCount: number; - email?: components["schemas"]["email"]; - phoneNumber?: components["schemas"]["phoneNumber"]; - }; - } - | { - /** @enum {string} */ - status?: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR"; - /** @example 2 */ - failedCodeInputAttemptCount?: number; - /** @example 5 */ - maximumCodeInputAttempts?: number; - } - | { - /** @enum {string} */ - status?: "RESTART_FLOW_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example true */ + createdNewUser?: boolean; + user?: components["schemas"]["authRecipeUser"]; + recipeUserId?: components["schemas"]["userId"]; + consumedDevice?: { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + /** @example 2 */ + failedCodeInputAttemptCount: number; + email?: components["schemas"]["email"]; + phoneNumber?: components["schemas"]["phoneNumber"]; + }; + } | { + /** @enum {string} */ + status: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR"; + /** @example 2 */ + failedCodeInputAttemptCount?: number; + /** @example 5 */ + maximumCodeInputAttempts?: number; + } | { + /** @enum {string} */ + status: "RESTART_FLOW_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -4603,19 +4554,16 @@ export interface operations { }; requestBody?: { content: { - "application/json": - | { - email: components["schemas"]["email"]; - userInputCode?: components["schemas"]["userInputCode"]; - } - | { - phoneNumber: components["schemas"]["phoneNumber"]; - userInputCode?: components["schemas"]["userInputCode"]; - } - | { - deviceId: components["schemas"]["deviceId"]; - userInputCode?: components["schemas"]["userInputCode"]; - }; + "application/json": { + email: components["schemas"]["email"]; + userInputCode?: components["schemas"]["userInputCode"]; + } | { + phoneNumber: components["schemas"]["phoneNumber"]; + userInputCode?: components["schemas"]["userInputCode"]; + } | { + deviceId: components["schemas"]["deviceId"]; + userInputCode?: components["schemas"]["userInputCode"]; + }; }; }; responses: { @@ -4625,21 +4573,19 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - preAuthSessionId?: components["schemas"]["preAuthSessionId"]; - codeId?: components["schemas"]["codeId"]; - deviceId?: components["schemas"]["deviceId"]; - userInputCode?: components["schemas"]["userInputCode"]; - linkCode?: components["schemas"]["linkCode"]; - timeCreated?: components["schemas"]["timeCreated"]; - codeLifetime?: components["schemas"]["codeLifetime"]; - } - | { - /** @enum {string} */ - status?: "RESTART_FLOW_ERROR" | "USER_INPUT_CODE_ALREADY_USED_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + preAuthSessionId?: components["schemas"]["preAuthSessionId"]; + codeId?: components["schemas"]["codeId"]; + deviceId?: components["schemas"]["deviceId"]; + userInputCode?: components["schemas"]["userInputCode"]; + linkCode?: components["schemas"]["linkCode"]; + timeCreated?: components["schemas"]["timeCreated"]; + codeLifetime?: components["schemas"]["codeLifetime"]; + } | { + /** @enum {string} */ + status: "RESTART_FLOW_ERROR" | "USER_INPUT_CODE_ALREADY_USED_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -4667,13 +4613,11 @@ export interface operations { }; requestBody?: { content: { - "application/json": - | { - codeId: components["schemas"]["codeId"]; - } - | { - preAuthSessionId: components["schemas"]["preAuthSessionId"]; - }; + "application/json": { + codeId: components["schemas"]["codeId"]; + } | { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + }; }; }; responses: { @@ -4684,7 +4628,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; }; }; }; @@ -4729,7 +4673,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; devices?: { preAuthSessionId?: components["schemas"]["preAuthSessionId"]; /** @example 2 */ @@ -4770,13 +4714,11 @@ export interface operations { }; requestBody?: { content: { - "application/json": - | { - email: components["schemas"]["email"]; - } - | { - phoneNumber: components["schemas"]["phoneNumber"]; - }; + "application/json": { + email: components["schemas"]["email"]; + } | { + phoneNumber: components["schemas"]["phoneNumber"]; + }; }; }; responses: { @@ -4787,7 +4729,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; }; }; }; @@ -4828,15 +4770,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - user?: components["schemas"]["authRecipeUser"]; - } - | { - /** @enum {string} */ - status?: "UNKNOWN_USER_ID_ERROR" | "UNKNOWN_EMAIL_ERROR" | "UNKNOWN_PHONE_NUMBER_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + } | { + /** @enum {string} */ + status: "UNKNOWN_USER_ID_ERROR" | "UNKNOWN_EMAIL_ERROR" | "UNKNOWN_PHONE_NUMBER_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -4878,20 +4818,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - /** @enum {string} */ - status?: - | "OK" - | "UNKNOWN_USER_ID_ERROR" - | "EMAIL_ALREADY_EXISTS_ERROR" - | "PHONE_NUMBER_ALREADY_EXISTS_ERROR"; - } - | { - /** @enum {string} */ - status?: "EMAIL_CHANGE_NOT_ALLOWED_ERROR" | "PHONE_NUMBER_CHANGE_NOT_ALLOWED_ERROR"; - reason?: string; - }; + "application/json": { + /** @enum {string} */ + status: "OK" | "UNKNOWN_USER_ID_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR" | "PHONE_NUMBER_ALREADY_EXISTS_ERROR"; + } | { + /** @enum {string} */ + status: "EMAIL_CHANGE_NOT_ALLOWED_ERROR" | "PHONE_NUMBER_CHANGE_NOT_ALLOWED_ERROR"; + reason?: string; + }; }; }; 400: components["responses"]["400"]; @@ -4932,13 +4866,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - user?: components["schemas"]["authRecipeUser"]; - recipeUserId?: components["schemas"]["userId"]; - } - | components["schemas"]["wrongCredentialsResponse"]; + "application/json": { + status: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + recipeUserId?: components["schemas"]["userId"]; + } | components["schemas"]["wrongCredentialsResponse"]; }; }; 400: components["responses"]["400"]; @@ -4979,16 +4911,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - user?: components["schemas"]["authRecipeUser"]; - recipeUserId?: components["schemas"]["userId"]; - } - | { - /** @enum {string} */ - status?: "EMAIL_ALREADY_EXISTS_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + recipeUserId?: components["schemas"]["userId"]; + } | { + /** @enum {string} */ + status: "EMAIL_ALREADY_EXISTS_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -5027,15 +4957,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - user?: components["schemas"]["authRecipeUser"]; - } - | { - /** @enum {string} */ - status?: "UNKNOWN_USER_ID_ERROR" | "UNKNOWN_EMAIL_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + } | { + /** @enum {string} */ + status: "UNKNOWN_USER_ID_ERROR" | "UNKNOWN_EMAIL_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -5077,16 +5005,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - /** @enum {string} */ - status?: "OK" | "UNKNOWN_USER_ID_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR"; - } - | { - /** @enum {string} */ - status?: "EMAIL_CHANGE_NOT_ALLOWED_ERROR"; - reason?: string; - }; + "application/json": { + /** @enum {string} */ + status: "OK" | "UNKNOWN_USER_ID_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR"; + } | { + /** @enum {string} */ + status: "EMAIL_CHANGE_NOT_ALLOWED_ERROR"; + reason?: string; + }; }; }; 400: components["responses"]["400"]; @@ -5127,12 +5053,10 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - token?: components["schemas"]["token"]; - } - | components["schemas"]["unknownUserIdResponse"]; + "application/json": { + status: components["schemas"]["statusOK"]; + token?: components["schemas"]["token"]; + } | components["schemas"]["unknownUserIdResponse"]; }; }; 400: components["responses"]["400"]; @@ -5176,15 +5100,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - userId?: components["schemas"]["userId"]; - } - | { - /** @enum {string} */ - status?: "RESET_PASSWORD_INVALID_TOKEN_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + userId?: components["schemas"]["userId"]; + } | { + /** @enum {string} */ + status: "RESET_PASSWORD_INVALID_TOKEN_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -5227,7 +5149,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; user?: components["schemas"]["authRecipeUser"]; didUserAlreadyExist?: boolean; }; @@ -5270,16 +5192,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - userId?: components["schemas"]["userId"]; - email?: components["schemas"]["email"]; - } - | { - /** @enum {string} */ - status?: "RESET_PASSWORD_INVALID_TOKEN_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + userId?: components["schemas"]["userId"]; + email?: components["schemas"]["email"]; + } | { + /** @enum {string} */ + status: "RESET_PASSWORD_INVALID_TOKEN_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -5321,19 +5241,17 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example true */ - createdNewUser?: boolean; - user?: components["schemas"]["authRecipeUser"]; - recipeUserId?: components["schemas"]["userId"]; - } - | { - /** @enum {string} */ - status?: "EMAIL_CHANGE_NOT_ALLOWED_ERROR"; - reason?: string; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example true */ + createdNewUser?: boolean; + user?: components["schemas"]["authRecipeUser"]; + recipeUserId?: components["schemas"]["userId"]; + } | { + /** @enum {string} */ + status: "EMAIL_CHANGE_NOT_ALLOWED_ERROR"; + reason?: string; + }; }; }; 400: components["responses"]["400"]; @@ -5373,15 +5291,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - user?: components["schemas"]["authRecipeUser"]; - } - | { - /** @enum {string} */ - status?: "UNKNOWN_USER_ID_ERROR" | "UNKNOWN_THIRD_PARTY_USER_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + } | { + /** @enum {string} */ + status: "UNKNOWN_USER_ID_ERROR" | "UNKNOWN_THIRD_PARTY_USER_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -5419,7 +5335,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; users?: components["schemas"]["authRecipeUser"][]; }; }; @@ -5458,15 +5374,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - token?: components["schemas"]["token"]; - } - | { - /** @enum {string} */ - status?: "EMAIL_ALREADY_VERIFIED_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + token?: components["schemas"]["token"]; + } | { + /** @enum {string} */ + status: "EMAIL_ALREADY_VERIFIED_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -5506,7 +5420,7 @@ export interface operations { content: { "application/json": { /** @enum {string} */ - status?: "OK"; + status: "OK"; }; }; }; @@ -5549,16 +5463,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - userId?: components["schemas"]["userId"]; - email?: components["schemas"]["email"]; - } - | { - /** @enum {string} */ - status?: "EMAIL_VERIFICATION_INVALID_TOKEN_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + userId?: components["schemas"]["userId"]; + email?: components["schemas"]["email"]; + } | { + /** @enum {string} */ + status: "EMAIL_VERIFICATION_INVALID_TOKEN_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -5596,7 +5508,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; isVerified?: components["schemas"]["isVerified"]; }; }; @@ -5638,7 +5550,7 @@ export interface operations { content: { "application/json": { /** @enum {string} */ - status?: "OK"; + status: "OK"; }; }; }; @@ -5676,7 +5588,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; metadata?: components["schemas"]["userMetadata"]; }; }; @@ -5720,7 +5632,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; metadata?: components["schemas"]["userMetadata"]; }; }; @@ -5763,7 +5675,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; }; }; }; @@ -5805,13 +5717,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example true */ - didUserAlreadyHaveRole?: boolean; - } - | components["schemas"]["unknownRoleResponse"]; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example true */ + didUserAlreadyHaveRole?: boolean; + } | components["schemas"]["unknownRoleResponse"]; }; }; 400: components["responses"]["400"]; @@ -5852,13 +5762,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example true */ - didUserHaveRole?: boolean; - } - | components["schemas"]["unknownRoleResponse"]; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example true */ + didUserHaveRole?: boolean; + } | components["schemas"]["unknownRoleResponse"]; }; }; 400: components["responses"]["400"]; @@ -5895,7 +5803,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; roles?: components["schemas"]["role"][]; }; }; @@ -5933,12 +5841,10 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - users?: components["schemas"]["userId"][]; - } - | components["schemas"]["unknownRoleResponse"]; + "application/json": { + status: components["schemas"]["statusOK"]; + users?: components["schemas"]["userId"][]; + } | components["schemas"]["unknownRoleResponse"]; }; }; 400: components["responses"]["400"]; @@ -5980,7 +5886,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; /** @example true */ createdNewRole?: boolean; }; @@ -6019,12 +5925,10 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - permissions?: string[]; - } - | components["schemas"]["unknownRoleResponse"]; + "application/json": { + status: components["schemas"]["statusOK"]; + permissions?: string[]; + } | components["schemas"]["unknownRoleResponse"]; }; }; 400: components["responses"]["400"]; @@ -6065,11 +5969,9 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - } - | components["schemas"]["unknownRoleResponse"]; + "application/json": { + status: components["schemas"]["statusOK"]; + } | components["schemas"]["unknownRoleResponse"]; }; }; 400: components["responses"]["400"]; @@ -6106,7 +6008,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; roles?: string[]; }; }; @@ -6149,7 +6051,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; /** @example true */ didRoleExist?: boolean; }; @@ -6187,7 +6089,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; roles?: string[]; }; }; @@ -6238,7 +6140,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; session?: components["schemas"]["session"]; accessToken?: components["schemas"]["cookieInfo"]; refreshToken?: components["schemas"]["cookieInfo"]; @@ -6279,18 +6181,16 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - userDataInDatabase?: components["schemas"]["userDataInDatabase"]; - userDataInJWT?: components["schemas"]["userDataInJWT"]; - userId?: components["schemas"]["userId"]; - expiry?: components["schemas"]["expiry"]; - timeCreated?: components["schemas"]["timeCreated"]; - sessionHandle?: components["schemas"]["handle"]; - tenantId?: components["schemas"]["tenantId"]; - } - | components["schemas"]["unauthorisedMessageResponse"]; + "application/json": { + status: components["schemas"]["statusOK"]; + userDataInDatabase?: components["schemas"]["userDataInDatabase"]; + userDataInJWT?: components["schemas"]["userDataInJWT"]; + userId?: components["schemas"]["userId"]; + expiry?: components["schemas"]["expiry"]; + timeCreated?: components["schemas"]["timeCreated"]; + sessionHandle?: components["schemas"]["handle"]; + tenantId?: components["schemas"]["tenantId"]; + } | components["schemas"]["unauthorisedMessageResponse"]; }; }; 400: components["responses"]["400"]; @@ -6318,14 +6218,12 @@ export interface operations { }; requestBody?: { content: { - "application/json": - | { - sessionHandles?: components["schemas"]["sessionHandles"]; - } - | { - userId: components["schemas"]["userId"]; - revokeAcrossAllTenants?: boolean; - }; + "application/json": { + sessionHandles?: components["schemas"]["sessionHandles"]; + } | { + userId: components["schemas"]["userId"]; + revokeAcrossAllTenants?: boolean; + }; }; }; responses: { @@ -6336,7 +6234,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; sessionHandlesRevoked?: components["schemas"]["sessionHandles"]; }; }; @@ -6387,17 +6285,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - session?: components["schemas"]["session"]; - accessToken?: components["schemas"]["cookieInfo"]; - } - | components["schemas"]["unauthorisedMessageResponse"] - | { - status?: components["schemas"]["tryRefreshTokenResponse"]; - message?: components["schemas"]["message"]; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + session?: components["schemas"]["session"]; + accessToken?: components["schemas"]["cookieInfo"]; + } | components["schemas"]["unauthorisedMessageResponse"] | { + status: components["schemas"]["tryRefreshTokenResponse"]; + message?: components["schemas"]["message"]; + }; }; }; 400: components["responses"]["400"]; @@ -6440,22 +6335,19 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - session?: components["schemas"]["session"]; - accessToken?: components["schemas"]["cookieInfo"]; - refreshToken?: components["schemas"]["cookieInfo"]; - antiCsrfToken?: components["schemas"]["token"]; - } - | { - status?: components["schemas"]["tokenTheftResponse"]; - session?: { - handle?: components["schemas"]["handle"]; - userId?: components["schemas"]["userId"]; - }; - } - | components["schemas"]["unauthorisedMessageResponse"]; + "application/json": { + status: components["schemas"]["statusOK"]; + session?: components["schemas"]["session"]; + accessToken?: components["schemas"]["cookieInfo"]; + refreshToken?: components["schemas"]["cookieInfo"]; + antiCsrfToken?: components["schemas"]["token"]; + } | { + status: components["schemas"]["tokenTheftResponse"]; + session?: { + handle?: components["schemas"]["handle"]; + userId?: components["schemas"]["userId"]; + }; + } | components["schemas"]["unauthorisedMessageResponse"]; }; }; 400: components["responses"]["400"]; @@ -6493,7 +6385,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; sessionHandles?: components["schemas"]["sessionHandles"]; }; }; @@ -6536,13 +6428,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - session?: components["schemas"]["session"]; - accessToken?: components["schemas"]["cookieInfo"]; - } - | components["schemas"]["unauthorisedMessageResponse"]; + "application/json": { + status: components["schemas"]["statusOK"]; + session?: components["schemas"]["session"]; + accessToken?: components["schemas"]["cookieInfo"]; + } | components["schemas"]["unauthorisedMessageResponse"]; }; }; 400: components["responses"]["400"]; @@ -6579,12 +6469,10 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - userDataInDatabase?: components["schemas"]["userDataInDatabase"]; - } - | components["schemas"]["unauthorisedMessageResponse"]; + "application/json": { + status: components["schemas"]["statusOK"]; + userDataInDatabase?: components["schemas"]["userDataInDatabase"]; + } | components["schemas"]["unauthorisedMessageResponse"]; }; }; 400: components["responses"]["400"]; @@ -6625,9 +6513,7 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | components["schemas"]["statusOKResponse"] - | components["schemas"]["unauthorisedMessageResponse"]; + "application/json": components["schemas"]["statusOKResponse"] | components["schemas"]["unauthorisedMessageResponse"]; }; }; 400: components["responses"]["400"]; @@ -6675,16 +6561,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c */ - jwt?: string; - } - | { - /** @enum {string} */ - status?: "UNSUPPORTED_ALGORITHM_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c */ + jwt?: string; + } | { + /** @enum {string} */ + status: "UNSUPPORTED_ALGORITHM_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -6720,12 +6604,10 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - userDataInJWT?: components["schemas"]["userDataInJWT"]; - } - | components["schemas"]["unauthorisedMessageResponse"]; + "application/json": { + status: components["schemas"]["statusOK"]; + userDataInJWT?: components["schemas"]["userDataInJWT"]; + } | components["schemas"]["unauthorisedMessageResponse"]; }; }; 400: components["responses"]["400"]; @@ -6766,9 +6648,7 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | components["schemas"]["statusOKResponse"] - | components["schemas"]["unauthorisedMessageResponse"]; + "application/json": components["schemas"]["statusOKResponse"] | components["schemas"]["unauthorisedMessageResponse"]; }; }; 400: components["responses"]["400"]; @@ -6796,23 +6676,21 @@ export interface operations { }; requestBody?: { content: { - "application/json": - | { - /** @example test@example.com */ - email?: string; - /** @example password@123 */ - newPassword?: string; - /** @example test2@example.com */ - newEmail?: string; - } - | { - /** @example ue21r-fw32r3-d121-d1 */ - userId?: string; - /** @example password@123 */ - newPassword?: string; - /** @example test2@example.com */ - newEmail?: string; - }; + "application/json": { + /** @example test@example.com */ + email?: string; + /** @example password@123 */ + newPassword?: string; + /** @example test2@example.com */ + newEmail?: string; + } | { + /** @example ue21r-fw32r3-d121-d1 */ + userId?: string; + /** @example password@123 */ + newPassword?: string; + /** @example test2@example.com */ + newEmail?: string; + }; }; }; responses: { @@ -6822,37 +6700,32 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - /** @enum {string} */ - status?: "OK"; - user?: { - /** @example r23r-f235th54-g3413gf-r32dr2 */ - userId?: string; - /** @example test@example.com */ - email?: string; - /** @example 391238234792 */ - timeCreated?: number; - }; - } - | { - /** @enum {string} */ - status?: "EMAIL_ALREADY_EXISTS_ERROR"; - } - | { - /** @enum {string} */ - status?: "PASSWORD_WEAK_ERROR"; - /** @example Your password must have at least 8 characters */ - message?: string; - } - | { - /** @enum {string} */ - status?: "INVALID_EMAIL_ERROR"; - } - | { - /** @enum {string} */ - status?: "UNKNOWN_USER_ERROR"; - }; + "application/json": { + /** @enum {string} */ + status: "OK"; + user?: { + /** @example r23r-f235th54-g3413gf-r32dr2 */ + userId?: string; + /** @example test@example.com */ + email?: string; + /** @example 391238234792 */ + timeCreated?: number; + }; + } | { + /** @enum {string} */ + status: "EMAIL_ALREADY_EXISTS_ERROR"; + } | { + /** @enum {string} */ + status: "PASSWORD_WEAK_ERROR"; + /** @example Your password must have at least 8 characters */ + message?: string; + } | { + /** @enum {string} */ + status: "INVALID_EMAIL_ERROR"; + } | { + /** @enum {string} */ + status: "UNKNOWN_USER_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -6895,33 +6768,29 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - /** @enum {string} */ - status?: "OK"; - user?: { - /** @example example-userid */ - userId?: string; - /** @example test@example.com */ - email?: string; - /** @example 1231321231 */ - timeCreated?: number; - }; - } - | { - /** @enum {string} */ - status?: "EMAIL_ALREADY_EXISTS_ERROR"; - } - | { - /** @enum {string} */ - status?: "PASSWORD_WEAK_ERROR"; - /** @example Your password must have at least 8 characters */ - message?: string; - } - | { - /** @enum {string} */ - status?: "INVALID_EMAIL_ERROR"; - }; + "application/json": { + /** @enum {string} */ + status: "OK"; + user?: { + /** @example example-userid */ + userId?: string; + /** @example test@example.com */ + email?: string; + /** @example 1231321231 */ + timeCreated?: number; + }; + } | { + /** @enum {string} */ + status: "EMAIL_ALREADY_EXISTS_ERROR"; + } | { + /** @enum {string} */ + status: "PASSWORD_WEAK_ERROR"; + /** @example Your password must have at least 8 characters */ + message?: string; + } | { + /** @enum {string} */ + status: "INVALID_EMAIL_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -6934,7 +6803,7 @@ export interface operations { content: { "application/json": { /** @enum {string} */ - status?: "USER_LIMIT_REACHED_ERROR"; + status: "USER_LIMIT_REACHED_ERROR"; /** @example You have reached the free limit for creating users, please purchase the dashboard feature to create new users */ message?: string; }; @@ -6973,7 +6842,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; didUserExist?: boolean; }; }; @@ -7011,7 +6880,7 @@ export interface operations { content: { "application/json": { /** @enum {string} */ - status?: "OK"; + status: "OK"; users?: { /** @example test@example.com */ email?: string; @@ -7063,22 +6932,19 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - /** @enum {string} */ - status?: "OK"; - email?: string; - } - | { - /** @enum {string} */ - status?: "USER_SUSPENDED_ERROR"; - /** @example You have crossed the free dashboard user limit. Please purchase the dashboard feature or login with a valid user account */ - message?: string; - } - | { - /** @enum {string} */ - status?: "INVAlID_SESSION_ERROR"; - }; + "application/json": { + /** @enum {string} */ + status: "OK"; + email?: string; + } | { + /** @enum {string} */ + status: "USER_SUSPENDED_ERROR"; + /** @example You have crossed the free dashboard user limit. Please purchase the dashboard feature or login with a valid user account */ + message?: string; + } | { + /** @enum {string} */ + status: "INVAlID_SESSION_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -7115,7 +6981,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; }; }; }; @@ -7159,23 +7025,20 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - /** @enum {string} */ - status?: "OK"; - /** @example null */ - sessionId?: string; - } - | { - /** @enum {string} */ - status?: "USER_SUSPENDED_ERROR"; - /** @example You have crossed the free dashboard user limit. Please purchase the dashboard feature or login with a valid user account */ - message?: string; - } - | { - /** @enum {string} */ - status?: "INVAlID_CREDENTIALS_ERROR"; - }; + "application/json": { + /** @enum {string} */ + status: "OK"; + /** @example null */ + sessionId?: string; + } | { + /** @enum {string} */ + status: "USER_SUSPENDED_ERROR"; + /** @example You have crossed the free dashboard user limit. Please purchase the dashboard feature or login with a valid user account */ + message?: string; + } | { + /** @enum {string} */ + status: "INVAlID_CREDENTIALS_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -7287,16 +7150,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example /usr/lib/supertokens/config.yaml */ - path?: string; - } - | { - /** @enum {string} */ - status?: "NOT_ALLOWED"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example /usr/lib/supertokens/config.yaml */ + path?: string; + } | { + /** @enum {string} */ + status: "NOT_ALLOWED"; + }; }; }; 400: components["responses"]["400"]; @@ -7393,19 +7254,17 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - /** @enum {boolean} */ - exists?: true; - /** @example 99c87c72-1807-22d-9b39-7a88f95re56c */ - telemetryId?: string; - } - | { - /** @example [ - * false - * ] */ - exists?: boolean; - }; + "application/json": { + /** @enum {boolean} */ + exists?: true; + /** @example 99c87c72-1807-22d-9b39-7a88f95re56c */ + telemetryId?: string; + } | { + /** @example [ + * false + * ] */ + exists?: boolean; + }; }; }; 400: components["responses"]["400"]; @@ -7443,7 +7302,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; /** @example 1000000 */ count?: number; }; @@ -7481,7 +7340,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; /** @example 100000 */ count?: number; }; @@ -7529,7 +7388,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; users?: { user?: components["schemas"]["authRecipeUser"]; }[]; @@ -7575,7 +7434,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; }; }; }; @@ -7608,7 +7467,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; tags?: string[]; }; }; @@ -7643,13 +7502,13 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; /** @example [ * "feature_1", * "feature_2" * ] */ features?: string[]; - usageStats?: Record; + usageStats?: Record; }; }; }; @@ -7682,16 +7541,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example eyJhbGciOiJIUzI1NiIsIn... */ - licenseKey?: string; - } - | { - /** @enum {string} */ - status?: "NO_LICENSE_KEY_FOUND_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example eyJhbGciOiJIUzI1NiIsIn... */ + licenseKey?: string; + } | { + /** @enum {string} */ + status: "NO_LICENSE_KEY_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -7729,18 +7586,15 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - } - | { - /** @enum {string} */ - status?: "MISSING_EE_FOLDER_ERROR"; - } - | { - /** @enum {string} */ - status?: "INVALID_LICENSE_KEY_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + } | { + /** @enum {string} */ + status: "MISSING_EE_FOLDER_ERROR"; + } | { + /** @enum {string} */ + status: "INVALID_LICENSE_KEY_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -7772,7 +7626,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; }; }; }; @@ -7806,15 +7660,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - user?: components["schemas"]["authRecipeUser"]; - } - | { - /** @enum {string} */ - status?: "UNKNOWN_USER_ID_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + } | { + /** @enum {string} */ + status: "UNKNOWN_USER_ID_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -7853,7 +7705,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; users?: components["schemas"]["authRecipeUser"][]; }; }; @@ -7888,7 +7740,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; /** @example 16382348 */ atMinute?: number; averageRequestsPerSecond?: number[]; @@ -8457,14 +8309,12 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | ({ - status?: components["schemas"]["statusOK"]; - } & components["schemas"]["tenantConfig"]) - | { - /** @enum {string} */ - status?: "TENANT_NOT_FOUND_ERROR"; - }; + "application/json": ({ + status: components["schemas"]["statusOK"]; + } & components["schemas"]["tenantConfig"]) | { + /** @enum {string} */ + status: "TENANT_NOT_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -8499,14 +8349,12 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | ({ - status?: components["schemas"]["statusOK"]; - } & components["schemas"]["tenantConfigV2"]) - | { - /** @enum {string} */ - status?: "TENANT_NOT_FOUND_ERROR"; - }; + "application/json": ({ + status: components["schemas"]["statusOK"]; + } & components["schemas"]["tenantConfigV2"]) | { + /** @enum {string} */ + status: "TENANT_NOT_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -8727,16 +8575,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status: components["schemas"]["statusOK"]; - createdNew: boolean; - } - | { - /** @enum {string} */ - status: "CONFIG_VALIDATION_ERROR"; - reason: string; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + createdNew: boolean; + } | { + /** @enum {string} */ + status: "CONFIG_VALIDATION_ERROR"; + reason: string; + }; }; }; 400: components["responses"]["400"]; @@ -8778,7 +8624,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; didConfigExist?: boolean; }; }; @@ -8821,24 +8667,17 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status: components["schemas"]["statusOK"]; - wasAlreadyAssociated: boolean; - } - | { - /** @enum {string} */ - status: - | "UNKNOWN_USER_ID_ERROR" - | "EMAIL_ALREADY_EXISTS_ERROR" - | "PHONE_NUMBER_ALREADY_EXISTS_ERROR" - | "THIRD_PARTY_USER_ALREADY_EXISTS_ERROR"; - } - | { - /** @enum {string} */ - status?: "ASSOCIATION_NOT_ALLOWED_ERROR"; - reason?: string; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + wasAlreadyAssociated: boolean; + } | { + /** @enum {string} */ + status: "UNKNOWN_USER_ID_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR" | "PHONE_NUMBER_ALREADY_EXISTS_ERROR" | "THIRD_PARTY_USER_ALREADY_EXISTS_ERROR"; + } | { + /** @enum {string} */ + status: "ASSOCIATION_NOT_ALLOWED_ERROR"; + reason?: string; + }; }; }; 400: components["responses"]["400"]; @@ -8920,11 +8759,9 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | ({ - status?: components["schemas"]["statusOK"]; - } & components["schemas"]["oauthClient"]) - | components["schemas"]["oauthError"]; + "application/json": ({ + status: components["schemas"]["statusOK"]; + } & components["schemas"]["oauthClient"]) | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -8963,11 +8800,9 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | ({ - status?: components["schemas"]["statusOK"]; - } & components["schemas"]["oauthClient"]) - | components["schemas"]["oauthError"]; + "application/json": ({ + status: components["schemas"]["statusOK"]; + } & components["schemas"]["oauthClient"]) | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9006,11 +8841,9 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | ({ - status?: components["schemas"]["statusOK"]; - } & components["schemas"]["oauthClient"]) - | components["schemas"]["oauthError"]; + "application/json": ({ + status: components["schemas"]["statusOK"]; + } & components["schemas"]["oauthClient"]) | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9049,13 +8882,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - clients?: components["schemas"]["oauthClient"][]; - nextPaginationToken?: string; - } - | components["schemas"]["oauthError"]; + "application/json": { + status: components["schemas"]["statusOK"]; + clients?: components["schemas"]["oauthClient"][]; + nextPaginationToken?: string; + } | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9097,13 +8928,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example true */ - didExist?: boolean; - } - | components["schemas"]["oauthError"]; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example true */ + didExist?: boolean; + } | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9140,61 +8969,59 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - client?: components["schemas"]["oauthClient"]; - requestedScope?: string[]; - requestedAudience?: string[]; - requestedClaims?: { - idToken?: { - property1?: string; - property2?: string; - }; - }; - loginHint?: string; - uiLocales?: string[]; - acrValues?: string[]; - subject?: string; - requestUrl?: string; - skip?: boolean; - clientId?: string; - redirectUri?: string; - forceSubjectIdentifier?: string; - requestedAccessTokenAudience?: string[]; - context?: Record; - sessionId?: string; - loginSessionId?: string; - loginChallenge?: string; - loginRequestedAt?: string; - consentRequestedAt?: string; - consentChallenge?: string; - consentSkip?: boolean; - consentRemember?: boolean; - consentRememberFor?: number; - consentError?: { - name?: string; - description?: string; - }; - consentErrorDebug?: string; - consentErrorDescription?: string; - consentErrorHint?: string; - consentErrorCode?: string; - consentStatusCode?: number; - sessionIdToken?: { - property1?: string; - property2?: string; - }; - sessionAccessToken?: { - property1?: string; - property2?: string; - }; - sessionToken?: { - property1?: string; - property2?: string; - }; - } - | components["schemas"]["oauthError"]; + "application/json": { + status: components["schemas"]["statusOK"]; + client?: components["schemas"]["oauthClient"]; + requestedScope?: string[]; + requestedAudience?: string[]; + requestedClaims?: { + idToken?: { + property1?: string; + property2?: string; + }; + }; + loginHint?: string; + uiLocales?: string[]; + acrValues?: string[]; + subject?: string; + requestUrl?: string; + skip?: boolean; + clientId?: string; + redirectUri?: string; + forceSubjectIdentifier?: string; + requestedAccessTokenAudience?: string[]; + context?: Record; + sessionId?: string; + loginSessionId?: string; + loginChallenge?: string; + loginRequestedAt?: string; + consentRequestedAt?: string; + consentChallenge?: string; + consentSkip?: boolean; + consentRemember?: boolean; + consentRememberFor?: number; + consentError?: { + name?: string; + description?: string; + }; + consentErrorDebug?: string; + consentErrorDescription?: string; + consentErrorHint?: string; + consentErrorCode?: string; + consentStatusCode?: number; + sessionIdToken?: { + property1?: string; + property2?: string; + }; + sessionAccessToken?: { + property1?: string; + property2?: string; + }; + sessionToken?: { + property1?: string; + property2?: string; + }; + } | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9226,7 +9053,7 @@ export interface operations { requestBody?: { content: { "application/json": { - context?: Record; + context?: Record; grantAccessTokenAudience?: string[]; grantScope?: string[]; /** @@ -9254,13 +9081,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example {apiDomain}/oauth/consent?... */ - redirectTo?: string; - } - | components["schemas"]["oauthError"]; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example {apiDomain}/oauth/consent?... */ + redirectTo?: string; + } | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9308,13 +9133,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example {apiDomain}/oauth/consent?... */ - redirectTo?: string; - } - | components["schemas"]["oauthError"]; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example {apiDomain}/oauth/consent?... */ + redirectTo?: string; + } | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9351,26 +9174,24 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - challenge?: string; - client?: components["schemas"]["oauthClient"]; - oidcContext?: { - acrValues?: string[]; - display?: string; - idTokenHintClaims?: Record; - loginHint?: string; - uiLocales?: string[]; - requestUrl?: string; - requestedAccessTokenAudience?: string[]; - requestedScope?: string[]; - sessionId?: string; - skip?: boolean; - subject?: string; - }; - } - | components["schemas"]["oauthError"]; + "application/json": { + status: components["schemas"]["statusOK"]; + challenge?: string; + client?: components["schemas"]["oauthClient"]; + oidcContext?: { + acrValues?: string[]; + display?: string; + idTokenHintClaims?: Record; + loginHint?: string; + uiLocales?: string[]; + requestUrl?: string; + requestedAccessTokenAudience?: string[]; + requestedScope?: string[]; + sessionId?: string; + skip?: boolean; + subject?: string; + }; + } | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9424,13 +9245,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example {apiDomain}/oauth/login?... */ - redirectTo?: string; - } - | components["schemas"]["oauthError"]; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example {apiDomain}/oauth/login?... */ + redirectTo?: string; + } | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9478,13 +9297,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example {apiDomain}/oauth/login?... */ - redirectTo?: string; - } - | components["schemas"]["oauthError"]; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example {apiDomain}/oauth/login?... */ + redirectTo?: string; + } | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9525,13 +9342,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example {apiDomain}/oauth/logout?... */ - redirectTo?: string; - } - | components["schemas"]["oauthError"]; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example {apiDomain}/oauth/logout?... */ + redirectTo?: string; + } | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9572,11 +9387,9 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - } - | components["schemas"]["oauthError"]; + "application/json": { + status: components["schemas"]["statusOK"]; + } | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9617,13 +9430,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example true */ - didExist?: boolean; - } - | components["schemas"]["oauthError"]; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example true */ + didExist?: boolean; + } | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9664,13 +9475,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example true */ - didExist?: boolean; - } - | components["schemas"]["oauthError"]; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example true */ + didExist?: boolean; + } | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9712,13 +9521,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example true */ - didExist?: boolean; - } - | components["schemas"]["oauthError"]; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example true */ + didExist?: boolean; + } | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9753,11 +9560,9 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | ({ - status?: components["schemas"]["statusOK"]; - } & components["schemas"]["oauthClient"]) - | components["schemas"]["oauthError"]; + "application/json": ({ + status: components["schemas"]["statusOK"]; + } & components["schemas"]["oauthClient"]) | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9790,7 +9595,7 @@ export interface operations { /** @example https://api.auth.com */ iss?: string; /** @example {} */ - inputBody?: Record; + inputBody?: Record; /** @example false */ useStaticSigningKey?: boolean; /** @example Bearer 1234567890 */ @@ -9805,23 +9610,21 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status: components["schemas"]["statusOK"]; - /** @example eyJraWQiOiJzLTBjZmVmMDdkLWQ2NDktNGIwOC04MTVjLWJkYjZlYTczNWQyZCIsInR5cCI6IkpXVCIsImFsZyI6IlJTMjU2In0.eyJpYXQiOjE3NDAzODU5MzcsImV4cCI6MTc0MDM4OTUzOCwiY2xpZW50X2lkIjoic3RjbF82NWUwODc1Mi0yYzU5LTQ5NjQtOTM0Yy02OTIwZDJmMDZlNjIiLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjMwMDEvYXV0aCIsImp0aSI6Ijc1NTc2MmFmLTUwYTUtNDc1ZS04YWRkLTg3MDA1ZmU3YWJlNiIsIm5iZiI6MTc0MDM4NTkzNywic2NwIjpbIm9wZW5pZCIsIm9mZmxpbmVfYWNjZXNzIl0sInN1YiI6InNvbWV1c2VyaWQiLCJzdHQiOjEsImdpZCI6ImRjOGQ0OGUzLTcwOTgtNDhhNi1hYjU0LTgxMWMyODQ4N2I4MiIsInRJZCI6InB1YmxpYyIsInJzdWIiOiJzb21ldXNlcmlkIiwic2Vzc2lvbkhhbmRsZSI6InNlc3Npb24taGFuZGxlIn0.DgVgtD2gXgzHrDsC2lIUBa-wsYm8KO4Pg8L1Ov3aSBVgjwtjiCO40ldjBZ9qKdQBq5Qqk0ElAZNj6Bzc40ESfQumLH3_N2XtOj568s71JPuEOIg5hs9XAdK4vYfXMhVQRWn9iPUKHKrpRVf73IIH0mpkN8i6_MhcDoMMOuG5XPlXajG9VOyoY_5saHA61-uTafZLdAgKqnmYGvS8KmNEcEbBWLGwFB4QQKiDAUvatIi5n3juFBUxyt9t6DrqT1D04shesRppa0XhCZbCFBv1dixSrprdtqKhlPOrMgvOGNZ3cBLbYBOG9zoJRD5YlVMGw-j_pE7IbvpDWKL7tTJS1Q */ - access_token: string; - /** @example 3599 */ - expires_in?: number; - /** @example eyJraWQiOiJzLTBjZmVmMDdkLWQ2NDktNGIwOC04MTVjLWJkYjZlYTczNWQyZCIsInR5cCI6IkpXVCIsImFsZyI6IlJTMjU2In0.eyJpYXQiOjE3NDAzODU5MzgsImV4cCI6MTc0MDM4OTUzOCwiYXRfaGFzaCI6IkNxOGNCSk01Nm5FcG9aaWREcnZvLVEiLCJhdWQiOiJzdGNsXzY1ZTA4NzUyLTJjNTktNDk2NC05MzRjLTY5MjBkMmYwNmU2MiIsImF1dGhfdGltZSI6MTc0MDM4NTkzNywiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDozMDAxL2F1dGgiLCJqdGkiOiIxZDA5OGUxZi04ZGIxLTQyNzUtYmMzYS0zYTA4NjdjOWE2NTAiLCJyYXQiOjE3NDAzODU3MzEsInNpZCI6InNlc3Npb24taGFuZGxlIiwic3ViIjoic29tZXVzZXJpZCIsInN0dCI6MiwiZ2lkIjoiYzk1OTVjYjItMWFjOS00MDI0LWFjNjMtNDJlZDEyODliY2RmIn0.PGsemf1qpLF-cE_616NHvKsRmanFiyba0yqF2j5fy87AWD5McI405A4eqi-wAlKsDxC-MPpuW8bx-08YUhs3x6ku4aFaDyA-M-Xhc65fJJ4SCPVaUL7qlUwl7wJwNs2rMRW3Ayyj4MDSlW5uqm39_K_bBqod2Qj1yqck-N0g78qh86uEcyX6Al3d5KSln1B21nwDsEgegk3xzE8lFMCQUTpZEYb5-1v2D0Bu_PblBfOCjA6mBtT1IIQkmSE27FvkTUS1H50EUyhFP4JH30kP3bUnQ9pOqGMTe405N2ruKtPyWsXHLPlQ4hcJCLO5GT5ZgtUjfz6Y3mCM9l69uDYDHg */ - id_token?: string; - /** @example st_rt_d7LI9mGYHF2TAaVEFJi7fqOWo8ZQ8zEGpuxhHQs0R18.UZ0nbTuuYuDD8G54PCD8AKHdsh9cezu8BTxVlTy7pYw */ - refresh_token?: string; - /** @example openid offline_access */ - scope?: string; - /** @example bearer */ - token_type?: string; - } - | components["schemas"]["oauthError"]; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example eyJraWQiOiJzLTBjZmVmMDdkLWQ2NDktNGIwOC04MTVjLWJkYjZlYTczNWQyZCIsInR5cCI6IkpXVCIsImFsZyI6IlJTMjU2In0.eyJpYXQiOjE3NDAzODU5MzcsImV4cCI6MTc0MDM4OTUzOCwiY2xpZW50X2lkIjoic3RjbF82NWUwODc1Mi0yYzU5LTQ5NjQtOTM0Yy02OTIwZDJmMDZlNjIiLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjMwMDEvYXV0aCIsImp0aSI6Ijc1NTc2MmFmLTUwYTUtNDc1ZS04YWRkLTg3MDA1ZmU3YWJlNiIsIm5iZiI6MTc0MDM4NTkzNywic2NwIjpbIm9wZW5pZCIsIm9mZmxpbmVfYWNjZXNzIl0sInN1YiI6InNvbWV1c2VyaWQiLCJzdHQiOjEsImdpZCI6ImRjOGQ0OGUzLTcwOTgtNDhhNi1hYjU0LTgxMWMyODQ4N2I4MiIsInRJZCI6InB1YmxpYyIsInJzdWIiOiJzb21ldXNlcmlkIiwic2Vzc2lvbkhhbmRsZSI6InNlc3Npb24taGFuZGxlIn0.DgVgtD2gXgzHrDsC2lIUBa-wsYm8KO4Pg8L1Ov3aSBVgjwtjiCO40ldjBZ9qKdQBq5Qqk0ElAZNj6Bzc40ESfQumLH3_N2XtOj568s71JPuEOIg5hs9XAdK4vYfXMhVQRWn9iPUKHKrpRVf73IIH0mpkN8i6_MhcDoMMOuG5XPlXajG9VOyoY_5saHA61-uTafZLdAgKqnmYGvS8KmNEcEbBWLGwFB4QQKiDAUvatIi5n3juFBUxyt9t6DrqT1D04shesRppa0XhCZbCFBv1dixSrprdtqKhlPOrMgvOGNZ3cBLbYBOG9zoJRD5YlVMGw-j_pE7IbvpDWKL7tTJS1Q */ + access_token: string; + /** @example 3599 */ + expires_in?: number; + /** @example eyJraWQiOiJzLTBjZmVmMDdkLWQ2NDktNGIwOC04MTVjLWJkYjZlYTczNWQyZCIsInR5cCI6IkpXVCIsImFsZyI6IlJTMjU2In0.eyJpYXQiOjE3NDAzODU5MzgsImV4cCI6MTc0MDM4OTUzOCwiYXRfaGFzaCI6IkNxOGNCSk01Nm5FcG9aaWREcnZvLVEiLCJhdWQiOiJzdGNsXzY1ZTA4NzUyLTJjNTktNDk2NC05MzRjLTY5MjBkMmYwNmU2MiIsImF1dGhfdGltZSI6MTc0MDM4NTkzNywiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDozMDAxL2F1dGgiLCJqdGkiOiIxZDA5OGUxZi04ZGIxLTQyNzUtYmMzYS0zYTA4NjdjOWE2NTAiLCJyYXQiOjE3NDAzODU3MzEsInNpZCI6InNlc3Npb24taGFuZGxlIiwic3ViIjoic29tZXVzZXJpZCIsInN0dCI6MiwiZ2lkIjoiYzk1OTVjYjItMWFjOS00MDI0LWFjNjMtNDJlZDEyODliY2RmIn0.PGsemf1qpLF-cE_616NHvKsRmanFiyba0yqF2j5fy87AWD5McI405A4eqi-wAlKsDxC-MPpuW8bx-08YUhs3x6ku4aFaDyA-M-Xhc65fJJ4SCPVaUL7qlUwl7wJwNs2rMRW3Ayyj4MDSlW5uqm39_K_bBqod2Qj1yqck-N0g78qh86uEcyX6Al3d5KSln1B21nwDsEgegk3xzE8lFMCQUTpZEYb5-1v2D0Bu_PblBfOCjA6mBtT1IIQkmSE27FvkTUS1H50EUyhFP4JH30kP3bUnQ9pOqGMTe405N2ruKtPyWsXHLPlQ4hcJCLO5GT5ZgtUjfz6Y3mCM9l69uDYDHg */ + id_token?: string; + /** @example st_rt_d7LI9mGYHF2TAaVEFJi7fqOWo8ZQ8zEGpuxhHQs0R18.UZ0nbTuuYuDD8G54PCD8AKHdsh9cezu8BTxVlTy7pYw */ + refresh_token?: string; + /** @example openid offline_access */ + scope?: string; + /** @example bearer */ + token_type?: string; + } | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9861,13 +9664,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example {apiDomain}/oauth/logout?... */ - redirectTo?: string; - } - | components["schemas"]["oauthError"]; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example {apiDomain}/oauth/logout?... */ + redirectTo?: string; + } | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9908,45 +9709,43 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - active?: boolean; - /** @example 1740992368 */ - iat?: number; - /** @example 1740995969 */ - exp?: number; - /** @example stcl_fed7cff0-cc6e-406e-b7a6-766148675a4a */ - client_id?: string; - /** @example http://localhost:3001/auth */ - iss?: string; - /** @example 1c229efe-c55b-44c1-98cf-9fa3a366502e */ - jti?: string; - /** @example 1740992368 */ - nbf?: number; - /** @example [ - * "openid", - * "offline_access" - * ] */ - scp?: string[]; - /** @example 137d053d-0d69-4dea-8a19-06ddbdfa4f96 */ - sub?: string; - /** @example 1 */ - stt?: number; - /** @example 87bcc2d8-f159-4e10-a097-0898179a2d7d */ - sessionHandle?: string; - /** @example 137d053d-0d69-4dea-8a19-06ddbdfa4f96 */ - rsub?: string; - /** @example public */ - tId?: string; - /** @example 575b7130-d982-4945-be49-3ecde2a49eaa */ - gid?: string; - /** @example Bearer */ - token_type?: string; - /** @example access_token */ - token_use?: string; - } - | components["schemas"]["oauthError"]; + "application/json": { + status: components["schemas"]["statusOK"]; + active?: boolean; + /** @example 1740992368 */ + iat?: number; + /** @example 1740995969 */ + exp?: number; + /** @example stcl_fed7cff0-cc6e-406e-b7a6-766148675a4a */ + client_id?: string; + /** @example http://localhost:3001/auth */ + iss?: string; + /** @example 1c229efe-c55b-44c1-98cf-9fa3a366502e */ + jti?: string; + /** @example 1740992368 */ + nbf?: number; + /** @example [ + * "openid", + * "offline_access" + * ] */ + scp?: string[]; + /** @example 137d053d-0d69-4dea-8a19-06ddbdfa4f96 */ + sub?: string; + /** @example 1 */ + stt?: number; + /** @example 87bcc2d8-f159-4e10-a097-0898179a2d7d */ + sessionHandle?: string; + /** @example 137d053d-0d69-4dea-8a19-06ddbdfa4f96 */ + rsub?: string; + /** @example public */ + tId?: string; + /** @example 575b7130-d982-4945-be49-3ecde2a49eaa */ + gid?: string; + /** @example Bearer */ + token_type?: string; + /** @example access_token */ + token_use?: string; + } | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9963,7 +9762,7 @@ export interface operations { paginationToken?: components["parameters"]["paginationToken"]; /** @example 1 */ limit?: components["parameters"]["limit"]; - status?: components["parameters"]["bulkImportUserStatus"]; + status: components["parameters"]["bulkImportUserStatus"]; }; header?: { /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ @@ -9986,7 +9785,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; users?: components["schemas"]["bulkImportUserResponse"][]; nextPaginationToken?: components["schemas"]["paginationToken"]; }; @@ -10028,7 +9827,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; users?: components["schemas"]["addBulkImportUserResponse"]; }; }; @@ -10133,26 +9932,20 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - credential?: { - /** @example ea7a0931-b533-4478-9253-0fde890ca23 */ - webauthnCredentialId?: string; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - recipeUserId?: string; - /** @example example.com */ - relyingPartyId?: string; - /** @example 1741793746 */ - createdAt?: number; - /** @example 1741793746 */ - updatedAt?: number; - }; - } - | { - /** @enum {string} */ - status?: "CREDENTIAL_NOT_FOUND_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example ea7a0931-b533-4478-9253-0fde890ca23 */ + webauthnCredentialId?: string; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId?: string; + /** @example example.com */ + relyingPartyId?: string; + /** @example 1741793746 */ + createdAt?: number; + } | { + /** @enum {string} */ + status: "CREDENTIAL_NOT_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10189,16 +9982,16 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; credentials?: { /** @example ea7a0931-b533-4478-9253-0fde890ca23 */ - webauthnCredentialId?: string; + webauthnCredentialId: string; /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - recipeUserId?: string; + recipeUserId: string; /** @example example.com */ - relyingPartyId?: string; + relyingPartyId: string; /** @example 1741793746 */ - createdAt?: number; + createdAt: number; /** @example 1741793746 */ updatedAt?: number; }[]; @@ -10239,7 +10032,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; /** @example fa7a0841-b533-4478-9253-0fde890c576 */ webauthnGeneratedOptionsId?: string; /** @example example.com */ @@ -10249,13 +10042,12 @@ export interface operations { /** @example TQvEVDV8B64w_2zIifzKaPzBPfthqpx2uJkq_2PIB0k */ challenge?: string; /** @example 10000 */ - timeout?: number; + timeout?: string; /** @example http://example.com */ origin?: string; /** @example email@example.com */ email?: string; - /** @example required */ - userVerification?: string; + userVerification?: components["schemas"]["userVerification"]; /** @example true */ userPresence?: boolean; /** @example 1741793746 */ @@ -10298,17 +10090,15 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - recipeUserId?: string; - user?: components["schemas"]["authRecipeUser"]; - } - | { - /** @enum {string} */ - status?: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId?: string; + user?: components["schemas"]["authRecipeUser"]; + } | { + /** @enum {string} */ + status: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10348,15 +10138,14 @@ export interface operations { origin: string; /** @example 10000 */ timeout?: number; - /** @example preferred */ - userVerification?: string; + userVerification?: components["schemas"]["userVerification"]; /** @example false */ userPresence?: boolean; /** @example none */ attestation?: string; /** @example required */ residentKey?: string; - supportedAlgorithmIDs?: number[]; + supportedAlgorithmIds?: number[]; }; }; }; @@ -10367,59 +10156,56 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - webauthnGeneratedOptionsId?: string; - rp?: { - /** @example example.com */ - id?: string; - /** @example Example */ - name?: string; - }; - user?: { - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - id?: string; - /** @example John Doe */ - name?: string; - /** @example John Doe */ - displayName?: string; - }; - email?: components["schemas"]["email"]; - /** @example TQvEVDV8B64w_2zIifzKaPzBPfthqpx2uJkq_2PIB0k */ - challenge?: string; - /** @example 10000 */ - timeout?: number; - /** @example none */ - attestation?: string; - /** @example 1741793746 */ - createdAt?: number; - /** @example 1741793746 */ - expiresAt?: number; - pubKeyCredParams?: { - /** @example public-key */ - type?: string; - /** @example -7 */ - alg?: number; - }[]; - excludeCredentials?: { - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - id?: string; - transport?: string[]; - }[]; - authenticatorSelection?: { - /** @example preferred */ - userVerification?: string; - /** @example true */ - requireResidentKey?: boolean; - }; - } - | { - /** @enum {string} */ - status?: "INVALID_OPTIONS_ERROR"; - reason?: string; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + webauthnGeneratedOptionsId?: string; + rp?: { + /** @example example.com */ + id?: string; + /** @example Example */ + name?: string; + }; + user?: { + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + id?: string; + /** @example John Doe */ + name?: string; + /** @example John Doe */ + displayName?: string; + }; + email?: components["schemas"]["email"]; + /** @example TQvEVDV8B64w_2zIifzKaPzBPfthqpx2uJkq_2PIB0k */ + challenge?: string; + /** @example 10000 */ + timeout?: number; + /** @example none */ + attestation?: string; + /** @example 1741793746 */ + createdAt?: number; + /** @example 1741793746 */ + expiresAt?: number; + pubKeyCredParams?: { + /** @example public-key */ + type?: string; + /** @example -7 */ + alg?: number; + }[]; + excludeCredentials?: { + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + id?: string; + transport?: string[]; + }[]; + authenticatorSelection?: { + userVerification?: components["schemas"]["userVerification"]; + /** @example true */ + requireResidentKey?: boolean; + }; + } | { + /** @enum {string} */ + status: "INVALID_OPTIONS_ERROR"; + reason?: string; + }; }; }; 400: components["responses"]["400"]; @@ -10455,11 +10241,10 @@ export interface operations { /** @example http://example.com */ origin: string; /** @example 10000 */ - timeout: number; - /** @example preferred */ - userVerification: string; + timeout?: number; + userVerification?: components["schemas"]["userVerification"]; /** @example false */ - userPresence: boolean; + userPresence?: boolean; }; }; }; @@ -10470,31 +10255,28 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - webauthnGeneratedOptionsId?: string; - /** @example example.com */ - relyingPartyId?: string; - /** @example TQvEVDV8B64w_2zIifzKaPzBPfthqpx2uJkq_2PIB0k */ - challenge?: string; - /** @example 10000 */ - timeout?: number; - /** @example required */ - userVerification?: string; - /** @example true */ - userPresence?: boolean; - /** @example 1741793746 */ - createdAt?: number; - /** @example 1741793746 */ - expiresAt?: number; - } - | { - /** @enum {string} */ - status?: "INVALID_OPTIONS_ERROR"; - reason?: string; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + webauthnGeneratedOptionsId?: string; + /** @example example.com */ + relyingPartyId?: string; + /** @example TQvEVDV8B64w_2zIifzKaPzBPfthqpx2uJkq_2PIB0k */ + challenge?: string; + /** @example 10000 */ + timeout?: number; + userVerification?: components["schemas"]["userVerification"]; + /** @example true */ + userPresence?: boolean; + /** @example 1741793746 */ + createdAt?: string; + /** @example 1741793746 */ + expiresAt?: string; + } | { + /** @enum {string} */ + status: "INVALID_OPTIONS_ERROR"; + reason?: string; + }; }; }; 400: components["responses"]["400"]; @@ -10527,7 +10309,7 @@ export interface operations { /** @example fa7a0841-b533-4478-9253-0fde890c576 */ webauthnGeneratedOptionsId?: string; /** @description Credential returned by the browser */ - credential?: Record; + credential?: Record; }; }; }; @@ -10538,34 +10320,25 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - webauthnCredentialId?: string; - /** @example example.com */ - relyingPartyId?: string; - /** @example Example */ - relyingPartyName?: string; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - recipeUserId?: string; - email?: components["schemas"]["email"]; - } - | { - /** @enum {string} */ - status?: - | "INVALID_OPTIONS_ERROR" - | "INVALID_AUTHENTICATOR_ERROR" - | "INVALID_CREDENTIALS_ERROR"; - reason?: string; - } - | { - /** @enum {string} */ - status?: - | "OPTIONS_NOT_FOUND_ERROR" - | "CREDENTIAL_ALREADY_EXISTS_ERROR" - | "UNKNOWN_USER_ID_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + webauthnCredentialId?: string; + /** @example example.com */ + relyingPartyId?: string; + /** @example Example */ + relyingPartyName?: string; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId?: string; + email?: components["schemas"]["email"]; + } | { + /** @enum {string} */ + status: "INVALID_AUTHENTICATOR_ERROR"; + reason?: string; + } | { + /** @enum {string} */ + status: "OPTIONS_NOT_FOUND_ERROR" | "INVALID_CREDENTIALS_ERROR" | "INVALID_OPTIONS_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10597,7 +10370,7 @@ export interface operations { /** @example fa7a0841-b533-4478-9253-0fde890c576 */ webauthnGeneratedOptionsId?: string; /** @description Credential returned by the browser */ - credential?: Record; + credential?: Record; }; }; }; @@ -10608,31 +10381,25 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - webauthnCredentialId?: string; - /** @example example.com */ - relyingPartyId?: string; - /** @example Example */ - relyingPartyName?: string; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - recipeUserId?: string; - user?: components["schemas"]["authRecipeUser"]; - } - | { - /** @enum {string} */ - status?: - | "INVALID_OPTIONS_ERROR" - | "INVALID_AUTHENTICATOR_ERROR" - | "INVALID_CREDENTIALS_ERROR"; - reason?: string; - } - | { - /** @enum {string} */ - status?: "OPTIONS_NOT_FOUND_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + webauthnCredentialId?: string; + /** @example example.com */ + relyingPartyId?: string; + /** @example Example */ + relyingPartyName?: string; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId?: string; + user?: components["schemas"]["authRecipeUser"]; + } | { + /** @enum {string} */ + status: "INVALID_OPTIONS_ERROR" | "INVALID_AUTHENTICATOR_ERROR" | "INVALID_CREDENTIALS_ERROR"; + reason?: string; + } | { + /** @enum {string} */ + status: "OPTIONS_NOT_FOUND_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10664,7 +10431,7 @@ export interface operations { /** @example fa7a0841-b533-4478-9253-0fde890c576 */ webauthnGeneratedOptionsId?: string; /** @description Credential returned by the browser */ - credential?: Record; + credential?: Record; }; }; }; @@ -10675,28 +10442,19 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - recipeUserId?: string; - user?: components["schemas"]["authRecipeUser"]; - } - | { - /** @enum {string} */ - status?: - | "INVALID_OPTIONS_ERROR" - | "INVALID_AUTHENTICATOR_ERROR" - | "INVALID_CREDENTIALS_ERROR"; - reason?: string; - } - | { - /** @enum {string} */ - status?: - | "OPTIONS_NOT_FOUND_ERROR" - | "CREDENTIAL_NOT_FOUND_ERROR" - | "UNKNOWN_USER_ID_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId?: string; + user?: components["schemas"]["authRecipeUser"]; + } | { + /** @enum {string} */ + status: "INVALID_OPTIONS_ERROR" | "INVALID_AUTHENTICATOR_ERROR" | "INVALID_CREDENTIALS_ERROR"; + reason?: string; + } | { + /** @enum {string} */ + status: "OPTIONS_NOT_FOUND_ERROR" | "CREDENTIAL_NOT_FOUND_ERROR" | "UNKNOWN_USER_ID_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10737,16 +10495,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example ZmE3YTA4NDEtYjUzMy00NDc4LTkyNTMtMGZkZTg5MGM1NzY */ - token?: string; - } - | { - /** @enum {string} */ - status?: "UNKNOWN_USER_ID_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example ZmE3YTA4NDEtYjUzMy00NDc4LTkyNTMtMGZkZTg5MGM1NzY */ + token?: string; + } | { + /** @enum {string} */ + status: "UNKNOWN_USER_ID_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10787,16 +10543,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - userId?: components["schemas"]["userId"]; - email?: components["schemas"]["email"]; - } - | { - /** @enum {string} */ - status?: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + userId?: components["schemas"]["userId"]; + email?: components["schemas"]["email"]; + } | { + /** @enum {string} */ + status: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10837,17 +10591,12 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - } - | { - /** @enum {string} */ - status?: - | "UNKNOWN_USER_ID_ERROR" - | "EMAIL_ALREADY_EXISTS_ERROR" - | "USER_WITH_EMAIL_ALREADY_EXISTS_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + } | { + /** @enum {string} */ + status: "UNKNOWN_USER_ID_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10884,14 +10633,12 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - } - | { - /** @enum {string} */ - status?: "CREDENTIAL_NOT_FOUND_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + } | { + /** @enum {string} */ + status: "CREDENTIAL_NOT_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10927,14 +10674,12 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - } - | { - /** @enum {string} */ - status?: "OPTIONS_NOT_FOUND_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + } | { + /** @enum {string} */ + status: "OPTIONS_NOT_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; From a76d84532f426af2727800ac3ffa35a2e27d03ae Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Tue, 6 May 2025 13:02:13 +0530 Subject: [PATCH 07/64] Update API spec to match user definition changes in spec --- lib/core/versions/5.3/schema.d.ts | 42 +++++++++++++++---------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/lib/core/versions/5.3/schema.d.ts b/lib/core/versions/5.3/schema.d.ts index 3e526f0b9..021de7a14 100644 --- a/lib/core/versions/5.3/schema.d.ts +++ b/lib/core/versions/5.3/schema.d.ts @@ -2948,35 +2948,35 @@ export type webhooks = Record; export interface components { schemas: { authRecipeUser: { - id?: components["schemas"]["userId"]; + id: components["schemas"]["userId"]; /** @example true */ - isPrimaryUser?: boolean; - tenantIds?: components["schemas"]["tenantId"][]; - timeJoined?: components["schemas"]["timeJoined"]; - emails?: components["schemas"]["email"][]; - phoneNumbers?: components["schemas"]["phoneNumber"][]; - webauthn?: { - credentialIds?: string[]; - }; - thirdParty?: { - id?: components["schemas"]["thirdPartyId"]; - userId?: components["schemas"]["thirdPartyUserId"]; + isPrimaryUser: boolean; + tenantIds: components["schemas"]["tenantId"][]; + timeJoined: components["schemas"]["timeJoined"]; + emails: components["schemas"]["email"][]; + phoneNumbers: components["schemas"]["phoneNumber"][]; + webauthn: { + credentialIds: string[]; + }; + thirdParty: { + id: components["schemas"]["thirdPartyId"]; + userId: components["schemas"]["thirdPartyUserId"]; }[]; - loginMethods?: { - tenantIds?: components["schemas"]["tenantId"][]; - recipeUserId?: components["schemas"]["userId"]; + loginMethods: { + tenantIds: components["schemas"]["tenantId"][]; + recipeUserId: components["schemas"]["userId"]; /** @example true */ - verified?: boolean; - timeJoined?: components["schemas"]["timeJoined"]; - recipeId?: components["schemas"]["recipeId"]; + verified: boolean; + timeJoined: components["schemas"]["timeJoined"]; + recipeId: components["schemas"]["recipeId"]; email?: components["schemas"]["email"]; phoneNumber?: components["schemas"]["phoneNumber"]; thirdParty?: { - id?: components["schemas"]["thirdPartyId"]; - userId?: components["schemas"]["thirdPartyUserId"]; + id: components["schemas"]["thirdPartyId"]; + userId: components["schemas"]["thirdPartyUserId"]; }; webauthn?: { - credentialIds?: string[]; + credentialIds: string[]; }; }[]; }; From 1693aaef9375ae49e028f7593b3e4b5263733028 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Tue, 6 May 2025 13:51:46 +0530 Subject: [PATCH 08/64] Add fix for user handling in SDK from API --- lib/core/versions/5.3/schema.d.ts | 11 ++++---- .../accountlinking/recipeImplementation.ts | 28 +++++++++---------- lib/ts/user.ts | 7 +++++ 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/lib/core/versions/5.3/schema.d.ts b/lib/core/versions/5.3/schema.d.ts index 021de7a14..9a8683511 100644 --- a/lib/core/versions/5.3/schema.d.ts +++ b/lib/core/versions/5.3/schema.d.ts @@ -3686,20 +3686,19 @@ export interface operations { "application/json": { status: components["schemas"]["statusOK"]; /** @example true */ - wasAlreadyAPrimaryUser?: boolean; - user?: components["schemas"]["authRecipeUser"]; + wasAlreadyAPrimaryUser: boolean; + user: components["schemas"]["authRecipeUser"]; } | { /** @enum {string} */ status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId?: string; - description?: string; + primaryUserId: string; + description: string; } | { /** @enum {string} */ status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId?: string; - description?: string; + primaryUserId: string; }; }; }; diff --git a/lib/ts/recipe/accountlinking/recipeImplementation.ts b/lib/ts/recipe/accountlinking/recipeImplementation.ts index 2655d1096..5f5110146 100644 --- a/lib/ts/recipe/accountlinking/recipeImplementation.ts +++ b/lib/ts/recipe/accountlinking/recipeImplementation.ts @@ -15,7 +15,6 @@ import { AccountInfoInput, RecipeInterface, TypeNormalisedInput } from "./types"; import { Querier } from "../../querier"; -import NormalisedURLPath from "../../normalisedURLPath"; import RecipeUserId from "../../recipeUserId"; import type AccountLinkingRecipe from "./recipe"; import { User } from "../../user"; @@ -139,7 +138,10 @@ export default function getRecipeImplementation( userContext ); if (response.status === "OK") { - response.user = new User(response.user); + return { + ...response, + user: User.fromApi(response.user), + }; } return response; }, @@ -226,20 +228,15 @@ export default function getRecipeImplementation( userContext ); - if (accountsLinkingResult.status === "OK") { - accountsLinkingResult.user = new User(accountsLinkingResult.user); - } - - if ( - ["OK", "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"].includes( - accountsLinkingResult.status - ) - ) { - accountsLinkingResult.user = new User(accountsLinkingResult.user); + if (accountsLinkingResult.status === "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR") { + return { + ...accountsLinkingResult, + user: User.fromApi(accountsLinkingResult.user), + }; } if (accountsLinkingResult.status === "OK") { - let user: UserType = accountsLinkingResult.user; + let user: UserType = User.fromApi(accountsLinkingResult.user); if (!accountsLinkingResult.accountsAlreadyLinked) { await recipeInstance.verifyEmailForRecipeUserIfLinkedAccountsAreVerified({ user: user, @@ -264,7 +261,10 @@ export default function getRecipeImplementation( await config.onAccountLinked(user, loginMethodInfo, userContext); } - accountsLinkingResult.user = user; + return { + ...accountsLinkingResult, + user, + }; } return accountsLinkingResult; diff --git a/lib/ts/user.ts b/lib/ts/user.ts index 7fb9cebfa..156e92ccf 100644 --- a/lib/ts/user.ts +++ b/lib/ts/user.ts @@ -120,6 +120,13 @@ export class User implements UserType { this.loginMethods = user.loginMethods.map((m) => new LoginMethod(m)); } + static fromApi(apiUser: Omit & { id: string }): User { + return new User({ + ...apiUser, + id: new RecipeUserId(apiUser.id).getAsString(), + }); + } + toJson(): JSONObject { return { id: this.id, From f05d6e67e543855c62cd1037827ee08df59584e5 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Tue, 6 May 2025 16:46:44 +0530 Subject: [PATCH 09/64] Add fix for emailpassword recipe --- lib/core/versions/5.3/schema.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/core/versions/5.3/schema.d.ts b/lib/core/versions/5.3/schema.d.ts index 9a8683511..cd14998ab 100644 --- a/lib/core/versions/5.3/schema.d.ts +++ b/lib/core/versions/5.3/schema.d.ts @@ -434,7 +434,7 @@ export interface paths { patch?: never; trace?: never; }; - "//recipe/user": { + "/recipe/user": { parameters: { query?: never; header?: never; From 066977835f0a516b6d8e0ef678c76601be8cbbc5 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Tue, 6 May 2025 17:11:57 +0530 Subject: [PATCH 10/64] Add fixes for multitenancy related conflicts --- lib/core/versions/5.3/schema.d.ts | 37 ++++++++++++------- .../multitenancy/recipeImplementation.ts | 7 +++- 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/lib/core/versions/5.3/schema.d.ts b/lib/core/versions/5.3/schema.d.ts index cd14998ab..ba5c7784c 100644 --- a/lib/core/versions/5.3/schema.d.ts +++ b/lib/core/versions/5.3/schema.d.ts @@ -1173,7 +1173,7 @@ export interface paths { }; content: { "application/json": { - keys?: components["schemas"]["jwk"][]; + keys: components["schemas"]["jwk"][]; }; }; }; @@ -3208,13 +3208,17 @@ export interface components { jwtValidity: number; /** @description A JWK that can be used to verify a JWT */ jwk: { - alg?: components["schemas"]["createJWTAlgorithm"]; + alg: components["schemas"]["createJWTAlgorithm"]; /** @example RSA */ - kty?: string; + kty: string; /** @example sig */ - use?: string; + use: string; /** @description Unique identifier for the JWK */ - kid?: string; + kid: string; + /** @description Modulus */ + n: string; + /** @description Exponent */ + e: string; /** @description X.509 Certificate Chain */ x5c?: string[]; }; @@ -3264,23 +3268,30 @@ export interface components { name?: string; clients?: { clientType?: string; - clientId?: string; + clientId: string; clientSecret?: string; scope?: string[]; forcePKCE?: boolean; additionalConfig?: Record; }[]; authorizationEndpoint?: string; - authorizationEndpointQueryParams?: Record; + authorizationEndpointQueryParams?: { + [key: string]: string | null; + }; tokenEndpoint?: string; - tokenEndpointBodyParams?: Record; + tokenEndpointBodyParams?: { + [key: string]: string; + }; userInfoEndpoint?: string; - userInfoEndpointQueryParams?: Record; - userInfoEndpointHeaders?: Record; + userInfoEndpointQueryParams?: { + [key: string]: string | null; + }; + userInfoEndpointHeaders?: { + [key: string]: string | null; + }; jwksURI?: string; oidcDiscoveryEndpoint?: string; - /** @default true */ - requireEmail: boolean; + requireEmail?: boolean; userInfoMap?: { fromIdTokenPayload?: { userId?: string; @@ -3406,7 +3417,7 @@ export interface components { tenantConfigV2: { tenantId: components["schemas"]["tenantId"]; thirdParty: { - providers?: components["schemas"]["thirdPartyProviderConfig"][]; + providers: components["schemas"]["thirdPartyProviderConfig"][]; }; firstFactors?: components["schemas"]["firstFactors"]; requiredSecondaryFactors?: components["schemas"]["requiredSecondaryFactors"]; diff --git a/lib/ts/recipe/multitenancy/recipeImplementation.ts b/lib/ts/recipe/multitenancy/recipeImplementation.ts index b0516a50c..bdb55e756 100644 --- a/lib/ts/recipe/multitenancy/recipeImplementation.ts +++ b/lib/ts/recipe/multitenancy/recipeImplementation.ts @@ -13,7 +13,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { "/recipe/multitenancy/tenant/v2", { tenantId, - ...config, + ...{ + config: { + ...config, + firstFactors: config?.firstFactors === null ? undefined : config?.firstFactors, + }, + }, }, {}, userContext From 93627107cb592feb985703d6b0a90915049b2c91 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Tue, 6 May 2025 17:26:23 +0530 Subject: [PATCH 11/64] Fix some more recipe related type conflicts --- lib/core/versions/5.3/schema.d.ts | 24 +++++++++---------- .../recipe/thirdparty/recipeImplementation.ts | 1 - lib/ts/recipe/totp/recipeImplementation.ts | 5 +++- .../usermetadata/recipeImplementation.ts | 1 - .../recipe/userroles/recipeImplementation.ts | 2 -- 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/lib/core/versions/5.3/schema.d.ts b/lib/core/versions/5.3/schema.d.ts index ba5c7784c..d29ed99e8 100644 --- a/lib/core/versions/5.3/schema.d.ts +++ b/lib/core/versions/5.3/schema.d.ts @@ -3168,16 +3168,16 @@ export interface components { /** @example Error Message */ message: string; session: { - handle?: components["schemas"]["handle"]; - userId?: components["schemas"]["userId"]; + handle: components["schemas"]["handle"]; + userId: components["schemas"]["userId"]; userDataInJWT?: components["schemas"]["userDataInJWT"]; - tenantId?: components["schemas"]["tenantId"]; - recipeUserId?: components["schemas"]["userId"]; + tenantId: components["schemas"]["tenantId"]; + recipeUserId: components["schemas"]["userId"]; }; cookieInfo: { - token?: components["schemas"]["token"]; - expiry?: components["schemas"]["expiry"]; - createdTime?: components["schemas"]["timeCreated"]; + token: components["schemas"]["token"]; + expiry: components["schemas"]["expiry"]; + createdTime: components["schemas"]["timeCreated"]; }; /** @example 1637262633029 */ expiry: number; @@ -3969,10 +3969,10 @@ export interface operations { "application/json": { status: components["schemas"]["statusOK"]; devices?: { - name?: string; - period?: number; - skew?: number; - verified?: boolean; + name: string; + period: number; + skew: number; + verified: boolean; }[]; }; }; @@ -4108,7 +4108,7 @@ export interface operations { /** @example 123456 */ totp: string; /** @example false */ - allowUnverifiedDevices: boolean; + allowUnverifiedDevices?: boolean; }; }; }; diff --git a/lib/ts/recipe/thirdparty/recipeImplementation.ts b/lib/ts/recipe/thirdparty/recipeImplementation.ts index 58dfc19d5..ab0571f38 100644 --- a/lib/ts/recipe/thirdparty/recipeImplementation.ts +++ b/lib/ts/recipe/thirdparty/recipeImplementation.ts @@ -1,6 +1,5 @@ import { RecipeInterface, ProviderInput } from "./types"; import { Querier } from "../../querier"; -import NormalisedURLPath from "../../normalisedURLPath"; import { findAndCreateProviderInstance, mergeProvidersFromCoreAndStatic } from "./providers/configUtils"; import AccountLinking from "../accountlinking/recipe"; import MultitenancyRecipe from "../multitenancy/recipe"; diff --git a/lib/ts/recipe/totp/recipeImplementation.ts b/lib/ts/recipe/totp/recipeImplementation.ts index 4ce109d0e..cf2b744d0 100644 --- a/lib/ts/recipe/totp/recipeImplementation.ts +++ b/lib/ts/recipe/totp/recipeImplementation.ts @@ -15,7 +15,6 @@ import { RecipeInterface } from "./"; import { Querier } from "../../querier"; -import NormalisedURLPath from "../../normalisedURLPath"; import { TypeNormalisedInput } from "./types"; import { UserContext } from "../../types"; import { getUser } from "../.."; @@ -98,6 +97,10 @@ export default function getRecipeInterface(querier: Querier, config: TypeNormali input.userContext ); + if (response.status !== "OK") { + return response; + } + return { ...response, qrCodeString: diff --git a/lib/ts/recipe/usermetadata/recipeImplementation.ts b/lib/ts/recipe/usermetadata/recipeImplementation.ts index e2cc0c4f4..33482f988 100644 --- a/lib/ts/recipe/usermetadata/recipeImplementation.ts +++ b/lib/ts/recipe/usermetadata/recipeImplementation.ts @@ -14,7 +14,6 @@ */ import { RecipeInterface } from "."; -import NormalisedURLPath from "../../normalisedURLPath"; import { Querier } from "../../querier"; export default function getRecipeInterface(querier: Querier): RecipeInterface { diff --git a/lib/ts/recipe/userroles/recipeImplementation.ts b/lib/ts/recipe/userroles/recipeImplementation.ts index eb7248411..ae1fa9090 100644 --- a/lib/ts/recipe/userroles/recipeImplementation.ts +++ b/lib/ts/recipe/userroles/recipeImplementation.ts @@ -14,9 +14,7 @@ */ import { RecipeInterface } from "./types"; -import NormalisedURLPath from "../../normalisedURLPath"; import { Querier } from "../../querier"; -import { DEFAULT_TENANT_ID } from "../multitenancy/constants"; export default function getRecipeInterface(querier: Querier): RecipeInterface { return { From 24c715d1122bcacc024df716afd601d76572ec6d Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Wed, 7 May 2025 13:24:22 +0530 Subject: [PATCH 12/64] Fix various type conflicts in the schema --- lib/core/versions/5.3/schema.d.ts | 40 +++++++++++++------ .../oauth2provider/recipeImplementation.ts | 2 +- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/lib/core/versions/5.3/schema.d.ts b/lib/core/versions/5.3/schema.d.ts index d29ed99e8..1fcf9d29a 100644 --- a/lib/core/versions/5.3/schema.d.ts +++ b/lib/core/versions/5.3/schema.d.ts @@ -8588,10 +8588,6 @@ export interface operations { "application/json": { status: components["schemas"]["statusOK"]; createdNew: boolean; - } | { - /** @enum {string} */ - status: "CONFIG_VALIDATION_ERROR"; - reason: string; }; }; }; @@ -9031,7 +9027,11 @@ export interface operations { property1?: string; property2?: string; }; - } | components["schemas"]["oauthError"]; + acr?: string; + amr?: string[]; + challenge: string; + oidcContext?: Record; + }; }; }; 400: components["responses"]["400"]; @@ -9081,6 +9081,12 @@ export interface operations { [key: string]: unknown; }; }; + iss?: string; + tId?: string; + rsub?: string; + sessionHandle?: string; + initialAccessTokenPayload?: Record; + initialIdTokenPayload?: Record; }; }; }; @@ -9095,7 +9101,7 @@ export interface operations { status: components["schemas"]["statusOK"]; /** @example {apiDomain}/oauth/consent?... */ redirectTo?: string; - } | components["schemas"]["oauthError"]; + }; }; }; 400: components["responses"]["400"]; @@ -9147,7 +9153,7 @@ export interface operations { status: components["schemas"]["statusOK"]; /** @example {apiDomain}/oauth/consent?... */ redirectTo?: string; - } | components["schemas"]["oauthError"]; + }; }; }; 400: components["responses"]["400"]; @@ -9188,6 +9194,12 @@ export interface operations { status: components["schemas"]["statusOK"]; challenge?: string; client?: components["schemas"]["oauthClient"]; + requestUrl: string; + requestedAccessTokenAudience?: string[]; + requestedScope?: string[]; + sessionId?: string; + skip?: boolean; + subject?: string; oidcContext?: { acrValues?: string[]; display?: string; @@ -9259,7 +9271,7 @@ export interface operations { status: components["schemas"]["statusOK"]; /** @example {apiDomain}/oauth/login?... */ redirectTo?: string; - } | components["schemas"]["oauthError"]; + }; }; }; 400: components["responses"]["400"]; @@ -9311,7 +9323,7 @@ export interface operations { status: components["schemas"]["statusOK"]; /** @example {apiDomain}/oauth/login?... */ redirectTo?: string; - } | components["schemas"]["oauthError"]; + }; }; }; 400: components["responses"]["400"]; @@ -9520,7 +9532,7 @@ export interface operations { content: { "application/json": { /** @example stcl_fed7cff0-cc6e-406e-b7a6-766148675a4a */ - client_id?: string; + clientId?: string; }; }; }; @@ -9634,7 +9646,10 @@ export interface operations { scope?: string; /** @example bearer */ token_type?: string; - } | components["schemas"]["oauthError"]; + } | components["schemas"]["oauthError"] | { + /** @enum {string} */ + status: "CLIENT_NOT_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -9709,6 +9724,7 @@ export interface operations { content: { "application/json": { token: string; + scope?: string; }; }; }; @@ -9755,7 +9771,7 @@ export interface operations { token_type?: string; /** @example access_token */ token_use?: string; - } | components["schemas"]["oauthError"]; + }; }; }; 400: components["responses"]["400"]; diff --git a/lib/ts/recipe/oauth2provider/recipeImplementation.ts b/lib/ts/recipe/oauth2provider/recipeImplementation.ts index 0a8cdfae0..3b51f2083 100644 --- a/lib/ts/recipe/oauth2provider/recipeImplementation.ts +++ b/lib/ts/recipe/oauth2provider/recipeImplementation.ts @@ -136,7 +136,7 @@ export default function getRecipeInterface( amr: resp.amr, challenge: resp.challenge, client: OAuth2Client.fromAPIResponse(resp.client), - context: resp.context, + context: resp.context as JSONObject, loginChallenge: resp.loginChallenge, loginSessionId: resp.loginSessionId, oidcContext: resp.oidcContext, From 6b7f9a013f6a2118db6a88376458df23ad75fbbc Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Wed, 7 May 2025 13:33:35 +0530 Subject: [PATCH 13/64] Fix passwordless type mismatches --- lib/core/versions/5.3/schema.d.ts | 15 ++++++--------- .../recipe/passwordless/recipeImplementation.ts | 16 +++++++--------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/lib/core/versions/5.3/schema.d.ts b/lib/core/versions/5.3/schema.d.ts index 1fcf9d29a..c838ad8ba 100644 --- a/lib/core/versions/5.3/schema.d.ts +++ b/lib/core/versions/5.3/schema.d.ts @@ -4592,9 +4592,6 @@ export interface operations { linkCode?: components["schemas"]["linkCode"]; timeCreated?: components["schemas"]["timeCreated"]; codeLifetime?: components["schemas"]["codeLifetime"]; - } | { - /** @enum {string} */ - status: "RESTART_FLOW_ERROR" | "USER_INPUT_CODE_ALREADY_USED_ERROR"; }; }; }; @@ -4685,15 +4682,15 @@ export interface operations { "application/json": { status: components["schemas"]["statusOK"]; devices?: { - preAuthSessionId?: components["schemas"]["preAuthSessionId"]; + preAuthSessionId: components["schemas"]["preAuthSessionId"]; /** @example 2 */ - failedCodeInputAttemptCount?: number; + failedCodeInputAttemptCount: number; email?: components["schemas"]["email"]; phoneNumber?: components["schemas"]["phoneNumber"]; - codes?: { - codeId?: components["schemas"]["codeId"]; - timeCreated?: components["schemas"]["timeCreated"]; - codeLifetime?: components["schemas"]["codeLifetime"]; + codes: { + codeId: components["schemas"]["codeId"]; + timeCreated: string; + codeLifetime: components["schemas"]["codeLifetime"]; }[]; }[]; }; diff --git a/lib/ts/recipe/passwordless/recipeImplementation.ts b/lib/ts/recipe/passwordless/recipeImplementation.ts index 4191268e8..9aecfc2d7 100644 --- a/lib/ts/recipe/passwordless/recipeImplementation.ts +++ b/lib/ts/recipe/passwordless/recipeImplementation.ts @@ -42,16 +42,16 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { logDebugMessage("Passwordless.consumeCode code consumed OK"); - response.user = new User(response.user); - response.recipeUserId = new RecipeUserId(response.recipeUserId); + const userAsObj = User.fromApi(response.user); + const recipeUserIdAsObj = new RecipeUserId(response.recipeUserId); // Attempt account linking (this is a sign up) - let updatedUser = response.user; + let updatedUser = userAsObj; const linkResult = await AuthUtils.linkToSessionIfRequiredElseCreatePrimaryUserIdOrLinkByAccountInfo({ tenantId: input.tenantId, - inputUser: response.user, - recipeUserId: response.recipeUserId, + inputUser: userAsObj, + recipeUserId: recipeUserIdAsObj, session: input.session, shouldTryLinkingWithSessionUser: input.shouldTryLinkingWithSessionUser, userContext: input.userContext, @@ -62,14 +62,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { } updatedUser = linkResult.user; - response.user = updatedUser; - return { ...response, consumedDevice: response.consumedDevice, createdNewRecipeUser: response.createdNewUser, - user: response.user!, - recipeUserId: response.recipeUserId!, + user: updatedUser, + recipeUserId: recipeUserIdAsObj, }; }, From 9e165e2955bc45fd9fc8f38e1e89927984d462c3 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Wed, 7 May 2025 14:48:58 +0530 Subject: [PATCH 14/64] Add fixes to thirdparty and usermetadata based on types --- .../recipe/thirdparty/recipeImplementation.ts | 18 +++++++----------- .../usermetadata/recipeImplementation.ts | 10 ++++++++-- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/lib/ts/recipe/thirdparty/recipeImplementation.ts b/lib/ts/recipe/thirdparty/recipeImplementation.ts index ab0571f38..5254301cb 100644 --- a/lib/ts/recipe/thirdparty/recipeImplementation.ts +++ b/lib/ts/recipe/thirdparty/recipeImplementation.ts @@ -71,24 +71,20 @@ export default function getRecipeImplementation(querier: Querier, providers: Pro return response; } - response.user = new User(response.user); - response.recipeUserId = new RecipeUserId(response.recipeUserId); + const userAsObj = User.fromApi(response.user); + const recipeUserIdAsObj = new RecipeUserId(response.recipeUserId); await AccountLinking.getInstance().verifyEmailForRecipeUserIfLinkedAccountsAreVerified({ - user: response.user, - recipeUserId: response.recipeUserId, + user: userAsObj, + recipeUserId: recipeUserIdAsObj, userContext, }); - // we do this so that we get the updated user (in case the above - // function updated the verification status) and can return that - response.user = (await getUser(response.recipeUserId.getAsString(), userContext))!; - const linkResult = await AuthUtils.linkToSessionIfRequiredElseCreatePrimaryUserIdOrLinkByAccountInfo({ tenantId, shouldTryLinkingWithSessionUser, - inputUser: response.user, - recipeUserId: response.recipeUserId, + inputUser: userAsObj, + recipeUserId: recipeUserIdAsObj, session, userContext, }); @@ -101,7 +97,7 @@ export default function getRecipeImplementation(querier: Querier, providers: Pro status: "OK", createdNewRecipeUser: response.createdNewUser, user: linkResult.user, - recipeUserId: response.recipeUserId, + recipeUserId: recipeUserIdAsObj, }; }, diff --git a/lib/ts/recipe/usermetadata/recipeImplementation.ts b/lib/ts/recipe/usermetadata/recipeImplementation.ts index 33482f988..892428abf 100644 --- a/lib/ts/recipe/usermetadata/recipeImplementation.ts +++ b/lib/ts/recipe/usermetadata/recipeImplementation.ts @@ -15,6 +15,7 @@ import { RecipeInterface } from "."; import { Querier } from "../../querier"; +import { JSONObject } from "../../types"; export default function getRecipeInterface(querier: Querier): RecipeInterface { return { @@ -22,8 +23,8 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { return querier.sendGetRequest("/recipe/user/metadata", { userId }, userContext); }, - updateUserMetadata: function ({ userId, metadataUpdate, userContext }) { - return querier.sendPutRequest( + updateUserMetadata: async function ({ userId, metadataUpdate, userContext }) { + const response = await querier.sendPutRequest( "/recipe/user/metadata", { userId, @@ -32,6 +33,11 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { {}, userContext ); + + return { + ...response, + metadata: response.metadata as JSONObject, + }; }, clearUserMetadata: function ({ userId, userContext }) { From cbe9c28f1efe15a5cb093978f0a912812ad46e1e Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Wed, 7 May 2025 15:13:24 +0530 Subject: [PATCH 15/64] Fix some issues with unused variables/imports --- lib/core/versions/5.3/schema.d.ts | 148 ++++++++++++++++-- lib/ts/recipe/dashboard/api/analytics.ts | 1 - .../api/multitenancy/getTenantInfo.ts | 1 - lib/ts/recipe/dashboard/api/signIn.ts | 6 - .../recipe/dashboard/recipeImplementation.ts | 1 - .../emailpassword/recipeImplementation.ts | 1 - .../emailverification/recipeImplementation.ts | 1 - lib/ts/recipe/jwt/recipeImplementation.ts | 1 - .../passwordless/recipeImplementation.ts | 1 - lib/ts/recipe/session/recipeImplementation.ts | 1 - lib/ts/recipe/session/sessionFunctions.ts | 6 +- .../recipe/thirdparty/recipeImplementation.ts | 2 +- .../recipe/webauthn/recipeImplementation.ts | 2 - 13 files changed, 142 insertions(+), 30 deletions(-) diff --git a/lib/core/versions/5.3/schema.d.ts b/lib/core/versions/5.3/schema.d.ts index c838ad8ba..6998ade8b 100644 --- a/lib/core/versions/5.3/schema.d.ts +++ b/lib/core/versions/5.3/schema.d.ts @@ -974,6 +974,28 @@ export interface paths { patch?: never; trace?: never; }; + "/recipe/session/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Delete a sesion + * + * If revoking session by `userId`, the sessions are cleared across all tenants by default. + * + * Note: If `revokeAcrossAllTenants` is set to `true`, this API can only be called from `public` tenant. + * */ + post: operations["deleteSession"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/recipe/session/verify": { parameters: { query?: never; @@ -1032,6 +1054,28 @@ export interface paths { patch?: never; trace?: never; }; + "/recipe/session/user": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get session handles for a user + * + * By default, the session handles are fetched across all tenants. Set `fetchAcrossAllTenants` to `false` to get sessionHandles for the user for a particular tenant. + * + * Note: If `fetchAcrossAllTenants` is set to `true`, this API can only be called from `public` tenant. + * */ + get: operations["getUserSessionHandles"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/recipe/session/regenerate": { parameters: { query?: never; @@ -1190,7 +1234,7 @@ export interface paths { patch?: never; trace?: never; }; - "//recipe/jwt/data": { + "/recipe/jwt/data": { parameters: { query?: never; header?: never; @@ -6197,6 +6241,7 @@ export interface operations { timeCreated?: components["schemas"]["timeCreated"]; sessionHandle?: components["schemas"]["handle"]; tenantId?: components["schemas"]["tenantId"]; + recipeUserId?: components["schemas"]["userId"]; } | components["schemas"]["unauthorisedMessageResponse"]; }; }; @@ -6252,6 +6297,52 @@ export interface operations { 500: components["responses"]["500"]; }; }; + deleteSession: { + parameters: { + query?: never; + header?: { + /** @example session */ + rid?: components["parameters"]["sessionRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + sessionHandles?: components["schemas"]["sessionHandles"]; + } | { + userId: components["schemas"]["userId"]; + revokeAcrossAllTenants?: boolean; + }; + }; + }; + responses: { + /** @description Delete a session */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + sessionHandlesRevoked?: components["schemas"]["sessionHandles"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; verifySession: { parameters: { query?: never; @@ -6351,8 +6442,9 @@ export interface operations { } | { status: components["schemas"]["tokenTheftResponse"]; session?: { - handle?: components["schemas"]["handle"]; - userId?: components["schemas"]["userId"]; + handle: components["schemas"]["handle"]; + userId: components["schemas"]["userId"]; + recipeUserId: components["schemas"]["userId"]; }; } | components["schemas"]["unauthorisedMessageResponse"]; }; @@ -6403,6 +6495,46 @@ export interface operations { 500: components["responses"]["500"]; }; }; + getUserSessionHandles: { + parameters: { + query?: { + userId?: components["parameters"]["userId"]; + fetchAcrossAllTenants?: "true" | "false"; + }; + header?: { + /** @example session */ + rid?: components["parameters"]["sessionRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Get user Session Handles */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + sessionHandles?: components["schemas"]["sessionHandles"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; regenerateSession: { parameters: { query?: never; @@ -7263,14 +7395,12 @@ export interface operations { content: { "application/json": { /** @enum {boolean} */ - exists?: true; + exists: true; /** @example 99c87c72-1807-22d-9b39-7a88f95re56c */ - telemetryId?: string; + telemetryId: string; } | { - /** @example [ - * false - * ] */ - exists?: boolean; + /** @enum {boolean} */ + exists: false; }; }; }; diff --git a/lib/ts/recipe/dashboard/api/analytics.ts b/lib/ts/recipe/dashboard/api/analytics.ts index 4ceb3a928..456264027 100644 --- a/lib/ts/recipe/dashboard/api/analytics.ts +++ b/lib/ts/recipe/dashboard/api/analytics.ts @@ -16,7 +16,6 @@ import { APIInterface, APIOptions } from "../types"; import SuperTokens from "../../../supertokens"; import { Querier } from "../../../querier"; -import NormalisedURLPath from "../../../normalisedURLPath"; import { version as SDKVersion } from "../../../version"; import STError from "../../../error"; import { doFetch } from "../../../utils"; diff --git a/lib/ts/recipe/dashboard/api/multitenancy/getTenantInfo.ts b/lib/ts/recipe/dashboard/api/multitenancy/getTenantInfo.ts index 84258fc5b..56d137cf0 100644 --- a/lib/ts/recipe/dashboard/api/multitenancy/getTenantInfo.ts +++ b/lib/ts/recipe/dashboard/api/multitenancy/getTenantInfo.ts @@ -21,7 +21,6 @@ import { findAndCreateProviderInstance, mergeProvidersFromCoreAndStatic, } from "../../../thirdparty/providers/configUtils"; -import NormalisedURLPath from "../../../../normalisedURLPath"; import { Querier } from "../../../../querier"; import { UserContext } from "../../../../types"; import { DEFAULT_TENANT_ID } from "../../../multitenancy/constants"; diff --git a/lib/ts/recipe/dashboard/api/signIn.ts b/lib/ts/recipe/dashboard/api/signIn.ts index dcc193325..e4067ce2a 100644 --- a/lib/ts/recipe/dashboard/api/signIn.ts +++ b/lib/ts/recipe/dashboard/api/signIn.ts @@ -17,14 +17,8 @@ import { APIInterface, APIOptions } from "../types"; import { send200Response } from "../../../utils"; import STError from "../../../error"; import { Querier } from "../../../querier"; -import NormalisedURLPath from "../../../normalisedURLPath"; import { UserContext } from "../../../types"; -type SignInResponse = - | { status: "OK"; sessionId: string } - | { status: "INVALID_CREDENTIALS_ERROR" } - | { status: "USER_SUSPENDED_ERROR" }; - export default async function signIn(_: APIInterface, options: APIOptions, userContext: UserContext): Promise { const { email, password } = await options.req.getJSONBody(); diff --git a/lib/ts/recipe/dashboard/recipeImplementation.ts b/lib/ts/recipe/dashboard/recipeImplementation.ts index 155b7c973..a000f5d60 100644 --- a/lib/ts/recipe/dashboard/recipeImplementation.ts +++ b/lib/ts/recipe/dashboard/recipeImplementation.ts @@ -15,7 +15,6 @@ import RecipeError from "./error"; import { logDebugMessage } from "../../logger"; -import NormalisedURLPath from "../../normalisedURLPath"; import { Querier } from "../../querier"; import { normaliseHttpMethod } from "../../utils"; import { dashboardVersion } from "../../version"; diff --git a/lib/ts/recipe/emailpassword/recipeImplementation.ts b/lib/ts/recipe/emailpassword/recipeImplementation.ts index 082f83437..16dede2f4 100644 --- a/lib/ts/recipe/emailpassword/recipeImplementation.ts +++ b/lib/ts/recipe/emailpassword/recipeImplementation.ts @@ -2,7 +2,6 @@ import { RecipeInterface, TypeNormalisedInput } from "./types"; import AccountLinking from "../accountlinking/recipe"; import EmailVerification from "../emailverification/recipe"; import { Querier } from "../../querier"; -import NormalisedURLPath from "../../normalisedURLPath"; import { getUser } from "../.."; import { FORM_FIELD_PASSWORD_ID } from "./constants"; import RecipeUserId from "../../recipeUserId"; diff --git a/lib/ts/recipe/emailverification/recipeImplementation.ts b/lib/ts/recipe/emailverification/recipeImplementation.ts index abaf99bd1..634239188 100644 --- a/lib/ts/recipe/emailverification/recipeImplementation.ts +++ b/lib/ts/recipe/emailverification/recipeImplementation.ts @@ -1,6 +1,5 @@ import { RecipeInterface } from "./"; import { Querier } from "../../querier"; -import NormalisedURLPath from "../../normalisedURLPath"; import RecipeUserId from "../../recipeUserId"; import { GetEmailForRecipeUserIdFunc, UserEmailInfo } from "./types"; import { getUser } from "../.."; diff --git a/lib/ts/recipe/jwt/recipeImplementation.ts b/lib/ts/recipe/jwt/recipeImplementation.ts index aade7b227..a354f3746 100644 --- a/lib/ts/recipe/jwt/recipeImplementation.ts +++ b/lib/ts/recipe/jwt/recipeImplementation.ts @@ -13,7 +13,6 @@ * under the License. */ -import NormalisedURLPath from "../../normalisedURLPath"; import { Querier } from "../../querier"; import { NormalisedAppinfo, UserContext } from "../../types"; import { JsonWebKey, RecipeInterface, TypeNormalisedInput } from "./types"; diff --git a/lib/ts/recipe/passwordless/recipeImplementation.ts b/lib/ts/recipe/passwordless/recipeImplementation.ts index 9aecfc2d7..d2cfd0521 100644 --- a/lib/ts/recipe/passwordless/recipeImplementation.ts +++ b/lib/ts/recipe/passwordless/recipeImplementation.ts @@ -2,7 +2,6 @@ import { RecipeInterface } from "./types"; import { Querier } from "../../querier"; import AccountLinking from "../accountlinking/recipe"; import EmailVerification from "../emailverification/recipe"; -import NormalisedURLPath from "../../normalisedURLPath"; import { logDebugMessage } from "../../logger"; import { User } from "../../user"; import { getUser } from "../.."; diff --git a/lib/ts/recipe/session/recipeImplementation.ts b/lib/ts/recipe/session/recipeImplementation.ts index 7f5e752b5..670d43115 100644 --- a/lib/ts/recipe/session/recipeImplementation.ts +++ b/lib/ts/recipe/session/recipeImplementation.ts @@ -13,7 +13,6 @@ import { buildFrontToken } from "./cookieAndHeaders"; import { validateClaimsInPayload } from "./utils"; import Session from "./sessionClass"; import { Querier } from "../../querier"; -import NormalisedURLPath from "../../normalisedURLPath"; import { JSONObject, NormalisedAppinfo, UserContext } from "../../types"; import { logDebugMessage } from "../../logger"; import { ParsedJWTInfo, parseJWTWithoutSignatureVerification } from "./jwt"; diff --git a/lib/ts/recipe/session/sessionFunctions.ts b/lib/ts/recipe/session/sessionFunctions.ts index f5a781a2c..2526797d4 100644 --- a/lib/ts/recipe/session/sessionFunctions.ts +++ b/lib/ts/recipe/session/sessionFunctions.ts @@ -17,7 +17,6 @@ import { ParsedJWTInfo } from "./jwt"; import STError from "./error"; import { PROCESS_STATE, ProcessState } from "../../processState"; import { CreateOrRefreshAPIResponse, SessionInformation, TypeNormalisedInput } from "./types"; -import NormalisedURLPath from "../../normalisedURLPath"; import { Helpers } from "./recipeImplementation"; import { maxVersion } from "../../utils"; import { logDebugMessage } from "../../logger"; @@ -120,7 +119,7 @@ export async function getSession( getCombinedJWKS(config), helpers.config.antiCsrfFunctionOrString === "VIA_TOKEN" && doAntiCsrfCheck ); - } catch (err) { + } catch (err: any) { /** * if error type is not TRY_REFRESH_TOKEN, we return the * error to the user @@ -253,9 +252,8 @@ export async function getSession( ); if (response.status === "OK") { - delete response.status; return { - ...response, + accessToken: response.accessToken, session: { handle: response.session.handle, userId: response.session.userId, diff --git a/lib/ts/recipe/thirdparty/recipeImplementation.ts b/lib/ts/recipe/thirdparty/recipeImplementation.ts index 5254301cb..08b43568c 100644 --- a/lib/ts/recipe/thirdparty/recipeImplementation.ts +++ b/lib/ts/recipe/thirdparty/recipeImplementation.ts @@ -4,7 +4,7 @@ import { findAndCreateProviderInstance, mergeProvidersFromCoreAndStatic } from " import AccountLinking from "../accountlinking/recipe"; import MultitenancyRecipe from "../multitenancy/recipe"; import RecipeUserId from "../../recipeUserId"; -import { getUser, listUsersByAccountInfo } from "../.."; +import { listUsersByAccountInfo } from "../.."; import { User as UserType } from "../../types"; import { User } from "../../user"; import { AuthUtils } from "../../authUtils"; diff --git a/lib/ts/recipe/webauthn/recipeImplementation.ts b/lib/ts/recipe/webauthn/recipeImplementation.ts index 74731f664..e4bb9a18c 100644 --- a/lib/ts/recipe/webauthn/recipeImplementation.ts +++ b/lib/ts/recipe/webauthn/recipeImplementation.ts @@ -16,10 +16,8 @@ import { RecipeInterface, TypeNormalisedInput } from "./types"; import AccountLinking from "../accountlinking/recipe"; import { Querier } from "../../querier"; -import NormalisedURLPath from "../../normalisedURLPath"; import { getUser } from "../.."; import RecipeUserId from "../../recipeUserId"; -import { DEFAULT_TENANT_ID } from "../multitenancy/constants"; import { LoginMethod, User } from "../../user"; import { AuthUtils } from "../../authUtils"; From 90ed34e369bbb4c6b2af3707da769f48bbbfd488 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Wed, 7 May 2025 15:47:29 +0530 Subject: [PATCH 16/64] Update built spec with oauth endpoint returning incorrect status --- lib/core/versions/5.3/schema.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/core/versions/5.3/schema.d.ts b/lib/core/versions/5.3/schema.d.ts index 6998ade8b..4ae084476 100644 --- a/lib/core/versions/5.3/schema.d.ts +++ b/lib/core/versions/5.3/schema.d.ts @@ -8894,7 +8894,10 @@ export interface operations { content: { "application/json": ({ status: components["schemas"]["statusOK"]; - } & components["schemas"]["oauthClient"]) | components["schemas"]["oauthError"]; + } & components["schemas"]["oauthClient"]) | components["schemas"]["oauthError"] | { + /** @enum {string} */ + status: "CLIENT_NOT_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; From cc35817dabf4f33518760ba0c3d1cae890cd21e4 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Thu, 8 May 2025 20:17:25 +0530 Subject: [PATCH 17/64] Update oauth2provider related type fixes --- lib/core/versions/5.3/schema.d.ts | 48 ++++++++++++++++++- .../oauth2provider/recipeImplementation.ts | 2 +- scripts/generate-schema.js | 1 - 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/lib/core/versions/5.3/schema.d.ts b/lib/core/versions/5.3/schema.d.ts index 4ae084476..3bf697120 100644 --- a/lib/core/versions/5.3/schema.d.ts +++ b/lib/core/versions/5.3/schema.d.ts @@ -2650,7 +2650,9 @@ export interface paths { * */ get: operations["getOAuth2Auth"]; put?: never; - post?: never; + /** @description Exchange OAuth2 Auth request for redirect or error. + * */ + post: operations["postOAuth2Auth"]; delete?: never; options?: never; head?: never; @@ -9724,6 +9726,50 @@ export interface operations { 500: components["responses"]["500"]; }; }; + postOAuth2Auth: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + params: Record; + iss: string; + cookies?: string; + session?: { + idToken?: Record; + accessToken?: Record; + }; + }; + }; + }; + responses: { + /** @description OAuth2 auth result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + redirectTo: string; + cookies: string[]; + } | components["schemas"]["oauthError"] | { + /** @enum {string} */ + status: "CLIENT_NOT_FOUND_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; getOAuth2Token: { parameters: { query?: never; diff --git a/lib/ts/recipe/oauth2provider/recipeImplementation.ts b/lib/ts/recipe/oauth2provider/recipeImplementation.ts index 3b51f2083..d1e476bad 100644 --- a/lib/ts/recipe/oauth2provider/recipeImplementation.ts +++ b/lib/ts/recipe/oauth2provider/recipeImplementation.ts @@ -306,7 +306,7 @@ export default function getRecipeInterface( const redirectTo = getUpdatedRedirectTo(appInfo, resp.redirectTo); if (redirectTo === undefined) { - throw new Error(resp.body); + throw new Error("Got redirectTo as undefined, cannot continue"); } const redirectToURL = new URL(redirectTo); const consentChallenge = redirectToURL.searchParams.get("consent_challenge"); diff --git a/scripts/generate-schema.js b/scripts/generate-schema.js index b312702bf..d8502046c 100644 --- a/scripts/generate-schema.js +++ b/scripts/generate-schema.js @@ -1,4 +1,3 @@ -// scripts/generate-schemas.js const fs = require("fs/promises"); const path = require("path"); const { exec } = require("child_process"); From 7b10194421200a3e31b50ebe7136eb1743b31737 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Fri, 9 May 2025 11:30:34 +0530 Subject: [PATCH 18/64] Add build files and pretty fixes --- lib/build/core/paths.d.ts | 3 + lib/build/core/paths.js | 2 + lib/build/core/types.d.ts | 61 + lib/build/core/types.js | 9 + lib/build/customFramework.d.ts | 4 +- lib/build/customFramework.js | 9 +- lib/build/framework/custom/framework.js | 7 +- lib/build/framework/express/framework.js | 7 +- lib/build/framework/fastify/index.d.ts | 8 +- lib/build/framework/index.js | 10 +- lib/build/framework/utils.js | 18 +- lib/build/index.js | 19 +- lib/build/nextjs.js | 7 +- lib/build/querier.d.ts | 88 +- lib/build/querier.js | 28 +- lib/build/recipe/accountlinking/index.js | 13 +- .../accountlinking/recipeImplementation.js | 54 +- lib/build/recipe/accountlinking/types.d.ts | 27 +- lib/build/recipe/dashboard/api/analytics.js | 3 +- .../api/multitenancy/getTenantInfo.js | 8 +- .../api/multitenancy/getThirdPartyConfig.js | 5 +- .../updateTenantSecondaryFactor.js | 5 +- .../dashboard/api/multitenancy/utils.js | 12 +- .../recipe/dashboard/api/search/tagsGet.js | 12 +- lib/build/recipe/dashboard/api/signIn.js | 3 +- lib/build/recipe/dashboard/api/signOut.js | 10 +- lib/build/recipe/dashboard/api/usersGet.d.ts | 4 +- .../recipe/dashboard/recipeImplementation.js | 3 +- lib/build/recipe/dashboard/utils.js | 8 +- .../emailpassword/api/implementation.js | 10 +- .../services/backwardCompatibility/index.d.ts | 3 +- lib/build/recipe/emailpassword/index.js | 14 +- lib/build/recipe/emailpassword/recipe.js | 5 +- .../emailpassword/recipeImplementation.js | 58 +- lib/build/recipe/emailpassword/types.d.ts | 20 +- lib/build/recipe/emailpassword/utils.js | 7 +- .../services/backwardCompatibility/index.d.ts | 3 +- lib/build/recipe/emailverification/index.js | 13 +- .../emailverification/recipeImplementation.js | 26 +- lib/build/recipe/emailverification/types.d.ts | 18 +- lib/build/recipe/jwt/index.d.ts | 4 +- lib/build/recipe/jwt/recipeImplementation.js | 10 +- lib/build/recipe/jwt/types.d.ts | 9 +- .../multifactorauth/api/implementation.js | 9 +- lib/build/recipe/multifactorauth/index.js | 12 +- .../multifactorauth/multiFactorAuthClaim.d.ts | 8 +- .../multifactorauth/recipeImplementation.js | 9 +- lib/build/recipe/multifactorauth/types.d.ts | 6 +- lib/build/recipe/multitenancy/index.d.ts | 4 +- lib/build/recipe/multitenancy/index.js | 12 +- .../multitenancy/recipeImplementation.js | 85 +- lib/build/recipe/multitenancy/types.d.ts | 20 +- .../recipe/oauth2provider/api/userInfo.js | 12 +- lib/build/recipe/oauth2provider/constants.js | 11 +- lib/build/recipe/oauth2provider/index.js | 14 +- .../oauth2provider/recipeImplementation.js | 53 +- lib/build/recipe/oauth2provider/types.d.ts | 48 +- lib/build/recipe/openid/index.d.ts | 4 +- lib/build/recipe/openid/types.d.ts | 9 +- .../recipe/passwordless/api/implementation.js | 7 +- .../services/backwardCompatibility/index.d.ts | 3 +- lib/build/recipe/passwordless/index.js | 19 +- lib/build/recipe/passwordless/recipe.js | 20 +- .../passwordless/recipeImplementation.js | 95 +- lib/build/recipe/passwordless/utils.js | 6 +- lib/build/recipe/session/constants.js | 16 +- lib/build/recipe/session/cookieAndHeaders.js | 16 +- lib/build/recipe/session/index.d.ts | 8 +- lib/build/recipe/session/index.js | 25 +- .../recipe/session/recipeImplementation.js | 3 +- lib/build/recipe/session/sessionFunctions.js | 81 +- .../recipe/session/sessionRequestFunctions.js | 6 +- lib/build/recipe/session/types.d.ts | 12 +- lib/build/recipe/session/utils.js | 15 +- .../thirdparty/providers/configUtils.js | 6 +- .../recipe/thirdparty/providers/custom.js | 14 +- .../recipe/thirdparty/providers/index.js | 15 +- .../recipe/thirdparty/providers/utils.js | 7 +- .../recipe/thirdparty/recipeImplementation.js | 32 +- lib/build/recipe/totp/index.js | 9 +- lib/build/recipe/totp/recipeImplementation.js | 31 +- lib/build/recipe/totp/types.d.ts | 29 +- .../usermetadata/recipeImplementation.js | 21 +- lib/build/recipe/usermetadata/types.d.ts | 16 +- lib/build/recipe/userroles/index.d.ts | 4 +- lib/build/recipe/userroles/index.js | 15 +- .../recipe/userroles/recipeImplementation.js | 72 +- lib/build/recipe/userroles/types.d.ts | 51 +- .../recipe/webauthn/api/implementation.js | 10 +- lib/build/recipe/webauthn/constants.js | 18 +- lib/build/recipe/webauthn/index.d.ts | 5 +- lib/build/recipe/webauthn/index.js | 23 +- lib/build/recipe/webauthn/recipe.js | 5 +- .../recipe/webauthn/recipeImplementation.js | 134 +- lib/build/recipe/webauthn/types.d.ts | 49 +- lib/build/supertokens.js | 19 +- lib/build/thirdpartyUtils.js | 6 +- lib/build/user.d.ts | 5 + lib/build/user.js | 5 + lib/build/utils.js | 34 +- lib/{ => ts}/core/paths.ts | 0 lib/{ => ts}/core/types.ts | 31 +- lib/{ => ts}/core/versions/5.3/schema.d.ts | 1996 +++++++++-------- lib/ts/customFramework.ts | 4 +- lib/ts/nextjs.ts | 4 +- lib/ts/querier.ts | 66 +- lib/ts/recipe/accountlinking/recipe.ts | 23 +- .../accountlinking/recipeImplementation.ts | 98 +- lib/ts/recipe/accountlinking/types.ts | 21 +- .../api/multitenancy/getThirdPartyConfig.ts | 11 +- .../emailpassword/api/implementation.ts | 46 +- .../emailpassword/recipeImplementation.ts | 7 +- lib/ts/recipe/emailpassword/types.ts | 13 +- .../emailverification/recipeImplementation.ts | 3 +- lib/ts/recipe/multifactorauth/types.ts | 6 +- .../multitenancy/recipeImplementation.ts | 6 +- lib/ts/recipe/oauth2provider/api/userInfo.ts | 11 +- .../oauth2provider/recipeImplementation.ts | 12 +- lib/ts/recipe/oauth2provider/types.ts | 5 +- lib/ts/recipe/openid/types.ts | 9 +- .../recipe/passwordless/api/implementation.ts | 7 +- lib/ts/recipe/passwordless/recipe.ts | 20 +- lib/ts/recipe/session/index.ts | 3 +- lib/ts/recipe/session/sessionFunctions.ts | 34 +- lib/ts/recipe/session/types.ts | 6 +- lib/ts/recipe/session/utils.ts | 10 +- .../recipe/userroles/recipeImplementation.ts | 13 +- lib/ts/recipe/webauthn/api/implementation.ts | 35 +- lib/ts/recipe/webauthn/recipe.ts | 5 +- .../recipe/webauthn/recipeImplementation.ts | 6 +- lib/ts/recipe/webauthn/types.ts | 43 +- lib/ts/supertokens.ts | 34 +- package-lock.json | 144 +- package.json | 2 +- test/emailpassword/signinFeature.test.js | 3 +- test/emailverification/apiInterface.test.js | 34 +- 136 files changed, 2627 insertions(+), 2074 deletions(-) create mode 100644 lib/build/core/paths.d.ts create mode 100644 lib/build/core/paths.js create mode 100644 lib/build/core/types.d.ts create mode 100644 lib/build/core/types.js rename lib/{ => ts}/core/paths.ts (100%) rename lib/{ => ts}/core/types.ts (80%) rename lib/{ => ts}/core/versions/5.3/schema.d.ts (85%) diff --git a/lib/build/core/paths.d.ts b/lib/build/core/paths.d.ts new file mode 100644 index 000000000..59a51999c --- /dev/null +++ b/lib/build/core/paths.d.ts @@ -0,0 +1,3 @@ +// @ts-nocheck +import { paths as pathsV5_3 } from "./versions/5.3/schema"; +export declare type paths = pathsV5_3; diff --git a/lib/build/core/paths.js b/lib/build/core/paths.js new file mode 100644 index 000000000..c8ad2e549 --- /dev/null +++ b/lib/build/core/paths.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/lib/build/core/types.d.ts b/lib/build/core/types.d.ts new file mode 100644 index 000000000..4bc9dd71f --- /dev/null +++ b/lib/build/core/types.d.ts @@ -0,0 +1,61 @@ +// @ts-nocheck +/** + * This file contains the types for providing automatic type inference + * for core related method calls that is generated from the OpenAPI spec. + * + * This file is not needed for the core driver interface to work, but it is + * useful for providing type inference for the core related method calls. + */ +import { paths } from "./paths"; +export declare type Method = "get" | "post" | "put" | "delete" | "patch"; +declare type ExtractMethodTypeWithUndefined

= M extends keyof paths[P] + ? paths[P][M] + : never; +export declare type ExtractMethodType

= Exclude< + ExtractMethodTypeWithUndefined, + undefined +>; +declare type MakeAllRequired = { + [K in keyof T]-?: NonNullable; +}; +declare type DeepRequireAllFields = T extends any ? MakeAllRequired : never; +export declare type RequestBody

= ExtractMethodType extends { + requestBody?: infer ReqBody; +} + ? ReqBody extends { + content: { + "application/json": infer R; + }; + } + ? R | undefined + : undefined + : undefined; +export declare type UncleanedResponseBody

= ExtractMethodType extends { + responses: { + 200: { + content: { + "application/json": infer R; + }; + }; + }; +} + ? R + : unknown; +export declare type ResponseBody

= DeepRequireAllFields< + UncleanedResponseBody +>; +declare type ExtractPathParams = T extends `${string}<${infer Param}>${infer Rest}` + ? Param | ExtractPathParams + : never; +declare type PathParamsObject = ExtractPathParams extends never + ? undefined + : { + [K in ExtractPathParams]: string; + }; +export declare type PathParam

= + | P + | { + path: P; + params: PathParamsObject

; + }; +export {}; diff --git a/lib/build/core/types.js b/lib/build/core/types.js new file mode 100644 index 000000000..fa70e988e --- /dev/null +++ b/lib/build/core/types.js @@ -0,0 +1,9 @@ +"use strict"; +/** + * This file contains the types for providing automatic type inference + * for core related method calls that is generated from the OpenAPI spec. + * + * This file is not needed for the core driver interface to work, but it is + * useful for providing type inference for the core related method calls. + */ +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/lib/build/customFramework.d.ts b/lib/build/customFramework.d.ts index d7abeb160..ec107d0fc 100644 --- a/lib/build/customFramework.d.ts +++ b/lib/build/customFramework.d.ts @@ -35,9 +35,7 @@ export declare function getSessionForSSR; -export declare function getSessionForSSRUsingAccessToken( - accessToken: string | undefined -): Promise<{ +export declare function getSessionForSSRUsingAccessToken(accessToken: string | undefined): Promise<{ accessTokenPayload: JWTPayload | undefined; hasToken: boolean; error: Error | undefined; diff --git a/lib/build/customFramework.js b/lib/build/customFramework.js index 25064135d..8c2d5f9ec 100644 --- a/lib/build/customFramework.js +++ b/lib/build/customFramework.js @@ -10,7 +10,14 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.withPreParsedRequestResponse = exports.withSession = exports.getSessionForSSRUsingAccessToken = exports.getSessionForSSR = exports.handleAuthAPIRequest = exports.getQueryFromRequest = exports.getCookieFromRequest = void 0; +exports.withPreParsedRequestResponse = + exports.withSession = + exports.getSessionForSSRUsingAccessToken = + exports.getSessionForSSR = + exports.handleAuthAPIRequest = + exports.getQueryFromRequest = + exports.getCookieFromRequest = + void 0; const cookie_1 = require("cookie"); const custom_1 = require("./framework/custom"); const session_1 = __importDefault(require("./recipe/session")); diff --git a/lib/build/framework/custom/framework.js b/lib/build/framework/custom/framework.js index a321c2ffb..77f875f4b 100644 --- a/lib/build/framework/custom/framework.js +++ b/lib/build/framework/custom/framework.js @@ -19,7 +19,12 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.CustomFrameworkWrapper = exports.errorHandler = exports.middleware = exports.CollectingResponse = exports.PreParsedRequest = void 0; +exports.CustomFrameworkWrapper = + exports.errorHandler = + exports.middleware = + exports.CollectingResponse = + exports.PreParsedRequest = + void 0; const utils_1 = require("../../utils"); const request_1 = require("../request"); const response_1 = require("../response"); diff --git a/lib/build/framework/express/framework.js b/lib/build/framework/express/framework.js index d8a58729b..7b6812f9d 100644 --- a/lib/build/framework/express/framework.js +++ b/lib/build/framework/express/framework.js @@ -19,7 +19,12 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.ExpressWrapper = exports.errorHandler = exports.middleware = exports.ExpressResponse = exports.ExpressRequest = void 0; +exports.ExpressWrapper = + exports.errorHandler = + exports.middleware = + exports.ExpressResponse = + exports.ExpressRequest = + void 0; const utils_1 = require("../../utils"); const request_1 = require("../request"); const response_1 = require("../response"); diff --git a/lib/build/framework/fastify/index.d.ts b/lib/build/framework/fastify/index.d.ts index 878d1ec23..8d9e13a41 100644 --- a/lib/build/framework/fastify/index.d.ts +++ b/lib/build/framework/fastify/index.d.ts @@ -1,10 +1,8 @@ // @ts-nocheck export type { SessionRequest } from "./framework"; -export declare const plugin: import("./types").FastifyPluginCallback>; +export declare const plugin: import("./types").FastifyPluginCallback< + import("./types").FastifyInstance +>; export declare const errorHandler: () => ( err: any, req: import("./types").FastifyRequest, diff --git a/lib/build/framework/index.js b/lib/build/framework/index.js index 28dc9790d..177f21dbd 100644 --- a/lib/build/framework/index.js +++ b/lib/build/framework/index.js @@ -36,7 +36,15 @@ var __importStar = return result; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.awsLambda = exports.koa = exports.loopback = exports.hapi = exports.fastify = exports.express = exports.BaseResponse = exports.BaseRequest = void 0; +exports.awsLambda = + exports.koa = + exports.loopback = + exports.hapi = + exports.fastify = + exports.express = + exports.BaseResponse = + exports.BaseRequest = + void 0; /* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. * * This software is licensed under the Apache License, Version 2.0 (the diff --git a/lib/build/framework/utils.js b/lib/build/framework/utils.js index eb78c07df..54ccc4e69 100644 --- a/lib/build/framework/utils.js +++ b/lib/build/framework/utils.js @@ -51,7 +51,20 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.isBoxedPrimitive = exports.serializeCookieValue = exports.getCookieValueToSetInHeader = exports.setCookieForServerResponse = exports.setHeaderForExpressLikeResponse = exports.assertFormDataBodyParserHasBeenUsedForExpressLikeRequest = exports.assertThatBodyParserHasBeenUsedForExpressLikeRequest = exports.parseURLEncodedFormData = exports.parseJSONBodyFromRequest = exports.normalizeHeaderValue = exports.getHeaderValueFromIncomingMessage = exports.getCookieValueFromIncomingMessage = exports.getCookieValueFromHeaders = void 0; +exports.isBoxedPrimitive = + exports.serializeCookieValue = + exports.getCookieValueToSetInHeader = + exports.setCookieForServerResponse = + exports.setHeaderForExpressLikeResponse = + exports.assertFormDataBodyParserHasBeenUsedForExpressLikeRequest = + exports.assertThatBodyParserHasBeenUsedForExpressLikeRequest = + exports.parseURLEncodedFormData = + exports.parseJSONBodyFromRequest = + exports.normalizeHeaderValue = + exports.getHeaderValueFromIncomingMessage = + exports.getCookieValueFromIncomingMessage = + exports.getCookieValueFromHeaders = + void 0; const cookie_1 = require("cookie"); const error_1 = __importDefault(require("../error")); const constants_1 = require("./constants"); @@ -300,7 +313,8 @@ async function assertFormDataBodyParserHasBeenUsedForExpressLikeRequest(request) } } } -exports.assertFormDataBodyParserHasBeenUsedForExpressLikeRequest = assertFormDataBodyParserHasBeenUsedForExpressLikeRequest; +exports.assertFormDataBodyParserHasBeenUsedForExpressLikeRequest = + assertFormDataBodyParserHasBeenUsedForExpressLikeRequest; function setHeaderForExpressLikeResponse(res, key, value, allowDuplicateKey) { var _a; try { diff --git a/lib/build/index.js b/lib/build/index.js index ecdd1b8b6..799e4b773 100644 --- a/lib/build/index.js +++ b/lib/build/index.js @@ -19,7 +19,24 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.User = exports.RecipeUserId = exports.Error = exports.getRequestFromUserContext = exports.convertToRecipeUserId = exports.listUsersByAccountInfo = exports.getUser = exports.updateOrDeleteUserIdMappingInfo = exports.deleteUserIdMapping = exports.getUserIdMapping = exports.createUserIdMapping = exports.deleteUser = exports.getUsersNewestFirst = exports.getUsersOldestFirst = exports.getUserCount = exports.getAllCORSHeaders = exports.init = void 0; +exports.User = + exports.RecipeUserId = + exports.Error = + exports.getRequestFromUserContext = + exports.convertToRecipeUserId = + exports.listUsersByAccountInfo = + exports.getUser = + exports.updateOrDeleteUserIdMappingInfo = + exports.deleteUserIdMapping = + exports.getUserIdMapping = + exports.createUserIdMapping = + exports.deleteUser = + exports.getUsersNewestFirst = + exports.getUsersOldestFirst = + exports.getUserCount = + exports.getAllCORSHeaders = + exports.init = + void 0; const supertokens_1 = __importDefault(require("./supertokens")); const error_1 = __importDefault(require("./error")); const recipe_1 = __importDefault(require("./recipe/accountlinking/recipe")); diff --git a/lib/build/nextjs.js b/lib/build/nextjs.js index 6ced5eff5..0b00ed904 100644 --- a/lib/build/nextjs.js +++ b/lib/build/nextjs.js @@ -14,7 +14,12 @@ * under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -exports.withPreParsedRequestResponse = exports.withSession = exports.getSSRSession = exports.getAppDirRequestHandler = exports.superTokensNextWrapper = void 0; +exports.withPreParsedRequestResponse = + exports.withSession = + exports.getSSRSession = + exports.getAppDirRequestHandler = + exports.superTokensNextWrapper = + void 0; const express_1 = require("./framework/express"); const customFramework_1 = require("./customFramework"); function next(request, response, resolve, reject) { diff --git a/lib/build/querier.d.ts b/lib/build/querier.d.ts index 17d12763b..d91f6fc11 100644 --- a/lib/build/querier.d.ts +++ b/lib/build/querier.d.ts @@ -3,6 +3,7 @@ import NormalisedURLDomain from "./normalisedURLDomain"; import NormalisedURLPath from "./normalisedURLPath"; import { UserContext } from "./types"; import { NetworkInterceptor } from "./types"; +import { PathParam, RequestBody, ResponseBody } from "./core/types"; export declare class Querier { private static initCalled; private static hosts; @@ -29,34 +30,89 @@ export declare class Querier { networkInterceptor?: NetworkInterceptor, disableCache?: boolean ): void; - sendPostRequest: (path: NormalisedURLPath, body: any, userContext: UserContext) => Promise; - sendDeleteRequest: ( - path: NormalisedURLPath, - body: any, + private getPath; + sendPostRequest:

( + template: PathParam

, + body: RequestBody, + userContext: UserContext + ) => Promise< + import("./core/types").UncleanedResponseBody extends any + ? { + [K in keyof import("./core/types").UncleanedResponseBody]-?: NonNullable< + import("./core/types").UncleanedResponseBody[K] + >; + } + : never + >; + sendDeleteRequest:

( + template: PathParam

, + body: RequestBody, params: any | undefined, userContext: UserContext - ) => Promise; - sendGetRequest: ( - path: NormalisedURLPath, + ) => Promise< + import("./core/types").UncleanedResponseBody extends any + ? { + [K in keyof import("./core/types").UncleanedResponseBody]-?: NonNullable< + import("./core/types").UncleanedResponseBody[K] + >; + } + : never + >; + sendGetRequest:

( + template: PathParam

, params: Record, userContext: UserContext - ) => Promise; - sendGetRequestWithResponseHeaders: ( - path: NormalisedURLPath, + ) => Promise< + import("./core/types").UncleanedResponseBody extends any + ? { + [K in keyof import("./core/types").UncleanedResponseBody]-?: NonNullable< + import("./core/types").UncleanedResponseBody[K] + >; + } + : never + >; + sendGetRequestWithResponseHeaders:

( + template: PathParam

, params: Record, inpHeaders: Record | undefined, userContext: UserContext ) => Promise<{ - body: any; + body: import("./core/types").UncleanedResponseBody extends any + ? { + [K in keyof import("./core/types").UncleanedResponseBody]-?: NonNullable< + import("./core/types").UncleanedResponseBody[K] + >; + } + : never; headers: Headers; }>; - sendPutRequest: ( - path: NormalisedURLPath, - body: any, + sendPutRequest:

( + template: PathParam

, + body: RequestBody, params: Record, userContext: UserContext - ) => Promise; - sendPatchRequest: (path: NormalisedURLPath, body: any, userContext: UserContext) => Promise; + ) => Promise< + import("./core/types").UncleanedResponseBody extends any + ? { + [K in keyof import("./core/types").UncleanedResponseBody]-?: NonNullable< + import("./core/types").UncleanedResponseBody[K] + >; + } + : never + >; + sendPatchRequest:

( + template: PathParam

, + body: RequestBody, + userContext: UserContext + ) => Promise< + import("./core/types").UncleanedResponseBody extends any + ? { + [K in keyof import("./core/types").UncleanedResponseBody]-?: NonNullable< + import("./core/types").UncleanedResponseBody[K] + >; + } + : never + >; invalidateCoreCallCache: (userContext: UserContext, updGlobalCacheTagIfNecessary?: boolean) => void; getAllCoreUrlsForPath(path: string): string[]; private sendRequestHelper; diff --git a/lib/build/querier.js b/lib/build/querier.js index f4190edd7..812ae4bcc 100644 --- a/lib/build/querier.js +++ b/lib/build/querier.js @@ -97,10 +97,21 @@ class Querier { } return Querier.hostsAliveForTesting; }; + this.getPath = (path) => { + var _a; + const template = typeof path === "string" ? path : path.path; + const params = typeof path === "string" ? {} : (_a = path.params) !== null && _a !== void 0 ? _a : {}; + let populated = String(template); + for (const [key, value] of Object.entries(params)) { + populated = populated.replace(new RegExp(`<${key}>\\b`, "g"), String(value)); + } + return new normalisedURLPath_1.default(populated); + }; // path should start with "/" - this.sendPostRequest = async (path, body, userContext) => { + this.sendPostRequest = async (template, body, userContext) => { var _a; this.invalidateCoreCallCache(userContext); + const path = this.getPath(template); const { body: respBody } = await this.sendRequestHelper( path, "POST", @@ -143,9 +154,10 @@ class Querier { return respBody; }; // path should start with "/" - this.sendDeleteRequest = async (path, body, params, userContext) => { + this.sendDeleteRequest = async (template, body, params, userContext) => { var _a; this.invalidateCoreCallCache(userContext); + const path = this.getPath(template); const { body: respBody } = await this.sendRequestHelper( path, "DELETE", @@ -192,8 +204,9 @@ class Querier { return respBody; }; // path should start with "/" - this.sendGetRequest = async (path, params, userContext) => { + this.sendGetRequest = async (template, params, userContext) => { var _a; + const path = this.getPath(template); const { body: respBody } = await this.sendRequestHelper( path, "GET", @@ -295,8 +308,9 @@ class Querier { ); return respBody; }; - this.sendGetRequestWithResponseHeaders = async (path, params, inpHeaders, userContext) => { + this.sendGetRequestWithResponseHeaders = async (template, params, inpHeaders, userContext) => { var _a; + const path = this.getPath(template); return await this.sendRequestHelper( path, "GET", @@ -340,9 +354,10 @@ class Querier { ); }; // path should start with "/" - this.sendPutRequest = async (path, body, params, userContext) => { + this.sendPutRequest = async (template, body, params, userContext) => { var _a; this.invalidateCoreCallCache(userContext); + const path = this.getPath(template); const { body: respBody } = await this.sendRequestHelper( path, "PUT", @@ -388,9 +403,10 @@ class Querier { return respBody; }; // path should start with "/" - this.sendPatchRequest = async (path, body, userContext) => { + this.sendPatchRequest = async (template, body, userContext) => { var _a; this.invalidateCoreCallCache(userContext); + const path = this.getPath(template); const { body: respBody } = await this.sendRequestHelper( path, "PATCH", diff --git a/lib/build/recipe/accountlinking/index.js b/lib/build/recipe/accountlinking/index.js index f65eeeaee..b98f84951 100644 --- a/lib/build/recipe/accountlinking/index.js +++ b/lib/build/recipe/accountlinking/index.js @@ -19,7 +19,18 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.isEmailChangeAllowed = exports.isSignInAllowed = exports.isSignUpAllowed = exports.getPrimaryUserThatCanBeLinkedToRecipeUserId = exports.createPrimaryUserIdOrLinkAccounts = exports.unlinkAccount = exports.linkAccounts = exports.canLinkAccounts = exports.createPrimaryUser = exports.canCreatePrimaryUser = exports.init = void 0; +exports.isEmailChangeAllowed = + exports.isSignInAllowed = + exports.isSignUpAllowed = + exports.getPrimaryUserThatCanBeLinkedToRecipeUserId = + exports.createPrimaryUserIdOrLinkAccounts = + exports.unlinkAccount = + exports.linkAccounts = + exports.canLinkAccounts = + exports.createPrimaryUser = + exports.canCreatePrimaryUser = + exports.init = + void 0; const recipe_1 = __importDefault(require("./recipe")); const __1 = require("../.."); const utils_1 = require("../../utils"); diff --git a/lib/build/recipe/accountlinking/recipeImplementation.js b/lib/build/recipe/accountlinking/recipeImplementation.js index cf6ae1f15..5edbce2fd 100644 --- a/lib/build/recipe/accountlinking/recipeImplementation.js +++ b/lib/build/recipe/accountlinking/recipeImplementation.js @@ -13,13 +13,7 @@ * License for the specific language governing permissions and limitations * under the License. */ -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; Object.defineProperty(exports, "__esModule", { value: true }); -const normalisedURLPath_1 = __importDefault(require("../../normalisedURLPath")); const user_1 = require("../../user"); function getRecipeImplementation(querier, config, recipeInstance) { return { @@ -37,9 +31,12 @@ function getRecipeImplementation(querier, config, recipeInstance) { includeRecipeIdsStr = includeRecipeIds.join(","); } let response = await querier.sendGetRequest( - new normalisedURLPath_1.default( - `${tenantId !== null && tenantId !== void 0 ? tenantId : "public"}/users` - ), + { + path: "//users", + params: { + tenantId: tenantId !== null && tenantId !== void 0 ? tenantId : "public", + }, + }, Object.assign( { includeRecipeIds: includeRecipeIdsStr, @@ -58,7 +55,7 @@ function getRecipeImplementation(querier, config, recipeInstance) { }, canCreatePrimaryUser: async function ({ recipeUserId, userContext }) { return await querier.sendGetRequest( - new normalisedURLPath_1.default("/recipe/accountlinking/user/primary/check"), + "/recipe/accountlinking/user/primary/check", { recipeUserId: recipeUserId.getAsString(), }, @@ -67,20 +64,20 @@ function getRecipeImplementation(querier, config, recipeInstance) { }, createPrimaryUser: async function ({ recipeUserId, userContext }) { let response = await querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/accountlinking/user/primary"), + "/recipe/accountlinking/user/primary", { recipeUserId: recipeUserId.getAsString(), }, userContext ); if (response.status === "OK") { - response.user = new user_1.User(response.user); + return Object.assign(Object.assign({}, response), { user: user_1.User.fromApi(response.user) }); } return response; }, canLinkAccounts: async function ({ recipeUserId, primaryUserId, userContext }) { let result = await querier.sendGetRequest( - new normalisedURLPath_1.default("/recipe/accountlinking/user/link/check"), + "/recipe/accountlinking/user/link/check", { recipeUserId: recipeUserId.getAsString(), primaryUserId, @@ -91,22 +88,20 @@ function getRecipeImplementation(querier, config, recipeInstance) { }, linkAccounts: async function ({ recipeUserId, primaryUserId, userContext }) { const accountsLinkingResult = await querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/accountlinking/user/link"), + "/recipe/accountlinking/user/link", { recipeUserId: recipeUserId.getAsString(), primaryUserId, }, userContext ); - if ( - ["OK", "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"].includes( - accountsLinkingResult.status - ) - ) { - accountsLinkingResult.user = new user_1.User(accountsLinkingResult.user); + if (accountsLinkingResult.status === "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR") { + return Object.assign(Object.assign({}, accountsLinkingResult), { + user: user_1.User.fromApi(accountsLinkingResult.user), + }); } if (accountsLinkingResult.status === "OK") { - let user = accountsLinkingResult.user; + let user = user_1.User.fromApi(accountsLinkingResult.user); if (!accountsLinkingResult.accountsAlreadyLinked) { await recipeInstance.verifyEmailForRecipeUserIfLinkedAccountsAreVerified({ user: user, @@ -129,13 +124,13 @@ function getRecipeImplementation(querier, config, recipeInstance) { } await config.onAccountLinked(user, loginMethodInfo, userContext); } - accountsLinkingResult.user = user; + return Object.assign(Object.assign({}, accountsLinkingResult), { user }); } return accountsLinkingResult; }, unlinkAccount: async function ({ recipeUserId, userContext }) { let accountsUnlinkingResult = await querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/accountlinking/user/unlink"), + "/recipe/accountlinking/user/unlink", { recipeUserId: recipeUserId.getAsString(), }, @@ -145,7 +140,7 @@ function getRecipeImplementation(querier, config, recipeInstance) { }, getUser: async function ({ userId, userContext }) { let result = await querier.sendGetRequest( - new normalisedURLPath_1.default("/user/id"), + "/user/id", { userId, }, @@ -159,9 +154,12 @@ function getRecipeImplementation(querier, config, recipeInstance) { listUsersByAccountInfo: async function ({ tenantId, accountInfo, doUnionOfAccountInfo, userContext }) { var _a, _b, _c; let result = await querier.sendGetRequest( - new normalisedURLPath_1.default( - `${tenantId !== null && tenantId !== void 0 ? tenantId : "public"}/users/by-accountinfo` - ), + { + path: "//users/by-accountinfo", + params: { + tenantId: tenantId !== null && tenantId !== void 0 ? tenantId : "public", + }, + }, { email: accountInfo.email, phoneNumber: accountInfo.phoneNumber, @@ -177,7 +175,7 @@ function getRecipeImplementation(querier, config, recipeInstance) { }, deleteUser: async function ({ userId, removeAllLinkedAccounts, userContext }) { return await querier.sendPostRequest( - new normalisedURLPath_1.default("/user/remove"), + "/user/remove", { userId, removeAllLinkedAccounts, diff --git a/lib/build/recipe/accountlinking/types.d.ts b/lib/build/recipe/accountlinking/types.d.ts index 9d1d54e78..5a9080571 100644 --- a/lib/build/recipe/accountlinking/types.d.ts +++ b/lib/build/recipe/accountlinking/types.d.ts @@ -70,10 +70,7 @@ export declare type RecipeInterface = { users: User[]; nextPaginationToken?: string; }>; - canCreatePrimaryUser: (input: { - recipeUserId: RecipeUserId; - userContext: UserContext; - }) => Promise< + canCreatePrimaryUser: (input: { recipeUserId: RecipeUserId; userContext: UserContext }) => Promise< | { status: "OK"; wasAlreadyAPrimaryUser: boolean; @@ -86,10 +83,7 @@ export declare type RecipeInterface = { description: string; } >; - createPrimaryUser: (input: { - recipeUserId: RecipeUserId; - userContext: UserContext; - }) => Promise< + createPrimaryUser: (input: { recipeUserId: RecipeUserId; userContext: UserContext }) => Promise< | { status: "OK"; user: User; @@ -128,11 +122,7 @@ export declare type RecipeInterface = { status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; } >; - linkAccounts: (input: { - recipeUserId: RecipeUserId; - primaryUserId: string; - userContext: UserContext; - }) => Promise< + linkAccounts: (input: { recipeUserId: RecipeUserId; primaryUserId: string; userContext: UserContext }) => Promise< | { status: "OK"; accountsAlreadyLinked: boolean; @@ -152,10 +142,7 @@ export declare type RecipeInterface = { status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; } >; - unlinkAccount: (input: { - recipeUserId: RecipeUserId; - userContext: UserContext; - }) => Promise<{ + unlinkAccount: (input: { recipeUserId: RecipeUserId; userContext: UserContext }) => Promise<{ status: "OK"; wasRecipeUserDeleted: boolean; wasLinked: boolean; @@ -167,11 +154,7 @@ export declare type RecipeInterface = { doUnionOfAccountInfo: boolean; userContext: UserContext; }) => Promise; - deleteUser: (input: { - userId: string; - removeAllLinkedAccounts: boolean; - userContext: UserContext; - }) => Promise<{ + deleteUser: (input: { userId: string; removeAllLinkedAccounts: boolean; userContext: UserContext }) => Promise<{ status: "OK"; }>; }; diff --git a/lib/build/recipe/dashboard/api/analytics.js b/lib/build/recipe/dashboard/api/analytics.js index 18762e156..6f6bb0460 100644 --- a/lib/build/recipe/dashboard/api/analytics.js +++ b/lib/build/recipe/dashboard/api/analytics.js @@ -21,7 +21,6 @@ var __importDefault = Object.defineProperty(exports, "__esModule", { value: true }); const supertokens_1 = __importDefault(require("../../../supertokens")); const querier_1 = require("../../../querier"); -const normalisedURLPath_1 = __importDefault(require("../../../normalisedURLPath")); const version_1 = require("../../../version"); const error_1 = __importDefault(require("../../../error")); const utils_1 = require("../../../utils"); @@ -49,7 +48,7 @@ async function analyticsPost(_, ___, options, userContext) { let numberOfUsers; try { let querier = querier_1.Querier.getNewInstanceOrThrowError(options.recipeId); - let response = await querier.sendGetRequest(new normalisedURLPath_1.default("/telemetry"), {}, userContext); + let response = await querier.sendGetRequest("/telemetry", {}, userContext); if (response.exists) { telemetryId = response.telemetryId; } diff --git a/lib/build/recipe/dashboard/api/multitenancy/getTenantInfo.js b/lib/build/recipe/dashboard/api/multitenancy/getTenantInfo.js index b7f39cc18..2b743e893 100644 --- a/lib/build/recipe/dashboard/api/multitenancy/getTenantInfo.js +++ b/lib/build/recipe/dashboard/api/multitenancy/getTenantInfo.js @@ -21,7 +21,6 @@ const recipe_1 = __importDefault(require("../../../multitenancy/recipe")); const supertokens_1 = __importDefault(require("../../../../supertokens")); const utils_1 = require("./utils"); const configUtils_1 = require("../../../thirdparty/providers/configUtils"); -const normalisedURLPath_1 = __importDefault(require("../../../../normalisedURLPath")); const querier_1 = require("../../../../querier"); const constants_1 = require("../../../multitenancy/constants"); async function getTenantInfo(_, tenantId, options, userContext) { @@ -60,7 +59,12 @@ async function getTenantInfo(_, tenantId, options, userContext) { ); let querier = querier_1.Querier.getNewInstanceOrThrowError(options.recipeId); let coreConfig = await querier.sendGetRequest( - new normalisedURLPath_1.default(`/${tenantId}/recipe/dashboard/tenant/core-config`), + { + path: "//recipe/dashboard/tenant/core-config", + params: { + tenantId, + }, + }, {}, userContext ); diff --git a/lib/build/recipe/dashboard/api/multitenancy/getThirdPartyConfig.js b/lib/build/recipe/dashboard/api/multitenancy/getThirdPartyConfig.js index 9c73084e7..697db62e8 100644 --- a/lib/build/recipe/dashboard/api/multitenancy/getThirdPartyConfig.js +++ b/lib/build/recipe/dashboard/api/multitenancy/getThirdPartyConfig.js @@ -89,9 +89,8 @@ async function getThirdPartyConfig(_, tenantId, options, userContext) { providersFromCore[0].authorizationEndpoint = undefined; providersFromCore[0].tokenEndpoint = undefined; providersFromCore[0].userInfoEndpoint = undefined; - providersFromCore[0].clients = ((_b = providersFromCore[0].clients) !== null && _b !== void 0 - ? _b - : [] + providersFromCore[0].clients = ( + (_b = providersFromCore[0].clients) !== null && _b !== void 0 ? _b : [] ).map((client) => Object.assign(Object.assign({}, client), { additionalConfig: Object.assign(Object.assign({}, client.additionalConfig), additionalConfig), diff --git a/lib/build/recipe/dashboard/api/multitenancy/updateTenantSecondaryFactor.js b/lib/build/recipe/dashboard/api/multitenancy/updateTenantSecondaryFactor.js index 8729bcb42..122b69b14 100644 --- a/lib/build/recipe/dashboard/api/multitenancy/updateTenantSecondaryFactor.js +++ b/lib/build/recipe/dashboard/api/multitenancy/updateTenantSecondaryFactor.js @@ -35,9 +35,8 @@ async function updateTenantSecondaryFactor(_, tenantId, options, userContext) { }; } } - let secondaryFactors = utils_1.getNormalisedRequiredSecondaryFactorsBasedOnTenantConfigFromCoreAndSDKInit( - tenantRes - ); + let secondaryFactors = + utils_1.getNormalisedRequiredSecondaryFactorsBasedOnTenantConfigFromCoreAndSDKInit(tenantRes); if (enable === true) { if (!secondaryFactors.includes(factorId)) { secondaryFactors.push(factorId); diff --git a/lib/build/recipe/dashboard/api/multitenancy/utils.js b/lib/build/recipe/dashboard/api/multitenancy/utils.js index 0285d3b8f..ba5d5965b 100644 --- a/lib/build/recipe/dashboard/api/multitenancy/utils.js +++ b/lib/build/recipe/dashboard/api/multitenancy/utils.js @@ -5,7 +5,11 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.getFactorNotAvailableMessage = exports.factorIdToRecipe = exports.getNormalisedRequiredSecondaryFactorsBasedOnTenantConfigFromCoreAndSDKInit = exports.getNormalisedFirstFactorsBasedOnTenantConfigFromCoreAndSDKInit = void 0; +exports.getFactorNotAvailableMessage = + exports.factorIdToRecipe = + exports.getNormalisedRequiredSecondaryFactorsBasedOnTenantConfigFromCoreAndSDKInit = + exports.getNormalisedFirstFactorsBasedOnTenantConfigFromCoreAndSDKInit = + void 0; const recipe_1 = __importDefault(require("../../../multitenancy/recipe")); const recipe_2 = __importDefault(require("../../../multifactorauth/recipe")); const utils_1 = require("../../../multitenancy/utils"); @@ -41,7 +45,8 @@ function getNormalisedFirstFactorsBasedOnTenantConfigFromCoreAndSDKInit(tenantDe } return validFirstFactors; } -exports.getNormalisedFirstFactorsBasedOnTenantConfigFromCoreAndSDKInit = getNormalisedFirstFactorsBasedOnTenantConfigFromCoreAndSDKInit; +exports.getNormalisedFirstFactorsBasedOnTenantConfigFromCoreAndSDKInit = + getNormalisedFirstFactorsBasedOnTenantConfigFromCoreAndSDKInit; function getNormalisedRequiredSecondaryFactorsBasedOnTenantConfigFromCoreAndSDKInit(tenantDetailsFromCore) { const mfaInstance = recipe_2.default.getInstance(); if (mfaInstance === undefined) { @@ -56,7 +61,8 @@ function getNormalisedRequiredSecondaryFactorsBasedOnTenantConfigFromCoreAndSDKI }); return secondaryFactors; } -exports.getNormalisedRequiredSecondaryFactorsBasedOnTenantConfigFromCoreAndSDKInit = getNormalisedRequiredSecondaryFactorsBasedOnTenantConfigFromCoreAndSDKInit; +exports.getNormalisedRequiredSecondaryFactorsBasedOnTenantConfigFromCoreAndSDKInit = + getNormalisedRequiredSecondaryFactorsBasedOnTenantConfigFromCoreAndSDKInit; function factorIdToRecipe(factorId) { const factorIdToRecipe = { emailpassword: "Emailpassword", diff --git a/lib/build/recipe/dashboard/api/search/tagsGet.js b/lib/build/recipe/dashboard/api/search/tagsGet.js index 06c87156f..8fa929e30 100644 --- a/lib/build/recipe/dashboard/api/search/tagsGet.js +++ b/lib/build/recipe/dashboard/api/search/tagsGet.js @@ -13,22 +13,12 @@ * License for the specific language governing permissions and limitations * under the License. */ -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getSearchTags = void 0; const querier_1 = require("../../../../querier"); -const normalisedURLPath_1 = __importDefault(require("../../../../normalisedURLPath")); const getSearchTags = async (_, ___, options, userContext) => { let querier = querier_1.Querier.getNewInstanceOrThrowError(options.recipeId); - let tagsResponse = await querier.sendGetRequest( - new normalisedURLPath_1.default("/user/search/tags"), - {}, - userContext - ); + let tagsResponse = await querier.sendGetRequest("/user/search/tags", {}, userContext); return tagsResponse; }; exports.getSearchTags = getSearchTags; diff --git a/lib/build/recipe/dashboard/api/signIn.js b/lib/build/recipe/dashboard/api/signIn.js index 5f52060a2..6e5488e18 100644 --- a/lib/build/recipe/dashboard/api/signIn.js +++ b/lib/build/recipe/dashboard/api/signIn.js @@ -22,7 +22,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); const utils_1 = require("../../../utils"); const error_1 = __importDefault(require("../../../error")); const querier_1 = require("../../../querier"); -const normalisedURLPath_1 = __importDefault(require("../../../normalisedURLPath")); async function signIn(_, options, userContext) { const { email, password } = await options.req.getJSONBody(); if (email === undefined) { @@ -39,7 +38,7 @@ async function signIn(_, options, userContext) { } let querier = querier_1.Querier.getNewInstanceOrThrowError(undefined); const signInResponse = await querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/dashboard/signin"), + "/recipe/dashboard/signin", { email, password, diff --git a/lib/build/recipe/dashboard/api/signOut.js b/lib/build/recipe/dashboard/api/signOut.js index 48e0d22fa..614f1f5ee 100644 --- a/lib/build/recipe/dashboard/api/signOut.js +++ b/lib/build/recipe/dashboard/api/signOut.js @@ -13,15 +13,9 @@ * License for the specific language governing permissions and limitations * under the License. */ -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; Object.defineProperty(exports, "__esModule", { value: true }); const utils_1 = require("../../../utils"); const querier_1 = require("../../../querier"); -const normalisedURLPath_1 = __importDefault(require("../../../normalisedURLPath")); async function signOut(_, ___, options, userContext) { var _a; if (options.config.authMode === "api-key") { @@ -31,8 +25,8 @@ async function signOut(_, ___, options, userContext) { (_a = options.req.getHeaderValue("authorization")) === null || _a === void 0 ? void 0 : _a.split(" ")[1]; let querier = querier_1.Querier.getNewInstanceOrThrowError(undefined); const sessionDeleteResponse = await querier.sendDeleteRequest( - new normalisedURLPath_1.default("/recipe/dashboard/session"), - {}, + "/recipe/dashboard/session", + undefined, { sessionId: sessionIdFormAuthHeader }, userContext ); diff --git a/lib/build/recipe/dashboard/api/usersGet.d.ts b/lib/build/recipe/dashboard/api/usersGet.d.ts index 00834f077..5bfb9dd24 100644 --- a/lib/build/recipe/dashboard/api/usersGet.d.ts +++ b/lib/build/recipe/dashboard/api/usersGet.d.ts @@ -6,8 +6,6 @@ export declare type Response = { users: UserWithFirstAndLastName[]; }; export default function usersGet(_: APIInterface, tenantId: string, options: APIOptions): Promise; -export declare function getSearchParamsFromURL( - path: string -): { +export declare function getSearchParamsFromURL(path: string): { [key: string]: string; }; diff --git a/lib/build/recipe/dashboard/recipeImplementation.js b/lib/build/recipe/dashboard/recipeImplementation.js index 9ad3fa57c..d8a8a18d3 100644 --- a/lib/build/recipe/dashboard/recipeImplementation.js +++ b/lib/build/recipe/dashboard/recipeImplementation.js @@ -21,7 +21,6 @@ var __importDefault = Object.defineProperty(exports, "__esModule", { value: true }); const error_1 = __importDefault(require("./error")); const logger_1 = require("../../logger"); -const normalisedURLPath_1 = __importDefault(require("../../normalisedURLPath")); const querier_1 = require("../../querier"); const utils_1 = require("../../utils"); const version_1 = require("../../version"); @@ -43,7 +42,7 @@ function getRecipeImplementation() { ? void 0 : _a.split(" ")[1]; const sessionVerificationResponse = await querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/dashboard/session/verify"), + "/recipe/dashboard/session/verify", { sessionId: authHeaderValue, }, diff --git a/lib/build/recipe/dashboard/utils.js b/lib/build/recipe/dashboard/utils.js index 81f5cc881..c149c90bc 100644 --- a/lib/build/recipe/dashboard/utils.js +++ b/lib/build/recipe/dashboard/utils.js @@ -19,7 +19,13 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.getApiPathWithDashboardBase = exports.validateApiKey = exports.getUserForRecipeId = exports.isValidRecipeId = exports.sendUnauthorisedAccess = exports.validateAndNormaliseUserInput = void 0; +exports.getApiPathWithDashboardBase = + exports.validateApiKey = + exports.getUserForRecipeId = + exports.isValidRecipeId = + exports.sendUnauthorisedAccess = + exports.validateAndNormaliseUserInput = + void 0; const utils_1 = require("../../utils"); const constants_1 = require("./constants"); const recipe_1 = __importDefault(require("../accountlinking/recipe")); diff --git a/lib/build/recipe/emailpassword/api/implementation.js b/lib/build/recipe/emailpassword/api/implementation.js index 501fe1f30..48ae4ea6e 100644 --- a/lib/build/recipe/emailpassword/api/implementation.js +++ b/lib/build/recipe/emailpassword/api/implementation.js @@ -213,8 +213,7 @@ function getAPIImplementation() { if (!emailVerified && hasOtherEmailOrPhone) { return { status: "PASSWORD_RESET_NOT_ALLOWED", - reason: - "Reset password link was not created because of account take over risk. Please contact support. (ERR_CODE_001)", + reason: "Reset password link was not created because of account take over risk. Please contact support. (ERR_CODE_001)", }; } if (linkingCandidate.isPrimaryUser && emailPasswordAccount !== undefined) { @@ -311,14 +310,13 @@ function getAPIImplementation() { async function markEmailAsVerified(recipeUserId, email) { const emailVerificationInstance = recipe_2.default.getInstance(); if (emailVerificationInstance) { - const tokenResponse = await emailVerificationInstance.recipeInterfaceImpl.createEmailVerificationToken( - { + const tokenResponse = + await emailVerificationInstance.recipeInterfaceImpl.createEmailVerificationToken({ tenantId, recipeUserId, email, userContext, - } - ); + }); if (tokenResponse.status === "OK") { await emailVerificationInstance.recipeInterfaceImpl.verifyEmailUsingToken({ tenantId, diff --git a/lib/build/recipe/emailpassword/emaildelivery/services/backwardCompatibility/index.d.ts b/lib/build/recipe/emailpassword/emaildelivery/services/backwardCompatibility/index.d.ts index 7184fcbbd..bca6a6f17 100644 --- a/lib/build/recipe/emailpassword/emaildelivery/services/backwardCompatibility/index.d.ts +++ b/lib/build/recipe/emailpassword/emaildelivery/services/backwardCompatibility/index.d.ts @@ -3,7 +3,8 @@ import { TypeEmailPasswordEmailDeliveryInput } from "../../../types"; import { NormalisedAppinfo, UserContext } from "../../../../../types"; import { EmailDeliveryInterface } from "../../../../../ingredients/emaildelivery/types"; export default class BackwardCompatibilityService - implements EmailDeliveryInterface { + implements EmailDeliveryInterface +{ private isInServerlessEnv; private appInfo; constructor(appInfo: NormalisedAppinfo, isInServerlessEnv: boolean); diff --git a/lib/build/recipe/emailpassword/index.js b/lib/build/recipe/emailpassword/index.js index 2c77224c0..9e6939af6 100644 --- a/lib/build/recipe/emailpassword/index.js +++ b/lib/build/recipe/emailpassword/index.js @@ -19,7 +19,19 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.sendEmail = exports.sendResetPasswordEmail = exports.createResetPasswordLink = exports.updateEmailOrPassword = exports.consumePasswordResetToken = exports.resetPasswordUsingToken = exports.createResetPasswordToken = exports.verifyCredentials = exports.signIn = exports.signUp = exports.Error = exports.init = void 0; +exports.sendEmail = + exports.sendResetPasswordEmail = + exports.createResetPasswordLink = + exports.updateEmailOrPassword = + exports.consumePasswordResetToken = + exports.resetPasswordUsingToken = + exports.createResetPasswordToken = + exports.verifyCredentials = + exports.signIn = + exports.signUp = + exports.Error = + exports.init = + void 0; const recipe_1 = __importDefault(require("./recipe")); const error_1 = __importDefault(require("./error")); const recipeUserId_1 = __importDefault(require("../../recipeUserId")); diff --git a/lib/build/recipe/emailpassword/recipe.js b/lib/build/recipe/emailpassword/recipe.js index dc968c536..fde4dddb2 100644 --- a/lib/build/recipe/emailpassword/recipe.js +++ b/lib/build/recipe/emailpassword/recipe.js @@ -191,9 +191,8 @@ class Recipe extends recipeModule_1.default { return a.timeJoined - b.timeJoined; }); // Then we take the ones that belong to this recipe - const recipeLoginMethodsOrderedByTimeJoinedOldestFirst = orderedLoginMethodsByTimeJoinedOldestFirst.filter( - (lm) => lm.recipeId === Recipe.RECIPE_ID - ); + const recipeLoginMethodsOrderedByTimeJoinedOldestFirst = + orderedLoginMethodsByTimeJoinedOldestFirst.filter((lm) => lm.recipeId === Recipe.RECIPE_ID); let result; if (recipeLoginMethodsOrderedByTimeJoinedOldestFirst.length !== 0) { // If there are login methods belonging to this recipe, the factor is set up diff --git a/lib/build/recipe/emailpassword/recipeImplementation.js b/lib/build/recipe/emailpassword/recipeImplementation.js index acbbb1c7f..cb8473498 100644 --- a/lib/build/recipe/emailpassword/recipeImplementation.js +++ b/lib/build/recipe/emailpassword/recipeImplementation.js @@ -7,7 +7,6 @@ var __importDefault = Object.defineProperty(exports, "__esModule", { value: true }); const recipe_1 = __importDefault(require("../accountlinking/recipe")); const recipe_2 = __importDefault(require("../emailverification/recipe")); -const normalisedURLPath_1 = __importDefault(require("../../normalisedURLPath")); const __1 = require("../.."); const constants_1 = require("./constants"); const recipeUserId_1 = __importDefault(require("../../recipeUserId")); @@ -27,16 +26,15 @@ function getRecipeInterface(querier, getEmailPasswordConfig) { return response; } let updatedUser = response.user; - const linkResult = await authUtils_1.AuthUtils.linkToSessionIfRequiredElseCreatePrimaryUserIdOrLinkByAccountInfo( - { + const linkResult = + await authUtils_1.AuthUtils.linkToSessionIfRequiredElseCreatePrimaryUserIdOrLinkByAccountInfo({ tenantId, inputUser: response.user, recipeUserId: response.recipeUserId, session, shouldTryLinkingWithSessionUser, userContext, - } - ); + }); if (linkResult.status != "OK") { return linkResult; } @@ -49,9 +47,12 @@ function getRecipeInterface(querier, getEmailPasswordConfig) { }, createNewRecipeUser: async function (input) { const resp = await querier.sendPostRequest( - new normalisedURLPath_1.default( - `/${input.tenantId === undefined ? constants_2.DEFAULT_TENANT_ID : input.tenantId}/recipe/signup` - ), + { + path: "//recipe/signup", + params: { + tenantId: input.tenantId === undefined ? constants_2.DEFAULT_TENANT_ID : input.tenantId, + }, + }, { email: input.email, password: input.password, @@ -94,16 +95,15 @@ function getRecipeInterface(querier, getEmailPasswordConfig) { // function updated the verification status) and can return that response.user = await __1.getUser(response.recipeUserId.getAsString(), userContext); } - const linkResult = await authUtils_1.AuthUtils.linkToSessionIfRequiredElseCreatePrimaryUserIdOrLinkByAccountInfo( - { + const linkResult = + await authUtils_1.AuthUtils.linkToSessionIfRequiredElseCreatePrimaryUserIdOrLinkByAccountInfo({ tenantId, inputUser: response.user, recipeUserId: response.recipeUserId, session, shouldTryLinkingWithSessionUser, userContext, - } - ); + }); if (linkResult.status === "LINKING_TO_SESSION_USER_FAILED") { return linkResult; } @@ -113,9 +113,12 @@ function getRecipeInterface(querier, getEmailPasswordConfig) { }, verifyCredentials: async function ({ email, password, tenantId, userContext }) { const response = await querier.sendPostRequest( - new normalisedURLPath_1.default( - `/${tenantId === undefined ? constants_2.DEFAULT_TENANT_ID : tenantId}/recipe/signin` - ), + { + path: "//recipe/signin", + params: { + tenantId: tenantId === undefined ? constants_2.DEFAULT_TENANT_ID : tenantId, + }, + }, { email, password, @@ -136,11 +139,12 @@ function getRecipeInterface(querier, getEmailPasswordConfig) { createResetPasswordToken: async function ({ userId, email, tenantId, userContext }) { // the input user ID can be a recipe or a primary user ID. return await querier.sendPostRequest( - new normalisedURLPath_1.default( - `/${ - tenantId === undefined ? constants_2.DEFAULT_TENANT_ID : tenantId - }/recipe/user/password/reset/token` - ), + { + path: "//recipe/user/password/reset/token", + params: { + tenantId: tenantId === undefined ? constants_2.DEFAULT_TENANT_ID : tenantId, + }, + }, { userId, email, @@ -150,13 +154,13 @@ function getRecipeInterface(querier, getEmailPasswordConfig) { }, consumePasswordResetToken: async function ({ token, tenantId, userContext }) { return await querier.sendPostRequest( - new normalisedURLPath_1.default( - `/${ - tenantId === undefined ? constants_2.DEFAULT_TENANT_ID : tenantId - }/recipe/user/password/reset/token/consume` - ), { - method: "token", + path: "//recipe/user/password/reset/token/consume", + params: { + tenantId: tenantId === undefined ? constants_2.DEFAULT_TENANT_ID : tenantId, + }, + }, + { token, }, userContext @@ -219,7 +223,7 @@ function getRecipeInterface(querier, getEmailPasswordConfig) { // a change in email. The check for email verification should actually go in // an update email API (post login update). let response = await querier.sendPutRequest( - new normalisedURLPath_1.default(`/recipe/user`), + "/recipe/user", { recipeUserId: input.recipeUserId.getAsString(), email: input.email, diff --git a/lib/build/recipe/emailpassword/types.d.ts b/lib/build/recipe/emailpassword/types.d.ts index fa3eb1408..08a8e94d1 100644 --- a/lib/build/recipe/emailpassword/types.d.ts +++ b/lib/build/recipe/emailpassword/types.d.ts @@ -128,12 +128,7 @@ export declare type RecipeInterface = { | "SESSION_USER_ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; } >; - verifyCredentials(input: { - email: string; - password: string; - tenantId: string; - userContext: UserContext; - }): Promise< + verifyCredentials(input: { email: string; password: string; tenantId: string; userContext: UserContext }): Promise< | { status: "OK"; user: User; @@ -162,11 +157,7 @@ export declare type RecipeInterface = { status: "UNKNOWN_USER_ID_ERROR"; } >; - consumePasswordResetToken(input: { - token: string; - tenantId: string; - userContext: UserContext; - }): Promise< + consumePasswordResetToken(input: { token: string; tenantId: string; userContext: UserContext }): Promise< | { status: "OK"; email: string; @@ -210,12 +201,7 @@ export declare type APIOptions = { export declare type APIInterface = { emailExistsGET: | undefined - | ((input: { - email: string; - tenantId: string; - options: APIOptions; - userContext: UserContext; - }) => Promise< + | ((input: { email: string; tenantId: string; options: APIOptions; userContext: UserContext }) => Promise< | { status: "OK"; exists: boolean; diff --git a/lib/build/recipe/emailpassword/utils.js b/lib/build/recipe/emailpassword/utils.js index 18014af69..b36538a4f 100644 --- a/lib/build/recipe/emailpassword/utils.js +++ b/lib/build/recipe/emailpassword/utils.js @@ -19,7 +19,12 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.getPasswordResetLink = exports.defaultEmailValidator = exports.defaultPasswordValidator = exports.normaliseSignUpFormFields = exports.validateAndNormaliseUserInput = void 0; +exports.getPasswordResetLink = + exports.defaultEmailValidator = + exports.defaultPasswordValidator = + exports.normaliseSignUpFormFields = + exports.validateAndNormaliseUserInput = + void 0; const constants_1 = require("./constants"); const backwardCompatibility_1 = __importDefault(require("./emaildelivery/services/backwardCompatibility")); function validateAndNormaliseUserInput(recipeInstance, appInfo, config) { diff --git a/lib/build/recipe/emailverification/emaildelivery/services/backwardCompatibility/index.d.ts b/lib/build/recipe/emailverification/emaildelivery/services/backwardCompatibility/index.d.ts index d5c7479ac..572911269 100644 --- a/lib/build/recipe/emailverification/emaildelivery/services/backwardCompatibility/index.d.ts +++ b/lib/build/recipe/emailverification/emaildelivery/services/backwardCompatibility/index.d.ts @@ -3,7 +3,8 @@ import { TypeEmailVerificationEmailDeliveryInput } from "../../../types"; import { NormalisedAppinfo, UserContext } from "../../../../../types"; import { EmailDeliveryInterface } from "../../../../../ingredients/emaildelivery/types"; export default class BackwardCompatibilityService - implements EmailDeliveryInterface { + implements EmailDeliveryInterface +{ private appInfo; private isInServerlessEnv; constructor(appInfo: NormalisedAppinfo, isInServerlessEnv: boolean); diff --git a/lib/build/recipe/emailverification/index.js b/lib/build/recipe/emailverification/index.js index af145da81..084d1c0a7 100644 --- a/lib/build/recipe/emailverification/index.js +++ b/lib/build/recipe/emailverification/index.js @@ -19,7 +19,18 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.EmailVerificationClaim = exports.sendEmail = exports.unverifyEmail = exports.revokeEmailVerificationTokens = exports.isEmailVerified = exports.verifyEmailUsingToken = exports.sendEmailVerificationEmail = exports.createEmailVerificationLink = exports.createEmailVerificationToken = exports.Error = exports.init = void 0; +exports.EmailVerificationClaim = + exports.sendEmail = + exports.unverifyEmail = + exports.revokeEmailVerificationTokens = + exports.isEmailVerified = + exports.verifyEmailUsingToken = + exports.sendEmailVerificationEmail = + exports.createEmailVerificationLink = + exports.createEmailVerificationToken = + exports.Error = + exports.init = + void 0; const recipe_1 = __importDefault(require("./recipe")); const error_1 = __importDefault(require("./error")); const emailVerificationClaim_1 = require("./emailVerificationClaim"); diff --git a/lib/build/recipe/emailverification/recipeImplementation.js b/lib/build/recipe/emailverification/recipeImplementation.js index 347bc8f44..20739f9ac 100644 --- a/lib/build/recipe/emailverification/recipeImplementation.js +++ b/lib/build/recipe/emailverification/recipeImplementation.js @@ -5,14 +5,18 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -const normalisedURLPath_1 = __importDefault(require("../../normalisedURLPath")); const recipeUserId_1 = __importDefault(require("../../recipeUserId")); const __1 = require("../.."); function getRecipeInterface(querier, getEmailForRecipeUserId) { return { createEmailVerificationToken: async function ({ recipeUserId, email, tenantId, userContext }) { let response = await querier.sendPostRequest( - new normalisedURLPath_1.default(`/${tenantId}/recipe/user/email/verify/token`), + { + path: "//recipe/user/email/verify/token", + params: { + tenantId, + }, + }, { userId: recipeUserId.getAsString(), email, @@ -32,7 +36,12 @@ function getRecipeInterface(querier, getEmailForRecipeUserId) { }, verifyEmailUsingToken: async function ({ token, attemptAccountLinking, tenantId, userContext }) { let response = await querier.sendPostRequest( - new normalisedURLPath_1.default(`/${tenantId}/recipe/user/email/verify`), + { + path: "//recipe/user/email/verify", + params: { + tenantId, + }, + }, { method: "token", token, @@ -78,7 +87,7 @@ function getRecipeInterface(querier, getEmailForRecipeUserId) { }, isEmailVerified: async function ({ recipeUserId, email, userContext }) { let response = await querier.sendGetRequest( - new normalisedURLPath_1.default("/recipe/user/email/verify"), + "/recipe/user/email/verify", { userId: recipeUserId.getAsString(), email, @@ -89,7 +98,12 @@ function getRecipeInterface(querier, getEmailForRecipeUserId) { }, revokeEmailVerificationTokens: async function (input) { await querier.sendPostRequest( - new normalisedURLPath_1.default(`/${input.tenantId}/recipe/user/email/verify/token/remove`), + { + path: "//recipe/user/email/verify/token/remove", + params: { + tenantId: input.tenantId, + }, + }, { userId: input.recipeUserId.getAsString(), email: input.email, @@ -100,7 +114,7 @@ function getRecipeInterface(querier, getEmailForRecipeUserId) { }, unverifyEmail: async function (input) { await querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/user/email/verify/remove"), + "/recipe/user/email/verify/remove", { userId: input.recipeUserId.getAsString(), email: input.email, diff --git a/lib/build/recipe/emailverification/types.d.ts b/lib/build/recipe/emailverification/types.d.ts index fb0e7c24d..55f3e89d3 100644 --- a/lib/build/recipe/emailverification/types.d.ts +++ b/lib/build/recipe/emailverification/types.d.ts @@ -100,11 +100,7 @@ export declare type RecipeInterface = { }): Promise<{ status: "OK"; }>; - unverifyEmail(input: { - recipeUserId: RecipeUserId; - email: string; - userContext: UserContext; - }): Promise<{ + unverifyEmail(input: { recipeUserId: RecipeUserId; email: string; userContext: UserContext }): Promise<{ status: "OK"; }>; }; @@ -140,11 +136,7 @@ export declare type APIInterface = { >); isEmailVerifiedGET: | undefined - | ((input: { - options: APIOptions; - userContext: UserContext; - session: SessionContainerInterface; - }) => Promise< + | ((input: { options: APIOptions; userContext: UserContext; session: SessionContainerInterface }) => Promise< | { status: "OK"; isVerified: boolean; @@ -154,11 +146,7 @@ export declare type APIInterface = { >); generateEmailVerifyTokenPOST: | undefined - | ((input: { - options: APIOptions; - userContext: UserContext; - session: SessionContainerInterface; - }) => Promise< + | ((input: { options: APIOptions; userContext: UserContext; session: SessionContainerInterface }) => Promise< | { status: "OK"; } diff --git a/lib/build/recipe/jwt/index.d.ts b/lib/build/recipe/jwt/index.d.ts index ed6ab4c4e..734746418 100644 --- a/lib/build/recipe/jwt/index.d.ts +++ b/lib/build/recipe/jwt/index.d.ts @@ -17,9 +17,7 @@ export default class Wrapper { status: "UNSUPPORTED_ALGORITHM_ERROR"; } >; - static getJWKS( - userContext?: Record - ): Promise<{ + static getJWKS(userContext?: Record): Promise<{ keys: JsonWebKey[]; validityInSeconds?: number | undefined; }>; diff --git a/lib/build/recipe/jwt/recipeImplementation.js b/lib/build/recipe/jwt/recipeImplementation.js index 0ac8ddf6f..9cce12755 100644 --- a/lib/build/recipe/jwt/recipeImplementation.js +++ b/lib/build/recipe/jwt/recipeImplementation.js @@ -13,13 +13,7 @@ * License for the specific language governing permissions and limitations * under the License. */ -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; Object.defineProperty(exports, "__esModule", { value: true }); -const normalisedURLPath_1 = __importDefault(require("../../normalisedURLPath")); const defaultJWKSMaxAge = 60; // This corresponds to the dynamicSigningKeyOverlapMS in the core function getRecipeInterface(querier, config, appInfo) { return { @@ -29,7 +23,7 @@ function getRecipeInterface(querier, config, appInfo) { validitySeconds = config.jwtValiditySeconds; } let response = await querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/jwt"), + "/recipe/jwt", { payload: payload !== null && payload !== void 0 ? payload : {}, validity: validitySeconds, @@ -52,7 +46,7 @@ function getRecipeInterface(querier, config, appInfo) { }, getJWKS: async function ({ userContext }) { const { body, headers } = await querier.sendGetRequestWithResponseHeaders( - new normalisedURLPath_1.default("/.well-known/jwks.json"), + "/.well-known/jwks.json", {}, undefined, userContext diff --git a/lib/build/recipe/jwt/types.d.ts b/lib/build/recipe/jwt/types.d.ts index 84c1802ae..b78d5c45e 100644 --- a/lib/build/recipe/jwt/types.d.ts +++ b/lib/build/recipe/jwt/types.d.ts @@ -53,9 +53,7 @@ export declare type RecipeInterface = { status: "UNSUPPORTED_ALGORITHM_ERROR"; } >; - getJWKS(input: { - userContext: UserContext; - }): Promise<{ + getJWKS(input: { userContext: UserContext }): Promise<{ keys: JsonWebKey[]; validityInSeconds?: number; }>; @@ -63,10 +61,7 @@ export declare type RecipeInterface = { export declare type APIInterface = { getJWKSGET: | undefined - | ((input: { - options: APIOptions; - userContext: UserContext; - }) => Promise< + | ((input: { options: APIOptions; userContext: UserContext }) => Promise< | { keys: JsonWebKey[]; } diff --git a/lib/build/recipe/multifactorauth/api/implementation.js b/lib/build/recipe/multifactorauth/api/implementation.js index 954ae11bd..38d01101a 100644 --- a/lib/build/recipe/multifactorauth/api/implementation.js +++ b/lib/build/recipe/multifactorauth/api/implementation.js @@ -72,10 +72,11 @@ function getAPIInterface() { // ignore claims error and not add to the list of factors allowed to be set up } } - const nextSetOfUnsatisfiedFactors = multiFactorAuthClaim_1.MultiFactorAuthClaim.getNextSetOfUnsatisfiedFactors( - mfaInfo.completedFactors, - mfaInfo.mfaRequirementsForAuth - ); + const nextSetOfUnsatisfiedFactors = + multiFactorAuthClaim_1.MultiFactorAuthClaim.getNextSetOfUnsatisfiedFactors( + mfaInfo.completedFactors, + mfaInfo.mfaRequirementsForAuth + ); let getEmailsForFactorsResult = options.recipeInstance.getEmailsForFactors( sessionUser, session.getRecipeUserId(userContext) diff --git a/lib/build/recipe/multifactorauth/index.js b/lib/build/recipe/multifactorauth/index.js index 25e208c4c..8c114acf0 100644 --- a/lib/build/recipe/multifactorauth/index.js +++ b/lib/build/recipe/multifactorauth/index.js @@ -19,7 +19,17 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.FactorIds = exports.MultiFactorAuthClaim = exports.removeFromRequiredSecondaryFactorsForUser = exports.addToRequiredSecondaryFactorsForUser = exports.getMFARequirementsForAuth = exports.getRequiredSecondaryFactorsForUser = exports.getFactorsSetupForUser = exports.markFactorAsCompleteInSession = exports.assertAllowedToSetupFactorElseThrowInvalidClaimError = exports.init = void 0; +exports.FactorIds = + exports.MultiFactorAuthClaim = + exports.removeFromRequiredSecondaryFactorsForUser = + exports.addToRequiredSecondaryFactorsForUser = + exports.getMFARequirementsForAuth = + exports.getRequiredSecondaryFactorsForUser = + exports.getFactorsSetupForUser = + exports.markFactorAsCompleteInSession = + exports.assertAllowedToSetupFactorElseThrowInvalidClaimError = + exports.init = + void 0; const recipe_1 = __importDefault(require("./recipe")); const multiFactorAuthClaim_1 = require("./multiFactorAuthClaim"); Object.defineProperty(exports, "MultiFactorAuthClaim", { diff --git a/lib/build/recipe/multifactorauth/multiFactorAuthClaim.d.ts b/lib/build/recipe/multifactorauth/multiFactorAuthClaim.d.ts index 07976ada7..2ef6410b4 100644 --- a/lib/build/recipe/multifactorauth/multiFactorAuthClaim.d.ts +++ b/lib/build/recipe/multifactorauth/multiFactorAuthClaim.d.ts @@ -50,14 +50,10 @@ export declare class MultiFactorAuthClaimClass extends SessionClaim { + removeFromPayload: (payload: JSONObject) => { [x: string]: import("../../types").JSONValue; }; - removeFromPayloadByMerge_internal: ( - payload: JSONObject - ) => { + removeFromPayloadByMerge_internal: (payload: JSONObject) => { [x: string]: import("../../types").JSONValue; }; getValueFromPayload: (payload: JSONObject) => MFAClaimValue; diff --git a/lib/build/recipe/multifactorauth/recipeImplementation.js b/lib/build/recipe/multifactorauth/recipeImplementation.js index 611743da9..2217ce32f 100644 --- a/lib/build/recipe/multifactorauth/recipeImplementation.js +++ b/lib/build/recipe/multifactorauth/recipeImplementation.js @@ -88,10 +88,11 @@ function getRecipeInterface(recipeInstance) { ); return { isValid: true }; } - const setOfUnsatisfiedFactors = multiFactorAuthClaim_1.MultiFactorAuthClaim.getNextSetOfUnsatisfiedFactors( - claimVal.c, - await input.mfaRequirementsForAuth - ); + const setOfUnsatisfiedFactors = + multiFactorAuthClaim_1.MultiFactorAuthClaim.getNextSetOfUnsatisfiedFactors( + claimVal.c, + await input.mfaRequirementsForAuth + ); const factorsSetUpForUserRes = await input.factorsSetUpForUser; if (setOfUnsatisfiedFactors.factorIds.some((id) => factorsSetUpForUserRes.includes(id))) { logger_1.logDebugMessage( diff --git a/lib/build/recipe/multifactorauth/types.d.ts b/lib/build/recipe/multifactorauth/types.d.ts index e02cbadb4..40db1bdbc 100644 --- a/lib/build/recipe/multifactorauth/types.d.ts +++ b/lib/build/recipe/multifactorauth/types.d.ts @@ -89,11 +89,7 @@ export declare type APIOptions = { export declare type APIInterface = { resyncSessionAndFetchMFAInfoPUT: | undefined - | ((input: { - options: APIOptions; - session: SessionContainerInterface; - userContext: UserContext; - }) => Promise< + | ((input: { options: APIOptions; session: SessionContainerInterface; userContext: UserContext }) => Promise< | { status: "OK"; factors: { diff --git a/lib/build/recipe/multitenancy/index.d.ts b/lib/build/recipe/multitenancy/index.d.ts index 6aef31375..d592eb4be 100644 --- a/lib/build/recipe/multitenancy/index.d.ts +++ b/lib/build/recipe/multitenancy/index.d.ts @@ -36,9 +36,7 @@ export default class Wrapper { } & TenantConfig) | undefined >; - static listAllTenants( - userContext?: Record - ): Promise<{ + static listAllTenants(userContext?: Record): Promise<{ status: "OK"; tenants: ({ tenantId: string; diff --git a/lib/build/recipe/multitenancy/index.js b/lib/build/recipe/multitenancy/index.js index bb6446939..6beb76416 100644 --- a/lib/build/recipe/multitenancy/index.js +++ b/lib/build/recipe/multitenancy/index.js @@ -19,7 +19,17 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.AllowedDomainsClaim = exports.disassociateUserFromTenant = exports.associateUserToTenant = exports.deleteThirdPartyConfig = exports.createOrUpdateThirdPartyConfig = exports.listAllTenants = exports.getTenant = exports.deleteTenant = exports.createOrUpdateTenant = exports.init = void 0; +exports.AllowedDomainsClaim = + exports.disassociateUserFromTenant = + exports.associateUserToTenant = + exports.deleteThirdPartyConfig = + exports.createOrUpdateThirdPartyConfig = + exports.listAllTenants = + exports.getTenant = + exports.deleteTenant = + exports.createOrUpdateTenant = + exports.init = + void 0; const recipe_1 = __importDefault(require("./recipe")); const allowedDomainsClaim_1 = require("./allowedDomainsClaim"); Object.defineProperty(exports, "AllowedDomainsClaim", { diff --git a/lib/build/recipe/multitenancy/recipeImplementation.js b/lib/build/recipe/multitenancy/recipeImplementation.js index 044c7e319..50e21c8cb 100644 --- a/lib/build/recipe/multitenancy/recipeImplementation.js +++ b/lib/build/recipe/multitenancy/recipeImplementation.js @@ -1,11 +1,5 @@ "use strict"; -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; Object.defineProperty(exports, "__esModule", { value: true }); -const normalisedURLPath_1 = __importDefault(require("../../normalisedURLPath")); const constants_1 = require("./constants"); function getRecipeInterface(querier) { return { @@ -14,8 +8,20 @@ function getRecipeInterface(querier) { }, createOrUpdateTenant: async function ({ tenantId, config, userContext }) { let response = await querier.sendPutRequest( - new normalisedURLPath_1.default(`/recipe/multitenancy/tenant/v2`), - Object.assign({ tenantId }, config), + "/recipe/multitenancy/tenant/v2", + Object.assign( + { tenantId }, + { + config: Object.assign(Object.assign({}, config), { + firstFactors: + (config === null || config === void 0 ? void 0 : config.firstFactors) === null + ? undefined + : config === null || config === void 0 + ? void 0 + : config.firstFactors, + }), + } + ), {}, userContext ); @@ -23,7 +29,7 @@ function getRecipeInterface(querier) { }, deleteTenant: async function ({ tenantId, userContext }) { let response = await querier.sendPostRequest( - new normalisedURLPath_1.default(`/recipe/multitenancy/tenant/remove`), + "/recipe/multitenancy/tenant/remove", { tenantId, }, @@ -33,11 +39,12 @@ function getRecipeInterface(querier) { }, getTenant: async function ({ tenantId, userContext }) { let response = await querier.sendGetRequest( - new normalisedURLPath_1.default( - `/${ - tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId - }/recipe/multitenancy/tenant/v2` - ), + { + path: "//recipe/multitenancy/tenant/v2", + params: { + tenantId: tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId, + }, + }, {}, userContext ); @@ -47,20 +54,17 @@ function getRecipeInterface(querier) { return response; }, listAllTenants: async function ({ userContext }) { - let response = await querier.sendGetRequest( - new normalisedURLPath_1.default(`/recipe/multitenancy/tenant/list/v2`), - {}, - userContext - ); + let response = await querier.sendGetRequest("/recipe/multitenancy/tenant/list/v2", {}, userContext); return response; }, createOrUpdateThirdPartyConfig: async function ({ tenantId, config, skipValidation, userContext }) { let response = await querier.sendPutRequest( - new normalisedURLPath_1.default( - `/${ - tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId - }/recipe/multitenancy/config/thirdparty` - ), + { + path: "//recipe/multitenancy/config/thirdparty", + params: { + tenantId: tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId, + }, + }, { config, skipValidation, @@ -72,11 +76,12 @@ function getRecipeInterface(querier) { }, deleteThirdPartyConfig: async function ({ tenantId, thirdPartyId, userContext }) { let response = await querier.sendPostRequest( - new normalisedURLPath_1.default( - `/${ - tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId - }/recipe/multitenancy/config/thirdparty/remove` - ), + { + path: "//recipe/multitenancy/config/thirdparty/remove", + params: { + tenantId: tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId, + }, + }, { thirdPartyId, }, @@ -86,11 +91,12 @@ function getRecipeInterface(querier) { }, associateUserToTenant: async function ({ tenantId, recipeUserId, userContext }) { let response = await querier.sendPostRequest( - new normalisedURLPath_1.default( - `/${ - tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId - }/recipe/multitenancy/tenant/user` - ), + { + path: "//recipe/multitenancy/tenant/user", + params: { + tenantId: tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId, + }, + }, { recipeUserId: recipeUserId.getAsString(), }, @@ -100,11 +106,12 @@ function getRecipeInterface(querier) { }, disassociateUserFromTenant: async function ({ tenantId, recipeUserId, userContext }) { let response = await querier.sendPostRequest( - new normalisedURLPath_1.default( - `/${ - tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId - }/recipe/multitenancy/tenant/user/remove` - ), + { + path: "//recipe/multitenancy/tenant/user/remove", + params: { + tenantId: tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId, + }, + }, { recipeUserId: recipeUserId.getAsString(), }, diff --git a/lib/build/recipe/multitenancy/types.d.ts b/lib/build/recipe/multitenancy/types.d.ts index e3d0008a6..3aff87722 100644 --- a/lib/build/recipe/multitenancy/types.d.ts +++ b/lib/build/recipe/multitenancy/types.d.ts @@ -50,25 +50,17 @@ export declare type RecipeInterface = { status: "OK"; createdNew: boolean; }>; - deleteTenant: (input: { - tenantId: string; - userContext: UserContext; - }) => Promise<{ + deleteTenant: (input: { tenantId: string; userContext: UserContext }) => Promise<{ status: "OK"; didExist: boolean; }>; - getTenant: (input: { - tenantId: string; - userContext: UserContext; - }) => Promise< + getTenant: (input: { tenantId: string; userContext: UserContext }) => Promise< | ({ status: "OK"; } & TenantConfig) | undefined >; - listAllTenants: (input: { - userContext: UserContext; - }) => Promise<{ + listAllTenants: (input: { userContext: UserContext }) => Promise<{ status: "OK"; tenants: (TenantConfig & { tenantId: string; @@ -83,11 +75,7 @@ export declare type RecipeInterface = { status: "OK"; createdNew: boolean; }>; - deleteThirdPartyConfig: (input: { - tenantId: string; - thirdPartyId: string; - userContext: UserContext; - }) => Promise<{ + deleteThirdPartyConfig: (input: { tenantId: string; thirdPartyId: string; userContext: UserContext }) => Promise<{ status: "OK"; didConfigExist: boolean; }>; diff --git a/lib/build/recipe/oauth2provider/api/userInfo.js b/lib/build/recipe/oauth2provider/api/userInfo.js index cfa8f704b..402e6b0e7 100644 --- a/lib/build/recipe/oauth2provider/api/userInfo.js +++ b/lib/build/recipe/oauth2provider/api/userInfo.js @@ -34,12 +34,12 @@ async function userInfoGET(apiImplementation, tenantId, options, userContext) { const accessToken = authHeader.replace(/^Bearer /, "").trim(); let accessTokenPayload; try { - const { - payload, - } = await recipe_1.default.getInstanceOrThrowError().recipeInterfaceImpl.validateOAuth2AccessToken({ - token: accessToken, - userContext, - }); + const { payload } = await recipe_1.default + .getInstanceOrThrowError() + .recipeInterfaceImpl.validateOAuth2AccessToken({ + token: accessToken, + userContext, + }); accessTokenPayload = payload; } catch (error) { options.res.setHeader("WWW-Authenticate", 'Bearer error="invalid_token"', false); diff --git a/lib/build/recipe/oauth2provider/constants.js b/lib/build/recipe/oauth2provider/constants.js index 260e9eb50..e3550b35f 100644 --- a/lib/build/recipe/oauth2provider/constants.js +++ b/lib/build/recipe/oauth2provider/constants.js @@ -14,7 +14,16 @@ * under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -exports.LOGOUT_PATH = exports.END_SESSION_PATH = exports.INTROSPECT_TOKEN_PATH = exports.REVOKE_TOKEN_PATH = exports.USER_INFO_PATH = exports.LOGIN_INFO_PATH = exports.TOKEN_PATH = exports.AUTH_PATH = exports.LOGIN_PATH = void 0; +exports.LOGOUT_PATH = + exports.END_SESSION_PATH = + exports.INTROSPECT_TOKEN_PATH = + exports.REVOKE_TOKEN_PATH = + exports.USER_INFO_PATH = + exports.LOGIN_INFO_PATH = + exports.TOKEN_PATH = + exports.AUTH_PATH = + exports.LOGIN_PATH = + void 0; exports.LOGIN_PATH = "/oauth/login"; exports.AUTH_PATH = "/oauth/auth"; exports.TOKEN_PATH = "/oauth/token"; diff --git a/lib/build/recipe/oauth2provider/index.js b/lib/build/recipe/oauth2provider/index.js index ee4d9b5ed..14799b800 100644 --- a/lib/build/recipe/oauth2provider/index.js +++ b/lib/build/recipe/oauth2provider/index.js @@ -19,7 +19,19 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.revokeTokensBySessionHandle = exports.revokeTokensByClientId = exports.revokeToken = exports.createTokenForClientCredentials = exports.validateOAuth2RefreshToken = exports.validateOAuth2AccessToken = exports.deleteOAuth2Client = exports.updateOAuth2Client = exports.createOAuth2Client = exports.getOAuth2Clients = exports.getOAuth2Client = exports.init = void 0; +exports.revokeTokensBySessionHandle = + exports.revokeTokensByClientId = + exports.revokeToken = + exports.createTokenForClientCredentials = + exports.validateOAuth2RefreshToken = + exports.validateOAuth2AccessToken = + exports.deleteOAuth2Client = + exports.updateOAuth2Client = + exports.createOAuth2Client = + exports.getOAuth2Clients = + exports.getOAuth2Client = + exports.init = + void 0; const utils_1 = require("../../utils"); const recipe_1 = __importDefault(require("./recipe")); class Wrapper { diff --git a/lib/build/recipe/oauth2provider/recipeImplementation.js b/lib/build/recipe/oauth2provider/recipeImplementation.js index f40da4bce..c397127d3 100644 --- a/lib/build/recipe/oauth2provider/recipeImplementation.js +++ b/lib/build/recipe/oauth2provider/recipeImplementation.js @@ -56,7 +56,6 @@ var __importDefault = }; Object.defineProperty(exports, "__esModule", { value: true }); const jose = __importStar(require("jose")); -const normalisedURLPath_1 = __importDefault(require("../../normalisedURLPath")); const OAuth2Client_1 = require("./OAuth2Client"); const __1 = require("../.."); const combinedRemoteJWKSet_1 = require("../../combinedRemoteJWKSet"); @@ -88,7 +87,7 @@ function getRecipeInterface( return { getLoginRequest: async function (input) { const resp = await querier.sendGetRequest( - new normalisedURLPath_1.default("/recipe/oauth/auth/requests/login"), + "/recipe/oauth/auth/requests/login", { loginChallenge: input.challenge }, input.userContext ); @@ -115,7 +114,7 @@ function getRecipeInterface( }, acceptLoginRequest: async function (input) { const resp = await querier.sendPutRequest( - new normalisedURLPath_1.default(`/recipe/oauth/auth/requests/login/accept`), + "/recipe/oauth/auth/requests/login/accept", { acr: input.acr, amr: input.amr, @@ -135,7 +134,7 @@ function getRecipeInterface( }, rejectLoginRequest: async function (input) { const resp = await querier.sendPutRequest( - new normalisedURLPath_1.default(`/recipe/oauth/auth/requests/login/reject`), + "/recipe/oauth/auth/requests/login/reject", { error: input.error.error, errorDescription: input.error.errorDescription, @@ -152,7 +151,7 @@ function getRecipeInterface( }, getConsentRequest: async function (input) { const resp = await querier.sendGetRequest( - new normalisedURLPath_1.default("/recipe/oauth/auth/requests/consent"), + "/recipe/oauth/auth/requests/consent", { consentChallenge: input.challenge }, input.userContext ); @@ -173,7 +172,7 @@ function getRecipeInterface( }, acceptConsentRequest: async function (input) { const resp = await querier.sendPutRequest( - new normalisedURLPath_1.default(`/recipe/oauth/auth/requests/consent/accept`), + "/recipe/oauth/auth/requests/consent/accept", { context: input.context, grantAccessTokenAudience: input.grantAccessTokenAudience, @@ -197,7 +196,7 @@ function getRecipeInterface( }, rejectConsentRequest: async function (input) { const resp = await querier.sendPutRequest( - new normalisedURLPath_1.default(`/recipe/oauth/auth/requests/consent/reject`), + "/recipe/oauth/auth/requests/consent/reject", { error: input.error.error, errorDescription: input.error.errorDescription, @@ -291,7 +290,7 @@ function getRecipeInterface( }; } const resp = await querier.sendPostRequest( - new normalisedURLPath_1.default(`/recipe/oauth/auth`), + "/recipe/oauth/auth", { params: Object.assign(Object.assign({}, input.params), { scope: scopes.join(" ") }), iss: await recipe_2.default.getIssuer(input.userContext), @@ -318,7 +317,7 @@ function getRecipeInterface( } const redirectTo = getUpdatedRedirectTo(appInfo, resp.redirectTo); if (redirectTo === undefined) { - throw new Error(resp.body); + throw new Error("Got redirectTo as undefined, cannot continue"); } const redirectToURL = new URL(redirectTo); const consentChallenge = redirectToURL.searchParams.get("consent_challenge"); @@ -460,11 +459,7 @@ function getRecipeInterface( if (input.authorizationHeader) { body["authorizationHeader"] = input.authorizationHeader; } - const res = await querier.sendPostRequest( - new normalisedURLPath_1.default(`/recipe/oauth/token`), - body, - input.userContext - ); + const res = await querier.sendPostRequest("/recipe/oauth/token", body, input.userContext); if (res.status === "CLIENT_NOT_FOUND_ERROR") { return { status: "ERROR", @@ -485,7 +480,7 @@ function getRecipeInterface( }, getOAuth2Clients: async function (input) { let response = await querier.sendGetRequestWithResponseHeaders( - new normalisedURLPath_1.default(`/recipe/oauth/clients/list`), + "/recipe/oauth/clients/list", { pageSize: input.pageSize, clientName: input.clientName, @@ -510,7 +505,7 @@ function getRecipeInterface( }, getOAuth2Client: async function (input) { let response = await querier.sendGetRequestWithResponseHeaders( - new normalisedURLPath_1.default(`/recipe/oauth/clients`), + "/recipe/oauth/clients", { clientId: input.clientId }, {}, input.userContext @@ -536,7 +531,7 @@ function getRecipeInterface( }, createOAuth2Client: async function (input) { let response = await querier.sendPostRequest( - new normalisedURLPath_1.default(`/recipe/oauth/clients`), + "/recipe/oauth/clients", copyAndCleanRequestBodyInput(input), input.userContext ); @@ -555,7 +550,7 @@ function getRecipeInterface( }, updateOAuth2Client: async function (input) { let response = await querier.sendPutRequest( - new normalisedURLPath_1.default(`/recipe/oauth/clients`), + "/recipe/oauth/clients", copyAndCleanRequestBodyInput(input), { clientId: input.clientId }, input.userContext @@ -575,7 +570,7 @@ function getRecipeInterface( }, deleteOAuth2Client: async function (input) { let response = await querier.sendPostRequest( - new normalisedURLPath_1.default(`/recipe/oauth/clients/remove`), + "/recipe/oauth/clients/remove", { clientId: input.clientId }, input.userContext ); @@ -669,7 +664,7 @@ function getRecipeInterface( } if (input.checkDatabase) { let response = await querier.sendPostRequest( - new normalisedURLPath_1.default(`/recipe/oauth/introspect`), + "/recipe/oauth/introspect", { token: input.token, }, @@ -695,11 +690,7 @@ function getRecipeInterface( requestBody.client_secret = input.clientSecret; } } - const res = await querier.sendPostRequest( - new normalisedURLPath_1.default(`/recipe/oauth/token/revoke`), - requestBody, - input.userContext - ); + const res = await querier.sendPostRequest("/recipe/oauth/token/revoke", requestBody, input.userContext); if (res.status !== "OK") { return { status: "ERROR", @@ -712,7 +703,7 @@ function getRecipeInterface( }, revokeTokensBySessionHandle: async function (input) { await querier.sendPostRequest( - new normalisedURLPath_1.default(`/recipe/oauth/session/revoke`), + "/recipe/oauth/session/revoke", { sessionHandle: input.sessionHandle }, input.userContext ); @@ -720,7 +711,7 @@ function getRecipeInterface( }, revokeTokensByClientId: async function (input) { await querier.sendPostRequest( - new normalisedURLPath_1.default(`/recipe/oauth/tokens/revoke`), + "/recipe/oauth/tokens/revoke", { clientId: input.clientId }, input.userContext ); @@ -746,7 +737,7 @@ function getRecipeInterface( // For tokens that passed local validation or if it's a refresh token, // validate the token with the database by calling the core introspection endpoint const res = await querier.sendPostRequest( - new normalisedURLPath_1.default(`/recipe/oauth/introspect`), + "/recipe/oauth/introspect", { token, scope: scopes ? scopes.join(" ") : undefined, @@ -769,7 +760,7 @@ function getRecipeInterface( * - Redirects to the `post_logout_redirect_uri` or the default logout fallback page. */ const resp = await querier.sendGetRequest( - new normalisedURLPath_1.default(`/recipe/oauth/sessions/logout`), + "/recipe/oauth/sessions/logout", { clientId: input.params.client_id, idTokenHint: input.params.id_token_hint, @@ -828,7 +819,7 @@ function getRecipeInterface( }, acceptLogoutRequest: async function (input) { const resp = await querier.sendPutRequest( - new normalisedURLPath_1.default(`/recipe/oauth/auth/requests/logout/accept`), + "/recipe/oauth/auth/requests/logout/accept", { challenge: input.challenge }, {}, input.userContext @@ -854,7 +845,7 @@ function getRecipeInterface( }, rejectLogoutRequest: async function (input) { const resp = await querier.sendPutRequest( - new normalisedURLPath_1.default(`/recipe/oauth/auth/requests/logout/reject`), + "/recipe/oauth/auth/requests/logout/reject", {}, { challenge: input.challenge }, input.userContext diff --git a/lib/build/recipe/oauth2provider/types.d.ts b/lib/build/recipe/oauth2provider/types.d.ts index 97d4d4624..34805fb3b 100644 --- a/lib/build/recipe/oauth2provider/types.d.ts +++ b/lib/build/recipe/oauth2provider/types.d.ts @@ -129,17 +129,10 @@ export declare type RecipeInterface = { }): Promise<{ redirectTo: string; }>; - rejectConsentRequest(input: { - challenge: string; - error: ErrorOAuth2; - userContext: UserContext; - }): Promise<{ + rejectConsentRequest(input: { challenge: string; error: ErrorOAuth2; userContext: UserContext }): Promise<{ redirectTo: string; }>; - getLoginRequest(input: { - challenge: string; - userContext: UserContext; - }): Promise< + getLoginRequest(input: { challenge: string; userContext: UserContext }): Promise< | (LoginRequest & { status: "OK"; }) @@ -157,17 +150,10 @@ export declare type RecipeInterface = { }): Promise<{ redirectTo: string; }>; - rejectLoginRequest(input: { - challenge: string; - error: ErrorOAuth2; - userContext: UserContext; - }): Promise<{ + rejectLoginRequest(input: { challenge: string; error: ErrorOAuth2; userContext: UserContext }): Promise<{ redirectTo: string; }>; - getOAuth2Client(input: { - clientId: string; - userContext: UserContext; - }): Promise< + getOAuth2Client(input: { clientId: string; userContext: UserContext }): Promise< | { status: "OK"; client: OAuth2Client; @@ -323,16 +309,10 @@ export declare type RecipeInterface = { } | ErrorOAuth2 >; - revokeTokensByClientId(input: { - clientId: string; - userContext: UserContext; - }): Promise<{ + revokeTokensByClientId(input: { clientId: string; userContext: UserContext }): Promise<{ status: "OK"; }>; - revokeTokensBySessionHandle(input: { - sessionHandle: string; - userContext: UserContext; - }): Promise<{ + revokeTokensBySessionHandle(input: { sessionHandle: string; userContext: UserContext }): Promise<{ status: "OK"; }>; introspectToken(input: { @@ -351,19 +331,13 @@ export declare type RecipeInterface = { } | ErrorOAuth2 >; - acceptLogoutRequest(input: { - challenge: string; - userContext: UserContext; - }): Promise< + acceptLogoutRequest(input: { challenge: string; userContext: UserContext }): Promise< | { redirectTo: string; } | ErrorOAuth2 >; - rejectLogoutRequest(input: { - challenge: string; - userContext: UserContext; - }): Promise<{ + rejectLogoutRequest(input: { challenge: string; userContext: UserContext }): Promise<{ status: "OK"; }>; }; @@ -411,11 +385,7 @@ export declare type APIInterface = { }) => Promise); loginInfoGET: | undefined - | ((input: { - loginChallenge: string; - options: APIOptions; - userContext: UserContext; - }) => Promise< + | ((input: { loginChallenge: string; options: APIOptions; userContext: UserContext }) => Promise< | { status: "OK"; info: LoginInfo; diff --git a/lib/build/recipe/openid/index.d.ts b/lib/build/recipe/openid/index.d.ts index 84b55bd8c..7e921973b 100644 --- a/lib/build/recipe/openid/index.d.ts +++ b/lib/build/recipe/openid/index.d.ts @@ -2,9 +2,7 @@ import OpenIdRecipe from "./recipe"; export default class OpenIdRecipeWrapper { static init: typeof OpenIdRecipe.init; - static getOpenIdDiscoveryConfiguration( - userContext?: Record - ): Promise<{ + static getOpenIdDiscoveryConfiguration(userContext?: Record): Promise<{ status: "OK"; issuer: string; jwks_uri: string; diff --git a/lib/build/recipe/openid/types.d.ts b/lib/build/recipe/openid/types.d.ts index b0dda95fd..09cc3ab21 100644 --- a/lib/build/recipe/openid/types.d.ts +++ b/lib/build/recipe/openid/types.d.ts @@ -30,10 +30,7 @@ export declare type APIOptions = { export declare type APIInterface = { getOpenIdDiscoveryConfigurationGET: | undefined - | ((input: { - options: APIOptions; - userContext: UserContext; - }) => Promise< + | ((input: { options: APIOptions; userContext: UserContext }) => Promise< | { status: "OK"; issuer: string; @@ -52,9 +49,7 @@ export declare type APIInterface = { >); }; export declare type RecipeInterface = { - getOpenIdDiscoveryConfiguration(input: { - userContext: UserContext; - }): Promise<{ + getOpenIdDiscoveryConfiguration(input: { userContext: UserContext }): Promise<{ status: "OK"; issuer: string; jwks_uri: string; diff --git a/lib/build/recipe/passwordless/api/implementation.js b/lib/build/recipe/passwordless/api/implementation.js index 0936acc2c..171fdc6d2 100644 --- a/lib/build/recipe/passwordless/api/implementation.js +++ b/lib/build/recipe/passwordless/api/implementation.js @@ -120,14 +120,13 @@ function getAPIImplementation() { if (loginMethod.hasSameEmailAs(accountInfo.email) && !loginMethod.verified) { // We first check that the submitted code is actually valid if (await checkCredentials()) { - const tokenResponse = await emailVerificationInstance.recipeInterfaceImpl.createEmailVerificationToken( - { + const tokenResponse = + await emailVerificationInstance.recipeInterfaceImpl.createEmailVerificationToken({ tenantId: input.tenantId, recipeUserId: loginMethod.recipeUserId, email: accountInfo.email, userContext: input.userContext, - } - ); + }); if (tokenResponse.status === "OK") { await emailVerificationInstance.recipeInterfaceImpl.verifyEmailUsingToken({ tenantId: input.tenantId, diff --git a/lib/build/recipe/passwordless/emaildelivery/services/backwardCompatibility/index.d.ts b/lib/build/recipe/passwordless/emaildelivery/services/backwardCompatibility/index.d.ts index 3c47b9d5a..f062dc699 100644 --- a/lib/build/recipe/passwordless/emaildelivery/services/backwardCompatibility/index.d.ts +++ b/lib/build/recipe/passwordless/emaildelivery/services/backwardCompatibility/index.d.ts @@ -3,7 +3,8 @@ import { TypePasswordlessEmailDeliveryInput } from "../../../types"; import { EmailDeliveryInterface } from "../../../../../ingredients/emaildelivery/types"; import { NormalisedAppinfo, UserContext } from "../../../../../types"; export default class BackwardCompatibilityService - implements EmailDeliveryInterface { + implements EmailDeliveryInterface +{ private appInfo; constructor(appInfo: NormalisedAppinfo); sendEmail: ( diff --git a/lib/build/recipe/passwordless/index.js b/lib/build/recipe/passwordless/index.js index 285ccb9ed..68d007a27 100644 --- a/lib/build/recipe/passwordless/index.js +++ b/lib/build/recipe/passwordless/index.js @@ -19,7 +19,24 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.sendSms = exports.sendEmail = exports.checkCode = exports.signInUp = exports.createMagicLink = exports.revokeCode = exports.revokeAllCodes = exports.updateUser = exports.createNewCodeForDevice = exports.listCodesByPreAuthSessionId = exports.listCodesByPhoneNumber = exports.listCodesByEmail = exports.listCodesByDeviceId = exports.consumeCode = exports.createCode = exports.Error = exports.init = void 0; +exports.sendSms = + exports.sendEmail = + exports.checkCode = + exports.signInUp = + exports.createMagicLink = + exports.revokeCode = + exports.revokeAllCodes = + exports.updateUser = + exports.createNewCodeForDevice = + exports.listCodesByPreAuthSessionId = + exports.listCodesByPhoneNumber = + exports.listCodesByEmail = + exports.listCodesByDeviceId = + exports.consumeCode = + exports.createCode = + exports.Error = + exports.init = + void 0; const recipe_1 = __importDefault(require("./recipe")); const error_1 = __importDefault(require("./error")); const __1 = require("../.."); diff --git a/lib/build/recipe/passwordless/recipe.js b/lib/build/recipe/passwordless/recipe.js index 6ff155b8b..68109548e 100644 --- a/lib/build/recipe/passwordless/recipe.js +++ b/lib/build/recipe/passwordless/recipe.js @@ -378,14 +378,12 @@ class Recipe extends recipeModule_1.default { // object. let factorIdToEmailsMap = {}; if (allFactors.includes(multifactorauth_1.FactorIds.OTP_EMAIL)) { - factorIdToEmailsMap[ - multifactorauth_1.FactorIds.OTP_EMAIL - ] = nonFakeEmailsThatPasswordlessLoginMethodOrderedByTimeJoined; + factorIdToEmailsMap[multifactorauth_1.FactorIds.OTP_EMAIL] = + nonFakeEmailsThatPasswordlessLoginMethodOrderedByTimeJoined; } if (allFactors.includes(multifactorauth_1.FactorIds.LINK_EMAIL)) { - factorIdToEmailsMap[ - multifactorauth_1.FactorIds.LINK_EMAIL - ] = nonFakeEmailsThatPasswordlessLoginMethodOrderedByTimeJoined; + factorIdToEmailsMap[multifactorauth_1.FactorIds.LINK_EMAIL] = + nonFakeEmailsThatPasswordlessLoginMethodOrderedByTimeJoined; } return { status: "OK", @@ -498,14 +496,12 @@ class Recipe extends recipeModule_1.default { // object. let factorIdToPhoneNumberMap = {}; if (allFactors.includes(multifactorauth_1.FactorIds.OTP_PHONE)) { - factorIdToPhoneNumberMap[ - multifactorauth_1.FactorIds.OTP_PHONE - ] = phoneNumbersThatPasswordlessLoginMethodOrderedByTimeJoined; + factorIdToPhoneNumberMap[multifactorauth_1.FactorIds.OTP_PHONE] = + phoneNumbersThatPasswordlessLoginMethodOrderedByTimeJoined; } if (allFactors.includes(multifactorauth_1.FactorIds.LINK_PHONE)) { - factorIdToPhoneNumberMap[ - multifactorauth_1.FactorIds.LINK_PHONE - ] = phoneNumbersThatPasswordlessLoginMethodOrderedByTimeJoined; + factorIdToPhoneNumberMap[multifactorauth_1.FactorIds.LINK_PHONE] = + phoneNumbersThatPasswordlessLoginMethodOrderedByTimeJoined; } return { status: "OK", diff --git a/lib/build/recipe/passwordless/recipeImplementation.js b/lib/build/recipe/passwordless/recipeImplementation.js index d2fb36376..9b693b05a 100644 --- a/lib/build/recipe/passwordless/recipeImplementation.js +++ b/lib/build/recipe/passwordless/recipeImplementation.js @@ -7,7 +7,6 @@ var __importDefault = Object.defineProperty(exports, "__esModule", { value: true }); const recipe_1 = __importDefault(require("../accountlinking/recipe")); const recipe_2 = __importDefault(require("../emailverification/recipe")); -const normalisedURLPath_1 = __importDefault(require("../../normalisedURLPath")); const logger_1 = require("../../logger"); const user_1 = require("../../user"); const __1 = require("../.."); @@ -27,7 +26,12 @@ function getRecipeInterface(querier) { return { consumeCode: async function (input) { const response = await querier.sendPostRequest( - new normalisedURLPath_1.default(`/${input.tenantId}/recipe/signinup/code/consume`), + { + path: "//recipe/signinup/code/consume", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -35,35 +39,38 @@ function getRecipeInterface(querier) { return response; } logger_1.logDebugMessage("Passwordless.consumeCode code consumed OK"); - response.user = new user_1.User(response.user); - response.recipeUserId = new recipeUserId_1.default(response.recipeUserId); + const userAsObj = user_1.User.fromApi(response.user); + const recipeUserIdAsObj = new recipeUserId_1.default(response.recipeUserId); // Attempt account linking (this is a sign up) - let updatedUser = response.user; - const linkResult = await authUtils_1.AuthUtils.linkToSessionIfRequiredElseCreatePrimaryUserIdOrLinkByAccountInfo( - { + let updatedUser = userAsObj; + const linkResult = + await authUtils_1.AuthUtils.linkToSessionIfRequiredElseCreatePrimaryUserIdOrLinkByAccountInfo({ tenantId: input.tenantId, - inputUser: response.user, - recipeUserId: response.recipeUserId, + inputUser: userAsObj, + recipeUserId: recipeUserIdAsObj, session: input.session, shouldTryLinkingWithSessionUser: input.shouldTryLinkingWithSessionUser, userContext: input.userContext, - } - ); + }); if (linkResult.status !== "OK") { return linkResult; } updatedUser = linkResult.user; - response.user = updatedUser; return Object.assign(Object.assign({}, response), { consumedDevice: response.consumedDevice, createdNewRecipeUser: response.createdNewUser, - user: response.user, - recipeUserId: response.recipeUserId, + user: updatedUser, + recipeUserId: recipeUserIdAsObj, }); }, checkCode: async function (input) { let response = await querier.sendPostRequest( - new normalisedURLPath_1.default(`/${input.tenantId}/recipe/signinup/code/check`), + { + path: "//recipe/signinup/code/check", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -75,7 +82,12 @@ function getRecipeInterface(querier) { }, createCode: async function (input) { let response = await querier.sendPostRequest( - new normalisedURLPath_1.default(`/${input.tenantId}/recipe/signinup/code`), + { + path: "//recipe/signinup/code", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -83,7 +95,12 @@ function getRecipeInterface(querier) { }, createNewCodeForDevice: async function (input) { let response = await querier.sendPostRequest( - new normalisedURLPath_1.default(`/${input.tenantId}/recipe/signinup/code`), + { + path: "//recipe/signinup/code", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -91,7 +108,12 @@ function getRecipeInterface(querier) { }, listCodesByDeviceId: async function (input) { let response = await querier.sendGetRequest( - new normalisedURLPath_1.default(`/${input.tenantId}/recipe/signinup/codes`), + { + path: "//recipe/signinup/codes", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -99,7 +121,12 @@ function getRecipeInterface(querier) { }, listCodesByEmail: async function (input) { let response = await querier.sendGetRequest( - new normalisedURLPath_1.default(`/${input.tenantId}/recipe/signinup/codes`), + { + path: "//recipe/signinup/codes", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -107,7 +134,12 @@ function getRecipeInterface(querier) { }, listCodesByPhoneNumber: async function (input) { let response = await querier.sendGetRequest( - new normalisedURLPath_1.default(`/${input.tenantId}/recipe/signinup/codes`), + { + path: "//recipe/signinup/codes", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -115,7 +147,12 @@ function getRecipeInterface(querier) { }, listCodesByPreAuthSessionId: async function (input) { let response = await querier.sendGetRequest( - new normalisedURLPath_1.default(`/${input.tenantId}/recipe/signinup/codes`), + { + path: "//recipe/signinup/codes", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -123,7 +160,12 @@ function getRecipeInterface(querier) { }, revokeAllCodes: async function (input) { await querier.sendPostRequest( - new normalisedURLPath_1.default(`/${input.tenantId}/recipe/signinup/codes/remove`), + { + path: "//recipe/signinup/codes/remove", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -133,7 +175,12 @@ function getRecipeInterface(querier) { }, revokeCode: async function (input) { await querier.sendPostRequest( - new normalisedURLPath_1.default(`/${input.tenantId}/recipe/signinup/code/remove`), + { + path: "//recipe/signinup/code/remove", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -173,7 +220,7 @@ function getRecipeInterface(querier) { } } let response = await querier.sendPutRequest( - new normalisedURLPath_1.default(`/recipe/user`), + "/recipe/user", copyAndRemoveUserContextAndTenantId(input), {}, input.userContext diff --git a/lib/build/recipe/passwordless/utils.js b/lib/build/recipe/passwordless/utils.js index 951335f9f..c21cf9b58 100644 --- a/lib/build/recipe/passwordless/utils.js +++ b/lib/build/recipe/passwordless/utils.js @@ -19,7 +19,11 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.getEnabledPwlessFactors = exports.defaultValidateEmail = exports.defaultValidatePhoneNumber = exports.validateAndNormaliseUserInput = void 0; +exports.getEnabledPwlessFactors = + exports.defaultValidateEmail = + exports.defaultValidatePhoneNumber = + exports.validateAndNormaliseUserInput = + void 0; const max_1 = __importDefault(require("libphonenumber-js/max")); const backwardCompatibility_1 = __importDefault(require("./emaildelivery/services/backwardCompatibility")); const backwardCompatibility_2 = __importDefault(require("./smsdelivery/services/backwardCompatibility")); diff --git a/lib/build/recipe/session/constants.js b/lib/build/recipe/session/constants.js index e196684e5..82fdcadde 100644 --- a/lib/build/recipe/session/constants.js +++ b/lib/build/recipe/session/constants.js @@ -14,7 +14,21 @@ * under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -exports.authModeHeaderKey = exports.frontTokenHeaderKey = exports.antiCsrfHeaderKey = exports.refreshTokenHeaderKey = exports.refreshTokenCookieKey = exports.accessTokenCookieKey = exports.accessTokenHeaderKey = exports.authorizationHeaderKey = exports.protectedProps = exports.JWKCacheCooldownInMs = exports.oneYearInMs = exports.availableTokenTransferMethods = exports.SIGNOUT_API_PATH = exports.REFRESH_API_PATH = void 0; +exports.authModeHeaderKey = + exports.frontTokenHeaderKey = + exports.antiCsrfHeaderKey = + exports.refreshTokenHeaderKey = + exports.refreshTokenCookieKey = + exports.accessTokenCookieKey = + exports.accessTokenHeaderKey = + exports.authorizationHeaderKey = + exports.protectedProps = + exports.JWKCacheCooldownInMs = + exports.oneYearInMs = + exports.availableTokenTransferMethods = + exports.SIGNOUT_API_PATH = + exports.REFRESH_API_PATH = + void 0; exports.REFRESH_API_PATH = "/session/refresh"; exports.SIGNOUT_API_PATH = "/signout"; exports.availableTokenTransferMethods = ["cookie", "header"]; diff --git a/lib/build/recipe/session/cookieAndHeaders.js b/lib/build/recipe/session/cookieAndHeaders.js index 2bf01f8aa..d103c3807 100644 --- a/lib/build/recipe/session/cookieAndHeaders.js +++ b/lib/build/recipe/session/cookieAndHeaders.js @@ -5,7 +5,21 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.hasMultipleCookiesForTokenType = exports.clearSessionCookiesFromOlderCookieDomain = exports.getAuthModeFromHeader = exports.setCookie = exports.setHeader = exports.setToken = exports.getToken = exports.getCORSAllowedHeaders = exports.setFrontTokenInHeaders = exports.buildFrontToken = exports.setAntiCsrfTokenInHeaders = exports.getAntiCsrfTokenFromHeaders = exports.clearSession = exports.clearSessionFromAllTokenTransferMethods = void 0; +exports.hasMultipleCookiesForTokenType = + exports.clearSessionCookiesFromOlderCookieDomain = + exports.getAuthModeFromHeader = + exports.setCookie = + exports.setHeader = + exports.setToken = + exports.getToken = + exports.getCORSAllowedHeaders = + exports.setFrontTokenInHeaders = + exports.buildFrontToken = + exports.setAntiCsrfTokenInHeaders = + exports.getAntiCsrfTokenFromHeaders = + exports.clearSession = + exports.clearSessionFromAllTokenTransferMethods = + void 0; /* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. * * This software is licensed under the Apache License, Version 2.0 (the diff --git a/lib/build/recipe/session/index.d.ts b/lib/build/recipe/session/index.d.ts index 8115d4727..034b3562f 100644 --- a/lib/build/recipe/session/index.d.ts +++ b/lib/build/recipe/session/index.d.ts @@ -166,15 +166,11 @@ export default class SessionWrapper { status: "UNSUPPORTED_ALGORITHM_ERROR"; } >; - static getJWKS( - userContext?: Record - ): Promise<{ + static getJWKS(userContext?: Record): Promise<{ keys: import("../jwt").JsonWebKey[]; validityInSeconds?: number | undefined; }>; - static getOpenIdDiscoveryConfiguration( - userContext?: Record - ): Promise<{ + static getOpenIdDiscoveryConfiguration(userContext?: Record): Promise<{ status: "OK"; issuer: string; jwks_uri: string; diff --git a/lib/build/recipe/session/index.js b/lib/build/recipe/session/index.js index ad7855e98..94a6c1f80 100644 --- a/lib/build/recipe/session/index.js +++ b/lib/build/recipe/session/index.js @@ -19,7 +19,30 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.getOpenIdDiscoveryConfiguration = exports.getJWKS = exports.createJWT = exports.Error = exports.validateClaimsForSessionHandle = exports.removeClaim = exports.getClaimValue = exports.setClaimValue = exports.fetchAndSetClaim = exports.mergeIntoAccessTokenPayload = exports.updateSessionDataInDatabase = exports.revokeMultipleSessions = exports.revokeSession = exports.getAllSessionHandlesForUser = exports.revokeAllSessionsForUser = exports.refreshSessionWithoutRequestResponse = exports.refreshSession = exports.getSessionInformation = exports.getSessionWithoutRequestResponse = exports.getSession = exports.createNewSessionWithoutRequestResponse = exports.createNewSession = exports.init = void 0; +exports.getOpenIdDiscoveryConfiguration = + exports.getJWKS = + exports.createJWT = + exports.Error = + exports.validateClaimsForSessionHandle = + exports.removeClaim = + exports.getClaimValue = + exports.setClaimValue = + exports.fetchAndSetClaim = + exports.mergeIntoAccessTokenPayload = + exports.updateSessionDataInDatabase = + exports.revokeMultipleSessions = + exports.revokeSession = + exports.getAllSessionHandlesForUser = + exports.revokeAllSessionsForUser = + exports.refreshSessionWithoutRequestResponse = + exports.refreshSession = + exports.getSessionInformation = + exports.getSessionWithoutRequestResponse = + exports.getSession = + exports.createNewSessionWithoutRequestResponse = + exports.createNewSession = + exports.init = + void 0; const error_1 = __importDefault(require("./error")); const recipe_1 = __importDefault(require("./recipe")); const recipe_2 = __importDefault(require("../openid/recipe")); diff --git a/lib/build/recipe/session/recipeImplementation.js b/lib/build/recipe/session/recipeImplementation.js index 7dbba30ec..2a1b8071f 100644 --- a/lib/build/recipe/session/recipeImplementation.js +++ b/lib/build/recipe/session/recipeImplementation.js @@ -45,7 +45,6 @@ const SessionFunctions = __importStar(require("./sessionFunctions")); const cookieAndHeaders_1 = require("./cookieAndHeaders"); const utils_1 = require("./utils"); const sessionClass_1 = __importDefault(require("./sessionClass")); -const normalisedURLPath_1 = __importDefault(require("../../normalisedURLPath")); const logger_1 = require("../../logger"); const jwt_1 = require("./jwt"); const accessToken_1 = require("./accessToken"); @@ -267,7 +266,7 @@ function getRecipeInterface(querier, config, appInfo, getRecipeImplAfterOverride ? {} : input.newAccessTokenPayload; let response = await querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/session/regenerate"), + "/recipe/session/regenerate", { accessToken: input.accessToken, userDataInJWT: newAccessTokenPayload, diff --git a/lib/build/recipe/session/sessionFunctions.js b/lib/build/recipe/session/sessionFunctions.js index f939f0367..0b1785610 100644 --- a/lib/build/recipe/session/sessionFunctions.js +++ b/lib/build/recipe/session/sessionFunctions.js @@ -5,7 +5,17 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.updateAccessTokenPayload = exports.updateSessionDataInDatabase = exports.revokeMultipleSessions = exports.revokeSession = exports.getAllSessionHandlesForUser = exports.revokeAllSessionsForUser = exports.refreshSession = exports.getSessionInformation = exports.getSession = exports.createNewSession = void 0; +exports.updateAccessTokenPayload = + exports.updateSessionDataInDatabase = + exports.revokeMultipleSessions = + exports.revokeSession = + exports.getAllSessionHandlesForUser = + exports.revokeAllSessionsForUser = + exports.refreshSession = + exports.getSessionInformation = + exports.getSession = + exports.createNewSession = + void 0; /* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. * * This software is licensed under the Apache License, Version 2.0 (the @@ -23,7 +33,6 @@ exports.updateAccessTokenPayload = exports.updateSessionDataInDatabase = exports const accessToken_1 = require("./accessToken"); const error_1 = __importDefault(require("./error")); const processState_1 = require("../../processState"); -const normalisedURLPath_1 = __importDefault(require("../../normalisedURLPath")); const utils_1 = require("../../utils"); const logger_1 = require("../../logger"); const recipeUserId_1 = __importDefault(require("../../recipeUserId")); @@ -53,7 +62,12 @@ async function createNewSession( enableAntiCsrf: !disableAntiCsrf && helpers.config.antiCsrfFunctionOrString === "VIA_TOKEN", }; let response = await helpers.querier.sendPostRequest( - new normalisedURLPath_1.default(`/${tenantId}/recipe/session`), + { + path: "//recipe/session", + params: { + tenantId: tenantId, + }, + }, requestBody, userContext ); @@ -219,14 +233,10 @@ async function getSession( enableAntiCsrf: helpers.config.antiCsrfFunctionOrString === "VIA_TOKEN", checkDatabase: alwaysCheckCore, }; - let response = await helpers.querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/session/verify"), - requestBody, - userContext - ); + let response = await helpers.querier.sendPostRequest("/recipe/session/verify", requestBody, userContext); if (response.status === "OK") { - delete response.status; - return Object.assign(Object.assign({}, response), { + return { + accessToken: response.accessToken, session: { handle: response.session.handle, userId: response.session.userId, @@ -241,7 +251,7 @@ async function getSession( constants_1.DEFAULT_TENANT_ID, userDataInJWT: response.session.userDataInJWT, }, - }); + }; } else if (response.status === "UNAUTHORISED") { logger_1.logDebugMessage("getSession: Returning UNAUTHORISED because of core response"); throw new error_1.default({ @@ -267,7 +277,7 @@ async function getSessionInformation(helpers, sessionHandle, userContext) { throw new Error("Please use core version >= 3.5 to call this function."); } let response = await helpers.querier.sendGetRequest( - new normalisedURLPath_1.default(`/recipe/session`), + "/recipe/session", { sessionHandle, }, @@ -317,11 +327,7 @@ async function refreshSession( // There we can add a bit more information to the error, so that's the primary check, this is just making sure. throw new Error("Please either use VIA_TOKEN, NONE or call with doAntiCsrfCheck false"); } - let response = await helpers.querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/session/refresh"), - requestBody, - userContext - ); + let response = await helpers.querier.sendPostRequest("/recipe/session/refresh", requestBody, userContext); if (response.status === "OK") { return { session: { @@ -378,15 +384,23 @@ async function revokeAllSessionsForUser( if (tenantId === undefined) { tenantId = constants_1.DEFAULT_TENANT_ID; } - let response = await helpers.querier.sendPostRequest( - new normalisedURLPath_1.default( - revokeAcrossAllTenants ? `/recipe/session/remove` : `/${tenantId}/recipe/session/remove` - ), + const body = { + userId, + revokeSessionsForLinkedAccounts, + revokeAcrossAllTenants, + }; + if (revokeAcrossAllTenants) { + const response = await helpers.querier.sendPostRequest("/recipe/session/remove", body, userContext); + return response.sessionHandlesRevoked; + } + const response = await helpers.querier.sendPostRequest( { - userId, - revokeSessionsForLinkedAccounts, - revokeAcrossAllTenants, + path: "//recipe/session/remove", + params: { + tenantId: tenantId, + }, }, + body, userContext ); return response.sessionHandlesRevoked; @@ -407,9 +421,14 @@ async function getAllSessionHandlesForUser( tenantId = constants_1.DEFAULT_TENANT_ID; } let response = await helpers.querier.sendGetRequest( - new normalisedURLPath_1.default( - fetchAcrossAllTenants ? `/recipe/session/user` : `/${tenantId}/recipe/session/user` - ), + fetchAcrossAllTenants + ? "/recipe/session/user" + : { + path: "//recipe/session/user", + params: { + tenantId: tenantId, + }, + }, { userId, fetchSessionsForAllLinkedAccounts, @@ -426,7 +445,7 @@ exports.getAllSessionHandlesForUser = getAllSessionHandlesForUser; */ async function revokeSession(helpers, sessionHandle, userContext) { let response = await helpers.querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/session/remove"), + "/recipe/session/remove", { sessionHandles: [sessionHandle], }, @@ -441,7 +460,7 @@ exports.revokeSession = revokeSession; */ async function revokeMultipleSessions(helpers, sessionHandles, userContext) { let response = await helpers.querier.sendPostRequest( - new normalisedURLPath_1.default(`/recipe/session/remove`), + "/recipe/session/remove", { sessionHandles, }, @@ -456,7 +475,7 @@ exports.revokeMultipleSessions = revokeMultipleSessions; async function updateSessionDataInDatabase(helpers, sessionHandle, newSessionData, userContext) { newSessionData = newSessionData === null || newSessionData === undefined ? {} : newSessionData; let response = await helpers.querier.sendPutRequest( - new normalisedURLPath_1.default(`/recipe/session/data`), + "/recipe/session/data", { sessionHandle, userDataInDatabase: newSessionData, @@ -474,7 +493,7 @@ async function updateAccessTokenPayload(helpers, sessionHandle, newAccessTokenPa newAccessTokenPayload = newAccessTokenPayload === null || newAccessTokenPayload === undefined ? {} : newAccessTokenPayload; let response = await helpers.querier.sendPutRequest( - new normalisedURLPath_1.default("/recipe/jwt/data"), + "/recipe/jwt/data", { sessionHandle, userDataInJWT: newAccessTokenPayload, diff --git a/lib/build/recipe/session/sessionRequestFunctions.js b/lib/build/recipe/session/sessionRequestFunctions.js index d3a49abbe..6d3b90857 100644 --- a/lib/build/recipe/session/sessionRequestFunctions.js +++ b/lib/build/recipe/session/sessionRequestFunctions.js @@ -5,7 +5,11 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.createNewSessionInRequest = exports.refreshSessionInRequest = exports.getAccessTokenFromRequest = exports.getSessionFromRequest = void 0; +exports.createNewSessionInRequest = + exports.refreshSessionInRequest = + exports.getAccessTokenFromRequest = + exports.getSessionFromRequest = + void 0; const framework_1 = __importDefault(require("../../framework")); const supertokens_1 = __importDefault(require("../../supertokens")); const recipe_1 = __importDefault(require("../openid/recipe")); diff --git a/lib/build/recipe/session/types.d.ts b/lib/build/recipe/session/types.d.ts index 8a1d06794..4fe3983b2 100644 --- a/lib/build/recipe/session/types.d.ts +++ b/lib/build/recipe/session/types.d.ts @@ -254,11 +254,7 @@ export declare type RecipeInterface = { value: T; userContext: UserContext; }): Promise; - getClaimValue(input: { - sessionHandle: string; - claim: SessionClaim; - userContext: UserContext; - }): Promise< + getClaimValue(input: { sessionHandle: string; claim: SessionClaim; userContext: UserContext }): Promise< | { status: "SESSION_DOES_NOT_EXIST_ERROR"; } @@ -315,11 +311,7 @@ export declare type APIInterface = { | ((input: { options: APIOptions; userContext: UserContext }) => Promise); signOutPOST: | undefined - | ((input: { - options: APIOptions; - session: SessionContainerInterface; - userContext: UserContext; - }) => Promise< + | ((input: { options: APIOptions; session: SessionContainerInterface; userContext: UserContext }) => Promise< | { status: "OK"; } diff --git a/lib/build/recipe/session/utils.js b/lib/build/recipe/session/utils.js index 501b39f96..c8a3f9848 100644 --- a/lib/build/recipe/session/utils.js +++ b/lib/build/recipe/session/utils.js @@ -19,7 +19,20 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.getResponseHeaderNameForTokenType = exports.getCookieNameForTokenType = exports.validateClaimsInPayload = exports.getRequiredClaimValidators = exports.setAccessTokenInResponse = exports.normaliseSameSiteOrThrowError = exports.validateAndNormaliseUserInput = exports.getURLProtocol = exports.normaliseSessionScopeOrThrowError = exports.sendTokenTheftDetectedResponse = exports.sendInvalidClaimResponse = exports.sendUnauthorisedResponse = exports.sendTryRefreshTokenResponse = void 0; +exports.getResponseHeaderNameForTokenType = + exports.getCookieNameForTokenType = + exports.validateClaimsInPayload = + exports.getRequiredClaimValidators = + exports.setAccessTokenInResponse = + exports.normaliseSameSiteOrThrowError = + exports.validateAndNormaliseUserInput = + exports.getURLProtocol = + exports.normaliseSessionScopeOrThrowError = + exports.sendTokenTheftDetectedResponse = + exports.sendInvalidClaimResponse = + exports.sendUnauthorisedResponse = + exports.sendTryRefreshTokenResponse = + void 0; const cookieAndHeaders_1 = require("./cookieAndHeaders"); const recipe_1 = __importDefault(require("./recipe")); const constants_1 = require("./constants"); diff --git a/lib/build/recipe/thirdparty/providers/configUtils.js b/lib/build/recipe/thirdparty/providers/configUtils.js index f0be656c4..90e4a4aa1 100644 --- a/lib/build/recipe/thirdparty/providers/configUtils.js +++ b/lib/build/recipe/thirdparty/providers/configUtils.js @@ -5,7 +5,11 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.mergeProvidersFromCoreAndStatic = exports.mergeConfig = exports.findAndCreateProviderInstance = exports.getProviderConfigForClient = void 0; +exports.mergeProvidersFromCoreAndStatic = + exports.mergeConfig = + exports.findAndCreateProviderInstance = + exports.getProviderConfigForClient = + void 0; const _1 = require("."); const custom_1 = __importDefault(require("./custom")); const utils_1 = require("./utils"); diff --git a/lib/build/recipe/thirdparty/providers/custom.js b/lib/build/recipe/thirdparty/providers/custom.js index 9c182c222..feb3b04c6 100644 --- a/lib/build/recipe/thirdparty/providers/custom.js +++ b/lib/build/recipe/thirdparty/providers/custom.js @@ -5,7 +5,10 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.getActualClientIdFromDevelopmentClientId = exports.isUsingDevelopmentClientId = exports.DEV_OAUTH_REDIRECT_URL = void 0; +exports.getActualClientIdFromDevelopmentClientId = + exports.isUsingDevelopmentClientId = + exports.DEV_OAUTH_REDIRECT_URL = + void 0; const thirdpartyUtils_1 = require("../../../thirdpartyUtils"); const utils_1 = require("../../../utils"); const pkce_challenge_1 = __importDefault(require("pkce-challenge")); @@ -285,13 +288,10 @@ function NewProvider(input) { if (jwks === undefined) { jwks = jose_1.createRemoteJWKSet(new URL(impl.config.jwksURI)); } - rawUserInfoFromProvider.fromIdTokenPayload = await thirdpartyUtils_1.verifyIdTokenFromJWKSEndpointAndGetPayload( - idToken, - jwks, - { + rawUserInfoFromProvider.fromIdTokenPayload = + await thirdpartyUtils_1.verifyIdTokenFromJWKSEndpointAndGetPayload(idToken, jwks, { audience: getActualClientIdFromDevelopmentClientId(impl.config.clientId), - } - ); + }); if (impl.config.validateIdTokenPayload !== undefined) { await impl.config.validateIdTokenPayload({ idTokenPayload: rawUserInfoFromProvider.fromIdTokenPayload, diff --git a/lib/build/recipe/thirdparty/providers/index.js b/lib/build/recipe/thirdparty/providers/index.js index 345d7f130..59f7195aa 100644 --- a/lib/build/recipe/thirdparty/providers/index.js +++ b/lib/build/recipe/thirdparty/providers/index.js @@ -5,7 +5,20 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.Twitter = exports.Gitlab = exports.Bitbucket = exports.Okta = exports.Linkedin = exports.GoogleWorkspaces = exports.Google = exports.Github = exports.Facebook = exports.Discord = exports.Apple = exports.BoxySAML = exports.ActiveDirectory = void 0; +exports.Twitter = + exports.Gitlab = + exports.Bitbucket = + exports.Okta = + exports.Linkedin = + exports.GoogleWorkspaces = + exports.Google = + exports.Github = + exports.Facebook = + exports.Discord = + exports.Apple = + exports.BoxySAML = + exports.ActiveDirectory = + void 0; const activeDirectory_1 = __importDefault(require("./activeDirectory")); const boxySaml_1 = __importDefault(require("./boxySaml")); const apple_1 = __importDefault(require("./apple")); diff --git a/lib/build/recipe/thirdparty/providers/utils.js b/lib/build/recipe/thirdparty/providers/utils.js index 52637b2dd..d5f5edfff 100644 --- a/lib/build/recipe/thirdparty/providers/utils.js +++ b/lib/build/recipe/thirdparty/providers/utils.js @@ -41,7 +41,12 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.normaliseOIDCEndpointToIncludeWellKnown = exports.discoverOIDCEndpoints = exports.verifyIdTokenFromJWKSEndpointAndGetPayload = exports.doPostRequest = exports.doGetRequest = void 0; +exports.normaliseOIDCEndpointToIncludeWellKnown = + exports.discoverOIDCEndpoints = + exports.verifyIdTokenFromJWKSEndpointAndGetPayload = + exports.doPostRequest = + exports.doGetRequest = + void 0; const jose = __importStar(require("jose")); const thirdpartyUtils_1 = require("../../../thirdpartyUtils"); const normalisedURLDomain_1 = __importDefault(require("../../../normalisedURLDomain")); diff --git a/lib/build/recipe/thirdparty/recipeImplementation.js b/lib/build/recipe/thirdparty/recipeImplementation.js index dce4ef1e6..5dcc2ca48 100644 --- a/lib/build/recipe/thirdparty/recipeImplementation.js +++ b/lib/build/recipe/thirdparty/recipeImplementation.js @@ -5,7 +5,6 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -const normalisedURLPath_1 = __importDefault(require("../../normalisedURLPath")); const configUtils_1 = require("./providers/configUtils"); const recipe_1 = __importDefault(require("../accountlinking/recipe")); const recipe_2 = __importDefault(require("../multitenancy/recipe")); @@ -53,7 +52,12 @@ function getRecipeImplementation(querier, providers) { } } let response = await querier.sendPostRequest( - new normalisedURLPath_1.default(`/${tenantId}/recipe/signinup`), + { + path: "//recipe/signinup", + params: { + tenantId: tenantId, + }, + }, { thirdPartyId, thirdPartyUserId, @@ -64,26 +68,22 @@ function getRecipeImplementation(querier, providers) { if (response.status !== "OK") { return response; } - response.user = new user_1.User(response.user); - response.recipeUserId = new recipeUserId_1.default(response.recipeUserId); + const userAsObj = user_1.User.fromApi(response.user); + const recipeUserIdAsObj = new recipeUserId_1.default(response.recipeUserId); await recipe_1.default.getInstance().verifyEmailForRecipeUserIfLinkedAccountsAreVerified({ - user: response.user, - recipeUserId: response.recipeUserId, + user: userAsObj, + recipeUserId: recipeUserIdAsObj, userContext, }); - // we do this so that we get the updated user (in case the above - // function updated the verification status) and can return that - response.user = await __1.getUser(response.recipeUserId.getAsString(), userContext); - const linkResult = await authUtils_1.AuthUtils.linkToSessionIfRequiredElseCreatePrimaryUserIdOrLinkByAccountInfo( - { + const linkResult = + await authUtils_1.AuthUtils.linkToSessionIfRequiredElseCreatePrimaryUserIdOrLinkByAccountInfo({ tenantId, shouldTryLinkingWithSessionUser, - inputUser: response.user, - recipeUserId: response.recipeUserId, + inputUser: userAsObj, + recipeUserId: recipeUserIdAsObj, session, userContext, - } - ); + }); if (linkResult.status !== "OK") { return linkResult; } @@ -91,7 +91,7 @@ function getRecipeImplementation(querier, providers) { status: "OK", createdNewRecipeUser: response.createdNewUser, user: linkResult.user, - recipeUserId: response.recipeUserId, + recipeUserId: recipeUserIdAsObj, }; }, signInUp: async function ({ diff --git a/lib/build/recipe/totp/index.js b/lib/build/recipe/totp/index.js index 579bb3332..c9f1c313b 100644 --- a/lib/build/recipe/totp/index.js +++ b/lib/build/recipe/totp/index.js @@ -19,7 +19,14 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.verifyTOTP = exports.verifyDevice = exports.removeDevice = exports.updateDevice = exports.listDevices = exports.createDevice = exports.init = void 0; +exports.verifyTOTP = + exports.verifyDevice = + exports.removeDevice = + exports.updateDevice = + exports.listDevices = + exports.createDevice = + exports.init = + void 0; const utils_1 = require("../../utils"); const recipe_1 = __importDefault(require("./recipe")); class Wrapper { diff --git a/lib/build/recipe/totp/recipeImplementation.js b/lib/build/recipe/totp/recipeImplementation.js index 5ad44874b..966784a86 100644 --- a/lib/build/recipe/totp/recipeImplementation.js +++ b/lib/build/recipe/totp/recipeImplementation.js @@ -13,13 +13,7 @@ * License for the specific language governing permissions and limitations * under the License. */ -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; Object.defineProperty(exports, "__esModule", { value: true }); -const normalisedURLPath_1 = __importDefault(require("../../normalisedURLPath")); const __1 = require("../.."); function getRecipeInterface(querier, config) { return { @@ -73,7 +67,7 @@ function getRecipeInterface(querier, config) { } } const response = await querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/totp/device"), + "/recipe/totp/device", { userId: input.userId, deviceName: input.deviceName, @@ -82,6 +76,9 @@ function getRecipeInterface(querier, config) { }, input.userContext ); + if (response.status !== "OK") { + return response; + } return Object.assign(Object.assign({}, response), { qrCodeString: `otpauth://totp/${encodeURI(config.issuer)}${ @@ -94,7 +91,7 @@ function getRecipeInterface(querier, config) { }, updateDevice: (input) => { return querier.sendPutRequest( - new normalisedURLPath_1.default("/recipe/totp/device"), + "/recipe/totp/device", { userId: input.userId, existingDeviceName: input.existingDeviceName, @@ -106,7 +103,7 @@ function getRecipeInterface(querier, config) { }, listDevices: (input) => { return querier.sendGetRequest( - new normalisedURLPath_1.default("/recipe/totp/device/list"), + "/recipe/totp/device/list", { userId: input.userId, }, @@ -115,7 +112,7 @@ function getRecipeInterface(querier, config) { }, removeDevice: (input) => { return querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/totp/device/remove"), + "/recipe/totp/device/remove", { userId: input.userId, deviceName: input.deviceName, @@ -125,7 +122,12 @@ function getRecipeInterface(querier, config) { }, verifyDevice: (input) => { return querier.sendPostRequest( - new normalisedURLPath_1.default(`${input.tenantId}/recipe/totp/device/verify`), + { + path: "//recipe/totp/device/verify", + params: { + tenantId: input.tenantId, + }, + }, { userId: input.userId, deviceName: input.deviceName, @@ -136,7 +138,12 @@ function getRecipeInterface(querier, config) { }, verifyTOTP: (input) => { return querier.sendPostRequest( - new normalisedURLPath_1.default(`${input.tenantId}/recipe/totp/verify`), + { + path: "//recipe/totp/verify", + params: { + tenantId: input.tenantId, + }, + }, { userId: input.userId, totp: input.totp, diff --git a/lib/build/recipe/totp/types.d.ts b/lib/build/recipe/totp/types.d.ts index f4016b9e1..9bbd8e1a8 100644 --- a/lib/build/recipe/totp/types.d.ts +++ b/lib/build/recipe/totp/types.d.ts @@ -28,10 +28,7 @@ export declare type TypeNormalisedInput = { }; }; export declare type RecipeInterface = { - getUserIdentifierInfoForUserId: (input: { - userId: string; - userContext: UserContext; - }) => Promise< + getUserIdentifierInfoForUserId: (input: { userId: string; userContext: UserContext }) => Promise< | { status: "OK"; info: string; @@ -69,10 +66,7 @@ export declare type RecipeInterface = { }) => Promise<{ status: "OK" | "UNKNOWN_DEVICE_ERROR" | "DEVICE_ALREADY_EXISTS_ERROR"; }>; - listDevices: (input: { - userId: string; - userContext: UserContext; - }) => Promise<{ + listDevices: (input: { userId: string; userContext: UserContext }) => Promise<{ status: "OK"; devices: { name: string; @@ -81,11 +75,7 @@ export declare type RecipeInterface = { verified: boolean; }[]; }>; - removeDevice: (input: { - userId: string; - deviceName: string; - userContext: UserContext; - }) => Promise<{ + removeDevice: (input: { userId: string; deviceName: string; userContext: UserContext }) => Promise<{ status: "OK"; didDeviceExist: boolean; }>; @@ -113,12 +103,7 @@ export declare type RecipeInterface = { retryAfterMs: number; } >; - verifyTOTP: (input: { - tenantId: string; - userId: string; - totp: string; - userContext: UserContext; - }) => Promise< + verifyTOTP: (input: { tenantId: string; userId: string; totp: string; userContext: UserContext }) => Promise< | { status: "OK" | "UNKNOWN_USER_ID_ERROR"; } @@ -163,11 +148,7 @@ export declare type APIInterface = { >); listDevicesGET: | undefined - | ((input: { - options: APIOptions; - session: SessionContainerInterface; - userContext: UserContext; - }) => Promise< + | ((input: { options: APIOptions; session: SessionContainerInterface; userContext: UserContext }) => Promise< | { status: "OK"; devices: { diff --git a/lib/build/recipe/usermetadata/recipeImplementation.js b/lib/build/recipe/usermetadata/recipeImplementation.js index 2fd78898b..ac7009fb5 100644 --- a/lib/build/recipe/usermetadata/recipeImplementation.js +++ b/lib/build/recipe/usermetadata/recipeImplementation.js @@ -13,25 +13,15 @@ * License for the specific language governing permissions and limitations * under the License. */ -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; Object.defineProperty(exports, "__esModule", { value: true }); -const normalisedURLPath_1 = __importDefault(require("../../normalisedURLPath")); function getRecipeInterface(querier) { return { getUserMetadata: function ({ userId, userContext }) { - return querier.sendGetRequest( - new normalisedURLPath_1.default("/recipe/user/metadata"), - { userId }, - userContext - ); + return querier.sendGetRequest("/recipe/user/metadata", { userId }, userContext); }, - updateUserMetadata: function ({ userId, metadataUpdate, userContext }) { - return querier.sendPutRequest( - new normalisedURLPath_1.default("/recipe/user/metadata"), + updateUserMetadata: async function ({ userId, metadataUpdate, userContext }) { + const response = await querier.sendPutRequest( + "/recipe/user/metadata", { userId, metadataUpdate, @@ -39,10 +29,11 @@ function getRecipeInterface(querier) { {}, userContext ); + return Object.assign(Object.assign({}, response), { metadata: response.metadata }); }, clearUserMetadata: function ({ userId, userContext }) { return querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/user/metadata/remove"), + "/recipe/user/metadata/remove", { userId, }, diff --git a/lib/build/recipe/usermetadata/types.d.ts b/lib/build/recipe/usermetadata/types.d.ts index 8dd434ac7..b2a05c249 100644 --- a/lib/build/recipe/usermetadata/types.d.ts +++ b/lib/build/recipe/usermetadata/types.d.ts @@ -21,10 +21,7 @@ export declare type TypeNormalisedInput = { }; export declare type APIInterface = {}; export declare type RecipeInterface = { - getUserMetadata: (input: { - userId: string; - userContext: UserContext; - }) => Promise<{ + getUserMetadata: (input: { userId: string; userContext: UserContext }) => Promise<{ status: "OK"; metadata: any; }>; @@ -36,18 +33,11 @@ export declare type RecipeInterface = { * - update: `{ "notifications": { "sms": true }, "todos": null }` * - result: `{ "preferences": { "theme":"dark" }, "notifications": { "sms": true } }` */ - updateUserMetadata: (input: { - userId: string; - metadataUpdate: JSONObject; - userContext: UserContext; - }) => Promise<{ + updateUserMetadata: (input: { userId: string; metadataUpdate: JSONObject; userContext: UserContext }) => Promise<{ status: "OK"; metadata: JSONObject; }>; - clearUserMetadata: (input: { - userId: string; - userContext: UserContext; - }) => Promise<{ + clearUserMetadata: (input: { userId: string; userContext: UserContext }) => Promise<{ status: "OK"; }>; }; diff --git a/lib/build/recipe/userroles/index.d.ts b/lib/build/recipe/userroles/index.d.ts index 11a803d66..17279d2f7 100644 --- a/lib/build/recipe/userroles/index.d.ts +++ b/lib/build/recipe/userroles/index.d.ts @@ -95,9 +95,7 @@ export default class Wrapper { status: "OK"; didRoleExist: boolean; }>; - static getAllRoles( - userContext?: Record - ): Promise<{ + static getAllRoles(userContext?: Record): Promise<{ status: "OK"; roles: string[]; }>; diff --git a/lib/build/recipe/userroles/index.js b/lib/build/recipe/userroles/index.js index 21e01ff10..46339d6bd 100644 --- a/lib/build/recipe/userroles/index.js +++ b/lib/build/recipe/userroles/index.js @@ -19,7 +19,20 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.PermissionClaim = exports.UserRoleClaim = exports.getAllRoles = exports.deleteRole = exports.getRolesThatHavePermission = exports.removePermissionsFromRole = exports.getPermissionsForRole = exports.createNewRoleOrAddPermissions = exports.getUsersThatHaveRole = exports.getRolesForUser = exports.removeUserRole = exports.addRoleToUser = exports.init = void 0; +exports.PermissionClaim = + exports.UserRoleClaim = + exports.getAllRoles = + exports.deleteRole = + exports.getRolesThatHavePermission = + exports.removePermissionsFromRole = + exports.getPermissionsForRole = + exports.createNewRoleOrAddPermissions = + exports.getUsersThatHaveRole = + exports.getRolesForUser = + exports.removeUserRole = + exports.addRoleToUser = + exports.init = + void 0; const utils_1 = require("../../utils"); const permissionClaim_1 = require("./permissionClaim"); const recipe_1 = __importDefault(require("./recipe")); diff --git a/lib/build/recipe/userroles/recipeImplementation.js b/lib/build/recipe/userroles/recipeImplementation.js index 47dbdc1ba..584369625 100644 --- a/lib/build/recipe/userroles/recipeImplementation.js +++ b/lib/build/recipe/userroles/recipeImplementation.js @@ -13,21 +13,17 @@ * License for the specific language governing permissions and limitations * under the License. */ -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; Object.defineProperty(exports, "__esModule", { value: true }); -const normalisedURLPath_1 = __importDefault(require("../../normalisedURLPath")); -const constants_1 = require("../multitenancy/constants"); function getRecipeInterface(querier) { return { addRoleToUser: function ({ userId, role, tenantId, userContext }) { return querier.sendPutRequest( - new normalisedURLPath_1.default( - `/${tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId}/recipe/user/role` - ), + { + path: "//recipe/user/role", + params: { + tenantId: tenantId, + }, + }, { userId, role }, {}, userContext @@ -35,49 +31,49 @@ function getRecipeInterface(querier) { }, removeUserRole: function ({ userId, role, tenantId, userContext }) { return querier.sendPostRequest( - new normalisedURLPath_1.default( - `/${tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId}/recipe/user/role/remove` - ), + { + path: "//recipe/user/role/remove", + params: { + tenantId: tenantId, + }, + }, { userId, role }, userContext ); }, getRolesForUser: function ({ userId, tenantId, userContext }) { return querier.sendGetRequest( - new normalisedURLPath_1.default( - `/${tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId}/recipe/user/roles` - ), + { + path: "//recipe/user/roles", + params: { + tenantId: tenantId, + }, + }, { userId }, userContext ); }, getUsersThatHaveRole: function ({ role, tenantId, userContext }) { return querier.sendGetRequest( - new normalisedURLPath_1.default( - `/${tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId}/recipe/role/users` - ), + { + path: "//recipe/role/users", + params: { + tenantId: tenantId, + }, + }, { role }, userContext ); }, createNewRoleOrAddPermissions: function ({ role, permissions, userContext }) { - return querier.sendPutRequest( - new normalisedURLPath_1.default("/recipe/role"), - { role, permissions }, - {}, - userContext - ); + return querier.sendPutRequest("/recipe/role", { role, permissions }, {}, userContext); }, getPermissionsForRole: function ({ role, userContext }) { - return querier.sendGetRequest( - new normalisedURLPath_1.default("/recipe/role/permissions"), - { role }, - userContext - ); + return querier.sendGetRequest("/recipe/role/permissions", { role }, userContext); }, removePermissionsFromRole: function ({ role, permissions, userContext }) { return querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/role/permissions/remove"), + "/recipe/role/permissions/remove", { role, permissions, @@ -86,21 +82,13 @@ function getRecipeInterface(querier) { ); }, getRolesThatHavePermission: function ({ permission, userContext }) { - return querier.sendGetRequest( - new normalisedURLPath_1.default("/recipe/permission/roles"), - { permission }, - userContext - ); + return querier.sendGetRequest("/recipe/permission/roles", { permission }, userContext); }, deleteRole: function ({ role, userContext }) { - return querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/role/remove"), - { role }, - userContext - ); + return querier.sendPostRequest("/recipe/role/remove", { role }, userContext); }, getAllRoles: function ({ userContext }) { - return querier.sendGetRequest(new normalisedURLPath_1.default("/recipe/roles"), {}, userContext); + return querier.sendGetRequest("/recipe/roles", {}, userContext); }, }; } diff --git a/lib/build/recipe/userroles/types.d.ts b/lib/build/recipe/userroles/types.d.ts index c79ca9b8d..8228a348a 100644 --- a/lib/build/recipe/userroles/types.d.ts +++ b/lib/build/recipe/userroles/types.d.ts @@ -25,12 +25,7 @@ export declare type TypeNormalisedInput = { }; export declare type APIInterface = {}; export declare type RecipeInterface = { - addRoleToUser: (input: { - userId: string; - role: string; - tenantId: string; - userContext: UserContext; - }) => Promise< + addRoleToUser: (input: { userId: string; role: string; tenantId: string; userContext: UserContext }) => Promise< | { status: "OK"; didUserAlreadyHaveRole: boolean; @@ -39,12 +34,7 @@ export declare type RecipeInterface = { status: "UNKNOWN_ROLE_ERROR"; } >; - removeUserRole: (input: { - userId: string; - role: string; - tenantId: string; - userContext: UserContext; - }) => Promise< + removeUserRole: (input: { userId: string; role: string; tenantId: string; userContext: UserContext }) => Promise< | { status: "OK"; didUserHaveRole: boolean; @@ -53,19 +43,11 @@ export declare type RecipeInterface = { status: "UNKNOWN_ROLE_ERROR"; } >; - getRolesForUser: (input: { - userId: string; - tenantId: string; - userContext: UserContext; - }) => Promise<{ + getRolesForUser: (input: { userId: string; tenantId: string; userContext: UserContext }) => Promise<{ status: "OK"; roles: string[]; }>; - getUsersThatHaveRole: (input: { - role: string; - tenantId: string; - userContext: UserContext; - }) => Promise< + getUsersThatHaveRole: (input: { role: string; tenantId: string; userContext: UserContext }) => Promise< | { status: "OK"; users: string[]; @@ -82,10 +64,7 @@ export declare type RecipeInterface = { status: "OK"; createdNewRole: boolean; }>; - getPermissionsForRole: (input: { - role: string; - userContext: UserContext; - }) => Promise< + getPermissionsForRole: (input: { role: string; userContext: UserContext }) => Promise< | { status: "OK"; permissions: string[]; @@ -94,30 +73,18 @@ export declare type RecipeInterface = { status: "UNKNOWN_ROLE_ERROR"; } >; - removePermissionsFromRole: (input: { - role: string; - permissions: string[]; - userContext: UserContext; - }) => Promise<{ + removePermissionsFromRole: (input: { role: string; permissions: string[]; userContext: UserContext }) => Promise<{ status: "OK" | "UNKNOWN_ROLE_ERROR"; }>; - getRolesThatHavePermission: (input: { - permission: string; - userContext: UserContext; - }) => Promise<{ + getRolesThatHavePermission: (input: { permission: string; userContext: UserContext }) => Promise<{ status: "OK"; roles: string[]; }>; - deleteRole: (input: { - role: string; - userContext: UserContext; - }) => Promise<{ + deleteRole: (input: { role: string; userContext: UserContext }) => Promise<{ status: "OK"; didRoleExist: boolean; }>; - getAllRoles: (input: { - userContext: UserContext; - }) => Promise<{ + getAllRoles: (input: { userContext: UserContext }) => Promise<{ status: "OK"; roles: string[]; }>; diff --git a/lib/build/recipe/webauthn/api/implementation.js b/lib/build/recipe/webauthn/api/implementation.js index 6621a5e44..b0e15937f 100644 --- a/lib/build/recipe/webauthn/api/implementation.js +++ b/lib/build/recipe/webauthn/api/implementation.js @@ -578,8 +578,7 @@ function getAPIImplementation() { if (!emailVerified && hasOtherEmailOrPhone) { return { status: "RECOVER_ACCOUNT_NOT_ALLOWED", - reason: - "Recover account link was not created because of account take over risk. Please contact support. (ERR_CODE_001)", + reason: "Recover account link was not created because of account take over risk. Please contact support. (ERR_CODE_001)", }; } const shouldDoAccountLinkingResponse = await recipe_1.default @@ -704,14 +703,13 @@ function getAPIImplementation() { async function markEmailAsVerified(recipeUserId, email) { const emailVerificationInstance = recipe_2.default.getInstance(); if (emailVerificationInstance) { - const tokenResponse = await emailVerificationInstance.recipeInterfaceImpl.createEmailVerificationToken( - { + const tokenResponse = + await emailVerificationInstance.recipeInterfaceImpl.createEmailVerificationToken({ tenantId, recipeUserId, email, userContext, - } - ); + }); if (tokenResponse.status === "OK") { await emailVerificationInstance.recipeInterfaceImpl.verifyEmailUsingToken({ tenantId, diff --git a/lib/build/recipe/webauthn/constants.js b/lib/build/recipe/webauthn/constants.js index 09f1ebdbf..ff345b144 100644 --- a/lib/build/recipe/webauthn/constants.js +++ b/lib/build/recipe/webauthn/constants.js @@ -14,7 +14,23 @@ * under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -exports.DEFAULT_SIGNIN_OPTIONS_USER_PRESENCE = exports.DEFAULT_SIGNIN_OPTIONS_USER_VERIFICATION = exports.DEFAULT_SIGNIN_OPTIONS_TIMEOUT = exports.DEFAULT_REGISTER_OPTIONS_SUPPORTED_ALGORITHM_IDS = exports.DEFAULT_REGISTER_OPTIONS_USER_PRESENCE = exports.DEFAULT_REGISTER_OPTIONS_USER_VERIFICATION = exports.DEFAULT_REGISTER_OPTIONS_RESIDENT_KEY = exports.DEFAULT_REGISTER_OPTIONS_ATTESTATION = exports.DEFAULT_REGISTER_OPTIONS_TIMEOUT = exports.SIGNUP_EMAIL_EXISTS_API = exports.RECOVER_ACCOUNT_API = exports.GENERATE_RECOVER_ACCOUNT_TOKEN_API = exports.SIGN_IN_API = exports.SIGN_UP_API = exports.SIGNIN_OPTIONS_API = exports.REGISTER_OPTIONS_API = void 0; +exports.DEFAULT_SIGNIN_OPTIONS_USER_PRESENCE = + exports.DEFAULT_SIGNIN_OPTIONS_USER_VERIFICATION = + exports.DEFAULT_SIGNIN_OPTIONS_TIMEOUT = + exports.DEFAULT_REGISTER_OPTIONS_SUPPORTED_ALGORITHM_IDS = + exports.DEFAULT_REGISTER_OPTIONS_USER_PRESENCE = + exports.DEFAULT_REGISTER_OPTIONS_USER_VERIFICATION = + exports.DEFAULT_REGISTER_OPTIONS_RESIDENT_KEY = + exports.DEFAULT_REGISTER_OPTIONS_ATTESTATION = + exports.DEFAULT_REGISTER_OPTIONS_TIMEOUT = + exports.SIGNUP_EMAIL_EXISTS_API = + exports.RECOVER_ACCOUNT_API = + exports.GENERATE_RECOVER_ACCOUNT_TOKEN_API = + exports.SIGN_IN_API = + exports.SIGN_UP_API = + exports.SIGNIN_OPTIONS_API = + exports.REGISTER_OPTIONS_API = + void 0; exports.REGISTER_OPTIONS_API = "/webauthn/options/register"; exports.SIGNIN_OPTIONS_API = "/webauthn/options/signin"; exports.SIGN_UP_API = "/webauthn/signup"; diff --git a/lib/build/recipe/webauthn/index.d.ts b/lib/build/recipe/webauthn/index.d.ts index c4e28c46d..bbedbb5d0 100644 --- a/lib/build/recipe/webauthn/index.d.ts +++ b/lib/build/recipe/webauthn/index.d.ts @@ -425,10 +425,7 @@ export default class Wrapper { createdAt: number; } >; - static listCredentials(input: { - recipeUserId: string; - userContext?: Record; - }): Promise<{ + static listCredentials(input: { recipeUserId: string; userContext?: Record }): Promise<{ status: "OK"; credentials: { webauthnCredentialId: string; diff --git a/lib/build/recipe/webauthn/index.js b/lib/build/recipe/webauthn/index.js index fda5d6388..125573f2d 100644 --- a/lib/build/recipe/webauthn/index.js +++ b/lib/build/recipe/webauthn/index.js @@ -19,7 +19,28 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.updateUserEmail = exports.listCredentials = exports.getCredential = exports.removeCredential = exports.removeGeneratedOptions = exports.getUserFromRecoverAccountToken = exports.getGeneratedOptions = exports.sendEmail = exports.sendRecoverAccountEmail = exports.createRecoverAccountLink = exports.registerCredential = exports.consumeRecoverAccountToken = exports.recoverAccount = exports.generateRecoverAccountToken = exports.verifyCredentials = exports.signUp = exports.signIn = exports.signInOptions = exports.registerOptions = exports.Error = exports.init = void 0; +exports.updateUserEmail = + exports.listCredentials = + exports.getCredential = + exports.removeCredential = + exports.removeGeneratedOptions = + exports.getUserFromRecoverAccountToken = + exports.getGeneratedOptions = + exports.sendEmail = + exports.sendRecoverAccountEmail = + exports.createRecoverAccountLink = + exports.registerCredential = + exports.consumeRecoverAccountToken = + exports.recoverAccount = + exports.generateRecoverAccountToken = + exports.verifyCredentials = + exports.signUp = + exports.signIn = + exports.signInOptions = + exports.registerOptions = + exports.Error = + exports.init = + void 0; const recipe_1 = __importDefault(require("./recipe")); const error_1 = __importDefault(require("./error")); const constants_1 = require("../multitenancy/constants"); diff --git a/lib/build/recipe/webauthn/recipe.js b/lib/build/recipe/webauthn/recipe.js index ba5ab2579..4155373f3 100644 --- a/lib/build/recipe/webauthn/recipe.js +++ b/lib/build/recipe/webauthn/recipe.js @@ -192,9 +192,8 @@ class Recipe extends recipeModule_1.default { return a.timeJoined - b.timeJoined; }); // Then we take the ones that belong to this recipe - const recipeLoginMethodsOrderedByTimeJoinedOldestFirst = orderedLoginMethodsByTimeJoinedOldestFirst.filter( - (lm) => lm.recipeId === Recipe.RECIPE_ID - ); + const recipeLoginMethodsOrderedByTimeJoinedOldestFirst = + orderedLoginMethodsByTimeJoinedOldestFirst.filter((lm) => lm.recipeId === Recipe.RECIPE_ID); let result; if (recipeLoginMethodsOrderedByTimeJoinedOldestFirst.length !== 0) { // If there are login methods belonging to this recipe, the factor is set up diff --git a/lib/build/recipe/webauthn/recipeImplementation.js b/lib/build/recipe/webauthn/recipeImplementation.js index 9b192bb8c..bfacd97c3 100644 --- a/lib/build/recipe/webauthn/recipeImplementation.js +++ b/lib/build/recipe/webauthn/recipeImplementation.js @@ -31,10 +31,8 @@ var __importDefault = }; Object.defineProperty(exports, "__esModule", { value: true }); const recipe_1 = __importDefault(require("../accountlinking/recipe")); -const normalisedURLPath_1 = __importDefault(require("../../normalisedURLPath")); const __1 = require("../.."); const recipeUserId_1 = __importDefault(require("../../recipeUserId")); -const constants_1 = require("../multitenancy/constants"); const user_1 = require("../../user"); const authUtils_1 = require("../../authUtils"); function getRecipeInterface(querier, getWebauthnConfig) { @@ -112,11 +110,12 @@ function getRecipeInterface(querier, getWebauthnConfig) { displayName = email; } return await querier.sendPostRequest( - new normalisedURLPath_1.default( - `/${ - tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId - }/recipe/webauthn/options/register` - ), + { + path: "//recipe/webauthn/options/register", + params: { + tenantId: tenantId, + }, + }, { email, displayName, @@ -144,11 +143,12 @@ function getRecipeInterface(querier, getWebauthnConfig) { userContext, }) { return await querier.sendPostRequest( - new normalisedURLPath_1.default( - `/${ - tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId - }/recipe/webauthn/options/signin` - ), + { + path: "//recipe/webauthn/options/signin", + params: { + tenantId: tenantId, + }, + }, { userVerification, userPresence, @@ -177,16 +177,15 @@ function getRecipeInterface(querier, getWebauthnConfig) { if (response.status !== "OK") { return response; } - const linkResult = await authUtils_1.AuthUtils.linkToSessionIfRequiredElseCreatePrimaryUserIdOrLinkByAccountInfo( - { + const linkResult = + await authUtils_1.AuthUtils.linkToSessionIfRequiredElseCreatePrimaryUserIdOrLinkByAccountInfo({ tenantId, inputUser: response.user, recipeUserId: response.recipeUserId, session, shouldTryLinkingWithSessionUser, userContext, - } - ); + }); if (linkResult.status != "OK") { return linkResult; } @@ -226,16 +225,15 @@ function getRecipeInterface(querier, getWebauthnConfig) { // function updated the verification status) and can return that response.user = await __1.getUser(response.recipeUserId.getAsString(), userContext); } - const linkResult = await authUtils_1.AuthUtils.linkToSessionIfRequiredElseCreatePrimaryUserIdOrLinkByAccountInfo( - { + const linkResult = + await authUtils_1.AuthUtils.linkToSessionIfRequiredElseCreatePrimaryUserIdOrLinkByAccountInfo({ tenantId, inputUser: response.user, recipeUserId: response.recipeUserId, session, shouldTryLinkingWithSessionUser, userContext, - } - ); + }); if (linkResult.status === "LINKING_TO_SESSION_USER_FAILED") { return linkResult; } @@ -244,9 +242,12 @@ function getRecipeInterface(querier, getWebauthnConfig) { }, verifyCredentials: async function ({ credential, webauthnGeneratedOptionsId, tenantId, userContext }) { const response = await querier.sendPostRequest( - new normalisedURLPath_1.default( - `/${tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId}/recipe/webauthn/signin` - ), + { + path: "//recipe/webauthn/signin", + params: { + tenantId: tenantId, + }, + }, { credential, webauthnGeneratedOptionsId, @@ -264,11 +265,12 @@ function getRecipeInterface(querier, getWebauthnConfig) { }, createNewRecipeUser: async function (input) { const resp = await querier.sendPostRequest( - new normalisedURLPath_1.default( - `/${ - input.tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : input.tenantId - }/recipe/webauthn/signup` - ), + { + path: "//recipe/webauthn/signup", + params: { + tenantId: input.tenantId, + }, + }, { webauthnGeneratedOptionsId: input.webauthnGeneratedOptionsId, credential: input.credential, @@ -286,11 +288,12 @@ function getRecipeInterface(querier, getWebauthnConfig) { }, generateRecoverAccountToken: async function ({ userId, email, tenantId, userContext }) { return await querier.sendPostRequest( - new normalisedURLPath_1.default( - `/${ - tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId - }/recipe/webauthn/user/recover/token` - ), + { + path: "//recipe/webauthn/user/recover/token", + params: { + tenantId: tenantId, + }, + }, { userId, email, @@ -300,11 +303,12 @@ function getRecipeInterface(querier, getWebauthnConfig) { }, consumeRecoverAccountToken: async function ({ token, tenantId, userContext }) { return await querier.sendPostRequest( - new normalisedURLPath_1.default( - `/${ - tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId - }/recipe/webauthn/user/recover/token/consume` - ), + { + path: "//recipe/webauthn/user/recover/token/consume", + params: { + tenantId: tenantId, + }, + }, { token, }, @@ -313,7 +317,7 @@ function getRecipeInterface(querier, getWebauthnConfig) { }, registerCredential: async function ({ webauthnGeneratedOptionsId, credential, userContext, recipeUserId }) { return await querier.sendPostRequest( - new normalisedURLPath_1.default(`/recipe/webauthn/user/credential/register`), + "/recipe/webauthn/user/credential/register", { recipeUserId, webauthnGeneratedOptionsId, @@ -324,9 +328,12 @@ function getRecipeInterface(querier, getWebauthnConfig) { }, getUserFromRecoverAccountToken: async function ({ token, tenantId, userContext }) { const resp = await querier.sendGetRequest( - new normalisedURLPath_1.default( - `/${tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId}/recipe/webauthn/user/recover` - ), + { + path: "//recipe/webauthn/user/recover", + params: { + tenantId: tenantId, + }, + }, { token }, userContext ); @@ -340,15 +347,15 @@ function getRecipeInterface(querier, getWebauthnConfig) { }, removeCredential: async function ({ webauthnCredentialId, recipeUserId, userContext }) { return await querier.sendDeleteRequest( - new normalisedURLPath_1.default(`/recipe/webauthn/user/credential/remove`), - {}, + "/recipe/webauthn/user/credential/remove", + undefined, { recipeUserId, webauthnCredentialId }, userContext ); }, getCredential: async function ({ webauthnCredentialId, recipeUserId, userContext }) { const resp = await querier.sendGetRequest( - new normalisedURLPath_1.default(`/recipe/webauthn/user/credential`), + "/recipe/webauthn/user/credential", { webauthnCredentialId, recipeUserId }, userContext ); @@ -360,38 +367,41 @@ function getRecipeInterface(querier, getWebauthnConfig) { return resp; }, listCredentials: async function ({ recipeUserId, userContext }) { - return await querier.sendGetRequest( - new normalisedURLPath_1.default(`/recipe/webauthn/user/credential/list`), - { recipeUserId }, - userContext - ); + return await querier.sendGetRequest("/recipe/webauthn/user/credential/list", { recipeUserId }, userContext); }, removeGeneratedOptions: async function ({ webauthnGeneratedOptionsId, tenantId, userContext }) { return await querier.sendDeleteRequest( - new normalisedURLPath_1.default( - `/${ - tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId - }/recipe/webauthn/options/remove` - ), - {}, + { + path: "//recipe/webauthn/options/remove", + params: { + tenantId: tenantId, + }, + }, + undefined, { webauthnGeneratedOptionsId }, userContext ); }, getGeneratedOptions: async function ({ webauthnGeneratedOptionsId, tenantId, userContext }) { return await querier.sendGetRequest( - new normalisedURLPath_1.default( - `/${tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId}/recipe/webauthn/options` - ), + { + path: "//recipe/webauthn/options", + params: { + tenantId: tenantId, + }, + }, { webauthnGeneratedOptionsId }, userContext ); }, updateUserEmail: async function ({ email, recipeUserId, tenantId, userContext }) { return await querier.sendPutRequest( - new normalisedURLPath_1.default( - `/${tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId}/recipe/webauthn/user/email` - ), + { + path: "//recipe/webauthn/user/email", + params: { + tenantId: tenantId, + }, + }, { email, recipeUserId }, {}, userContext diff --git a/lib/build/recipe/webauthn/types.d.ts b/lib/build/recipe/webauthn/types.d.ts index 30fc60c1c..539de2b8c 100644 --- a/lib/build/recipe/webauthn/types.d.ts +++ b/lib/build/recipe/webauthn/types.d.ts @@ -349,11 +349,7 @@ export declare type RecipeInterface = { } | GenerateRecoverAccountTokenErrorResponse >; - consumeRecoverAccountToken(input: { - token: string; - tenantId: string; - userContext: UserContext; - }): Promise< + consumeRecoverAccountToken(input: { token: string; tenantId: string; userContext: UserContext }): Promise< | { status: "OK"; email: string; @@ -372,11 +368,7 @@ export declare type RecipeInterface = { } | RegisterCredentialErrorResponse >; - getUserFromRecoverAccountToken(input: { - token: string; - tenantId: string; - userContext: UserContext; - }): Promise< + getUserFromRecoverAccountToken(input: { token: string; tenantId: string; userContext: UserContext }): Promise< | { status: "OK"; user: User; @@ -384,21 +376,13 @@ export declare type RecipeInterface = { } | GetUserFromRecoverAccountTokenErrorResponse >; - removeCredential(input: { - webauthnCredentialId: string; - recipeUserId: string; - userContext: UserContext; - }): Promise< + removeCredential(input: { webauthnCredentialId: string; recipeUserId: string; userContext: UserContext }): Promise< | { status: "OK"; } | RemoveCredentialErrorResponse >; - getCredential(input: { - webauthnCredentialId: string; - recipeUserId: string; - userContext: UserContext; - }): Promise< + getCredential(input: { webauthnCredentialId: string; recipeUserId: string; userContext: UserContext }): Promise< | { status: "OK"; webauthnCredentialId: string; @@ -408,10 +392,7 @@ export declare type RecipeInterface = { } | GetCredentialErrorResponse >; - listCredentials(input: { - recipeUserId: string; - userContext: UserContext; - }): Promise<{ + listCredentials(input: { recipeUserId: string; userContext: UserContext }): Promise<{ status: "OK"; credentials: { webauthnCredentialId: string; @@ -598,11 +579,7 @@ export declare type APIInterface = { >); signInOptionsPOST: | undefined - | ((input: { - tenantId: string; - options: APIOptions; - userContext: UserContext; - }) => Promise< + | ((input: { tenantId: string; options: APIOptions; userContext: UserContext }) => Promise< | { status: "OK"; webauthnGeneratedOptionsId: string; @@ -656,12 +633,7 @@ export declare type APIInterface = { >); generateRecoverAccountTokenPOST: | undefined - | ((input: { - email: string; - tenantId: string; - options: APIOptions; - userContext: UserContext; - }) => Promise< + | ((input: { email: string; tenantId: string; options: APIOptions; userContext: UserContext }) => Promise< | { status: "OK"; } @@ -704,12 +676,7 @@ export declare type APIInterface = { >); emailExistsGET: | undefined - | ((input: { - email: string; - tenantId: string; - options: APIOptions; - userContext: UserContext; - }) => Promise< + | ((input: { email: string; tenantId: string; options: APIOptions; userContext: UserContext }) => Promise< | { status: "OK"; exists: boolean; diff --git a/lib/build/supertokens.js b/lib/build/supertokens.js index db7ceb9ef..58ef100ca 100644 --- a/lib/build/supertokens.js +++ b/lib/build/supertokens.js @@ -59,9 +59,12 @@ class SuperTokens { includeRecipeIdsStr = includeRecipeIds.join(","); } let response = await querier.sendGetRequest( - new normalisedURLPath_1.default( - `/${tenantId === undefined ? constants_2.DEFAULT_TENANT_ID : tenantId}/users/count` - ), + { + path: "//users/count", + params: { + tenantId: tenantId === undefined ? constants_2.DEFAULT_TENANT_ID : tenantId, + }, + }, { includeRecipeIds: includeRecipeIdsStr, includeAllTenants: tenantId === undefined, @@ -76,7 +79,7 @@ class SuperTokens { if (utils_1.maxVersion("2.15", cdiVersion) === cdiVersion) { // create userId mapping is only available >= CDI 2.15 return await querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/userid/map"), + "/recipe/userid/map", { superTokensUserId: input.superTokensUserId, externalUserId: input.externalUserId, @@ -95,7 +98,7 @@ class SuperTokens { if (utils_1.maxVersion("2.15", cdiVersion) === cdiVersion) { // create userId mapping is only available >= CDI 2.15 let response = await querier.sendGetRequest( - new normalisedURLPath_1.default("/recipe/userid/map"), + "/recipe/userid/map", { userId: input.userId, userIdType: input.userIdType, @@ -112,7 +115,7 @@ class SuperTokens { let cdiVersion = await querier.getAPIVersion(input.userContext); if (utils_1.maxVersion("2.15", cdiVersion) === cdiVersion) { return await querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/userid/map/remove"), + "/recipe/userid/map/remove", { userId: input.userId, userIdType: input.userIdType, @@ -129,11 +132,11 @@ class SuperTokens { let cdiVersion = await querier.getAPIVersion(input.userContext); if (utils_1.maxVersion("2.15", cdiVersion) === cdiVersion) { return await querier.sendPutRequest( - new normalisedURLPath_1.default("/recipe/userid/external-user-id-info"), + "/recipe/userid/external-user-id-info", { userId: input.userId, userIdType: input.userIdType, - externalUserIdInfo: input.externalUserIdInfo, + externalUserIdInfo: input.externalUserIdInfo || null, }, {}, input.userContext diff --git a/lib/build/thirdpartyUtils.js b/lib/build/thirdpartyUtils.js index 83cc3d405..ffaf83338 100644 --- a/lib/build/thirdpartyUtils.js +++ b/lib/build/thirdpartyUtils.js @@ -41,7 +41,11 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.getOIDCDiscoveryInfo = exports.verifyIdTokenFromJWKSEndpointAndGetPayload = exports.doPostRequest = exports.doGetRequest = void 0; +exports.getOIDCDiscoveryInfo = + exports.verifyIdTokenFromJWKSEndpointAndGetPayload = + exports.doPostRequest = + exports.doGetRequest = + void 0; const jose = __importStar(require("jose")); const logger_1 = require("./logger"); const utils_1 = require("./utils"); diff --git a/lib/build/user.d.ts b/lib/build/user.d.ts index b50e8f506..72e7a2d59 100644 --- a/lib/build/user.d.ts +++ b/lib/build/user.d.ts @@ -35,6 +35,11 @@ export declare class User implements UserType { readonly loginMethods: LoginMethod[]; readonly timeJoined: number; constructor(user: UserWithoutHelperFunctions); + static fromApi( + apiUser: Omit & { + id: string; + } + ): User; toJson(): JSONObject; } export declare type UserWithoutHelperFunctions = { diff --git a/lib/build/user.js b/lib/build/user.js index f89bf48bc..75d18ba4f 100644 --- a/lib/build/user.js +++ b/lib/build/user.js @@ -87,6 +87,11 @@ class User { this.timeJoined = user.timeJoined; this.loginMethods = user.loginMethods.map((m) => new LoginMethod(m)); } + static fromApi(apiUser) { + return new User( + Object.assign(Object.assign({}, apiUser), { id: new recipeUserId_1.default(apiUser.id).getAsString() }) + ); + } toJson() { return { id: this.id, diff --git a/lib/build/utils.js b/lib/build/utils.js index 93e6b1438..ec547d43f 100644 --- a/lib/build/utils.js +++ b/lib/build/utils.js @@ -5,7 +5,39 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.isBuffer = exports.decodeBase64 = exports.encodeBase64 = exports.isTestEnv = exports.getBuffer = exports.getProcess = exports.transformObjectKeys = exports.toSnakeCase = exports.toCamelCase = exports.normaliseEmail = exports.postWithFetch = exports.getFromObjectCaseInsensitive = exports.getTopLevelDomainForSameSiteResolution = exports.setRequestInUserContextIfNotDefined = exports.getUserContext = exports.makeDefaultUserContextFromAPI = exports.humaniseMilliseconds = exports.frontendHasInterceptor = exports.getRidFromHeader = exports.hasGreaterThanEqualToFDI = exports.getLatestFDIVersionFromFDIList = exports.getBackwardsCompatibleUserInfo = exports.getNormalisedShouldTryLinkingWithSessionUserFlag = exports.isAnIpAddress = exports.send200Response = exports.sendNon200Response = exports.sendNon200ResponseWithMessage = exports.normaliseHttpMethod = exports.normaliseInputAppInfoOrThrowError = exports.maxVersion = exports.getLargestVersionFromIntersection = exports.doFetch = void 0; +exports.isBuffer = + exports.decodeBase64 = + exports.encodeBase64 = + exports.isTestEnv = + exports.getBuffer = + exports.getProcess = + exports.transformObjectKeys = + exports.toSnakeCase = + exports.toCamelCase = + exports.normaliseEmail = + exports.postWithFetch = + exports.getFromObjectCaseInsensitive = + exports.getTopLevelDomainForSameSiteResolution = + exports.setRequestInUserContextIfNotDefined = + exports.getUserContext = + exports.makeDefaultUserContextFromAPI = + exports.humaniseMilliseconds = + exports.frontendHasInterceptor = + exports.getRidFromHeader = + exports.hasGreaterThanEqualToFDI = + exports.getLatestFDIVersionFromFDIList = + exports.getBackwardsCompatibleUserInfo = + exports.getNormalisedShouldTryLinkingWithSessionUserFlag = + exports.isAnIpAddress = + exports.send200Response = + exports.sendNon200Response = + exports.sendNon200ResponseWithMessage = + exports.normaliseHttpMethod = + exports.normaliseInputAppInfoOrThrowError = + exports.maxVersion = + exports.getLargestVersionFromIntersection = + exports.doFetch = + void 0; const tldts_1 = require("tldts"); const normalisedURLDomain_1 = __importDefault(require("./normalisedURLDomain")); const normalisedURLPath_1 = __importDefault(require("./normalisedURLPath")); diff --git a/lib/core/paths.ts b/lib/ts/core/paths.ts similarity index 100% rename from lib/core/paths.ts rename to lib/ts/core/paths.ts diff --git a/lib/core/types.ts b/lib/ts/core/types.ts similarity index 80% rename from lib/core/types.ts rename to lib/ts/core/types.ts index aad43e9df..d93c449a4 100644 --- a/lib/core/types.ts +++ b/lib/ts/core/types.ts @@ -37,22 +37,20 @@ type MakeAllRequired = { type DeepRequireAllFields = T extends any ? MakeAllRequired : never; // Type to extract the request body from the method type -export type RequestBody

= - ExtractMethodType extends { - requestBody?: infer ReqBody; - } - ? ReqBody extends { content: { "application/json": infer R } } - ? R | undefined - : undefined - : undefined; +export type RequestBody

= ExtractMethodType extends { + requestBody?: infer ReqBody; +} + ? ReqBody extends { content: { "application/json": infer R } } + ? R | undefined + : undefined + : undefined; // Type to extract the response body from the method type -export type UncleanedResponseBody

= - ExtractMethodType extends { - responses: { 200: { content: { "application/json": infer R } } }; - } - ? R - : unknown; +export type UncleanedResponseBody

= ExtractMethodType extends { + responses: { 200: { content: { "application/json": infer R } } }; +} + ? R + : unknown; // Type to clean the response body from the method type export type ResponseBody

= DeepRequireAllFields>; @@ -63,8 +61,9 @@ type ExtractPathParams = T extends `${string}<${infer Param}>$ ? Param | ExtractPathParams : never; -type PathParamsObject = - ExtractPathParams extends never ? undefined : { [K in ExtractPathParams]: string }; +type PathParamsObject = ExtractPathParams extends never + ? undefined + : { [K in ExtractPathParams]: string }; // Type to handle the path parameter export type PathParam

= P | { path: P; params: PathParamsObject

}; diff --git a/lib/core/versions/5.3/schema.d.ts b/lib/ts/core/versions/5.3/schema.d.ts similarity index 85% rename from lib/core/versions/5.3/schema.d.ts rename to lib/ts/core/versions/5.3/schema.d.ts index 3bf697120..dc4083377 100644 --- a/lib/core/versions/5.3/schema.d.ts +++ b/lib/ts/core/versions/5.3/schema.d.ts @@ -1,3 +1,7 @@ +// @ts-nocheck +// @ts-nocheck +// @ts-nocheck +// @ts-nocheck /** * This file was auto-generated by openapi-typescript. * Do not make direct changes to the file. @@ -3442,13 +3446,18 @@ export interface components { bulkImportUserPasswordlessLoginMethod: (components["schemas"]["bulkImportUserLoginMethodFields"] & { /** @example passwordless */ recipeId?: string; - }) & (components["schemas"]["email"] | components["schemas"]["phoneNumber"]); + }) & + (components["schemas"]["email"] | components["schemas"]["phoneNumber"]); bulkImportUser: { externalUserId?: components["schemas"]["userId"]; userMetadata?: components["schemas"]["userMetadata"][]; userRoles?: components["schemas"]["bulkImportUserRole"][]; totpDevices?: components["schemas"]["bulkImportTotpDevice"][]; - loginMethods?: (components["schemas"]["bulkImportUserEmailPasswordLoginMethod"] | components["schemas"]["bulkImportUserThirdPartyLoginMethod"] | components["schemas"]["bulkImportUserPasswordlessLoginMethod"])[]; + loginMethods?: ( + | components["schemas"]["bulkImportUserEmailPasswordLoginMethod"] + | components["schemas"]["bulkImportUserThirdPartyLoginMethod"] + | components["schemas"]["bulkImportUserPasswordlessLoginMethod"] + )[]; }; addBulkImportUserResponse: { userId?: components["schemas"]["userId"]; @@ -3627,23 +3636,26 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example true */ - wasAlreadyAPrimaryUser?: boolean; - } | { - /** @enum {string} */ - status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId?: string; - description?: string; - } | { - /** @enum {string} */ - status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId?: string; - description?: string; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example true */ + wasAlreadyAPrimaryUser?: boolean; + } + | { + /** @enum {string} */ + status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + } + | { + /** @enum {string} */ + status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + }; }; }; 400: components["responses"]["400"]; @@ -3680,26 +3692,30 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example true */ - accountsAlreadyLinked?: boolean; - } | { - /** @enum {string} */ - status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId?: string; - description?: string; - } | { - /** @enum {string} */ - status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId?: string; - description?: string; - } | { - /** @enum {string} */ - status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example true */ + accountsAlreadyLinked?: boolean; + } + | { + /** @enum {string} */ + status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + } + | { + /** @enum {string} */ + status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + } + | { + /** @enum {string} */ + status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; + }; }; }; 400: components["responses"]["400"]; @@ -3740,23 +3756,26 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example true */ - wasAlreadyAPrimaryUser: boolean; - user: components["schemas"]["authRecipeUser"]; - } | { - /** @enum {string} */ - status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId: string; - description: string; - } | { - /** @enum {string} */ - status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId: string; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example true */ + wasAlreadyAPrimaryUser: boolean; + user: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId: string; + description: string; + } + | { + /** @enum {string} */ + status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId: string; + }; }; }; 400: components["responses"]["400"]; @@ -3800,28 +3819,32 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example true */ - accountsAlreadyLinked?: boolean; - user?: components["schemas"]["authRecipeUser"]; - } | { - /** @enum {string} */ - status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId?: string; - description?: string; - } | { - /** @enum {string} */ - status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId?: string; - user?: components["schemas"]["authRecipeUser"]; - description?: string; - } | { - /** @enum {string} */ - status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example true */ + accountsAlreadyLinked?: boolean; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + } + | { + /** @enum {string} */ + status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + user?: components["schemas"]["authRecipeUser"]; + description?: string; + } + | { + /** @enum {string} */ + status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; + }; }; }; 400: components["responses"]["400"]; @@ -3913,15 +3936,18 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - } | { - /** @enum {string} */ - status: "UNKNOWN_DEVICE_ERROR"; - } | { - /** @enum {string} */ - status: "DEVICE_ALREADY_EXISTS_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + } + | { + /** @enum {string} */ + status: "UNKNOWN_DEVICE_ERROR"; + } + | { + /** @enum {string} */ + status: "DEVICE_ALREADY_EXISTS_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -3967,16 +3993,18 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example JBSWY3DPEHPK3PXP */ - secret?: string; - /** @example d1 */ - deviceName?: string; - } | { - /** @enum {string} */ - status: "DEVICE_ALREADY_EXISTS_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example JBSWY3DPEHPK3PXP */ + secret?: string; + /** @example d1 */ + deviceName?: string; + } + | { + /** @enum {string} */ + status: "DEVICE_ALREADY_EXISTS_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -4068,14 +4096,16 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example d1 */ - deviceName?: string; - } | { - /** @enum {string} */ - status: "DEVICE_ALREADY_EXISTS_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example d1 */ + deviceName?: string; + } + | { + /** @enum {string} */ + status: "DEVICE_ALREADY_EXISTS_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -4165,28 +4195,32 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - } | { - /** @enum {string} */ - status: "INVALID_TOTP_ERROR"; - /** @example 2 */ - currentNumberOfFailedAttempts?: number; - /** @example 5 */ - maxNumberOfFailedAttempts?: number; - } | { - /** @enum {string} */ - status: "UNKNOWN_USER_ID_ERROR"; - } | { - /** @enum {string} */ - status: "LIMIT_REACHED_ERROR"; - /** @example 90000 */ - retryAfterMs?: number; - /** @example 2 */ - currentNumberOfFailedAttempts?: number; - /** @example 5 */ - maxNumberOfFailedAttempts?: number; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + } + | { + /** @enum {string} */ + status: "INVALID_TOTP_ERROR"; + /** @example 2 */ + currentNumberOfFailedAttempts?: number; + /** @example 5 */ + maxNumberOfFailedAttempts?: number; + } + | { + /** @enum {string} */ + status: "UNKNOWN_USER_ID_ERROR"; + } + | { + /** @enum {string} */ + status: "LIMIT_REACHED_ERROR"; + /** @example 90000 */ + retryAfterMs?: number; + /** @example 2 */ + currentNumberOfFailedAttempts?: number; + /** @example 5 */ + maxNumberOfFailedAttempts?: number; + }; }; }; 400: components["responses"]["400"]; @@ -4230,30 +4264,34 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example false */ - wasAlreadyVerified?: boolean; - } | { - /** @enum {string} */ - status: "UNKNOWN_DEVICE_ERROR"; - } | { - /** @enum {string} */ - status: "INVALID_TOTP_ERROR"; - /** @example 2 */ - currentNumberOfFailedAttempts?: number; - /** @example 5 */ - maxNumberOfFailedAttempts?: number; - } | { - /** @enum {string} */ - status: "LIMIT_REACHED_ERROR"; - /** @example 90000 */ - retryAfterMs?: number; - /** @example 2 */ - currentNumberOfFailedAttempts?: number; - /** @example 5 */ - maxNumberOfFailedAttempts?: number; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example false */ + wasAlreadyVerified?: boolean; + } + | { + /** @enum {string} */ + status: "UNKNOWN_DEVICE_ERROR"; + } + | { + /** @enum {string} */ + status: "INVALID_TOTP_ERROR"; + /** @example 2 */ + currentNumberOfFailedAttempts?: number; + /** @example 5 */ + maxNumberOfFailedAttempts?: number; + } + | { + /** @enum {string} */ + status: "LIMIT_REACHED_ERROR"; + /** @example 90000 */ + retryAfterMs?: number; + /** @example 2 */ + currentNumberOfFailedAttempts?: number; + /** @example 5 */ + maxNumberOfFailedAttempts?: number; + }; }; }; 400: components["responses"]["400"]; @@ -4290,17 +4328,19 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - superTokensUserId: components["schemas"]["userId"]; - /** @example externalId */ - externalUserId: string; - /** @example Info about external userId */ - externalUserIdInfo?: string; - } | { - /** @enum {string} */ - status: "UNKNOWN_MAPPING_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + superTokensUserId: components["schemas"]["userId"]; + /** @example externalId */ + externalUserId: string; + /** @example Info about external userId */ + externalUserIdInfo?: string; + } + | { + /** @enum {string} */ + status: "UNKNOWN_MAPPING_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -4345,17 +4385,20 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - } | { - /** @enum {string} */ - status: "UNKNOWN_SUPERTOKENS_USER_ID_ERROR"; - } | { - /** @enum {string} */ - status: "USER_ID_MAPPING_ALREADY_EXISTS_ERROR"; - doesSuperTokensUserIdExist?: boolean; - doesExternalUserIdExist?: boolean; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + } + | { + /** @enum {string} */ + status: "UNKNOWN_SUPERTOKENS_USER_ID_ERROR"; + } + | { + /** @enum {string} */ + status: "USER_ID_MAPPING_ALREADY_EXISTS_ERROR"; + doesSuperTokensUserIdExist?: boolean; + doesExternalUserIdExist?: boolean; + }; }; }; 400: components["responses"]["400"]; @@ -4445,12 +4488,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - } | { - /** @enum {string} */ - status: "UNKNOWN_MAPPING_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + } + | { + /** @enum {string} */ + status: "UNKNOWN_MAPPING_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -4478,14 +4523,16 @@ export interface operations { }; requestBody?: { content: { - "application/json": { - preAuthSessionId: components["schemas"]["preAuthSessionId"]; - linkCode: components["schemas"]["linkCode"]; - } | { - preAuthSessionId: components["schemas"]["preAuthSessionId"]; - deviceId: components["schemas"]["deviceId"]; - userInputCode: components["schemas"]["userInputCode"]; - }; + "application/json": + | { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + linkCode: components["schemas"]["linkCode"]; + } + | { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + deviceId: components["schemas"]["deviceId"]; + userInputCode: components["schemas"]["userInputCode"]; + }; }; }; responses: { @@ -4495,26 +4542,29 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - consumedDevice?: { - preAuthSessionId: components["schemas"]["preAuthSessionId"]; - /** @example 2 */ - failedCodeInputAttemptCount: number; - email?: components["schemas"]["email"]; - phoneNumber?: components["schemas"]["phoneNumber"]; - }; - } | { - /** @enum {string} */ - status: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR"; - /** @example 2 */ - failedCodeInputAttemptCount?: number; - /** @example 5 */ - maximumCodeInputAttempts?: number; - } | { - /** @enum {string} */ - status: "RESTART_FLOW_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + consumedDevice?: { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + /** @example 2 */ + failedCodeInputAttemptCount: number; + email?: components["schemas"]["email"]; + phoneNumber?: components["schemas"]["phoneNumber"]; + }; + } + | { + /** @enum {string} */ + status: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR"; + /** @example 2 */ + failedCodeInputAttemptCount?: number; + /** @example 5 */ + maximumCodeInputAttempts?: number; + } + | { + /** @enum {string} */ + status: "RESTART_FLOW_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -4542,14 +4592,16 @@ export interface operations { }; requestBody?: { content: { - "application/json": { - preAuthSessionId: components["schemas"]["preAuthSessionId"]; - linkCode: components["schemas"]["linkCode"]; - } | { - preAuthSessionId: components["schemas"]["preAuthSessionId"]; - deviceId: components["schemas"]["deviceId"]; - userInputCode: components["schemas"]["userInputCode"]; - }; + "application/json": + | { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + linkCode: components["schemas"]["linkCode"]; + } + | { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + deviceId: components["schemas"]["deviceId"]; + userInputCode: components["schemas"]["userInputCode"]; + }; }; }; responses: { @@ -4559,30 +4611,33 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example true */ - createdNewUser?: boolean; - user?: components["schemas"]["authRecipeUser"]; - recipeUserId?: components["schemas"]["userId"]; - consumedDevice?: { - preAuthSessionId: components["schemas"]["preAuthSessionId"]; - /** @example 2 */ - failedCodeInputAttemptCount: number; - email?: components["schemas"]["email"]; - phoneNumber?: components["schemas"]["phoneNumber"]; - }; - } | { - /** @enum {string} */ - status: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR"; - /** @example 2 */ - failedCodeInputAttemptCount?: number; - /** @example 5 */ - maximumCodeInputAttempts?: number; - } | { - /** @enum {string} */ - status: "RESTART_FLOW_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example true */ + createdNewUser?: boolean; + user?: components["schemas"]["authRecipeUser"]; + recipeUserId?: components["schemas"]["userId"]; + consumedDevice?: { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + /** @example 2 */ + failedCodeInputAttemptCount: number; + email?: components["schemas"]["email"]; + phoneNumber?: components["schemas"]["phoneNumber"]; + }; + } + | { + /** @enum {string} */ + status: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR"; + /** @example 2 */ + failedCodeInputAttemptCount?: number; + /** @example 5 */ + maximumCodeInputAttempts?: number; + } + | { + /** @enum {string} */ + status: "RESTART_FLOW_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -4610,16 +4665,19 @@ export interface operations { }; requestBody?: { content: { - "application/json": { - email: components["schemas"]["email"]; - userInputCode?: components["schemas"]["userInputCode"]; - } | { - phoneNumber: components["schemas"]["phoneNumber"]; - userInputCode?: components["schemas"]["userInputCode"]; - } | { - deviceId: components["schemas"]["deviceId"]; - userInputCode?: components["schemas"]["userInputCode"]; - }; + "application/json": + | { + email: components["schemas"]["email"]; + userInputCode?: components["schemas"]["userInputCode"]; + } + | { + phoneNumber: components["schemas"]["phoneNumber"]; + userInputCode?: components["schemas"]["userInputCode"]; + } + | { + deviceId: components["schemas"]["deviceId"]; + userInputCode?: components["schemas"]["userInputCode"]; + }; }; }; responses: { @@ -4666,11 +4724,13 @@ export interface operations { }; requestBody?: { content: { - "application/json": { - codeId: components["schemas"]["codeId"]; - } | { - preAuthSessionId: components["schemas"]["preAuthSessionId"]; - }; + "application/json": + | { + codeId: components["schemas"]["codeId"]; + } + | { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + }; }; }; responses: { @@ -4767,11 +4827,13 @@ export interface operations { }; requestBody?: { content: { - "application/json": { - email: components["schemas"]["email"]; - } | { - phoneNumber: components["schemas"]["phoneNumber"]; - }; + "application/json": + | { + email: components["schemas"]["email"]; + } + | { + phoneNumber: components["schemas"]["phoneNumber"]; + }; }; }; responses: { @@ -4823,13 +4885,15 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - user?: components["schemas"]["authRecipeUser"]; - } | { - /** @enum {string} */ - status: "UNKNOWN_USER_ID_ERROR" | "UNKNOWN_EMAIL_ERROR" | "UNKNOWN_PHONE_NUMBER_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status: "UNKNOWN_USER_ID_ERROR" | "UNKNOWN_EMAIL_ERROR" | "UNKNOWN_PHONE_NUMBER_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -4871,14 +4935,20 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - /** @enum {string} */ - status: "OK" | "UNKNOWN_USER_ID_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR" | "PHONE_NUMBER_ALREADY_EXISTS_ERROR"; - } | { - /** @enum {string} */ - status: "EMAIL_CHANGE_NOT_ALLOWED_ERROR" | "PHONE_NUMBER_CHANGE_NOT_ALLOWED_ERROR"; - reason?: string; - }; + "application/json": + | { + /** @enum {string} */ + status: + | "OK" + | "UNKNOWN_USER_ID_ERROR" + | "EMAIL_ALREADY_EXISTS_ERROR" + | "PHONE_NUMBER_ALREADY_EXISTS_ERROR"; + } + | { + /** @enum {string} */ + status: "EMAIL_CHANGE_NOT_ALLOWED_ERROR" | "PHONE_NUMBER_CHANGE_NOT_ALLOWED_ERROR"; + reason?: string; + }; }; }; 400: components["responses"]["400"]; @@ -4919,11 +4989,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - user?: components["schemas"]["authRecipeUser"]; - recipeUserId?: components["schemas"]["userId"]; - } | components["schemas"]["wrongCredentialsResponse"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + recipeUserId?: components["schemas"]["userId"]; + } + | components["schemas"]["wrongCredentialsResponse"]; }; }; 400: components["responses"]["400"]; @@ -4964,14 +5036,16 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - user?: components["schemas"]["authRecipeUser"]; - recipeUserId?: components["schemas"]["userId"]; - } | { - /** @enum {string} */ - status: "EMAIL_ALREADY_EXISTS_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + recipeUserId?: components["schemas"]["userId"]; + } + | { + /** @enum {string} */ + status: "EMAIL_ALREADY_EXISTS_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -5010,13 +5084,15 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - user?: components["schemas"]["authRecipeUser"]; - } | { - /** @enum {string} */ - status: "UNKNOWN_USER_ID_ERROR" | "UNKNOWN_EMAIL_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status: "UNKNOWN_USER_ID_ERROR" | "UNKNOWN_EMAIL_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -5058,14 +5134,16 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - /** @enum {string} */ - status: "OK" | "UNKNOWN_USER_ID_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR"; - } | { - /** @enum {string} */ - status: "EMAIL_CHANGE_NOT_ALLOWED_ERROR"; - reason?: string; - }; + "application/json": + | { + /** @enum {string} */ + status: "OK" | "UNKNOWN_USER_ID_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR"; + } + | { + /** @enum {string} */ + status: "EMAIL_CHANGE_NOT_ALLOWED_ERROR"; + reason?: string; + }; }; }; 400: components["responses"]["400"]; @@ -5106,10 +5184,12 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - token?: components["schemas"]["token"]; - } | components["schemas"]["unknownUserIdResponse"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + token?: components["schemas"]["token"]; + } + | components["schemas"]["unknownUserIdResponse"]; }; }; 400: components["responses"]["400"]; @@ -5153,13 +5233,15 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - userId?: components["schemas"]["userId"]; - } | { - /** @enum {string} */ - status: "RESET_PASSWORD_INVALID_TOKEN_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + userId?: components["schemas"]["userId"]; + } + | { + /** @enum {string} */ + status: "RESET_PASSWORD_INVALID_TOKEN_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -5245,14 +5327,16 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - userId?: components["schemas"]["userId"]; - email?: components["schemas"]["email"]; - } | { - /** @enum {string} */ - status: "RESET_PASSWORD_INVALID_TOKEN_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + userId?: components["schemas"]["userId"]; + email?: components["schemas"]["email"]; + } + | { + /** @enum {string} */ + status: "RESET_PASSWORD_INVALID_TOKEN_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -5294,17 +5378,19 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example true */ - createdNewUser?: boolean; - user?: components["schemas"]["authRecipeUser"]; - recipeUserId?: components["schemas"]["userId"]; - } | { - /** @enum {string} */ - status: "EMAIL_CHANGE_NOT_ALLOWED_ERROR"; - reason?: string; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example true */ + createdNewUser?: boolean; + user?: components["schemas"]["authRecipeUser"]; + recipeUserId?: components["schemas"]["userId"]; + } + | { + /** @enum {string} */ + status: "EMAIL_CHANGE_NOT_ALLOWED_ERROR"; + reason?: string; + }; }; }; 400: components["responses"]["400"]; @@ -5344,13 +5430,15 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - user?: components["schemas"]["authRecipeUser"]; - } | { - /** @enum {string} */ - status: "UNKNOWN_USER_ID_ERROR" | "UNKNOWN_THIRD_PARTY_USER_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status: "UNKNOWN_USER_ID_ERROR" | "UNKNOWN_THIRD_PARTY_USER_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -5427,13 +5515,15 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - token?: components["schemas"]["token"]; - } | { - /** @enum {string} */ - status: "EMAIL_ALREADY_VERIFIED_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + token?: components["schemas"]["token"]; + } + | { + /** @enum {string} */ + status: "EMAIL_ALREADY_VERIFIED_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -5516,14 +5606,16 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - userId?: components["schemas"]["userId"]; - email?: components["schemas"]["email"]; - } | { - /** @enum {string} */ - status: "EMAIL_VERIFICATION_INVALID_TOKEN_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + userId?: components["schemas"]["userId"]; + email?: components["schemas"]["email"]; + } + | { + /** @enum {string} */ + status: "EMAIL_VERIFICATION_INVALID_TOKEN_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -5770,11 +5862,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example true */ - didUserAlreadyHaveRole?: boolean; - } | components["schemas"]["unknownRoleResponse"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example true */ + didUserAlreadyHaveRole?: boolean; + } + | components["schemas"]["unknownRoleResponse"]; }; }; 400: components["responses"]["400"]; @@ -5815,11 +5909,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example true */ - didUserHaveRole?: boolean; - } | components["schemas"]["unknownRoleResponse"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example true */ + didUserHaveRole?: boolean; + } + | components["schemas"]["unknownRoleResponse"]; }; }; 400: components["responses"]["400"]; @@ -5894,10 +5990,12 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - users?: components["schemas"]["userId"][]; - } | components["schemas"]["unknownRoleResponse"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + users?: components["schemas"]["userId"][]; + } + | components["schemas"]["unknownRoleResponse"]; }; }; 400: components["responses"]["400"]; @@ -5978,10 +6076,12 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - permissions?: string[]; - } | components["schemas"]["unknownRoleResponse"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + permissions?: string[]; + } + | components["schemas"]["unknownRoleResponse"]; }; }; 400: components["responses"]["400"]; @@ -6022,9 +6122,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - } | components["schemas"]["unknownRoleResponse"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + } + | components["schemas"]["unknownRoleResponse"]; }; }; 400: components["responses"]["400"]; @@ -6234,17 +6336,19 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - userDataInDatabase?: components["schemas"]["userDataInDatabase"]; - userDataInJWT?: components["schemas"]["userDataInJWT"]; - userId?: components["schemas"]["userId"]; - expiry?: components["schemas"]["expiry"]; - timeCreated?: components["schemas"]["timeCreated"]; - sessionHandle?: components["schemas"]["handle"]; - tenantId?: components["schemas"]["tenantId"]; - recipeUserId?: components["schemas"]["userId"]; - } | components["schemas"]["unauthorisedMessageResponse"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + userDataInDatabase?: components["schemas"]["userDataInDatabase"]; + userDataInJWT?: components["schemas"]["userDataInJWT"]; + userId?: components["schemas"]["userId"]; + expiry?: components["schemas"]["expiry"]; + timeCreated?: components["schemas"]["timeCreated"]; + sessionHandle?: components["schemas"]["handle"]; + tenantId?: components["schemas"]["tenantId"]; + recipeUserId?: components["schemas"]["userId"]; + } + | components["schemas"]["unauthorisedMessageResponse"]; }; }; 400: components["responses"]["400"]; @@ -6272,12 +6376,14 @@ export interface operations { }; requestBody?: { content: { - "application/json": { - sessionHandles?: components["schemas"]["sessionHandles"]; - } | { - userId: components["schemas"]["userId"]; - revokeAcrossAllTenants?: boolean; - }; + "application/json": + | { + sessionHandles?: components["schemas"]["sessionHandles"]; + } + | { + userId: components["schemas"]["userId"]; + revokeAcrossAllTenants?: boolean; + }; }; }; responses: { @@ -6318,12 +6424,14 @@ export interface operations { }; requestBody?: { content: { - "application/json": { - sessionHandles?: components["schemas"]["sessionHandles"]; - } | { - userId: components["schemas"]["userId"]; - revokeAcrossAllTenants?: boolean; - }; + "application/json": + | { + sessionHandles?: components["schemas"]["sessionHandles"]; + } + | { + userId: components["schemas"]["userId"]; + revokeAcrossAllTenants?: boolean; + }; }; }; responses: { @@ -6385,14 +6493,17 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - session?: components["schemas"]["session"]; - accessToken?: components["schemas"]["cookieInfo"]; - } | components["schemas"]["unauthorisedMessageResponse"] | { - status: components["schemas"]["tryRefreshTokenResponse"]; - message?: components["schemas"]["message"]; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + session?: components["schemas"]["session"]; + accessToken?: components["schemas"]["cookieInfo"]; + } + | components["schemas"]["unauthorisedMessageResponse"] + | { + status: components["schemas"]["tryRefreshTokenResponse"]; + message?: components["schemas"]["message"]; + }; }; }; 400: components["responses"]["400"]; @@ -6435,20 +6546,23 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - session?: components["schemas"]["session"]; - accessToken?: components["schemas"]["cookieInfo"]; - refreshToken?: components["schemas"]["cookieInfo"]; - antiCsrfToken?: components["schemas"]["token"]; - } | { - status: components["schemas"]["tokenTheftResponse"]; - session?: { - handle: components["schemas"]["handle"]; - userId: components["schemas"]["userId"]; - recipeUserId: components["schemas"]["userId"]; - }; - } | components["schemas"]["unauthorisedMessageResponse"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + session?: components["schemas"]["session"]; + accessToken?: components["schemas"]["cookieInfo"]; + refreshToken?: components["schemas"]["cookieInfo"]; + antiCsrfToken?: components["schemas"]["token"]; + } + | { + status: components["schemas"]["tokenTheftResponse"]; + session?: { + handle: components["schemas"]["handle"]; + userId: components["schemas"]["userId"]; + recipeUserId: components["schemas"]["userId"]; + }; + } + | components["schemas"]["unauthorisedMessageResponse"]; }; }; 400: components["responses"]["400"]; @@ -6569,11 +6683,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - session?: components["schemas"]["session"]; - accessToken?: components["schemas"]["cookieInfo"]; - } | components["schemas"]["unauthorisedMessageResponse"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + session?: components["schemas"]["session"]; + accessToken?: components["schemas"]["cookieInfo"]; + } + | components["schemas"]["unauthorisedMessageResponse"]; }; }; 400: components["responses"]["400"]; @@ -6610,10 +6726,12 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - userDataInDatabase?: components["schemas"]["userDataInDatabase"]; - } | components["schemas"]["unauthorisedMessageResponse"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + userDataInDatabase?: components["schemas"]["userDataInDatabase"]; + } + | components["schemas"]["unauthorisedMessageResponse"]; }; }; 400: components["responses"]["400"]; @@ -6654,7 +6772,9 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": components["schemas"]["statusOKResponse"] | components["schemas"]["unauthorisedMessageResponse"]; + "application/json": + | components["schemas"]["statusOKResponse"] + | components["schemas"]["unauthorisedMessageResponse"]; }; }; 400: components["responses"]["400"]; @@ -6702,14 +6822,16 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c */ - jwt?: string; - } | { - /** @enum {string} */ - status: "UNSUPPORTED_ALGORITHM_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c */ + jwt?: string; + } + | { + /** @enum {string} */ + status: "UNSUPPORTED_ALGORITHM_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -6745,10 +6867,12 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - userDataInJWT?: components["schemas"]["userDataInJWT"]; - } | components["schemas"]["unauthorisedMessageResponse"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + userDataInJWT?: components["schemas"]["userDataInJWT"]; + } + | components["schemas"]["unauthorisedMessageResponse"]; }; }; 400: components["responses"]["400"]; @@ -6789,7 +6913,9 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": components["schemas"]["statusOKResponse"] | components["schemas"]["unauthorisedMessageResponse"]; + "application/json": + | components["schemas"]["statusOKResponse"] + | components["schemas"]["unauthorisedMessageResponse"]; }; }; 400: components["responses"]["400"]; @@ -6817,21 +6943,23 @@ export interface operations { }; requestBody?: { content: { - "application/json": { - /** @example test@example.com */ - email?: string; - /** @example password@123 */ - newPassword?: string; - /** @example test2@example.com */ - newEmail?: string; - } | { - /** @example ue21r-fw32r3-d121-d1 */ - userId?: string; - /** @example password@123 */ - newPassword?: string; - /** @example test2@example.com */ - newEmail?: string; - }; + "application/json": + | { + /** @example test@example.com */ + email?: string; + /** @example password@123 */ + newPassword?: string; + /** @example test2@example.com */ + newEmail?: string; + } + | { + /** @example ue21r-fw32r3-d121-d1 */ + userId?: string; + /** @example password@123 */ + newPassword?: string; + /** @example test2@example.com */ + newEmail?: string; + }; }; }; responses: { @@ -6841,32 +6969,37 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - /** @enum {string} */ - status: "OK"; - user?: { - /** @example r23r-f235th54-g3413gf-r32dr2 */ - userId?: string; - /** @example test@example.com */ - email?: string; - /** @example 391238234792 */ - timeCreated?: number; - }; - } | { - /** @enum {string} */ - status: "EMAIL_ALREADY_EXISTS_ERROR"; - } | { - /** @enum {string} */ - status: "PASSWORD_WEAK_ERROR"; - /** @example Your password must have at least 8 characters */ - message?: string; - } | { - /** @enum {string} */ - status: "INVALID_EMAIL_ERROR"; - } | { - /** @enum {string} */ - status: "UNKNOWN_USER_ERROR"; - }; + "application/json": + | { + /** @enum {string} */ + status: "OK"; + user?: { + /** @example r23r-f235th54-g3413gf-r32dr2 */ + userId?: string; + /** @example test@example.com */ + email?: string; + /** @example 391238234792 */ + timeCreated?: number; + }; + } + | { + /** @enum {string} */ + status: "EMAIL_ALREADY_EXISTS_ERROR"; + } + | { + /** @enum {string} */ + status: "PASSWORD_WEAK_ERROR"; + /** @example Your password must have at least 8 characters */ + message?: string; + } + | { + /** @enum {string} */ + status: "INVALID_EMAIL_ERROR"; + } + | { + /** @enum {string} */ + status: "UNKNOWN_USER_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -6909,29 +7042,33 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - /** @enum {string} */ - status: "OK"; - user?: { - /** @example example-userid */ - userId?: string; - /** @example test@example.com */ - email?: string; - /** @example 1231321231 */ - timeCreated?: number; - }; - } | { - /** @enum {string} */ - status: "EMAIL_ALREADY_EXISTS_ERROR"; - } | { - /** @enum {string} */ - status: "PASSWORD_WEAK_ERROR"; - /** @example Your password must have at least 8 characters */ - message?: string; - } | { - /** @enum {string} */ - status: "INVALID_EMAIL_ERROR"; - }; + "application/json": + | { + /** @enum {string} */ + status: "OK"; + user?: { + /** @example example-userid */ + userId?: string; + /** @example test@example.com */ + email?: string; + /** @example 1231321231 */ + timeCreated?: number; + }; + } + | { + /** @enum {string} */ + status: "EMAIL_ALREADY_EXISTS_ERROR"; + } + | { + /** @enum {string} */ + status: "PASSWORD_WEAK_ERROR"; + /** @example Your password must have at least 8 characters */ + message?: string; + } + | { + /** @enum {string} */ + status: "INVALID_EMAIL_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -7073,19 +7210,22 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - /** @enum {string} */ - status: "OK"; - email?: string; - } | { - /** @enum {string} */ - status: "USER_SUSPENDED_ERROR"; - /** @example You have crossed the free dashboard user limit. Please purchase the dashboard feature or login with a valid user account */ - message?: string; - } | { - /** @enum {string} */ - status: "INVAlID_SESSION_ERROR"; - }; + "application/json": + | { + /** @enum {string} */ + status: "OK"; + email?: string; + } + | { + /** @enum {string} */ + status: "USER_SUSPENDED_ERROR"; + /** @example You have crossed the free dashboard user limit. Please purchase the dashboard feature or login with a valid user account */ + message?: string; + } + | { + /** @enum {string} */ + status: "INVAlID_SESSION_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -7166,20 +7306,23 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - /** @enum {string} */ - status: "OK"; - /** @example null */ - sessionId?: string; - } | { - /** @enum {string} */ - status: "USER_SUSPENDED_ERROR"; - /** @example You have crossed the free dashboard user limit. Please purchase the dashboard feature or login with a valid user account */ - message?: string; - } | { - /** @enum {string} */ - status: "INVAlID_CREDENTIALS_ERROR"; - }; + "application/json": + | { + /** @enum {string} */ + status: "OK"; + /** @example null */ + sessionId?: string; + } + | { + /** @enum {string} */ + status: "USER_SUSPENDED_ERROR"; + /** @example You have crossed the free dashboard user limit. Please purchase the dashboard feature or login with a valid user account */ + message?: string; + } + | { + /** @enum {string} */ + status: "INVAlID_CREDENTIALS_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -7291,14 +7434,16 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example /usr/lib/supertokens/config.yaml */ - path?: string; - } | { - /** @enum {string} */ - status: "NOT_ALLOWED"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example /usr/lib/supertokens/config.yaml */ + path?: string; + } + | { + /** @enum {string} */ + status: "NOT_ALLOWED"; + }; }; }; 400: components["responses"]["400"]; @@ -7395,15 +7540,17 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - /** @enum {boolean} */ - exists: true; - /** @example 99c87c72-1807-22d-9b39-7a88f95re56c */ - telemetryId: string; - } | { - /** @enum {boolean} */ - exists: false; - }; + "application/json": + | { + /** @enum {boolean} */ + exists: true; + /** @example 99c87c72-1807-22d-9b39-7a88f95re56c */ + telemetryId: string; + } + | { + /** @enum {boolean} */ + exists: false; + }; }; }; 400: components["responses"]["400"]; @@ -7680,14 +7827,16 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example eyJhbGciOiJIUzI1NiIsIn... */ - licenseKey?: string; - } | { - /** @enum {string} */ - status: "NO_LICENSE_KEY_FOUND_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example eyJhbGciOiJIUzI1NiIsIn... */ + licenseKey?: string; + } + | { + /** @enum {string} */ + status: "NO_LICENSE_KEY_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -7725,15 +7874,18 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - } | { - /** @enum {string} */ - status: "MISSING_EE_FOLDER_ERROR"; - } | { - /** @enum {string} */ - status: "INVALID_LICENSE_KEY_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + } + | { + /** @enum {string} */ + status: "MISSING_EE_FOLDER_ERROR"; + } + | { + /** @enum {string} */ + status: "INVALID_LICENSE_KEY_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -7799,13 +7951,15 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - user?: components["schemas"]["authRecipeUser"]; - } | { - /** @enum {string} */ - status: "UNKNOWN_USER_ID_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status: "UNKNOWN_USER_ID_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -8448,12 +8602,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": ({ - status: components["schemas"]["statusOK"]; - } & components["schemas"]["tenantConfig"]) | { - /** @enum {string} */ - status: "TENANT_NOT_FOUND_ERROR"; - }; + "application/json": + | ({ + status: components["schemas"]["statusOK"]; + } & components["schemas"]["tenantConfig"]) + | { + /** @enum {string} */ + status: "TENANT_NOT_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -8488,12 +8644,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": ({ - status: components["schemas"]["statusOK"]; - } & components["schemas"]["tenantConfigV2"]) | { - /** @enum {string} */ - status: "TENANT_NOT_FOUND_ERROR"; - }; + "application/json": + | ({ + status: components["schemas"]["statusOK"]; + } & components["schemas"]["tenantConfigV2"]) + | { + /** @enum {string} */ + status: "TENANT_NOT_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -8802,17 +8960,24 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - wasAlreadyAssociated: boolean; - } | { - /** @enum {string} */ - status: "UNKNOWN_USER_ID_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR" | "PHONE_NUMBER_ALREADY_EXISTS_ERROR" | "THIRD_PARTY_USER_ALREADY_EXISTS_ERROR"; - } | { - /** @enum {string} */ - status: "ASSOCIATION_NOT_ALLOWED_ERROR"; - reason?: string; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + wasAlreadyAssociated: boolean; + } + | { + /** @enum {string} */ + status: + | "UNKNOWN_USER_ID_ERROR" + | "EMAIL_ALREADY_EXISTS_ERROR" + | "PHONE_NUMBER_ALREADY_EXISTS_ERROR" + | "THIRD_PARTY_USER_ALREADY_EXISTS_ERROR"; + } + | { + /** @enum {string} */ + status: "ASSOCIATION_NOT_ALLOWED_ERROR"; + reason?: string; + }; }; }; 400: components["responses"]["400"]; @@ -8894,12 +9059,15 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": ({ - status: components["schemas"]["statusOK"]; - } & components["schemas"]["oauthClient"]) | components["schemas"]["oauthError"] | { - /** @enum {string} */ - status: "CLIENT_NOT_FOUND_ERROR"; - }; + "application/json": + | ({ + status: components["schemas"]["statusOK"]; + } & components["schemas"]["oauthClient"]) + | components["schemas"]["oauthError"] + | { + /** @enum {string} */ + status: "CLIENT_NOT_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -8938,9 +9106,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": ({ - status: components["schemas"]["statusOK"]; - } & components["schemas"]["oauthClient"]) | components["schemas"]["oauthError"]; + "application/json": + | ({ + status: components["schemas"]["statusOK"]; + } & components["schemas"]["oauthClient"]) + | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -8979,9 +9149,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": ({ - status: components["schemas"]["statusOK"]; - } & components["schemas"]["oauthClient"]) | components["schemas"]["oauthError"]; + "application/json": + | ({ + status: components["schemas"]["statusOK"]; + } & components["schemas"]["oauthClient"]) + | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9020,11 +9192,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - clients?: components["schemas"]["oauthClient"][]; - nextPaginationToken?: string; - } | components["schemas"]["oauthError"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + clients?: components["schemas"]["oauthClient"][]; + nextPaginationToken?: string; + } + | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9066,11 +9240,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example true */ - didExist?: boolean; - } | components["schemas"]["oauthError"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example true */ + didExist?: boolean; + } + | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9322,30 +9498,32 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - challenge?: string; - client?: components["schemas"]["oauthClient"]; - requestUrl: string; - requestedAccessTokenAudience?: string[]; - requestedScope?: string[]; - sessionId?: string; - skip?: boolean; - subject?: string; - oidcContext?: { - acrValues?: string[]; - display?: string; - idTokenHintClaims?: Record; - loginHint?: string; - uiLocales?: string[]; - requestUrl?: string; - requestedAccessTokenAudience?: string[]; - requestedScope?: string[]; - sessionId?: string; - skip?: boolean; - subject?: string; - }; - } | components["schemas"]["oauthError"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + challenge?: string; + client?: components["schemas"]["oauthClient"]; + requestUrl: string; + requestedAccessTokenAudience?: string[]; + requestedScope?: string[]; + sessionId?: string; + skip?: boolean; + subject?: string; + oidcContext?: { + acrValues?: string[]; + display?: string; + idTokenHintClaims?: Record; + loginHint?: string; + uiLocales?: string[]; + requestUrl?: string; + requestedAccessTokenAudience?: string[]; + requestedScope?: string[]; + sessionId?: string; + skip?: boolean; + subject?: string; + }; + } + | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9496,11 +9674,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example {apiDomain}/oauth/logout?... */ - redirectTo?: string; - } | components["schemas"]["oauthError"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example {apiDomain}/oauth/logout?... */ + redirectTo?: string; + } + | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9541,9 +9721,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - } | components["schemas"]["oauthError"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + } + | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9584,11 +9766,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example true */ - didExist?: boolean; - } | components["schemas"]["oauthError"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example true */ + didExist?: boolean; + } + | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9629,11 +9813,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example true */ - didExist?: boolean; - } | components["schemas"]["oauthError"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example true */ + didExist?: boolean; + } + | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9675,11 +9861,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example true */ - didExist?: boolean; - } | components["schemas"]["oauthError"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example true */ + didExist?: boolean; + } + | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9714,9 +9902,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": ({ - status: components["schemas"]["statusOK"]; - } & components["schemas"]["oauthClient"]) | components["schemas"]["oauthError"]; + "application/json": + | ({ + status: components["schemas"]["statusOK"]; + } & components["schemas"]["oauthClient"]) + | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9753,14 +9943,17 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - redirectTo: string; - cookies: string[]; - } | components["schemas"]["oauthError"] | { - /** @enum {string} */ - status: "CLIENT_NOT_FOUND_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + redirectTo: string; + cookies: string[]; + } + | components["schemas"]["oauthError"] + | { + /** @enum {string} */ + status: "CLIENT_NOT_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -9808,24 +10001,27 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example eyJraWQiOiJzLTBjZmVmMDdkLWQ2NDktNGIwOC04MTVjLWJkYjZlYTczNWQyZCIsInR5cCI6IkpXVCIsImFsZyI6IlJTMjU2In0.eyJpYXQiOjE3NDAzODU5MzcsImV4cCI6MTc0MDM4OTUzOCwiY2xpZW50X2lkIjoic3RjbF82NWUwODc1Mi0yYzU5LTQ5NjQtOTM0Yy02OTIwZDJmMDZlNjIiLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjMwMDEvYXV0aCIsImp0aSI6Ijc1NTc2MmFmLTUwYTUtNDc1ZS04YWRkLTg3MDA1ZmU3YWJlNiIsIm5iZiI6MTc0MDM4NTkzNywic2NwIjpbIm9wZW5pZCIsIm9mZmxpbmVfYWNjZXNzIl0sInN1YiI6InNvbWV1c2VyaWQiLCJzdHQiOjEsImdpZCI6ImRjOGQ0OGUzLTcwOTgtNDhhNi1hYjU0LTgxMWMyODQ4N2I4MiIsInRJZCI6InB1YmxpYyIsInJzdWIiOiJzb21ldXNlcmlkIiwic2Vzc2lvbkhhbmRsZSI6InNlc3Npb24taGFuZGxlIn0.DgVgtD2gXgzHrDsC2lIUBa-wsYm8KO4Pg8L1Ov3aSBVgjwtjiCO40ldjBZ9qKdQBq5Qqk0ElAZNj6Bzc40ESfQumLH3_N2XtOj568s71JPuEOIg5hs9XAdK4vYfXMhVQRWn9iPUKHKrpRVf73IIH0mpkN8i6_MhcDoMMOuG5XPlXajG9VOyoY_5saHA61-uTafZLdAgKqnmYGvS8KmNEcEbBWLGwFB4QQKiDAUvatIi5n3juFBUxyt9t6DrqT1D04shesRppa0XhCZbCFBv1dixSrprdtqKhlPOrMgvOGNZ3cBLbYBOG9zoJRD5YlVMGw-j_pE7IbvpDWKL7tTJS1Q */ - access_token: string; - /** @example 3599 */ - expires_in?: number; - /** @example eyJraWQiOiJzLTBjZmVmMDdkLWQ2NDktNGIwOC04MTVjLWJkYjZlYTczNWQyZCIsInR5cCI6IkpXVCIsImFsZyI6IlJTMjU2In0.eyJpYXQiOjE3NDAzODU5MzgsImV4cCI6MTc0MDM4OTUzOCwiYXRfaGFzaCI6IkNxOGNCSk01Nm5FcG9aaWREcnZvLVEiLCJhdWQiOiJzdGNsXzY1ZTA4NzUyLTJjNTktNDk2NC05MzRjLTY5MjBkMmYwNmU2MiIsImF1dGhfdGltZSI6MTc0MDM4NTkzNywiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDozMDAxL2F1dGgiLCJqdGkiOiIxZDA5OGUxZi04ZGIxLTQyNzUtYmMzYS0zYTA4NjdjOWE2NTAiLCJyYXQiOjE3NDAzODU3MzEsInNpZCI6InNlc3Npb24taGFuZGxlIiwic3ViIjoic29tZXVzZXJpZCIsInN0dCI6MiwiZ2lkIjoiYzk1OTVjYjItMWFjOS00MDI0LWFjNjMtNDJlZDEyODliY2RmIn0.PGsemf1qpLF-cE_616NHvKsRmanFiyba0yqF2j5fy87AWD5McI405A4eqi-wAlKsDxC-MPpuW8bx-08YUhs3x6ku4aFaDyA-M-Xhc65fJJ4SCPVaUL7qlUwl7wJwNs2rMRW3Ayyj4MDSlW5uqm39_K_bBqod2Qj1yqck-N0g78qh86uEcyX6Al3d5KSln1B21nwDsEgegk3xzE8lFMCQUTpZEYb5-1v2D0Bu_PblBfOCjA6mBtT1IIQkmSE27FvkTUS1H50EUyhFP4JH30kP3bUnQ9pOqGMTe405N2ruKtPyWsXHLPlQ4hcJCLO5GT5ZgtUjfz6Y3mCM9l69uDYDHg */ - id_token?: string; - /** @example st_rt_d7LI9mGYHF2TAaVEFJi7fqOWo8ZQ8zEGpuxhHQs0R18.UZ0nbTuuYuDD8G54PCD8AKHdsh9cezu8BTxVlTy7pYw */ - refresh_token?: string; - /** @example openid offline_access */ - scope?: string; - /** @example bearer */ - token_type?: string; - } | components["schemas"]["oauthError"] | { - /** @enum {string} */ - status: "CLIENT_NOT_FOUND_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example eyJraWQiOiJzLTBjZmVmMDdkLWQ2NDktNGIwOC04MTVjLWJkYjZlYTczNWQyZCIsInR5cCI6IkpXVCIsImFsZyI6IlJTMjU2In0.eyJpYXQiOjE3NDAzODU5MzcsImV4cCI6MTc0MDM4OTUzOCwiY2xpZW50X2lkIjoic3RjbF82NWUwODc1Mi0yYzU5LTQ5NjQtOTM0Yy02OTIwZDJmMDZlNjIiLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjMwMDEvYXV0aCIsImp0aSI6Ijc1NTc2MmFmLTUwYTUtNDc1ZS04YWRkLTg3MDA1ZmU3YWJlNiIsIm5iZiI6MTc0MDM4NTkzNywic2NwIjpbIm9wZW5pZCIsIm9mZmxpbmVfYWNjZXNzIl0sInN1YiI6InNvbWV1c2VyaWQiLCJzdHQiOjEsImdpZCI6ImRjOGQ0OGUzLTcwOTgtNDhhNi1hYjU0LTgxMWMyODQ4N2I4MiIsInRJZCI6InB1YmxpYyIsInJzdWIiOiJzb21ldXNlcmlkIiwic2Vzc2lvbkhhbmRsZSI6InNlc3Npb24taGFuZGxlIn0.DgVgtD2gXgzHrDsC2lIUBa-wsYm8KO4Pg8L1Ov3aSBVgjwtjiCO40ldjBZ9qKdQBq5Qqk0ElAZNj6Bzc40ESfQumLH3_N2XtOj568s71JPuEOIg5hs9XAdK4vYfXMhVQRWn9iPUKHKrpRVf73IIH0mpkN8i6_MhcDoMMOuG5XPlXajG9VOyoY_5saHA61-uTafZLdAgKqnmYGvS8KmNEcEbBWLGwFB4QQKiDAUvatIi5n3juFBUxyt9t6DrqT1D04shesRppa0XhCZbCFBv1dixSrprdtqKhlPOrMgvOGNZ3cBLbYBOG9zoJRD5YlVMGw-j_pE7IbvpDWKL7tTJS1Q */ + access_token: string; + /** @example 3599 */ + expires_in?: number; + /** @example eyJraWQiOiJzLTBjZmVmMDdkLWQ2NDktNGIwOC04MTVjLWJkYjZlYTczNWQyZCIsInR5cCI6IkpXVCIsImFsZyI6IlJTMjU2In0.eyJpYXQiOjE3NDAzODU5MzgsImV4cCI6MTc0MDM4OTUzOCwiYXRfaGFzaCI6IkNxOGNCSk01Nm5FcG9aaWREcnZvLVEiLCJhdWQiOiJzdGNsXzY1ZTA4NzUyLTJjNTktNDk2NC05MzRjLTY5MjBkMmYwNmU2MiIsImF1dGhfdGltZSI6MTc0MDM4NTkzNywiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDozMDAxL2F1dGgiLCJqdGkiOiIxZDA5OGUxZi04ZGIxLTQyNzUtYmMzYS0zYTA4NjdjOWE2NTAiLCJyYXQiOjE3NDAzODU3MzEsInNpZCI6InNlc3Npb24taGFuZGxlIiwic3ViIjoic29tZXVzZXJpZCIsInN0dCI6MiwiZ2lkIjoiYzk1OTVjYjItMWFjOS00MDI0LWFjNjMtNDJlZDEyODliY2RmIn0.PGsemf1qpLF-cE_616NHvKsRmanFiyba0yqF2j5fy87AWD5McI405A4eqi-wAlKsDxC-MPpuW8bx-08YUhs3x6ku4aFaDyA-M-Xhc65fJJ4SCPVaUL7qlUwl7wJwNs2rMRW3Ayyj4MDSlW5uqm39_K_bBqod2Qj1yqck-N0g78qh86uEcyX6Al3d5KSln1B21nwDsEgegk3xzE8lFMCQUTpZEYb5-1v2D0Bu_PblBfOCjA6mBtT1IIQkmSE27FvkTUS1H50EUyhFP4JH30kP3bUnQ9pOqGMTe405N2ruKtPyWsXHLPlQ4hcJCLO5GT5ZgtUjfz6Y3mCM9l69uDYDHg */ + id_token?: string; + /** @example st_rt_d7LI9mGYHF2TAaVEFJi7fqOWo8ZQ8zEGpuxhHQs0R18.UZ0nbTuuYuDD8G54PCD8AKHdsh9cezu8BTxVlTy7pYw */ + refresh_token?: string; + /** @example openid offline_access */ + scope?: string; + /** @example bearer */ + token_type?: string; + } + | components["schemas"]["oauthError"] + | { + /** @enum {string} */ + status: "CLIENT_NOT_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -9865,11 +10061,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example {apiDomain}/oauth/logout?... */ - redirectTo?: string; - } | components["schemas"]["oauthError"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example {apiDomain}/oauth/logout?... */ + redirectTo?: string; + } + | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -10134,20 +10332,22 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example ea7a0931-b533-4478-9253-0fde890ca23 */ - webauthnCredentialId?: string; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - recipeUserId?: string; - /** @example example.com */ - relyingPartyId?: string; - /** @example 1741793746 */ - createdAt?: number; - } | { - /** @enum {string} */ - status: "CREDENTIAL_NOT_FOUND_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example ea7a0931-b533-4478-9253-0fde890ca23 */ + webauthnCredentialId?: string; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId?: string; + /** @example example.com */ + relyingPartyId?: string; + /** @example 1741793746 */ + createdAt?: number; + } + | { + /** @enum {string} */ + status: "CREDENTIAL_NOT_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10292,15 +10492,17 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - recipeUserId?: string; - user?: components["schemas"]["authRecipeUser"]; - } | { - /** @enum {string} */ - status: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId?: string; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10358,56 +10560,58 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - webauthnGeneratedOptionsId?: string; - rp?: { - /** @example example.com */ - id?: string; - /** @example Example */ - name?: string; - }; - user?: { - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - id?: string; - /** @example John Doe */ - name?: string; - /** @example John Doe */ - displayName?: string; - }; - email?: components["schemas"]["email"]; - /** @example TQvEVDV8B64w_2zIifzKaPzBPfthqpx2uJkq_2PIB0k */ - challenge?: string; - /** @example 10000 */ - timeout?: number; - /** @example none */ - attestation?: string; - /** @example 1741793746 */ - createdAt?: number; - /** @example 1741793746 */ - expiresAt?: number; - pubKeyCredParams?: { - /** @example public-key */ - type?: string; - /** @example -7 */ - alg?: number; - }[]; - excludeCredentials?: { - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - id?: string; - transport?: string[]; - }[]; - authenticatorSelection?: { - userVerification?: components["schemas"]["userVerification"]; - /** @example true */ - requireResidentKey?: boolean; - }; - } | { - /** @enum {string} */ - status: "INVALID_OPTIONS_ERROR"; - reason?: string; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + webauthnGeneratedOptionsId?: string; + rp?: { + /** @example example.com */ + id?: string; + /** @example Example */ + name?: string; + }; + user?: { + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + id?: string; + /** @example John Doe */ + name?: string; + /** @example John Doe */ + displayName?: string; + }; + email?: components["schemas"]["email"]; + /** @example TQvEVDV8B64w_2zIifzKaPzBPfthqpx2uJkq_2PIB0k */ + challenge?: string; + /** @example 10000 */ + timeout?: number; + /** @example none */ + attestation?: string; + /** @example 1741793746 */ + createdAt?: number; + /** @example 1741793746 */ + expiresAt?: number; + pubKeyCredParams?: { + /** @example public-key */ + type?: string; + /** @example -7 */ + alg?: number; + }[]; + excludeCredentials?: { + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + id?: string; + transport?: string[]; + }[]; + authenticatorSelection?: { + userVerification?: components["schemas"]["userVerification"]; + /** @example true */ + requireResidentKey?: boolean; + }; + } + | { + /** @enum {string} */ + status: "INVALID_OPTIONS_ERROR"; + reason?: string; + }; }; }; 400: components["responses"]["400"]; @@ -10457,28 +10661,30 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - webauthnGeneratedOptionsId?: string; - /** @example example.com */ - relyingPartyId?: string; - /** @example TQvEVDV8B64w_2zIifzKaPzBPfthqpx2uJkq_2PIB0k */ - challenge?: string; - /** @example 10000 */ - timeout?: number; - userVerification?: components["schemas"]["userVerification"]; - /** @example true */ - userPresence?: boolean; - /** @example 1741793746 */ - createdAt?: string; - /** @example 1741793746 */ - expiresAt?: string; - } | { - /** @enum {string} */ - status: "INVALID_OPTIONS_ERROR"; - reason?: string; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + webauthnGeneratedOptionsId?: string; + /** @example example.com */ + relyingPartyId?: string; + /** @example TQvEVDV8B64w_2zIifzKaPzBPfthqpx2uJkq_2PIB0k */ + challenge?: string; + /** @example 10000 */ + timeout?: number; + userVerification?: components["schemas"]["userVerification"]; + /** @example true */ + userPresence?: boolean; + /** @example 1741793746 */ + createdAt?: string; + /** @example 1741793746 */ + expiresAt?: string; + } + | { + /** @enum {string} */ + status: "INVALID_OPTIONS_ERROR"; + reason?: string; + }; }; }; 400: components["responses"]["400"]; @@ -10522,25 +10728,28 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - webauthnCredentialId?: string; - /** @example example.com */ - relyingPartyId?: string; - /** @example Example */ - relyingPartyName?: string; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - recipeUserId?: string; - email?: components["schemas"]["email"]; - } | { - /** @enum {string} */ - status: "INVALID_AUTHENTICATOR_ERROR"; - reason?: string; - } | { - /** @enum {string} */ - status: "OPTIONS_NOT_FOUND_ERROR" | "INVALID_CREDENTIALS_ERROR" | "INVALID_OPTIONS_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + webauthnCredentialId?: string; + /** @example example.com */ + relyingPartyId?: string; + /** @example Example */ + relyingPartyName?: string; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId?: string; + email?: components["schemas"]["email"]; + } + | { + /** @enum {string} */ + status: "INVALID_AUTHENTICATOR_ERROR"; + reason?: string; + } + | { + /** @enum {string} */ + status: "OPTIONS_NOT_FOUND_ERROR" | "INVALID_CREDENTIALS_ERROR" | "INVALID_OPTIONS_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10583,25 +10792,31 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - webauthnCredentialId?: string; - /** @example example.com */ - relyingPartyId?: string; - /** @example Example */ - relyingPartyName?: string; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - recipeUserId?: string; - user?: components["schemas"]["authRecipeUser"]; - } | { - /** @enum {string} */ - status: "INVALID_OPTIONS_ERROR" | "INVALID_AUTHENTICATOR_ERROR" | "INVALID_CREDENTIALS_ERROR"; - reason?: string; - } | { - /** @enum {string} */ - status: "OPTIONS_NOT_FOUND_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + webauthnCredentialId?: string; + /** @example example.com */ + relyingPartyId?: string; + /** @example Example */ + relyingPartyName?: string; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId?: string; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status: + | "INVALID_OPTIONS_ERROR" + | "INVALID_AUTHENTICATOR_ERROR" + | "INVALID_CREDENTIALS_ERROR"; + reason?: string; + } + | { + /** @enum {string} */ + status: "OPTIONS_NOT_FOUND_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10644,19 +10859,28 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - recipeUserId?: string; - user?: components["schemas"]["authRecipeUser"]; - } | { - /** @enum {string} */ - status: "INVALID_OPTIONS_ERROR" | "INVALID_AUTHENTICATOR_ERROR" | "INVALID_CREDENTIALS_ERROR"; - reason?: string; - } | { - /** @enum {string} */ - status: "OPTIONS_NOT_FOUND_ERROR" | "CREDENTIAL_NOT_FOUND_ERROR" | "UNKNOWN_USER_ID_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId?: string; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status: + | "INVALID_OPTIONS_ERROR" + | "INVALID_AUTHENTICATOR_ERROR" + | "INVALID_CREDENTIALS_ERROR"; + reason?: string; + } + | { + /** @enum {string} */ + status: + | "OPTIONS_NOT_FOUND_ERROR" + | "CREDENTIAL_NOT_FOUND_ERROR" + | "UNKNOWN_USER_ID_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10697,14 +10921,16 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example ZmE3YTA4NDEtYjUzMy00NDc4LTkyNTMtMGZkZTg5MGM1NzY */ - token?: string; - } | { - /** @enum {string} */ - status: "UNKNOWN_USER_ID_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example ZmE3YTA4NDEtYjUzMy00NDc4LTkyNTMtMGZkZTg5MGM1NzY */ + token?: string; + } + | { + /** @enum {string} */ + status: "UNKNOWN_USER_ID_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10745,14 +10971,16 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - userId?: components["schemas"]["userId"]; - email?: components["schemas"]["email"]; - } | { - /** @enum {string} */ - status: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + userId?: components["schemas"]["userId"]; + email?: components["schemas"]["email"]; + } + | { + /** @enum {string} */ + status: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10793,12 +11021,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - } | { - /** @enum {string} */ - status: "UNKNOWN_USER_ID_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + } + | { + /** @enum {string} */ + status: "UNKNOWN_USER_ID_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10835,12 +11065,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - } | { - /** @enum {string} */ - status: "CREDENTIAL_NOT_FOUND_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + } + | { + /** @enum {string} */ + status: "CREDENTIAL_NOT_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10876,12 +11108,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - } | { - /** @enum {string} */ - status: "OPTIONS_NOT_FOUND_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + } + | { + /** @enum {string} */ + status: "OPTIONS_NOT_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; diff --git a/lib/ts/customFramework.ts b/lib/ts/customFramework.ts index 36c273d26..e68ad6eaf 100644 --- a/lib/ts/customFramework.ts +++ b/lib/ts/customFramework.ts @@ -130,9 +130,7 @@ export async function getSessionForSSR - ): Promise<{ + static async getSSRSession(cookies: Array<{ name: string; value: string }>): Promise<{ accessTokenPayload: JWTPayload | undefined; hasToken: boolean; error: Error | undefined; diff --git a/lib/ts/querier.ts b/lib/ts/querier.ts index b1f3b18fd..010e0bbb5 100644 --- a/lib/ts/querier.ts +++ b/lib/ts/querier.ts @@ -23,8 +23,8 @@ import { UserContext } from "./types"; import { NetworkInterceptor } from "./types"; import SuperTokens from "./supertokens"; -import { PathParam, RequestBody, ResponseBody } from "../core/types"; -import { paths } from "../core/paths"; +import { PathParam, RequestBody, ResponseBody } from "./core/types"; +import { paths } from "./core/paths"; export class Querier { private static initCalled = false; @@ -46,7 +46,7 @@ export class Querier { // to support multiple rIds per API private constructor( hosts: { domain: NormalisedURLDomain; basePath: NormalisedURLPath }[] | undefined, - rIdToCore?: string, + rIdToCore?: string ) { this.__hosts = hosts; this.rIdToCore = rIdToCore; @@ -89,7 +89,7 @@ export class Querier { headers: headers, params: queryParamsObj, }, - userContext, + userContext ); url = request.url; headers = request.headers; @@ -101,13 +101,13 @@ export class Querier { }); return response; }, - this.__hosts?.length || 0, + this.__hosts?.length || 0 ); let cdiSupportedByServer: string[] = response.versions; let supportedVersion = getLargestVersionFromIntersection(cdiSupportedByServer, cdiSupported); if (supportedVersion === undefined) { throw Error( - "The running SuperTokens core version is not compatible with this NodeJS SDK. Please visit https://supertokens.io/docs/community/compatibility to find the right versions", + "The running SuperTokens core version is not compatible with this NodeJS SDK. Please visit https://supertokens.io/docs/community/compatibility to find the right versions" ); } Querier.apiVersion = supportedVersion; @@ -140,7 +140,7 @@ export class Querier { hosts?: { domain: NormalisedURLDomain; basePath: NormalisedURLPath }[], apiKey?: string, networkInterceptor?: NetworkInterceptor, - disableCache?: boolean, + disableCache?: boolean ) { if (!Querier.initCalled) { logDebugMessage("querier initialized"); @@ -157,7 +157,7 @@ export class Querier { private getPath =

(path: PathParam

): NormalisedURLPath => { const template = typeof path === "string" ? path : path.path; - const params = typeof path === "string" ? {} : (path.params ?? {}); + const params = typeof path === "string" ? {} : path.params ?? {}; let populated = String(template); for (const [key, value] of Object.entries(params)) { @@ -171,7 +171,7 @@ export class Querier { sendPostRequest = async

( template: PathParam

, body: RequestBody, - userContext: UserContext, + userContext: UserContext ): Promise> => { this.invalidateCoreCallCache(userContext); const path = this.getPath(template); @@ -206,7 +206,7 @@ export class Querier { headers: headers, body: body, }, - userContext, + userContext ); url = request.url; headers = request.headers; @@ -220,7 +220,7 @@ export class Querier { headers, }); }, - this.__hosts?.length || 0, + this.__hosts?.length || 0 ); return respBody; }; @@ -230,7 +230,7 @@ export class Querier { template: PathParam

, body: RequestBody, params: any | undefined, - userContext: UserContext, + userContext: UserContext ): Promise> => { this.invalidateCoreCallCache(userContext); const path = this.getPath(template); @@ -262,7 +262,7 @@ export class Querier { params: params, body: body, }, - userContext, + userContext ); url = request.url; headers = request.headers; @@ -284,7 +284,7 @@ export class Querier { headers, }); }, - this.__hosts?.length || 0, + this.__hosts?.length || 0 ); return respBody; }; @@ -293,7 +293,7 @@ export class Querier { sendGetRequest = async

( template: PathParam

, params: Record, - userContext: UserContext, + userContext: UserContext ): Promise> => { const path = this.getPath(template); const { body: respBody } = await this.sendRequestHelper( @@ -357,7 +357,7 @@ export class Querier { headers: headers, params: params, }, - userContext, + userContext ); url = request.url; headers = request.headers; @@ -367,7 +367,7 @@ export class Querier { } const finalURL = new URL(url); const searchParams = new URLSearchParams( - Object.entries(params).filter(([_, value]) => value !== undefined) as string[][], + Object.entries(params).filter(([_, value]) => value !== undefined) as string[][] ); finalURL.search = searchParams.toString(); @@ -396,7 +396,7 @@ export class Querier { return response; }, - this.__hosts?.length || 0, + this.__hosts?.length || 0 ); return respBody; @@ -406,7 +406,7 @@ export class Querier { template: PathParam

, params: Record, inpHeaders: Record | undefined, - userContext: UserContext, + userContext: UserContext ): Promise<{ body: ResponseBody; headers: Headers }> => { const path = this.getPath(template); return await this.sendRequestHelper( @@ -437,7 +437,7 @@ export class Querier { headers: headers, params: params, }, - userContext, + userContext ); url = request.url; headers = request.headers; @@ -447,7 +447,7 @@ export class Querier { } const finalURL = new URL(url); const searchParams = new URLSearchParams( - Object.entries(params).filter(([_, value]) => value !== undefined) as string[][], + Object.entries(params).filter(([_, value]) => value !== undefined) as string[][] ); finalURL.search = searchParams.toString(); return doFetch(finalURL.toString(), { @@ -455,7 +455,7 @@ export class Querier { headers, }); }, - this.__hosts?.length || 0, + this.__hosts?.length || 0 ); }; @@ -464,7 +464,7 @@ export class Querier { template: PathParam

, body: RequestBody, params: Record, - userContext: UserContext, + userContext: UserContext ): Promise> => { this.invalidateCoreCallCache(userContext); const path = this.getPath(template); @@ -496,7 +496,7 @@ export class Querier { body: body, params: params, }, - userContext, + userContext ); url = request.url; headers = request.headers; @@ -507,7 +507,7 @@ export class Querier { const finalURL = new URL(url); const searchParams = new URLSearchParams( - Object.entries(params).filter(([_, value]) => value !== undefined) as string[][], + Object.entries(params).filter(([_, value]) => value !== undefined) as string[][] ); finalURL.search = searchParams.toString(); @@ -517,7 +517,7 @@ export class Querier { headers, }); }, - this.__hosts?.length || 0, + this.__hosts?.length || 0 ); return respBody; }; @@ -526,7 +526,7 @@ export class Querier { sendPatchRequest = async

( template: PathParam

, body: RequestBody, - userContext: UserContext, + userContext: UserContext ): Promise> => { this.invalidateCoreCallCache(userContext); const path = this.getPath(template); @@ -557,7 +557,7 @@ export class Querier { headers: headers, body: body, }, - userContext, + userContext ); url = request.url; headers = request.headers; @@ -572,7 +572,7 @@ export class Querier { headers, }); }, - this.__hosts?.length || 0, + this.__hosts?.length || 0 ); return respBody; }; @@ -609,11 +609,11 @@ export class Querier { method: string, requestFunc: (url: string) => Promise, numberOfTries: number, - retryInfoMap?: Record, + retryInfoMap?: Record ): Promise => { if (this.__hosts === undefined) { throw Error( - "No SuperTokens core available to query. Please pass supertokens > connectionURI to the init function, or override all the functions of the recipe you are using.", + "No SuperTokens core available to query. Please pass supertokens > connectionURI to the init function, or override all the functions of the recipe you are using." ); } if (numberOfTries === 0) { @@ -652,7 +652,7 @@ export class Querier { return { body: await response.clone().text(), headers: response.headers }; } return { body: await response.clone().json(), headers: response.headers }; - } catch (err: any) { + } catch (err) { if ( err.message !== undefined && (err.message.includes("Failed to fetch") || @@ -687,7 +687,7 @@ export class Querier { "' with status code: " + err.status + " and message: " + - (await err.text()), + (await err.text()) ); } diff --git a/lib/ts/recipe/accountlinking/recipe.ts b/lib/ts/recipe/accountlinking/recipe.ts index e03366053..4c20aaa2d 100644 --- a/lib/ts/recipe/accountlinking/recipe.ts +++ b/lib/ts/recipe/accountlinking/recipe.ts @@ -730,17 +730,18 @@ export default class Recipe extends RecipeModule { }); if (shouldVerifyEmail) { - let resp = await EmailVerificationRecipe.getInstanceOrThrowError().recipeInterfaceImpl.createEmailVerificationToken( - { - // While the token we create here is tenant specific, the verification status is not - // So we can use any tenantId the user is associated with here as long as we use the - // same in the verifyEmailUsingToken call - tenantId: input.user.tenantIds[0], - recipeUserId: input.recipeUserId, - email: recipeUserEmail, - userContext: input.userContext, - } - ); + let resp = + await EmailVerificationRecipe.getInstanceOrThrowError().recipeInterfaceImpl.createEmailVerificationToken( + { + // While the token we create here is tenant specific, the verification status is not + // So we can use any tenantId the user is associated with here as long as we use the + // same in the verifyEmailUsingToken call + tenantId: input.user.tenantIds[0], + recipeUserId: input.recipeUserId, + email: recipeUserEmail, + userContext: input.userContext, + } + ); if (resp.status === "OK") { // we purposely pass in false below cause we don't want account // linking to happen diff --git a/lib/ts/recipe/accountlinking/recipeImplementation.ts b/lib/ts/recipe/accountlinking/recipeImplementation.ts index 5f5110146..f233b937a 100644 --- a/lib/ts/recipe/accountlinking/recipeImplementation.ts +++ b/lib/ts/recipe/accountlinking/recipeImplementation.ts @@ -85,16 +85,16 @@ export default function getRecipeImplementation( } ): Promise< | { - status: "OK"; - wasAlreadyAPrimaryUser: boolean; - } + status: "OK"; + wasAlreadyAPrimaryUser: boolean; + } | { - status: - | "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR" - | "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - primaryUserId: string; - description: string; - } + status: + | "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR" + | "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + primaryUserId: string; + description: string; + } > { return await querier.sendGetRequest( "/recipe/accountlinking/user/primary/check", @@ -116,19 +116,19 @@ export default function getRecipeImplementation( } ): Promise< | { - status: "OK"; - user: User; - wasAlreadyAPrimaryUser: boolean; - } + status: "OK"; + user: User; + wasAlreadyAPrimaryUser: boolean; + } | { - status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; - primaryUserId: string; - } + status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; + primaryUserId: string; + } | { - status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - primaryUserId: string; - description: string; - } + status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + primaryUserId: string; + description: string; + } > { let response = await querier.sendPostRequest( "/recipe/accountlinking/user/primary", @@ -159,25 +159,25 @@ export default function getRecipeImplementation( } ): Promise< | { - status: "OK"; - accountsAlreadyLinked: boolean; - } + status: "OK"; + accountsAlreadyLinked: boolean; + } | { - status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - description: string; - primaryUserId: string; - } + status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + description: string; + primaryUserId: string; + } | { - status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - primaryUserId: string; - description: string; - } + status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + primaryUserId: string; + description: string; + } | { - status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; - } + status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; + } > { let result = await querier.sendGetRequest( - ("/recipe/accountlinking/user/link/check"), + "/recipe/accountlinking/user/link/check", { recipeUserId: recipeUserId.getAsString(), primaryUserId, @@ -201,23 +201,23 @@ export default function getRecipeImplementation( } ): Promise< | { - status: "OK"; - accountsAlreadyLinked: boolean; - user: User; - } + status: "OK"; + accountsAlreadyLinked: boolean; + user: User; + } | { - status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - user: User; - primaryUserId: string; - } + status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + user: User; + primaryUserId: string; + } | { - status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - primaryUserId: string; - description: string; - } + status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + primaryUserId: string; + description: string; + } | { - status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; - } + status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; + } > { const accountsLinkingResult = await querier.sendPostRequest( "/recipe/accountlinking/user/link", @@ -357,7 +357,7 @@ export default function getRecipeImplementation( status: "OK"; }> { return await querier.sendPostRequest( - ("/user/remove"), + "/user/remove", { userId, removeAllLinkedAccounts, diff --git a/lib/ts/recipe/accountlinking/types.ts b/lib/ts/recipe/accountlinking/types.ts index 2e1c07656..6874414d2 100644 --- a/lib/ts/recipe/accountlinking/types.ts +++ b/lib/ts/recipe/accountlinking/types.ts @@ -81,10 +81,7 @@ export type RecipeInterface = { users: User[]; nextPaginationToken?: string; }>; - canCreatePrimaryUser: (input: { - recipeUserId: RecipeUserId; - userContext: UserContext; - }) => Promise< + canCreatePrimaryUser: (input: { recipeUserId: RecipeUserId; userContext: UserContext }) => Promise< | { status: "OK"; wasAlreadyAPrimaryUser: boolean; @@ -97,10 +94,7 @@ export type RecipeInterface = { description: string; } >; - createPrimaryUser: (input: { - recipeUserId: RecipeUserId; - userContext: UserContext; - }) => Promise< + createPrimaryUser: (input: { recipeUserId: RecipeUserId; userContext: UserContext }) => Promise< | { status: "OK"; user: User; @@ -139,11 +133,7 @@ export type RecipeInterface = { status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; } >; - linkAccounts: (input: { - recipeUserId: RecipeUserId; - primaryUserId: string; - userContext: UserContext; - }) => Promise< + linkAccounts: (input: { recipeUserId: RecipeUserId; primaryUserId: string; userContext: UserContext }) => Promise< | { status: "OK"; accountsAlreadyLinked: boolean; @@ -163,10 +153,7 @@ export type RecipeInterface = { status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; } >; - unlinkAccount: (input: { - recipeUserId: RecipeUserId; - userContext: UserContext; - }) => Promise<{ + unlinkAccount: (input: { recipeUserId: RecipeUserId; userContext: UserContext }) => Promise<{ status: "OK"; wasRecipeUserDeleted: boolean; wasLinked: boolean; diff --git a/lib/ts/recipe/dashboard/api/multitenancy/getThirdPartyConfig.ts b/lib/ts/recipe/dashboard/api/multitenancy/getThirdPartyConfig.ts index 15eb75d9c..c11cdf26c 100644 --- a/lib/ts/recipe/dashboard/api/multitenancy/getThirdPartyConfig.ts +++ b/lib/ts/recipe/dashboard/api/multitenancy/getThirdPartyConfig.ts @@ -214,15 +214,8 @@ export default async function getThirdPartyConfig( client.clientType, userContext ); - const { - clientId, - clientSecret, - clientType, - scope, - additionalConfig, - forcePKCE, - ...commonConfig - } = providerInstance!.config; + const { clientId, clientSecret, clientType, scope, additionalConfig, forcePKCE, ...commonConfig } = + providerInstance!.config; clients.push({ clientId, diff --git a/lib/ts/recipe/emailpassword/api/implementation.ts b/lib/ts/recipe/emailpassword/api/implementation.ts index aef0c6fd0..58da60beb 100644 --- a/lib/ts/recipe/emailpassword/api/implementation.ts +++ b/lib/ts/recipe/emailpassword/api/implementation.ts @@ -53,12 +53,7 @@ export default function getAPIImplementation(): APIInterface { exists: emailPasswordUserExists, }; }, - generatePasswordResetTokenPOST: async function ({ - formFields, - tenantId, - options, - userContext, - }): Promise< + generatePasswordResetTokenPOST: async function ({ formFields, tenantId, options, userContext }): Promise< | { status: "OK"; } @@ -261,8 +256,7 @@ export default function getAPIImplementation(): APIInterface { if (!emailVerified && hasOtherEmailOrPhone) { return { status: "PASSWORD_RESET_NOT_ALLOWED", - reason: - "Reset password link was not created because of account take over risk. Please contact support. (ERR_CODE_001)", + reason: "Reset password link was not created because of account take over risk. Please contact support. (ERR_CODE_001)", }; } @@ -288,18 +282,19 @@ export default function getAPIImplementation(): APIInterface { // is verified, and if not, we need to make sure that there is no other email / phone number // associated with the primary user account. If there is, then we do not proceed. - let shouldDoAccountLinkingResponse = await AccountLinking.getInstance().config.shouldDoAutomaticAccountLinking( - emailPasswordAccount !== undefined - ? emailPasswordAccount - : { - recipeId: "emailpassword", - email, - }, - linkingCandidate, - undefined, - tenantId, - userContext - ); + let shouldDoAccountLinkingResponse = + await AccountLinking.getInstance().config.shouldDoAutomaticAccountLinking( + emailPasswordAccount !== undefined + ? emailPasswordAccount + : { + recipeId: "emailpassword", + email, + }, + linkingCandidate, + undefined, + tenantId, + userContext + ); // Now we need to check that if there exists any email password user at all // for the input email. If not, then it implies that when the token is consumed, @@ -391,14 +386,13 @@ export default function getAPIImplementation(): APIInterface { async function markEmailAsVerified(recipeUserId: RecipeUserId, email: string) { const emailVerificationInstance = EmailVerification.getInstance(); if (emailVerificationInstance) { - const tokenResponse = await emailVerificationInstance.recipeInterfaceImpl.createEmailVerificationToken( - { + const tokenResponse = + await emailVerificationInstance.recipeInterfaceImpl.createEmailVerificationToken({ tenantId, recipeUserId, email, userContext, - } - ); + }); if (tokenResponse.status === "OK") { await emailVerificationInstance.recipeInterfaceImpl.verifyEmailUsingToken({ @@ -413,9 +407,7 @@ export default function getAPIImplementation(): APIInterface { } } - async function doUpdatePasswordAndVerifyEmailAndTryLinkIfNotPrimary( - recipeUserId: RecipeUserId - ): Promise< + async function doUpdatePasswordAndVerifyEmailAndTryLinkIfNotPrimary(recipeUserId: RecipeUserId): Promise< | { status: "OK"; user: User; diff --git a/lib/ts/recipe/emailpassword/recipeImplementation.ts b/lib/ts/recipe/emailpassword/recipeImplementation.ts index 16dede2f4..218474559 100644 --- a/lib/ts/recipe/emailpassword/recipeImplementation.ts +++ b/lib/ts/recipe/emailpassword/recipeImplementation.ts @@ -156,12 +156,7 @@ export default function getRecipeInterface( return response; }, - verifyCredentials: async function ({ - email, - password, - tenantId, - userContext, - }): Promise< + verifyCredentials: async function ({ email, password, tenantId, userContext }): Promise< | { status: "OK"; user: User; diff --git a/lib/ts/recipe/emailpassword/types.ts b/lib/ts/recipe/emailpassword/types.ts index 0fdfbe088..93e30d52f 100644 --- a/lib/ts/recipe/emailpassword/types.ts +++ b/lib/ts/recipe/emailpassword/types.ts @@ -164,11 +164,7 @@ export type RecipeInterface = { userContext: UserContext; }): Promise<{ status: "OK"; token: string } | { status: "UNKNOWN_USER_ID_ERROR" }>; - consumePasswordResetToken(input: { - token: string; - tenantId: string; - userContext: UserContext; - }): Promise< + consumePasswordResetToken(input: { token: string; tenantId: string; userContext: UserContext }): Promise< | { status: "OK"; email: string; @@ -212,12 +208,7 @@ export type APIOptions = { export type APIInterface = { emailExistsGET: | undefined - | ((input: { - email: string; - tenantId: string; - options: APIOptions; - userContext: UserContext; - }) => Promise< + | ((input: { email: string; tenantId: string; options: APIOptions; userContext: UserContext }) => Promise< | { status: "OK"; exists: boolean; diff --git a/lib/ts/recipe/emailverification/recipeImplementation.ts b/lib/ts/recipe/emailverification/recipeImplementation.ts index 634239188..bdaa121af 100644 --- a/lib/ts/recipe/emailverification/recipeImplementation.ts +++ b/lib/ts/recipe/emailverification/recipeImplementation.ts @@ -87,7 +87,8 @@ export default function getRecipeInterface( if (emailInfo.status === "OK" && emailInfo.email === response.email) { // we do this here to prevent cyclic dependencies. // TODO: Fix this. - let AccountLinking = require("../accountlinking/recipe").default.getInstance() as AccountLinkingRecipe; + let AccountLinking = + require("../accountlinking/recipe").default.getInstance() as AccountLinkingRecipe; await AccountLinking.tryLinkingByAccountInfoOrCreatePrimaryUser({ tenantId, inputUser: updatedUser, diff --git a/lib/ts/recipe/multifactorauth/types.ts b/lib/ts/recipe/multifactorauth/types.ts index 693e8e646..0e0cd8acf 100644 --- a/lib/ts/recipe/multifactorauth/types.ts +++ b/lib/ts/recipe/multifactorauth/types.ts @@ -118,11 +118,7 @@ export type APIOptions = { export type APIInterface = { resyncSessionAndFetchMFAInfoPUT: | undefined - | ((input: { - options: APIOptions; - session: SessionContainerInterface; - userContext: UserContext; - }) => Promise< + | ((input: { options: APIOptions; session: SessionContainerInterface; userContext: UserContext }) => Promise< | { status: "OK"; factors: { diff --git a/lib/ts/recipe/multitenancy/recipeImplementation.ts b/lib/ts/recipe/multitenancy/recipeImplementation.ts index bdb55e756..e22df3a58 100644 --- a/lib/ts/recipe/multitenancy/recipeImplementation.ts +++ b/lib/ts/recipe/multitenancy/recipeImplementation.ts @@ -59,11 +59,7 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { }, listAllTenants: async function ({ userContext }) { - let response = await querier.sendGetRequest( - "/recipe/multitenancy/tenant/list/v2", - {}, - userContext - ); + let response = await querier.sendGetRequest("/recipe/multitenancy/tenant/list/v2", {}, userContext); return response; }, diff --git a/lib/ts/recipe/oauth2provider/api/userInfo.ts b/lib/ts/recipe/oauth2provider/api/userInfo.ts index 3e661068d..91b638352 100644 --- a/lib/ts/recipe/oauth2provider/api/userInfo.ts +++ b/lib/ts/recipe/oauth2provider/api/userInfo.ts @@ -41,12 +41,11 @@ export default async function userInfoGET( let accessTokenPayload: JSONObject; try { - const { - payload, - } = await OAuth2ProviderRecipe.getInstanceOrThrowError().recipeInterfaceImpl.validateOAuth2AccessToken({ - token: accessToken, - userContext, - }); + const { payload } = + await OAuth2ProviderRecipe.getInstanceOrThrowError().recipeInterfaceImpl.validateOAuth2AccessToken({ + token: accessToken, + userContext, + }); accessTokenPayload = payload; } catch (error) { options.res.setHeader("WWW-Authenticate", 'Bearer error="invalid_token"', false); diff --git a/lib/ts/recipe/oauth2provider/recipeImplementation.ts b/lib/ts/recipe/oauth2provider/recipeImplementation.ts index d1e476bad..4f52728dc 100644 --- a/lib/ts/recipe/oauth2provider/recipeImplementation.ts +++ b/lib/ts/recipe/oauth2provider/recipeImplementation.ts @@ -453,11 +453,7 @@ export default function getRecipeInterface( body["authorizationHeader"] = input.authorizationHeader; } - const res = await querier.sendPostRequest( - "/recipe/oauth/token", - body, - input.userContext - ); + const res = await querier.sendPostRequest("/recipe/oauth/token", body, input.userContext); if (res.status === "CLIENT_NOT_FOUND_ERROR") { return { @@ -697,11 +693,7 @@ export default function getRecipeInterface( } } - const res = await querier.sendPostRequest( - "/recipe/oauth/token/revoke", - requestBody, - input.userContext - ); + const res = await querier.sendPostRequest("/recipe/oauth/token/revoke", requestBody, input.userContext); if (res.status !== "OK") { return { diff --git a/lib/ts/recipe/oauth2provider/types.ts b/lib/ts/recipe/oauth2provider/types.ts index 6af8cd684..08f41f8d8 100644 --- a/lib/ts/recipe/oauth2provider/types.ts +++ b/lib/ts/recipe/oauth2provider/types.ts @@ -249,10 +249,7 @@ export type RecipeInterface = { userContext: UserContext; }): Promise<{ redirectTo: string }>; - getOAuth2Client(input: { - clientId: string; - userContext: UserContext; - }): Promise< + getOAuth2Client(input: { clientId: string; userContext: UserContext }): Promise< | { status: "OK"; client: OAuth2Client; diff --git a/lib/ts/recipe/openid/types.ts b/lib/ts/recipe/openid/types.ts index 11babcb13..2a3ec7c8f 100644 --- a/lib/ts/recipe/openid/types.ts +++ b/lib/ts/recipe/openid/types.ts @@ -47,10 +47,7 @@ export type APIOptions = { export type APIInterface = { getOpenIdDiscoveryConfigurationGET: | undefined - | ((input: { - options: APIOptions; - userContext: UserContext; - }) => Promise< + | ((input: { options: APIOptions; userContext: UserContext }) => Promise< | { status: "OK"; issuer: string; @@ -70,9 +67,7 @@ export type APIInterface = { }; export type RecipeInterface = { - getOpenIdDiscoveryConfiguration(input: { - userContext: UserContext; - }): Promise<{ + getOpenIdDiscoveryConfiguration(input: { userContext: UserContext }): Promise<{ status: "OK"; issuer: string; jwks_uri: string; diff --git a/lib/ts/recipe/passwordless/api/implementation.ts b/lib/ts/recipe/passwordless/api/implementation.ts index c769ad6ea..c9f793e59 100644 --- a/lib/ts/recipe/passwordless/api/implementation.ts +++ b/lib/ts/recipe/passwordless/api/implementation.ts @@ -125,14 +125,13 @@ export default function getAPIImplementation(): APIInterface { if (loginMethod.hasSameEmailAs(accountInfo.email) && !loginMethod.verified) { // We first check that the submitted code is actually valid if (await checkCredentials()) { - const tokenResponse = await emailVerificationInstance.recipeInterfaceImpl.createEmailVerificationToken( - { + const tokenResponse = + await emailVerificationInstance.recipeInterfaceImpl.createEmailVerificationToken({ tenantId: input.tenantId, recipeUserId: loginMethod.recipeUserId, email: accountInfo.email, userContext: input.userContext, - } - ); + }); if (tokenResponse.status === "OK") { await emailVerificationInstance.recipeInterfaceImpl.verifyEmailUsingToken({ diff --git a/lib/ts/recipe/passwordless/recipe.ts b/lib/ts/recipe/passwordless/recipe.ts index 8ad1c11c4..f8a40c4db 100644 --- a/lib/ts/recipe/passwordless/recipe.ts +++ b/lib/ts/recipe/passwordless/recipe.ts @@ -235,14 +235,12 @@ export default class Recipe extends RecipeModule { // object. let factorIdToEmailsMap: Record = {}; if (allFactors.includes(FactorIds.OTP_EMAIL)) { - factorIdToEmailsMap[ - FactorIds.OTP_EMAIL - ] = nonFakeEmailsThatPasswordlessLoginMethodOrderedByTimeJoined; + factorIdToEmailsMap[FactorIds.OTP_EMAIL] = + nonFakeEmailsThatPasswordlessLoginMethodOrderedByTimeJoined; } if (allFactors.includes(FactorIds.LINK_EMAIL)) { - factorIdToEmailsMap[ - FactorIds.LINK_EMAIL - ] = nonFakeEmailsThatPasswordlessLoginMethodOrderedByTimeJoined; + factorIdToEmailsMap[FactorIds.LINK_EMAIL] = + nonFakeEmailsThatPasswordlessLoginMethodOrderedByTimeJoined; } return { status: "OK", @@ -367,14 +365,12 @@ export default class Recipe extends RecipeModule { // object. let factorIdToPhoneNumberMap: Record = {}; if (allFactors.includes(FactorIds.OTP_PHONE)) { - factorIdToPhoneNumberMap[ - FactorIds.OTP_PHONE - ] = phoneNumbersThatPasswordlessLoginMethodOrderedByTimeJoined; + factorIdToPhoneNumberMap[FactorIds.OTP_PHONE] = + phoneNumbersThatPasswordlessLoginMethodOrderedByTimeJoined; } if (allFactors.includes(FactorIds.LINK_PHONE)) { - factorIdToPhoneNumberMap[ - FactorIds.LINK_PHONE - ] = phoneNumbersThatPasswordlessLoginMethodOrderedByTimeJoined; + factorIdToPhoneNumberMap[FactorIds.LINK_PHONE] = + phoneNumbersThatPasswordlessLoginMethodOrderedByTimeJoined; } return { status: "OK", diff --git a/lib/ts/recipe/session/index.ts b/lib/ts/recipe/session/index.ts index f09151583..76e060612 100644 --- a/lib/ts/recipe/session/index.ts +++ b/lib/ts/recipe/session/index.ts @@ -152,7 +152,8 @@ export default class SessionWrapper { }; } - const claimValidatorsAddedByOtherRecipes = Recipe.getInstanceOrThrowError().getClaimValidatorsAddedByOtherRecipes(); + const claimValidatorsAddedByOtherRecipes = + Recipe.getInstanceOrThrowError().getClaimValidatorsAddedByOtherRecipes(); const globalClaimValidators: SessionClaimValidator[] = await recipeImpl.getGlobalClaimValidators({ userId: sessionInfo.userId, recipeUserId: sessionInfo.recipeUserId, diff --git a/lib/ts/recipe/session/sessionFunctions.ts b/lib/ts/recipe/session/sessionFunctions.ts index 2526797d4..c4bd5f42b 100644 --- a/lib/ts/recipe/session/sessionFunctions.ts +++ b/lib/ts/recipe/session/sessionFunctions.ts @@ -119,7 +119,7 @@ export async function getSession( getCombinedJWKS(config), helpers.config.antiCsrfFunctionOrString === "VIA_TOKEN" && doAntiCsrfCheck ); - } catch (err: any) { + } catch (err) { /** * if error type is not TRY_REFRESH_TOKEN, we return the * error to the user @@ -245,11 +245,7 @@ export async function getSession( checkDatabase: alwaysCheckCore, }; - let response = await helpers.querier.sendPostRequest( - "/recipe/session/verify", - requestBody, - userContext - ); + let response = await helpers.querier.sendPostRequest("/recipe/session/verify", requestBody, userContext); if (response.status === "OK") { return { @@ -349,11 +345,7 @@ export async function refreshSession( throw new Error("Please either use VIA_TOKEN, NONE or call with doAntiCsrfCheck false"); } - let response = await helpers.querier.sendPostRequest( - "/recipe/session/refresh", - requestBody, - userContext - ); + let response = await helpers.querier.sendPostRequest("/recipe/session/refresh", requestBody, userContext); if (response.status === "OK") { return { @@ -419,11 +411,7 @@ export async function revokeAllSessionsForUser( }; if (revokeAcrossAllTenants) { - const response = await helpers.querier.sendPostRequest( - "/recipe/session/remove", - body, - userContext - ); + const response = await helpers.querier.sendPostRequest("/recipe/session/remove", body, userContext); return response.sessionHandlesRevoked; } @@ -455,12 +443,14 @@ export async function getAllSessionHandlesForUser( tenantId = DEFAULT_TENANT_ID; } let response = await helpers.querier.sendGetRequest( - fetchAcrossAllTenants ? "/recipe/session/user" : { - path: "//recipe/session/user", - params: { - tenantId: tenantId, - }, - }, + fetchAcrossAllTenants + ? "/recipe/session/user" + : { + path: "//recipe/session/user", + params: { + tenantId: tenantId, + }, + }, { userId, fetchSessionsForAllLinkedAccounts, diff --git a/lib/ts/recipe/session/types.ts b/lib/ts/recipe/session/types.ts index a05b172c1..83ff7492c 100644 --- a/lib/ts/recipe/session/types.ts +++ b/lib/ts/recipe/session/types.ts @@ -303,11 +303,7 @@ export type RecipeInterface = { userContext: UserContext; }): Promise; - getClaimValue(input: { - sessionHandle: string; - claim: SessionClaim; - userContext: UserContext; - }): Promise< + getClaimValue(input: { sessionHandle: string; claim: SessionClaim; userContext: UserContext }): Promise< | { status: "SESSION_DOES_NOT_EXIST_ERROR"; } diff --git a/lib/ts/recipe/session/utils.ts b/lib/ts/recipe/session/utils.ts index 02c018437..3a7b3439f 100644 --- a/lib/ts/recipe/session/utils.ts +++ b/lib/ts/recipe/session/utils.ts @@ -375,16 +375,16 @@ export async function getRequiredClaimValidators( overrideGlobalClaimValidators: VerifySessionOptions["overrideGlobalClaimValidators"], userContext: UserContext ) { - const claimValidatorsAddedByOtherRecipes = SessionRecipe.getInstanceOrThrowError().getClaimValidatorsAddedByOtherRecipes(); - const globalClaimValidators: SessionClaimValidator[] = await SessionRecipe.getInstanceOrThrowError().recipeInterfaceImpl.getGlobalClaimValidators( - { + const claimValidatorsAddedByOtherRecipes = + SessionRecipe.getInstanceOrThrowError().getClaimValidatorsAddedByOtherRecipes(); + const globalClaimValidators: SessionClaimValidator[] = + await SessionRecipe.getInstanceOrThrowError().recipeInterfaceImpl.getGlobalClaimValidators({ userId: session.getUserId(userContext), recipeUserId: session.getRecipeUserId(userContext), tenantId: session.getTenantId(userContext), claimValidatorsAddedByOtherRecipes, userContext, - } - ); + }); return overrideGlobalClaimValidators !== undefined ? await overrideGlobalClaimValidators(globalClaimValidators, session, userContext) diff --git a/lib/ts/recipe/userroles/recipeImplementation.ts b/lib/ts/recipe/userroles/recipeImplementation.ts index ae1fa9090..1793e79bc 100644 --- a/lib/ts/recipe/userroles/recipeImplementation.ts +++ b/lib/ts/recipe/userroles/recipeImplementation.ts @@ -72,12 +72,7 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { }, createNewRoleOrAddPermissions: function ({ role, permissions, userContext }) { - return querier.sendPutRequest( - "/recipe/role", - { role, permissions }, - {}, - userContext - ); + return querier.sendPutRequest("/recipe/role", { role, permissions }, {}, userContext); }, getPermissionsForRole: function ({ role, userContext }) { @@ -96,11 +91,7 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { }, getRolesThatHavePermission: function ({ permission, userContext }) { - return querier.sendGetRequest( - "/recipe/permission/roles", - { permission }, - userContext - ); + return querier.sendGetRequest("/recipe/permission/roles", { permission }, userContext); }, deleteRole: function ({ role, userContext }) { diff --git a/lib/ts/recipe/webauthn/api/implementation.ts b/lib/ts/recipe/webauthn/api/implementation.ts index d1444a501..e03256fc7 100644 --- a/lib/ts/recipe/webauthn/api/implementation.ts +++ b/lib/ts/recipe/webauthn/api/implementation.ts @@ -591,23 +591,23 @@ export default function getAPIImplementation(): APIInterface { if (!emailVerified && hasOtherEmailOrPhone) { return { status: "RECOVER_ACCOUNT_NOT_ALLOWED", - reason: - "Recover account link was not created because of account take over risk. Please contact support. (ERR_CODE_001)", + reason: "Recover account link was not created because of account take over risk. Please contact support. (ERR_CODE_001)", }; } - const shouldDoAccountLinkingResponse = await AccountLinking.getInstance().config.shouldDoAutomaticAccountLinking( - webauthnAccount !== undefined - ? webauthnAccount - : { - recipeId: "webauthn", - email, - }, - primaryUserAssociatedWithEmail, - undefined, - tenantId, - userContext - ); + const shouldDoAccountLinkingResponse = + await AccountLinking.getInstance().config.shouldDoAutomaticAccountLinking( + webauthnAccount !== undefined + ? webauthnAccount + : { + recipeId: "webauthn", + email, + }, + primaryUserAssociatedWithEmail, + undefined, + tenantId, + userContext + ); // Now we need to check that if there exists any webauthn user at all // for the input email. If not, then it implies that when the token is consumed, @@ -728,14 +728,13 @@ export default function getAPIImplementation(): APIInterface { async function markEmailAsVerified(recipeUserId: RecipeUserId, email: string) { const emailVerificationInstance = EmailVerification.getInstance(); if (emailVerificationInstance) { - const tokenResponse = await emailVerificationInstance.recipeInterfaceImpl.createEmailVerificationToken( - { + const tokenResponse = + await emailVerificationInstance.recipeInterfaceImpl.createEmailVerificationToken({ tenantId, recipeUserId, email, userContext, - } - ); + }); if (tokenResponse.status === "OK") { await emailVerificationInstance.recipeInterfaceImpl.verifyEmailUsingToken({ diff --git a/lib/ts/recipe/webauthn/recipe.ts b/lib/ts/recipe/webauthn/recipe.ts index b94af64ab..324c9401f 100644 --- a/lib/ts/recipe/webauthn/recipe.ts +++ b/lib/ts/recipe/webauthn/recipe.ts @@ -136,9 +136,8 @@ export default class Recipe extends RecipeModule { return a.timeJoined - b.timeJoined; }); // Then we take the ones that belong to this recipe - const recipeLoginMethodsOrderedByTimeJoinedOldestFirst = orderedLoginMethodsByTimeJoinedOldestFirst.filter( - (lm) => lm.recipeId === Recipe.RECIPE_ID - ); + const recipeLoginMethodsOrderedByTimeJoinedOldestFirst = + orderedLoginMethodsByTimeJoinedOldestFirst.filter((lm) => lm.recipeId === Recipe.RECIPE_ID); let result: string[]; if (recipeLoginMethodsOrderedByTimeJoinedOldestFirst.length !== 0) { diff --git a/lib/ts/recipe/webauthn/recipeImplementation.ts b/lib/ts/recipe/webauthn/recipeImplementation.ts index e4bb9a18c..b6adb661c 100644 --- a/lib/ts/recipe/webauthn/recipeImplementation.ts +++ b/lib/ts/recipe/webauthn/recipeImplementation.ts @@ -362,11 +362,7 @@ export default function getRecipeInterface( }, listCredentials: async function ({ recipeUserId, userContext }) { - return await querier.sendGetRequest( - "/recipe/webauthn/user/credential/list", - { recipeUserId }, - userContext - ); + return await querier.sendGetRequest("/recipe/webauthn/user/credential/list", { recipeUserId }, userContext); }, removeGeneratedOptions: async function ({ webauthnGeneratedOptionsId, tenantId, userContext }) { diff --git a/lib/ts/recipe/webauthn/types.ts b/lib/ts/recipe/webauthn/types.ts index a25c86070..8855bade1 100644 --- a/lib/ts/recipe/webauthn/types.ts +++ b/lib/ts/recipe/webauthn/types.ts @@ -319,11 +319,7 @@ export type RecipeInterface = { userContext: UserContext; }): Promise<{ status: "OK"; token: string } | GenerateRecoverAccountTokenErrorResponse>; - consumeRecoverAccountToken(input: { - token: string; - tenantId: string; - userContext: UserContext; - }): Promise< + consumeRecoverAccountToken(input: { token: string; tenantId: string; userContext: UserContext }): Promise< | { status: "OK"; email: string; @@ -350,22 +346,14 @@ export type RecipeInterface = { userContext: UserContext; }): Promise<{ status: "OK"; user: User; recipeUserId: RecipeUserId } | GetUserFromRecoverAccountTokenErrorResponse>; - removeCredential(input: { - webauthnCredentialId: string; - recipeUserId: string; - userContext: UserContext; - }): Promise< + removeCredential(input: { webauthnCredentialId: string; recipeUserId: string; userContext: UserContext }): Promise< | { status: "OK"; } | RemoveCredentialErrorResponse >; - getCredential(input: { - webauthnCredentialId: string; - recipeUserId: string; - userContext: UserContext; - }): Promise< + getCredential(input: { webauthnCredentialId: string; recipeUserId: string; userContext: UserContext }): Promise< | { status: "OK"; webauthnCredentialId: string; @@ -376,10 +364,7 @@ export type RecipeInterface = { | GetCredentialErrorResponse >; - listCredentials(input: { - recipeUserId: string; - userContext: UserContext; - }): Promise<{ + listCredentials(input: { recipeUserId: string; userContext: UserContext }): Promise<{ status: "OK"; credentials: { webauthnCredentialId: string; @@ -533,11 +518,7 @@ export type APIInterface = { signInOptionsPOST: | undefined - | ((input: { - tenantId: string; - options: APIOptions; - userContext: UserContext; - }) => Promise< + | ((input: { tenantId: string; options: APIOptions; userContext: UserContext }) => Promise< | { status: "OK"; webauthnGeneratedOptionsId: string; @@ -594,12 +575,7 @@ export type APIInterface = { generateRecoverAccountTokenPOST: | undefined - | ((input: { - email: string; - tenantId: string; - options: APIOptions; - userContext: UserContext; - }) => Promise< + | ((input: { email: string; tenantId: string; options: APIOptions; userContext: UserContext }) => Promise< | { status: "OK"; } @@ -645,12 +621,7 @@ export type APIInterface = { emailExistsGET: | undefined - | ((input: { - email: string; - tenantId: string; - options: APIOptions; - userContext: UserContext; - }) => Promise< + | ((input: { email: string; tenantId: string; options: APIOptions; userContext: UserContext }) => Promise< | { status: "OK"; exists: boolean; diff --git a/lib/ts/supertokens.ts b/lib/ts/supertokens.ts index 1bb8de28d..06470ccc7 100644 --- a/lib/ts/supertokens.ts +++ b/lib/ts/supertokens.ts @@ -59,14 +59,14 @@ export default class SuperTokens { config.appInfo.origin === undefined ? undefined : typeof config.appInfo.origin === "string" - ? config.appInfo.origin - : "function"; + ? config.appInfo.origin + : "function"; logDebugMessage( "appInfo: " + JSON.stringify({ ...config.appInfo, origin: originToPrint, - }), + }) ); this.framework = config.framework !== undefined ? config.framework : "express"; @@ -86,7 +86,7 @@ export default class SuperTokens { }), config.supertokens?.apiKey, config.supertokens?.networkInterceptor, - config.supertokens?.disableCoreCallCache, + config.supertokens?.disableCoreCallCache ); if (config.recipeList === undefined || config.recipeList.length === 0) { throw new Error("Please provide at least one recipe to the supertokens.init function call"); @@ -209,7 +209,7 @@ export default class SuperTokens { response: BaseResponse, path: NormalisedURLPath, method: HTTPMethod, - userContext: UserContext, + userContext: UserContext ) => { return await matchedRecipe.handleAPIRequest(id, tenantId, request, response, path, method, userContext); }; @@ -230,13 +230,13 @@ export default class SuperTokens { getUserCount = async ( includeRecipeIds: string[] | undefined, tenantId: string | undefined, - userContext: UserContext, + userContext: UserContext ): Promise => { let querier = Querier.getNewInstanceOrThrowError(undefined); let apiVersion = await querier.getAPIVersion(userContext); if (maxVersion(apiVersion, "2.7") === "2.7") { throw new Error( - "Please use core version >= 3.5 to call this function. Otherwise, you can call .getUserCount() instead (for example, EmailPassword.getUserCount())", + "Please use core version >= 3.5 to call this function. Otherwise, you can call .getUserCount() instead (for example, EmailPassword.getUserCount())" ); } let includeRecipeIdsStr = undefined; @@ -255,7 +255,7 @@ export default class SuperTokens { includeRecipeIds: includeRecipeIdsStr, includeAllTenants: tenantId === undefined, }, - userContext, + userContext ); return Number(response.count); }; @@ -288,7 +288,7 @@ export default class SuperTokens { externalUserIdInfo: input.externalUserIdInfo, force: input.force, }, - input.userContext, + input.userContext ); } else { throw new global.Error("Please upgrade the SuperTokens core to >= 3.15.0"); @@ -320,7 +320,7 @@ export default class SuperTokens { userId: input.userId, userIdType: input.userIdType, }, - input.userContext, + input.userContext ); return response; } else { @@ -347,7 +347,7 @@ export default class SuperTokens { userIdType: input.userIdType, force: input.force, }, - input.userContext, + input.userContext ); } else { throw new global.Error("Please upgrade the SuperTokens core to >= 3.15.0"); @@ -373,7 +373,7 @@ export default class SuperTokens { externalUserIdInfo: input.externalUserIdInfo || null, }, {}, - input.userContext, + input.userContext ); } else { throw new global.Error("Please upgrade the SuperTokens core to >= 3.15.0"); @@ -389,7 +389,7 @@ export default class SuperTokens { if (!path.startsWith(this.appInfo.apiBasePath)) { logDebugMessage( "middleware: Not handling because request path did not start with config path. Request path: " + - path.getAsStringDangerous(), + path.getAsStringDangerous() ); return false; } @@ -416,7 +416,7 @@ export default class SuperTokens { " with path: " + path.getAsStringDangerous() + " and method: " + - method, + method ); let idResult = await recipeModules[i].returnAPIIdIfCanHandleRequest(path, method, userContext); if (idResult !== undefined) { @@ -445,7 +445,7 @@ export default class SuperTokens { response, path, method, - userContext, + userContext ); if (!requestHandled) { logDebugMessage("middleware: Not handled because API returned requestHandled as false"); @@ -517,7 +517,7 @@ export default class SuperTokens { idResult = currIdResult; } else { throw new Error( - "Two recipes have matched the same API path and method! This is a bug in the SDK. Please contact support.", + "Two recipes have matched the same API path and method! This is a bug in the SDK. Please contact support." ); } } @@ -536,7 +536,7 @@ export default class SuperTokens { response, path, method, - userContext, + userContext ); if (!requestHandled) { logDebugMessage("middleware: Not handled because API returned requestHandled as false"); diff --git a/package-lock.json b/package-lock.json index b9c026dd8..b3c6ed571 100644 --- a/package-lock.json +++ b/package-lock.json @@ -59,9 +59,10 @@ "next": "^14.0.4", "next-test-api-route-handler": "^3.1.10", "nock": "11.7.0", + "node-fetch": "^3.3.2", "nyc": "^15.1.0", "otpauth": "9.1.5", - "prettier": "2.0.5", + "prettier": "^2.3.2", "pretty-quick": "^3.1.1", "react": "^18.2.0", "sinon": "^14.0.0", @@ -2951,6 +2952,25 @@ "node-fetch": "^2.6.12" } }, + "node_modules/cross-fetch/node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -2979,6 +2999,15 @@ "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz", "integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==" }, + "node_modules/data-uri-to-buffer": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz", + "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==", + "dev": true, + "engines": { + "node": ">= 12" + } + }, "node_modules/dayjs": { "version": "1.11.10", "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz", @@ -3547,6 +3576,29 @@ "reusify": "^1.0.4" } }, + "node_modules/fetch-blob": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", + "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "paypal", + "url": "https://paypal.me/jimmywarting" + } + ], + "dependencies": { + "node-domexception": "^1.0.0", + "web-streams-polyfill": "^3.0.3" + }, + "engines": { + "node": "^12.20 || >= 14.13" + } + }, "node_modules/filelist": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz", @@ -3740,6 +3792,18 @@ "node": ">= 0.12" } }, + "node_modules/formdata-polyfill": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", + "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", + "dev": true, + "dependencies": { + "fetch-blob": "^3.1.2" + }, + "engines": { + "node": ">=12.20.0" + } + }, "node_modules/formidable": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/formidable/-/formidable-1.2.6.tgz", @@ -5717,6 +5781,26 @@ "node": ">= 0.6" } }, + "node_modules/next-test-api-route-handler/node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dev": true, + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, "node_modules/nise": { "version": "5.1.9", "resolved": "https://registry.npmjs.org/nise/-/nise-5.1.9.tgz", @@ -5775,23 +5859,42 @@ "node": ">= 8.0" } }, + "node_modules/node-domexception": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", + "deprecated": "Use your platform's native DOMException instead", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "github", + "url": "https://paypal.me/jimmywarting" + } + ], + "engines": { + "node": ">=10.5.0" + } + }, "node_modules/node-fetch": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz", + "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==", + "dev": true, "dependencies": { - "whatwg-url": "^5.0.0" + "data-uri-to-buffer": "^4.0.0", + "fetch-blob": "^3.1.4", + "formdata-polyfill": "^4.0.10" }, "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/node-fetch" } }, "node_modules/node-preload": { @@ -6476,9 +6579,9 @@ } }, "node_modules/prettier": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz", - "integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.3.2.tgz", + "integrity": "sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==", "dev": true, "bin": { "prettier": "bin-prettier.js" @@ -8011,6 +8114,15 @@ "integrity": "sha512-Uw5ooOQxRASHgu6C7GVvUxisKXfSgW4oFlO+aa+PAkgmH89O3CXxEEzNRNtHSqtXFTl0nAC1uYj0GMSH27uwtQ==", "dev": true }, + "node_modules/web-streams-polyfill": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz", + "integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", diff --git a/package.json b/package.json index 8376ece46..b648fb5a0 100644 --- a/package.json +++ b/package.json @@ -179,7 +179,7 @@ "node-fetch": "^3.3.2", "nyc": "^15.1.0", "otpauth": "9.1.5", - "prettier": "2.0.5", + "prettier": "2.3.2", "pretty-quick": "^3.1.1", "react": "^18.2.0", "sinon": "^14.0.0", diff --git a/test/emailpassword/signinFeature.test.js b/test/emailpassword/signinFeature.test.js index 15f95f7d6..d617c5bb4 100644 --- a/test/emailpassword/signinFeature.test.js +++ b/test/emailpassword/signinFeature.test.js @@ -1239,7 +1239,8 @@ describe(`signinFeature: ${printPath("[test/emailpassword/signinFeature.test.js] loginMethods: [ { ...response.user.loginMethods[0], - recipeUserId: response.user.loginMethods[0].recipeUserId.getAsString(), + recipeUserId: + response.user.loginMethods[0].recipeUserId.getAsString(), }, ], }; diff --git a/test/emailverification/apiInterface.test.js b/test/emailverification/apiInterface.test.js index e7142606f..63a033de9 100644 --- a/test/emailverification/apiInterface.test.js +++ b/test/emailverification/apiInterface.test.js @@ -78,14 +78,15 @@ describe(`apiInterface: ${printPath("[test/emailverification/apiInterface.js]")} assert.equal(typeof signUpResult.user.id, "string"); assert.equal(typeof signUpResult.recipeUserId.getAsString(), "string"); - const tokenResult = await EmailVerificationRecipe.getInstanceOrThrowError().recipeInterfaceImpl.createEmailVerificationToken( - { - email, - recipeUserId: signUpResult.recipeUserId, - tenantId: "public", - userContext: {}, - } - ); + const tokenResult = + await EmailVerificationRecipe.getInstanceOrThrowError().recipeInterfaceImpl.createEmailVerificationToken( + { + email, + recipeUserId: signUpResult.recipeUserId, + tenantId: "public", + userContext: {}, + } + ); assert.equal(tokenResult.status, "OK"); assert.equal(typeof tokenResult.token, "string"); @@ -168,14 +169,15 @@ describe(`apiInterface: ${printPath("[test/emailverification/apiInterface.js]")} signUpResponse.user?.loginMethods?.find((method) => method.recipeId === "webauthn")?.recipeUserId ); - const tokenResult = await EmailVerificationRecipe.getInstanceOrThrowError().recipeInterfaceImpl.createEmailVerificationToken( - { - email, - recipeUserId, - tenantId: "public", - userContext: {}, - } - ); + const tokenResult = + await EmailVerificationRecipe.getInstanceOrThrowError().recipeInterfaceImpl.createEmailVerificationToken( + { + email, + recipeUserId, + tenantId: "public", + userContext: {}, + } + ); assert.equal(tokenResult.status, "OK"); assert.equal(typeof tokenResult.token, "string"); From 8af3ebf9cff242c5daf453cb115eb1149ea1c62d Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Fri, 9 May 2025 11:36:27 +0530 Subject: [PATCH 19/64] Bumps version to 22.2.0 --- CHANGELOG.md | 4 ++++ lib/build/version.d.ts | 2 +- lib/build/version.js | 2 +- lib/ts/core/versions/5.3/schema.d.ts | 1 + lib/ts/version.ts | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 7 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 116d3a284..1a0e34177 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Adds workflow to test supertokens-website - Updates `frontendIntegration` servers +## [22.2.0] - 2025-05-09 + +- Refactors querier to use dynamic request body and response body types inference + ## [22.1.0] - 2025-04-04 - Adds support for using `code_challenge_method` from OIDC provider response to determine whether to use PKCE or not. diff --git a/lib/build/version.d.ts b/lib/build/version.d.ts index 39f082328..3ea03c7f3 100644 --- a/lib/build/version.d.ts +++ b/lib/build/version.d.ts @@ -1,4 +1,4 @@ // @ts-nocheck -export declare const version = "22.1.0"; +export declare const version = "22.2.0"; export declare const cdiSupported: string[]; export declare const dashboardVersion = "0.15"; diff --git a/lib/build/version.js b/lib/build/version.js index 4f9a887ac..afd8a3b91 100644 --- a/lib/build/version.js +++ b/lib/build/version.js @@ -15,7 +15,7 @@ exports.dashboardVersion = exports.cdiSupported = exports.version = void 0; * License for the specific language governing permissions and limitations * under the License. */ -exports.version = "22.1.0"; +exports.version = "22.2.0"; exports.cdiSupported = ["5.3"]; // Note: The actual script import for dashboard uses v{DASHBOARD_VERSION} exports.dashboardVersion = "0.15"; diff --git a/lib/ts/core/versions/5.3/schema.d.ts b/lib/ts/core/versions/5.3/schema.d.ts index dc4083377..877cf9c89 100644 --- a/lib/ts/core/versions/5.3/schema.d.ts +++ b/lib/ts/core/versions/5.3/schema.d.ts @@ -2,6 +2,7 @@ // @ts-nocheck // @ts-nocheck // @ts-nocheck +// @ts-nocheck /** * This file was auto-generated by openapi-typescript. * Do not make direct changes to the file. diff --git a/lib/ts/version.ts b/lib/ts/version.ts index 46b29d786..21474d062 100644 --- a/lib/ts/version.ts +++ b/lib/ts/version.ts @@ -12,7 +12,7 @@ * License for the specific language governing permissions and limitations * under the License. */ -export const version = "22.1.0"; +export const version = "22.2.0"; export const cdiSupported = ["5.3"]; diff --git a/package-lock.json b/package-lock.json index b3c6ed571..d82dd371c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "supertokens-node", - "version": "22.1.0", + "version": "22.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "supertokens-node", - "version": "22.1.0", + "version": "22.2.0", "license": "Apache-2.0", "dependencies": { "buffer": "^6.0.3", diff --git a/package.json b/package.json index b648fb5a0..2c8b6f0d8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "supertokens-node", - "version": "22.1.0", + "version": "22.2.0", "description": "NodeJS driver for SuperTokens core", "main": "index.js", "scripts": { From bf3cf4e5efb99228b0ef486d8a334d69610c0e88 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Tue, 29 Apr 2025 14:00:25 +0530 Subject: [PATCH 20/64] Add init script for generating the schema --- lib/core/5.3/schema.d.ts | 10946 +++++++++++++++++++++++++++++++++++ package.json | 4 +- scripts/generate-schema.js | 82 + 3 files changed, 11031 insertions(+), 1 deletion(-) create mode 100644 lib/core/5.3/schema.d.ts create mode 100644 scripts/generate-schema.js diff --git a/lib/core/5.3/schema.d.ts b/lib/core/5.3/schema.d.ts new file mode 100644 index 000000000..3a45b6642 --- /dev/null +++ b/lib/core/5.3/schema.d.ts @@ -0,0 +1,10946 @@ +/** + * This file was auto-generated by openapi-typescript. + * Do not make direct changes to the file. + */ + +export interface paths { + "/recipe/accountlinking/user/primary/check": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Check if primary user can be created for given user id + * */ + get: operations["canCreatePrimaryUser"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/accountlinking/user/link/check": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Check if accounts can be linked for given primary and recipe user id + * */ + get: operations["canLinkAccounts"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/accountlinking/user/primary": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Create a primary user for given user id + * */ + post: operations["createPrimaryUser"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/accountlinking/user/link": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Link accounts for given primary and recipe user id + * */ + post: operations["linkAccounts"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/accountlinking/user/unlink": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Unlink accounts for given recipe user id + * */ + post: operations["unlinkAccounts"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/totp/device": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** @description Update the name of a TOTP device for a user. + * */ + put: operations["updateTotpDeviceName"]; + /** @description Add a TOTP device for a user and enable TOTP if not already enabled. + * */ + post: operations["createTotpDevice"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/totp/device/list": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Retrieve a list of TOTP devices for a user. + * */ + get: operations["getTotpDevices"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/totp/device/import": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Add a TOTP device for a user and enable TOTP if not already enabled. + * */ + post: operations["importTotpDevice"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/totp/device/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Remove a TOTP device for a user. If all devices are removed, TOTP is disabled for the user. + * */ + post: operations["removeTotpDevice"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/totp/verify": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Check if a TOTP code is valid against any of the TOTP devices for a user. + * */ + post: operations["verifyTotpCode"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/totp/device/verify": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Mark a TOTP device as verified if the given TOTP code is valid for that device. + * */ + post: operations["verifyTotpDevice"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/userid/map": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Retrieve a UserIdMapping + * */ + get: operations["userIdMappingGetMapping"]; + put?: never; + /** @description Create a mapping between a SuperTokens userId and an external userId. + * */ + post: operations["userIdMappingCreateMapping"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/userid/map/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Delete a mapping between a SuperTokens userId and an external userId. + * */ + post: operations["userIdMappingRemoveMapping"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/userid/external-user-id-info": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** @description Update or delete externalUserIdInfo + * */ + put: operations["userIdMappingUpateExternalUserIdInfo"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/signinup/code/check": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Tries to check if the passed userInputCode+deviceId combo or the linkCode is valid + * */ + post: operations["passwordlessCheckCode"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/signinup/code/consume": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Tries to consume the passed userInputCode+deviceId combo or the linkCode to sign the user in + * */ + post: operations["passwordlessTryUseCode"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/signinup/code": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Starts a sign in process by requesting a linkCode and a deviceId + userInputCode combination the user can use to sign in. + * Passing the optional deviceId signifies a resend code flow. + * */ + post: operations["passwordlessStartSignIn"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/signinup/code/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Revokes a code by id + * */ + post: operations["passwordlessRevokeCode"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/signinup/codes": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Lists all active passwordless codes of the user + * */ + get: operations["passwordlessListCodes"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/signinup/codes/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Revokes all codes issued for the user + * */ + post: operations["passwordlessRevokeAllCodesOfUser"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/user\u2800\u2800": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * @deprecated + * @description Get a user's information. + * + * API is tenant specific if querying by email or phone number. + * If querying by userId, tenantId will be ignored. + * + * Note that there is an invisible character at the end of the path, this was to avoid a conflict with the OpenAPI spec. + * + */ + get: operations["passwordlessGetUser"]; + /** @description Update a user's information. + * If the email or phoneNumber is set to null the previous value will be deleted. If they are not set (i.e., undefined/missing from the request), they are left as-is. + * */ + put: operations["passwordlessPutUser"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/signin": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Signin a user with email ID and password + * */ + post: operations["emailPasswordSignin"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/signup": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Signup a user with email ID and password + * */ + post: operations["emailPasswordSignup"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/user": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * @deprecated + * @description Get a user's information + * + * API is tenant specific if querying by email. + * If querying by userId, tenantId will be ignored. + * + */ + get: operations["emailPasswordGetUser"]; + /** @description Update a user's information + * */ + put: operations["emailPasswordPutUser"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/user/password/reset/token": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Generate a new reset password token for this user + * */ + post: operations["emailPasswordGetPasswordResetToken"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/user/password/reset": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * @deprecated + * @description Reset a password using password reset token + * + */ + post: operations["emailPasswordGetPasswordReset"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/user/passwordhash/import": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Import a user with email ID and password hash + * */ + post: operations["userImport"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/user/password/reset/token/consume": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Consume a password reset token + * */ + post: operations["emailPasswordResetPasswordConsumeToken"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/signinup": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Signin/up a user + * */ + post: operations["thirdPartySigninup"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/user\u2800": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * @deprecated + * @description Get a user's information. + * + * API is tenant specific if querying by email. + * If querying by userId, tenantId will be ignored. + * + * Note that there is an invisible character at the end of the path, this was to avoid a conflict with the OpenAPI spec. + * + */ + get: operations["thirdPartyGetUser"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/users/by-email": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * @deprecated + * @description Get all users accounts associated with given email + * + */ + get: operations["thirdPartyGetUsersByEmail"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/user/email/verify/token": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Generate a new email verification token for this user + * */ + post: operations["emailVerificationVerifyToken"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/user/email/verify/token/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Remove all unused email verification tokens for this user + * */ + post: operations["emailVerificationVerifyTokenRemove"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/user/email/verify": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Verify an email + * */ + post: operations["emailVerificationVerify"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/user/email/verify": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Check if an email is verified + * */ + get: operations["emailVerificationVerifyGet"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/user/email/verify/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Unverify an email + * */ + post: operations["emailVerificationVerifyRemove"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/user/metadata": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Gets the stored metadata object of the user + * */ + get: operations["userMetadataRead"]; + /** @description Updates the metadata object stored about the user by doing a shallow merge of the stored and the update JSONs + * and removing properties set to null on the root level of the update object. The merged object is then reserialized and stored. + * + * e.g.: + * - stored: `{ "preferences": { "theme":"dark" }, "notifications": { "email": true }, "todos": ["example"] }` + * + * - update: `{ "notifications": { "sms": true }, "todos": null }` + * + * - result: `{ "preferences": { "theme":"dark" }, "notifications": { "sms": true } }` + * */ + put: operations["userMetadataUpdate"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/user/metadata/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Removes the entire metadata JSON stored about the user. + * */ + post: operations["userMetadataDelete"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/user/role": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** @description Creates a User Role mapping + * */ + put: operations["addUserRole"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/user/role/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Removes a User Role mapping + * */ + post: operations["removeUserRole"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/user/roles": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Retrive the roles associated with the user. + * */ + get: operations["getUserRoles"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/role/users": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Retrive the users associated with the role. + * */ + get: operations["getRoleUsers"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/role": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** @description Creates a role with permissions, can also be used to add permissions to a role + * */ + put: operations["putRole"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/role/permissions": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Retrive the permissions associated with a role + * */ + get: operations["getRolePermissions"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/role/permissions/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Removes permissions mapped to a role, if no permissions are passed all permissions mapped to the role are removed + * */ + post: operations["removeRolePermissions"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/permission/roles": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Retrive the roles associated with the permission + * */ + get: operations["getPermissionRoles"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/role/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Deletes a role + * */ + post: operations["removeRole"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/roles": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Retrive all created roles + * */ + get: operations["getRoles"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/session": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Create a new Session + * */ + post: operations["createNewSession"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/session": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get user and session information for a given session handle + * */ + get: operations["getSessionInfo"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/session/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Delete a sesion + * + * If revoking session by `userId`, the sessions are cleared across all tenants by default. + * + * Note: If `revokeAcrossAllTenants` is set to `true`, this API can only be called from `public` tenant. + * */ + post: operations["deleteSession"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/session/verify": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Verify a Session + * */ + post: operations["verifySession"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/session/refresh": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Refresh a Session + * */ + post: operations["refreshSession"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/session/user": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get session handles for a user + * + * By default, the session handles are fetched across all tenants. Set `fetchAcrossAllTenants` to `false` to get sessionHandles for the user for a particular tenant. + * + * Note: If `fetchAcrossAllTenants` is set to `true`, this API can only be called from `public` tenant. + * */ + get: operations["getUserSessionHandles"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/session/regenerate": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Regenerate a session + * */ + post: operations["regenerateSession"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/session/data": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * @deprecated + * @description Get session data + * + */ + get: operations["getSessionData"]; + /** @description Change session data + * */ + put: operations["putSessionData"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/jwt": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Create a signed JWT + * */ + post: operations["createSignedJWT"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/jwt/jwks": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * @deprecated + * @description Retrieve JWKs for JWT verification, containing both static and dynamic keys. + * + */ + get: { + parameters: { + query?: never; + header?: { + /** @example jwt */ + rid?: components["parameters"]["jwtRID"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Retrieve JWKs for JWT verification, containing both static and dynamic keys. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @enum {string} */ + status?: "OK"; + keys?: components["schemas"]["jwk"][]; + }; + }; + }; + 400: components["responses"]["400"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/.well-known/jwks.json": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Retrieve JWKs for JWT verification, containing both static and dynamic keys. + * */ + get: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Retrieve JWKs for JWT verification, containing both static and dynamic keys. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + keys?: components["schemas"]["jwk"][]; + }; + }; + }; + 400: components["responses"]["400"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/jwt/data": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * @deprecated + * @description Get JWT data for a session + * + */ + get: operations["getJWTData"]; + /** @description Change JWT data for a session + * */ + put: operations["putJWTData"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/dashboard/user": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** @description Update a user's email or password + * */ + put: operations["updateDashboardUser"]; + /** @description Create a dashboard user + * */ + post: operations["createDashboardUser"]; + /** @description Delete a dashboard user with their userId or email + * */ + delete: operations["deleteDashboardUser"]; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/dashboard/users": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get a list of call the dashboard users + * */ + get: operations["getAllDashboardUsers"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/dashboard/session/verify": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Verify a Dashboard user's sessionId + * */ + post: operations["verifyDashboardUserSession"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/dashboard/session": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post?: never; + /** @description Revoke a Dashboard user's session + * */ + delete: operations["RevokeDashboardUsersSession"]; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/dashboard/signin": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Signin a Dashboard user + * */ + post: operations["signInDashboardUser"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/dashboard/user/sessions": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get a list of the sessions for the dashboard user + * */ + get: operations["getAllSessionsForDashboardUser"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/apiversion": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get a list of compatible CDI versions + * */ + get: operations["getApiVersion"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/config": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get path to the loaded config file + * */ + get: operations["getConfig"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Return a simple hello message + * */ + get: operations["getHelloOnRootPath"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//hello": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Return a simple hello message + * */ + get: operations["getHello"]; + /** @description Return a simple hello message + * */ + put: operations["putHello"]; + /** @description Return a simple hello message + * */ + post: operations["postHello"]; + /** @description Return a simple hello message + * */ + delete: operations["deleteHello"]; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/telemetry": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Returns the telemetryID if it exists + * */ + get: operations["getTelemetry"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//users/count": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get number of users. + * + * API is tenant specific if `includeAllTenants` is false. + * Else, `tenantId` is ignored. + * */ + get: operations["getUsersCount"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/users/count/active": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get number of active users. + * */ + get: operations["getActiveUsersCount"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//users": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description User Pagination + * */ + get: operations["getUsers"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/user/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Delete user + * */ + post: operations["deleteUser"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/user/search/tags": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Retrieve available tags for search + * */ + get: operations["getSearchTags"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/ee/featureflag": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get a list of the enabled enterprise features + * */ + get: operations["getFeatureFlag"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/ee/license": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Retrieve license key + * */ + get: operations["getLicense"]; + /** @description Set or sync license key + * */ + put: operations["setLicense"]; + post?: never; + /** @description Delete license key + * */ + delete: operations["deleteLicense"]; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/user/id": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get user id from email or phone number + * */ + get: operations["getUserId"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//users/by-accountinfo": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get users by email, phoneNumber or thirdParty info + * */ + get: operations["getUsersByAccountInfo"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/requests/stats": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get requests stats for last 24 hours + * + * `averageRequestsPerSecond` and `peakRequestsPerSecond` would countain `1440` values corresponding to `now - 1440 minutes` until `now - 1 minute`. + * + * A value of `-1` would mean that there is no data for that minute. + * */ + get: operations["getRequestsStats"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/multitenancy/connectionuridomain": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** + * @deprecated + * @description This API is deprecated. Please use the v2 version of this API. In the v2 version of the API, the login methods are no longer enabled using the `emailPasswordEnabled`, `thirdPartyEnabled` and `passwordlessEnabled` inputs. Instead, they are enabled using factorIds (such as emailpassword, otp-email, etc) specified in the `firstFactors` and `requiredSecondaryFactors` inputs. Please refer [Multitenancy Docs](https://supertokens.com/docs/multitenancy/new-tenant) to know the list of factorIds available. + * + * Note: This deprecated API still accepts those `emailPasswordEnabled`, `thirdPartyEnabled` and `passwordlessEnabled` inputs for backward compatibility. + * + * Create or update a connection uri domain. + * + * SuperTokens subscription license key is required, if not using the base connection uri domain. + * + * This request must originate from public app and public tenant on the base + * connection uri domain. + * + * If creating a new connection uri domain, only the login methods set to true will be enabled and rest will be disabled by default. + * + * `firstFactors` and `requiredSecondaryFactors` can be set to null to remove all entries in the core, or a non empty string array to be updated in the core. Setting of empty array is disallowed. + * + * Note: the create/update will fail if a login method is not enabled and a relavant factor is added to either `firstFactors` or `requiredSecondaryFactors`. For example, `emailPasswordEnabled` cannot be set to `false` if `emailpassword` is present in the `firstFactors` array. + * + * If updating an existing connection uri domain, + * 1. core will keep the existing state of login methods and only update the ones that are specified in the request body. + * 2. Core config will be merged into existing config. To delete a key in the config, use a null value + * + * Note: The core config must contain a unique connection to the storage layer, because sharing of database between 2 different connection uri domains is not allowed. + * + * Note: Updation of core config is not allowed for the default connectionUriDomain. In order to update config for the default connectionUriDomain, you must edit the config.yaml or the docker env directly. + * + */ + put: operations["createOrUpdateConnectionURIDomainPUT"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/multitenancy/connectionuridomain/v2": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** @description Create or update a connection uri domain. + * + * SuperTokens subscription license key is required, if not using the base connection uri domain. + * + * This request must originate from public app and public tenant on the base + * connection uri domain. + * + * The `firstFactors` can be set to following values: + * + * - `null`: When set to `null`, all the login methods will be available for the connection URI domain (public app, public tenant). + * - `[]` (empty array): No login methods will be enabled for the connection URI domain (public app, public tenant). + * - `['factor1', 'factor2', ...]` (non-empty array): The list of login methods to enable for the connection URI domain (public app, public tenant). For eg. if this is set to `['emailpassword', 'thirdparty']`, the users of the tenant will be able to login using emailpassword and third party providers. + * + * List of built-in first factors are as follows: + * + * - Email password auth: `emailpassword` + * - Social login / enterprise SSO auth: `thirdparty` + * - Passwordless: + * - With email OTP: `otp-email` + * - With SMS OTP: `otp-phone` + * - With email magic link: `link-email` + * - With SMS magic link: `link-phone` + * + * If first factors are not specified while creating a new connection uri domain, all the login methods will be enabled by default. + * + * The `requiredSecondaryFactors` can be set to following values: + * - `null`: When set to `null`, no secondary factors will be required for the users of the connection URI domain (public app, public tenant). + * - `['factor1', 'factor2', ...]` (non-empty array): The list of factors that the users of the connection URI domain (public app, public tenant) must complete post the first factor login. For eg. if this is set to `['otp-phone', 'totp']`, the users of the tenant will be required to complete either phone OTP or TOTP post the first factor login. + * + * List of built-in secondary factors are as follows: + * + * - Email password auth: `emailpassword` + * - Social login / enterprise SSO auth: `thirdparty` + * - Passwordless: + * - With email OTP: `otp-email` + * - With SMS OTP: `otp-phone` + * - With email magic link: `link-email` + * - With SMS magic link: `link-phone` + * - Time based OTP: `totp` + * + * If updating an existing connection uri domain, + * 1. core will keep the existing state of login methods and only update the ones that are specified in the request body. + * 2. Core config will be merged into existing config. To delete a key in the config, use a null value + * + * Note: The core config must contain a unique connection to the storage layer, because sharing of database between 2 different connection uri domains is not allowed. + * + * Note: Updation of core config is not allowed for the default connectionUriDomain. In order to update config for the default connectionUriDomain, you must edit the config.yaml or the docker env directly. + * */ + put: operations["createOrUpdateConnectionURIDomainV2PUT"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/multitenancy/connectionuridomain/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Delete a connection uri domain. + * + * Deletion of base connection uri domain is not allowed. + * + * The request must originate from base connection uri domain and public app and tenant. + * + * Note: There should be no apps or tenants (other than the public app and public tenant) belonging to the connection uri domain to be able to delete it. + * */ + post: operations["deleteConnectionUriDomainPOST"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/multitenancy/connectionuridomain/list": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * @deprecated + * @description This API is deprecated. Please use the v2 version of this API. In the v2 version of the API, the login methods are no longer enabled using the `emailPasswordEnabled`, `thirdPartyEnabled` and `passwordlessEnabled` inputs. Instead, they are enabled using factorIds (such as emailpassword, otp-email, etc) specified in the `firstFactors` and `requiredSecondaryFactors` inputs. Please refer [Multitenancy Docs](https://supertokens.com/docs/multitenancy/new-tenant) to know the list of factorIds available. + * + * Note: This deprecated API still returns `emailPasswordEnabled`, `thirdPartyEnabled` and `passwordlessEnabled` values for backward compatibility, and it's values are derived from the `firstFactors` and `requiredSecondaryFactors` configured for the tenant. The detailed computation of the values as per CDI version is described here: https://github.com/supertokens/supertokens-core/issues/979#issuecomment-2099971371 + * + * Get a list of all connection uri domains. + * + * Request must originate from base connection uri domain and public app and tenant. + * + */ + get: operations["connectionUriDomainListGET"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/multitenancy/connectionuridomain/list/v2": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get a list of all connection uri domains. + * + * The value of `firstFactors` can be as follows: + * - `null`: When set to `null`, the SDK will use firstFactors defined in the SDK + * - `[]` (empty array): No first factors would be enabled for the tenant + * - non-empty array: The first factors that are enabled for the tenant + * + * Request must originate from base connection uri domain and public app and tenant. + * */ + get: operations["connectionUriDomainListV2GET"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/multitenancy/app": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** + * @deprecated + * @description This API is deprecated. Please use the v2 version of this API. In the v2 version of the API, the login methods are no longer enabled using the `emailPasswordEnabled`, `thirdPartyEnabled` and `passwordlessEnabled` inputs. Instead, they are enabled using factorIds (such as emailpassword, otp-email, etc) specified in the `firstFactors` and `requiredSecondaryFactors` inputs. Please refer [Multitenancy Docs](https://supertokens.com/docs/multitenancy/new-tenant) to know the list of factorIds available. + * + * Note: This deprecated API still accepts those `emailPasswordEnabled`, `thirdPartyEnabled` and `passwordlessEnabled` inputs for backward compatibility. + * + * Create or update an app. + * + * SuperTokens subscription license key is required. + * + * If creating a new app, only the login methods set to true will be enabled and rest will be disabled by default. + * + * `firstFactors` and `requiredSecondaryFactors` can be set to null to remove all entries in the core, or a non empty string array to be updated in the core. Setting of empty array is disallowed. + * + * Note: the create/update will fail if a login method is not enabled and a relavant factor is added to either `firstFactors` or `requiredSecondaryFactors`. For example, `emailPasswordEnabled` cannot be set to `false` if `emailpassword` is present in the `firstFactors` array. + * + * If updating an existing app, + * 1. core will keep the existing state of login methods and only update the ones that are specified in the request body. + * 2. Core config will be merged into existing config. To delete a key in the config, use a null value + * + * Note: the newly created app will use the same connection uri domain from which + * this request originates and the request must originate from public app and public tenant. + * + * Note: Updation of core config is not allowed for the default connectionUriDomain, public app. In order to update config for the default connectionUriDomain and public app, you must edit the config.yaml or the docker env directly. + * + */ + put: operations["createOrUpdateAppPUT"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/multitenancy/app/v2": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** @description Create or update an app. + * + * SuperTokens subscription license key is required. + * + * The `firstFactors` can be set to following values: + * + * - `null`: When set to `null`, all the login methods will be available for the app (public tenant). + * - `[]` (empty array): No login methods will be enabled for the app (public tenant). + * - `['factor1', 'factor2', ...]` (non-empty array): The list of login methods to enable for the app (public tenant). For eg. if this is set to `['emailpassword', 'thirdparty']`, the users of the tenant will be able to login using emailpassword and third party providers. + * + * List of built-in first factors are as follows: + * + * - Email password auth: `emailpassword` + * - Social login / enterprise SSO auth: `thirdparty` + * - Passwordless: + * - With email OTP: `otp-email` + * - With SMS OTP: `otp-phone` + * - With email magic link: `link-email` + * - With SMS magic link: `link-phone` + * + * If first factors are not specified while creating a new app, all the login methods will be enabled by default. + * + * The `requiredSecondaryFactors` can be set to following values: + * - `null`: When set to `null`, no secondary factors will be required for the users of the app (public tenant). + * - `['factor1', 'factor2', ...]` (non-empty array): The list of factors that the users of the app (public tenant) must complete post the first factor login. For eg. if this is set to `['otp-phone', 'totp']`, the users of the tenant will be required to complete either phone OTP or TOTP post the first factor login. + * + * List of built-in secondary factors are as follows: + * + * - Email password auth: `emailpassword` + * - Social login / enterprise SSO auth: `thirdparty` + * - Passwordless: + * - With email OTP: `otp-email` + * - With SMS OTP: `otp-phone` + * - With email magic link: `link-email` + * - With SMS magic link: `link-phone` + * - Time based OTP: `totp` + * + * If updating an existing app, + * 1. core will keep the existing state of login methods and only update the ones that are specified in the request body. + * 2. Core config will be merged into existing config. To delete a key in the config, use a null value + * + * Note: the newly created app will use the same connection uri domain from which + * this request originates and the request must originate from public app and public tenant. + * + * Note: Updation of core config is not allowed for the default connectionUriDomain, public app. In order to update config for the default connectionUriDomain and public app, you must edit the config.yaml or the docker env directly. + * */ + put: operations["createOrUpdateAppV2PUT"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/multitenancy/app/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Delete an app. + * + * Request must originate from public app and tenant. + * + * Note: No tenants (other than the public tenant) must belong to the app to be able to delete it. + * */ + post: operations["deleteAppPOST"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/multitenancy/app/list": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * @deprecated + * @description This API is deprecated. Please use the v2 version of this API. In the v2 version of the API, the login methods are no longer enabled using the `emailPasswordEnabled`, `thirdPartyEnabled` and `passwordlessEnabled` inputs. Instead, they are enabled using factorIds (such as emailpassword, otp-email, etc) specified in the `firstFactors` and `requiredSecondaryFactors` inputs. Please refer [Multitenancy Docs](https://supertokens.com/docs/multitenancy/new-tenant) to know the list of factorIds available. + * + * Note: This deprecated API still returns `emailPasswordEnabled`, `thirdPartyEnabled` and `passwordlessEnabled` values for backward compatibility, and it's values are derived from the `firstFactors` and `requiredSecondaryFactors` configured for the tenant. The detailed computation of the values as per CDI version is described here: https://github.com/supertokens/supertokens-core/issues/979#issuecomment-2099971371 + * + * Get a list of all apps in a connection uri domain. + * + * Request must originate from public app and tenant. + * + */ + get: operations["appListGET"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/multitenancy/app/list/v2": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get a list of all apps in a connection uri domain. + * + * The value of `firstFactors` can be as follows: + * - `null`: When set to `null`, the SDK will use firstFactors defined in the SDK + * - `[]` (empty array): No first factors would be enabled for the tenant + * - non-empty array: The first factors that are enabled for the tenant + * + * Request must originate from public app and tenant. + * */ + get: operations["appListV2GET"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/multitenancy/tenant": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** + * @deprecated + * @description This API is deprecated. Please use the v2 version of this API. In the v2 version of the API, the login methods are no longer enabled using the `emailPasswordEnabled`, `thirdPartyEnabled` and `passwordlessEnabled` inputs. Instead, they are enabled using factorIds (such as emailpassword, otp-email, etc) specified in the `firstFactors` and `requiredSecondaryFactors` inputs. Please refer [Multitenancy Docs](https://supertokens.com/docs/multitenancy/new-tenant) to know the list of factorIds available. + * + * Note: This deprecated API still accepts those `emailPasswordEnabled`, `thirdPartyEnabled` and `passwordlessEnabled` inputs for backward compatibility. + * + * Creates or updates a tenant. + * + * SuperTokens subscription license key is required. + * + * If creating a new tenant, only the login methods set to true will be enabled and rest will be disabled by default. + * + * `firstFactors` and `requiredSecondaryFactors` can be set to null to remove all entries in the core, or a non empty string array to be updated in the core. Setting of empty array is disallowed. + * + * Note: the create/update will fail if a login method is not enabled and a relavant factor is added to either `firstFactors` or `requiredSecondaryFactors`. For example, `emailPasswordEnabled` cannot be set to `false` if `emailpassword` is present in the `firstFactors` array. + * + * If updating an existing tenant, + * 1. core will keep the existing state of login methods and only update the ones that are specified in the request body. + * 2. Core config will be merged into existing config. To delete a key in the config, use a null value + * + * The request must originate from public tenant, and the new tenant will use connectionUriDomain and app from which the request originates. + * + * Note: Updation of core config is not allowed for the default connectionUriDomain, public app and tenant. In order to update config for the default connectionUriDomain, public app and tenant, you must edit the config.yaml or the docker env directly. + * + */ + put: operations["createOrUpdateTenantPUT"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/multitenancy/tenant/v2": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** @description Creates or updates a tenant. + * + * SuperTokens subscription license key is required. + * + * The `firstFactors` can be set to following values: + * + * - `null`: When set to `null`, all the login methods will be available for the tenant. + * - `[]` (empty array): No login methods will be enabled for the tenant. + * - `['factor1', 'factor2', ...]` (non-empty array): The list of login methods to enable for the tenant. For eg. if this is set to `['emailpassword', 'thirdparty']`, the users of the tenant will be able to login using emailpassword and third party providers. + * + * List of built-in first factors are as follows: + * + * - Email password auth: `emailpassword` + * - Social login / enterprise SSO auth: `thirdparty` + * - Passwordless: + * - With email OTP: `otp-email` + * - With SMS OTP: `otp-phone` + * - With email magic link: `link-email` + * - With SMS magic link: `link-phone` + * + * If first factors are not specified while creating a new tenant, all the login methods will be disabled by default. + * + * The `requiredSecondaryFactors` can be set to following values: + * - `null`: When set to `null`, no secondary factors will be required for the users of the tenant. + * - `['factor1', 'factor2', ...]` (non-empty array): The list of factors that the users of the tenant must complete post the first factor login. For eg. if this is set to `['otp-phone', 'totp']`, the users of the tenant will be required to complete either phone OTP or TOTP post the first factor login. + * + * List of built-in secondary factors are as follows: + * + * - Email password auth: `emailpassword` + * - Social login / enterprise SSO auth: `thirdparty` + * - Passwordless: + * - With email OTP: `otp-email` + * - With SMS OTP: `otp-phone` + * - With email magic link: `link-email` + * - With SMS magic link: `link-phone` + * - Time based OTP: `totp` + * + * If updating an existing tenant, + * 1. core will keep the existing state of login methods and only update the ones that are specified in the request body. + * 2. Core config will be merged into existing config. To delete a key in the config, use a null value + * + * The request must originate from public tenant, and the new tenant will use connectionUriDomain and app from which the request originates. + * + * Note: Updation of core config is not allowed for the default connectionUriDomain, public app and tenant. In order to update config for the default connectionUriDomain, public app and tenant, you must edit the config.yaml or the docker env directly. + * */ + put: operations["createOrUpdateTenantV2PUT"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/multitenancy/tenant": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * @deprecated + * @description This API is deprecated. Please use the v2 version of this API. In the v2 version of the API, the login methods are no longer enabled using the `emailPasswordEnabled`, `thirdPartyEnabled` and `passwordlessEnabled` inputs. Instead, they are enabled using factorIds (such as emailpassword, otp-email, etc) specified in the `firstFactors` and `requiredSecondaryFactors` inputs. Please refer [Multitenancy Docs](https://supertokens.com/docs/multitenancy/new-tenant) to know the list of factorIds available. + * + * Note: This deprecated API still returns `emailPasswordEnabled`, `thirdPartyEnabled` and `passwordlessEnabled` values for backward compatibility, and it's values are derived from the `firstFactors` and `requiredSecondaryFactors` configured for the tenant. The detailed computation of the values as per CDI version is described here: https://github.com/supertokens/supertokens-core/issues/979#issuecomment-2099971371 + * + * Get a tenant config of the tenant specified by the url prefix. + * + * SuperTokens subscription license key is required if querying any tenant other than the base tenant. + * + * Returns recipes with their enabled flag and recipe specific configs saved in core + * + */ + get: operations["tenantConfigGet"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/multitenancy/tenant/v2": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get a tenant config of the tenant specified by the url prefix. + * + * The value of `firstFactors` can be as follows: + * - `null`: When set to `null`, the SDK will use firstFactors defined in the SDK + * - `[]` (empty array): No first factors would be enabled for the tenant + * - non-empty array: The first factors that are enabled for the tenant + * + * SuperTokens subscription license key is required if querying any tenant other than the base tenant. + * + * Returns recipes with their enabled flag and recipe specific configs saved in core + * */ + get: operations["tenantConfigV2Get"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/dashboard/tenant/core-config": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get the core config of the tenant specified by the url prefix, along with the metadata of each of the fields. + * */ + get: operations["tenantCoreConfigForDashboardGET"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/multitenancy/tenant/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Delete a tenant. + * + * Request must originate from public tenant. + * */ + post: operations["deleteTenantPOST"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/multitenancy/tenant/list": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * @deprecated + * @description This API is deprecated. Please use the v2 version of this API. In the v2 version of the API, the login methods are no longer enabled using the `emailPasswordEnabled`, `thirdPartyEnabled` and `passwordlessEnabled` inputs. Instead, they are enabled using factorIds (such as emailpassword, otp-email, etc) specified in the `firstFactors` and `requiredSecondaryFactors` inputs. Please refer [Multitenancy Docs](https://supertokens.com/docs/multitenancy/new-tenant) to know the list of factorIds available. + * + * Note: This deprecated API still returns `emailPasswordEnabled`, `thirdPartyEnabled` and `passwordlessEnabled` values for backward compatibility, and it's values are derived from the `firstFactors` and `requiredSecondaryFactors` configured for the tenant. The detailed computation of the values as per CDI version is described here: https://github.com/supertokens/supertokens-core/issues/979#issuecomment-2099971371 + * + * Get a list of all tenants in an app. + * + * Request must originate from public tenant. + * + */ + get: operations["tenantListGET"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/multitenancy/tenant/list/v2": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get a list of all tenants in an app. + * + * The value of `firstFactors` can be as follows: + * - `null`: When set to `null`, the SDK will use firstFactors defined in the SDK + * - `[]` (empty array): No first factors would be enabled for the tenant + * - non-empty array: The first factors that are enabled for the tenant + * + * Request must originate from public tenant. + * */ + get: operations["tenantListV2GET"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/multitenancy/config/thirdparty": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** @description Creates or updates ThirdParty Provider Config for a tenant. + * + * If `skipValidation` is set to true, the config will be saved without any validation. + * + * If the config already exists for the given `tenantId` and `thirdPartyId`, the config in the core will be completely replaced with the config provided in the request body. + * + * **Validations done by the core:** + * + * `thirdPartyId` and `name` are required + * + * Common to all providers: + * - `clients` list: + * - can be undefined or empty + * - if contains 1 element, clientType can be empty or undefined + * - if contains more than 1 element, clientType must be defined and unique + * - for each element in `clients`: + * - `clientId` must not be empty + * + * Built-in provider's specific validation is invoked if the `thirdPartyId` starts with the provider's id + * + * Apple (id: apple): + * - `clients` + * - if it contains elements, each of them are validated as follows: + * - `clientSecret` must be empty or undefined + * - `additionalConfig` should contain the following keys: + * - `keyId` must be a non empty string + * - `teamId` must be a non empty string + * - `privateKey` must be a non empty string + * + * Google Workspaces (id: google-workspaces): + * - `clients` + * - if it contains elements, each of them are validated as follows: + * - `additionalConfig` may contain the key `hd` + * - `hd` is optional + * - if specified, it must be either `"*"`, or a valid domain + * + * Boxy SAML (id: boxy-saml): + * - `clients` + * - `additionalConfig` in the each element must contain `boxyURL` and must be non-empty string + * */ + put: operations["createOrUpdateTenantConfigPUT"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/multitenancy/config/thirdparty/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Delete ThirdParty Provider config for a tenant. + * */ + post: operations["deleteTenantConfigPOST"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/multitenancy/tenant/user": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Add user's association with the tenant. + * + * User will be added to the tenant based on the url prefix of the request. + * + * Note: To associate a user to a tenant, the tenant must be in the same database + * and user must already exist in the app + * */ + post: operations["addUserToTenant"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/multitenancy/tenant/user/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Remove user's association with the tenant + * + * User will be removed from the tenant based on the url prefix of the request. + * */ + post: operations["removeUserFromTenant"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/clients": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get OAuth2 Client + * */ + get: operations["getOAuth2Client"]; + /** @description Update OAuth2 Client + * */ + put: operations["updateOAuth2Client"]; + /** @description Create OAuth2 Client + * */ + post: operations["createOAuth2Client"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/clients/list": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description List OAuth2 Clients + * */ + get: operations["listOAuth2Clients"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/clients/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Remove OAuth2 Client + * */ + post: operations["removeOAuth2Client"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/auth/requests/consent": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get OAuth2 Consent Request + * */ + get: operations["getOAuth2ConsentRequest"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/auth/requests/consent/accept": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** @description Accept OAuth2 Consent Request + * */ + put: operations["acceptOAuth2ConsentRequest"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/auth/requests/consent/reject": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** @description Reject OAuth2 Consent Request + * */ + put: operations["rejectOAuth2ConsentRequest"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/auth/requests/login": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get OAuth2 Login Request + * */ + get: operations["getOAuth2LoginRequest"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/auth/requests/login/accept": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** @description Accept OAuth2 Login Request + * */ + put: operations["acceptOAuth2LoginRequest"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/auth/requests/login/reject": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** @description Reject OAuth2 Login Request + * */ + put: operations["rejectOAuth2LoginRequest"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/auth/requests/logout/accept": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** @description Accept OAuth2 Logout Request + * */ + put: operations["acceptOAuth2LogoutRequest"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/auth/requests/logout/reject": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** @description Reject OAuth2 Logout Request + * */ + put: operations["rejectOAuth2LogoutRequest"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/session/revoke": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Revoke OAuth2 Session + * */ + post: operations["revokeOAuth2Session"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/token/revoke": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Revoke OAuth2 Token + * */ + post: operations["revokeOAuth2Token"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/tokens/revoke": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Revoke OAuth2 Token + * */ + post: operations["revokeOAuth2Tokens"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/auth": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get OAuth2 Auth + * */ + get: operations["getOAuth2Auth"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/token": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Get OAuth2 Token + * */ + post: operations["getOAuth2Token"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/sessions/logout": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get OAuth2 Sessions Logout + * */ + get: operations["getOAuth2SessionsLogout"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/recipe/oauth/introspect": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Introspect OAuth2 Token + * */ + post: operations["introspectOAuth2Token"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/bulk-import/users": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Paginated API to get bulk import users + * */ + get: operations["getBulkImportUsers"]; + put?: never; + /** @description Add users for bulk import. Maximum 10000 users can be added in one request. + * */ + post: operations["addBulkImportUsers"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/bulk-import/users/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Delete bulk import users by id. Multiple ids can be passed in the request body. + * */ + post: operations["deleteBulkImportUsers"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/webauthn/user/credential": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get the WebAuthn credential for the user. */ + get: operations["getWebAuthNCredential"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/webauthn/user/credential/list": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description List credentials that were created by the user. */ + get: operations["listWebAuthNCredentials"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/webauthn/options": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get the WebAuthn options. */ + get: operations["getWebAuthNOptions"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/webauthn/user/recover": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Recover the user using the WebAuthn credential. */ + get: operations["recoverWebAuthNUser"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/webauthn/options/register": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Generate the webauthn options for registration. */ + post: operations["generateRegistrationOptions"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/webauthn/options/signin": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Generate the webauthn options for signin. */ + post: operations["generateSigninOptions"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/webauthn/user/credential/register": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Register a new credential for the user */ + post: operations["registerWebAuthNCredential"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/webauthn/signup": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Sign up the user using the WebAuthn credential. */ + post: operations["signUpWebAuthNUser"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/webauthn/signin": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Sign in the user using the WebAuthn credential. */ + post: operations["signInWebAuthNUser"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/webauthn/user/recover/token": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Generate a token to recover the user. */ + post: operations["generateTokenForRecovery"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/webauthn/user/recover/token/consume": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Consume the token to recover the user. */ + post: operations["consumeWebAuthNToken"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/webauthn/user/email": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** @description Update the email of the user. */ + put: operations["updateEmail"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/webauthn/user/credential/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post?: never; + /** @description Remove the WebAuthn credential for the user. */ + delete: operations["removeWebAuthNCredential"]; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "//recipe/webauthn/options/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post?: never; + /** @description Remove the WebAuthn options. */ + delete: operations["removeWebAuthNOptions"]; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; +} +export type webhooks = Record; +export interface components { + schemas: { + authRecipeUser: { + id?: components["schemas"]["userId"]; + /** @example true */ + isPrimaryUser?: boolean; + tenantIds?: components["schemas"]["tenantId"][]; + timeJoined?: components["schemas"]["timeJoined"]; + emails?: components["schemas"]["email"][]; + phoneNumbers?: components["schemas"]["phoneNumber"][]; + webauthn?: { + credentialIds?: string[]; + }; + thirdParty?: { + id?: components["schemas"]["thirdPartyId"]; + userId?: components["schemas"]["thirdPartyUserId"]; + }[]; + loginMethods?: { + tenantIds?: components["schemas"]["tenantId"][]; + recipeUserId?: components["schemas"]["userId"]; + /** @example true */ + verified?: boolean; + timeJoined?: components["schemas"]["timeJoined"]; + recipeId?: components["schemas"]["recipeId"]; + email?: components["schemas"]["email"]; + phoneNumber?: components["schemas"]["phoneNumber"]; + thirdParty?: { + id?: components["schemas"]["thirdPartyId"]; + userId?: components["schemas"]["thirdPartyUserId"]; + }; + webauthn?: { + credentialIds?: string[]; + }; + }[]; + }; + /** @enum {string} */ + recipeId: "emailpassword" | "passwordless" | "thirdparty" | "webauthn"; + /** @example ZTRiOTBjNz...jI5MTZlODkxw */ + token: string; + emailVerificationVerifyTokenRequest: { + userId?: components["schemas"]["userId"]; + email?: components["schemas"]["email"]; + }; + /** @example google */ + thirdPartyId: string; + /** @example 106347997792363870000 */ + thirdPartyUserId: string; + thirdPartyEmail: { + id?: components["schemas"]["email"]; + isVerified?: components["schemas"]["isVerified"]; + }; + /** @example true */ + isVerified: boolean; + /** @example johndoe@gmail.com */ + email: string; + /** @example password123 */ + password: string; + /** @example fa7a0841-b533-4478-95533-0fde890c3483 */ + userId: string; + /** @example admin */ + role: string; + /** @example 1623918032231 */ + timeJoined: number; + /** @example ZmE3YTA4ND...OzE2MjM5MTgwMzIyMzE= */ + paginationToken: string; + /** @example +14155552671 */ + phoneNumber: string; + /** + * @description Uniquely identifies a code + * @example QZ0Mx9zG9cfqNXmPI0I/67r9bpKghUBDQZeMMbayi+I= + */ + codeId: string; + /** + * @description A random identifier that should be stored on the device that started the sign in process. + * @example TU/52WOcktSv99zqaAZuWJG9BSoS0aRLfCbep8rFEwk= + */ + deviceId: string; + /** + * @description A random identifier that can be used to identify the login attempt/device. + * @example kFmkPQEAJtACiT2w/K8fndEuNm+XozJXSZSlWEr+iGs= + */ + preAuthSessionId: string; + /** + * @description This can be used to authenticate the user when paired with the deviceId + * @example 456123 + */ + userInputCode: string; + /** + * @description URL-safe string that can be used to authenticate the user, without the deviceId + * @example b10lbT_SnDC4flA6Fn7pE5TtG5k5NfigLef4QMBeGA8 + */ + linkCode: string; + /** + * @description The maximum lifetime of the code in milliseconds + * @example 900000 + */ + codeLifetime: number; + /** @enum {string} */ + statusOK: "OK"; + oauthClient: { + /** @example stcl_c6dd9189-33b8-4ec0-8aea-a0ffdaf75fcb */ + clientId?: string; + /** @example Hello */ + clientName?: string; + /** @example T98n1YIMWqr4wOM.~bV4HOPFmO */ + clientSecret?: string; + /** @example [ + * "http://localhost:3000/auth/callback/ory" + * ] */ + redirectUris?: string[]; + /** @example [ + * "authorization_code", + * "refresh_token" + * ] */ + grantTypes?: string[]; + /** @example [ + * "code", + * "id_token" + * ] */ + responseTypes?: string[]; + /** @example offline_access openid email */ + scope?: string; + /** @example [] */ + audience?: string[]; + /** @example */ + policyUri?: string; + /** @example [] */ + allowedCorsOrigins?: string[]; + /** @example */ + tosUri?: string; + /** @example */ + clientUri?: string; + /** @example */ + logoUri?: string; + /** @example client_secret_post */ + tokenEndpointAuthMethod?: string; + /** + * Format: date-time + * @example 2025-02-24T08:14:40Z + */ + createdAt?: string; + /** + * Format: date-time + * @example 2025-02-24T08:14:40.362463Z + */ + updatedAt?: string; + /** @example [ + * "http://localhost:3000" + * ] */ + postLogoutRedirectUris?: string[]; + /** @example {} */ + metadata?: { + [key: string]: unknown; + }; + /** @example 1h0m0s */ + authorizationCodeGrantAccessTokenLifespan?: string | null; + /** @example 1h0m0s */ + authorizationCodeGrantIdTokenLifespan?: string | null; + /** @example 1h0m0s */ + authorizationCodeGrantRefreshTokenLifespan?: string | null; + /** @example 1h0m0s */ + clientCredentialsGrantAccessTokenLifespan?: string | null; + /** @example 1h0m0s */ + implicitGrantAccessTokenLifespan?: string | null; + /** @example 1h0m0s */ + implicitGrantIdTokenLifespan?: string | null; + /** @example 1h0m0s */ + refreshTokenGrantIdTokenLifespan?: string | null; + /** @example 1h0m0s */ + refreshTokenGrantAccessTokenLifespan?: string | null; + /** @example 1h0m0s */ + refreshTokenGrantRefreshTokenLifespan?: string | null; + /** @example false */ + enableRefreshTokenRotation?: boolean; + }; + /** + * @description should be a JSON object (not a JSON literal nor an array) + * @example { + * "preferences": { + * "theme": "dark" + * }, + * "notifications": { + * "email": true + * }, + * "todos": [ + * "example" + * ] + * } + */ + userMetadata: Record; + /** + * @description should be a JSON object (not a JSON literal nor an array) + * @example { + * "notifications": { + * "sms": true + * }, + * "todos": null + * } + */ + userMetadataUpdate: Record; + /** + * @description should be a JSON object (not a JSON literal nor an array) + * @example { + * "test": 123 + * } + */ + userDataInJWT: Record; + /** + * @description should be a JSON object (not a JSON literal nor an array) + * @example { + * "test": 123 + * } + */ + userDataInDatabase: Record; + /** @example false */ + enableAntiCsrf: boolean; + /** @example 68en6gd6-865b-4af6-ba00-96e5c153257d */ + handle: string; + /** @example Error Message */ + message: string; + session: { + handle?: components["schemas"]["handle"]; + userId?: components["schemas"]["userId"]; + userDataInJWT?: components["schemas"]["userDataInJWT"]; + tenantId?: components["schemas"]["tenantId"]; + recipeUserId?: components["schemas"]["userId"]; + }; + cookieInfo: { + token?: components["schemas"]["token"]; + expiry?: components["schemas"]["expiry"]; + createdTime?: components["schemas"]["timeCreated"]; + }; + /** @example 1637262633029 */ + expiry: number; + /** @example 1637262633029 */ + timeCreated: number; + sessionHandles: components["schemas"]["handle"][]; + /** + * @description The payload of the JWT, should be a JSON object. + * @example { + * "custom-claim": "" + * } + */ + createJWTPayload: Record; + /** + * @description The algorithm to use when creating the JWT. + * @enum {string} + */ + createJWTAlgorithm: "RS256"; + /** + * @description This is used as the value for the issuer claim in the JWT payload. + * @example https://api.test.com/ + */ + jwksDomain: string; + /** + * @description Duration in seconds, used to calculate JWT expiry + * @example 86400 + */ + jwtValidity: number; + /** @description A JWK that can be used to verify a JWT */ + jwk: { + alg?: components["schemas"]["createJWTAlgorithm"]; + /** @example RSA */ + kty?: string; + /** @example sig */ + use?: string; + /** @description Unique identifier for the JWK */ + kid?: string; + /** @description X.509 Certificate Chain */ + x5c?: string[]; + }; + unauthorisedMessageResponse: { + status?: components["schemas"]["unauthorisedResponse"]; + message?: components["schemas"]["message"]; + }; + /** @enum {string} */ + helloResponse: "Hello"; + statusOKResponse: { + /** @enum {string} */ + status?: "OK"; + }; + wrongCredentialsResponse: { + /** @enum {string} */ + status?: "WRONG_CREDENTIALS_ERROR"; + }; + unknownUserIdResponse: { + /** @enum {string} */ + status?: "UNKNOWN_USER_ID_ERROR"; + }; + unknownRoleResponse: { + /** @enum {string} */ + status?: "UNKNOWN_ROLE_ERROR"; + }; + /** @enum {string} */ + tokenTheftResponse: "TOKEN_THEFT_DETECTED"; + /** @enum {string} */ + unauthorisedResponse: "UNAUTHORISED"; + /** @enum {string} */ + tryRefreshTokenResponse: "TRY_REFRESH_TOKEN"; + /** @enum {string} */ + internalError: "Internal Error"; + /** @enum {string} */ + notFound: "Not Found"; + /** @enum {string} */ + methodNotSupported: "Method not supported"; + invalidJSON: string; + /** @enum {string} */ + requestUnauthorised: "Invalid API key"; + /** @enum {string} */ + licenseError: "License Error"; + /** @example customer1 */ + tenantId: string; + thirdPartyProviderConfig: { + thirdPartyId: string; + name?: string; + clients?: { + clientType?: string; + clientId?: string; + clientSecret?: string; + scope?: string[]; + forcePKCE?: boolean; + additionalConfig?: Record; + }[]; + authorizationEndpoint?: string; + authorizationEndpointQueryParams?: Record; + tokenEndpoint?: string; + tokenEndpointBodyParams?: Record; + userInfoEndpoint?: string; + userInfoEndpointQueryParams?: Record; + userInfoEndpointHeaders?: Record; + jwksURI?: string; + oidcDiscoveryEndpoint?: string; + /** @default true */ + requireEmail: boolean; + userInfoMap?: { + fromIdTokenPayload?: { + userId?: string; + email?: string; + emailVerified?: string; + }; + fromUserInfoAPI?: { + userId?: string; + email?: string; + emailVerified?: string; + }; + }; + }; + firstFactors: string[]; + requiredSecondaryFactors: string[]; + tenantInput: { + emailPasswordEnabled?: boolean; + thirdPartyEnabled?: boolean; + passwordlessEnabled?: boolean; + firstFactors?: components["schemas"]["firstFactors"]; + requiredSecondaryFactors?: components["schemas"]["requiredSecondaryFactors"]; + coreConfig?: Record; + }; + tenantInputV2: { + firstFactors?: components["schemas"]["firstFactors"]; + requiredSecondaryFactors?: components["schemas"]["requiredSecondaryFactors"]; + coreConfig?: Record; + }; + tenantConfig: { + tenantId: components["schemas"]["tenantId"]; + emailPassword: { + enabled: boolean; + }; + thirdParty: { + enabled: boolean; + providers?: components["schemas"]["thirdPartyProviderConfig"][]; + }; + passwordless: { + enabled: boolean; + }; + firstFactors?: components["schemas"]["firstFactors"]; + requiredSecondaryFactors?: components["schemas"]["requiredSecondaryFactors"]; + coreConfig: Record; + }; + /** @example $argon2d$v=19$m=12,t=3,p=1$aGI4enNvMmd0Zm0wMDAwMA$r6p7qbr6HD+8CD7sBi4HVw */ + passwordHash: string; + /** @enum {string} */ + hashingAlgorithm: "argon2" | "bcrypt" | "firebase_scrypt"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + bulkImportUserId: string; + /** @enum {string} */ + bulkImportUserStatus: "NEW" | "PROCESSING" | "FAILED"; + bulkImportUserRole: { + role: components["schemas"]["role"]; + tenantIds: components["schemas"]["tenantId"][]; + }; + bulkImportTotpDevice: { + /** @example 2PRXZWZAYYDAWCD */ + secretKey: string; + /** @example 0 */ + skew?: number; + /** @example 30 */ + period?: number; + /** @example My Authy App */ + deviceName?: string; + }; + bulkImportUserLoginMethodFields: { + /** @description List of tenant IDs this login method is associated with */ + tenantIds?: components["schemas"]["tenantId"][]; + /** @description Indicates whether the email is verified */ + isVerified?: boolean; + /** @description Indicates whether the login method is the primary login method */ + isPrimary?: boolean; + /** @description Time joined in milliseconds since the epoch */ + timeJoinedInMSSinceEpoch?: number; + }; + bulkImportUserEmailPasswordLoginMethod: components["schemas"]["bulkImportUserLoginMethodFields"] & { + /** @example emailpassword */ + recipeId?: string; + email: components["schemas"]["email"]; + passwordHash: components["schemas"]["passwordHash"]; + /** @example passwordExample */ + plainTextPassword?: string; + hashingAlgorithm: components["schemas"]["hashingAlgorithm"]; + }; + addBulkImportUserLoginMethodResponse: { + /** @example emailpassword */ + recipeId: string; + userId: components["schemas"]["userId"]; + tenants: components["schemas"]["tenantId"][]; + email: components["schemas"]["email"]; + thirdpartyId?: components["schemas"]["thirdPartyId"]; + thirdpartyUserId?: components["schemas"]["thirdPartyUserId"]; + phoneNumber?: components["schemas"]["phoneNumber"]; + }; + bulkImportUserThirdPartyLoginMethod: components["schemas"]["bulkImportUserLoginMethodFields"] & { + /** @example thirdparty */ + recipeId?: string; + thirdPartyId: components["schemas"]["thirdPartyId"]; + thirdPartyUserId: components["schemas"]["thirdPartyUserId"]; + }; + bulkImportUserPasswordlessLoginMethod: (components["schemas"]["bulkImportUserLoginMethodFields"] & { + /** @example passwordless */ + recipeId?: string; + }) & + (components["schemas"]["email"] | components["schemas"]["phoneNumber"]); + bulkImportUser: { + externalUserId?: components["schemas"]["userId"]; + userMetadata?: components["schemas"]["userMetadata"][]; + userRoles?: components["schemas"]["bulkImportUserRole"][]; + totpDevices?: components["schemas"]["bulkImportTotpDevice"][]; + loginMethods?: ( + | components["schemas"]["bulkImportUserEmailPasswordLoginMethod"] + | components["schemas"]["bulkImportUserThirdPartyLoginMethod"] + | components["schemas"]["bulkImportUserPasswordlessLoginMethod"] + )[]; + }; + addBulkImportUserResponse: { + userId?: components["schemas"]["userId"]; + loginMethods?: components["schemas"]["addBulkImportUserLoginMethodResponse"][]; + }; + bulkImportUserResponse: { + id?: components["schemas"]["bulkImportUserId"]; + status?: components["schemas"]["bulkImportUserStatus"]; + createdAt?: components["schemas"]["timeJoined"]; + updatedAt?: components["schemas"]["timeJoined"]; + } & (components["schemas"]["bulkImportUser"] & Record); + tenantConfigV2: { + tenantId: components["schemas"]["tenantId"]; + thirdParty: { + providers?: components["schemas"]["thirdPartyProviderConfig"][]; + }; + firstFactors?: components["schemas"]["firstFactors"]; + requiredSecondaryFactors?: components["schemas"]["requiredSecondaryFactors"]; + coreConfig: Record; + }; + oauthError: { + /** @enum {string} */ + status: "OAUTH_ERROR"; + error: string; + errorDescription: string; + statusCode: number; + }; + }; + responses: { + /** @description error code 400 */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "text/plain": components["schemas"]["invalidJSON"]; + }; + }; + /** @description error code 401 */ + 401: { + headers: { + [name: string]: unknown; + }; + content: { + "text/plain": components["schemas"]["requestUnauthorised"]; + }; + }; + /** @description error code 402 */ + 402: { + headers: { + [name: string]: unknown; + }; + content: { + "text/plain": components["schemas"]["licenseError"]; + }; + }; + /** @description error code 404 */ + 404: { + headers: { + [name: string]: unknown; + }; + content: { + "text/plain": components["schemas"]["notFound"]; + }; + }; + /** @description error code 405 */ + 405: { + headers: { + [name: string]: unknown; + }; + content: { + "text/plain": components["schemas"]["methodNotSupported"]; + }; + }; + /** @description error code 500 */ + 500: { + headers: { + [name: string]: unknown; + }; + content: { + "text/plain": components["schemas"]["internalError"]; + }; + }; + /** @description return a simple hello message */ + hello: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["helloResponse"]; + }; + }; + }; + parameters: { + /** @example emailpassword */ + rid: string; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + "api-key": string; + /** @example thirdparty */ + thirdPartyRid: string; + /** @example passwordless */ + passwordlessRid: string; + /** @example emailverification */ + emailVerificationRid: string; + /** @example multitenancy */ + multitenancyRid: string; + /** @example oauth */ + oauthRid: string; + /** @example usermetadata */ + userMetadataRid: string; + /** @example userroles */ + userRolesRid: string; + /** @example session */ + sessionRid: string; + /** @example jwt */ + jwtRID: string; + /** @example useridmapping */ + userIdMappingRid: string; + /** @example dashboard */ + dashboardRid: string; + /** @example totp */ + totpRid: string; + /** @example accountlinking */ + accountLinkingRid: string; + /** @example webauthn */ + webauthnRid: string; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version": string; + /** @example ZmE3YTA4NDEtY...MjM5MTgwMzIyMzE= */ + paginationToken: string; + /** @example 1 */ + limit: number; + timeJoinedOrder: "ASC" | "DESC"; + email: string; + userId: string; + userIdRequired: string; + roleRequired: string; + permissionRequired: string; + /** @description The param should take an array of comma seperated strings */ + includeRecipeIds: string; + bulkImportUserStatus: components["schemas"]["bulkImportUserStatus"]; + }; + requestBodies: never; + headers: never; + pathItems: never; +} +export type $defs = Record; +export interface operations { + canCreatePrimaryUser: { + parameters: { + query: { + recipeUserId: string; + }; + header?: { + /** @example accountlinking */ + rid?: components["parameters"]["accountLinkingRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Indicates success with the status and canCreatePrimaryUser properties */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example true */ + wasAlreadyAPrimaryUser?: boolean; + } + | { + /** @enum {string} */ + status?: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + } + | { + /** @enum {string} */ + status?: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + canLinkAccounts: { + parameters: { + query: { + primaryUserId: string; + recipeUserId: string; + }; + header?: { + /** @example accountlinking */ + rid?: components["parameters"]["accountLinkingRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Indicates success with the status prop */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example true */ + accountsAlreadyLinked?: boolean; + } + | { + /** @enum {string} */ + status?: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + } + | { + /** @enum {string} */ + status?: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + } + | { + /** @enum {string} */ + status?: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + createPrimaryUser: { + parameters: { + query?: never; + header?: { + /** @example accountlinking */ + rid?: components["parameters"]["accountLinkingRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId: string; + }; + }; + }; + responses: { + /** @description Indicates success with the status and primaryUserId properties */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example true */ + wasAlreadyAPrimaryUser?: boolean; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status?: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + } + | { + /** @enum {string} */ + status?: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + linkAccounts: { + parameters: { + query?: never; + header?: { + /** @example accountlinking */ + rid?: components["parameters"]["accountLinkingRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId: string; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId: string; + }; + }; + }; + responses: { + /** @description Indicates success with the status and accountsAlreadyLinked properties */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example true */ + accountsAlreadyLinked?: boolean; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status?: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + } + | { + /** @enum {string} */ + status?: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + user?: components["schemas"]["authRecipeUser"]; + description?: string; + } + | { + /** @enum {string} */ + status?: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + unlinkAccounts: { + parameters: { + query?: never; + header?: { + /** @example accountlinking */ + rid?: components["parameters"]["accountLinkingRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId: string; + }; + }; + }; + responses: { + /** @description Indicates success with the status and accountsUnlinked properties */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + /** @example true */ + wasRecipeUserDeleted?: boolean; + /** @example true */ + wasLinked?: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + updateTotpDeviceName: { + parameters: { + query?: never; + header?: { + /** @example totp */ + rid?: components["parameters"]["totpRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + userId: components["schemas"]["userId"]; + /** @example My Authy App */ + existingDeviceName: string; + /** @example A better name for my TOTP device */ + newDeviceName: string; + }; + }; + }; + responses: { + /** @description Indicates success with the status property */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + } + | { + /** @enum {string} */ + status?: "UNKNOWN_DEVICE_ERROR"; + } + | { + /** @enum {string} */ + status?: "DEVICE_ALREADY_EXISTS_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + createTotpDevice: { + parameters: { + query?: never; + header?: { + /** @example totp */ + rid?: components["parameters"]["totpRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + userId: components["schemas"]["userId"]; + /** @example My Authy App */ + deviceName?: string; + /** @example 0 */ + skew: number; + /** @example 30 */ + period: number; + }; + }; + }; + responses: { + /** @description Indicates success with the status and secret properties */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example JBSWY3DPEHPK3PXP */ + secret?: string; + /** @example d1 */ + deviceName?: string; + } + | { + /** @enum {string} */ + status?: "DEVICE_ALREADY_EXISTS_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getTotpDevices: { + parameters: { + query: { + userId: string; + }; + header?: { + /** @example totp */ + rid?: components["parameters"]["totpRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Retrives all TOTP devices */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + devices?: { + name?: string; + period?: number; + skew?: number; + verified?: boolean; + }[]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + importTotpDevice: { + parameters: { + query?: never; + header?: { + /** @example totp */ + rid?: components["parameters"]["totpRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + userId: components["schemas"]["userId"]; + /** @example My Authy App */ + deviceName?: string; + /** @example 0 */ + skew: number; + /** @example 30 */ + period: number; + /** @example BSWY3DPEMOWNFUWJLDIWNDNDPONBIUFG */ + secretKey: string; + }; + }; + }; + responses: { + /** @description Indicates success with the status and secret properties */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example d1 */ + deviceName?: string; + } + | { + /** @enum {string} */ + status?: "DEVICE_ALREADY_EXISTS_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + removeTotpDevice: { + parameters: { + query?: never; + header?: { + /** @example totp */ + rid?: components["parameters"]["totpRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + userId: components["schemas"]["userId"]; + /** @example My Authy App */ + deviceName: string; + }; + }; + }; + responses: { + /** @description Indicates success with the status property */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + /** @example true */ + didDeviceExist?: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + verifyTotpCode: { + parameters: { + query?: never; + header?: { + /** @example totp */ + rid?: components["parameters"]["totpRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + userId: components["schemas"]["userId"]; + /** @example 123456 */ + totp: string; + /** @example false */ + allowUnverifiedDevices: boolean; + }; + }; + }; + responses: { + /** @description Indicates success with the status property */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + } + | { + /** @enum {string} */ + status?: "INVALID_TOTP_ERROR"; + /** @example 2 */ + currentNumberOfFailedAttempts?: number; + /** @example 5 */ + maxNumberOfFailedAttempts?: number; + } + | { + /** @enum {string} */ + status?: "UNKNOWN_USER_ID_ERROR"; + } + | { + /** @enum {string} */ + status?: "LIMIT_REACHED_ERROR"; + /** @example 90000 */ + retryAfterMs?: number; + /** @example 2 */ + currentNumberOfFailedAttempts?: number; + /** @example 5 */ + maxNumberOfFailedAttempts?: number; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + verifyTotpDevice: { + parameters: { + query?: never; + header?: { + /** @example totp */ + rid?: components["parameters"]["totpRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + userId: components["schemas"]["userId"]; + /** @example My Authy App */ + deviceName: string; + /** @example 123456 */ + totp: string; + }; + }; + }; + responses: { + /** @description Indicates success with the status property */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example false */ + wasAlreadyVerified?: boolean; + } + | { + /** @enum {string} */ + status?: "UNKNOWN_DEVICE_ERROR"; + } + | { + /** @enum {string} */ + status?: "INVALID_TOTP_ERROR"; + /** @example 2 */ + currentNumberOfFailedAttempts?: number; + /** @example 5 */ + maxNumberOfFailedAttempts?: number; + } + | { + /** @enum {string} */ + status?: "LIMIT_REACHED_ERROR"; + /** @example 90000 */ + retryAfterMs?: number; + /** @example 2 */ + currentNumberOfFailedAttempts?: number; + /** @example 5 */ + maxNumberOfFailedAttempts?: number; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + userIdMappingGetMapping: { + parameters: { + query: { + userId: string; + userIdType?: "SUPERTOKENS" | "EXTERNAL" | "ANY"; + }; + header?: { + /** @example useridmapping */ + rid?: components["parameters"]["userIdMappingRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Retrives a userId mapping */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status: components["schemas"]["statusOK"]; + superTokensUserId: components["schemas"]["userId"]; + /** @example externalId */ + externalUserId: string; + /** @example Info about external userId */ + externalUserIdInfo?: string; + } + | { + /** @enum {string} */ + status?: "UNKNOWN_MAPPING_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + userIdMappingCreateMapping: { + parameters: { + query?: never; + header?: { + /** @example useridmapping */ + rid?: components["parameters"]["userIdMappingRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + superTokensUserId: components["schemas"]["userId"]; + /** @example externalId */ + externalUserId: string; + /** @example Info about external userId */ + externalUserIdInfo?: string; + force?: boolean; + }; + }; + }; + responses: { + /** @description Indicates success with the status property */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + } + | { + /** @enum {string} */ + status?: "UNKNOWN_SUPERTOKENS_USER_ID_ERROR"; + } + | { + /** @enum {string} */ + status?: "USER_ID_MAPPING_ALREADY_EXISTS_ERROR"; + doesSuperTokensUserIdExist?: boolean; + doesExternalUserIdExist?: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + userIdMappingRemoveMapping: { + parameters: { + query?: never; + header?: { + /** @example useridmapping */ + rid?: components["parameters"]["userIdMappingRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + userId: components["schemas"]["userId"]; + /** @enum {string} */ + userIdType?: "SUPERTOKENS" | "EXTERNAL" | "ANY"; + force?: boolean; + }; + }; + }; + responses: { + /** @description Indicates success with the status property */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + didMappingExist?: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + userIdMappingUpateExternalUserIdInfo: { + parameters: { + query?: never; + header?: { + /** @example useridmapping */ + rid?: components["parameters"]["userIdMappingRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + userId: components["schemas"]["userId"]; + /** @enum {string} */ + userIdType?: "SUPERTOKENS" | "EXTERNAL" | "ANY"; + /** @example new external userId info */ + externalUserIdInfo: string | null; + }; + }; + }; + responses: { + /** @description Indicates success with the status property */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + } + | { + /** @enum {string} */ + status?: "UNKNOWN_MAPPING_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + passwordlessCheckCode: { + parameters: { + query?: never; + header?: { + /** @example passwordless */ + rid?: components["parameters"]["passwordlessRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": + | { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + linkCode: components["schemas"]["linkCode"]; + } + | { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + deviceId: components["schemas"]["deviceId"]; + userInputCode: components["schemas"]["userInputCode"]; + }; + }; + }; + responses: { + /** @description Indicates success with the status property */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + consumedDevice?: { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + /** @example 2 */ + failedCodeInputAttemptCount: number; + email?: components["schemas"]["email"]; + phoneNumber?: components["schemas"]["phoneNumber"]; + }; + } + | { + /** @enum {string} */ + status?: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR"; + /** @example 2 */ + failedCodeInputAttemptCount?: number; + /** @example 5 */ + maximumCodeInputAttempts?: number; + } + | { + /** @enum {string} */ + status?: "RESTART_FLOW_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + passwordlessTryUseCode: { + parameters: { + query?: never; + header?: { + /** @example passwordless */ + rid?: components["parameters"]["passwordlessRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": + | { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + linkCode: components["schemas"]["linkCode"]; + } + | { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + deviceId: components["schemas"]["deviceId"]; + userInputCode: components["schemas"]["userInputCode"]; + }; + }; + }; + responses: { + /** @description Indicates success with the status property */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example true */ + createdNewUser?: boolean; + user?: components["schemas"]["authRecipeUser"]; + recipeUserId?: components["schemas"]["userId"]; + consumedDevice?: { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + /** @example 2 */ + failedCodeInputAttemptCount: number; + email?: components["schemas"]["email"]; + phoneNumber?: components["schemas"]["phoneNumber"]; + }; + } + | { + /** @enum {string} */ + status?: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR"; + /** @example 2 */ + failedCodeInputAttemptCount?: number; + /** @example 5 */ + maximumCodeInputAttempts?: number; + } + | { + /** @enum {string} */ + status?: "RESTART_FLOW_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + passwordlessStartSignIn: { + parameters: { + query?: never; + header?: { + /** @example passwordless */ + rid?: components["parameters"]["passwordlessRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": + | { + email: components["schemas"]["email"]; + userInputCode?: components["schemas"]["userInputCode"]; + } + | { + phoneNumber: components["schemas"]["phoneNumber"]; + userInputCode?: components["schemas"]["userInputCode"]; + } + | { + deviceId: components["schemas"]["deviceId"]; + userInputCode?: components["schemas"]["userInputCode"]; + }; + }; + }; + responses: { + /** @description Starts the passwordless login process */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + preAuthSessionId?: components["schemas"]["preAuthSessionId"]; + codeId?: components["schemas"]["codeId"]; + deviceId?: components["schemas"]["deviceId"]; + userInputCode?: components["schemas"]["userInputCode"]; + linkCode?: components["schemas"]["linkCode"]; + timeCreated?: components["schemas"]["timeCreated"]; + codeLifetime?: components["schemas"]["codeLifetime"]; + } + | { + /** @enum {string} */ + status?: "RESTART_FLOW_ERROR" | "USER_INPUT_CODE_ALREADY_USED_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + passwordlessRevokeCode: { + parameters: { + query?: never; + header?: { + /** @example passwordless */ + rid?: components["parameters"]["passwordlessRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": + | { + codeId: components["schemas"]["codeId"]; + } + | { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + }; + }; + }; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + passwordlessListCodes: { + parameters: { + query?: { + /** @description Use this parameter to get information about all devices associated with an email (without the other query params) */ + email?: string; + /** @description Use this parameter to get information about all devices associated with a phoneNumber (without the other query params) */ + phoneNumber?: components["schemas"]["phoneNumber"]; + /** @description Use this parameter to get information about a single device (without the other query params) */ + deviceId?: components["schemas"]["deviceId"]; + /** @description Use this parameter to get information about a single device (without the other query params) */ + preAuthSessionId?: components["schemas"]["preAuthSessionId"]; + }; + header?: { + /** @example passwordless */ + rid?: components["parameters"]["passwordlessRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description List of all active passwordless codes of the user */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + devices?: { + preAuthSessionId?: components["schemas"]["preAuthSessionId"]; + /** @example 2 */ + failedCodeInputAttemptCount?: number; + email?: components["schemas"]["email"]; + phoneNumber?: components["schemas"]["phoneNumber"]; + codes?: { + codeId?: components["schemas"]["codeId"]; + timeCreated?: components["schemas"]["timeCreated"]; + codeLifetime?: components["schemas"]["codeLifetime"]; + }[]; + }[]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + passwordlessRevokeAllCodesOfUser: { + parameters: { + query?: never; + header?: { + /** @example passwordless */ + rid?: components["parameters"]["passwordlessRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": + | { + email: components["schemas"]["email"]; + } + | { + phoneNumber: components["schemas"]["phoneNumber"]; + }; + }; + }; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + passwordlessGetUser: { + parameters: { + query?: { + userId?: components["parameters"]["userId"]; + /** @description Use exactly one of phoneNumber, email or userId */ + email?: components["schemas"]["email"]; + /** @description Use exactly one of phoneNumber, email or userId */ + phoneNumber?: components["schemas"]["phoneNumber"]; + }; + header?: { + /** @example passwordless */ + rid?: components["parameters"]["passwordlessRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Get a user's information. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status?: "UNKNOWN_USER_ID_ERROR" | "UNKNOWN_EMAIL_ERROR" | "UNKNOWN_PHONE_NUMBER_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + passwordlessPutUser: { + parameters: { + query?: never; + header?: { + /** @example passwordless */ + rid?: components["parameters"]["passwordlessRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + recipeUserId?: components["schemas"]["userId"]; + email?: components["schemas"]["email"] & unknown; + phoneNumber?: components["schemas"]["phoneNumber"] & unknown; + }; + }; + }; + responses: { + /** @description update user's information */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + /** @enum {string} */ + status?: + | "OK" + | "UNKNOWN_USER_ID_ERROR" + | "EMAIL_ALREADY_EXISTS_ERROR" + | "PHONE_NUMBER_ALREADY_EXISTS_ERROR"; + } + | { + /** @enum {string} */ + status?: "EMAIL_CHANGE_NOT_ALLOWED_ERROR" | "PHONE_NUMBER_CHANGE_NOT_ALLOWED_ERROR"; + reason?: string; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + emailPasswordSignin: { + parameters: { + query?: never; + header?: { + /** @example emailpassword */ + rid?: components["parameters"]["rid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + email?: components["schemas"]["email"]; + password?: components["schemas"]["password"]; + }; + }; + }; + responses: { + /** @description signin response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + recipeUserId?: components["schemas"]["userId"]; + } + | components["schemas"]["wrongCredentialsResponse"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + emailPasswordSignup: { + parameters: { + query?: never; + header?: { + /** @example emailpassword */ + rid?: components["parameters"]["rid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + email?: components["schemas"]["email"]; + password?: components["schemas"]["password"]; + }; + }; + }; + responses: { + /** @description signup response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + recipeUserId?: components["schemas"]["userId"]; + } + | { + /** @enum {string} */ + status?: "EMAIL_ALREADY_EXISTS_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + emailPasswordGetUser: { + parameters: { + query?: { + /** @description use either email or userId, not both */ + email?: components["schemas"]["email"]; + /** @description use either email or userId, not both */ + userId?: components["schemas"]["userId"]; + }; + header?: { + /** @example emailpassword */ + rid?: components["parameters"]["rid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description get user's information */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status?: "UNKNOWN_USER_ID_ERROR" | "UNKNOWN_EMAIL_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + emailPasswordPutUser: { + parameters: { + query?: never; + header?: { + /** @example emailpassword */ + rid?: components["parameters"]["rid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + recipeUserId?: components["schemas"]["userId"]; + email?: components["schemas"]["email"]; + password?: components["schemas"]["password"]; + }; + }; + }; + responses: { + /** @description update user's information */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + /** @enum {string} */ + status?: "OK" | "UNKNOWN_USER_ID_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR"; + } + | { + /** @enum {string} */ + status?: "EMAIL_CHANGE_NOT_ALLOWED_ERROR"; + reason?: string; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + emailPasswordGetPasswordResetToken: { + parameters: { + query?: never; + header?: { + /** @example emailpassword */ + rid?: components["parameters"]["rid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + userId: components["schemas"]["userId"]; + email: components["schemas"]["email"]; + }; + }; + }; + responses: { + /** @description Generate a new reset password token for this user */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + token?: components["schemas"]["token"]; + } + | components["schemas"]["unknownUserIdResponse"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + emailPasswordGetPasswordReset: { + parameters: { + query?: never; + header?: { + /** @example emailpassword */ + rid?: components["parameters"]["rid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @enum {string} */ + method?: "token"; + token?: components["schemas"]["token"]; + /** @example newpassword123 */ + newPassword?: string; + }; + }; + }; + responses: { + /** @description Reset a password using password reset token */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + userId?: components["schemas"]["userId"]; + } + | { + /** @enum {string} */ + status?: "RESET_PASSWORD_INVALID_TOKEN_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + userImport: { + parameters: { + query?: never; + header?: { + /** @example emailpassword */ + rid?: components["parameters"]["rid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + email?: components["schemas"]["email"]; + passwordHash?: components["schemas"]["passwordHash"]; + hashingAlgorithm?: components["schemas"]["hashingAlgorithm"]; + }; + }; + }; + responses: { + /** @description import user response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + didUserAlreadyExist?: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + emailPasswordResetPasswordConsumeToken: { + parameters: { + query?: never; + header?: { + /** @example emailpassword */ + rid?: components["parameters"]["rid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + token?: components["schemas"]["token"]; + }; + }; + }; + responses: { + /** @description Consume a password reset token */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + userId?: components["schemas"]["userId"]; + email?: components["schemas"]["email"]; + } + | { + /** @enum {string} */ + status?: "RESET_PASSWORD_INVALID_TOKEN_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + thirdPartySigninup: { + parameters: { + query?: never; + header?: { + /** @example thirdparty */ + rid?: components["parameters"]["thirdPartyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + thirdPartyId?: components["schemas"]["thirdPartyId"]; + thirdPartyUserId?: components["schemas"]["thirdPartyUserId"]; + email?: components["schemas"]["thirdPartyEmail"]; + }; + }; + }; + responses: { + /** @description Signin/up a user */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example true */ + createdNewUser?: boolean; + user?: components["schemas"]["authRecipeUser"]; + recipeUserId?: components["schemas"]["userId"]; + } + | { + /** @enum {string} */ + status?: "EMAIL_CHANGE_NOT_ALLOWED_ERROR"; + reason?: string; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + thirdPartyGetUser: { + parameters: { + query?: { + userId?: components["parameters"]["userId"]; + /** @description Either use userId or thirdPartyId and thirdPartyUserId */ + thirdPartyId?: components["schemas"]["thirdPartyId"]; + /** @description Either use userId or thirdPartyId and thirdPartyUserId */ + thirdPartyUserId?: components["schemas"]["thirdPartyUserId"]; + }; + header?: { + /** @example thirdparty */ + rid?: components["parameters"]["thirdPartyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Get a user's information. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status?: "UNKNOWN_USER_ID_ERROR" | "UNKNOWN_THIRD_PARTY_USER_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + thirdPartyGetUsersByEmail: { + parameters: { + query: { + /** @description User's email */ + email: string; + }; + header?: { + /** @example thirdparty */ + rid?: components["parameters"]["thirdPartyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Get all users associated with given email */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + users?: components["schemas"]["authRecipeUser"][]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 500: components["responses"]["500"]; + }; + }; + emailVerificationVerifyToken: { + parameters: { + query?: never; + header?: { + /** @example emailverification */ + rid?: components["parameters"]["emailVerificationRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": components["schemas"]["emailVerificationVerifyTokenRequest"]; + }; + }; + responses: { + /** @description Generate a new email verification token for this user */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + token?: components["schemas"]["token"]; + } + | { + /** @enum {string} */ + status?: "EMAIL_ALREADY_VERIFIED_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + emailVerificationVerifyTokenRemove: { + parameters: { + query?: never; + header?: { + /** @example emailverification */ + rid?: components["parameters"]["emailVerificationRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": components["schemas"]["emailVerificationVerifyTokenRequest"]; + }; + }; + responses: { + /** @description OK response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @enum {string} */ + status?: "OK"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + emailVerificationVerify: { + parameters: { + query?: never; + header?: { + /** @example emailverification */ + rid?: components["parameters"]["emailVerificationRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @enum {string} */ + method?: "token"; + token?: components["schemas"]["token"]; + }; + }; + }; + responses: { + /** @description Verify an email */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + userId?: components["schemas"]["userId"]; + email?: components["schemas"]["email"]; + } + | { + /** @enum {string} */ + status?: "EMAIL_VERIFICATION_INVALID_TOKEN_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + emailVerificationVerifyGet: { + parameters: { + query?: { + userId?: components["parameters"]["userId"]; + email?: components["parameters"]["email"]; + }; + header?: { + /** @example emailverification */ + rid?: components["parameters"]["emailVerificationRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Verify an email */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + isVerified?: components["schemas"]["isVerified"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + emailVerificationVerifyRemove: { + parameters: { + query?: never; + header?: { + /** @example emailverification */ + rid?: components["parameters"]["emailVerificationRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": components["schemas"]["emailVerificationVerifyTokenRequest"]; + }; + }; + responses: { + /** @description OK response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @enum {string} */ + status?: "OK"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + userMetadataRead: { + parameters: { + query: { + userId: components["parameters"]["userIdRequired"]; + }; + header?: { + /** @example usermetadata */ + rid?: components["parameters"]["userMetadataRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + metadata?: components["schemas"]["userMetadata"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + userMetadataUpdate: { + parameters: { + query?: never; + header?: { + /** @example usermetadata */ + rid?: components["parameters"]["userMetadataRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + userId?: components["schemas"]["userId"]; + metadataUpdate?: components["schemas"]["userMetadataUpdate"]; + }; + }; + }; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + metadata?: components["schemas"]["userMetadata"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + userMetadataDelete: { + parameters: { + query?: never; + header?: { + /** @example usermetadata */ + rid?: components["parameters"]["userMetadataRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + userId?: components["schemas"]["userId"]; + }; + }; + }; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + addUserRole: { + parameters: { + query?: never; + header?: { + /** @example userroles */ + rid?: components["parameters"]["userRolesRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + userId: components["schemas"]["userId"]; + role: components["schemas"]["role"]; + }; + }; + }; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example true */ + didUserAlreadyHaveRole?: boolean; + } + | components["schemas"]["unknownRoleResponse"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + removeUserRole: { + parameters: { + query?: never; + header?: { + /** @example userroles */ + rid?: components["parameters"]["userRolesRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + userId: components["schemas"]["userId"]; + role: components["schemas"]["role"]; + }; + }; + }; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example true */ + didUserHaveRole?: boolean; + } + | components["schemas"]["unknownRoleResponse"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getUserRoles: { + parameters: { + query: { + userId: components["parameters"]["userIdRequired"]; + }; + header?: { + /** @example userroles */ + rid?: components["parameters"]["userRolesRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + roles?: components["schemas"]["role"][]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getRoleUsers: { + parameters: { + query: { + role: components["parameters"]["roleRequired"]; + }; + header?: { + /** @example userroles */ + rid?: components["parameters"]["userRolesRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + users?: components["schemas"]["userId"][]; + } + | components["schemas"]["unknownRoleResponse"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + putRole: { + parameters: { + query?: never; + header?: { + /** @example userroles */ + rid?: components["parameters"]["userRolesRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + role: components["schemas"]["role"]; + permissions?: string[]; + }; + }; + }; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + /** @example true */ + createdNewRole?: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getRolePermissions: { + parameters: { + query: { + role: components["parameters"]["roleRequired"]; + }; + header?: { + /** @example userroles */ + rid?: components["parameters"]["userRolesRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + permissions?: string[]; + } + | components["schemas"]["unknownRoleResponse"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + removeRolePermissions: { + parameters: { + query?: never; + header?: { + /** @example userroles */ + rid?: components["parameters"]["userRolesRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + role: components["schemas"]["role"]; + permissions?: string[]; + }; + }; + }; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + } + | components["schemas"]["unknownRoleResponse"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getPermissionRoles: { + parameters: { + query: { + permission: components["parameters"]["permissionRequired"]; + }; + header?: { + /** @example userroles */ + rid?: components["parameters"]["userRolesRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + roles?: string[]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + removeRole: { + parameters: { + query?: never; + header?: { + /** @example userroles */ + rid?: components["parameters"]["userRolesRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + role: components["schemas"]["role"]; + }; + }; + }; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + /** @example true */ + didRoleExist?: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getRoles: { + parameters: { + query?: never; + header?: { + /** @example userroles */ + rid?: components["parameters"]["userRolesRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + roles?: string[]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + createNewSession: { + parameters: { + query?: never; + header?: { + /** @example session */ + rid?: components["parameters"]["sessionRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + userId?: components["schemas"]["userId"]; + userDataInJWT?: components["schemas"]["userDataInJWT"]; + userDataInDatabase?: components["schemas"]["userDataInDatabase"]; + enableAntiCsrf?: components["schemas"]["enableAntiCsrf"]; + /** + * @description Decides if the token should be signed with a dynamic or static key, defaults to true + * @example false + */ + useDynamicSigningKey?: boolean; + }; + }; + }; + responses: { + /** @description Create a new Session */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + session?: components["schemas"]["session"]; + accessToken?: components["schemas"]["cookieInfo"]; + refreshToken?: components["schemas"]["cookieInfo"]; + antiCsrfToken?: components["schemas"]["token"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getSessionInfo: { + parameters: { + query?: { + sessionHandle?: components["schemas"]["handle"]; + }; + header?: { + /** @example session */ + rid?: components["parameters"]["sessionRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Get user and session information for a given session handle */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + userDataInDatabase?: components["schemas"]["userDataInDatabase"]; + userDataInJWT?: components["schemas"]["userDataInJWT"]; + userId?: components["schemas"]["userId"]; + expiry?: components["schemas"]["expiry"]; + timeCreated?: components["schemas"]["timeCreated"]; + sessionHandle?: components["schemas"]["handle"]; + tenantId?: components["schemas"]["tenantId"]; + } + | components["schemas"]["unauthorisedMessageResponse"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + deleteSession: { + parameters: { + query?: never; + header?: { + /** @example session */ + rid?: components["parameters"]["sessionRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": + | { + sessionHandles?: components["schemas"]["sessionHandles"]; + } + | { + userId: components["schemas"]["userId"]; + revokeAcrossAllTenants?: boolean; + }; + }; + }; + responses: { + /** @description Delete a session */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + sessionHandlesRevoked?: components["schemas"]["sessionHandles"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + verifySession: { + parameters: { + query?: never; + header?: { + /** @example session */ + rid?: components["parameters"]["sessionRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + accessToken?: components["schemas"]["token"]; + enableAntiCsrf?: components["schemas"]["enableAntiCsrf"]; + /** @example false */ + doAntiCsrfCheck?: boolean; + /** + * @description Decides if we always check if the session exists in the DB or just do token validation, defaults to false. + * @example false + */ + checkDatabase?: boolean; + antiCsrfToken?: components["schemas"]["token"]; + }; + }; + }; + responses: { + /** @description Verify a session */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + session?: components["schemas"]["session"]; + accessToken?: components["schemas"]["cookieInfo"]; + } + | components["schemas"]["unauthorisedMessageResponse"] + | { + status?: components["schemas"]["tryRefreshTokenResponse"]; + message?: components["schemas"]["message"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + refreshSession: { + parameters: { + query?: never; + header?: { + /** @example session */ + rid?: components["parameters"]["sessionRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + refreshToken: components["schemas"]["token"]; + enableAntiCsrf: components["schemas"]["enableAntiCsrf"]; + antiCsrfToken?: components["schemas"]["token"]; + useDynamicSigningKey: boolean; + }; + }; + }; + responses: { + /** @description Refresh a session */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + session?: components["schemas"]["session"]; + accessToken?: components["schemas"]["cookieInfo"]; + refreshToken?: components["schemas"]["cookieInfo"]; + antiCsrfToken?: components["schemas"]["token"]; + } + | { + status?: components["schemas"]["tokenTheftResponse"]; + session?: { + handle?: components["schemas"]["handle"]; + userId?: components["schemas"]["userId"]; + }; + } + | components["schemas"]["unauthorisedMessageResponse"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getUserSessionHandles: { + parameters: { + query?: { + userId?: components["parameters"]["userId"]; + fetchAcrossAllTenants?: "true" | "false"; + }; + header?: { + /** @example session */ + rid?: components["parameters"]["sessionRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Get user Session Handles */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + sessionHandles?: components["schemas"]["sessionHandles"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + regenerateSession: { + parameters: { + query?: never; + header?: { + /** @example session */ + rid?: components["parameters"]["sessionRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + accessToken?: components["schemas"]["token"]; + userDataInJWT?: components["schemas"]["userDataInJWT"]; + }; + }; + }; + responses: { + /** @description Regenerate user session */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + session?: components["schemas"]["session"]; + accessToken?: components["schemas"]["cookieInfo"]; + } + | components["schemas"]["unauthorisedMessageResponse"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getSessionData: { + parameters: { + query?: { + /** @description Users session handle */ + sessionHandle?: components["schemas"]["handle"]; + }; + header?: { + /** @example session */ + rid?: components["parameters"]["sessionRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Get Session Data */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + userDataInDatabase?: components["schemas"]["userDataInDatabase"]; + } + | components["schemas"]["unauthorisedMessageResponse"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + putSessionData: { + parameters: { + query?: never; + header?: { + /** @example session */ + rid?: components["parameters"]["sessionRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + sessionHandle?: components["schemas"]["handle"]; + userDataInDatabase?: components["schemas"]["userDataInDatabase"]; + }; + }; + }; + responses: { + /** @description Change Session Data */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | components["schemas"]["statusOKResponse"] + | components["schemas"]["unauthorisedMessageResponse"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + createSignedJWT: { + parameters: { + query?: never; + header?: { + /** @example jwt */ + rid?: components["parameters"]["jwtRID"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + payload?: components["schemas"]["createJWTPayload"]; + algorithm?: components["schemas"]["createJWTAlgorithm"]; + jwksDomain?: components["schemas"]["jwksDomain"]; + validity?: components["schemas"]["jwtValidity"]; + /** + * @description Decides if the token should be signed with a dynamic or static key, defaults to true + * @example true + */ + useStaticSigningKey?: boolean; + }; + }; + }; + responses: { + /** @description Create a signed JWT */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c */ + jwt?: string; + } + | { + /** @enum {string} */ + status?: "UNSUPPORTED_ALGORITHM_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getJWTData: { + parameters: { + query?: { + /** @description Users session handle */ + sessionHandle?: components["schemas"]["handle"]; + }; + header?: { + /** @example session */ + rid?: components["parameters"]["sessionRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Get JWT Data */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + userDataInJWT?: components["schemas"]["userDataInJWT"]; + } + | components["schemas"]["unauthorisedMessageResponse"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + putJWTData: { + parameters: { + query?: never; + header?: { + /** @example session */ + rid?: components["parameters"]["sessionRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + sessionHandle?: components["schemas"]["handle"]; + userDataInJWT?: components["schemas"]["userDataInJWT"]; + }; + }; + }; + responses: { + /** @description Change JWT Data for a session */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | components["schemas"]["statusOKResponse"] + | components["schemas"]["unauthorisedMessageResponse"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + updateDashboardUser: { + parameters: { + query?: never; + header?: { + /** @example dashboard */ + rid?: components["parameters"]["dashboardRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": + | { + /** @example test@example.com */ + email?: string; + /** @example password@123 */ + newPassword?: string; + /** @example test2@example.com */ + newEmail?: string; + } + | { + /** @example ue21r-fw32r3-d121-d1 */ + userId?: string; + /** @example password@123 */ + newPassword?: string; + /** @example test2@example.com */ + newEmail?: string; + }; + }; + }; + responses: { + /** @description Indicates success with the status property */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + /** @enum {string} */ + status?: "OK"; + user?: { + /** @example r23r-f235th54-g3413gf-r32dr2 */ + userId?: string; + /** @example test@example.com */ + email?: string; + /** @example 391238234792 */ + timeCreated?: number; + }; + } + | { + /** @enum {string} */ + status?: "EMAIL_ALREADY_EXISTS_ERROR"; + } + | { + /** @enum {string} */ + status?: "PASSWORD_WEAK_ERROR"; + /** @example Your password must have at least 8 characters */ + message?: string; + } + | { + /** @enum {string} */ + status?: "INVALID_EMAIL_ERROR"; + } + | { + /** @enum {string} */ + status?: "UNKNOWN_USER_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + createDashboardUser: { + parameters: { + query?: never; + header?: { + /** @example dashboard */ + rid?: components["parameters"]["dashboardRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example test@example.com */ + email?: string; + /** @example password@123 */ + password?: string; + }; + }; + }; + responses: { + /** @description Indicates success with the status property */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + /** @enum {string} */ + status?: "OK"; + user?: { + /** @example example-userid */ + userId?: string; + /** @example test@example.com */ + email?: string; + /** @example 1231321231 */ + timeCreated?: number; + }; + } + | { + /** @enum {string} */ + status?: "EMAIL_ALREADY_EXISTS_ERROR"; + } + | { + /** @enum {string} */ + status?: "PASSWORD_WEAK_ERROR"; + /** @example Your password must have at least 8 characters */ + message?: string; + } + | { + /** @enum {string} */ + status?: "INVALID_EMAIL_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + /** @description Indicates ayment required */ + 402: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @enum {string} */ + status?: "USER_LIMIT_REACHED_ERROR"; + /** @example You have reached the free limit for creating users, please purchase the dashboard feature to create new users */ + message?: string; + }; + }; + }; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + deleteDashboardUser: { + parameters: { + query?: { + email?: string; + userId?: string; + }; + header?: { + /** @example dashboard */ + rid?: components["parameters"]["dashboardRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Indicates success with the status property */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + didUserExist?: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getAllDashboardUsers: { + parameters: { + query?: never; + header?: { + /** @example dashboard */ + rid?: components["parameters"]["dashboardRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description get a list of dashboard users */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @enum {string} */ + status?: "OK"; + users?: { + /** @example test@example.com */ + email?: string; + /** @example uf2323-f223r233-f23-f23-f2f32 */ + userId?: string; + /** @example 16382348324 */ + timeCreated?: number; + /** @example false */ + isSuspended?: boolean; + }[]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + verifyDashboardUserSession: { + parameters: { + query?: never; + header?: { + /** @example dashboard */ + rid?: components["parameters"]["dashboardRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example rf32f-f32342f-32f-323r2f3-23 */ + sessionId?: string; + }; + }; + }; + responses: { + /** @description Indicates success with the status property */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + /** @enum {string} */ + status?: "OK"; + email?: string; + } + | { + /** @enum {string} */ + status?: "USER_SUSPENDED_ERROR"; + /** @example You have crossed the free dashboard user limit. Please purchase the dashboard feature or login with a valid user account */ + message?: string; + } + | { + /** @enum {string} */ + status?: "INVAlID_SESSION_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + RevokeDashboardUsersSession: { + parameters: { + query?: { + sessionId?: string; + }; + header?: { + /** @example dashboard */ + rid?: components["parameters"]["dashboardRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Indicates success with the status property */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + signInDashboardUser: { + parameters: { + query?: never; + header?: { + /** @example dashboard */ + rid?: components["parameters"]["dashboardRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example test@example.com */ + email?: string; + /** @example password@123 */ + password?: string; + }; + }; + }; + responses: { + /** @description Indicates success with the status property */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + /** @enum {string} */ + status?: "OK"; + /** @example null */ + sessionId?: string; + } + | { + /** @enum {string} */ + status?: "USER_SUSPENDED_ERROR"; + /** @example You have crossed the free dashboard user limit. Please purchase the dashboard feature or login with a valid user account */ + message?: string; + } + | { + /** @enum {string} */ + status?: "INVAlID_CREDENTIALS_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getAllSessionsForDashboardUser: { + parameters: { + query?: { + userId?: string; + }; + header?: { + /** @example dashboard */ + rid?: components["parameters"]["dashboardRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description get a list of sessions for dashboard user */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + sessions?: { + userId?: components["schemas"]["userId"]; + /** @example fni29f-f23f23-f2fq32qt-h35evf */ + sessionId?: string; + /** @example 16382348324 */ + timeCreated?: number; + /** @example 16382348324 */ + expiry?: number; + }[]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getApiVersion: { + parameters: { + query?: { + websiteDomain?: string; + apiDomain?: string; + }; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description get api version */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + versions?: string[]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getConfig: { + parameters: { + query?: { + pid?: string; + }; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description get api version */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example /usr/lib/supertokens/config.yaml */ + path?: string; + } + | { + /** @enum {string} */ + status?: "NOT_ALLOWED"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getHelloOnRootPath: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: components["responses"]["hello"]; + 500: components["responses"]["500"]; + }; + }; + getHello: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: components["responses"]["hello"]; + 500: components["responses"]["500"]; + }; + }; + putHello: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: components["responses"]["hello"]; + 500: components["responses"]["500"]; + }; + }; + postHello: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: components["responses"]["hello"]; + 500: components["responses"]["500"]; + }; + }; + deleteHello: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + 200: components["responses"]["hello"]; + 500: components["responses"]["500"]; + }; + }; + getTelemetry: { + parameters: { + query?: never; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Returns the telemetryID if it exists */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + /** @enum {boolean} */ + exists?: true; + /** @example 99c87c72-1807-22d-9b39-7a88f95re56c */ + telemetryId?: string; + } + | { + /** @example [ + * false + * ] */ + exists?: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getUsersCount: { + parameters: { + query?: { + /** @description The param should take an array of comma seperated strings */ + includeRecipeIds?: components["parameters"]["includeRecipeIds"]; + /** @description if set to true, will count users across all tenants in the app */ + includeAllTenants?: boolean; + }; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Get number of users */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + /** @example 1000000 */ + count?: number; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getActiveUsersCount: { + parameters: { + query: { + since: number; + }; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Get number of active users */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + /** @example 100000 */ + count?: number; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getUsers: { + parameters: { + query?: { + /** @description The param should take an array of comma seperated strings */ + includeRecipeIds?: components["parameters"]["includeRecipeIds"]; + /** @example ZmE3YTA4NDEtY...MjM5MTgwMzIyMzE= */ + paginationToken?: components["parameters"]["paginationToken"]; + /** @example 1 */ + limit?: components["parameters"]["limit"]; + timeJoinedOrder?: components["parameters"]["timeJoinedOrder"]; + email?: string; + phone?: number; + recipe?: string; + provider?: string; + }; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description User Pagination */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + users?: { + user?: components["schemas"]["authRecipeUser"]; + }[]; + nextPaginationToken?: components["schemas"]["paginationToken"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + deleteUser: { + parameters: { + query?: never; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + userId: components["schemas"]["userId"]; + /** @example true */ + removeAllLinkedAccounts?: boolean; + }; + }; + }; + responses: { + /** @description Returns OK if the operation succeeded (even if the user didn't exist before the call) */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 500: components["responses"]["500"]; + }; + }; + getSearchTags: { + parameters: { + query?: never; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Returns available tags for search */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + tags?: string[]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getFeatureFlag: { + parameters: { + query?: never; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + /** @example [ + * "feature_1", + * "feature_2" + * ] */ + features?: string[]; + usageStats?: Record; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getLicense: { + parameters: { + query?: never; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example eyJhbGciOiJIUzI1NiIsIn... */ + licenseKey?: string; + } + | { + /** @enum {string} */ + status?: "NO_LICENSE_KEY_FOUND_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 500: components["responses"]["500"]; + }; + }; + setLicense: { + parameters: { + query?: never; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example eyJhbGciOiJIUzI1NiIsIn... */ + licenseKey?: string; + }; + }; + }; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + } + | { + /** @enum {string} */ + status?: "MISSING_EE_FOLDER_ERROR"; + } + | { + /** @enum {string} */ + status?: "INVALID_LICENSE_KEY_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 500: components["responses"]["500"]; + }; + }; + deleteLicense: { + parameters: { + query?: never; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 500: components["responses"]["500"]; + }; + }; + getUserId: { + parameters: { + query?: { + userId?: components["parameters"]["userId"]; + }; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status?: "UNKNOWN_USER_ID_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getUsersByAccountInfo: { + parameters: { + query: { + email?: string; + phoneNumber?: string; + thirdPartyId?: string; + thirdPartyUserId?: string; + doUnionOfAccountInfo: boolean; + }; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + users?: components["schemas"]["authRecipeUser"][]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getRequestsStats: { + parameters: { + query?: never; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description The operation was successful */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + /** @example 16382348 */ + atMinute?: number; + averageRequestsPerSecond?: number[]; + peakRequestsPerSecond?: number[]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + createOrUpdateConnectionURIDomainPUT: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example core-1234.supertokens.io:3567 */ + connectionUriDomain: string; + } & components["schemas"]["tenantInput"]; + }; + }; + responses: { + /** @description Create or Update connection uri domain result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + createdNew: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + createOrUpdateConnectionURIDomainV2PUT: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example core-1234.supertokens.io:3567 */ + connectionUriDomain: string; + } & components["schemas"]["tenantInputV2"]; + }; + }; + responses: { + /** @description Create or Update connection uri domain result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + createdNew: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + deleteConnectionUriDomainPOST: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example core-1234.supertokens.io:3567 */ + connectionUriDomain: string; + }; + }; + }; + responses: { + /** @description Remove connection uri domain result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + didExist: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + connectionUriDomainListGET: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description List of connection uri domains */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + connectionUriDomains: { + /** @example core-1234.supertokens.io:3567 */ + connectionUriDomain?: string; + apps?: { + /** @example app1 */ + appId?: string; + tenants?: components["schemas"]["tenantConfig"][]; + }[]; + }[]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + connectionUriDomainListV2GET: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description List of connection uri domains */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + connectionUriDomains: { + /** @example core-1234.supertokens.io:3567 */ + connectionUriDomain?: string; + apps?: { + /** @example app1 */ + appId?: string; + tenants?: components["schemas"]["tenantConfigV2"][]; + }[]; + }[]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + createOrUpdateAppPUT: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example app1 */ + appId: string; + } & components["schemas"]["tenantInput"]; + }; + }; + responses: { + /** @description Create or Update app result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + createdNew: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + createOrUpdateAppV2PUT: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example app1 */ + appId: string; + } & components["schemas"]["tenantInputV2"]; + }; + }; + responses: { + /** @description Create or Update app result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + createdNew: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + deleteAppPOST: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example app1 */ + appId: string; + }; + }; + }; + responses: { + /** @description Remove app result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + didExist: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + appListGET: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description List of apps */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + apps: { + /** @example app1 */ + appId?: string; + tenants?: components["schemas"]["tenantConfig"][]; + }[]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + appListV2GET: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description List of apps */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + apps: { + /** @example app1 */ + appId?: string; + tenants?: components["schemas"]["tenantConfigV2"][]; + }[]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + createOrUpdateTenantPUT: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + tenantId: components["schemas"]["tenantId"]; + } & components["schemas"]["tenantInput"]; + }; + }; + responses: { + /** @description Create or Update tenant result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + createdNew: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + createOrUpdateTenantV2PUT: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + tenantId: components["schemas"]["tenantId"]; + } & components["schemas"]["tenantInputV2"]; + }; + }; + responses: { + /** @description Create or Update tenant result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + createdNew: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + tenantConfigGet: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Tenant config result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | ({ + status?: components["schemas"]["statusOK"]; + } & components["schemas"]["tenantConfig"]) + | { + /** @enum {string} */ + status?: "TENANT_NOT_FOUND_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + tenantConfigV2Get: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Tenant config result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | ({ + status?: components["schemas"]["statusOK"]; + } & components["schemas"]["tenantConfigV2"]) + | { + /** @enum {string} */ + status?: "TENANT_NOT_FOUND_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + tenantCoreConfigForDashboardGET: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Tenant core config result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + config: { + /** @example password_reset_token_lifetime */ + key?: string; + /** + * @example number + * @enum {string|null} + */ + valueType?: "string" | "number" | "boolean" | null; + /** @example 3600000 */ + value?: (string | number | boolean) | null; + /** @example Time in milliseconds for how long a password reset token / link is valid for. [Default: 3600000 (1 hour)] */ + description?: string; + isDifferentAcrossTenants?: boolean; + possibleValues?: string[] | null; + /** @example false */ + isNullable?: boolean; + /** @example 3600000 */ + defaultValue?: (string | number | boolean) | null; + /** @example false */ + isPluginProperty?: boolean; + /** @example false */ + isPluginPropertyEditable?: boolean; + }[]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + deleteTenantPOST: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + tenantId: components["schemas"]["tenantId"]; + }; + }; + }; + responses: { + /** @description Remove tenant result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + didExist: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + tenantListGET: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description List of tenants */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + tenants: components["schemas"]["tenantConfig"][]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + tenantListV2GET: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description List of tenants */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + tenants: components["schemas"]["tenantConfigV2"][]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + createOrUpdateTenantConfigPUT: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + config: components["schemas"]["thirdPartyProviderConfig"]; + /** @example false */ + skipValidation?: boolean; + }; + }; + }; + responses: { + /** @description Create or Update result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status: components["schemas"]["statusOK"]; + createdNew: boolean; + } + | { + /** @enum {string} */ + status: "CONFIG_VALIDATION_ERROR"; + reason: string; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + deleteTenantConfigPOST: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + thirdPartyId: components["schemas"]["thirdPartyId"]; + }; + }; + }; + responses: { + /** @description Remove thirdParty config result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + didConfigExist?: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + addUserToTenant: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + recipeUserId: components["schemas"]["userId"]; + }; + }; + }; + responses: { + /** @description Association result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status: components["schemas"]["statusOK"]; + wasAlreadyAssociated: boolean; + } + | { + /** @enum {string} */ + status: + | "UNKNOWN_USER_ID_ERROR" + | "EMAIL_ALREADY_EXISTS_ERROR" + | "PHONE_NUMBER_ALREADY_EXISTS_ERROR" + | "THIRD_PARTY_USER_ALREADY_EXISTS_ERROR"; + } + | { + /** @enum {string} */ + status?: "ASSOCIATION_NOT_ALLOWED_ERROR"; + reason?: string; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + removeUserFromTenant: { + parameters: { + query?: never; + header?: { + /** @example multitenancy */ + rid?: components["parameters"]["multitenancyRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + recipeUserId: components["schemas"]["userId"]; + }; + }; + }; + responses: { + /** @description Disassociation result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + wasAssociated: boolean; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getOAuth2Client: { + parameters: { + query: { + /** @example abcd */ + clientId: string; + }; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OAuth2 Client Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | ({ + status?: components["schemas"]["statusOK"]; + } & components["schemas"]["oauthClient"]) + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + updateOAuth2Client: { + parameters: { + query?: never; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": components["schemas"]["oauthClient"]; + }; + }; + responses: { + /** @description OAuth2 Client Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | ({ + status?: components["schemas"]["statusOK"]; + } & components["schemas"]["oauthClient"]) + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + createOAuth2Client: { + parameters: { + query?: never; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": components["schemas"]["oauthClient"]; + }; + }; + responses: { + /** @description OAuth2 Client Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | ({ + status?: components["schemas"]["statusOK"]; + } & components["schemas"]["oauthClient"]) + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + listOAuth2Clients: { + parameters: { + query?: { + pageSize?: number; + pageToken?: string; + clientName?: string; + }; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OAuth2 Client Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + clients?: components["schemas"]["oauthClient"][]; + nextPaginationToken?: string; + } + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + removeOAuth2Client: { + parameters: { + query?: never; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example stcl_c6dd9189-33b8-4ec0-8aea-a0ffdaf75fcb */ + clientId?: string; + }; + }; + }; + responses: { + /** @description OAuth2 Client Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example true */ + didExist?: boolean; + } + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getOAuth2ConsentRequest: { + parameters: { + query: { + consentChallenge: string; + }; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OAuth2 Consent Request Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + client?: components["schemas"]["oauthClient"]; + requestedScope?: string[]; + requestedAudience?: string[]; + requestedClaims?: { + idToken?: { + property1?: string; + property2?: string; + }; + }; + loginHint?: string; + uiLocales?: string[]; + acrValues?: string[]; + subject?: string; + requestUrl?: string; + skip?: boolean; + clientId?: string; + redirectUri?: string; + forceSubjectIdentifier?: string; + requestedAccessTokenAudience?: string[]; + context?: Record; + sessionId?: string; + loginSessionId?: string; + loginChallenge?: string; + loginRequestedAt?: string; + consentRequestedAt?: string; + consentChallenge?: string; + consentSkip?: boolean; + consentRemember?: boolean; + consentRememberFor?: number; + consentError?: { + name?: string; + description?: string; + }; + consentErrorDebug?: string; + consentErrorDescription?: string; + consentErrorHint?: string; + consentErrorCode?: string; + consentStatusCode?: number; + sessionIdToken?: { + property1?: string; + property2?: string; + }; + sessionAccessToken?: { + property1?: string; + property2?: string; + }; + sessionToken?: { + property1?: string; + property2?: string; + }; + } + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + acceptOAuth2ConsentRequest: { + parameters: { + query: { + consentChallenge: string; + }; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + context?: Record; + grantAccessTokenAudience?: string[]; + grantScope?: string[]; + /** + * Format: date-time + * @example 2019-08-24T14:15:22Z + */ + handledAt?: string; + remember?: boolean; + rememberFor?: number; + session?: { + accessToken?: { + [key: string]: unknown; + }; + idToken?: { + [key: string]: unknown; + }; + }; + }; + }; + }; + responses: { + /** @description OAuth2 Consent Request Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example {apiDomain}/oauth/consent?... */ + redirectTo?: string; + } + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + rejectOAuth2ConsentRequest: { + parameters: { + query: { + consentChallenge: string; + }; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + error?: string; + errorDebug?: string; + errorDescription?: string; + errorHint?: string; + /** @example 400 */ + statusCode?: number; + }; + }; + }; + responses: { + /** @description OAuth2 Consent Request Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example {apiDomain}/oauth/consent?... */ + redirectTo?: string; + } + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getOAuth2LoginRequest: { + parameters: { + query: { + loginChallenge: string; + }; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OAuth2 Login Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + challenge?: string; + client?: components["schemas"]["oauthClient"]; + oidcContext?: { + acrValues?: string[]; + display?: string; + idTokenHintClaims?: Record; + loginHint?: string; + uiLocales?: string[]; + requestUrl?: string; + requestedAccessTokenAudience?: string[]; + requestedScope?: string[]; + sessionId?: string; + skip?: boolean; + subject?: string; + }; + } + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + acceptOAuth2LoginRequest: { + parameters: { + query: { + loginChallenge: string; + }; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + acr?: string; + amr?: string[]; + context?: string | null; + /** @example true */ + extendSessionLifespan?: boolean; + forceSubjectIdentifier?: string; + identityProviderSessionId?: string; + /** @example true */ + remember?: boolean; + /** @example 0 */ + rememberFor?: number; + subject: string; + }; + }; + }; + responses: { + /** @description OAuth2 Login Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example {apiDomain}/oauth/login?... */ + redirectTo?: string; + } + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + rejectOAuth2LoginRequest: { + parameters: { + query: { + loginChallenge: string; + }; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + error?: string; + errorDebug?: string; + errorDescription?: string; + errorHint?: string; + /** @example 0 */ + statusCode?: number; + }; + }; + }; + responses: { + /** @description OAuth2 Login Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example {apiDomain}/oauth/login?... */ + redirectTo?: string; + } + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + acceptOAuth2LogoutRequest: { + parameters: { + query?: never; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + challenge?: string; + }; + }; + }; + responses: { + /** @description OAuth2 Logout Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example {apiDomain}/oauth/logout?... */ + redirectTo?: string; + } + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + rejectOAuth2LogoutRequest: { + parameters: { + query?: never; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + challenge?: string; + }; + }; + }; + responses: { + /** @description OAuth2 Logout Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + } + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + revokeOAuth2Session: { + parameters: { + query?: never; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + sessionHandle?: string; + }; + }; + }; + responses: { + /** @description OAuth2 Session Revocation Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example true */ + didExist?: boolean; + } + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + revokeOAuth2Token: { + parameters: { + query?: never; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + token?: string; + }; + }; + }; + responses: { + /** @description OAuth2 Token Revocation Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example true */ + didExist?: boolean; + } + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + revokeOAuth2Tokens: { + parameters: { + query?: never; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example stcl_fed7cff0-cc6e-406e-b7a6-766148675a4a */ + client_id?: string; + }; + }; + }; + responses: { + /** @description OAuth2 Token Revocation Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example true */ + didExist?: boolean; + } + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getOAuth2Auth: { + parameters: { + query?: never; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OAuth2 Auth Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | ({ + status?: components["schemas"]["statusOK"]; + } & components["schemas"]["oauthClient"]) + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getOAuth2Token: { + parameters: { + query?: never; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example https://api.auth.com */ + iss?: string; + /** @example {} */ + inputBody?: Record; + /** @example false */ + useStaticSigningKey?: boolean; + /** @example Bearer 1234567890 */ + authorizationHeader?: string; + }; + }; + }; + responses: { + /** @description OAuth2 Token Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example eyJraWQiOiJzLTBjZmVmMDdkLWQ2NDktNGIwOC04MTVjLWJkYjZlYTczNWQyZCIsInR5cCI6IkpXVCIsImFsZyI6IlJTMjU2In0.eyJpYXQiOjE3NDAzODU5MzcsImV4cCI6MTc0MDM4OTUzOCwiY2xpZW50X2lkIjoic3RjbF82NWUwODc1Mi0yYzU5LTQ5NjQtOTM0Yy02OTIwZDJmMDZlNjIiLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjMwMDEvYXV0aCIsImp0aSI6Ijc1NTc2MmFmLTUwYTUtNDc1ZS04YWRkLTg3MDA1ZmU3YWJlNiIsIm5iZiI6MTc0MDM4NTkzNywic2NwIjpbIm9wZW5pZCIsIm9mZmxpbmVfYWNjZXNzIl0sInN1YiI6InNvbWV1c2VyaWQiLCJzdHQiOjEsImdpZCI6ImRjOGQ0OGUzLTcwOTgtNDhhNi1hYjU0LTgxMWMyODQ4N2I4MiIsInRJZCI6InB1YmxpYyIsInJzdWIiOiJzb21ldXNlcmlkIiwic2Vzc2lvbkhhbmRsZSI6InNlc3Npb24taGFuZGxlIn0.DgVgtD2gXgzHrDsC2lIUBa-wsYm8KO4Pg8L1Ov3aSBVgjwtjiCO40ldjBZ9qKdQBq5Qqk0ElAZNj6Bzc40ESfQumLH3_N2XtOj568s71JPuEOIg5hs9XAdK4vYfXMhVQRWn9iPUKHKrpRVf73IIH0mpkN8i6_MhcDoMMOuG5XPlXajG9VOyoY_5saHA61-uTafZLdAgKqnmYGvS8KmNEcEbBWLGwFB4QQKiDAUvatIi5n3juFBUxyt9t6DrqT1D04shesRppa0XhCZbCFBv1dixSrprdtqKhlPOrMgvOGNZ3cBLbYBOG9zoJRD5YlVMGw-j_pE7IbvpDWKL7tTJS1Q */ + access_token: string; + /** @example 3599 */ + expires_in?: number; + /** @example eyJraWQiOiJzLTBjZmVmMDdkLWQ2NDktNGIwOC04MTVjLWJkYjZlYTczNWQyZCIsInR5cCI6IkpXVCIsImFsZyI6IlJTMjU2In0.eyJpYXQiOjE3NDAzODU5MzgsImV4cCI6MTc0MDM4OTUzOCwiYXRfaGFzaCI6IkNxOGNCSk01Nm5FcG9aaWREcnZvLVEiLCJhdWQiOiJzdGNsXzY1ZTA4NzUyLTJjNTktNDk2NC05MzRjLTY5MjBkMmYwNmU2MiIsImF1dGhfdGltZSI6MTc0MDM4NTkzNywiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDozMDAxL2F1dGgiLCJqdGkiOiIxZDA5OGUxZi04ZGIxLTQyNzUtYmMzYS0zYTA4NjdjOWE2NTAiLCJyYXQiOjE3NDAzODU3MzEsInNpZCI6InNlc3Npb24taGFuZGxlIiwic3ViIjoic29tZXVzZXJpZCIsInN0dCI6MiwiZ2lkIjoiYzk1OTVjYjItMWFjOS00MDI0LWFjNjMtNDJlZDEyODliY2RmIn0.PGsemf1qpLF-cE_616NHvKsRmanFiyba0yqF2j5fy87AWD5McI405A4eqi-wAlKsDxC-MPpuW8bx-08YUhs3x6ku4aFaDyA-M-Xhc65fJJ4SCPVaUL7qlUwl7wJwNs2rMRW3Ayyj4MDSlW5uqm39_K_bBqod2Qj1yqck-N0g78qh86uEcyX6Al3d5KSln1B21nwDsEgegk3xzE8lFMCQUTpZEYb5-1v2D0Bu_PblBfOCjA6mBtT1IIQkmSE27FvkTUS1H50EUyhFP4JH30kP3bUnQ9pOqGMTe405N2ruKtPyWsXHLPlQ4hcJCLO5GT5ZgtUjfz6Y3mCM9l69uDYDHg */ + id_token?: string; + /** @example st_rt_d7LI9mGYHF2TAaVEFJi7fqOWo8ZQ8zEGpuxhHQs0R18.UZ0nbTuuYuDD8G54PCD8AKHdsh9cezu8BTxVlTy7pYw */ + refresh_token?: string; + /** @example openid offline_access */ + scope?: string; + /** @example bearer */ + token_type?: string; + } + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getOAuth2SessionsLogout: { + parameters: { + query?: { + clientId?: string; + idTokenHint?: string; + postLogoutRedirectUri?: string; + state?: string; + }; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description OAuth2 Sessions Logout Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example {apiDomain}/oauth/logout?... */ + redirectTo?: string; + } + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + introspectOAuth2Token: { + parameters: { + query?: never; + header?: { + /** @example oauth */ + rid?: components["parameters"]["oauthRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + token: string; + }; + }; + }; + responses: { + /** @description OAuth2 Token Introspection Result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + active?: boolean; + /** @example 1740992368 */ + iat?: number; + /** @example 1740995969 */ + exp?: number; + /** @example stcl_fed7cff0-cc6e-406e-b7a6-766148675a4a */ + client_id?: string; + /** @example http://localhost:3001/auth */ + iss?: string; + /** @example 1c229efe-c55b-44c1-98cf-9fa3a366502e */ + jti?: string; + /** @example 1740992368 */ + nbf?: number; + /** @example [ + * "openid", + * "offline_access" + * ] */ + scp?: string[]; + /** @example 137d053d-0d69-4dea-8a19-06ddbdfa4f96 */ + sub?: string; + /** @example 1 */ + stt?: number; + /** @example 87bcc2d8-f159-4e10-a097-0898179a2d7d */ + sessionHandle?: string; + /** @example 137d053d-0d69-4dea-8a19-06ddbdfa4f96 */ + rsub?: string; + /** @example public */ + tId?: string; + /** @example 575b7130-d982-4945-be49-3ecde2a49eaa */ + gid?: string; + /** @example Bearer */ + token_type?: string; + /** @example access_token */ + token_use?: string; + } + | components["schemas"]["oauthError"]; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getBulkImportUsers: { + parameters: { + query?: { + /** @example ZmE3YTA4NDEtY...MjM5MTgwMzIyMzE= */ + paginationToken?: components["parameters"]["paginationToken"]; + /** @example 1 */ + limit?: components["parameters"]["limit"]; + status?: components["parameters"]["bulkImportUserStatus"]; + }; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Paginated Bulk Import Users */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + users?: components["schemas"]["bulkImportUserResponse"][]; + nextPaginationToken?: components["schemas"]["paginationToken"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + addBulkImportUsers: { + parameters: { + query?: never; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + users: components["schemas"]["bulkImportUser"][]; + }; + }; + }; + responses: { + /** @description Bulk Import Users added successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + users?: components["schemas"]["addBulkImportUserResponse"]; + }; + }; + }; + /** @description One or more users have invalid schema */ + 400: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @example Data has missing or invalid fields. Please check the users field for more details. */ + error?: string; + users?: { + /** + * @description Index of the user in the users array that has invalid schema + * @example 0 + */ + index?: number; + errors?: string[]; + }[]; + }; + }; + }; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + deleteBulkImportUsers: { + parameters: { + query?: never; + header?: { + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @description List of bulk import user ids to be deleted */ + ids: components["schemas"]["bulkImportUserId"][]; + }; + }; + }; + responses: { + /** @description Bulk Import Users deleted successfully */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + /** @description List of ids that were successfully deleted */ + deletedIds?: components["schemas"]["bulkImportUserId"][]; + /** + * @description List of ids that were invalid + * @example [] + */ + invalidIds?: components["schemas"]["bulkImportUserId"][]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getWebAuthNCredential: { + parameters: { + query: { + recipeUserId: string; + webauthnCredentialId: string; + }; + header?: { + /** @example webauthn */ + rid?: components["parameters"]["webauthnRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description WebAuthn credential result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + credential?: { + /** @example ea7a0931-b533-4478-9253-0fde890ca23 */ + webauthnCredentialId?: string; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId?: string; + /** @example example.com */ + relyingPartyId?: string; + /** @example 1741793746 */ + createdAt?: number; + /** @example 1741793746 */ + updatedAt?: number; + }; + } + | { + /** @enum {string} */ + status?: "CREDENTIAL_NOT_FOUND_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + listWebAuthNCredentials: { + parameters: { + query: { + recipeUserId: string; + }; + header?: { + /** @example webauthn */ + rid?: components["parameters"]["webauthnRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description WebAuthn credentials list result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + credentials?: { + /** @example ea7a0931-b533-4478-9253-0fde890ca23 */ + webauthnCredentialId?: string; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId?: string; + /** @example example.com */ + relyingPartyId?: string; + /** @example 1741793746 */ + createdAt?: number; + /** @example 1741793746 */ + updatedAt?: number; + }[]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + getWebAuthNOptions: { + parameters: { + query: { + webauthnGeneratedOptionsId: string; + }; + header?: { + /** @example webauthn */ + rid?: components["parameters"]["webauthnRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description WebAuthn options result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status?: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + webauthnGeneratedOptionsId?: string; + /** @example example.com */ + relyingPartyId?: string; + /** @example Example */ + relyingPartyName?: string; + /** @example TQvEVDV8B64w_2zIifzKaPzBPfthqpx2uJkq_2PIB0k */ + challenge?: string; + /** @example 10000 */ + timeout?: number; + /** @example http://example.com */ + origin?: string; + /** @example email@example.com */ + email?: string; + /** @example required */ + userVerification?: string; + /** @example true */ + userPresence?: boolean; + /** @example 1741793746 */ + createdAt?: number; + /** @example 1741793746 */ + expiresAt?: number; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + recoverWebAuthNUser: { + parameters: { + query: { + token: string; + }; + header?: { + /** @example webauthn */ + rid?: components["parameters"]["webauthnRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description AuthRecipeUser for the token */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId?: string; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status?: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + generateRegistrationOptions: { + parameters: { + query?: never; + header?: { + /** @example webauthn */ + rid?: components["parameters"]["webauthnRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + email: components["schemas"]["email"]; + /** @example John Doe */ + displayName?: string; + /** @example example.com */ + relyingPartyId: string; + /** @example Example */ + relyingPartyName: string; + /** @example http://example.com */ + origin: string; + /** @example 10000 */ + timeout?: number; + /** @example preferred */ + userVerification?: string; + /** @example false */ + userPresence?: boolean; + /** @example none */ + attestation?: string; + /** @example required */ + residentKey?: string; + supportedAlgorithmIDs?: number[]; + }; + }; + }; + responses: { + /** @description The generated register options response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + webauthnGeneratedOptionsId?: string; + rp?: { + /** @example example.com */ + id?: string; + /** @example Example */ + name?: string; + }; + user?: { + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + id?: string; + /** @example John Doe */ + name?: string; + /** @example John Doe */ + displayName?: string; + }; + email?: components["schemas"]["email"]; + /** @example TQvEVDV8B64w_2zIifzKaPzBPfthqpx2uJkq_2PIB0k */ + challenge?: string; + /** @example 10000 */ + timeout?: number; + /** @example none */ + attestation?: string; + /** @example 1741793746 */ + createdAt?: number; + /** @example 1741793746 */ + expiresAt?: number; + pubKeyCredParams?: { + /** @example public-key */ + type?: string; + /** @example -7 */ + alg?: number; + }[]; + excludeCredentials?: { + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + id?: string; + transport?: string[]; + }[]; + authenticatorSelection?: { + /** @example preferred */ + userVerification?: string; + /** @example true */ + requireResidentKey?: boolean; + }; + } + | { + /** @enum {string} */ + status?: "INVALID_OPTIONS_ERROR"; + reason?: string; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + generateSigninOptions: { + parameters: { + query?: never; + header?: { + /** @example webauthn */ + rid?: components["parameters"]["webauthnRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example example.com */ + relyingPartyId: string; + /** @example Example */ + relyingPartyName: string; + /** @example http://example.com */ + origin: string; + /** @example 10000 */ + timeout: number; + /** @example preferred */ + userVerification: string; + /** @example false */ + userPresence: boolean; + }; + }; + }; + responses: { + /** @description AuthRecipeUser for the token */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + webauthnGeneratedOptionsId?: string; + /** @example example.com */ + relyingPartyId?: string; + /** @example TQvEVDV8B64w_2zIifzKaPzBPfthqpx2uJkq_2PIB0k */ + challenge?: string; + /** @example 10000 */ + timeout?: number; + /** @example required */ + userVerification?: string; + /** @example true */ + userPresence?: boolean; + /** @example 1741793746 */ + createdAt?: number; + /** @example 1741793746 */ + expiresAt?: number; + } + | { + /** @enum {string} */ + status?: "INVALID_OPTIONS_ERROR"; + reason?: string; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + registerWebAuthNCredential: { + parameters: { + query?: never; + header?: { + /** @example webauthn */ + rid?: components["parameters"]["webauthnRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + recipeUserId?: components["schemas"]["userId"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + webauthnGeneratedOptionsId?: string; + /** @description Credential returned by the browser */ + credential?: Record; + }; + }; + }; + responses: { + /** @description The stored credential */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + webauthnCredentialId?: string; + /** @example example.com */ + relyingPartyId?: string; + /** @example Example */ + relyingPartyName?: string; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId?: string; + email?: components["schemas"]["email"]; + } + | { + /** @enum {string} */ + status?: + | "INVALID_OPTIONS_ERROR" + | "INVALID_AUTHENTICATOR_ERROR" + | "INVALID_CREDENTIALS_ERROR"; + reason?: string; + } + | { + /** @enum {string} */ + status?: + | "OPTIONS_NOT_FOUND_ERROR" + | "CREDENTIAL_ALREADY_EXISTS_ERROR" + | "UNKNOWN_USER_ID_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + signUpWebAuthNUser: { + parameters: { + query?: never; + header?: { + /** @example webauthn */ + rid?: components["parameters"]["webauthnRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + webauthnGeneratedOptionsId?: string; + /** @description Credential returned by the browser */ + credential?: Record; + }; + }; + }; + responses: { + /** @description The signup result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + webauthnCredentialId?: string; + /** @example example.com */ + relyingPartyId?: string; + /** @example Example */ + relyingPartyName?: string; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId?: string; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status?: + | "INVALID_OPTIONS_ERROR" + | "INVALID_AUTHENTICATOR_ERROR" + | "INVALID_CREDENTIALS_ERROR"; + reason?: string; + } + | { + /** @enum {string} */ + status?: "OPTIONS_NOT_FOUND_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + signInWebAuthNUser: { + parameters: { + query?: never; + header?: { + /** @example webauthn */ + rid?: components["parameters"]["webauthnRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + webauthnGeneratedOptionsId?: string; + /** @description Credential returned by the browser */ + credential?: Record; + }; + }; + }; + responses: { + /** @description The stored credential */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId?: string; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status?: + | "INVALID_OPTIONS_ERROR" + | "INVALID_AUTHENTICATOR_ERROR" + | "INVALID_CREDENTIALS_ERROR"; + reason?: string; + } + | { + /** @enum {string} */ + status?: + | "OPTIONS_NOT_FOUND_ERROR" + | "CREDENTIAL_NOT_FOUND_ERROR" + | "UNKNOWN_USER_ID_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + generateTokenForRecovery: { + parameters: { + query?: never; + header?: { + /** @example webauthn */ + rid?: components["parameters"]["webauthnRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + userId: components["schemas"]["userId"]; + email: components["schemas"]["email"]; + }; + }; + }; + responses: { + /** @description WebAuthn options result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + /** @example ZmE3YTA4NDEtYjUzMy00NDc4LTkyNTMtMGZkZTg5MGM1NzY */ + token?: string; + } + | { + /** @enum {string} */ + status?: "UNKNOWN_USER_ID_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + consumeWebAuthNToken: { + parameters: { + query?: never; + header?: { + /** @example webauthn */ + rid?: components["parameters"]["webauthnRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @example ZmE3YTA4NDEtYjUzMy00NDc4LTkyNTMtMGZkZTg5MGM1NzY */ + token: string; + }; + }; + }; + responses: { + /** @description Consume token result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + userId?: components["schemas"]["userId"]; + email?: components["schemas"]["email"]; + } + | { + /** @enum {string} */ + status?: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + updateEmail: { + parameters: { + query?: never; + header?: { + /** @example webauthn */ + rid?: components["parameters"]["webauthnRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + recipeUserId: components["schemas"]["userId"]; + email: components["schemas"]["email"]; + }; + }; + }; + responses: { + /** @description Update email result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + } + | { + /** @enum {string} */ + status?: + | "UNKNOWN_USER_ID_ERROR" + | "EMAIL_ALREADY_EXISTS_ERROR" + | "USER_WITH_EMAIL_ALREADY_EXISTS_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + removeWebAuthNCredential: { + parameters: { + query: { + recipeUserId: string; + webauthnCredentialId: string; + }; + header?: { + /** @example webauthn */ + rid?: components["parameters"]["webauthnRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Delete credential result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + } + | { + /** @enum {string} */ + status?: "CREDENTIAL_NOT_FOUND_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + removeWebAuthNOptions: { + parameters: { + query: { + webauthnGeneratedOptionsId: string; + }; + header?: { + /** @example webauthn */ + rid?: components["parameters"]["webauthnRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Delete options result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": + | { + status?: components["schemas"]["statusOK"]; + } + | { + /** @enum {string} */ + status?: "OPTIONS_NOT_FOUND_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; +} diff --git a/package.json b/package.json index 1bc5a0a41..8376ece46 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,8 @@ "build-pretty": "npm run build && npm run pretty && npm run pretty", "pretty-check": "npx pretty-quick --check .", "set-up-hooks": "cp hooks/pre-commit.sh .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit", - "build-docs": "rm -rf ./docs && npx typedoc --out ./docs --tsconfig ./lib/tsconfig.json ./lib/ts/index.ts ./lib/ts/**/index.ts ./lib/ts/**/*/index.ts" + "build-docs": "rm -rf ./docs && npx typedoc --out ./docs --tsconfig ./lib/tsconfig.json ./lib/ts/index.ts ./lib/ts/**/index.ts ./lib/ts/**/*/index.ts", + "build-core-types": "node scripts/generate-schema.js" }, "keywords": [ "auth", @@ -175,6 +176,7 @@ "next": "^14.0.4", "next-test-api-route-handler": "^3.1.10", "nock": "11.7.0", + "node-fetch": "^3.3.2", "nyc": "^15.1.0", "otpauth": "9.1.5", "prettier": "2.0.5", diff --git a/scripts/generate-schema.js b/scripts/generate-schema.js new file mode 100644 index 000000000..33792c803 --- /dev/null +++ b/scripts/generate-schema.js @@ -0,0 +1,82 @@ +// scripts/generate-schemas.js +const fs = require("fs/promises"); +const path = require("path"); +const { exec } = require("child_process"); + +// Dynamic import for node-fetch because it’s an ESM module +const fetch = (...args) => import("node-fetch").then(({ default: fetch }) => fetch(...args)); + +const coreJsonPath = path.join(__dirname, "..", "coreDriverInterfaceSupported.json"); +const specsDir = path.join(__dirname, "..", "specs"); +const libDir = path.join(__dirname, "..", "lib", "core"); + +const BASE_URL = "https://raw.githubusercontent.com/supertokens/core-driver-interface/refs/heads"; + +async function run() { + const file = await fs.readFile(coreJsonPath, "utf-8"); + const json = JSON.parse(file); + const versions = json.versions; + + console.log("📁 Creating specs directory..."); + await fs.mkdir(specsDir, { recursive: true }); + + try { + for (const version of versions) { + const url = `${BASE_URL}/${version}/api_spec.yaml`; + const specPath = path.join(specsDir, `api_spec_${version}.yaml`); + + console.log(`📥 Downloading: ${url}`); + const res = await fetch(url); + if (!res.ok) { + console.error(`❌ Failed to fetch ${url}: ${res.statusText}`); + continue; + } + + const specContent = await res.text(); + await fs.writeFile(specPath, specContent, "utf-8"); + console.log(`✅ Saved to ${specPath}`); + } + + for (const version of versions) { + const inputPath = path.join(specsDir, `api_spec_${version}.yaml`); + const outputDir = path.join(libDir, version); + const outputPath = path.join(outputDir, "schema.d.ts"); + + await fs.mkdir(outputDir, { recursive: true }); + + console.log(`🔧 Generating schema for version ${version}...`); + await execPromise(`npx openapi-typescript ${inputPath} -o ${outputPath}`); + + // Post-process: remove `/appid-/` + console.log(`🧹 Cleaning appid from ${outputPath}`); + let schemaContent = await fs.readFile(outputPath, "utf-8"); + schemaContent = schemaContent.replace(/\/appid-[^/]+/g, ""); + await fs.writeFile(outputPath, schemaContent, "utf-8"); + console.log(`✅ Cleaned ${outputPath}`); + } + } finally { + console.log("🧹 Cleaning up specs directory..."); + await fs.rm(specsDir, { recursive: true, force: true }); + console.log("✅ Specs directory deleted."); + } + + console.log("🎉 All done!"); +} + +function execPromise(command) { + return new Promise((resolve, reject) => { + exec(command, (err, stdout, stderr) => { + if (err) { + console.error(`Error: ${stderr}`); + reject(err); + } else { + resolve(stdout); + } + }); + }); +} + +run().catch((err) => { + console.error("Unhandled error:", err); + process.exit(1); +}); From 4416c46f95d88bf752161b09c6e713d77406d0ef Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Tue, 29 Apr 2025 14:08:31 +0530 Subject: [PATCH 21/64] Add type definitions for inferring response body and request body from schema --- lib/core/paths.ts | 29 +++++++++++++++++++++++++ lib/core/types.ts | 27 +++++++++++++++++++++++ lib/core/{ => versions}/5.3/schema.d.ts | 0 scripts/generate-schema.js | 2 +- 4 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 lib/core/paths.ts create mode 100644 lib/core/types.ts rename lib/core/{ => versions}/5.3/schema.d.ts (100%) diff --git a/lib/core/paths.ts b/lib/core/paths.ts new file mode 100644 index 000000000..b7f4883fd --- /dev/null +++ b/lib/core/paths.ts @@ -0,0 +1,29 @@ +import { paths as pathsV5_3 } from "./versions/5.3/schema"; + +// NOTE: Uncomment the following code if there +// are more than one CDI versions being used. +// E.g. usage: export type paths = MergePaths; + +// type MergePaths = { +// [K in keyof P1 | keyof P2]: +// K extends keyof P1 +// ? K extends keyof P2 +// ? MergeMethods +// : P1[K] +// : K extends keyof P2 +// ? P2[K] +// : never; +// }; + +// type MergeMethods = { +// [K in keyof M1 | keyof M2]: +// K extends keyof M1 +// ? K extends keyof M2 +// ? M1[K] | M2[K] +// : M1[K] +// : K extends keyof M2 +// ? M2[K] +// : never; +// }; + +export type paths = pathsV5_3; diff --git a/lib/core/types.ts b/lib/core/types.ts new file mode 100644 index 000000000..c7c236fb3 --- /dev/null +++ b/lib/core/types.ts @@ -0,0 +1,27 @@ +/** + * This file contains the types for providing automatic type inference + * for core related method calls that is generated from the OpenAPI spec. + * + * This file is not needed for the core driver interface to work, but it is + * useful for providing type inference for the core related method calls. + */ + +import { paths } from "./paths"; + +export type Method = "get" | "post" | "put" | "delete" | "patch"; + +export type ExtractMethodType

= M extends keyof paths[P] ? paths[P][M] : never; + +export type RequestBody

= ExtractMethodType extends { + requestBody?: infer ReqBody; +} + ? ReqBody extends { content: { "application/json": infer R } } + ? R | undefined + : undefined + : undefined; + +export type ResponseBody

= ExtractMethodType extends { + responses: { 200: { content: { "application/json": infer R } } }; +} + ? R + : unknown; diff --git a/lib/core/5.3/schema.d.ts b/lib/core/versions/5.3/schema.d.ts similarity index 100% rename from lib/core/5.3/schema.d.ts rename to lib/core/versions/5.3/schema.d.ts diff --git a/scripts/generate-schema.js b/scripts/generate-schema.js index 33792c803..9f6911c0f 100644 --- a/scripts/generate-schema.js +++ b/scripts/generate-schema.js @@ -8,7 +8,7 @@ const fetch = (...args) => import("node-fetch").then(({ default: fetch }) => fet const coreJsonPath = path.join(__dirname, "..", "coreDriverInterfaceSupported.json"); const specsDir = path.join(__dirname, "..", "specs"); -const libDir = path.join(__dirname, "..", "lib", "core"); +const libDir = path.join(__dirname, "..", "lib", "core", "versions"); const BASE_URL = "https://raw.githubusercontent.com/supertokens/core-driver-interface/refs/heads"; From 49f2e0e8d42d9a806329de872c454999bea3a0cc Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Wed, 30 Apr 2025 14:43:57 +0530 Subject: [PATCH 22/64] Refactor querier to use inferred types in network methods --- lib/core/types.ts | 73 ++++++++++++++++++++------ lib/ts/querier.ts | 117 ++++++++++++++++++++++++++---------------- lib/ts/supertokens.ts | 51 +++++++++--------- 3 files changed, 159 insertions(+), 82 deletions(-) diff --git a/lib/core/types.ts b/lib/core/types.ts index c7c236fb3..aad43e9df 100644 --- a/lib/core/types.ts +++ b/lib/core/types.ts @@ -10,18 +10,61 @@ import { paths } from "./paths"; export type Method = "get" | "post" | "put" | "delete" | "patch"; -export type ExtractMethodType

= M extends keyof paths[P] ? paths[P][M] : never; - -export type RequestBody

= ExtractMethodType extends { - requestBody?: infer ReqBody; -} - ? ReqBody extends { content: { "application/json": infer R } } - ? R | undefined - : undefined - : undefined; - -export type ResponseBody

= ExtractMethodType extends { - responses: { 200: { content: { "application/json": infer R } } }; -} - ? R - : unknown; +// Type to extract the method type from the paths object +type ExtractMethodTypeWithUndefined

= M extends keyof paths[P] + ? paths[P][M] + : never; +export type ExtractMethodType

= Exclude< + ExtractMethodTypeWithUndefined, + undefined +>; + +// Type to ensure that the `status` is a required field instead of +// it being optional. We should use this until the spec is not updated. +// TODO: Remove if we decide to go ahead with MakeAllRequired +// type MakeStatusRequired = T extends { status?: infer S } +// ? Omit & { status: S } +// : T; + +// Type to make all fields required. This should be used only if +// it is absolutely guaranteed that the fields are not optional. +type MakeAllRequired = { + [K in keyof T]-?: NonNullable; +}; + +// Wrapper around MakeAllRequired to ensure that it is applied recursively +// to all unions. +type DeepRequireAllFields = T extends any ? MakeAllRequired : never; + +// Type to extract the request body from the method type +export type RequestBody

= + ExtractMethodType extends { + requestBody?: infer ReqBody; + } + ? ReqBody extends { content: { "application/json": infer R } } + ? R | undefined + : undefined + : undefined; + +// Type to extract the response body from the method type +export type UncleanedResponseBody

= + ExtractMethodType extends { + responses: { 200: { content: { "application/json": infer R } } }; + } + ? R + : unknown; + +// Type to clean the response body from the method type +export type ResponseBody

= DeepRequireAllFields>; + +// Type to extract the path parameters from the method type +// and enforce them through inference +type ExtractPathParams = T extends `${string}<${infer Param}>${infer Rest}` + ? Param | ExtractPathParams + : never; + +type PathParamsObject = + ExtractPathParams extends never ? undefined : { [K in ExtractPathParams]: string }; + +// Type to handle the path parameter +export type PathParam

= P | { path: P; params: PathParamsObject

}; diff --git a/lib/ts/querier.ts b/lib/ts/querier.ts index 4d1263e36..b1f3b18fd 100644 --- a/lib/ts/querier.ts +++ b/lib/ts/querier.ts @@ -23,6 +23,9 @@ import { UserContext } from "./types"; import { NetworkInterceptor } from "./types"; import SuperTokens from "./supertokens"; +import { PathParam, RequestBody, ResponseBody } from "../core/types"; +import { paths } from "../core/paths"; + export class Querier { private static initCalled = false; private static hosts: { domain: NormalisedURLDomain; basePath: NormalisedURLPath }[] | undefined = undefined; @@ -43,7 +46,7 @@ export class Querier { // to support multiple rIds per API private constructor( hosts: { domain: NormalisedURLDomain; basePath: NormalisedURLPath }[] | undefined, - rIdToCore?: string + rIdToCore?: string, ) { this.__hosts = hosts; this.rIdToCore = rIdToCore; @@ -86,7 +89,7 @@ export class Querier { headers: headers, params: queryParamsObj, }, - userContext + userContext, ); url = request.url; headers = request.headers; @@ -98,13 +101,13 @@ export class Querier { }); return response; }, - this.__hosts?.length || 0 + this.__hosts?.length || 0, ); let cdiSupportedByServer: string[] = response.versions; let supportedVersion = getLargestVersionFromIntersection(cdiSupportedByServer, cdiSupported); if (supportedVersion === undefined) { throw Error( - "The running SuperTokens core version is not compatible with this NodeJS SDK. Please visit https://supertokens.io/docs/community/compatibility to find the right versions" + "The running SuperTokens core version is not compatible with this NodeJS SDK. Please visit https://supertokens.io/docs/community/compatibility to find the right versions", ); } Querier.apiVersion = supportedVersion; @@ -137,7 +140,7 @@ export class Querier { hosts?: { domain: NormalisedURLDomain; basePath: NormalisedURLPath }[], apiKey?: string, networkInterceptor?: NetworkInterceptor, - disableCache?: boolean + disableCache?: boolean, ) { if (!Querier.initCalled) { logDebugMessage("querier initialized"); @@ -152,9 +155,26 @@ export class Querier { } } + private getPath =

(path: PathParam

): NormalisedURLPath => { + const template = typeof path === "string" ? path : path.path; + const params = typeof path === "string" ? {} : (path.params ?? {}); + + let populated = String(template); + for (const [key, value] of Object.entries(params)) { + populated = populated.replace(new RegExp(`<${key}>\\b`, "g"), String(value)); + } + + return new NormalisedURLPath(populated); + }; + // path should start with "/" - sendPostRequest = async (path: NormalisedURLPath, body: any, userContext: UserContext): Promise => { + sendPostRequest = async

( + template: PathParam

, + body: RequestBody, + userContext: UserContext, + ): Promise> => { this.invalidateCoreCallCache(userContext); + const path = this.getPath(template); const { body: respBody } = await this.sendRequestHelper( path, @@ -186,7 +206,7 @@ export class Querier { headers: headers, body: body, }, - userContext + userContext, ); url = request.url; headers = request.headers; @@ -200,19 +220,20 @@ export class Querier { headers, }); }, - this.__hosts?.length || 0 + this.__hosts?.length || 0, ); return respBody; }; // path should start with "/" - sendDeleteRequest = async ( - path: NormalisedURLPath, - body: any, + sendDeleteRequest = async

( + template: PathParam

, + body: RequestBody, params: any | undefined, - userContext: UserContext - ): Promise => { + userContext: UserContext, + ): Promise> => { this.invalidateCoreCallCache(userContext); + const path = this.getPath(template); const { body: respBody } = await this.sendRequestHelper( path, @@ -241,7 +262,7 @@ export class Querier { params: params, body: body, }, - userContext + userContext, ); url = request.url; headers = request.headers; @@ -263,17 +284,18 @@ export class Querier { headers, }); }, - this.__hosts?.length || 0 + this.__hosts?.length || 0, ); return respBody; }; // path should start with "/" - sendGetRequest = async ( - path: NormalisedURLPath, + sendGetRequest = async

( + template: PathParam

, params: Record, - userContext: UserContext - ): Promise => { + userContext: UserContext, + ): Promise> => { + const path = this.getPath(template); const { body: respBody } = await this.sendRequestHelper( path, "GET", @@ -335,7 +357,7 @@ export class Querier { headers: headers, params: params, }, - userContext + userContext, ); url = request.url; headers = request.headers; @@ -345,7 +367,7 @@ export class Querier { } const finalURL = new URL(url); const searchParams = new URLSearchParams( - Object.entries(params).filter(([_, value]) => value !== undefined) as string[][] + Object.entries(params).filter(([_, value]) => value !== undefined) as string[][], ); finalURL.search = searchParams.toString(); @@ -374,18 +396,19 @@ export class Querier { return response; }, - this.__hosts?.length || 0 + this.__hosts?.length || 0, ); return respBody; }; - sendGetRequestWithResponseHeaders = async ( - path: NormalisedURLPath, + sendGetRequestWithResponseHeaders = async

( + template: PathParam

, params: Record, inpHeaders: Record | undefined, - userContext: UserContext - ): Promise<{ body: any; headers: Headers }> => { + userContext: UserContext, + ): Promise<{ body: ResponseBody; headers: Headers }> => { + const path = this.getPath(template); return await this.sendRequestHelper( path, "GET", @@ -414,7 +437,7 @@ export class Querier { headers: headers, params: params, }, - userContext + userContext, ); url = request.url; headers = request.headers; @@ -424,7 +447,7 @@ export class Querier { } const finalURL = new URL(url); const searchParams = new URLSearchParams( - Object.entries(params).filter(([_, value]) => value !== undefined) as string[][] + Object.entries(params).filter(([_, value]) => value !== undefined) as string[][], ); finalURL.search = searchParams.toString(); return doFetch(finalURL.toString(), { @@ -432,18 +455,19 @@ export class Querier { headers, }); }, - this.__hosts?.length || 0 + this.__hosts?.length || 0, ); }; // path should start with "/" - sendPutRequest = async ( - path: NormalisedURLPath, - body: any, + sendPutRequest = async

( + template: PathParam

, + body: RequestBody, params: Record, - userContext: UserContext - ): Promise => { + userContext: UserContext, + ): Promise> => { this.invalidateCoreCallCache(userContext); + const path = this.getPath(template); const { body: respBody } = await this.sendRequestHelper( path, @@ -472,7 +496,7 @@ export class Querier { body: body, params: params, }, - userContext + userContext, ); url = request.url; headers = request.headers; @@ -483,7 +507,7 @@ export class Querier { const finalURL = new URL(url); const searchParams = new URLSearchParams( - Object.entries(params).filter(([_, value]) => value !== undefined) as string[][] + Object.entries(params).filter(([_, value]) => value !== undefined) as string[][], ); finalURL.search = searchParams.toString(); @@ -493,14 +517,19 @@ export class Querier { headers, }); }, - this.__hosts?.length || 0 + this.__hosts?.length || 0, ); return respBody; }; // path should start with "/" - sendPatchRequest = async (path: NormalisedURLPath, body: any, userContext: UserContext): Promise => { + sendPatchRequest = async

( + template: PathParam

, + body: RequestBody, + userContext: UserContext, + ): Promise> => { this.invalidateCoreCallCache(userContext); + const path = this.getPath(template); const { body: respBody } = await this.sendRequestHelper( path, @@ -528,7 +557,7 @@ export class Querier { headers: headers, body: body, }, - userContext + userContext, ); url = request.url; headers = request.headers; @@ -543,7 +572,7 @@ export class Querier { headers, }); }, - this.__hosts?.length || 0 + this.__hosts?.length || 0, ); return respBody; }; @@ -580,11 +609,11 @@ export class Querier { method: string, requestFunc: (url: string) => Promise, numberOfTries: number, - retryInfoMap?: Record + retryInfoMap?: Record, ): Promise => { if (this.__hosts === undefined) { throw Error( - "No SuperTokens core available to query. Please pass supertokens > connectionURI to the init function, or override all the functions of the recipe you are using." + "No SuperTokens core available to query. Please pass supertokens > connectionURI to the init function, or override all the functions of the recipe you are using.", ); } if (numberOfTries === 0) { @@ -623,7 +652,7 @@ export class Querier { return { body: await response.clone().text(), headers: response.headers }; } return { body: await response.clone().json(), headers: response.headers }; - } catch (err) { + } catch (err: any) { if ( err.message !== undefined && (err.message.includes("Failed to fetch") || @@ -658,7 +687,7 @@ export class Querier { "' with status code: " + err.status + " and message: " + - (await err.text()) + (await err.text()), ); } diff --git a/lib/ts/supertokens.ts b/lib/ts/supertokens.ts index 145266186..1bb8de28d 100644 --- a/lib/ts/supertokens.ts +++ b/lib/ts/supertokens.ts @@ -59,14 +59,14 @@ export default class SuperTokens { config.appInfo.origin === undefined ? undefined : typeof config.appInfo.origin === "string" - ? config.appInfo.origin - : "function"; + ? config.appInfo.origin + : "function"; logDebugMessage( "appInfo: " + JSON.stringify({ ...config.appInfo, origin: originToPrint, - }) + }), ); this.framework = config.framework !== undefined ? config.framework : "express"; @@ -86,7 +86,7 @@ export default class SuperTokens { }), config.supertokens?.apiKey, config.supertokens?.networkInterceptor, - config.supertokens?.disableCoreCallCache + config.supertokens?.disableCoreCallCache, ); if (config.recipeList === undefined || config.recipeList.length === 0) { throw new Error("Please provide at least one recipe to the supertokens.init function call"); @@ -209,7 +209,7 @@ export default class SuperTokens { response: BaseResponse, path: NormalisedURLPath, method: HTTPMethod, - userContext: UserContext + userContext: UserContext, ) => { return await matchedRecipe.handleAPIRequest(id, tenantId, request, response, path, method, userContext); }; @@ -230,13 +230,13 @@ export default class SuperTokens { getUserCount = async ( includeRecipeIds: string[] | undefined, tenantId: string | undefined, - userContext: UserContext + userContext: UserContext, ): Promise => { let querier = Querier.getNewInstanceOrThrowError(undefined); let apiVersion = await querier.getAPIVersion(userContext); if (maxVersion(apiVersion, "2.7") === "2.7") { throw new Error( - "Please use core version >= 3.5 to call this function. Otherwise, you can call .getUserCount() instead (for example, EmailPassword.getUserCount())" + "Please use core version >= 3.5 to call this function. Otherwise, you can call .getUserCount() instead (for example, EmailPassword.getUserCount())", ); } let includeRecipeIdsStr = undefined; @@ -245,12 +245,17 @@ export default class SuperTokens { } let response = await querier.sendGetRequest( - new NormalisedURLPath(`/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/users/count`), + { + path: "//users/count", + params: { + tenantId: tenantId === undefined ? DEFAULT_TENANT_ID : tenantId, + }, + }, { includeRecipeIds: includeRecipeIdsStr, includeAllTenants: tenantId === undefined, }, - userContext + userContext, ); return Number(response.count); }; @@ -276,14 +281,14 @@ export default class SuperTokens { if (maxVersion("2.15", cdiVersion) === cdiVersion) { // create userId mapping is only available >= CDI 2.15 return await querier.sendPostRequest( - new NormalisedURLPath("/recipe/userid/map"), + "/recipe/userid/map", { superTokensUserId: input.superTokensUserId, externalUserId: input.externalUserId, externalUserIdInfo: input.externalUserIdInfo, force: input.force, }, - input.userContext + input.userContext, ); } else { throw new global.Error("Please upgrade the SuperTokens core to >= 3.15.0"); @@ -310,12 +315,12 @@ export default class SuperTokens { if (maxVersion("2.15", cdiVersion) === cdiVersion) { // create userId mapping is only available >= CDI 2.15 let response = await querier.sendGetRequest( - new NormalisedURLPath("/recipe/userid/map"), + "/recipe/userid/map", { userId: input.userId, userIdType: input.userIdType, }, - input.userContext + input.userContext, ); return response; } else { @@ -336,13 +341,13 @@ export default class SuperTokens { let cdiVersion = await querier.getAPIVersion(input.userContext); if (maxVersion("2.15", cdiVersion) === cdiVersion) { return await querier.sendPostRequest( - new NormalisedURLPath("/recipe/userid/map/remove"), + "/recipe/userid/map/remove", { userId: input.userId, userIdType: input.userIdType, force: input.force, }, - input.userContext + input.userContext, ); } else { throw new global.Error("Please upgrade the SuperTokens core to >= 3.15.0"); @@ -361,14 +366,14 @@ export default class SuperTokens { let cdiVersion = await querier.getAPIVersion(input.userContext); if (maxVersion("2.15", cdiVersion) === cdiVersion) { return await querier.sendPutRequest( - new NormalisedURLPath("/recipe/userid/external-user-id-info"), + "/recipe/userid/external-user-id-info", { userId: input.userId, userIdType: input.userIdType, - externalUserIdInfo: input.externalUserIdInfo, + externalUserIdInfo: input.externalUserIdInfo || null, }, {}, - input.userContext + input.userContext, ); } else { throw new global.Error("Please upgrade the SuperTokens core to >= 3.15.0"); @@ -384,7 +389,7 @@ export default class SuperTokens { if (!path.startsWith(this.appInfo.apiBasePath)) { logDebugMessage( "middleware: Not handling because request path did not start with config path. Request path: " + - path.getAsStringDangerous() + path.getAsStringDangerous(), ); return false; } @@ -411,7 +416,7 @@ export default class SuperTokens { " with path: " + path.getAsStringDangerous() + " and method: " + - method + method, ); let idResult = await recipeModules[i].returnAPIIdIfCanHandleRequest(path, method, userContext); if (idResult !== undefined) { @@ -440,7 +445,7 @@ export default class SuperTokens { response, path, method, - userContext + userContext, ); if (!requestHandled) { logDebugMessage("middleware: Not handled because API returned requestHandled as false"); @@ -512,7 +517,7 @@ export default class SuperTokens { idResult = currIdResult; } else { throw new Error( - "Two recipes have matched the same API path and method! This is a bug in the SDK. Please contact support." + "Two recipes have matched the same API path and method! This is a bug in the SDK. Please contact support.", ); } } @@ -531,7 +536,7 @@ export default class SuperTokens { response, path, method, - userContext + userContext, ); if (!requestHandled) { logDebugMessage("middleware: Not handled because API returned requestHandled as false"); From 8d1c655346461f958b3b3d52e06fc878e0411167 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Wed, 30 Apr 2025 15:28:35 +0530 Subject: [PATCH 23/64] Update all querier references to avoid usage of NormalisedURLPath --- .../accountlinking/recipeImplementation.ts | 126 ++++++++++-------- lib/ts/recipe/dashboard/api/analytics.ts | 2 +- .../api/multitenancy/getTenantInfo.ts | 7 +- lib/ts/recipe/dashboard/api/search/tagsGet.ts | 3 +- lib/ts/recipe/dashboard/api/signIn.ts | 4 +- lib/ts/recipe/dashboard/api/signOut.ts | 5 +- .../recipe/dashboard/recipeImplementation.ts | 2 +- .../emailpassword/recipeImplementation.ts | 37 +++-- .../emailverification/recipeImplementation.ts | 25 +++- lib/ts/recipe/jwt/recipeImplementation.ts | 4 +- .../multitenancy/recipeImplementation.ts | 54 +++++--- .../oauth2provider/recipeImplementation.ts | 43 +++--- .../passwordless/recipeImplementation.ts | 72 ++++++++-- lib/ts/recipe/session/recipeImplementation.ts | 2 +- lib/ts/recipe/session/sessionFunctions.ts | 54 ++++++-- .../recipe/thirdparty/recipeImplementation.ts | 7 +- lib/ts/recipe/totp/recipeImplementation.ts | 22 ++- .../usermetadata/recipeImplementation.ts | 6 +- .../recipe/userroles/recipeImplementation.ts | 42 ++++-- .../recipe/webauthn/recipeImplementation.ts | 102 +++++++++----- 20 files changed, 406 insertions(+), 213 deletions(-) diff --git a/lib/ts/recipe/accountlinking/recipeImplementation.ts b/lib/ts/recipe/accountlinking/recipeImplementation.ts index 79b4357ce..2655d1096 100644 --- a/lib/ts/recipe/accountlinking/recipeImplementation.ts +++ b/lib/ts/recipe/accountlinking/recipeImplementation.ts @@ -55,7 +55,12 @@ export default function getRecipeImplementation( includeRecipeIdsStr = includeRecipeIds.join(","); } let response = await querier.sendGetRequest( - new NormalisedURLPath(`${tenantId ?? "public"}/users`), + { + path: "//users", + params: { + tenantId: tenantId ?? "public", + }, + }, { includeRecipeIds: includeRecipeIdsStr, timeJoinedOrder: timeJoinedOrder, @@ -81,19 +86,19 @@ export default function getRecipeImplementation( } ): Promise< | { - status: "OK"; - wasAlreadyAPrimaryUser: boolean; - } + status: "OK"; + wasAlreadyAPrimaryUser: boolean; + } | { - status: - | "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR" - | "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - primaryUserId: string; - description: string; - } + status: + | "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR" + | "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + primaryUserId: string; + description: string; + } > { return await querier.sendGetRequest( - new NormalisedURLPath("/recipe/accountlinking/user/primary/check"), + "/recipe/accountlinking/user/primary/check", { recipeUserId: recipeUserId.getAsString(), }, @@ -112,22 +117,22 @@ export default function getRecipeImplementation( } ): Promise< | { - status: "OK"; - user: User; - wasAlreadyAPrimaryUser: boolean; - } + status: "OK"; + user: User; + wasAlreadyAPrimaryUser: boolean; + } | { - status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; - primaryUserId: string; - } + status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; + primaryUserId: string; + } | { - status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - primaryUserId: string; - description: string; - } + status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + primaryUserId: string; + description: string; + } > { let response = await querier.sendPostRequest( - new NormalisedURLPath("/recipe/accountlinking/user/primary"), + "/recipe/accountlinking/user/primary", { recipeUserId: recipeUserId.getAsString(), }, @@ -152,25 +157,25 @@ export default function getRecipeImplementation( } ): Promise< | { - status: "OK"; - accountsAlreadyLinked: boolean; - } + status: "OK"; + accountsAlreadyLinked: boolean; + } | { - status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - description: string; - primaryUserId: string; - } + status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + description: string; + primaryUserId: string; + } | { - status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - primaryUserId: string; - description: string; - } + status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + primaryUserId: string; + description: string; + } | { - status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; - } + status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; + } > { let result = await querier.sendGetRequest( - new NormalisedURLPath("/recipe/accountlinking/user/link/check"), + ("/recipe/accountlinking/user/link/check"), { recipeUserId: recipeUserId.getAsString(), primaryUserId, @@ -194,26 +199,26 @@ export default function getRecipeImplementation( } ): Promise< | { - status: "OK"; - accountsAlreadyLinked: boolean; - user: User; - } + status: "OK"; + accountsAlreadyLinked: boolean; + user: User; + } | { - status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - user: User; - primaryUserId: string; - } + status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + user: User; + primaryUserId: string; + } | { - status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - primaryUserId: string; - description: string; - } + status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + primaryUserId: string; + description: string; + } | { - status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; - } + status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; + } > { const accountsLinkingResult = await querier.sendPostRequest( - new NormalisedURLPath("/recipe/accountlinking/user/link"), + "/recipe/accountlinking/user/link", { recipeUserId: recipeUserId.getAsString(), primaryUserId, @@ -221,6 +226,10 @@ export default function getRecipeImplementation( userContext ); + if (accountsLinkingResult.status === "OK") { + accountsLinkingResult.user = new User(accountsLinkingResult.user); + } + if ( ["OK", "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"].includes( accountsLinkingResult.status @@ -276,7 +285,7 @@ export default function getRecipeImplementation( wasLinked: boolean; }> { let accountsUnlinkingResult = await querier.sendPostRequest( - new NormalisedURLPath("/recipe/accountlinking/user/unlink"), + "/recipe/accountlinking/user/unlink", { recipeUserId: recipeUserId.getAsString(), }, @@ -287,7 +296,7 @@ export default function getRecipeImplementation( getUser: async function (this: RecipeInterface, { userId, userContext }): Promise { let result = await querier.sendGetRequest( - new NormalisedURLPath("/user/id"), + "/user/id", { userId, }, @@ -314,7 +323,12 @@ export default function getRecipeImplementation( } ): Promise { let result = await querier.sendGetRequest( - new NormalisedURLPath(`${tenantId ?? "public"}/users/by-accountinfo`), + { + path: "//users/by-accountinfo", + params: { + tenantId: tenantId ?? "public", + }, + }, { email: accountInfo.email, phoneNumber: accountInfo.phoneNumber, @@ -343,7 +357,7 @@ export default function getRecipeImplementation( status: "OK"; }> { return await querier.sendPostRequest( - new NormalisedURLPath("/user/remove"), + ("/user/remove"), { userId, removeAllLinkedAccounts, diff --git a/lib/ts/recipe/dashboard/api/analytics.ts b/lib/ts/recipe/dashboard/api/analytics.ts index c7830273d..4ceb3a928 100644 --- a/lib/ts/recipe/dashboard/api/analytics.ts +++ b/lib/ts/recipe/dashboard/api/analytics.ts @@ -59,7 +59,7 @@ export default async function analyticsPost( let numberOfUsers: number; try { let querier = Querier.getNewInstanceOrThrowError(options.recipeId); - let response = await querier.sendGetRequest(new NormalisedURLPath("/telemetry"), {}, userContext); + let response = await querier.sendGetRequest("/telemetry", {}, userContext); if (response.exists) { telemetryId = response.telemetryId; } diff --git a/lib/ts/recipe/dashboard/api/multitenancy/getTenantInfo.ts b/lib/ts/recipe/dashboard/api/multitenancy/getTenantInfo.ts index c03a04093..84258fc5b 100644 --- a/lib/ts/recipe/dashboard/api/multitenancy/getTenantInfo.ts +++ b/lib/ts/recipe/dashboard/api/multitenancy/getTenantInfo.ts @@ -82,7 +82,12 @@ export default async function getTenantInfo( let querier = Querier.getNewInstanceOrThrowError(options.recipeId); let coreConfig = await querier.sendGetRequest( - new NormalisedURLPath(`/${tenantId}/recipe/dashboard/tenant/core-config`), + { + path: "//recipe/dashboard/tenant/core-config", + params: { + tenantId, + }, + }, {}, userContext ); diff --git a/lib/ts/recipe/dashboard/api/search/tagsGet.ts b/lib/ts/recipe/dashboard/api/search/tagsGet.ts index 8d380c109..420b39654 100644 --- a/lib/ts/recipe/dashboard/api/search/tagsGet.ts +++ b/lib/ts/recipe/dashboard/api/search/tagsGet.ts @@ -15,7 +15,6 @@ import { APIInterface, APIOptions } from "../../types"; import { Querier } from "../../../../querier"; -import NormalisedURLPath from "../../../../normalisedURLPath"; import { UserContext } from "../../../../types"; type TagsResponse = { status: "OK"; tags: string[] }; @@ -27,6 +26,6 @@ export const getSearchTags = async ( userContext: UserContext ): Promise => { let querier = Querier.getNewInstanceOrThrowError(options.recipeId); - let tagsResponse = await querier.sendGetRequest(new NormalisedURLPath("/user/search/tags"), {}, userContext); + let tagsResponse = await querier.sendGetRequest("/user/search/tags", {}, userContext); return tagsResponse; }; diff --git a/lib/ts/recipe/dashboard/api/signIn.ts b/lib/ts/recipe/dashboard/api/signIn.ts index 96df122c3..dcc193325 100644 --- a/lib/ts/recipe/dashboard/api/signIn.ts +++ b/lib/ts/recipe/dashboard/api/signIn.ts @@ -43,8 +43,8 @@ export default async function signIn(_: APIInterface, options: APIOptions, userC } let querier = Querier.getNewInstanceOrThrowError(undefined); - const signInResponse = await querier.sendPostRequest( - new NormalisedURLPath("/recipe/dashboard/signin"), + const signInResponse = await querier.sendPostRequest( + "/recipe/dashboard/signin", { email, password, diff --git a/lib/ts/recipe/dashboard/api/signOut.ts b/lib/ts/recipe/dashboard/api/signOut.ts index 12128d166..7dc199d16 100644 --- a/lib/ts/recipe/dashboard/api/signOut.ts +++ b/lib/ts/recipe/dashboard/api/signOut.ts @@ -16,7 +16,6 @@ import { APIInterface, APIOptions } from "../types"; import { send200Response } from "../../../utils"; import { Querier } from "../../../querier"; -import NormalisedURLPath from "../../../normalisedURLPath"; import { UserContext } from "../../../types"; export default async function signOut( @@ -31,8 +30,8 @@ export default async function signOut( const sessionIdFormAuthHeader = options.req.getHeaderValue("authorization")?.split(" ")[1]; let querier = Querier.getNewInstanceOrThrowError(undefined); const sessionDeleteResponse = await querier.sendDeleteRequest( - new NormalisedURLPath("/recipe/dashboard/session"), - {}, + "/recipe/dashboard/session", + undefined, { sessionId: sessionIdFormAuthHeader }, userContext ); diff --git a/lib/ts/recipe/dashboard/recipeImplementation.ts b/lib/ts/recipe/dashboard/recipeImplementation.ts index 446c2047c..155b7c973 100644 --- a/lib/ts/recipe/dashboard/recipeImplementation.ts +++ b/lib/ts/recipe/dashboard/recipeImplementation.ts @@ -35,7 +35,7 @@ export default function getRecipeImplementation(): RecipeInterface { let querier = Querier.getNewInstanceOrThrowError(undefined); const authHeaderValue = input.req.getHeaderValue("authorization")?.split(" ")[1]; const sessionVerificationResponse = await querier.sendPostRequest( - new NormalisedURLPath("/recipe/dashboard/session/verify"), + "/recipe/dashboard/session/verify", { sessionId: authHeaderValue, }, diff --git a/lib/ts/recipe/emailpassword/recipeImplementation.ts b/lib/ts/recipe/emailpassword/recipeImplementation.ts index 1c883021c..082f83437 100644 --- a/lib/ts/recipe/emailpassword/recipeImplementation.ts +++ b/lib/ts/recipe/emailpassword/recipeImplementation.ts @@ -82,9 +82,12 @@ export default function getRecipeInterface( | { status: "EMAIL_ALREADY_EXISTS_ERROR" } > { const resp = await querier.sendPostRequest( - new NormalisedURLPath( - `/${input.tenantId === undefined ? DEFAULT_TENANT_ID : input.tenantId}/recipe/signup` - ), + { + path: "//recipe/signup", + params: { + tenantId: input.tenantId === undefined ? DEFAULT_TENANT_ID : input.tenantId, + }, + }, { email: input.email, password: input.password, @@ -168,7 +171,12 @@ export default function getRecipeInterface( | { status: "WRONG_CREDENTIALS_ERROR" } > { const response = await querier.sendPostRequest( - new NormalisedURLPath(`/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/signin`), + { + path: "//recipe/signin", + params: { + tenantId: tenantId === undefined ? DEFAULT_TENANT_ID : tenantId, + }, + }, { email, password, @@ -202,9 +210,12 @@ export default function getRecipeInterface( }): Promise<{ status: "OK"; token: string } | { status: "UNKNOWN_USER_ID_ERROR" }> { // the input user ID can be a recipe or a primary user ID. return await querier.sendPostRequest( - new NormalisedURLPath( - `/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/user/password/reset/token` - ), + { + path: "//recipe/user/password/reset/token", + params: { + tenantId: tenantId === undefined ? DEFAULT_TENANT_ID : tenantId, + }, + }, { userId, email, @@ -230,11 +241,13 @@ export default function getRecipeInterface( | { status: "RESET_PASSWORD_INVALID_TOKEN_ERROR" } > { return await querier.sendPostRequest( - new NormalisedURLPath( - `/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/user/password/reset/token/consume` - ), { - method: "token", + path: "//recipe/user/password/reset/token/consume", + params: { + tenantId: tenantId === undefined ? DEFAULT_TENANT_ID : tenantId, + }, + }, + { token, }, userContext @@ -319,7 +332,7 @@ export default function getRecipeInterface( // an update email API (post login update). let response = await querier.sendPutRequest( - new NormalisedURLPath(`/recipe/user`), + "/recipe/user", { recipeUserId: input.recipeUserId.getAsString(), email: input.email, diff --git a/lib/ts/recipe/emailverification/recipeImplementation.ts b/lib/ts/recipe/emailverification/recipeImplementation.ts index b597aef0e..abaf99bd1 100644 --- a/lib/ts/recipe/emailverification/recipeImplementation.ts +++ b/lib/ts/recipe/emailverification/recipeImplementation.ts @@ -30,7 +30,12 @@ export default function getRecipeInterface( | { status: "EMAIL_ALREADY_VERIFIED_ERROR" } > { let response = await querier.sendPostRequest( - new NormalisedURLPath(`/${tenantId}/recipe/user/email/verify/token`), + { + path: "//recipe/user/email/verify/token", + params: { + tenantId, + }, + }, { userId: recipeUserId.getAsString(), email, @@ -56,7 +61,12 @@ export default function getRecipeInterface( userContext, }): Promise<{ status: "OK"; user: UserEmailInfo } | { status: "EMAIL_VERIFICATION_INVALID_TOKEN_ERROR" }> { let response = await querier.sendPostRequest( - new NormalisedURLPath(`/${tenantId}/recipe/user/email/verify`), + { + path: "//recipe/user/email/verify", + params: { + tenantId, + }, + }, { method: "token", token, @@ -113,7 +123,7 @@ export default function getRecipeInterface( userContext: UserContext; }): Promise { let response = await querier.sendGetRequest( - new NormalisedURLPath("/recipe/user/email/verify"), + "/recipe/user/email/verify", { userId: recipeUserId.getAsString(), email, @@ -130,7 +140,12 @@ export default function getRecipeInterface( userContext: UserContext; }): Promise<{ status: "OK" }> { await querier.sendPostRequest( - new NormalisedURLPath(`/${input.tenantId}/recipe/user/email/verify/token/remove`), + { + path: "//recipe/user/email/verify/token/remove", + params: { + tenantId: input.tenantId, + }, + }, { userId: input.recipeUserId.getAsString(), email: input.email, @@ -146,7 +161,7 @@ export default function getRecipeInterface( userContext: UserContext; }): Promise<{ status: "OK" }> { await querier.sendPostRequest( - new NormalisedURLPath("/recipe/user/email/verify/remove"), + "/recipe/user/email/verify/remove", { userId: input.recipeUserId.getAsString(), email: input.email, diff --git a/lib/ts/recipe/jwt/recipeImplementation.ts b/lib/ts/recipe/jwt/recipeImplementation.ts index fa937c881..aade7b227 100644 --- a/lib/ts/recipe/jwt/recipeImplementation.ts +++ b/lib/ts/recipe/jwt/recipeImplementation.ts @@ -51,7 +51,7 @@ export default function getRecipeInterface( } let response = await querier.sendPostRequest( - new NormalisedURLPath("/recipe/jwt"), + "/recipe/jwt", { payload: payload ?? {}, validity: validitySeconds, @@ -76,7 +76,7 @@ export default function getRecipeInterface( getJWKS: async function ({ userContext }): Promise<{ keys: JsonWebKey[]; validityInSeconds?: number }> { const { body, headers } = await querier.sendGetRequestWithResponseHeaders( - new NormalisedURLPath("/.well-known/jwks.json"), + "/.well-known/jwks.json", {}, undefined, userContext diff --git a/lib/ts/recipe/multitenancy/recipeImplementation.ts b/lib/ts/recipe/multitenancy/recipeImplementation.ts index d3694647a..b0516a50c 100644 --- a/lib/ts/recipe/multitenancy/recipeImplementation.ts +++ b/lib/ts/recipe/multitenancy/recipeImplementation.ts @@ -1,6 +1,5 @@ import { RecipeInterface } from "./"; import { Querier } from "../../querier"; -import NormalisedURLPath from "../../normalisedURLPath"; import { DEFAULT_TENANT_ID } from "./constants"; export default function getRecipeInterface(querier: Querier): RecipeInterface { @@ -11,7 +10,7 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { createOrUpdateTenant: async function ({ tenantId, config, userContext }) { let response = await querier.sendPutRequest( - new NormalisedURLPath(`/recipe/multitenancy/tenant/v2`), + "/recipe/multitenancy/tenant/v2", { tenantId, ...config, @@ -25,7 +24,7 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { deleteTenant: async function ({ tenantId, userContext }) { let response = await querier.sendPostRequest( - new NormalisedURLPath(`/recipe/multitenancy/tenant/remove`), + "/recipe/multitenancy/tenant/remove", { tenantId, }, @@ -37,9 +36,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { getTenant: async function ({ tenantId, userContext }) { let response = await querier.sendGetRequest( - new NormalisedURLPath( - `/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/multitenancy/tenant/v2` - ), + { + path: "//recipe/multitenancy/tenant/v2", + params: { + tenantId: tenantId === undefined ? DEFAULT_TENANT_ID : tenantId, + }, + }, {}, userContext ); @@ -53,7 +55,7 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { listAllTenants: async function ({ userContext }) { let response = await querier.sendGetRequest( - new NormalisedURLPath(`/recipe/multitenancy/tenant/list/v2`), + "/recipe/multitenancy/tenant/list/v2", {}, userContext ); @@ -62,9 +64,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { createOrUpdateThirdPartyConfig: async function ({ tenantId, config, skipValidation, userContext }) { let response = await querier.sendPutRequest( - new NormalisedURLPath( - `/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/multitenancy/config/thirdparty` - ), + { + path: "//recipe/multitenancy/config/thirdparty", + params: { + tenantId: tenantId === undefined ? DEFAULT_TENANT_ID : tenantId, + }, + }, { config, skipValidation, @@ -77,11 +82,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { deleteThirdPartyConfig: async function ({ tenantId, thirdPartyId, userContext }) { let response = await querier.sendPostRequest( - new NormalisedURLPath( - `/${ - tenantId === undefined ? DEFAULT_TENANT_ID : tenantId - }/recipe/multitenancy/config/thirdparty/remove` - ), + { + path: "//recipe/multitenancy/config/thirdparty/remove", + params: { + tenantId: tenantId === undefined ? DEFAULT_TENANT_ID : tenantId, + }, + }, { thirdPartyId, }, @@ -92,9 +98,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { associateUserToTenant: async function ({ tenantId, recipeUserId, userContext }) { let response = await querier.sendPostRequest( - new NormalisedURLPath( - `/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/multitenancy/tenant/user` - ), + { + path: "//recipe/multitenancy/tenant/user", + params: { + tenantId: tenantId === undefined ? DEFAULT_TENANT_ID : tenantId, + }, + }, { recipeUserId: recipeUserId.getAsString(), }, @@ -105,9 +114,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { disassociateUserFromTenant: async function ({ tenantId, recipeUserId, userContext }) { let response = await querier.sendPostRequest( - new NormalisedURLPath( - `/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/multitenancy/tenant/user/remove` - ), + { + path: "//recipe/multitenancy/tenant/user/remove", + params: { + tenantId: tenantId === undefined ? DEFAULT_TENANT_ID : tenantId, + }, + }, { recipeUserId: recipeUserId.getAsString(), }, diff --git a/lib/ts/recipe/oauth2provider/recipeImplementation.ts b/lib/ts/recipe/oauth2provider/recipeImplementation.ts index ee2b1a99f..0a8cdfae0 100644 --- a/lib/ts/recipe/oauth2provider/recipeImplementation.ts +++ b/lib/ts/recipe/oauth2provider/recipeImplementation.ts @@ -14,7 +14,6 @@ */ import * as jose from "jose"; -import NormalisedURLPath from "../../normalisedURLPath"; import { Querier } from "../../querier"; import { JSONObject, NormalisedAppinfo } from "../../types"; import { @@ -61,7 +60,7 @@ export default function getRecipeInterface( return { getLoginRequest: async function (this: RecipeInterface, input) { const resp = await querier.sendGetRequest( - new NormalisedURLPath("/recipe/oauth/auth/requests/login"), + "/recipe/oauth/auth/requests/login", { loginChallenge: input.challenge }, input.userContext ); @@ -88,7 +87,7 @@ export default function getRecipeInterface( }, acceptLoginRequest: async function (this: RecipeInterface, input): Promise<{ redirectTo: string }> { const resp = await querier.sendPutRequest( - new NormalisedURLPath(`/recipe/oauth/auth/requests/login/accept`), + "/recipe/oauth/auth/requests/login/accept", { acr: input.acr, amr: input.amr, @@ -109,7 +108,7 @@ export default function getRecipeInterface( }, rejectLoginRequest: async function (this: RecipeInterface, input): Promise<{ redirectTo: string }> { const resp = await querier.sendPutRequest( - new NormalisedURLPath(`/recipe/oauth/auth/requests/login/reject`), + "/recipe/oauth/auth/requests/login/reject", { error: input.error.error, errorDescription: input.error.errorDescription, @@ -127,7 +126,7 @@ export default function getRecipeInterface( }, getConsentRequest: async function (this: RecipeInterface, input): Promise { const resp = await querier.sendGetRequest( - new NormalisedURLPath("/recipe/oauth/auth/requests/consent"), + "/recipe/oauth/auth/requests/consent", { consentChallenge: input.challenge }, input.userContext ); @@ -149,7 +148,7 @@ export default function getRecipeInterface( }, acceptConsentRequest: async function (this: RecipeInterface, input): Promise<{ redirectTo: string }> { const resp = await querier.sendPutRequest( - new NormalisedURLPath(`/recipe/oauth/auth/requests/consent/accept`), + "/recipe/oauth/auth/requests/consent/accept", { context: input.context, grantAccessTokenAudience: input.grantAccessTokenAudience, @@ -175,7 +174,7 @@ export default function getRecipeInterface( rejectConsentRequest: async function (this: RecipeInterface, input) { const resp = await querier.sendPutRequest( - new NormalisedURLPath(`/recipe/oauth/auth/requests/consent/reject`), + "/recipe/oauth/auth/requests/consent/reject", { error: input.error.error, errorDescription: input.error.errorDescription, @@ -274,7 +273,7 @@ export default function getRecipeInterface( } const resp = await querier.sendPostRequest( - new NormalisedURLPath(`/recipe/oauth/auth`), + "/recipe/oauth/auth", { params: { ...input.params, @@ -455,7 +454,7 @@ export default function getRecipeInterface( } const res = await querier.sendPostRequest( - new NormalisedURLPath(`/recipe/oauth/token`), + "/recipe/oauth/token", body, input.userContext ); @@ -482,7 +481,7 @@ export default function getRecipeInterface( getOAuth2Clients: async function (input) { let response = await querier.sendGetRequestWithResponseHeaders( - new NormalisedURLPath(`/recipe/oauth/clients/list`), + "/recipe/oauth/clients/list", { pageSize: input.pageSize, clientName: input.clientName, @@ -508,7 +507,7 @@ export default function getRecipeInterface( }, getOAuth2Client: async function (input) { let response = await querier.sendGetRequestWithResponseHeaders( - new NormalisedURLPath(`/recipe/oauth/clients`), + "/recipe/oauth/clients", { clientId: input.clientId }, {}, input.userContext @@ -535,7 +534,7 @@ export default function getRecipeInterface( }, createOAuth2Client: async function (input) { let response = await querier.sendPostRequest( - new NormalisedURLPath(`/recipe/oauth/clients`), + "/recipe/oauth/clients", copyAndCleanRequestBodyInput(input), input.userContext ); @@ -555,7 +554,7 @@ export default function getRecipeInterface( }, updateOAuth2Client: async function (input) { let response = await querier.sendPutRequest( - new NormalisedURLPath(`/recipe/oauth/clients`), + "/recipe/oauth/clients", copyAndCleanRequestBodyInput(input), { clientId: input.clientId }, input.userContext @@ -576,7 +575,7 @@ export default function getRecipeInterface( }, deleteOAuth2Client: async function (input) { let response = await querier.sendPostRequest( - new NormalisedURLPath(`/recipe/oauth/clients/remove`), + "/recipe/oauth/clients/remove", { clientId: input.clientId }, input.userContext ); @@ -669,7 +668,7 @@ export default function getRecipeInterface( if (input.checkDatabase) { let response = await querier.sendPostRequest( - new NormalisedURLPath(`/recipe/oauth/introspect`), + "/recipe/oauth/introspect", { token: input.token, }, @@ -699,7 +698,7 @@ export default function getRecipeInterface( } const res = await querier.sendPostRequest( - new NormalisedURLPath(`/recipe/oauth/token/revoke`), + "/recipe/oauth/token/revoke", requestBody, input.userContext ); @@ -717,7 +716,7 @@ export default function getRecipeInterface( }, revokeTokensBySessionHandle: async function (this: RecipeInterface, input) { await querier.sendPostRequest( - new NormalisedURLPath(`/recipe/oauth/session/revoke`), + "/recipe/oauth/session/revoke", { sessionHandle: input.sessionHandle }, input.userContext ); @@ -726,7 +725,7 @@ export default function getRecipeInterface( }, revokeTokensByClientId: async function (this: RecipeInterface, input) { await querier.sendPostRequest( - new NormalisedURLPath(`/recipe/oauth/tokens/revoke`), + "/recipe/oauth/tokens/revoke", { clientId: input.clientId }, input.userContext ); @@ -756,7 +755,7 @@ export default function getRecipeInterface( // For tokens that passed local validation or if it's a refresh token, // validate the token with the database by calling the core introspection endpoint const res = await querier.sendPostRequest( - new NormalisedURLPath(`/recipe/oauth/introspect`), + "/recipe/oauth/introspect", { token, scope: scopes ? scopes.join(" ") : undefined, @@ -782,7 +781,7 @@ export default function getRecipeInterface( */ const resp = await querier.sendGetRequest( - new NormalisedURLPath(`/recipe/oauth/sessions/logout`), + "/recipe/oauth/sessions/logout", { clientId: input.params.client_id, idTokenHint: input.params.id_token_hint, @@ -847,7 +846,7 @@ export default function getRecipeInterface( }, acceptLogoutRequest: async function (this: RecipeInterface, input) { const resp = await querier.sendPutRequest( - new NormalisedURLPath(`/recipe/oauth/auth/requests/logout/accept`), + "/recipe/oauth/auth/requests/logout/accept", { challenge: input.challenge }, {}, input.userContext @@ -877,7 +876,7 @@ export default function getRecipeInterface( }, rejectLogoutRequest: async function (this: RecipeInterface, input) { const resp = await querier.sendPutRequest( - new NormalisedURLPath(`/recipe/oauth/auth/requests/logout/reject`), + "/recipe/oauth/auth/requests/logout/reject", {}, { challenge: input.challenge }, input.userContext diff --git a/lib/ts/recipe/passwordless/recipeImplementation.ts b/lib/ts/recipe/passwordless/recipeImplementation.ts index 1732a61b8..4191268e8 100644 --- a/lib/ts/recipe/passwordless/recipeImplementation.ts +++ b/lib/ts/recipe/passwordless/recipeImplementation.ts @@ -26,7 +26,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { return { consumeCode: async function (this: RecipeInterface, input) { const response = await querier.sendPostRequest( - new NormalisedURLPath(`/${input.tenantId}/recipe/signinup/code/consume`), + { + path: "//recipe/signinup/code/consume", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -70,7 +75,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { checkCode: async function (this: RecipeInterface, input) { let response = await querier.sendPostRequest( - new NormalisedURLPath(`/${input.tenantId}/recipe/signinup/code/check`), + { + path: "//recipe/signinup/code/check", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -86,7 +96,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { createCode: async function (input) { let response = await querier.sendPostRequest( - new NormalisedURLPath(`/${input.tenantId}/recipe/signinup/code`), + { + path: "//recipe/signinup/code", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -94,7 +109,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { }, createNewCodeForDevice: async function (input) { let response = await querier.sendPostRequest( - new NormalisedURLPath(`/${input.tenantId}/recipe/signinup/code`), + { + path: "//recipe/signinup/code", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -102,7 +122,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { }, listCodesByDeviceId: async function (input) { let response = await querier.sendGetRequest( - new NormalisedURLPath(`/${input.tenantId}/recipe/signinup/codes`), + { + path: "//recipe/signinup/codes", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -110,7 +135,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { }, listCodesByEmail: async function (input) { let response = await querier.sendGetRequest( - new NormalisedURLPath(`/${input.tenantId}/recipe/signinup/codes`), + { + path: "//recipe/signinup/codes", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -118,7 +148,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { }, listCodesByPhoneNumber: async function (input) { let response = await querier.sendGetRequest( - new NormalisedURLPath(`/${input.tenantId}/recipe/signinup/codes`), + { + path: "//recipe/signinup/codes", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -126,7 +161,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { }, listCodesByPreAuthSessionId: async function (input) { let response = await querier.sendGetRequest( - new NormalisedURLPath(`/${input.tenantId}/recipe/signinup/codes`), + { + path: "//recipe/signinup/codes", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -134,7 +174,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { }, revokeAllCodes: async function (input) { await querier.sendPostRequest( - new NormalisedURLPath(`/${input.tenantId}/recipe/signinup/codes/remove`), + { + path: "//recipe/signinup/codes/remove", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -144,7 +189,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { }, revokeCode: async function (input) { await querier.sendPostRequest( - new NormalisedURLPath(`/${input.tenantId}/recipe/signinup/code/remove`), + { + path: "//recipe/signinup/code/remove", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -187,7 +237,7 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { } } let response = await querier.sendPutRequest( - new NormalisedURLPath(`/recipe/user`), + "/recipe/user", copyAndRemoveUserContextAndTenantId(input), {}, input.userContext diff --git a/lib/ts/recipe/session/recipeImplementation.ts b/lib/ts/recipe/session/recipeImplementation.ts index 359c843ee..7f5e752b5 100644 --- a/lib/ts/recipe/session/recipeImplementation.ts +++ b/lib/ts/recipe/session/recipeImplementation.ts @@ -345,7 +345,7 @@ export default function getRecipeInterface( : input.newAccessTokenPayload; let response = await querier.sendPostRequest( - new NormalisedURLPath("/recipe/session/regenerate"), + "/recipe/session/regenerate", { accessToken: input.accessToken, userDataInJWT: newAccessTokenPayload, diff --git a/lib/ts/recipe/session/sessionFunctions.ts b/lib/ts/recipe/session/sessionFunctions.ts index 9c0b1bc40..f5a781a2c 100644 --- a/lib/ts/recipe/session/sessionFunctions.ts +++ b/lib/ts/recipe/session/sessionFunctions.ts @@ -51,7 +51,12 @@ export async function createNewSession( enableAntiCsrf: !disableAntiCsrf && helpers.config.antiCsrfFunctionOrString === "VIA_TOKEN", }; let response = await helpers.querier.sendPostRequest( - new NormalisedURLPath(`/${tenantId}/recipe/session`), + { + path: "//recipe/session", + params: { + tenantId: tenantId, + }, + }, requestBody, userContext ); @@ -242,7 +247,7 @@ export async function getSession( }; let response = await helpers.querier.sendPostRequest( - new NormalisedURLPath("/recipe/session/verify"), + "/recipe/session/verify", requestBody, userContext ); @@ -293,7 +298,7 @@ export async function getSessionInformation( throw new Error("Please use core version >= 3.5 to call this function."); } let response = await helpers.querier.sendGetRequest( - new NormalisedURLPath(`/recipe/session`), + "/recipe/session", { sessionHandle, }, @@ -347,7 +352,7 @@ export async function refreshSession( } let response = await helpers.querier.sendPostRequest( - new NormalisedURLPath("/recipe/session/refresh"), + "/recipe/session/refresh", requestBody, userContext ); @@ -409,13 +414,29 @@ export async function revokeAllSessionsForUser( tenantId = DEFAULT_TENANT_ID; } - let response = await helpers.querier.sendPostRequest( - new NormalisedURLPath(revokeAcrossAllTenants ? `/recipe/session/remove` : `/${tenantId}/recipe/session/remove`), + const body = { + userId, + revokeSessionsForLinkedAccounts, + revokeAcrossAllTenants, + }; + + if (revokeAcrossAllTenants) { + const response = await helpers.querier.sendPostRequest( + "/recipe/session/remove", + body, + userContext + ); + return response.sessionHandlesRevoked; + } + + const response = await helpers.querier.sendPostRequest( { - userId, - revokeSessionsForLinkedAccounts, - revokeAcrossAllTenants, + path: "//recipe/session/remove", + params: { + tenantId: tenantId, + }, }, + body, userContext ); return response.sessionHandlesRevoked; @@ -436,7 +457,12 @@ export async function getAllSessionHandlesForUser( tenantId = DEFAULT_TENANT_ID; } let response = await helpers.querier.sendGetRequest( - new NormalisedURLPath(fetchAcrossAllTenants ? `/recipe/session/user` : `/${tenantId}/recipe/session/user`), + fetchAcrossAllTenants ? "/recipe/session/user" : { + path: "//recipe/session/user", + params: { + tenantId: tenantId, + }, + }, { userId, fetchSessionsForAllLinkedAccounts, @@ -457,7 +483,7 @@ export async function revokeSession( userContext: UserContext ): Promise { let response = await helpers.querier.sendPostRequest( - new NormalisedURLPath("/recipe/session/remove"), + "/recipe/session/remove", { sessionHandles: [sessionHandle], }, @@ -476,7 +502,7 @@ export async function revokeMultipleSessions( userContext: UserContext ): Promise { let response = await helpers.querier.sendPostRequest( - new NormalisedURLPath(`/recipe/session/remove`), + "/recipe/session/remove", { sessionHandles, }, @@ -496,7 +522,7 @@ export async function updateSessionDataInDatabase( ): Promise { newSessionData = newSessionData === null || newSessionData === undefined ? {} : newSessionData; let response = await helpers.querier.sendPutRequest( - new NormalisedURLPath(`/recipe/session/data`), + "/recipe/session/data", { sessionHandle, userDataInDatabase: newSessionData, @@ -519,7 +545,7 @@ export async function updateAccessTokenPayload( newAccessTokenPayload = newAccessTokenPayload === null || newAccessTokenPayload === undefined ? {} : newAccessTokenPayload; let response = await helpers.querier.sendPutRequest( - new NormalisedURLPath("/recipe/jwt/data"), + "/recipe/jwt/data", { sessionHandle, userDataInJWT: newAccessTokenPayload, diff --git a/lib/ts/recipe/thirdparty/recipeImplementation.ts b/lib/ts/recipe/thirdparty/recipeImplementation.ts index 6225009bd..58dfc19d5 100644 --- a/lib/ts/recipe/thirdparty/recipeImplementation.ts +++ b/lib/ts/recipe/thirdparty/recipeImplementation.ts @@ -54,7 +54,12 @@ export default function getRecipeImplementation(querier: Querier, providers: Pro } } let response = await querier.sendPostRequest( - new NormalisedURLPath(`/${tenantId}/recipe/signinup`), + { + path: "//recipe/signinup", + params: { + tenantId: tenantId, + }, + }, { thirdPartyId, thirdPartyUserId, diff --git a/lib/ts/recipe/totp/recipeImplementation.ts b/lib/ts/recipe/totp/recipeImplementation.ts index a87a35c39..4ce109d0e 100644 --- a/lib/ts/recipe/totp/recipeImplementation.ts +++ b/lib/ts/recipe/totp/recipeImplementation.ts @@ -88,7 +88,7 @@ export default function getRecipeInterface(querier: Querier, config: TypeNormali } const response = await querier.sendPostRequest( - new NormalisedURLPath("/recipe/totp/device"), + "/recipe/totp/device", { userId: input.userId, deviceName: input.deviceName, @@ -117,7 +117,7 @@ export default function getRecipeInterface(querier: Querier, config: TypeNormali userContext: UserContext; }) => { return querier.sendPutRequest( - new NormalisedURLPath("/recipe/totp/device"), + "/recipe/totp/device", { userId: input.userId, existingDeviceName: input.existingDeviceName, @@ -130,7 +130,7 @@ export default function getRecipeInterface(querier: Querier, config: TypeNormali listDevices: (input: { userId: string; userContext: UserContext }) => { return querier.sendGetRequest( - new NormalisedURLPath("/recipe/totp/device/list"), + "/recipe/totp/device/list", { userId: input.userId, }, @@ -140,7 +140,7 @@ export default function getRecipeInterface(querier: Querier, config: TypeNormali removeDevice: (input: { userId: string; deviceName: string; userContext: UserContext }) => { return querier.sendPostRequest( - new NormalisedURLPath("/recipe/totp/device/remove"), + "/recipe/totp/device/remove", { userId: input.userId, deviceName: input.deviceName, @@ -157,7 +157,12 @@ export default function getRecipeInterface(querier: Querier, config: TypeNormali userContext: UserContext; }) => { return querier.sendPostRequest( - new NormalisedURLPath(`${input.tenantId}/recipe/totp/device/verify`), + { + path: "//recipe/totp/device/verify", + params: { + tenantId: input.tenantId, + }, + }, { userId: input.userId, deviceName: input.deviceName, @@ -169,7 +174,12 @@ export default function getRecipeInterface(querier: Querier, config: TypeNormali verifyTOTP: (input: { tenantId: string; userId: string; totp: string; userContext: UserContext }) => { return querier.sendPostRequest( - new NormalisedURLPath(`${input.tenantId}/recipe/totp/verify`), + { + path: "//recipe/totp/verify", + params: { + tenantId: input.tenantId, + }, + }, { userId: input.userId, totp: input.totp, diff --git a/lib/ts/recipe/usermetadata/recipeImplementation.ts b/lib/ts/recipe/usermetadata/recipeImplementation.ts index 2ab9d24e2..e2cc0c4f4 100644 --- a/lib/ts/recipe/usermetadata/recipeImplementation.ts +++ b/lib/ts/recipe/usermetadata/recipeImplementation.ts @@ -20,12 +20,12 @@ import { Querier } from "../../querier"; export default function getRecipeInterface(querier: Querier): RecipeInterface { return { getUserMetadata: function ({ userId, userContext }) { - return querier.sendGetRequest(new NormalisedURLPath("/recipe/user/metadata"), { userId }, userContext); + return querier.sendGetRequest("/recipe/user/metadata", { userId }, userContext); }, updateUserMetadata: function ({ userId, metadataUpdate, userContext }) { return querier.sendPutRequest( - new NormalisedURLPath("/recipe/user/metadata"), + "/recipe/user/metadata", { userId, metadataUpdate, @@ -37,7 +37,7 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { clearUserMetadata: function ({ userId, userContext }) { return querier.sendPostRequest( - new NormalisedURLPath("/recipe/user/metadata/remove"), + "/recipe/user/metadata/remove", { userId, }, diff --git a/lib/ts/recipe/userroles/recipeImplementation.ts b/lib/ts/recipe/userroles/recipeImplementation.ts index 7141a8bfe..eb7248411 100644 --- a/lib/ts/recipe/userroles/recipeImplementation.ts +++ b/lib/ts/recipe/userroles/recipeImplementation.ts @@ -22,7 +22,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { return { addRoleToUser: function ({ userId, role, tenantId, userContext }) { return querier.sendPutRequest( - new NormalisedURLPath(`/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/user/role`), + { + path: "//recipe/user/role", + params: { + tenantId: tenantId, + }, + }, { userId, role }, {}, userContext @@ -31,9 +36,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { removeUserRole: function ({ userId, role, tenantId, userContext }) { return querier.sendPostRequest( - new NormalisedURLPath( - `/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/user/role/remove` - ), + { + path: "//recipe/user/role/remove", + params: { + tenantId: tenantId, + }, + }, { userId, role }, userContext ); @@ -41,7 +49,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { getRolesForUser: function ({ userId, tenantId, userContext }) { return querier.sendGetRequest( - new NormalisedURLPath(`/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/user/roles`), + { + path: "//recipe/user/roles", + params: { + tenantId: tenantId, + }, + }, { userId }, userContext ); @@ -49,7 +62,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { getUsersThatHaveRole: function ({ role, tenantId, userContext }) { return querier.sendGetRequest( - new NormalisedURLPath(`/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/role/users`), + { + path: "//recipe/role/users", + params: { + tenantId: tenantId, + }, + }, { role }, userContext ); @@ -57,7 +75,7 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { createNewRoleOrAddPermissions: function ({ role, permissions, userContext }) { return querier.sendPutRequest( - new NormalisedURLPath("/recipe/role"), + "/recipe/role", { role, permissions }, {}, userContext @@ -65,12 +83,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { }, getPermissionsForRole: function ({ role, userContext }) { - return querier.sendGetRequest(new NormalisedURLPath("/recipe/role/permissions"), { role }, userContext); + return querier.sendGetRequest("/recipe/role/permissions", { role }, userContext); }, removePermissionsFromRole: function ({ role, permissions, userContext }) { return querier.sendPostRequest( - new NormalisedURLPath("/recipe/role/permissions/remove"), + "/recipe/role/permissions/remove", { role, permissions, @@ -81,18 +99,18 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { getRolesThatHavePermission: function ({ permission, userContext }) { return querier.sendGetRequest( - new NormalisedURLPath("/recipe/permission/roles"), + "/recipe/permission/roles", { permission }, userContext ); }, deleteRole: function ({ role, userContext }) { - return querier.sendPostRequest(new NormalisedURLPath("/recipe/role/remove"), { role }, userContext); + return querier.sendPostRequest("/recipe/role/remove", { role }, userContext); }, getAllRoles: function ({ userContext }) { - return querier.sendGetRequest(new NormalisedURLPath("/recipe/roles"), {}, userContext); + return querier.sendGetRequest("/recipe/roles", {}, userContext); }, }; } diff --git a/lib/ts/recipe/webauthn/recipeImplementation.ts b/lib/ts/recipe/webauthn/recipeImplementation.ts index 796be8130..2ca7db652 100644 --- a/lib/ts/recipe/webauthn/recipeImplementation.ts +++ b/lib/ts/recipe/webauthn/recipeImplementation.ts @@ -88,9 +88,12 @@ export default function getRecipeInterface( } return await querier.sendPostRequest( - new NormalisedURLPath( - `/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/webauthn/options/register` - ), + { + path: "//recipe/webauthn/options/register", + params: { + tenantId: tenantId, + }, + }, { email, displayName, @@ -119,9 +122,12 @@ export default function getRecipeInterface( userContext, }) { return await querier.sendPostRequest( - new NormalisedURLPath( - `/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/webauthn/options/signin` - ), + { + path: "//recipe/webauthn/options/signin", + params: { + tenantId: tenantId, + }, + }, { userVerification, userPresence, @@ -215,9 +221,12 @@ export default function getRecipeInterface( verifyCredentials: async function ({ credential, webauthnGeneratedOptionsId, tenantId, userContext }) { const response = await querier.sendPostRequest( - new NormalisedURLPath( - `/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/webauthn/signin` - ), + { + path: "//recipe/webauthn/signin", + params: { + tenantId: tenantId, + }, + }, { credential, webauthnGeneratedOptionsId, @@ -238,9 +247,12 @@ export default function getRecipeInterface( createNewRecipeUser: async function (input) { const resp = await querier.sendPostRequest( - new NormalisedURLPath( - `/${input.tenantId === undefined ? DEFAULT_TENANT_ID : input.tenantId}/recipe/webauthn/signup` - ), + { + path: "//recipe/webauthn/signup", + params: { + tenantId: input.tenantId, + }, + }, { webauthnGeneratedOptionsId: input.webauthnGeneratedOptionsId, credential: input.credential, @@ -261,9 +273,12 @@ export default function getRecipeInterface( generateRecoverAccountToken: async function ({ userId, email, tenantId, userContext }) { return await querier.sendPostRequest( - new NormalisedURLPath( - `/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/webauthn/user/recover/token` - ), + { + path: "//recipe/webauthn/user/recover/token", + params: { + tenantId: tenantId, + }, + }, { userId, email, @@ -274,11 +289,12 @@ export default function getRecipeInterface( consumeRecoverAccountToken: async function ({ token, tenantId, userContext }) { return await querier.sendPostRequest( - new NormalisedURLPath( - `/${ - tenantId === undefined ? DEFAULT_TENANT_ID : tenantId - }/recipe/webauthn/user/recover/token/consume` - ), + { + path: "//recipe/webauthn/user/recover/token/consume", + params: { + tenantId: tenantId, + }, + }, { token, }, @@ -288,7 +304,7 @@ export default function getRecipeInterface( registerCredential: async function ({ webauthnGeneratedOptionsId, credential, userContext, recipeUserId }) { return await querier.sendPostRequest( - new NormalisedURLPath(`/recipe/webauthn/user/credential/register`), + "/recipe/webauthn/user/credential/register", { recipeUserId, webauthnGeneratedOptionsId, @@ -300,9 +316,12 @@ export default function getRecipeInterface( getUserFromRecoverAccountToken: async function ({ token, tenantId, userContext }) { const resp = await querier.sendGetRequest( - new NormalisedURLPath( - `/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/webauthn/user/recover` - ), + { + path: "//recipe/webauthn/user/recover", + params: { + tenantId: tenantId, + }, + }, { token }, userContext ); @@ -320,7 +339,7 @@ export default function getRecipeInterface( removeCredential: async function ({ webauthnCredentialId, recipeUserId, userContext }) { return await querier.sendDeleteRequest( - new NormalisedURLPath(`/recipe/webauthn/user/credential/remove`), + "/recipe/webauthn/user/credential/remove", {}, { recipeUserId, webauthnCredentialId }, userContext @@ -329,7 +348,7 @@ export default function getRecipeInterface( getCredential: async function ({ webauthnCredentialId, recipeUserId, userContext }) { const resp = await querier.sendGetRequest( - new NormalisedURLPath(`/recipe/webauthn/user/credential`), + "/recipe/webauthn/user/credential", { webauthnCredentialId, recipeUserId }, userContext ); @@ -346,7 +365,7 @@ export default function getRecipeInterface( listCredentials: async function ({ recipeUserId, userContext }) { return await querier.sendGetRequest( - new NormalisedURLPath(`/recipe/webauthn/user/credential/list`), + "/recipe/webauthn/user/credential/list", { recipeUserId }, userContext ); @@ -354,10 +373,13 @@ export default function getRecipeInterface( removeGeneratedOptions: async function ({ webauthnGeneratedOptionsId, tenantId, userContext }) { return await querier.sendDeleteRequest( - new NormalisedURLPath( - `/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/webauthn/options/remove` - ), - {}, + { + path: "//recipe/webauthn/options/remove", + params: { + tenantId: tenantId, + }, + }, + undefined, { webauthnGeneratedOptionsId }, userContext ); @@ -365,9 +387,12 @@ export default function getRecipeInterface( getGeneratedOptions: async function ({ webauthnGeneratedOptionsId, tenantId, userContext }) { return await querier.sendGetRequest( - new NormalisedURLPath( - `/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/webauthn/options` - ), + { + path: "//recipe/webauthn/options", + params: { + tenantId: tenantId, + }, + }, { webauthnGeneratedOptionsId }, userContext ); @@ -375,9 +400,12 @@ export default function getRecipeInterface( updateUserEmail: async function ({ email, recipeUserId, tenantId, userContext }) { return await querier.sendPutRequest( - new NormalisedURLPath( - `/${tenantId === undefined ? DEFAULT_TENANT_ID : tenantId}/recipe/webauthn/user/email` - ), + { + path: "//recipe/webauthn/user/email", + params: { + tenantId: tenantId, + }, + }, { email, recipeUserId }, {}, userContext From a1e3df8fbf187ef4973b73d507ad7a59193c82b3 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Tue, 6 May 2025 12:51:56 +0530 Subject: [PATCH 24/64] Add fixes for webauthn schema issues --- .../recipe/webauthn/recipeImplementation.ts | 2 +- scripts/generate-schema.js | 39 +++++++++++++++++-- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/lib/ts/recipe/webauthn/recipeImplementation.ts b/lib/ts/recipe/webauthn/recipeImplementation.ts index 2ca7db652..74731f664 100644 --- a/lib/ts/recipe/webauthn/recipeImplementation.ts +++ b/lib/ts/recipe/webauthn/recipeImplementation.ts @@ -340,7 +340,7 @@ export default function getRecipeInterface( removeCredential: async function ({ webauthnCredentialId, recipeUserId, userContext }) { return await querier.sendDeleteRequest( "/recipe/webauthn/user/credential/remove", - {}, + undefined, { recipeUserId, webauthnCredentialId }, userContext ); diff --git a/scripts/generate-schema.js b/scripts/generate-schema.js index 9f6911c0f..b312702bf 100644 --- a/scripts/generate-schema.js +++ b/scripts/generate-schema.js @@ -13,6 +13,36 @@ const libDir = path.join(__dirname, "..", "lib", "core", "versions"); const BASE_URL = "https://raw.githubusercontent.com/supertokens/core-driver-interface/refs/heads"; async function run() { + const localFilePath = process.argv[2]; + const localVersion = process.argv[3]; + + if (localFilePath && localVersion) { + await processLocalSpec(localFilePath, localVersion); + } else { + await processRemoteSpecs(); + } +} + +async function processLocalSpec(filePath, version) { + const outputDir = path.join(libDir, version); + const outputPath = path.join(outputDir, "schema.d.ts"); + + await fs.mkdir(outputDir, { recursive: true }); + + console.log(`📄 Using local spec file: ${filePath}`); + await execPromise(`npx openapi-typescript ${filePath} -o ${outputPath}`); + + let schemaContent = await fs.readFile(outputPath, "utf-8"); + schemaContent = schemaContent + .replace(/\/appid-[^/]+/g, "") + .replace(/Record/g, "Record") + .replace(/\bstatus\?\s*:/g, "status:"); + await fs.writeFile(outputPath, schemaContent, "utf-8"); + + console.log(`✅ Generated and cleaned schema for local version ${version}`); +} + +async function processRemoteSpecs() { const file = await fs.readFile(coreJsonPath, "utf-8"); const json = JSON.parse(file); const versions = json.versions; @@ -47,11 +77,14 @@ async function run() { console.log(`🔧 Generating schema for version ${version}...`); await execPromise(`npx openapi-typescript ${inputPath} -o ${outputPath}`); - // Post-process: remove `/appid-/` - console.log(`🧹 Cleaning appid from ${outputPath}`); + console.log(`🧹 Post-processing ${outputPath}...`); let schemaContent = await fs.readFile(outputPath, "utf-8"); - schemaContent = schemaContent.replace(/\/appid-[^/]+/g, ""); + schemaContent = schemaContent + .replace(/\/appid-[^/]+/g, "") + .replace(/Record/g, "Record") + .replace(/\bstatus\?\s*:/g, "status:"); await fs.writeFile(outputPath, schemaContent, "utf-8"); + console.log(`✅ Cleaned ${outputPath}`); } } finally { From fa03ed382f36683d62ba3bc3f28bee5d75ddb9a9 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Tue, 6 May 2025 12:53:06 +0530 Subject: [PATCH 25/64] Update the local API spec based on the updated version --- lib/core/versions/5.3/schema.d.ts | 2405 +++++++++++++---------------- 1 file changed, 1075 insertions(+), 1330 deletions(-) diff --git a/lib/core/versions/5.3/schema.d.ts b/lib/core/versions/5.3/schema.d.ts index 3a45b6642..3e526f0b9 100644 --- a/lib/core/versions/5.3/schema.d.ts +++ b/lib/core/versions/5.3/schema.d.ts @@ -1130,7 +1130,7 @@ export interface paths { content: { "application/json": { /** @enum {string} */ - status?: "OK"; + status: "OK"; keys?: components["schemas"]["jwk"][]; }; }; @@ -2705,7 +2705,7 @@ export interface paths { patch?: never; trace?: never; }; - "//recipe/webauthn/user/credential": { + "/recipe/webauthn/user/credential": { parameters: { query?: never; header?: never; @@ -2722,7 +2722,7 @@ export interface paths { patch?: never; trace?: never; }; - "//recipe/webauthn/user/credential/list": { + "/recipe/webauthn/user/credential/list": { parameters: { query?: never; header?: never; @@ -2807,7 +2807,7 @@ export interface paths { patch?: never; trace?: never; }; - "//recipe/webauthn/user/credential/register": { + "/recipe/webauthn/user/credential/register": { parameters: { query?: never; header?: never; @@ -2909,7 +2909,7 @@ export interface paths { patch?: never; trace?: never; }; - "//recipe/webauthn/user/credential/remove": { + "/recipe/webauthn/user/credential/remove": { parameters: { query?: never; header?: never; @@ -2944,7 +2944,7 @@ export interface paths { trace?: never; }; } -export type webhooks = Record; +export type webhooks = Record; export interface components { schemas: { authRecipeUser: { @@ -3044,6 +3044,8 @@ export interface components { codeLifetime: number; /** @enum {string} */ statusOK: "OK"; + /** @enum {string} */ + userVerification: "preferred" | "required" | "discouraged"; oauthClient: { /** @example stcl_c6dd9189-33b8-4ec0-8aea-a0ffdaf75fcb */ clientId?: string; @@ -3134,7 +3136,7 @@ export interface components { * ] * } */ - userMetadata: Record; + userMetadata: Record; /** * @description should be a JSON object (not a JSON literal nor an array) * @example { @@ -3144,21 +3146,21 @@ export interface components { * "todos": null * } */ - userMetadataUpdate: Record; + userMetadataUpdate: Record; /** * @description should be a JSON object (not a JSON literal nor an array) * @example { * "test": 123 * } */ - userDataInJWT: Record; + userDataInJWT: Record; /** * @description should be a JSON object (not a JSON literal nor an array) * @example { * "test": 123 * } */ - userDataInDatabase: Record; + userDataInDatabase: Record; /** @example false */ enableAntiCsrf: boolean; /** @example 68en6gd6-865b-4af6-ba00-96e5c153257d */ @@ -3188,7 +3190,7 @@ export interface components { * "custom-claim": "" * } */ - createJWTPayload: Record; + createJWTPayload: Record; /** * @description The algorithm to use when creating the JWT. * @enum {string} @@ -3217,26 +3219,26 @@ export interface components { x5c?: string[]; }; unauthorisedMessageResponse: { - status?: components["schemas"]["unauthorisedResponse"]; + status: components["schemas"]["unauthorisedResponse"]; message?: components["schemas"]["message"]; }; /** @enum {string} */ helloResponse: "Hello"; statusOKResponse: { /** @enum {string} */ - status?: "OK"; + status: "OK"; }; wrongCredentialsResponse: { /** @enum {string} */ - status?: "WRONG_CREDENTIALS_ERROR"; + status: "WRONG_CREDENTIALS_ERROR"; }; unknownUserIdResponse: { /** @enum {string} */ - status?: "UNKNOWN_USER_ID_ERROR"; + status: "UNKNOWN_USER_ID_ERROR"; }; unknownRoleResponse: { /** @enum {string} */ - status?: "UNKNOWN_ROLE_ERROR"; + status: "UNKNOWN_ROLE_ERROR"; }; /** @enum {string} */ tokenTheftResponse: "TOKEN_THEFT_DETECTED"; @@ -3266,15 +3268,15 @@ export interface components { clientSecret?: string; scope?: string[]; forcePKCE?: boolean; - additionalConfig?: Record; + additionalConfig?: Record; }[]; authorizationEndpoint?: string; - authorizationEndpointQueryParams?: Record; + authorizationEndpointQueryParams?: Record; tokenEndpoint?: string; - tokenEndpointBodyParams?: Record; + tokenEndpointBodyParams?: Record; userInfoEndpoint?: string; - userInfoEndpointQueryParams?: Record; - userInfoEndpointHeaders?: Record; + userInfoEndpointQueryParams?: Record; + userInfoEndpointHeaders?: Record; jwksURI?: string; oidcDiscoveryEndpoint?: string; /** @default true */ @@ -3300,12 +3302,12 @@ export interface components { passwordlessEnabled?: boolean; firstFactors?: components["schemas"]["firstFactors"]; requiredSecondaryFactors?: components["schemas"]["requiredSecondaryFactors"]; - coreConfig?: Record; + coreConfig?: Record; }; tenantInputV2: { firstFactors?: components["schemas"]["firstFactors"]; requiredSecondaryFactors?: components["schemas"]["requiredSecondaryFactors"]; - coreConfig?: Record; + coreConfig?: Record; }; tenantConfig: { tenantId: components["schemas"]["tenantId"]; @@ -3321,7 +3323,7 @@ export interface components { }; firstFactors?: components["schemas"]["firstFactors"]; requiredSecondaryFactors?: components["schemas"]["requiredSecondaryFactors"]; - coreConfig: Record; + coreConfig: Record; }; /** @example $argon2d$v=19$m=12,t=3,p=1$aGI4enNvMmd0Zm0wMDAwMA$r6p7qbr6HD+8CD7sBi4HVw */ passwordHash: string; @@ -3383,18 +3385,13 @@ export interface components { bulkImportUserPasswordlessLoginMethod: (components["schemas"]["bulkImportUserLoginMethodFields"] & { /** @example passwordless */ recipeId?: string; - }) & - (components["schemas"]["email"] | components["schemas"]["phoneNumber"]); + }) & (components["schemas"]["email"] | components["schemas"]["phoneNumber"]); bulkImportUser: { externalUserId?: components["schemas"]["userId"]; userMetadata?: components["schemas"]["userMetadata"][]; userRoles?: components["schemas"]["bulkImportUserRole"][]; totpDevices?: components["schemas"]["bulkImportTotpDevice"][]; - loginMethods?: ( - | components["schemas"]["bulkImportUserEmailPasswordLoginMethod"] - | components["schemas"]["bulkImportUserThirdPartyLoginMethod"] - | components["schemas"]["bulkImportUserPasswordlessLoginMethod"] - )[]; + loginMethods?: (components["schemas"]["bulkImportUserEmailPasswordLoginMethod"] | components["schemas"]["bulkImportUserThirdPartyLoginMethod"] | components["schemas"]["bulkImportUserPasswordlessLoginMethod"])[]; }; addBulkImportUserResponse: { userId?: components["schemas"]["userId"]; @@ -3402,10 +3399,10 @@ export interface components { }; bulkImportUserResponse: { id?: components["schemas"]["bulkImportUserId"]; - status?: components["schemas"]["bulkImportUserStatus"]; + status: components["schemas"]["bulkImportUserStatus"]; createdAt?: components["schemas"]["timeJoined"]; updatedAt?: components["schemas"]["timeJoined"]; - } & (components["schemas"]["bulkImportUser"] & Record); + } & (components["schemas"]["bulkImportUser"] & Record); tenantConfigV2: { tenantId: components["schemas"]["tenantId"]; thirdParty: { @@ -3413,7 +3410,7 @@ export interface components { }; firstFactors?: components["schemas"]["firstFactors"]; requiredSecondaryFactors?: components["schemas"]["requiredSecondaryFactors"]; - coreConfig: Record; + coreConfig: Record; }; oauthError: { /** @enum {string} */ @@ -3544,7 +3541,7 @@ export interface components { headers: never; pathItems: never; } -export type $defs = Record; +export type $defs = Record; export interface operations { canCreatePrimaryUser: { parameters: { @@ -3573,26 +3570,23 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example true */ - wasAlreadyAPrimaryUser?: boolean; - } - | { - /** @enum {string} */ - status?: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId?: string; - description?: string; - } - | { - /** @enum {string} */ - status?: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId?: string; - description?: string; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example true */ + wasAlreadyAPrimaryUser?: boolean; + } | { + /** @enum {string} */ + status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + } | { + /** @enum {string} */ + status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + }; }; }; 400: components["responses"]["400"]; @@ -3629,30 +3623,26 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example true */ - accountsAlreadyLinked?: boolean; - } - | { - /** @enum {string} */ - status?: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId?: string; - description?: string; - } - | { - /** @enum {string} */ - status?: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId?: string; - description?: string; - } - | { - /** @enum {string} */ - status?: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example true */ + accountsAlreadyLinked?: boolean; + } | { + /** @enum {string} */ + status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + } | { + /** @enum {string} */ + status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + } | { + /** @enum {string} */ + status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; + }; }; }; 400: components["responses"]["400"]; @@ -3693,27 +3683,24 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example true */ - wasAlreadyAPrimaryUser?: boolean; - user?: components["schemas"]["authRecipeUser"]; - } - | { - /** @enum {string} */ - status?: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId?: string; - description?: string; - } - | { - /** @enum {string} */ - status?: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId?: string; - description?: string; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example true */ + wasAlreadyAPrimaryUser?: boolean; + user?: components["schemas"]["authRecipeUser"]; + } | { + /** @enum {string} */ + status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + } | { + /** @enum {string} */ + status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + }; }; }; 400: components["responses"]["400"]; @@ -3757,32 +3744,28 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example true */ - accountsAlreadyLinked?: boolean; - user?: components["schemas"]["authRecipeUser"]; - } - | { - /** @enum {string} */ - status?: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId?: string; - description?: string; - } - | { - /** @enum {string} */ - status?: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId?: string; - user?: components["schemas"]["authRecipeUser"]; - description?: string; - } - | { - /** @enum {string} */ - status?: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example true */ + accountsAlreadyLinked?: boolean; + user?: components["schemas"]["authRecipeUser"]; + } | { + /** @enum {string} */ + status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + } | { + /** @enum {string} */ + status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + user?: components["schemas"]["authRecipeUser"]; + description?: string; + } | { + /** @enum {string} */ + status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; + }; }; }; 400: components["responses"]["400"]; @@ -3825,7 +3808,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; /** @example true */ wasRecipeUserDeleted?: boolean; /** @example true */ @@ -3874,18 +3857,15 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - } - | { - /** @enum {string} */ - status?: "UNKNOWN_DEVICE_ERROR"; - } - | { - /** @enum {string} */ - status?: "DEVICE_ALREADY_EXISTS_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + } | { + /** @enum {string} */ + status: "UNKNOWN_DEVICE_ERROR"; + } | { + /** @enum {string} */ + status: "DEVICE_ALREADY_EXISTS_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -3931,18 +3911,16 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example JBSWY3DPEHPK3PXP */ - secret?: string; - /** @example d1 */ - deviceName?: string; - } - | { - /** @enum {string} */ - status?: "DEVICE_ALREADY_EXISTS_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example JBSWY3DPEHPK3PXP */ + secret?: string; + /** @example d1 */ + deviceName?: string; + } | { + /** @enum {string} */ + status: "DEVICE_ALREADY_EXISTS_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -4034,16 +4012,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example d1 */ - deviceName?: string; - } - | { - /** @enum {string} */ - status?: "DEVICE_ALREADY_EXISTS_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example d1 */ + deviceName?: string; + } | { + /** @enum {string} */ + status: "DEVICE_ALREADY_EXISTS_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -4086,7 +4062,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; /** @example true */ didDeviceExist?: boolean; }; @@ -4133,32 +4109,28 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - } - | { - /** @enum {string} */ - status?: "INVALID_TOTP_ERROR"; - /** @example 2 */ - currentNumberOfFailedAttempts?: number; - /** @example 5 */ - maxNumberOfFailedAttempts?: number; - } - | { - /** @enum {string} */ - status?: "UNKNOWN_USER_ID_ERROR"; - } - | { - /** @enum {string} */ - status?: "LIMIT_REACHED_ERROR"; - /** @example 90000 */ - retryAfterMs?: number; - /** @example 2 */ - currentNumberOfFailedAttempts?: number; - /** @example 5 */ - maxNumberOfFailedAttempts?: number; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + } | { + /** @enum {string} */ + status: "INVALID_TOTP_ERROR"; + /** @example 2 */ + currentNumberOfFailedAttempts?: number; + /** @example 5 */ + maxNumberOfFailedAttempts?: number; + } | { + /** @enum {string} */ + status: "UNKNOWN_USER_ID_ERROR"; + } | { + /** @enum {string} */ + status: "LIMIT_REACHED_ERROR"; + /** @example 90000 */ + retryAfterMs?: number; + /** @example 2 */ + currentNumberOfFailedAttempts?: number; + /** @example 5 */ + maxNumberOfFailedAttempts?: number; + }; }; }; 400: components["responses"]["400"]; @@ -4202,34 +4174,30 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example false */ - wasAlreadyVerified?: boolean; - } - | { - /** @enum {string} */ - status?: "UNKNOWN_DEVICE_ERROR"; - } - | { - /** @enum {string} */ - status?: "INVALID_TOTP_ERROR"; - /** @example 2 */ - currentNumberOfFailedAttempts?: number; - /** @example 5 */ - maxNumberOfFailedAttempts?: number; - } - | { - /** @enum {string} */ - status?: "LIMIT_REACHED_ERROR"; - /** @example 90000 */ - retryAfterMs?: number; - /** @example 2 */ - currentNumberOfFailedAttempts?: number; - /** @example 5 */ - maxNumberOfFailedAttempts?: number; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example false */ + wasAlreadyVerified?: boolean; + } | { + /** @enum {string} */ + status: "UNKNOWN_DEVICE_ERROR"; + } | { + /** @enum {string} */ + status: "INVALID_TOTP_ERROR"; + /** @example 2 */ + currentNumberOfFailedAttempts?: number; + /** @example 5 */ + maxNumberOfFailedAttempts?: number; + } | { + /** @enum {string} */ + status: "LIMIT_REACHED_ERROR"; + /** @example 90000 */ + retryAfterMs?: number; + /** @example 2 */ + currentNumberOfFailedAttempts?: number; + /** @example 5 */ + maxNumberOfFailedAttempts?: number; + }; }; }; 400: components["responses"]["400"]; @@ -4266,19 +4234,17 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status: components["schemas"]["statusOK"]; - superTokensUserId: components["schemas"]["userId"]; - /** @example externalId */ - externalUserId: string; - /** @example Info about external userId */ - externalUserIdInfo?: string; - } - | { - /** @enum {string} */ - status?: "UNKNOWN_MAPPING_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + superTokensUserId: components["schemas"]["userId"]; + /** @example externalId */ + externalUserId: string; + /** @example Info about external userId */ + externalUserIdInfo?: string; + } | { + /** @enum {string} */ + status: "UNKNOWN_MAPPING_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -4323,20 +4289,17 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - } - | { - /** @enum {string} */ - status?: "UNKNOWN_SUPERTOKENS_USER_ID_ERROR"; - } - | { - /** @enum {string} */ - status?: "USER_ID_MAPPING_ALREADY_EXISTS_ERROR"; - doesSuperTokensUserIdExist?: boolean; - doesExternalUserIdExist?: boolean; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + } | { + /** @enum {string} */ + status: "UNKNOWN_SUPERTOKENS_USER_ID_ERROR"; + } | { + /** @enum {string} */ + status: "USER_ID_MAPPING_ALREADY_EXISTS_ERROR"; + doesSuperTokensUserIdExist?: boolean; + doesExternalUserIdExist?: boolean; + }; }; }; 400: components["responses"]["400"]; @@ -4380,7 +4343,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; didMappingExist?: boolean; }; }; @@ -4426,14 +4389,12 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - } - | { - /** @enum {string} */ - status?: "UNKNOWN_MAPPING_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + } | { + /** @enum {string} */ + status: "UNKNOWN_MAPPING_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -4461,16 +4422,14 @@ export interface operations { }; requestBody?: { content: { - "application/json": - | { - preAuthSessionId: components["schemas"]["preAuthSessionId"]; - linkCode: components["schemas"]["linkCode"]; - } - | { - preAuthSessionId: components["schemas"]["preAuthSessionId"]; - deviceId: components["schemas"]["deviceId"]; - userInputCode: components["schemas"]["userInputCode"]; - }; + "application/json": { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + linkCode: components["schemas"]["linkCode"]; + } | { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + deviceId: components["schemas"]["deviceId"]; + userInputCode: components["schemas"]["userInputCode"]; + }; }; }; responses: { @@ -4480,29 +4439,26 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - consumedDevice?: { - preAuthSessionId: components["schemas"]["preAuthSessionId"]; - /** @example 2 */ - failedCodeInputAttemptCount: number; - email?: components["schemas"]["email"]; - phoneNumber?: components["schemas"]["phoneNumber"]; - }; - } - | { - /** @enum {string} */ - status?: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR"; - /** @example 2 */ - failedCodeInputAttemptCount?: number; - /** @example 5 */ - maximumCodeInputAttempts?: number; - } - | { - /** @enum {string} */ - status?: "RESTART_FLOW_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + consumedDevice?: { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + /** @example 2 */ + failedCodeInputAttemptCount: number; + email?: components["schemas"]["email"]; + phoneNumber?: components["schemas"]["phoneNumber"]; + }; + } | { + /** @enum {string} */ + status: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR"; + /** @example 2 */ + failedCodeInputAttemptCount?: number; + /** @example 5 */ + maximumCodeInputAttempts?: number; + } | { + /** @enum {string} */ + status: "RESTART_FLOW_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -4530,16 +4486,14 @@ export interface operations { }; requestBody?: { content: { - "application/json": - | { - preAuthSessionId: components["schemas"]["preAuthSessionId"]; - linkCode: components["schemas"]["linkCode"]; - } - | { - preAuthSessionId: components["schemas"]["preAuthSessionId"]; - deviceId: components["schemas"]["deviceId"]; - userInputCode: components["schemas"]["userInputCode"]; - }; + "application/json": { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + linkCode: components["schemas"]["linkCode"]; + } | { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + deviceId: components["schemas"]["deviceId"]; + userInputCode: components["schemas"]["userInputCode"]; + }; }; }; responses: { @@ -4549,33 +4503,30 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example true */ - createdNewUser?: boolean; - user?: components["schemas"]["authRecipeUser"]; - recipeUserId?: components["schemas"]["userId"]; - consumedDevice?: { - preAuthSessionId: components["schemas"]["preAuthSessionId"]; - /** @example 2 */ - failedCodeInputAttemptCount: number; - email?: components["schemas"]["email"]; - phoneNumber?: components["schemas"]["phoneNumber"]; - }; - } - | { - /** @enum {string} */ - status?: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR"; - /** @example 2 */ - failedCodeInputAttemptCount?: number; - /** @example 5 */ - maximumCodeInputAttempts?: number; - } - | { - /** @enum {string} */ - status?: "RESTART_FLOW_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example true */ + createdNewUser?: boolean; + user?: components["schemas"]["authRecipeUser"]; + recipeUserId?: components["schemas"]["userId"]; + consumedDevice?: { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + /** @example 2 */ + failedCodeInputAttemptCount: number; + email?: components["schemas"]["email"]; + phoneNumber?: components["schemas"]["phoneNumber"]; + }; + } | { + /** @enum {string} */ + status: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR"; + /** @example 2 */ + failedCodeInputAttemptCount?: number; + /** @example 5 */ + maximumCodeInputAttempts?: number; + } | { + /** @enum {string} */ + status: "RESTART_FLOW_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -4603,19 +4554,16 @@ export interface operations { }; requestBody?: { content: { - "application/json": - | { - email: components["schemas"]["email"]; - userInputCode?: components["schemas"]["userInputCode"]; - } - | { - phoneNumber: components["schemas"]["phoneNumber"]; - userInputCode?: components["schemas"]["userInputCode"]; - } - | { - deviceId: components["schemas"]["deviceId"]; - userInputCode?: components["schemas"]["userInputCode"]; - }; + "application/json": { + email: components["schemas"]["email"]; + userInputCode?: components["schemas"]["userInputCode"]; + } | { + phoneNumber: components["schemas"]["phoneNumber"]; + userInputCode?: components["schemas"]["userInputCode"]; + } | { + deviceId: components["schemas"]["deviceId"]; + userInputCode?: components["schemas"]["userInputCode"]; + }; }; }; responses: { @@ -4625,21 +4573,19 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - preAuthSessionId?: components["schemas"]["preAuthSessionId"]; - codeId?: components["schemas"]["codeId"]; - deviceId?: components["schemas"]["deviceId"]; - userInputCode?: components["schemas"]["userInputCode"]; - linkCode?: components["schemas"]["linkCode"]; - timeCreated?: components["schemas"]["timeCreated"]; - codeLifetime?: components["schemas"]["codeLifetime"]; - } - | { - /** @enum {string} */ - status?: "RESTART_FLOW_ERROR" | "USER_INPUT_CODE_ALREADY_USED_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + preAuthSessionId?: components["schemas"]["preAuthSessionId"]; + codeId?: components["schemas"]["codeId"]; + deviceId?: components["schemas"]["deviceId"]; + userInputCode?: components["schemas"]["userInputCode"]; + linkCode?: components["schemas"]["linkCode"]; + timeCreated?: components["schemas"]["timeCreated"]; + codeLifetime?: components["schemas"]["codeLifetime"]; + } | { + /** @enum {string} */ + status: "RESTART_FLOW_ERROR" | "USER_INPUT_CODE_ALREADY_USED_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -4667,13 +4613,11 @@ export interface operations { }; requestBody?: { content: { - "application/json": - | { - codeId: components["schemas"]["codeId"]; - } - | { - preAuthSessionId: components["schemas"]["preAuthSessionId"]; - }; + "application/json": { + codeId: components["schemas"]["codeId"]; + } | { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + }; }; }; responses: { @@ -4684,7 +4628,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; }; }; }; @@ -4729,7 +4673,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; devices?: { preAuthSessionId?: components["schemas"]["preAuthSessionId"]; /** @example 2 */ @@ -4770,13 +4714,11 @@ export interface operations { }; requestBody?: { content: { - "application/json": - | { - email: components["schemas"]["email"]; - } - | { - phoneNumber: components["schemas"]["phoneNumber"]; - }; + "application/json": { + email: components["schemas"]["email"]; + } | { + phoneNumber: components["schemas"]["phoneNumber"]; + }; }; }; responses: { @@ -4787,7 +4729,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; }; }; }; @@ -4828,15 +4770,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - user?: components["schemas"]["authRecipeUser"]; - } - | { - /** @enum {string} */ - status?: "UNKNOWN_USER_ID_ERROR" | "UNKNOWN_EMAIL_ERROR" | "UNKNOWN_PHONE_NUMBER_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + } | { + /** @enum {string} */ + status: "UNKNOWN_USER_ID_ERROR" | "UNKNOWN_EMAIL_ERROR" | "UNKNOWN_PHONE_NUMBER_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -4878,20 +4818,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - /** @enum {string} */ - status?: - | "OK" - | "UNKNOWN_USER_ID_ERROR" - | "EMAIL_ALREADY_EXISTS_ERROR" - | "PHONE_NUMBER_ALREADY_EXISTS_ERROR"; - } - | { - /** @enum {string} */ - status?: "EMAIL_CHANGE_NOT_ALLOWED_ERROR" | "PHONE_NUMBER_CHANGE_NOT_ALLOWED_ERROR"; - reason?: string; - }; + "application/json": { + /** @enum {string} */ + status: "OK" | "UNKNOWN_USER_ID_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR" | "PHONE_NUMBER_ALREADY_EXISTS_ERROR"; + } | { + /** @enum {string} */ + status: "EMAIL_CHANGE_NOT_ALLOWED_ERROR" | "PHONE_NUMBER_CHANGE_NOT_ALLOWED_ERROR"; + reason?: string; + }; }; }; 400: components["responses"]["400"]; @@ -4932,13 +4866,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - user?: components["schemas"]["authRecipeUser"]; - recipeUserId?: components["schemas"]["userId"]; - } - | components["schemas"]["wrongCredentialsResponse"]; + "application/json": { + status: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + recipeUserId?: components["schemas"]["userId"]; + } | components["schemas"]["wrongCredentialsResponse"]; }; }; 400: components["responses"]["400"]; @@ -4979,16 +4911,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - user?: components["schemas"]["authRecipeUser"]; - recipeUserId?: components["schemas"]["userId"]; - } - | { - /** @enum {string} */ - status?: "EMAIL_ALREADY_EXISTS_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + recipeUserId?: components["schemas"]["userId"]; + } | { + /** @enum {string} */ + status: "EMAIL_ALREADY_EXISTS_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -5027,15 +4957,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - user?: components["schemas"]["authRecipeUser"]; - } - | { - /** @enum {string} */ - status?: "UNKNOWN_USER_ID_ERROR" | "UNKNOWN_EMAIL_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + } | { + /** @enum {string} */ + status: "UNKNOWN_USER_ID_ERROR" | "UNKNOWN_EMAIL_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -5077,16 +5005,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - /** @enum {string} */ - status?: "OK" | "UNKNOWN_USER_ID_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR"; - } - | { - /** @enum {string} */ - status?: "EMAIL_CHANGE_NOT_ALLOWED_ERROR"; - reason?: string; - }; + "application/json": { + /** @enum {string} */ + status: "OK" | "UNKNOWN_USER_ID_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR"; + } | { + /** @enum {string} */ + status: "EMAIL_CHANGE_NOT_ALLOWED_ERROR"; + reason?: string; + }; }; }; 400: components["responses"]["400"]; @@ -5127,12 +5053,10 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - token?: components["schemas"]["token"]; - } - | components["schemas"]["unknownUserIdResponse"]; + "application/json": { + status: components["schemas"]["statusOK"]; + token?: components["schemas"]["token"]; + } | components["schemas"]["unknownUserIdResponse"]; }; }; 400: components["responses"]["400"]; @@ -5176,15 +5100,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - userId?: components["schemas"]["userId"]; - } - | { - /** @enum {string} */ - status?: "RESET_PASSWORD_INVALID_TOKEN_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + userId?: components["schemas"]["userId"]; + } | { + /** @enum {string} */ + status: "RESET_PASSWORD_INVALID_TOKEN_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -5227,7 +5149,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; user?: components["schemas"]["authRecipeUser"]; didUserAlreadyExist?: boolean; }; @@ -5270,16 +5192,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - userId?: components["schemas"]["userId"]; - email?: components["schemas"]["email"]; - } - | { - /** @enum {string} */ - status?: "RESET_PASSWORD_INVALID_TOKEN_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + userId?: components["schemas"]["userId"]; + email?: components["schemas"]["email"]; + } | { + /** @enum {string} */ + status: "RESET_PASSWORD_INVALID_TOKEN_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -5321,19 +5241,17 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example true */ - createdNewUser?: boolean; - user?: components["schemas"]["authRecipeUser"]; - recipeUserId?: components["schemas"]["userId"]; - } - | { - /** @enum {string} */ - status?: "EMAIL_CHANGE_NOT_ALLOWED_ERROR"; - reason?: string; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example true */ + createdNewUser?: boolean; + user?: components["schemas"]["authRecipeUser"]; + recipeUserId?: components["schemas"]["userId"]; + } | { + /** @enum {string} */ + status: "EMAIL_CHANGE_NOT_ALLOWED_ERROR"; + reason?: string; + }; }; }; 400: components["responses"]["400"]; @@ -5373,15 +5291,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - user?: components["schemas"]["authRecipeUser"]; - } - | { - /** @enum {string} */ - status?: "UNKNOWN_USER_ID_ERROR" | "UNKNOWN_THIRD_PARTY_USER_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + } | { + /** @enum {string} */ + status: "UNKNOWN_USER_ID_ERROR" | "UNKNOWN_THIRD_PARTY_USER_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -5419,7 +5335,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; users?: components["schemas"]["authRecipeUser"][]; }; }; @@ -5458,15 +5374,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - token?: components["schemas"]["token"]; - } - | { - /** @enum {string} */ - status?: "EMAIL_ALREADY_VERIFIED_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + token?: components["schemas"]["token"]; + } | { + /** @enum {string} */ + status: "EMAIL_ALREADY_VERIFIED_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -5506,7 +5420,7 @@ export interface operations { content: { "application/json": { /** @enum {string} */ - status?: "OK"; + status: "OK"; }; }; }; @@ -5549,16 +5463,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - userId?: components["schemas"]["userId"]; - email?: components["schemas"]["email"]; - } - | { - /** @enum {string} */ - status?: "EMAIL_VERIFICATION_INVALID_TOKEN_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + userId?: components["schemas"]["userId"]; + email?: components["schemas"]["email"]; + } | { + /** @enum {string} */ + status: "EMAIL_VERIFICATION_INVALID_TOKEN_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -5596,7 +5508,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; isVerified?: components["schemas"]["isVerified"]; }; }; @@ -5638,7 +5550,7 @@ export interface operations { content: { "application/json": { /** @enum {string} */ - status?: "OK"; + status: "OK"; }; }; }; @@ -5676,7 +5588,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; metadata?: components["schemas"]["userMetadata"]; }; }; @@ -5720,7 +5632,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; metadata?: components["schemas"]["userMetadata"]; }; }; @@ -5763,7 +5675,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; }; }; }; @@ -5805,13 +5717,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example true */ - didUserAlreadyHaveRole?: boolean; - } - | components["schemas"]["unknownRoleResponse"]; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example true */ + didUserAlreadyHaveRole?: boolean; + } | components["schemas"]["unknownRoleResponse"]; }; }; 400: components["responses"]["400"]; @@ -5852,13 +5762,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example true */ - didUserHaveRole?: boolean; - } - | components["schemas"]["unknownRoleResponse"]; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example true */ + didUserHaveRole?: boolean; + } | components["schemas"]["unknownRoleResponse"]; }; }; 400: components["responses"]["400"]; @@ -5895,7 +5803,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; roles?: components["schemas"]["role"][]; }; }; @@ -5933,12 +5841,10 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - users?: components["schemas"]["userId"][]; - } - | components["schemas"]["unknownRoleResponse"]; + "application/json": { + status: components["schemas"]["statusOK"]; + users?: components["schemas"]["userId"][]; + } | components["schemas"]["unknownRoleResponse"]; }; }; 400: components["responses"]["400"]; @@ -5980,7 +5886,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; /** @example true */ createdNewRole?: boolean; }; @@ -6019,12 +5925,10 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - permissions?: string[]; - } - | components["schemas"]["unknownRoleResponse"]; + "application/json": { + status: components["schemas"]["statusOK"]; + permissions?: string[]; + } | components["schemas"]["unknownRoleResponse"]; }; }; 400: components["responses"]["400"]; @@ -6065,11 +5969,9 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - } - | components["schemas"]["unknownRoleResponse"]; + "application/json": { + status: components["schemas"]["statusOK"]; + } | components["schemas"]["unknownRoleResponse"]; }; }; 400: components["responses"]["400"]; @@ -6106,7 +6008,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; roles?: string[]; }; }; @@ -6149,7 +6051,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; /** @example true */ didRoleExist?: boolean; }; @@ -6187,7 +6089,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; roles?: string[]; }; }; @@ -6238,7 +6140,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; session?: components["schemas"]["session"]; accessToken?: components["schemas"]["cookieInfo"]; refreshToken?: components["schemas"]["cookieInfo"]; @@ -6279,18 +6181,16 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - userDataInDatabase?: components["schemas"]["userDataInDatabase"]; - userDataInJWT?: components["schemas"]["userDataInJWT"]; - userId?: components["schemas"]["userId"]; - expiry?: components["schemas"]["expiry"]; - timeCreated?: components["schemas"]["timeCreated"]; - sessionHandle?: components["schemas"]["handle"]; - tenantId?: components["schemas"]["tenantId"]; - } - | components["schemas"]["unauthorisedMessageResponse"]; + "application/json": { + status: components["schemas"]["statusOK"]; + userDataInDatabase?: components["schemas"]["userDataInDatabase"]; + userDataInJWT?: components["schemas"]["userDataInJWT"]; + userId?: components["schemas"]["userId"]; + expiry?: components["schemas"]["expiry"]; + timeCreated?: components["schemas"]["timeCreated"]; + sessionHandle?: components["schemas"]["handle"]; + tenantId?: components["schemas"]["tenantId"]; + } | components["schemas"]["unauthorisedMessageResponse"]; }; }; 400: components["responses"]["400"]; @@ -6318,14 +6218,12 @@ export interface operations { }; requestBody?: { content: { - "application/json": - | { - sessionHandles?: components["schemas"]["sessionHandles"]; - } - | { - userId: components["schemas"]["userId"]; - revokeAcrossAllTenants?: boolean; - }; + "application/json": { + sessionHandles?: components["schemas"]["sessionHandles"]; + } | { + userId: components["schemas"]["userId"]; + revokeAcrossAllTenants?: boolean; + }; }; }; responses: { @@ -6336,7 +6234,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; sessionHandlesRevoked?: components["schemas"]["sessionHandles"]; }; }; @@ -6387,17 +6285,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - session?: components["schemas"]["session"]; - accessToken?: components["schemas"]["cookieInfo"]; - } - | components["schemas"]["unauthorisedMessageResponse"] - | { - status?: components["schemas"]["tryRefreshTokenResponse"]; - message?: components["schemas"]["message"]; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + session?: components["schemas"]["session"]; + accessToken?: components["schemas"]["cookieInfo"]; + } | components["schemas"]["unauthorisedMessageResponse"] | { + status: components["schemas"]["tryRefreshTokenResponse"]; + message?: components["schemas"]["message"]; + }; }; }; 400: components["responses"]["400"]; @@ -6440,22 +6335,19 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - session?: components["schemas"]["session"]; - accessToken?: components["schemas"]["cookieInfo"]; - refreshToken?: components["schemas"]["cookieInfo"]; - antiCsrfToken?: components["schemas"]["token"]; - } - | { - status?: components["schemas"]["tokenTheftResponse"]; - session?: { - handle?: components["schemas"]["handle"]; - userId?: components["schemas"]["userId"]; - }; - } - | components["schemas"]["unauthorisedMessageResponse"]; + "application/json": { + status: components["schemas"]["statusOK"]; + session?: components["schemas"]["session"]; + accessToken?: components["schemas"]["cookieInfo"]; + refreshToken?: components["schemas"]["cookieInfo"]; + antiCsrfToken?: components["schemas"]["token"]; + } | { + status: components["schemas"]["tokenTheftResponse"]; + session?: { + handle?: components["schemas"]["handle"]; + userId?: components["schemas"]["userId"]; + }; + } | components["schemas"]["unauthorisedMessageResponse"]; }; }; 400: components["responses"]["400"]; @@ -6493,7 +6385,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; sessionHandles?: components["schemas"]["sessionHandles"]; }; }; @@ -6536,13 +6428,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - session?: components["schemas"]["session"]; - accessToken?: components["schemas"]["cookieInfo"]; - } - | components["schemas"]["unauthorisedMessageResponse"]; + "application/json": { + status: components["schemas"]["statusOK"]; + session?: components["schemas"]["session"]; + accessToken?: components["schemas"]["cookieInfo"]; + } | components["schemas"]["unauthorisedMessageResponse"]; }; }; 400: components["responses"]["400"]; @@ -6579,12 +6469,10 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - userDataInDatabase?: components["schemas"]["userDataInDatabase"]; - } - | components["schemas"]["unauthorisedMessageResponse"]; + "application/json": { + status: components["schemas"]["statusOK"]; + userDataInDatabase?: components["schemas"]["userDataInDatabase"]; + } | components["schemas"]["unauthorisedMessageResponse"]; }; }; 400: components["responses"]["400"]; @@ -6625,9 +6513,7 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | components["schemas"]["statusOKResponse"] - | components["schemas"]["unauthorisedMessageResponse"]; + "application/json": components["schemas"]["statusOKResponse"] | components["schemas"]["unauthorisedMessageResponse"]; }; }; 400: components["responses"]["400"]; @@ -6675,16 +6561,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c */ - jwt?: string; - } - | { - /** @enum {string} */ - status?: "UNSUPPORTED_ALGORITHM_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c */ + jwt?: string; + } | { + /** @enum {string} */ + status: "UNSUPPORTED_ALGORITHM_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -6720,12 +6604,10 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - userDataInJWT?: components["schemas"]["userDataInJWT"]; - } - | components["schemas"]["unauthorisedMessageResponse"]; + "application/json": { + status: components["schemas"]["statusOK"]; + userDataInJWT?: components["schemas"]["userDataInJWT"]; + } | components["schemas"]["unauthorisedMessageResponse"]; }; }; 400: components["responses"]["400"]; @@ -6766,9 +6648,7 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | components["schemas"]["statusOKResponse"] - | components["schemas"]["unauthorisedMessageResponse"]; + "application/json": components["schemas"]["statusOKResponse"] | components["schemas"]["unauthorisedMessageResponse"]; }; }; 400: components["responses"]["400"]; @@ -6796,23 +6676,21 @@ export interface operations { }; requestBody?: { content: { - "application/json": - | { - /** @example test@example.com */ - email?: string; - /** @example password@123 */ - newPassword?: string; - /** @example test2@example.com */ - newEmail?: string; - } - | { - /** @example ue21r-fw32r3-d121-d1 */ - userId?: string; - /** @example password@123 */ - newPassword?: string; - /** @example test2@example.com */ - newEmail?: string; - }; + "application/json": { + /** @example test@example.com */ + email?: string; + /** @example password@123 */ + newPassword?: string; + /** @example test2@example.com */ + newEmail?: string; + } | { + /** @example ue21r-fw32r3-d121-d1 */ + userId?: string; + /** @example password@123 */ + newPassword?: string; + /** @example test2@example.com */ + newEmail?: string; + }; }; }; responses: { @@ -6822,37 +6700,32 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - /** @enum {string} */ - status?: "OK"; - user?: { - /** @example r23r-f235th54-g3413gf-r32dr2 */ - userId?: string; - /** @example test@example.com */ - email?: string; - /** @example 391238234792 */ - timeCreated?: number; - }; - } - | { - /** @enum {string} */ - status?: "EMAIL_ALREADY_EXISTS_ERROR"; - } - | { - /** @enum {string} */ - status?: "PASSWORD_WEAK_ERROR"; - /** @example Your password must have at least 8 characters */ - message?: string; - } - | { - /** @enum {string} */ - status?: "INVALID_EMAIL_ERROR"; - } - | { - /** @enum {string} */ - status?: "UNKNOWN_USER_ERROR"; - }; + "application/json": { + /** @enum {string} */ + status: "OK"; + user?: { + /** @example r23r-f235th54-g3413gf-r32dr2 */ + userId?: string; + /** @example test@example.com */ + email?: string; + /** @example 391238234792 */ + timeCreated?: number; + }; + } | { + /** @enum {string} */ + status: "EMAIL_ALREADY_EXISTS_ERROR"; + } | { + /** @enum {string} */ + status: "PASSWORD_WEAK_ERROR"; + /** @example Your password must have at least 8 characters */ + message?: string; + } | { + /** @enum {string} */ + status: "INVALID_EMAIL_ERROR"; + } | { + /** @enum {string} */ + status: "UNKNOWN_USER_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -6895,33 +6768,29 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - /** @enum {string} */ - status?: "OK"; - user?: { - /** @example example-userid */ - userId?: string; - /** @example test@example.com */ - email?: string; - /** @example 1231321231 */ - timeCreated?: number; - }; - } - | { - /** @enum {string} */ - status?: "EMAIL_ALREADY_EXISTS_ERROR"; - } - | { - /** @enum {string} */ - status?: "PASSWORD_WEAK_ERROR"; - /** @example Your password must have at least 8 characters */ - message?: string; - } - | { - /** @enum {string} */ - status?: "INVALID_EMAIL_ERROR"; - }; + "application/json": { + /** @enum {string} */ + status: "OK"; + user?: { + /** @example example-userid */ + userId?: string; + /** @example test@example.com */ + email?: string; + /** @example 1231321231 */ + timeCreated?: number; + }; + } | { + /** @enum {string} */ + status: "EMAIL_ALREADY_EXISTS_ERROR"; + } | { + /** @enum {string} */ + status: "PASSWORD_WEAK_ERROR"; + /** @example Your password must have at least 8 characters */ + message?: string; + } | { + /** @enum {string} */ + status: "INVALID_EMAIL_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -6934,7 +6803,7 @@ export interface operations { content: { "application/json": { /** @enum {string} */ - status?: "USER_LIMIT_REACHED_ERROR"; + status: "USER_LIMIT_REACHED_ERROR"; /** @example You have reached the free limit for creating users, please purchase the dashboard feature to create new users */ message?: string; }; @@ -6973,7 +6842,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; didUserExist?: boolean; }; }; @@ -7011,7 +6880,7 @@ export interface operations { content: { "application/json": { /** @enum {string} */ - status?: "OK"; + status: "OK"; users?: { /** @example test@example.com */ email?: string; @@ -7063,22 +6932,19 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - /** @enum {string} */ - status?: "OK"; - email?: string; - } - | { - /** @enum {string} */ - status?: "USER_SUSPENDED_ERROR"; - /** @example You have crossed the free dashboard user limit. Please purchase the dashboard feature or login with a valid user account */ - message?: string; - } - | { - /** @enum {string} */ - status?: "INVAlID_SESSION_ERROR"; - }; + "application/json": { + /** @enum {string} */ + status: "OK"; + email?: string; + } | { + /** @enum {string} */ + status: "USER_SUSPENDED_ERROR"; + /** @example You have crossed the free dashboard user limit. Please purchase the dashboard feature or login with a valid user account */ + message?: string; + } | { + /** @enum {string} */ + status: "INVAlID_SESSION_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -7115,7 +6981,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; }; }; }; @@ -7159,23 +7025,20 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - /** @enum {string} */ - status?: "OK"; - /** @example null */ - sessionId?: string; - } - | { - /** @enum {string} */ - status?: "USER_SUSPENDED_ERROR"; - /** @example You have crossed the free dashboard user limit. Please purchase the dashboard feature or login with a valid user account */ - message?: string; - } - | { - /** @enum {string} */ - status?: "INVAlID_CREDENTIALS_ERROR"; - }; + "application/json": { + /** @enum {string} */ + status: "OK"; + /** @example null */ + sessionId?: string; + } | { + /** @enum {string} */ + status: "USER_SUSPENDED_ERROR"; + /** @example You have crossed the free dashboard user limit. Please purchase the dashboard feature or login with a valid user account */ + message?: string; + } | { + /** @enum {string} */ + status: "INVAlID_CREDENTIALS_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -7287,16 +7150,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example /usr/lib/supertokens/config.yaml */ - path?: string; - } - | { - /** @enum {string} */ - status?: "NOT_ALLOWED"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example /usr/lib/supertokens/config.yaml */ + path?: string; + } | { + /** @enum {string} */ + status: "NOT_ALLOWED"; + }; }; }; 400: components["responses"]["400"]; @@ -7393,19 +7254,17 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - /** @enum {boolean} */ - exists?: true; - /** @example 99c87c72-1807-22d-9b39-7a88f95re56c */ - telemetryId?: string; - } - | { - /** @example [ - * false - * ] */ - exists?: boolean; - }; + "application/json": { + /** @enum {boolean} */ + exists?: true; + /** @example 99c87c72-1807-22d-9b39-7a88f95re56c */ + telemetryId?: string; + } | { + /** @example [ + * false + * ] */ + exists?: boolean; + }; }; }; 400: components["responses"]["400"]; @@ -7443,7 +7302,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; /** @example 1000000 */ count?: number; }; @@ -7481,7 +7340,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; /** @example 100000 */ count?: number; }; @@ -7529,7 +7388,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; users?: { user?: components["schemas"]["authRecipeUser"]; }[]; @@ -7575,7 +7434,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; }; }; }; @@ -7608,7 +7467,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; tags?: string[]; }; }; @@ -7643,13 +7502,13 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; /** @example [ * "feature_1", * "feature_2" * ] */ features?: string[]; - usageStats?: Record; + usageStats?: Record; }; }; }; @@ -7682,16 +7541,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example eyJhbGciOiJIUzI1NiIsIn... */ - licenseKey?: string; - } - | { - /** @enum {string} */ - status?: "NO_LICENSE_KEY_FOUND_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example eyJhbGciOiJIUzI1NiIsIn... */ + licenseKey?: string; + } | { + /** @enum {string} */ + status: "NO_LICENSE_KEY_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -7729,18 +7586,15 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - } - | { - /** @enum {string} */ - status?: "MISSING_EE_FOLDER_ERROR"; - } - | { - /** @enum {string} */ - status?: "INVALID_LICENSE_KEY_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + } | { + /** @enum {string} */ + status: "MISSING_EE_FOLDER_ERROR"; + } | { + /** @enum {string} */ + status: "INVALID_LICENSE_KEY_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -7772,7 +7626,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; }; }; }; @@ -7806,15 +7660,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - user?: components["schemas"]["authRecipeUser"]; - } - | { - /** @enum {string} */ - status?: "UNKNOWN_USER_ID_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + } | { + /** @enum {string} */ + status: "UNKNOWN_USER_ID_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -7853,7 +7705,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; users?: components["schemas"]["authRecipeUser"][]; }; }; @@ -7888,7 +7740,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; /** @example 16382348 */ atMinute?: number; averageRequestsPerSecond?: number[]; @@ -8457,14 +8309,12 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | ({ - status?: components["schemas"]["statusOK"]; - } & components["schemas"]["tenantConfig"]) - | { - /** @enum {string} */ - status?: "TENANT_NOT_FOUND_ERROR"; - }; + "application/json": ({ + status: components["schemas"]["statusOK"]; + } & components["schemas"]["tenantConfig"]) | { + /** @enum {string} */ + status: "TENANT_NOT_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -8499,14 +8349,12 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | ({ - status?: components["schemas"]["statusOK"]; - } & components["schemas"]["tenantConfigV2"]) - | { - /** @enum {string} */ - status?: "TENANT_NOT_FOUND_ERROR"; - }; + "application/json": ({ + status: components["schemas"]["statusOK"]; + } & components["schemas"]["tenantConfigV2"]) | { + /** @enum {string} */ + status: "TENANT_NOT_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -8727,16 +8575,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status: components["schemas"]["statusOK"]; - createdNew: boolean; - } - | { - /** @enum {string} */ - status: "CONFIG_VALIDATION_ERROR"; - reason: string; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + createdNew: boolean; + } | { + /** @enum {string} */ + status: "CONFIG_VALIDATION_ERROR"; + reason: string; + }; }; }; 400: components["responses"]["400"]; @@ -8778,7 +8624,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; didConfigExist?: boolean; }; }; @@ -8821,24 +8667,17 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status: components["schemas"]["statusOK"]; - wasAlreadyAssociated: boolean; - } - | { - /** @enum {string} */ - status: - | "UNKNOWN_USER_ID_ERROR" - | "EMAIL_ALREADY_EXISTS_ERROR" - | "PHONE_NUMBER_ALREADY_EXISTS_ERROR" - | "THIRD_PARTY_USER_ALREADY_EXISTS_ERROR"; - } - | { - /** @enum {string} */ - status?: "ASSOCIATION_NOT_ALLOWED_ERROR"; - reason?: string; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + wasAlreadyAssociated: boolean; + } | { + /** @enum {string} */ + status: "UNKNOWN_USER_ID_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR" | "PHONE_NUMBER_ALREADY_EXISTS_ERROR" | "THIRD_PARTY_USER_ALREADY_EXISTS_ERROR"; + } | { + /** @enum {string} */ + status: "ASSOCIATION_NOT_ALLOWED_ERROR"; + reason?: string; + }; }; }; 400: components["responses"]["400"]; @@ -8920,11 +8759,9 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | ({ - status?: components["schemas"]["statusOK"]; - } & components["schemas"]["oauthClient"]) - | components["schemas"]["oauthError"]; + "application/json": ({ + status: components["schemas"]["statusOK"]; + } & components["schemas"]["oauthClient"]) | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -8963,11 +8800,9 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | ({ - status?: components["schemas"]["statusOK"]; - } & components["schemas"]["oauthClient"]) - | components["schemas"]["oauthError"]; + "application/json": ({ + status: components["schemas"]["statusOK"]; + } & components["schemas"]["oauthClient"]) | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9006,11 +8841,9 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | ({ - status?: components["schemas"]["statusOK"]; - } & components["schemas"]["oauthClient"]) - | components["schemas"]["oauthError"]; + "application/json": ({ + status: components["schemas"]["statusOK"]; + } & components["schemas"]["oauthClient"]) | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9049,13 +8882,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - clients?: components["schemas"]["oauthClient"][]; - nextPaginationToken?: string; - } - | components["schemas"]["oauthError"]; + "application/json": { + status: components["schemas"]["statusOK"]; + clients?: components["schemas"]["oauthClient"][]; + nextPaginationToken?: string; + } | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9097,13 +8928,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example true */ - didExist?: boolean; - } - | components["schemas"]["oauthError"]; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example true */ + didExist?: boolean; + } | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9140,61 +8969,59 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - client?: components["schemas"]["oauthClient"]; - requestedScope?: string[]; - requestedAudience?: string[]; - requestedClaims?: { - idToken?: { - property1?: string; - property2?: string; - }; - }; - loginHint?: string; - uiLocales?: string[]; - acrValues?: string[]; - subject?: string; - requestUrl?: string; - skip?: boolean; - clientId?: string; - redirectUri?: string; - forceSubjectIdentifier?: string; - requestedAccessTokenAudience?: string[]; - context?: Record; - sessionId?: string; - loginSessionId?: string; - loginChallenge?: string; - loginRequestedAt?: string; - consentRequestedAt?: string; - consentChallenge?: string; - consentSkip?: boolean; - consentRemember?: boolean; - consentRememberFor?: number; - consentError?: { - name?: string; - description?: string; - }; - consentErrorDebug?: string; - consentErrorDescription?: string; - consentErrorHint?: string; - consentErrorCode?: string; - consentStatusCode?: number; - sessionIdToken?: { - property1?: string; - property2?: string; - }; - sessionAccessToken?: { - property1?: string; - property2?: string; - }; - sessionToken?: { - property1?: string; - property2?: string; - }; - } - | components["schemas"]["oauthError"]; + "application/json": { + status: components["schemas"]["statusOK"]; + client?: components["schemas"]["oauthClient"]; + requestedScope?: string[]; + requestedAudience?: string[]; + requestedClaims?: { + idToken?: { + property1?: string; + property2?: string; + }; + }; + loginHint?: string; + uiLocales?: string[]; + acrValues?: string[]; + subject?: string; + requestUrl?: string; + skip?: boolean; + clientId?: string; + redirectUri?: string; + forceSubjectIdentifier?: string; + requestedAccessTokenAudience?: string[]; + context?: Record; + sessionId?: string; + loginSessionId?: string; + loginChallenge?: string; + loginRequestedAt?: string; + consentRequestedAt?: string; + consentChallenge?: string; + consentSkip?: boolean; + consentRemember?: boolean; + consentRememberFor?: number; + consentError?: { + name?: string; + description?: string; + }; + consentErrorDebug?: string; + consentErrorDescription?: string; + consentErrorHint?: string; + consentErrorCode?: string; + consentStatusCode?: number; + sessionIdToken?: { + property1?: string; + property2?: string; + }; + sessionAccessToken?: { + property1?: string; + property2?: string; + }; + sessionToken?: { + property1?: string; + property2?: string; + }; + } | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9226,7 +9053,7 @@ export interface operations { requestBody?: { content: { "application/json": { - context?: Record; + context?: Record; grantAccessTokenAudience?: string[]; grantScope?: string[]; /** @@ -9254,13 +9081,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example {apiDomain}/oauth/consent?... */ - redirectTo?: string; - } - | components["schemas"]["oauthError"]; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example {apiDomain}/oauth/consent?... */ + redirectTo?: string; + } | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9308,13 +9133,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example {apiDomain}/oauth/consent?... */ - redirectTo?: string; - } - | components["schemas"]["oauthError"]; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example {apiDomain}/oauth/consent?... */ + redirectTo?: string; + } | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9351,26 +9174,24 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - challenge?: string; - client?: components["schemas"]["oauthClient"]; - oidcContext?: { - acrValues?: string[]; - display?: string; - idTokenHintClaims?: Record; - loginHint?: string; - uiLocales?: string[]; - requestUrl?: string; - requestedAccessTokenAudience?: string[]; - requestedScope?: string[]; - sessionId?: string; - skip?: boolean; - subject?: string; - }; - } - | components["schemas"]["oauthError"]; + "application/json": { + status: components["schemas"]["statusOK"]; + challenge?: string; + client?: components["schemas"]["oauthClient"]; + oidcContext?: { + acrValues?: string[]; + display?: string; + idTokenHintClaims?: Record; + loginHint?: string; + uiLocales?: string[]; + requestUrl?: string; + requestedAccessTokenAudience?: string[]; + requestedScope?: string[]; + sessionId?: string; + skip?: boolean; + subject?: string; + }; + } | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9424,13 +9245,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example {apiDomain}/oauth/login?... */ - redirectTo?: string; - } - | components["schemas"]["oauthError"]; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example {apiDomain}/oauth/login?... */ + redirectTo?: string; + } | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9478,13 +9297,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example {apiDomain}/oauth/login?... */ - redirectTo?: string; - } - | components["schemas"]["oauthError"]; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example {apiDomain}/oauth/login?... */ + redirectTo?: string; + } | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9525,13 +9342,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example {apiDomain}/oauth/logout?... */ - redirectTo?: string; - } - | components["schemas"]["oauthError"]; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example {apiDomain}/oauth/logout?... */ + redirectTo?: string; + } | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9572,11 +9387,9 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - } - | components["schemas"]["oauthError"]; + "application/json": { + status: components["schemas"]["statusOK"]; + } | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9617,13 +9430,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example true */ - didExist?: boolean; - } - | components["schemas"]["oauthError"]; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example true */ + didExist?: boolean; + } | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9664,13 +9475,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example true */ - didExist?: boolean; - } - | components["schemas"]["oauthError"]; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example true */ + didExist?: boolean; + } | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9712,13 +9521,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example true */ - didExist?: boolean; - } - | components["schemas"]["oauthError"]; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example true */ + didExist?: boolean; + } | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9753,11 +9560,9 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | ({ - status?: components["schemas"]["statusOK"]; - } & components["schemas"]["oauthClient"]) - | components["schemas"]["oauthError"]; + "application/json": ({ + status: components["schemas"]["statusOK"]; + } & components["schemas"]["oauthClient"]) | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9790,7 +9595,7 @@ export interface operations { /** @example https://api.auth.com */ iss?: string; /** @example {} */ - inputBody?: Record; + inputBody?: Record; /** @example false */ useStaticSigningKey?: boolean; /** @example Bearer 1234567890 */ @@ -9805,23 +9610,21 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status: components["schemas"]["statusOK"]; - /** @example eyJraWQiOiJzLTBjZmVmMDdkLWQ2NDktNGIwOC04MTVjLWJkYjZlYTczNWQyZCIsInR5cCI6IkpXVCIsImFsZyI6IlJTMjU2In0.eyJpYXQiOjE3NDAzODU5MzcsImV4cCI6MTc0MDM4OTUzOCwiY2xpZW50X2lkIjoic3RjbF82NWUwODc1Mi0yYzU5LTQ5NjQtOTM0Yy02OTIwZDJmMDZlNjIiLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjMwMDEvYXV0aCIsImp0aSI6Ijc1NTc2MmFmLTUwYTUtNDc1ZS04YWRkLTg3MDA1ZmU3YWJlNiIsIm5iZiI6MTc0MDM4NTkzNywic2NwIjpbIm9wZW5pZCIsIm9mZmxpbmVfYWNjZXNzIl0sInN1YiI6InNvbWV1c2VyaWQiLCJzdHQiOjEsImdpZCI6ImRjOGQ0OGUzLTcwOTgtNDhhNi1hYjU0LTgxMWMyODQ4N2I4MiIsInRJZCI6InB1YmxpYyIsInJzdWIiOiJzb21ldXNlcmlkIiwic2Vzc2lvbkhhbmRsZSI6InNlc3Npb24taGFuZGxlIn0.DgVgtD2gXgzHrDsC2lIUBa-wsYm8KO4Pg8L1Ov3aSBVgjwtjiCO40ldjBZ9qKdQBq5Qqk0ElAZNj6Bzc40ESfQumLH3_N2XtOj568s71JPuEOIg5hs9XAdK4vYfXMhVQRWn9iPUKHKrpRVf73IIH0mpkN8i6_MhcDoMMOuG5XPlXajG9VOyoY_5saHA61-uTafZLdAgKqnmYGvS8KmNEcEbBWLGwFB4QQKiDAUvatIi5n3juFBUxyt9t6DrqT1D04shesRppa0XhCZbCFBv1dixSrprdtqKhlPOrMgvOGNZ3cBLbYBOG9zoJRD5YlVMGw-j_pE7IbvpDWKL7tTJS1Q */ - access_token: string; - /** @example 3599 */ - expires_in?: number; - /** @example eyJraWQiOiJzLTBjZmVmMDdkLWQ2NDktNGIwOC04MTVjLWJkYjZlYTczNWQyZCIsInR5cCI6IkpXVCIsImFsZyI6IlJTMjU2In0.eyJpYXQiOjE3NDAzODU5MzgsImV4cCI6MTc0MDM4OTUzOCwiYXRfaGFzaCI6IkNxOGNCSk01Nm5FcG9aaWREcnZvLVEiLCJhdWQiOiJzdGNsXzY1ZTA4NzUyLTJjNTktNDk2NC05MzRjLTY5MjBkMmYwNmU2MiIsImF1dGhfdGltZSI6MTc0MDM4NTkzNywiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDozMDAxL2F1dGgiLCJqdGkiOiIxZDA5OGUxZi04ZGIxLTQyNzUtYmMzYS0zYTA4NjdjOWE2NTAiLCJyYXQiOjE3NDAzODU3MzEsInNpZCI6InNlc3Npb24taGFuZGxlIiwic3ViIjoic29tZXVzZXJpZCIsInN0dCI6MiwiZ2lkIjoiYzk1OTVjYjItMWFjOS00MDI0LWFjNjMtNDJlZDEyODliY2RmIn0.PGsemf1qpLF-cE_616NHvKsRmanFiyba0yqF2j5fy87AWD5McI405A4eqi-wAlKsDxC-MPpuW8bx-08YUhs3x6ku4aFaDyA-M-Xhc65fJJ4SCPVaUL7qlUwl7wJwNs2rMRW3Ayyj4MDSlW5uqm39_K_bBqod2Qj1yqck-N0g78qh86uEcyX6Al3d5KSln1B21nwDsEgegk3xzE8lFMCQUTpZEYb5-1v2D0Bu_PblBfOCjA6mBtT1IIQkmSE27FvkTUS1H50EUyhFP4JH30kP3bUnQ9pOqGMTe405N2ruKtPyWsXHLPlQ4hcJCLO5GT5ZgtUjfz6Y3mCM9l69uDYDHg */ - id_token?: string; - /** @example st_rt_d7LI9mGYHF2TAaVEFJi7fqOWo8ZQ8zEGpuxhHQs0R18.UZ0nbTuuYuDD8G54PCD8AKHdsh9cezu8BTxVlTy7pYw */ - refresh_token?: string; - /** @example openid offline_access */ - scope?: string; - /** @example bearer */ - token_type?: string; - } - | components["schemas"]["oauthError"]; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example eyJraWQiOiJzLTBjZmVmMDdkLWQ2NDktNGIwOC04MTVjLWJkYjZlYTczNWQyZCIsInR5cCI6IkpXVCIsImFsZyI6IlJTMjU2In0.eyJpYXQiOjE3NDAzODU5MzcsImV4cCI6MTc0MDM4OTUzOCwiY2xpZW50X2lkIjoic3RjbF82NWUwODc1Mi0yYzU5LTQ5NjQtOTM0Yy02OTIwZDJmMDZlNjIiLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjMwMDEvYXV0aCIsImp0aSI6Ijc1NTc2MmFmLTUwYTUtNDc1ZS04YWRkLTg3MDA1ZmU3YWJlNiIsIm5iZiI6MTc0MDM4NTkzNywic2NwIjpbIm9wZW5pZCIsIm9mZmxpbmVfYWNjZXNzIl0sInN1YiI6InNvbWV1c2VyaWQiLCJzdHQiOjEsImdpZCI6ImRjOGQ0OGUzLTcwOTgtNDhhNi1hYjU0LTgxMWMyODQ4N2I4MiIsInRJZCI6InB1YmxpYyIsInJzdWIiOiJzb21ldXNlcmlkIiwic2Vzc2lvbkhhbmRsZSI6InNlc3Npb24taGFuZGxlIn0.DgVgtD2gXgzHrDsC2lIUBa-wsYm8KO4Pg8L1Ov3aSBVgjwtjiCO40ldjBZ9qKdQBq5Qqk0ElAZNj6Bzc40ESfQumLH3_N2XtOj568s71JPuEOIg5hs9XAdK4vYfXMhVQRWn9iPUKHKrpRVf73IIH0mpkN8i6_MhcDoMMOuG5XPlXajG9VOyoY_5saHA61-uTafZLdAgKqnmYGvS8KmNEcEbBWLGwFB4QQKiDAUvatIi5n3juFBUxyt9t6DrqT1D04shesRppa0XhCZbCFBv1dixSrprdtqKhlPOrMgvOGNZ3cBLbYBOG9zoJRD5YlVMGw-j_pE7IbvpDWKL7tTJS1Q */ + access_token: string; + /** @example 3599 */ + expires_in?: number; + /** @example eyJraWQiOiJzLTBjZmVmMDdkLWQ2NDktNGIwOC04MTVjLWJkYjZlYTczNWQyZCIsInR5cCI6IkpXVCIsImFsZyI6IlJTMjU2In0.eyJpYXQiOjE3NDAzODU5MzgsImV4cCI6MTc0MDM4OTUzOCwiYXRfaGFzaCI6IkNxOGNCSk01Nm5FcG9aaWREcnZvLVEiLCJhdWQiOiJzdGNsXzY1ZTA4NzUyLTJjNTktNDk2NC05MzRjLTY5MjBkMmYwNmU2MiIsImF1dGhfdGltZSI6MTc0MDM4NTkzNywiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDozMDAxL2F1dGgiLCJqdGkiOiIxZDA5OGUxZi04ZGIxLTQyNzUtYmMzYS0zYTA4NjdjOWE2NTAiLCJyYXQiOjE3NDAzODU3MzEsInNpZCI6InNlc3Npb24taGFuZGxlIiwic3ViIjoic29tZXVzZXJpZCIsInN0dCI6MiwiZ2lkIjoiYzk1OTVjYjItMWFjOS00MDI0LWFjNjMtNDJlZDEyODliY2RmIn0.PGsemf1qpLF-cE_616NHvKsRmanFiyba0yqF2j5fy87AWD5McI405A4eqi-wAlKsDxC-MPpuW8bx-08YUhs3x6ku4aFaDyA-M-Xhc65fJJ4SCPVaUL7qlUwl7wJwNs2rMRW3Ayyj4MDSlW5uqm39_K_bBqod2Qj1yqck-N0g78qh86uEcyX6Al3d5KSln1B21nwDsEgegk3xzE8lFMCQUTpZEYb5-1v2D0Bu_PblBfOCjA6mBtT1IIQkmSE27FvkTUS1H50EUyhFP4JH30kP3bUnQ9pOqGMTe405N2ruKtPyWsXHLPlQ4hcJCLO5GT5ZgtUjfz6Y3mCM9l69uDYDHg */ + id_token?: string; + /** @example st_rt_d7LI9mGYHF2TAaVEFJi7fqOWo8ZQ8zEGpuxhHQs0R18.UZ0nbTuuYuDD8G54PCD8AKHdsh9cezu8BTxVlTy7pYw */ + refresh_token?: string; + /** @example openid offline_access */ + scope?: string; + /** @example bearer */ + token_type?: string; + } | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9861,13 +9664,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example {apiDomain}/oauth/logout?... */ - redirectTo?: string; - } - | components["schemas"]["oauthError"]; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example {apiDomain}/oauth/logout?... */ + redirectTo?: string; + } | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9908,45 +9709,43 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - active?: boolean; - /** @example 1740992368 */ - iat?: number; - /** @example 1740995969 */ - exp?: number; - /** @example stcl_fed7cff0-cc6e-406e-b7a6-766148675a4a */ - client_id?: string; - /** @example http://localhost:3001/auth */ - iss?: string; - /** @example 1c229efe-c55b-44c1-98cf-9fa3a366502e */ - jti?: string; - /** @example 1740992368 */ - nbf?: number; - /** @example [ - * "openid", - * "offline_access" - * ] */ - scp?: string[]; - /** @example 137d053d-0d69-4dea-8a19-06ddbdfa4f96 */ - sub?: string; - /** @example 1 */ - stt?: number; - /** @example 87bcc2d8-f159-4e10-a097-0898179a2d7d */ - sessionHandle?: string; - /** @example 137d053d-0d69-4dea-8a19-06ddbdfa4f96 */ - rsub?: string; - /** @example public */ - tId?: string; - /** @example 575b7130-d982-4945-be49-3ecde2a49eaa */ - gid?: string; - /** @example Bearer */ - token_type?: string; - /** @example access_token */ - token_use?: string; - } - | components["schemas"]["oauthError"]; + "application/json": { + status: components["schemas"]["statusOK"]; + active?: boolean; + /** @example 1740992368 */ + iat?: number; + /** @example 1740995969 */ + exp?: number; + /** @example stcl_fed7cff0-cc6e-406e-b7a6-766148675a4a */ + client_id?: string; + /** @example http://localhost:3001/auth */ + iss?: string; + /** @example 1c229efe-c55b-44c1-98cf-9fa3a366502e */ + jti?: string; + /** @example 1740992368 */ + nbf?: number; + /** @example [ + * "openid", + * "offline_access" + * ] */ + scp?: string[]; + /** @example 137d053d-0d69-4dea-8a19-06ddbdfa4f96 */ + sub?: string; + /** @example 1 */ + stt?: number; + /** @example 87bcc2d8-f159-4e10-a097-0898179a2d7d */ + sessionHandle?: string; + /** @example 137d053d-0d69-4dea-8a19-06ddbdfa4f96 */ + rsub?: string; + /** @example public */ + tId?: string; + /** @example 575b7130-d982-4945-be49-3ecde2a49eaa */ + gid?: string; + /** @example Bearer */ + token_type?: string; + /** @example access_token */ + token_use?: string; + } | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9963,7 +9762,7 @@ export interface operations { paginationToken?: components["parameters"]["paginationToken"]; /** @example 1 */ limit?: components["parameters"]["limit"]; - status?: components["parameters"]["bulkImportUserStatus"]; + status: components["parameters"]["bulkImportUserStatus"]; }; header?: { /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ @@ -9986,7 +9785,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; users?: components["schemas"]["bulkImportUserResponse"][]; nextPaginationToken?: components["schemas"]["paginationToken"]; }; @@ -10028,7 +9827,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; users?: components["schemas"]["addBulkImportUserResponse"]; }; }; @@ -10133,26 +9932,20 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - credential?: { - /** @example ea7a0931-b533-4478-9253-0fde890ca23 */ - webauthnCredentialId?: string; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - recipeUserId?: string; - /** @example example.com */ - relyingPartyId?: string; - /** @example 1741793746 */ - createdAt?: number; - /** @example 1741793746 */ - updatedAt?: number; - }; - } - | { - /** @enum {string} */ - status?: "CREDENTIAL_NOT_FOUND_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example ea7a0931-b533-4478-9253-0fde890ca23 */ + webauthnCredentialId?: string; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId?: string; + /** @example example.com */ + relyingPartyId?: string; + /** @example 1741793746 */ + createdAt?: number; + } | { + /** @enum {string} */ + status: "CREDENTIAL_NOT_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10189,16 +9982,16 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; credentials?: { /** @example ea7a0931-b533-4478-9253-0fde890ca23 */ - webauthnCredentialId?: string; + webauthnCredentialId: string; /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - recipeUserId?: string; + recipeUserId: string; /** @example example.com */ - relyingPartyId?: string; + relyingPartyId: string; /** @example 1741793746 */ - createdAt?: number; + createdAt: number; /** @example 1741793746 */ updatedAt?: number; }[]; @@ -10239,7 +10032,7 @@ export interface operations { }; content: { "application/json": { - status?: components["schemas"]["statusOK"]; + status: components["schemas"]["statusOK"]; /** @example fa7a0841-b533-4478-9253-0fde890c576 */ webauthnGeneratedOptionsId?: string; /** @example example.com */ @@ -10249,13 +10042,12 @@ export interface operations { /** @example TQvEVDV8B64w_2zIifzKaPzBPfthqpx2uJkq_2PIB0k */ challenge?: string; /** @example 10000 */ - timeout?: number; + timeout?: string; /** @example http://example.com */ origin?: string; /** @example email@example.com */ email?: string; - /** @example required */ - userVerification?: string; + userVerification?: components["schemas"]["userVerification"]; /** @example true */ userPresence?: boolean; /** @example 1741793746 */ @@ -10298,17 +10090,15 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - recipeUserId?: string; - user?: components["schemas"]["authRecipeUser"]; - } - | { - /** @enum {string} */ - status?: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId?: string; + user?: components["schemas"]["authRecipeUser"]; + } | { + /** @enum {string} */ + status: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10348,15 +10138,14 @@ export interface operations { origin: string; /** @example 10000 */ timeout?: number; - /** @example preferred */ - userVerification?: string; + userVerification?: components["schemas"]["userVerification"]; /** @example false */ userPresence?: boolean; /** @example none */ attestation?: string; /** @example required */ residentKey?: string; - supportedAlgorithmIDs?: number[]; + supportedAlgorithmIds?: number[]; }; }; }; @@ -10367,59 +10156,56 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - webauthnGeneratedOptionsId?: string; - rp?: { - /** @example example.com */ - id?: string; - /** @example Example */ - name?: string; - }; - user?: { - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - id?: string; - /** @example John Doe */ - name?: string; - /** @example John Doe */ - displayName?: string; - }; - email?: components["schemas"]["email"]; - /** @example TQvEVDV8B64w_2zIifzKaPzBPfthqpx2uJkq_2PIB0k */ - challenge?: string; - /** @example 10000 */ - timeout?: number; - /** @example none */ - attestation?: string; - /** @example 1741793746 */ - createdAt?: number; - /** @example 1741793746 */ - expiresAt?: number; - pubKeyCredParams?: { - /** @example public-key */ - type?: string; - /** @example -7 */ - alg?: number; - }[]; - excludeCredentials?: { - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - id?: string; - transport?: string[]; - }[]; - authenticatorSelection?: { - /** @example preferred */ - userVerification?: string; - /** @example true */ - requireResidentKey?: boolean; - }; - } - | { - /** @enum {string} */ - status?: "INVALID_OPTIONS_ERROR"; - reason?: string; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + webauthnGeneratedOptionsId?: string; + rp?: { + /** @example example.com */ + id?: string; + /** @example Example */ + name?: string; + }; + user?: { + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + id?: string; + /** @example John Doe */ + name?: string; + /** @example John Doe */ + displayName?: string; + }; + email?: components["schemas"]["email"]; + /** @example TQvEVDV8B64w_2zIifzKaPzBPfthqpx2uJkq_2PIB0k */ + challenge?: string; + /** @example 10000 */ + timeout?: number; + /** @example none */ + attestation?: string; + /** @example 1741793746 */ + createdAt?: number; + /** @example 1741793746 */ + expiresAt?: number; + pubKeyCredParams?: { + /** @example public-key */ + type?: string; + /** @example -7 */ + alg?: number; + }[]; + excludeCredentials?: { + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + id?: string; + transport?: string[]; + }[]; + authenticatorSelection?: { + userVerification?: components["schemas"]["userVerification"]; + /** @example true */ + requireResidentKey?: boolean; + }; + } | { + /** @enum {string} */ + status: "INVALID_OPTIONS_ERROR"; + reason?: string; + }; }; }; 400: components["responses"]["400"]; @@ -10455,11 +10241,10 @@ export interface operations { /** @example http://example.com */ origin: string; /** @example 10000 */ - timeout: number; - /** @example preferred */ - userVerification: string; + timeout?: number; + userVerification?: components["schemas"]["userVerification"]; /** @example false */ - userPresence: boolean; + userPresence?: boolean; }; }; }; @@ -10470,31 +10255,28 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - webauthnGeneratedOptionsId?: string; - /** @example example.com */ - relyingPartyId?: string; - /** @example TQvEVDV8B64w_2zIifzKaPzBPfthqpx2uJkq_2PIB0k */ - challenge?: string; - /** @example 10000 */ - timeout?: number; - /** @example required */ - userVerification?: string; - /** @example true */ - userPresence?: boolean; - /** @example 1741793746 */ - createdAt?: number; - /** @example 1741793746 */ - expiresAt?: number; - } - | { - /** @enum {string} */ - status?: "INVALID_OPTIONS_ERROR"; - reason?: string; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + webauthnGeneratedOptionsId?: string; + /** @example example.com */ + relyingPartyId?: string; + /** @example TQvEVDV8B64w_2zIifzKaPzBPfthqpx2uJkq_2PIB0k */ + challenge?: string; + /** @example 10000 */ + timeout?: number; + userVerification?: components["schemas"]["userVerification"]; + /** @example true */ + userPresence?: boolean; + /** @example 1741793746 */ + createdAt?: string; + /** @example 1741793746 */ + expiresAt?: string; + } | { + /** @enum {string} */ + status: "INVALID_OPTIONS_ERROR"; + reason?: string; + }; }; }; 400: components["responses"]["400"]; @@ -10527,7 +10309,7 @@ export interface operations { /** @example fa7a0841-b533-4478-9253-0fde890c576 */ webauthnGeneratedOptionsId?: string; /** @description Credential returned by the browser */ - credential?: Record; + credential?: Record; }; }; }; @@ -10538,34 +10320,25 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - webauthnCredentialId?: string; - /** @example example.com */ - relyingPartyId?: string; - /** @example Example */ - relyingPartyName?: string; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - recipeUserId?: string; - email?: components["schemas"]["email"]; - } - | { - /** @enum {string} */ - status?: - | "INVALID_OPTIONS_ERROR" - | "INVALID_AUTHENTICATOR_ERROR" - | "INVALID_CREDENTIALS_ERROR"; - reason?: string; - } - | { - /** @enum {string} */ - status?: - | "OPTIONS_NOT_FOUND_ERROR" - | "CREDENTIAL_ALREADY_EXISTS_ERROR" - | "UNKNOWN_USER_ID_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + webauthnCredentialId?: string; + /** @example example.com */ + relyingPartyId?: string; + /** @example Example */ + relyingPartyName?: string; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId?: string; + email?: components["schemas"]["email"]; + } | { + /** @enum {string} */ + status: "INVALID_AUTHENTICATOR_ERROR"; + reason?: string; + } | { + /** @enum {string} */ + status: "OPTIONS_NOT_FOUND_ERROR" | "INVALID_CREDENTIALS_ERROR" | "INVALID_OPTIONS_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10597,7 +10370,7 @@ export interface operations { /** @example fa7a0841-b533-4478-9253-0fde890c576 */ webauthnGeneratedOptionsId?: string; /** @description Credential returned by the browser */ - credential?: Record; + credential?: Record; }; }; }; @@ -10608,31 +10381,25 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - webauthnCredentialId?: string; - /** @example example.com */ - relyingPartyId?: string; - /** @example Example */ - relyingPartyName?: string; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - recipeUserId?: string; - user?: components["schemas"]["authRecipeUser"]; - } - | { - /** @enum {string} */ - status?: - | "INVALID_OPTIONS_ERROR" - | "INVALID_AUTHENTICATOR_ERROR" - | "INVALID_CREDENTIALS_ERROR"; - reason?: string; - } - | { - /** @enum {string} */ - status?: "OPTIONS_NOT_FOUND_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + webauthnCredentialId?: string; + /** @example example.com */ + relyingPartyId?: string; + /** @example Example */ + relyingPartyName?: string; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId?: string; + user?: components["schemas"]["authRecipeUser"]; + } | { + /** @enum {string} */ + status: "INVALID_OPTIONS_ERROR" | "INVALID_AUTHENTICATOR_ERROR" | "INVALID_CREDENTIALS_ERROR"; + reason?: string; + } | { + /** @enum {string} */ + status: "OPTIONS_NOT_FOUND_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10664,7 +10431,7 @@ export interface operations { /** @example fa7a0841-b533-4478-9253-0fde890c576 */ webauthnGeneratedOptionsId?: string; /** @description Credential returned by the browser */ - credential?: Record; + credential?: Record; }; }; }; @@ -10675,28 +10442,19 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - recipeUserId?: string; - user?: components["schemas"]["authRecipeUser"]; - } - | { - /** @enum {string} */ - status?: - | "INVALID_OPTIONS_ERROR" - | "INVALID_AUTHENTICATOR_ERROR" - | "INVALID_CREDENTIALS_ERROR"; - reason?: string; - } - | { - /** @enum {string} */ - status?: - | "OPTIONS_NOT_FOUND_ERROR" - | "CREDENTIAL_NOT_FOUND_ERROR" - | "UNKNOWN_USER_ID_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId?: string; + user?: components["schemas"]["authRecipeUser"]; + } | { + /** @enum {string} */ + status: "INVALID_OPTIONS_ERROR" | "INVALID_AUTHENTICATOR_ERROR" | "INVALID_CREDENTIALS_ERROR"; + reason?: string; + } | { + /** @enum {string} */ + status: "OPTIONS_NOT_FOUND_ERROR" | "CREDENTIAL_NOT_FOUND_ERROR" | "UNKNOWN_USER_ID_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10737,16 +10495,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - /** @example ZmE3YTA4NDEtYjUzMy00NDc4LTkyNTMtMGZkZTg5MGM1NzY */ - token?: string; - } - | { - /** @enum {string} */ - status?: "UNKNOWN_USER_ID_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + /** @example ZmE3YTA4NDEtYjUzMy00NDc4LTkyNTMtMGZkZTg5MGM1NzY */ + token?: string; + } | { + /** @enum {string} */ + status: "UNKNOWN_USER_ID_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10787,16 +10543,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - userId?: components["schemas"]["userId"]; - email?: components["schemas"]["email"]; - } - | { - /** @enum {string} */ - status?: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + userId?: components["schemas"]["userId"]; + email?: components["schemas"]["email"]; + } | { + /** @enum {string} */ + status: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10837,17 +10591,12 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - } - | { - /** @enum {string} */ - status?: - | "UNKNOWN_USER_ID_ERROR" - | "EMAIL_ALREADY_EXISTS_ERROR" - | "USER_WITH_EMAIL_ALREADY_EXISTS_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + } | { + /** @enum {string} */ + status: "UNKNOWN_USER_ID_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10884,14 +10633,12 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - } - | { - /** @enum {string} */ - status?: "CREDENTIAL_NOT_FOUND_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + } | { + /** @enum {string} */ + status: "CREDENTIAL_NOT_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10927,14 +10674,12 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": - | { - status?: components["schemas"]["statusOK"]; - } - | { - /** @enum {string} */ - status?: "OPTIONS_NOT_FOUND_ERROR"; - }; + "application/json": { + status: components["schemas"]["statusOK"]; + } | { + /** @enum {string} */ + status: "OPTIONS_NOT_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; From 571f48ad527e97082166a8960d47103333139eb6 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Tue, 6 May 2025 13:02:13 +0530 Subject: [PATCH 26/64] Update API spec to match user definition changes in spec --- lib/core/versions/5.3/schema.d.ts | 42 +++++++++++++++---------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/lib/core/versions/5.3/schema.d.ts b/lib/core/versions/5.3/schema.d.ts index 3e526f0b9..021de7a14 100644 --- a/lib/core/versions/5.3/schema.d.ts +++ b/lib/core/versions/5.3/schema.d.ts @@ -2948,35 +2948,35 @@ export type webhooks = Record; export interface components { schemas: { authRecipeUser: { - id?: components["schemas"]["userId"]; + id: components["schemas"]["userId"]; /** @example true */ - isPrimaryUser?: boolean; - tenantIds?: components["schemas"]["tenantId"][]; - timeJoined?: components["schemas"]["timeJoined"]; - emails?: components["schemas"]["email"][]; - phoneNumbers?: components["schemas"]["phoneNumber"][]; - webauthn?: { - credentialIds?: string[]; - }; - thirdParty?: { - id?: components["schemas"]["thirdPartyId"]; - userId?: components["schemas"]["thirdPartyUserId"]; + isPrimaryUser: boolean; + tenantIds: components["schemas"]["tenantId"][]; + timeJoined: components["schemas"]["timeJoined"]; + emails: components["schemas"]["email"][]; + phoneNumbers: components["schemas"]["phoneNumber"][]; + webauthn: { + credentialIds: string[]; + }; + thirdParty: { + id: components["schemas"]["thirdPartyId"]; + userId: components["schemas"]["thirdPartyUserId"]; }[]; - loginMethods?: { - tenantIds?: components["schemas"]["tenantId"][]; - recipeUserId?: components["schemas"]["userId"]; + loginMethods: { + tenantIds: components["schemas"]["tenantId"][]; + recipeUserId: components["schemas"]["userId"]; /** @example true */ - verified?: boolean; - timeJoined?: components["schemas"]["timeJoined"]; - recipeId?: components["schemas"]["recipeId"]; + verified: boolean; + timeJoined: components["schemas"]["timeJoined"]; + recipeId: components["schemas"]["recipeId"]; email?: components["schemas"]["email"]; phoneNumber?: components["schemas"]["phoneNumber"]; thirdParty?: { - id?: components["schemas"]["thirdPartyId"]; - userId?: components["schemas"]["thirdPartyUserId"]; + id: components["schemas"]["thirdPartyId"]; + userId: components["schemas"]["thirdPartyUserId"]; }; webauthn?: { - credentialIds?: string[]; + credentialIds: string[]; }; }[]; }; From ce92ee8239d39d099abe62b17f251430f8325018 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Tue, 6 May 2025 13:51:46 +0530 Subject: [PATCH 27/64] Add fix for user handling in SDK from API --- lib/core/versions/5.3/schema.d.ts | 11 ++++---- .../accountlinking/recipeImplementation.ts | 28 +++++++++---------- lib/ts/user.ts | 7 +++++ 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/lib/core/versions/5.3/schema.d.ts b/lib/core/versions/5.3/schema.d.ts index 021de7a14..9a8683511 100644 --- a/lib/core/versions/5.3/schema.d.ts +++ b/lib/core/versions/5.3/schema.d.ts @@ -3686,20 +3686,19 @@ export interface operations { "application/json": { status: components["schemas"]["statusOK"]; /** @example true */ - wasAlreadyAPrimaryUser?: boolean; - user?: components["schemas"]["authRecipeUser"]; + wasAlreadyAPrimaryUser: boolean; + user: components["schemas"]["authRecipeUser"]; } | { /** @enum {string} */ status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId?: string; - description?: string; + primaryUserId: string; + description: string; } | { /** @enum {string} */ status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId?: string; - description?: string; + primaryUserId: string; }; }; }; diff --git a/lib/ts/recipe/accountlinking/recipeImplementation.ts b/lib/ts/recipe/accountlinking/recipeImplementation.ts index 2655d1096..5f5110146 100644 --- a/lib/ts/recipe/accountlinking/recipeImplementation.ts +++ b/lib/ts/recipe/accountlinking/recipeImplementation.ts @@ -15,7 +15,6 @@ import { AccountInfoInput, RecipeInterface, TypeNormalisedInput } from "./types"; import { Querier } from "../../querier"; -import NormalisedURLPath from "../../normalisedURLPath"; import RecipeUserId from "../../recipeUserId"; import type AccountLinkingRecipe from "./recipe"; import { User } from "../../user"; @@ -139,7 +138,10 @@ export default function getRecipeImplementation( userContext ); if (response.status === "OK") { - response.user = new User(response.user); + return { + ...response, + user: User.fromApi(response.user), + }; } return response; }, @@ -226,20 +228,15 @@ export default function getRecipeImplementation( userContext ); - if (accountsLinkingResult.status === "OK") { - accountsLinkingResult.user = new User(accountsLinkingResult.user); - } - - if ( - ["OK", "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"].includes( - accountsLinkingResult.status - ) - ) { - accountsLinkingResult.user = new User(accountsLinkingResult.user); + if (accountsLinkingResult.status === "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR") { + return { + ...accountsLinkingResult, + user: User.fromApi(accountsLinkingResult.user), + }; } if (accountsLinkingResult.status === "OK") { - let user: UserType = accountsLinkingResult.user; + let user: UserType = User.fromApi(accountsLinkingResult.user); if (!accountsLinkingResult.accountsAlreadyLinked) { await recipeInstance.verifyEmailForRecipeUserIfLinkedAccountsAreVerified({ user: user, @@ -264,7 +261,10 @@ export default function getRecipeImplementation( await config.onAccountLinked(user, loginMethodInfo, userContext); } - accountsLinkingResult.user = user; + return { + ...accountsLinkingResult, + user, + }; } return accountsLinkingResult; diff --git a/lib/ts/user.ts b/lib/ts/user.ts index 7fb9cebfa..156e92ccf 100644 --- a/lib/ts/user.ts +++ b/lib/ts/user.ts @@ -120,6 +120,13 @@ export class User implements UserType { this.loginMethods = user.loginMethods.map((m) => new LoginMethod(m)); } + static fromApi(apiUser: Omit & { id: string }): User { + return new User({ + ...apiUser, + id: new RecipeUserId(apiUser.id).getAsString(), + }); + } + toJson(): JSONObject { return { id: this.id, From f8b27760b7296a5dfe0ab770d935fb6a2f145bcb Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Tue, 6 May 2025 16:46:44 +0530 Subject: [PATCH 28/64] Add fix for emailpassword recipe --- lib/core/versions/5.3/schema.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/core/versions/5.3/schema.d.ts b/lib/core/versions/5.3/schema.d.ts index 9a8683511..cd14998ab 100644 --- a/lib/core/versions/5.3/schema.d.ts +++ b/lib/core/versions/5.3/schema.d.ts @@ -434,7 +434,7 @@ export interface paths { patch?: never; trace?: never; }; - "//recipe/user": { + "/recipe/user": { parameters: { query?: never; header?: never; From 90af0bf23a8be92f2e491d02ebe7f5bbc2d746a2 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Tue, 6 May 2025 17:11:57 +0530 Subject: [PATCH 29/64] Add fixes for multitenancy related conflicts --- lib/core/versions/5.3/schema.d.ts | 37 ++++++++++++------- .../multitenancy/recipeImplementation.ts | 7 +++- 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/lib/core/versions/5.3/schema.d.ts b/lib/core/versions/5.3/schema.d.ts index cd14998ab..ba5c7784c 100644 --- a/lib/core/versions/5.3/schema.d.ts +++ b/lib/core/versions/5.3/schema.d.ts @@ -1173,7 +1173,7 @@ export interface paths { }; content: { "application/json": { - keys?: components["schemas"]["jwk"][]; + keys: components["schemas"]["jwk"][]; }; }; }; @@ -3208,13 +3208,17 @@ export interface components { jwtValidity: number; /** @description A JWK that can be used to verify a JWT */ jwk: { - alg?: components["schemas"]["createJWTAlgorithm"]; + alg: components["schemas"]["createJWTAlgorithm"]; /** @example RSA */ - kty?: string; + kty: string; /** @example sig */ - use?: string; + use: string; /** @description Unique identifier for the JWK */ - kid?: string; + kid: string; + /** @description Modulus */ + n: string; + /** @description Exponent */ + e: string; /** @description X.509 Certificate Chain */ x5c?: string[]; }; @@ -3264,23 +3268,30 @@ export interface components { name?: string; clients?: { clientType?: string; - clientId?: string; + clientId: string; clientSecret?: string; scope?: string[]; forcePKCE?: boolean; additionalConfig?: Record; }[]; authorizationEndpoint?: string; - authorizationEndpointQueryParams?: Record; + authorizationEndpointQueryParams?: { + [key: string]: string | null; + }; tokenEndpoint?: string; - tokenEndpointBodyParams?: Record; + tokenEndpointBodyParams?: { + [key: string]: string; + }; userInfoEndpoint?: string; - userInfoEndpointQueryParams?: Record; - userInfoEndpointHeaders?: Record; + userInfoEndpointQueryParams?: { + [key: string]: string | null; + }; + userInfoEndpointHeaders?: { + [key: string]: string | null; + }; jwksURI?: string; oidcDiscoveryEndpoint?: string; - /** @default true */ - requireEmail: boolean; + requireEmail?: boolean; userInfoMap?: { fromIdTokenPayload?: { userId?: string; @@ -3406,7 +3417,7 @@ export interface components { tenantConfigV2: { tenantId: components["schemas"]["tenantId"]; thirdParty: { - providers?: components["schemas"]["thirdPartyProviderConfig"][]; + providers: components["schemas"]["thirdPartyProviderConfig"][]; }; firstFactors?: components["schemas"]["firstFactors"]; requiredSecondaryFactors?: components["schemas"]["requiredSecondaryFactors"]; diff --git a/lib/ts/recipe/multitenancy/recipeImplementation.ts b/lib/ts/recipe/multitenancy/recipeImplementation.ts index b0516a50c..bdb55e756 100644 --- a/lib/ts/recipe/multitenancy/recipeImplementation.ts +++ b/lib/ts/recipe/multitenancy/recipeImplementation.ts @@ -13,7 +13,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { "/recipe/multitenancy/tenant/v2", { tenantId, - ...config, + ...{ + config: { + ...config, + firstFactors: config?.firstFactors === null ? undefined : config?.firstFactors, + }, + }, }, {}, userContext From 12cdb0e624d82ca0771e7d2afb116c2c3ed73b72 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Tue, 6 May 2025 17:26:23 +0530 Subject: [PATCH 30/64] Fix some more recipe related type conflicts --- lib/core/versions/5.3/schema.d.ts | 24 +++++++++---------- .../recipe/thirdparty/recipeImplementation.ts | 1 - lib/ts/recipe/totp/recipeImplementation.ts | 5 +++- .../usermetadata/recipeImplementation.ts | 1 - .../recipe/userroles/recipeImplementation.ts | 2 -- 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/lib/core/versions/5.3/schema.d.ts b/lib/core/versions/5.3/schema.d.ts index ba5c7784c..d29ed99e8 100644 --- a/lib/core/versions/5.3/schema.d.ts +++ b/lib/core/versions/5.3/schema.d.ts @@ -3168,16 +3168,16 @@ export interface components { /** @example Error Message */ message: string; session: { - handle?: components["schemas"]["handle"]; - userId?: components["schemas"]["userId"]; + handle: components["schemas"]["handle"]; + userId: components["schemas"]["userId"]; userDataInJWT?: components["schemas"]["userDataInJWT"]; - tenantId?: components["schemas"]["tenantId"]; - recipeUserId?: components["schemas"]["userId"]; + tenantId: components["schemas"]["tenantId"]; + recipeUserId: components["schemas"]["userId"]; }; cookieInfo: { - token?: components["schemas"]["token"]; - expiry?: components["schemas"]["expiry"]; - createdTime?: components["schemas"]["timeCreated"]; + token: components["schemas"]["token"]; + expiry: components["schemas"]["expiry"]; + createdTime: components["schemas"]["timeCreated"]; }; /** @example 1637262633029 */ expiry: number; @@ -3969,10 +3969,10 @@ export interface operations { "application/json": { status: components["schemas"]["statusOK"]; devices?: { - name?: string; - period?: number; - skew?: number; - verified?: boolean; + name: string; + period: number; + skew: number; + verified: boolean; }[]; }; }; @@ -4108,7 +4108,7 @@ export interface operations { /** @example 123456 */ totp: string; /** @example false */ - allowUnverifiedDevices: boolean; + allowUnverifiedDevices?: boolean; }; }; }; diff --git a/lib/ts/recipe/thirdparty/recipeImplementation.ts b/lib/ts/recipe/thirdparty/recipeImplementation.ts index 58dfc19d5..ab0571f38 100644 --- a/lib/ts/recipe/thirdparty/recipeImplementation.ts +++ b/lib/ts/recipe/thirdparty/recipeImplementation.ts @@ -1,6 +1,5 @@ import { RecipeInterface, ProviderInput } from "./types"; import { Querier } from "../../querier"; -import NormalisedURLPath from "../../normalisedURLPath"; import { findAndCreateProviderInstance, mergeProvidersFromCoreAndStatic } from "./providers/configUtils"; import AccountLinking from "../accountlinking/recipe"; import MultitenancyRecipe from "../multitenancy/recipe"; diff --git a/lib/ts/recipe/totp/recipeImplementation.ts b/lib/ts/recipe/totp/recipeImplementation.ts index 4ce109d0e..cf2b744d0 100644 --- a/lib/ts/recipe/totp/recipeImplementation.ts +++ b/lib/ts/recipe/totp/recipeImplementation.ts @@ -15,7 +15,6 @@ import { RecipeInterface } from "./"; import { Querier } from "../../querier"; -import NormalisedURLPath from "../../normalisedURLPath"; import { TypeNormalisedInput } from "./types"; import { UserContext } from "../../types"; import { getUser } from "../.."; @@ -98,6 +97,10 @@ export default function getRecipeInterface(querier: Querier, config: TypeNormali input.userContext ); + if (response.status !== "OK") { + return response; + } + return { ...response, qrCodeString: diff --git a/lib/ts/recipe/usermetadata/recipeImplementation.ts b/lib/ts/recipe/usermetadata/recipeImplementation.ts index e2cc0c4f4..33482f988 100644 --- a/lib/ts/recipe/usermetadata/recipeImplementation.ts +++ b/lib/ts/recipe/usermetadata/recipeImplementation.ts @@ -14,7 +14,6 @@ */ import { RecipeInterface } from "."; -import NormalisedURLPath from "../../normalisedURLPath"; import { Querier } from "../../querier"; export default function getRecipeInterface(querier: Querier): RecipeInterface { diff --git a/lib/ts/recipe/userroles/recipeImplementation.ts b/lib/ts/recipe/userroles/recipeImplementation.ts index eb7248411..ae1fa9090 100644 --- a/lib/ts/recipe/userroles/recipeImplementation.ts +++ b/lib/ts/recipe/userroles/recipeImplementation.ts @@ -14,9 +14,7 @@ */ import { RecipeInterface } from "./types"; -import NormalisedURLPath from "../../normalisedURLPath"; import { Querier } from "../../querier"; -import { DEFAULT_TENANT_ID } from "../multitenancy/constants"; export default function getRecipeInterface(querier: Querier): RecipeInterface { return { From fcd1bd9c0bbeb06507d884e2d7e4377f3cf0df60 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Wed, 7 May 2025 13:24:22 +0530 Subject: [PATCH 31/64] Fix various type conflicts in the schema --- lib/core/versions/5.3/schema.d.ts | 40 +++++++++++++------ .../oauth2provider/recipeImplementation.ts | 2 +- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/lib/core/versions/5.3/schema.d.ts b/lib/core/versions/5.3/schema.d.ts index d29ed99e8..1fcf9d29a 100644 --- a/lib/core/versions/5.3/schema.d.ts +++ b/lib/core/versions/5.3/schema.d.ts @@ -8588,10 +8588,6 @@ export interface operations { "application/json": { status: components["schemas"]["statusOK"]; createdNew: boolean; - } | { - /** @enum {string} */ - status: "CONFIG_VALIDATION_ERROR"; - reason: string; }; }; }; @@ -9031,7 +9027,11 @@ export interface operations { property1?: string; property2?: string; }; - } | components["schemas"]["oauthError"]; + acr?: string; + amr?: string[]; + challenge: string; + oidcContext?: Record; + }; }; }; 400: components["responses"]["400"]; @@ -9081,6 +9081,12 @@ export interface operations { [key: string]: unknown; }; }; + iss?: string; + tId?: string; + rsub?: string; + sessionHandle?: string; + initialAccessTokenPayload?: Record; + initialIdTokenPayload?: Record; }; }; }; @@ -9095,7 +9101,7 @@ export interface operations { status: components["schemas"]["statusOK"]; /** @example {apiDomain}/oauth/consent?... */ redirectTo?: string; - } | components["schemas"]["oauthError"]; + }; }; }; 400: components["responses"]["400"]; @@ -9147,7 +9153,7 @@ export interface operations { status: components["schemas"]["statusOK"]; /** @example {apiDomain}/oauth/consent?... */ redirectTo?: string; - } | components["schemas"]["oauthError"]; + }; }; }; 400: components["responses"]["400"]; @@ -9188,6 +9194,12 @@ export interface operations { status: components["schemas"]["statusOK"]; challenge?: string; client?: components["schemas"]["oauthClient"]; + requestUrl: string; + requestedAccessTokenAudience?: string[]; + requestedScope?: string[]; + sessionId?: string; + skip?: boolean; + subject?: string; oidcContext?: { acrValues?: string[]; display?: string; @@ -9259,7 +9271,7 @@ export interface operations { status: components["schemas"]["statusOK"]; /** @example {apiDomain}/oauth/login?... */ redirectTo?: string; - } | components["schemas"]["oauthError"]; + }; }; }; 400: components["responses"]["400"]; @@ -9311,7 +9323,7 @@ export interface operations { status: components["schemas"]["statusOK"]; /** @example {apiDomain}/oauth/login?... */ redirectTo?: string; - } | components["schemas"]["oauthError"]; + }; }; }; 400: components["responses"]["400"]; @@ -9520,7 +9532,7 @@ export interface operations { content: { "application/json": { /** @example stcl_fed7cff0-cc6e-406e-b7a6-766148675a4a */ - client_id?: string; + clientId?: string; }; }; }; @@ -9634,7 +9646,10 @@ export interface operations { scope?: string; /** @example bearer */ token_type?: string; - } | components["schemas"]["oauthError"]; + } | components["schemas"]["oauthError"] | { + /** @enum {string} */ + status: "CLIENT_NOT_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -9709,6 +9724,7 @@ export interface operations { content: { "application/json": { token: string; + scope?: string; }; }; }; @@ -9755,7 +9771,7 @@ export interface operations { token_type?: string; /** @example access_token */ token_use?: string; - } | components["schemas"]["oauthError"]; + }; }; }; 400: components["responses"]["400"]; diff --git a/lib/ts/recipe/oauth2provider/recipeImplementation.ts b/lib/ts/recipe/oauth2provider/recipeImplementation.ts index 0a8cdfae0..3b51f2083 100644 --- a/lib/ts/recipe/oauth2provider/recipeImplementation.ts +++ b/lib/ts/recipe/oauth2provider/recipeImplementation.ts @@ -136,7 +136,7 @@ export default function getRecipeInterface( amr: resp.amr, challenge: resp.challenge, client: OAuth2Client.fromAPIResponse(resp.client), - context: resp.context, + context: resp.context as JSONObject, loginChallenge: resp.loginChallenge, loginSessionId: resp.loginSessionId, oidcContext: resp.oidcContext, From 87c7b4b37190c7a2cbd771a7be169fc1228fd7ed Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Wed, 7 May 2025 13:33:35 +0530 Subject: [PATCH 32/64] Fix passwordless type mismatches --- lib/core/versions/5.3/schema.d.ts | 15 ++++++--------- .../recipe/passwordless/recipeImplementation.ts | 16 +++++++--------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/lib/core/versions/5.3/schema.d.ts b/lib/core/versions/5.3/schema.d.ts index 1fcf9d29a..c838ad8ba 100644 --- a/lib/core/versions/5.3/schema.d.ts +++ b/lib/core/versions/5.3/schema.d.ts @@ -4592,9 +4592,6 @@ export interface operations { linkCode?: components["schemas"]["linkCode"]; timeCreated?: components["schemas"]["timeCreated"]; codeLifetime?: components["schemas"]["codeLifetime"]; - } | { - /** @enum {string} */ - status: "RESTART_FLOW_ERROR" | "USER_INPUT_CODE_ALREADY_USED_ERROR"; }; }; }; @@ -4685,15 +4682,15 @@ export interface operations { "application/json": { status: components["schemas"]["statusOK"]; devices?: { - preAuthSessionId?: components["schemas"]["preAuthSessionId"]; + preAuthSessionId: components["schemas"]["preAuthSessionId"]; /** @example 2 */ - failedCodeInputAttemptCount?: number; + failedCodeInputAttemptCount: number; email?: components["schemas"]["email"]; phoneNumber?: components["schemas"]["phoneNumber"]; - codes?: { - codeId?: components["schemas"]["codeId"]; - timeCreated?: components["schemas"]["timeCreated"]; - codeLifetime?: components["schemas"]["codeLifetime"]; + codes: { + codeId: components["schemas"]["codeId"]; + timeCreated: string; + codeLifetime: components["schemas"]["codeLifetime"]; }[]; }[]; }; diff --git a/lib/ts/recipe/passwordless/recipeImplementation.ts b/lib/ts/recipe/passwordless/recipeImplementation.ts index 4191268e8..9aecfc2d7 100644 --- a/lib/ts/recipe/passwordless/recipeImplementation.ts +++ b/lib/ts/recipe/passwordless/recipeImplementation.ts @@ -42,16 +42,16 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { logDebugMessage("Passwordless.consumeCode code consumed OK"); - response.user = new User(response.user); - response.recipeUserId = new RecipeUserId(response.recipeUserId); + const userAsObj = User.fromApi(response.user); + const recipeUserIdAsObj = new RecipeUserId(response.recipeUserId); // Attempt account linking (this is a sign up) - let updatedUser = response.user; + let updatedUser = userAsObj; const linkResult = await AuthUtils.linkToSessionIfRequiredElseCreatePrimaryUserIdOrLinkByAccountInfo({ tenantId: input.tenantId, - inputUser: response.user, - recipeUserId: response.recipeUserId, + inputUser: userAsObj, + recipeUserId: recipeUserIdAsObj, session: input.session, shouldTryLinkingWithSessionUser: input.shouldTryLinkingWithSessionUser, userContext: input.userContext, @@ -62,14 +62,12 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { } updatedUser = linkResult.user; - response.user = updatedUser; - return { ...response, consumedDevice: response.consumedDevice, createdNewRecipeUser: response.createdNewUser, - user: response.user!, - recipeUserId: response.recipeUserId!, + user: updatedUser, + recipeUserId: recipeUserIdAsObj, }; }, From 6ea5a1c492d1329270cdce0556754671bd234591 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Wed, 7 May 2025 14:48:58 +0530 Subject: [PATCH 33/64] Add fixes to thirdparty and usermetadata based on types --- .../recipe/thirdparty/recipeImplementation.ts | 18 +++++++----------- .../usermetadata/recipeImplementation.ts | 10 ++++++++-- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/lib/ts/recipe/thirdparty/recipeImplementation.ts b/lib/ts/recipe/thirdparty/recipeImplementation.ts index ab0571f38..5254301cb 100644 --- a/lib/ts/recipe/thirdparty/recipeImplementation.ts +++ b/lib/ts/recipe/thirdparty/recipeImplementation.ts @@ -71,24 +71,20 @@ export default function getRecipeImplementation(querier: Querier, providers: Pro return response; } - response.user = new User(response.user); - response.recipeUserId = new RecipeUserId(response.recipeUserId); + const userAsObj = User.fromApi(response.user); + const recipeUserIdAsObj = new RecipeUserId(response.recipeUserId); await AccountLinking.getInstance().verifyEmailForRecipeUserIfLinkedAccountsAreVerified({ - user: response.user, - recipeUserId: response.recipeUserId, + user: userAsObj, + recipeUserId: recipeUserIdAsObj, userContext, }); - // we do this so that we get the updated user (in case the above - // function updated the verification status) and can return that - response.user = (await getUser(response.recipeUserId.getAsString(), userContext))!; - const linkResult = await AuthUtils.linkToSessionIfRequiredElseCreatePrimaryUserIdOrLinkByAccountInfo({ tenantId, shouldTryLinkingWithSessionUser, - inputUser: response.user, - recipeUserId: response.recipeUserId, + inputUser: userAsObj, + recipeUserId: recipeUserIdAsObj, session, userContext, }); @@ -101,7 +97,7 @@ export default function getRecipeImplementation(querier: Querier, providers: Pro status: "OK", createdNewRecipeUser: response.createdNewUser, user: linkResult.user, - recipeUserId: response.recipeUserId, + recipeUserId: recipeUserIdAsObj, }; }, diff --git a/lib/ts/recipe/usermetadata/recipeImplementation.ts b/lib/ts/recipe/usermetadata/recipeImplementation.ts index 33482f988..892428abf 100644 --- a/lib/ts/recipe/usermetadata/recipeImplementation.ts +++ b/lib/ts/recipe/usermetadata/recipeImplementation.ts @@ -15,6 +15,7 @@ import { RecipeInterface } from "."; import { Querier } from "../../querier"; +import { JSONObject } from "../../types"; export default function getRecipeInterface(querier: Querier): RecipeInterface { return { @@ -22,8 +23,8 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { return querier.sendGetRequest("/recipe/user/metadata", { userId }, userContext); }, - updateUserMetadata: function ({ userId, metadataUpdate, userContext }) { - return querier.sendPutRequest( + updateUserMetadata: async function ({ userId, metadataUpdate, userContext }) { + const response = await querier.sendPutRequest( "/recipe/user/metadata", { userId, @@ -32,6 +33,11 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { {}, userContext ); + + return { + ...response, + metadata: response.metadata as JSONObject, + }; }, clearUserMetadata: function ({ userId, userContext }) { From 7d68cd307277f9eee25a48dcb7d5be31349942e9 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Wed, 7 May 2025 15:13:24 +0530 Subject: [PATCH 34/64] Fix some issues with unused variables/imports --- lib/core/versions/5.3/schema.d.ts | 148 ++++++++++++++++-- lib/ts/recipe/dashboard/api/analytics.ts | 1 - .../api/multitenancy/getTenantInfo.ts | 1 - lib/ts/recipe/dashboard/api/signIn.ts | 6 - .../recipe/dashboard/recipeImplementation.ts | 1 - .../emailpassword/recipeImplementation.ts | 1 - .../emailverification/recipeImplementation.ts | 1 - lib/ts/recipe/jwt/recipeImplementation.ts | 1 - .../passwordless/recipeImplementation.ts | 1 - lib/ts/recipe/session/recipeImplementation.ts | 1 - lib/ts/recipe/session/sessionFunctions.ts | 6 +- .../recipe/thirdparty/recipeImplementation.ts | 2 +- .../recipe/webauthn/recipeImplementation.ts | 2 - 13 files changed, 142 insertions(+), 30 deletions(-) diff --git a/lib/core/versions/5.3/schema.d.ts b/lib/core/versions/5.3/schema.d.ts index c838ad8ba..6998ade8b 100644 --- a/lib/core/versions/5.3/schema.d.ts +++ b/lib/core/versions/5.3/schema.d.ts @@ -974,6 +974,28 @@ export interface paths { patch?: never; trace?: never; }; + "/recipe/session/remove": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** @description Delete a sesion + * + * If revoking session by `userId`, the sessions are cleared across all tenants by default. + * + * Note: If `revokeAcrossAllTenants` is set to `true`, this API can only be called from `public` tenant. + * */ + post: operations["deleteSession"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/recipe/session/verify": { parameters: { query?: never; @@ -1032,6 +1054,28 @@ export interface paths { patch?: never; trace?: never; }; + "/recipe/session/user": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description Get session handles for a user + * + * By default, the session handles are fetched across all tenants. Set `fetchAcrossAllTenants` to `false` to get sessionHandles for the user for a particular tenant. + * + * Note: If `fetchAcrossAllTenants` is set to `true`, this API can only be called from `public` tenant. + * */ + get: operations["getUserSessionHandles"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/recipe/session/regenerate": { parameters: { query?: never; @@ -1190,7 +1234,7 @@ export interface paths { patch?: never; trace?: never; }; - "//recipe/jwt/data": { + "/recipe/jwt/data": { parameters: { query?: never; header?: never; @@ -6197,6 +6241,7 @@ export interface operations { timeCreated?: components["schemas"]["timeCreated"]; sessionHandle?: components["schemas"]["handle"]; tenantId?: components["schemas"]["tenantId"]; + recipeUserId?: components["schemas"]["userId"]; } | components["schemas"]["unauthorisedMessageResponse"]; }; }; @@ -6252,6 +6297,52 @@ export interface operations { 500: components["responses"]["500"]; }; }; + deleteSession: { + parameters: { + query?: never; + header?: { + /** @example session */ + rid?: components["parameters"]["sessionRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + sessionHandles?: components["schemas"]["sessionHandles"]; + } | { + userId: components["schemas"]["userId"]; + revokeAcrossAllTenants?: boolean; + }; + }; + }; + responses: { + /** @description Delete a session */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + sessionHandlesRevoked?: components["schemas"]["sessionHandles"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; verifySession: { parameters: { query?: never; @@ -6351,8 +6442,9 @@ export interface operations { } | { status: components["schemas"]["tokenTheftResponse"]; session?: { - handle?: components["schemas"]["handle"]; - userId?: components["schemas"]["userId"]; + handle: components["schemas"]["handle"]; + userId: components["schemas"]["userId"]; + recipeUserId: components["schemas"]["userId"]; }; } | components["schemas"]["unauthorisedMessageResponse"]; }; @@ -6403,6 +6495,46 @@ export interface operations { 500: components["responses"]["500"]; }; }; + getUserSessionHandles: { + parameters: { + query?: { + userId?: components["parameters"]["userId"]; + fetchAcrossAllTenants?: "true" | "false"; + }; + header?: { + /** @example session */ + rid?: components["parameters"]["sessionRid"]; + /** @example ajs30Nlbs0DjvsdFIne934n8NVee5n */ + Authorization?: components["parameters"]["api-key"]; + /** + * @description X.Y of the X.Y.Z CDI version. + * @example 5.2 + */ + "cdi-version"?: components["parameters"]["cdi-version"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Get user Session Handles */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + sessionHandles?: components["schemas"]["sessionHandles"]; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; regenerateSession: { parameters: { query?: never; @@ -7263,14 +7395,12 @@ export interface operations { content: { "application/json": { /** @enum {boolean} */ - exists?: true; + exists: true; /** @example 99c87c72-1807-22d-9b39-7a88f95re56c */ - telemetryId?: string; + telemetryId: string; } | { - /** @example [ - * false - * ] */ - exists?: boolean; + /** @enum {boolean} */ + exists: false; }; }; }; diff --git a/lib/ts/recipe/dashboard/api/analytics.ts b/lib/ts/recipe/dashboard/api/analytics.ts index 4ceb3a928..456264027 100644 --- a/lib/ts/recipe/dashboard/api/analytics.ts +++ b/lib/ts/recipe/dashboard/api/analytics.ts @@ -16,7 +16,6 @@ import { APIInterface, APIOptions } from "../types"; import SuperTokens from "../../../supertokens"; import { Querier } from "../../../querier"; -import NormalisedURLPath from "../../../normalisedURLPath"; import { version as SDKVersion } from "../../../version"; import STError from "../../../error"; import { doFetch } from "../../../utils"; diff --git a/lib/ts/recipe/dashboard/api/multitenancy/getTenantInfo.ts b/lib/ts/recipe/dashboard/api/multitenancy/getTenantInfo.ts index 84258fc5b..56d137cf0 100644 --- a/lib/ts/recipe/dashboard/api/multitenancy/getTenantInfo.ts +++ b/lib/ts/recipe/dashboard/api/multitenancy/getTenantInfo.ts @@ -21,7 +21,6 @@ import { findAndCreateProviderInstance, mergeProvidersFromCoreAndStatic, } from "../../../thirdparty/providers/configUtils"; -import NormalisedURLPath from "../../../../normalisedURLPath"; import { Querier } from "../../../../querier"; import { UserContext } from "../../../../types"; import { DEFAULT_TENANT_ID } from "../../../multitenancy/constants"; diff --git a/lib/ts/recipe/dashboard/api/signIn.ts b/lib/ts/recipe/dashboard/api/signIn.ts index dcc193325..e4067ce2a 100644 --- a/lib/ts/recipe/dashboard/api/signIn.ts +++ b/lib/ts/recipe/dashboard/api/signIn.ts @@ -17,14 +17,8 @@ import { APIInterface, APIOptions } from "../types"; import { send200Response } from "../../../utils"; import STError from "../../../error"; import { Querier } from "../../../querier"; -import NormalisedURLPath from "../../../normalisedURLPath"; import { UserContext } from "../../../types"; -type SignInResponse = - | { status: "OK"; sessionId: string } - | { status: "INVALID_CREDENTIALS_ERROR" } - | { status: "USER_SUSPENDED_ERROR" }; - export default async function signIn(_: APIInterface, options: APIOptions, userContext: UserContext): Promise { const { email, password } = await options.req.getJSONBody(); diff --git a/lib/ts/recipe/dashboard/recipeImplementation.ts b/lib/ts/recipe/dashboard/recipeImplementation.ts index 155b7c973..a000f5d60 100644 --- a/lib/ts/recipe/dashboard/recipeImplementation.ts +++ b/lib/ts/recipe/dashboard/recipeImplementation.ts @@ -15,7 +15,6 @@ import RecipeError from "./error"; import { logDebugMessage } from "../../logger"; -import NormalisedURLPath from "../../normalisedURLPath"; import { Querier } from "../../querier"; import { normaliseHttpMethod } from "../../utils"; import { dashboardVersion } from "../../version"; diff --git a/lib/ts/recipe/emailpassword/recipeImplementation.ts b/lib/ts/recipe/emailpassword/recipeImplementation.ts index 082f83437..16dede2f4 100644 --- a/lib/ts/recipe/emailpassword/recipeImplementation.ts +++ b/lib/ts/recipe/emailpassword/recipeImplementation.ts @@ -2,7 +2,6 @@ import { RecipeInterface, TypeNormalisedInput } from "./types"; import AccountLinking from "../accountlinking/recipe"; import EmailVerification from "../emailverification/recipe"; import { Querier } from "../../querier"; -import NormalisedURLPath from "../../normalisedURLPath"; import { getUser } from "../.."; import { FORM_FIELD_PASSWORD_ID } from "./constants"; import RecipeUserId from "../../recipeUserId"; diff --git a/lib/ts/recipe/emailverification/recipeImplementation.ts b/lib/ts/recipe/emailverification/recipeImplementation.ts index abaf99bd1..634239188 100644 --- a/lib/ts/recipe/emailverification/recipeImplementation.ts +++ b/lib/ts/recipe/emailverification/recipeImplementation.ts @@ -1,6 +1,5 @@ import { RecipeInterface } from "./"; import { Querier } from "../../querier"; -import NormalisedURLPath from "../../normalisedURLPath"; import RecipeUserId from "../../recipeUserId"; import { GetEmailForRecipeUserIdFunc, UserEmailInfo } from "./types"; import { getUser } from "../.."; diff --git a/lib/ts/recipe/jwt/recipeImplementation.ts b/lib/ts/recipe/jwt/recipeImplementation.ts index aade7b227..a354f3746 100644 --- a/lib/ts/recipe/jwt/recipeImplementation.ts +++ b/lib/ts/recipe/jwt/recipeImplementation.ts @@ -13,7 +13,6 @@ * under the License. */ -import NormalisedURLPath from "../../normalisedURLPath"; import { Querier } from "../../querier"; import { NormalisedAppinfo, UserContext } from "../../types"; import { JsonWebKey, RecipeInterface, TypeNormalisedInput } from "./types"; diff --git a/lib/ts/recipe/passwordless/recipeImplementation.ts b/lib/ts/recipe/passwordless/recipeImplementation.ts index 9aecfc2d7..d2cfd0521 100644 --- a/lib/ts/recipe/passwordless/recipeImplementation.ts +++ b/lib/ts/recipe/passwordless/recipeImplementation.ts @@ -2,7 +2,6 @@ import { RecipeInterface } from "./types"; import { Querier } from "../../querier"; import AccountLinking from "../accountlinking/recipe"; import EmailVerification from "../emailverification/recipe"; -import NormalisedURLPath from "../../normalisedURLPath"; import { logDebugMessage } from "../../logger"; import { User } from "../../user"; import { getUser } from "../.."; diff --git a/lib/ts/recipe/session/recipeImplementation.ts b/lib/ts/recipe/session/recipeImplementation.ts index 7f5e752b5..670d43115 100644 --- a/lib/ts/recipe/session/recipeImplementation.ts +++ b/lib/ts/recipe/session/recipeImplementation.ts @@ -13,7 +13,6 @@ import { buildFrontToken } from "./cookieAndHeaders"; import { validateClaimsInPayload } from "./utils"; import Session from "./sessionClass"; import { Querier } from "../../querier"; -import NormalisedURLPath from "../../normalisedURLPath"; import { JSONObject, NormalisedAppinfo, UserContext } from "../../types"; import { logDebugMessage } from "../../logger"; import { ParsedJWTInfo, parseJWTWithoutSignatureVerification } from "./jwt"; diff --git a/lib/ts/recipe/session/sessionFunctions.ts b/lib/ts/recipe/session/sessionFunctions.ts index f5a781a2c..2526797d4 100644 --- a/lib/ts/recipe/session/sessionFunctions.ts +++ b/lib/ts/recipe/session/sessionFunctions.ts @@ -17,7 +17,6 @@ import { ParsedJWTInfo } from "./jwt"; import STError from "./error"; import { PROCESS_STATE, ProcessState } from "../../processState"; import { CreateOrRefreshAPIResponse, SessionInformation, TypeNormalisedInput } from "./types"; -import NormalisedURLPath from "../../normalisedURLPath"; import { Helpers } from "./recipeImplementation"; import { maxVersion } from "../../utils"; import { logDebugMessage } from "../../logger"; @@ -120,7 +119,7 @@ export async function getSession( getCombinedJWKS(config), helpers.config.antiCsrfFunctionOrString === "VIA_TOKEN" && doAntiCsrfCheck ); - } catch (err) { + } catch (err: any) { /** * if error type is not TRY_REFRESH_TOKEN, we return the * error to the user @@ -253,9 +252,8 @@ export async function getSession( ); if (response.status === "OK") { - delete response.status; return { - ...response, + accessToken: response.accessToken, session: { handle: response.session.handle, userId: response.session.userId, diff --git a/lib/ts/recipe/thirdparty/recipeImplementation.ts b/lib/ts/recipe/thirdparty/recipeImplementation.ts index 5254301cb..08b43568c 100644 --- a/lib/ts/recipe/thirdparty/recipeImplementation.ts +++ b/lib/ts/recipe/thirdparty/recipeImplementation.ts @@ -4,7 +4,7 @@ import { findAndCreateProviderInstance, mergeProvidersFromCoreAndStatic } from " import AccountLinking from "../accountlinking/recipe"; import MultitenancyRecipe from "../multitenancy/recipe"; import RecipeUserId from "../../recipeUserId"; -import { getUser, listUsersByAccountInfo } from "../.."; +import { listUsersByAccountInfo } from "../.."; import { User as UserType } from "../../types"; import { User } from "../../user"; import { AuthUtils } from "../../authUtils"; diff --git a/lib/ts/recipe/webauthn/recipeImplementation.ts b/lib/ts/recipe/webauthn/recipeImplementation.ts index 74731f664..e4bb9a18c 100644 --- a/lib/ts/recipe/webauthn/recipeImplementation.ts +++ b/lib/ts/recipe/webauthn/recipeImplementation.ts @@ -16,10 +16,8 @@ import { RecipeInterface, TypeNormalisedInput } from "./types"; import AccountLinking from "../accountlinking/recipe"; import { Querier } from "../../querier"; -import NormalisedURLPath from "../../normalisedURLPath"; import { getUser } from "../.."; import RecipeUserId from "../../recipeUserId"; -import { DEFAULT_TENANT_ID } from "../multitenancy/constants"; import { LoginMethod, User } from "../../user"; import { AuthUtils } from "../../authUtils"; From 39b0d74fd81b40fbae16de50cebc2b75bfaed9f5 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Wed, 7 May 2025 15:47:29 +0530 Subject: [PATCH 35/64] Update built spec with oauth endpoint returning incorrect status --- lib/core/versions/5.3/schema.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/core/versions/5.3/schema.d.ts b/lib/core/versions/5.3/schema.d.ts index 6998ade8b..4ae084476 100644 --- a/lib/core/versions/5.3/schema.d.ts +++ b/lib/core/versions/5.3/schema.d.ts @@ -8894,7 +8894,10 @@ export interface operations { content: { "application/json": ({ status: components["schemas"]["statusOK"]; - } & components["schemas"]["oauthClient"]) | components["schemas"]["oauthError"]; + } & components["schemas"]["oauthClient"]) | components["schemas"]["oauthError"] | { + /** @enum {string} */ + status: "CLIENT_NOT_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; From 8574eec2e06bf487a707e9ed95da3c9619efd8e9 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Thu, 8 May 2025 20:17:25 +0530 Subject: [PATCH 36/64] Update oauth2provider related type fixes --- lib/core/versions/5.3/schema.d.ts | 48 ++++++++++++++++++- .../oauth2provider/recipeImplementation.ts | 2 +- scripts/generate-schema.js | 1 - 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/lib/core/versions/5.3/schema.d.ts b/lib/core/versions/5.3/schema.d.ts index 4ae084476..3bf697120 100644 --- a/lib/core/versions/5.3/schema.d.ts +++ b/lib/core/versions/5.3/schema.d.ts @@ -2650,7 +2650,9 @@ export interface paths { * */ get: operations["getOAuth2Auth"]; put?: never; - post?: never; + /** @description Exchange OAuth2 Auth request for redirect or error. + * */ + post: operations["postOAuth2Auth"]; delete?: never; options?: never; head?: never; @@ -9724,6 +9726,50 @@ export interface operations { 500: components["responses"]["500"]; }; }; + postOAuth2Auth: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + params: Record; + iss: string; + cookies?: string; + session?: { + idToken?: Record; + accessToken?: Record; + }; + }; + }; + }; + responses: { + /** @description OAuth2 auth result */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": { + status: components["schemas"]["statusOK"]; + redirectTo: string; + cookies: string[]; + } | components["schemas"]["oauthError"] | { + /** @enum {string} */ + status: "CLIENT_NOT_FOUND_ERROR"; + }; + }; + }; + 400: components["responses"]["400"]; + 401: components["responses"]["401"]; + 402: components["responses"]["402"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; getOAuth2Token: { parameters: { query?: never; diff --git a/lib/ts/recipe/oauth2provider/recipeImplementation.ts b/lib/ts/recipe/oauth2provider/recipeImplementation.ts index 3b51f2083..d1e476bad 100644 --- a/lib/ts/recipe/oauth2provider/recipeImplementation.ts +++ b/lib/ts/recipe/oauth2provider/recipeImplementation.ts @@ -306,7 +306,7 @@ export default function getRecipeInterface( const redirectTo = getUpdatedRedirectTo(appInfo, resp.redirectTo); if (redirectTo === undefined) { - throw new Error(resp.body); + throw new Error("Got redirectTo as undefined, cannot continue"); } const redirectToURL = new URL(redirectTo); const consentChallenge = redirectToURL.searchParams.get("consent_challenge"); diff --git a/scripts/generate-schema.js b/scripts/generate-schema.js index b312702bf..d8502046c 100644 --- a/scripts/generate-schema.js +++ b/scripts/generate-schema.js @@ -1,4 +1,3 @@ -// scripts/generate-schemas.js const fs = require("fs/promises"); const path = require("path"); const { exec } = require("child_process"); From e96361c10cb65ae3c2de82f4b24578669f5b2e82 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Fri, 9 May 2025 11:30:34 +0530 Subject: [PATCH 37/64] Add build files and pretty fixes --- lib/build/core/paths.d.ts | 3 + lib/build/core/paths.js | 2 + lib/build/core/types.d.ts | 61 + lib/build/core/types.js | 9 + lib/build/customFramework.d.ts | 4 +- lib/build/customFramework.js | 9 +- lib/build/framework/custom/framework.js | 7 +- lib/build/framework/express/framework.js | 7 +- lib/build/framework/fastify/index.d.ts | 8 +- lib/build/framework/index.js | 10 +- lib/build/framework/utils.js | 18 +- lib/build/index.js | 19 +- lib/build/nextjs.js | 7 +- lib/build/querier.d.ts | 88 +- lib/build/querier.js | 28 +- lib/build/recipe/accountlinking/index.js | 13 +- .../accountlinking/recipeImplementation.js | 54 +- lib/build/recipe/accountlinking/types.d.ts | 27 +- lib/build/recipe/dashboard/api/analytics.js | 3 +- .../api/multitenancy/getTenantInfo.js | 8 +- .../api/multitenancy/getThirdPartyConfig.js | 5 +- .../updateTenantSecondaryFactor.js | 5 +- .../dashboard/api/multitenancy/utils.js | 12 +- .../recipe/dashboard/api/search/tagsGet.js | 12 +- lib/build/recipe/dashboard/api/signIn.js | 3 +- lib/build/recipe/dashboard/api/signOut.js | 10 +- lib/build/recipe/dashboard/api/usersGet.d.ts | 4 +- .../recipe/dashboard/recipeImplementation.js | 3 +- lib/build/recipe/dashboard/utils.js | 8 +- .../emailpassword/api/implementation.js | 10 +- .../services/backwardCompatibility/index.d.ts | 3 +- lib/build/recipe/emailpassword/index.js | 14 +- lib/build/recipe/emailpassword/recipe.js | 5 +- .../emailpassword/recipeImplementation.js | 58 +- lib/build/recipe/emailpassword/types.d.ts | 20 +- lib/build/recipe/emailpassword/utils.js | 7 +- .../services/backwardCompatibility/index.d.ts | 3 +- lib/build/recipe/emailverification/index.js | 13 +- .../emailverification/recipeImplementation.js | 26 +- lib/build/recipe/emailverification/types.d.ts | 18 +- lib/build/recipe/jwt/index.d.ts | 4 +- lib/build/recipe/jwt/recipeImplementation.js | 10 +- lib/build/recipe/jwt/types.d.ts | 9 +- .../multifactorauth/api/implementation.js | 9 +- lib/build/recipe/multifactorauth/index.js | 12 +- .../multifactorauth/multiFactorAuthClaim.d.ts | 8 +- .../multifactorauth/recipeImplementation.js | 9 +- lib/build/recipe/multifactorauth/types.d.ts | 6 +- lib/build/recipe/multitenancy/index.d.ts | 4 +- lib/build/recipe/multitenancy/index.js | 12 +- .../multitenancy/recipeImplementation.js | 85 +- lib/build/recipe/multitenancy/types.d.ts | 20 +- .../recipe/oauth2provider/api/userInfo.js | 12 +- lib/build/recipe/oauth2provider/constants.js | 11 +- lib/build/recipe/oauth2provider/index.js | 14 +- .../oauth2provider/recipeImplementation.js | 53 +- lib/build/recipe/oauth2provider/types.d.ts | 48 +- lib/build/recipe/openid/index.d.ts | 4 +- lib/build/recipe/openid/types.d.ts | 9 +- .../recipe/passwordless/api/implementation.js | 7 +- .../services/backwardCompatibility/index.d.ts | 3 +- lib/build/recipe/passwordless/index.js | 19 +- lib/build/recipe/passwordless/recipe.js | 20 +- .../passwordless/recipeImplementation.js | 95 +- lib/build/recipe/passwordless/utils.js | 6 +- lib/build/recipe/session/constants.js | 16 +- lib/build/recipe/session/cookieAndHeaders.js | 16 +- lib/build/recipe/session/index.d.ts | 8 +- lib/build/recipe/session/index.js | 25 +- .../recipe/session/recipeImplementation.js | 3 +- lib/build/recipe/session/sessionFunctions.js | 81 +- .../recipe/session/sessionRequestFunctions.js | 6 +- lib/build/recipe/session/types.d.ts | 12 +- lib/build/recipe/session/utils.js | 15 +- .../thirdparty/providers/configUtils.js | 6 +- .../recipe/thirdparty/providers/custom.js | 14 +- .../recipe/thirdparty/providers/index.js | 15 +- .../recipe/thirdparty/providers/utils.js | 7 +- .../recipe/thirdparty/recipeImplementation.js | 32 +- lib/build/recipe/totp/index.js | 9 +- lib/build/recipe/totp/recipeImplementation.js | 31 +- lib/build/recipe/totp/types.d.ts | 29 +- .../usermetadata/recipeImplementation.js | 21 +- lib/build/recipe/usermetadata/types.d.ts | 16 +- lib/build/recipe/userroles/index.d.ts | 4 +- lib/build/recipe/userroles/index.js | 15 +- .../recipe/userroles/recipeImplementation.js | 72 +- lib/build/recipe/userroles/types.d.ts | 51 +- .../recipe/webauthn/api/implementation.js | 10 +- lib/build/recipe/webauthn/constants.js | 18 +- lib/build/recipe/webauthn/index.d.ts | 5 +- lib/build/recipe/webauthn/index.js | 23 +- lib/build/recipe/webauthn/recipe.js | 5 +- .../recipe/webauthn/recipeImplementation.js | 134 +- lib/build/recipe/webauthn/types.d.ts | 49 +- lib/build/supertokens.js | 19 +- lib/build/thirdpartyUtils.js | 6 +- lib/build/user.d.ts | 5 + lib/build/user.js | 5 + lib/build/utils.js | 34 +- lib/{ => ts}/core/paths.ts | 0 lib/{ => ts}/core/types.ts | 31 +- lib/{ => ts}/core/versions/5.3/schema.d.ts | 1996 +++++++++-------- lib/ts/customFramework.ts | 4 +- lib/ts/nextjs.ts | 4 +- lib/ts/querier.ts | 66 +- lib/ts/recipe/accountlinking/recipe.ts | 23 +- .../accountlinking/recipeImplementation.ts | 98 +- lib/ts/recipe/accountlinking/types.ts | 21 +- .../api/multitenancy/getThirdPartyConfig.ts | 11 +- .../emailpassword/api/implementation.ts | 46 +- .../emailpassword/recipeImplementation.ts | 7 +- lib/ts/recipe/emailpassword/types.ts | 13 +- .../emailverification/recipeImplementation.ts | 3 +- lib/ts/recipe/multifactorauth/types.ts | 6 +- .../multitenancy/recipeImplementation.ts | 6 +- lib/ts/recipe/oauth2provider/api/userInfo.ts | 11 +- .../oauth2provider/recipeImplementation.ts | 12 +- lib/ts/recipe/oauth2provider/types.ts | 5 +- lib/ts/recipe/openid/types.ts | 9 +- .../recipe/passwordless/api/implementation.ts | 7 +- lib/ts/recipe/passwordless/recipe.ts | 20 +- lib/ts/recipe/session/index.ts | 3 +- lib/ts/recipe/session/sessionFunctions.ts | 34 +- lib/ts/recipe/session/types.ts | 6 +- lib/ts/recipe/session/utils.ts | 10 +- .../recipe/userroles/recipeImplementation.ts | 13 +- lib/ts/recipe/webauthn/api/implementation.ts | 35 +- lib/ts/recipe/webauthn/recipe.ts | 5 +- .../recipe/webauthn/recipeImplementation.ts | 6 +- lib/ts/recipe/webauthn/types.ts | 43 +- lib/ts/supertokens.ts | 34 +- package-lock.json | 144 +- package.json | 2 +- test/emailpassword/signinFeature.test.js | 3 +- test/emailverification/apiInterface.test.js | 34 +- 136 files changed, 2627 insertions(+), 2074 deletions(-) create mode 100644 lib/build/core/paths.d.ts create mode 100644 lib/build/core/paths.js create mode 100644 lib/build/core/types.d.ts create mode 100644 lib/build/core/types.js rename lib/{ => ts}/core/paths.ts (100%) rename lib/{ => ts}/core/types.ts (80%) rename lib/{ => ts}/core/versions/5.3/schema.d.ts (85%) diff --git a/lib/build/core/paths.d.ts b/lib/build/core/paths.d.ts new file mode 100644 index 000000000..59a51999c --- /dev/null +++ b/lib/build/core/paths.d.ts @@ -0,0 +1,3 @@ +// @ts-nocheck +import { paths as pathsV5_3 } from "./versions/5.3/schema"; +export declare type paths = pathsV5_3; diff --git a/lib/build/core/paths.js b/lib/build/core/paths.js new file mode 100644 index 000000000..c8ad2e549 --- /dev/null +++ b/lib/build/core/paths.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/lib/build/core/types.d.ts b/lib/build/core/types.d.ts new file mode 100644 index 000000000..4bc9dd71f --- /dev/null +++ b/lib/build/core/types.d.ts @@ -0,0 +1,61 @@ +// @ts-nocheck +/** + * This file contains the types for providing automatic type inference + * for core related method calls that is generated from the OpenAPI spec. + * + * This file is not needed for the core driver interface to work, but it is + * useful for providing type inference for the core related method calls. + */ +import { paths } from "./paths"; +export declare type Method = "get" | "post" | "put" | "delete" | "patch"; +declare type ExtractMethodTypeWithUndefined

= M extends keyof paths[P] + ? paths[P][M] + : never; +export declare type ExtractMethodType

= Exclude< + ExtractMethodTypeWithUndefined, + undefined +>; +declare type MakeAllRequired = { + [K in keyof T]-?: NonNullable; +}; +declare type DeepRequireAllFields = T extends any ? MakeAllRequired : never; +export declare type RequestBody

= ExtractMethodType extends { + requestBody?: infer ReqBody; +} + ? ReqBody extends { + content: { + "application/json": infer R; + }; + } + ? R | undefined + : undefined + : undefined; +export declare type UncleanedResponseBody

= ExtractMethodType extends { + responses: { + 200: { + content: { + "application/json": infer R; + }; + }; + }; +} + ? R + : unknown; +export declare type ResponseBody

= DeepRequireAllFields< + UncleanedResponseBody +>; +declare type ExtractPathParams = T extends `${string}<${infer Param}>${infer Rest}` + ? Param | ExtractPathParams + : never; +declare type PathParamsObject = ExtractPathParams extends never + ? undefined + : { + [K in ExtractPathParams]: string; + }; +export declare type PathParam

= + | P + | { + path: P; + params: PathParamsObject

; + }; +export {}; diff --git a/lib/build/core/types.js b/lib/build/core/types.js new file mode 100644 index 000000000..fa70e988e --- /dev/null +++ b/lib/build/core/types.js @@ -0,0 +1,9 @@ +"use strict"; +/** + * This file contains the types for providing automatic type inference + * for core related method calls that is generated from the OpenAPI spec. + * + * This file is not needed for the core driver interface to work, but it is + * useful for providing type inference for the core related method calls. + */ +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/lib/build/customFramework.d.ts b/lib/build/customFramework.d.ts index d7abeb160..ec107d0fc 100644 --- a/lib/build/customFramework.d.ts +++ b/lib/build/customFramework.d.ts @@ -35,9 +35,7 @@ export declare function getSessionForSSR; -export declare function getSessionForSSRUsingAccessToken( - accessToken: string | undefined -): Promise<{ +export declare function getSessionForSSRUsingAccessToken(accessToken: string | undefined): Promise<{ accessTokenPayload: JWTPayload | undefined; hasToken: boolean; error: Error | undefined; diff --git a/lib/build/customFramework.js b/lib/build/customFramework.js index 25064135d..8c2d5f9ec 100644 --- a/lib/build/customFramework.js +++ b/lib/build/customFramework.js @@ -10,7 +10,14 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.withPreParsedRequestResponse = exports.withSession = exports.getSessionForSSRUsingAccessToken = exports.getSessionForSSR = exports.handleAuthAPIRequest = exports.getQueryFromRequest = exports.getCookieFromRequest = void 0; +exports.withPreParsedRequestResponse = + exports.withSession = + exports.getSessionForSSRUsingAccessToken = + exports.getSessionForSSR = + exports.handleAuthAPIRequest = + exports.getQueryFromRequest = + exports.getCookieFromRequest = + void 0; const cookie_1 = require("cookie"); const custom_1 = require("./framework/custom"); const session_1 = __importDefault(require("./recipe/session")); diff --git a/lib/build/framework/custom/framework.js b/lib/build/framework/custom/framework.js index a321c2ffb..77f875f4b 100644 --- a/lib/build/framework/custom/framework.js +++ b/lib/build/framework/custom/framework.js @@ -19,7 +19,12 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.CustomFrameworkWrapper = exports.errorHandler = exports.middleware = exports.CollectingResponse = exports.PreParsedRequest = void 0; +exports.CustomFrameworkWrapper = + exports.errorHandler = + exports.middleware = + exports.CollectingResponse = + exports.PreParsedRequest = + void 0; const utils_1 = require("../../utils"); const request_1 = require("../request"); const response_1 = require("../response"); diff --git a/lib/build/framework/express/framework.js b/lib/build/framework/express/framework.js index d8a58729b..7b6812f9d 100644 --- a/lib/build/framework/express/framework.js +++ b/lib/build/framework/express/framework.js @@ -19,7 +19,12 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.ExpressWrapper = exports.errorHandler = exports.middleware = exports.ExpressResponse = exports.ExpressRequest = void 0; +exports.ExpressWrapper = + exports.errorHandler = + exports.middleware = + exports.ExpressResponse = + exports.ExpressRequest = + void 0; const utils_1 = require("../../utils"); const request_1 = require("../request"); const response_1 = require("../response"); diff --git a/lib/build/framework/fastify/index.d.ts b/lib/build/framework/fastify/index.d.ts index 878d1ec23..8d9e13a41 100644 --- a/lib/build/framework/fastify/index.d.ts +++ b/lib/build/framework/fastify/index.d.ts @@ -1,10 +1,8 @@ // @ts-nocheck export type { SessionRequest } from "./framework"; -export declare const plugin: import("./types").FastifyPluginCallback>; +export declare const plugin: import("./types").FastifyPluginCallback< + import("./types").FastifyInstance +>; export declare const errorHandler: () => ( err: any, req: import("./types").FastifyRequest, diff --git a/lib/build/framework/index.js b/lib/build/framework/index.js index 28dc9790d..177f21dbd 100644 --- a/lib/build/framework/index.js +++ b/lib/build/framework/index.js @@ -36,7 +36,15 @@ var __importStar = return result; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.awsLambda = exports.koa = exports.loopback = exports.hapi = exports.fastify = exports.express = exports.BaseResponse = exports.BaseRequest = void 0; +exports.awsLambda = + exports.koa = + exports.loopback = + exports.hapi = + exports.fastify = + exports.express = + exports.BaseResponse = + exports.BaseRequest = + void 0; /* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. * * This software is licensed under the Apache License, Version 2.0 (the diff --git a/lib/build/framework/utils.js b/lib/build/framework/utils.js index eb78c07df..54ccc4e69 100644 --- a/lib/build/framework/utils.js +++ b/lib/build/framework/utils.js @@ -51,7 +51,20 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.isBoxedPrimitive = exports.serializeCookieValue = exports.getCookieValueToSetInHeader = exports.setCookieForServerResponse = exports.setHeaderForExpressLikeResponse = exports.assertFormDataBodyParserHasBeenUsedForExpressLikeRequest = exports.assertThatBodyParserHasBeenUsedForExpressLikeRequest = exports.parseURLEncodedFormData = exports.parseJSONBodyFromRequest = exports.normalizeHeaderValue = exports.getHeaderValueFromIncomingMessage = exports.getCookieValueFromIncomingMessage = exports.getCookieValueFromHeaders = void 0; +exports.isBoxedPrimitive = + exports.serializeCookieValue = + exports.getCookieValueToSetInHeader = + exports.setCookieForServerResponse = + exports.setHeaderForExpressLikeResponse = + exports.assertFormDataBodyParserHasBeenUsedForExpressLikeRequest = + exports.assertThatBodyParserHasBeenUsedForExpressLikeRequest = + exports.parseURLEncodedFormData = + exports.parseJSONBodyFromRequest = + exports.normalizeHeaderValue = + exports.getHeaderValueFromIncomingMessage = + exports.getCookieValueFromIncomingMessage = + exports.getCookieValueFromHeaders = + void 0; const cookie_1 = require("cookie"); const error_1 = __importDefault(require("../error")); const constants_1 = require("./constants"); @@ -300,7 +313,8 @@ async function assertFormDataBodyParserHasBeenUsedForExpressLikeRequest(request) } } } -exports.assertFormDataBodyParserHasBeenUsedForExpressLikeRequest = assertFormDataBodyParserHasBeenUsedForExpressLikeRequest; +exports.assertFormDataBodyParserHasBeenUsedForExpressLikeRequest = + assertFormDataBodyParserHasBeenUsedForExpressLikeRequest; function setHeaderForExpressLikeResponse(res, key, value, allowDuplicateKey) { var _a; try { diff --git a/lib/build/index.js b/lib/build/index.js index ecdd1b8b6..799e4b773 100644 --- a/lib/build/index.js +++ b/lib/build/index.js @@ -19,7 +19,24 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.User = exports.RecipeUserId = exports.Error = exports.getRequestFromUserContext = exports.convertToRecipeUserId = exports.listUsersByAccountInfo = exports.getUser = exports.updateOrDeleteUserIdMappingInfo = exports.deleteUserIdMapping = exports.getUserIdMapping = exports.createUserIdMapping = exports.deleteUser = exports.getUsersNewestFirst = exports.getUsersOldestFirst = exports.getUserCount = exports.getAllCORSHeaders = exports.init = void 0; +exports.User = + exports.RecipeUserId = + exports.Error = + exports.getRequestFromUserContext = + exports.convertToRecipeUserId = + exports.listUsersByAccountInfo = + exports.getUser = + exports.updateOrDeleteUserIdMappingInfo = + exports.deleteUserIdMapping = + exports.getUserIdMapping = + exports.createUserIdMapping = + exports.deleteUser = + exports.getUsersNewestFirst = + exports.getUsersOldestFirst = + exports.getUserCount = + exports.getAllCORSHeaders = + exports.init = + void 0; const supertokens_1 = __importDefault(require("./supertokens")); const error_1 = __importDefault(require("./error")); const recipe_1 = __importDefault(require("./recipe/accountlinking/recipe")); diff --git a/lib/build/nextjs.js b/lib/build/nextjs.js index 6ced5eff5..0b00ed904 100644 --- a/lib/build/nextjs.js +++ b/lib/build/nextjs.js @@ -14,7 +14,12 @@ * under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -exports.withPreParsedRequestResponse = exports.withSession = exports.getSSRSession = exports.getAppDirRequestHandler = exports.superTokensNextWrapper = void 0; +exports.withPreParsedRequestResponse = + exports.withSession = + exports.getSSRSession = + exports.getAppDirRequestHandler = + exports.superTokensNextWrapper = + void 0; const express_1 = require("./framework/express"); const customFramework_1 = require("./customFramework"); function next(request, response, resolve, reject) { diff --git a/lib/build/querier.d.ts b/lib/build/querier.d.ts index 17d12763b..d91f6fc11 100644 --- a/lib/build/querier.d.ts +++ b/lib/build/querier.d.ts @@ -3,6 +3,7 @@ import NormalisedURLDomain from "./normalisedURLDomain"; import NormalisedURLPath from "./normalisedURLPath"; import { UserContext } from "./types"; import { NetworkInterceptor } from "./types"; +import { PathParam, RequestBody, ResponseBody } from "./core/types"; export declare class Querier { private static initCalled; private static hosts; @@ -29,34 +30,89 @@ export declare class Querier { networkInterceptor?: NetworkInterceptor, disableCache?: boolean ): void; - sendPostRequest: (path: NormalisedURLPath, body: any, userContext: UserContext) => Promise; - sendDeleteRequest: ( - path: NormalisedURLPath, - body: any, + private getPath; + sendPostRequest:

( + template: PathParam

, + body: RequestBody, + userContext: UserContext + ) => Promise< + import("./core/types").UncleanedResponseBody extends any + ? { + [K in keyof import("./core/types").UncleanedResponseBody]-?: NonNullable< + import("./core/types").UncleanedResponseBody[K] + >; + } + : never + >; + sendDeleteRequest:

( + template: PathParam

, + body: RequestBody, params: any | undefined, userContext: UserContext - ) => Promise; - sendGetRequest: ( - path: NormalisedURLPath, + ) => Promise< + import("./core/types").UncleanedResponseBody extends any + ? { + [K in keyof import("./core/types").UncleanedResponseBody]-?: NonNullable< + import("./core/types").UncleanedResponseBody[K] + >; + } + : never + >; + sendGetRequest:

( + template: PathParam

, params: Record, userContext: UserContext - ) => Promise; - sendGetRequestWithResponseHeaders: ( - path: NormalisedURLPath, + ) => Promise< + import("./core/types").UncleanedResponseBody extends any + ? { + [K in keyof import("./core/types").UncleanedResponseBody]-?: NonNullable< + import("./core/types").UncleanedResponseBody[K] + >; + } + : never + >; + sendGetRequestWithResponseHeaders:

( + template: PathParam

, params: Record, inpHeaders: Record | undefined, userContext: UserContext ) => Promise<{ - body: any; + body: import("./core/types").UncleanedResponseBody extends any + ? { + [K in keyof import("./core/types").UncleanedResponseBody]-?: NonNullable< + import("./core/types").UncleanedResponseBody[K] + >; + } + : never; headers: Headers; }>; - sendPutRequest: ( - path: NormalisedURLPath, - body: any, + sendPutRequest:

( + template: PathParam

, + body: RequestBody, params: Record, userContext: UserContext - ) => Promise; - sendPatchRequest: (path: NormalisedURLPath, body: any, userContext: UserContext) => Promise; + ) => Promise< + import("./core/types").UncleanedResponseBody extends any + ? { + [K in keyof import("./core/types").UncleanedResponseBody]-?: NonNullable< + import("./core/types").UncleanedResponseBody[K] + >; + } + : never + >; + sendPatchRequest:

( + template: PathParam

, + body: RequestBody, + userContext: UserContext + ) => Promise< + import("./core/types").UncleanedResponseBody extends any + ? { + [K in keyof import("./core/types").UncleanedResponseBody]-?: NonNullable< + import("./core/types").UncleanedResponseBody[K] + >; + } + : never + >; invalidateCoreCallCache: (userContext: UserContext, updGlobalCacheTagIfNecessary?: boolean) => void; getAllCoreUrlsForPath(path: string): string[]; private sendRequestHelper; diff --git a/lib/build/querier.js b/lib/build/querier.js index f4190edd7..812ae4bcc 100644 --- a/lib/build/querier.js +++ b/lib/build/querier.js @@ -97,10 +97,21 @@ class Querier { } return Querier.hostsAliveForTesting; }; + this.getPath = (path) => { + var _a; + const template = typeof path === "string" ? path : path.path; + const params = typeof path === "string" ? {} : (_a = path.params) !== null && _a !== void 0 ? _a : {}; + let populated = String(template); + for (const [key, value] of Object.entries(params)) { + populated = populated.replace(new RegExp(`<${key}>\\b`, "g"), String(value)); + } + return new normalisedURLPath_1.default(populated); + }; // path should start with "/" - this.sendPostRequest = async (path, body, userContext) => { + this.sendPostRequest = async (template, body, userContext) => { var _a; this.invalidateCoreCallCache(userContext); + const path = this.getPath(template); const { body: respBody } = await this.sendRequestHelper( path, "POST", @@ -143,9 +154,10 @@ class Querier { return respBody; }; // path should start with "/" - this.sendDeleteRequest = async (path, body, params, userContext) => { + this.sendDeleteRequest = async (template, body, params, userContext) => { var _a; this.invalidateCoreCallCache(userContext); + const path = this.getPath(template); const { body: respBody } = await this.sendRequestHelper( path, "DELETE", @@ -192,8 +204,9 @@ class Querier { return respBody; }; // path should start with "/" - this.sendGetRequest = async (path, params, userContext) => { + this.sendGetRequest = async (template, params, userContext) => { var _a; + const path = this.getPath(template); const { body: respBody } = await this.sendRequestHelper( path, "GET", @@ -295,8 +308,9 @@ class Querier { ); return respBody; }; - this.sendGetRequestWithResponseHeaders = async (path, params, inpHeaders, userContext) => { + this.sendGetRequestWithResponseHeaders = async (template, params, inpHeaders, userContext) => { var _a; + const path = this.getPath(template); return await this.sendRequestHelper( path, "GET", @@ -340,9 +354,10 @@ class Querier { ); }; // path should start with "/" - this.sendPutRequest = async (path, body, params, userContext) => { + this.sendPutRequest = async (template, body, params, userContext) => { var _a; this.invalidateCoreCallCache(userContext); + const path = this.getPath(template); const { body: respBody } = await this.sendRequestHelper( path, "PUT", @@ -388,9 +403,10 @@ class Querier { return respBody; }; // path should start with "/" - this.sendPatchRequest = async (path, body, userContext) => { + this.sendPatchRequest = async (template, body, userContext) => { var _a; this.invalidateCoreCallCache(userContext); + const path = this.getPath(template); const { body: respBody } = await this.sendRequestHelper( path, "PATCH", diff --git a/lib/build/recipe/accountlinking/index.js b/lib/build/recipe/accountlinking/index.js index f65eeeaee..b98f84951 100644 --- a/lib/build/recipe/accountlinking/index.js +++ b/lib/build/recipe/accountlinking/index.js @@ -19,7 +19,18 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.isEmailChangeAllowed = exports.isSignInAllowed = exports.isSignUpAllowed = exports.getPrimaryUserThatCanBeLinkedToRecipeUserId = exports.createPrimaryUserIdOrLinkAccounts = exports.unlinkAccount = exports.linkAccounts = exports.canLinkAccounts = exports.createPrimaryUser = exports.canCreatePrimaryUser = exports.init = void 0; +exports.isEmailChangeAllowed = + exports.isSignInAllowed = + exports.isSignUpAllowed = + exports.getPrimaryUserThatCanBeLinkedToRecipeUserId = + exports.createPrimaryUserIdOrLinkAccounts = + exports.unlinkAccount = + exports.linkAccounts = + exports.canLinkAccounts = + exports.createPrimaryUser = + exports.canCreatePrimaryUser = + exports.init = + void 0; const recipe_1 = __importDefault(require("./recipe")); const __1 = require("../.."); const utils_1 = require("../../utils"); diff --git a/lib/build/recipe/accountlinking/recipeImplementation.js b/lib/build/recipe/accountlinking/recipeImplementation.js index cf6ae1f15..5edbce2fd 100644 --- a/lib/build/recipe/accountlinking/recipeImplementation.js +++ b/lib/build/recipe/accountlinking/recipeImplementation.js @@ -13,13 +13,7 @@ * License for the specific language governing permissions and limitations * under the License. */ -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; Object.defineProperty(exports, "__esModule", { value: true }); -const normalisedURLPath_1 = __importDefault(require("../../normalisedURLPath")); const user_1 = require("../../user"); function getRecipeImplementation(querier, config, recipeInstance) { return { @@ -37,9 +31,12 @@ function getRecipeImplementation(querier, config, recipeInstance) { includeRecipeIdsStr = includeRecipeIds.join(","); } let response = await querier.sendGetRequest( - new normalisedURLPath_1.default( - `${tenantId !== null && tenantId !== void 0 ? tenantId : "public"}/users` - ), + { + path: "//users", + params: { + tenantId: tenantId !== null && tenantId !== void 0 ? tenantId : "public", + }, + }, Object.assign( { includeRecipeIds: includeRecipeIdsStr, @@ -58,7 +55,7 @@ function getRecipeImplementation(querier, config, recipeInstance) { }, canCreatePrimaryUser: async function ({ recipeUserId, userContext }) { return await querier.sendGetRequest( - new normalisedURLPath_1.default("/recipe/accountlinking/user/primary/check"), + "/recipe/accountlinking/user/primary/check", { recipeUserId: recipeUserId.getAsString(), }, @@ -67,20 +64,20 @@ function getRecipeImplementation(querier, config, recipeInstance) { }, createPrimaryUser: async function ({ recipeUserId, userContext }) { let response = await querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/accountlinking/user/primary"), + "/recipe/accountlinking/user/primary", { recipeUserId: recipeUserId.getAsString(), }, userContext ); if (response.status === "OK") { - response.user = new user_1.User(response.user); + return Object.assign(Object.assign({}, response), { user: user_1.User.fromApi(response.user) }); } return response; }, canLinkAccounts: async function ({ recipeUserId, primaryUserId, userContext }) { let result = await querier.sendGetRequest( - new normalisedURLPath_1.default("/recipe/accountlinking/user/link/check"), + "/recipe/accountlinking/user/link/check", { recipeUserId: recipeUserId.getAsString(), primaryUserId, @@ -91,22 +88,20 @@ function getRecipeImplementation(querier, config, recipeInstance) { }, linkAccounts: async function ({ recipeUserId, primaryUserId, userContext }) { const accountsLinkingResult = await querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/accountlinking/user/link"), + "/recipe/accountlinking/user/link", { recipeUserId: recipeUserId.getAsString(), primaryUserId, }, userContext ); - if ( - ["OK", "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"].includes( - accountsLinkingResult.status - ) - ) { - accountsLinkingResult.user = new user_1.User(accountsLinkingResult.user); + if (accountsLinkingResult.status === "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR") { + return Object.assign(Object.assign({}, accountsLinkingResult), { + user: user_1.User.fromApi(accountsLinkingResult.user), + }); } if (accountsLinkingResult.status === "OK") { - let user = accountsLinkingResult.user; + let user = user_1.User.fromApi(accountsLinkingResult.user); if (!accountsLinkingResult.accountsAlreadyLinked) { await recipeInstance.verifyEmailForRecipeUserIfLinkedAccountsAreVerified({ user: user, @@ -129,13 +124,13 @@ function getRecipeImplementation(querier, config, recipeInstance) { } await config.onAccountLinked(user, loginMethodInfo, userContext); } - accountsLinkingResult.user = user; + return Object.assign(Object.assign({}, accountsLinkingResult), { user }); } return accountsLinkingResult; }, unlinkAccount: async function ({ recipeUserId, userContext }) { let accountsUnlinkingResult = await querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/accountlinking/user/unlink"), + "/recipe/accountlinking/user/unlink", { recipeUserId: recipeUserId.getAsString(), }, @@ -145,7 +140,7 @@ function getRecipeImplementation(querier, config, recipeInstance) { }, getUser: async function ({ userId, userContext }) { let result = await querier.sendGetRequest( - new normalisedURLPath_1.default("/user/id"), + "/user/id", { userId, }, @@ -159,9 +154,12 @@ function getRecipeImplementation(querier, config, recipeInstance) { listUsersByAccountInfo: async function ({ tenantId, accountInfo, doUnionOfAccountInfo, userContext }) { var _a, _b, _c; let result = await querier.sendGetRequest( - new normalisedURLPath_1.default( - `${tenantId !== null && tenantId !== void 0 ? tenantId : "public"}/users/by-accountinfo` - ), + { + path: "//users/by-accountinfo", + params: { + tenantId: tenantId !== null && tenantId !== void 0 ? tenantId : "public", + }, + }, { email: accountInfo.email, phoneNumber: accountInfo.phoneNumber, @@ -177,7 +175,7 @@ function getRecipeImplementation(querier, config, recipeInstance) { }, deleteUser: async function ({ userId, removeAllLinkedAccounts, userContext }) { return await querier.sendPostRequest( - new normalisedURLPath_1.default("/user/remove"), + "/user/remove", { userId, removeAllLinkedAccounts, diff --git a/lib/build/recipe/accountlinking/types.d.ts b/lib/build/recipe/accountlinking/types.d.ts index 9d1d54e78..5a9080571 100644 --- a/lib/build/recipe/accountlinking/types.d.ts +++ b/lib/build/recipe/accountlinking/types.d.ts @@ -70,10 +70,7 @@ export declare type RecipeInterface = { users: User[]; nextPaginationToken?: string; }>; - canCreatePrimaryUser: (input: { - recipeUserId: RecipeUserId; - userContext: UserContext; - }) => Promise< + canCreatePrimaryUser: (input: { recipeUserId: RecipeUserId; userContext: UserContext }) => Promise< | { status: "OK"; wasAlreadyAPrimaryUser: boolean; @@ -86,10 +83,7 @@ export declare type RecipeInterface = { description: string; } >; - createPrimaryUser: (input: { - recipeUserId: RecipeUserId; - userContext: UserContext; - }) => Promise< + createPrimaryUser: (input: { recipeUserId: RecipeUserId; userContext: UserContext }) => Promise< | { status: "OK"; user: User; @@ -128,11 +122,7 @@ export declare type RecipeInterface = { status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; } >; - linkAccounts: (input: { - recipeUserId: RecipeUserId; - primaryUserId: string; - userContext: UserContext; - }) => Promise< + linkAccounts: (input: { recipeUserId: RecipeUserId; primaryUserId: string; userContext: UserContext }) => Promise< | { status: "OK"; accountsAlreadyLinked: boolean; @@ -152,10 +142,7 @@ export declare type RecipeInterface = { status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; } >; - unlinkAccount: (input: { - recipeUserId: RecipeUserId; - userContext: UserContext; - }) => Promise<{ + unlinkAccount: (input: { recipeUserId: RecipeUserId; userContext: UserContext }) => Promise<{ status: "OK"; wasRecipeUserDeleted: boolean; wasLinked: boolean; @@ -167,11 +154,7 @@ export declare type RecipeInterface = { doUnionOfAccountInfo: boolean; userContext: UserContext; }) => Promise; - deleteUser: (input: { - userId: string; - removeAllLinkedAccounts: boolean; - userContext: UserContext; - }) => Promise<{ + deleteUser: (input: { userId: string; removeAllLinkedAccounts: boolean; userContext: UserContext }) => Promise<{ status: "OK"; }>; }; diff --git a/lib/build/recipe/dashboard/api/analytics.js b/lib/build/recipe/dashboard/api/analytics.js index 18762e156..6f6bb0460 100644 --- a/lib/build/recipe/dashboard/api/analytics.js +++ b/lib/build/recipe/dashboard/api/analytics.js @@ -21,7 +21,6 @@ var __importDefault = Object.defineProperty(exports, "__esModule", { value: true }); const supertokens_1 = __importDefault(require("../../../supertokens")); const querier_1 = require("../../../querier"); -const normalisedURLPath_1 = __importDefault(require("../../../normalisedURLPath")); const version_1 = require("../../../version"); const error_1 = __importDefault(require("../../../error")); const utils_1 = require("../../../utils"); @@ -49,7 +48,7 @@ async function analyticsPost(_, ___, options, userContext) { let numberOfUsers; try { let querier = querier_1.Querier.getNewInstanceOrThrowError(options.recipeId); - let response = await querier.sendGetRequest(new normalisedURLPath_1.default("/telemetry"), {}, userContext); + let response = await querier.sendGetRequest("/telemetry", {}, userContext); if (response.exists) { telemetryId = response.telemetryId; } diff --git a/lib/build/recipe/dashboard/api/multitenancy/getTenantInfo.js b/lib/build/recipe/dashboard/api/multitenancy/getTenantInfo.js index b7f39cc18..2b743e893 100644 --- a/lib/build/recipe/dashboard/api/multitenancy/getTenantInfo.js +++ b/lib/build/recipe/dashboard/api/multitenancy/getTenantInfo.js @@ -21,7 +21,6 @@ const recipe_1 = __importDefault(require("../../../multitenancy/recipe")); const supertokens_1 = __importDefault(require("../../../../supertokens")); const utils_1 = require("./utils"); const configUtils_1 = require("../../../thirdparty/providers/configUtils"); -const normalisedURLPath_1 = __importDefault(require("../../../../normalisedURLPath")); const querier_1 = require("../../../../querier"); const constants_1 = require("../../../multitenancy/constants"); async function getTenantInfo(_, tenantId, options, userContext) { @@ -60,7 +59,12 @@ async function getTenantInfo(_, tenantId, options, userContext) { ); let querier = querier_1.Querier.getNewInstanceOrThrowError(options.recipeId); let coreConfig = await querier.sendGetRequest( - new normalisedURLPath_1.default(`/${tenantId}/recipe/dashboard/tenant/core-config`), + { + path: "//recipe/dashboard/tenant/core-config", + params: { + tenantId, + }, + }, {}, userContext ); diff --git a/lib/build/recipe/dashboard/api/multitenancy/getThirdPartyConfig.js b/lib/build/recipe/dashboard/api/multitenancy/getThirdPartyConfig.js index 9c73084e7..697db62e8 100644 --- a/lib/build/recipe/dashboard/api/multitenancy/getThirdPartyConfig.js +++ b/lib/build/recipe/dashboard/api/multitenancy/getThirdPartyConfig.js @@ -89,9 +89,8 @@ async function getThirdPartyConfig(_, tenantId, options, userContext) { providersFromCore[0].authorizationEndpoint = undefined; providersFromCore[0].tokenEndpoint = undefined; providersFromCore[0].userInfoEndpoint = undefined; - providersFromCore[0].clients = ((_b = providersFromCore[0].clients) !== null && _b !== void 0 - ? _b - : [] + providersFromCore[0].clients = ( + (_b = providersFromCore[0].clients) !== null && _b !== void 0 ? _b : [] ).map((client) => Object.assign(Object.assign({}, client), { additionalConfig: Object.assign(Object.assign({}, client.additionalConfig), additionalConfig), diff --git a/lib/build/recipe/dashboard/api/multitenancy/updateTenantSecondaryFactor.js b/lib/build/recipe/dashboard/api/multitenancy/updateTenantSecondaryFactor.js index 8729bcb42..122b69b14 100644 --- a/lib/build/recipe/dashboard/api/multitenancy/updateTenantSecondaryFactor.js +++ b/lib/build/recipe/dashboard/api/multitenancy/updateTenantSecondaryFactor.js @@ -35,9 +35,8 @@ async function updateTenantSecondaryFactor(_, tenantId, options, userContext) { }; } } - let secondaryFactors = utils_1.getNormalisedRequiredSecondaryFactorsBasedOnTenantConfigFromCoreAndSDKInit( - tenantRes - ); + let secondaryFactors = + utils_1.getNormalisedRequiredSecondaryFactorsBasedOnTenantConfigFromCoreAndSDKInit(tenantRes); if (enable === true) { if (!secondaryFactors.includes(factorId)) { secondaryFactors.push(factorId); diff --git a/lib/build/recipe/dashboard/api/multitenancy/utils.js b/lib/build/recipe/dashboard/api/multitenancy/utils.js index 0285d3b8f..ba5d5965b 100644 --- a/lib/build/recipe/dashboard/api/multitenancy/utils.js +++ b/lib/build/recipe/dashboard/api/multitenancy/utils.js @@ -5,7 +5,11 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.getFactorNotAvailableMessage = exports.factorIdToRecipe = exports.getNormalisedRequiredSecondaryFactorsBasedOnTenantConfigFromCoreAndSDKInit = exports.getNormalisedFirstFactorsBasedOnTenantConfigFromCoreAndSDKInit = void 0; +exports.getFactorNotAvailableMessage = + exports.factorIdToRecipe = + exports.getNormalisedRequiredSecondaryFactorsBasedOnTenantConfigFromCoreAndSDKInit = + exports.getNormalisedFirstFactorsBasedOnTenantConfigFromCoreAndSDKInit = + void 0; const recipe_1 = __importDefault(require("../../../multitenancy/recipe")); const recipe_2 = __importDefault(require("../../../multifactorauth/recipe")); const utils_1 = require("../../../multitenancy/utils"); @@ -41,7 +45,8 @@ function getNormalisedFirstFactorsBasedOnTenantConfigFromCoreAndSDKInit(tenantDe } return validFirstFactors; } -exports.getNormalisedFirstFactorsBasedOnTenantConfigFromCoreAndSDKInit = getNormalisedFirstFactorsBasedOnTenantConfigFromCoreAndSDKInit; +exports.getNormalisedFirstFactorsBasedOnTenantConfigFromCoreAndSDKInit = + getNormalisedFirstFactorsBasedOnTenantConfigFromCoreAndSDKInit; function getNormalisedRequiredSecondaryFactorsBasedOnTenantConfigFromCoreAndSDKInit(tenantDetailsFromCore) { const mfaInstance = recipe_2.default.getInstance(); if (mfaInstance === undefined) { @@ -56,7 +61,8 @@ function getNormalisedRequiredSecondaryFactorsBasedOnTenantConfigFromCoreAndSDKI }); return secondaryFactors; } -exports.getNormalisedRequiredSecondaryFactorsBasedOnTenantConfigFromCoreAndSDKInit = getNormalisedRequiredSecondaryFactorsBasedOnTenantConfigFromCoreAndSDKInit; +exports.getNormalisedRequiredSecondaryFactorsBasedOnTenantConfigFromCoreAndSDKInit = + getNormalisedRequiredSecondaryFactorsBasedOnTenantConfigFromCoreAndSDKInit; function factorIdToRecipe(factorId) { const factorIdToRecipe = { emailpassword: "Emailpassword", diff --git a/lib/build/recipe/dashboard/api/search/tagsGet.js b/lib/build/recipe/dashboard/api/search/tagsGet.js index 06c87156f..8fa929e30 100644 --- a/lib/build/recipe/dashboard/api/search/tagsGet.js +++ b/lib/build/recipe/dashboard/api/search/tagsGet.js @@ -13,22 +13,12 @@ * License for the specific language governing permissions and limitations * under the License. */ -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getSearchTags = void 0; const querier_1 = require("../../../../querier"); -const normalisedURLPath_1 = __importDefault(require("../../../../normalisedURLPath")); const getSearchTags = async (_, ___, options, userContext) => { let querier = querier_1.Querier.getNewInstanceOrThrowError(options.recipeId); - let tagsResponse = await querier.sendGetRequest( - new normalisedURLPath_1.default("/user/search/tags"), - {}, - userContext - ); + let tagsResponse = await querier.sendGetRequest("/user/search/tags", {}, userContext); return tagsResponse; }; exports.getSearchTags = getSearchTags; diff --git a/lib/build/recipe/dashboard/api/signIn.js b/lib/build/recipe/dashboard/api/signIn.js index 5f52060a2..6e5488e18 100644 --- a/lib/build/recipe/dashboard/api/signIn.js +++ b/lib/build/recipe/dashboard/api/signIn.js @@ -22,7 +22,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); const utils_1 = require("../../../utils"); const error_1 = __importDefault(require("../../../error")); const querier_1 = require("../../../querier"); -const normalisedURLPath_1 = __importDefault(require("../../../normalisedURLPath")); async function signIn(_, options, userContext) { const { email, password } = await options.req.getJSONBody(); if (email === undefined) { @@ -39,7 +38,7 @@ async function signIn(_, options, userContext) { } let querier = querier_1.Querier.getNewInstanceOrThrowError(undefined); const signInResponse = await querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/dashboard/signin"), + "/recipe/dashboard/signin", { email, password, diff --git a/lib/build/recipe/dashboard/api/signOut.js b/lib/build/recipe/dashboard/api/signOut.js index 48e0d22fa..614f1f5ee 100644 --- a/lib/build/recipe/dashboard/api/signOut.js +++ b/lib/build/recipe/dashboard/api/signOut.js @@ -13,15 +13,9 @@ * License for the specific language governing permissions and limitations * under the License. */ -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; Object.defineProperty(exports, "__esModule", { value: true }); const utils_1 = require("../../../utils"); const querier_1 = require("../../../querier"); -const normalisedURLPath_1 = __importDefault(require("../../../normalisedURLPath")); async function signOut(_, ___, options, userContext) { var _a; if (options.config.authMode === "api-key") { @@ -31,8 +25,8 @@ async function signOut(_, ___, options, userContext) { (_a = options.req.getHeaderValue("authorization")) === null || _a === void 0 ? void 0 : _a.split(" ")[1]; let querier = querier_1.Querier.getNewInstanceOrThrowError(undefined); const sessionDeleteResponse = await querier.sendDeleteRequest( - new normalisedURLPath_1.default("/recipe/dashboard/session"), - {}, + "/recipe/dashboard/session", + undefined, { sessionId: sessionIdFormAuthHeader }, userContext ); diff --git a/lib/build/recipe/dashboard/api/usersGet.d.ts b/lib/build/recipe/dashboard/api/usersGet.d.ts index 00834f077..5bfb9dd24 100644 --- a/lib/build/recipe/dashboard/api/usersGet.d.ts +++ b/lib/build/recipe/dashboard/api/usersGet.d.ts @@ -6,8 +6,6 @@ export declare type Response = { users: UserWithFirstAndLastName[]; }; export default function usersGet(_: APIInterface, tenantId: string, options: APIOptions): Promise; -export declare function getSearchParamsFromURL( - path: string -): { +export declare function getSearchParamsFromURL(path: string): { [key: string]: string; }; diff --git a/lib/build/recipe/dashboard/recipeImplementation.js b/lib/build/recipe/dashboard/recipeImplementation.js index 9ad3fa57c..d8a8a18d3 100644 --- a/lib/build/recipe/dashboard/recipeImplementation.js +++ b/lib/build/recipe/dashboard/recipeImplementation.js @@ -21,7 +21,6 @@ var __importDefault = Object.defineProperty(exports, "__esModule", { value: true }); const error_1 = __importDefault(require("./error")); const logger_1 = require("../../logger"); -const normalisedURLPath_1 = __importDefault(require("../../normalisedURLPath")); const querier_1 = require("../../querier"); const utils_1 = require("../../utils"); const version_1 = require("../../version"); @@ -43,7 +42,7 @@ function getRecipeImplementation() { ? void 0 : _a.split(" ")[1]; const sessionVerificationResponse = await querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/dashboard/session/verify"), + "/recipe/dashboard/session/verify", { sessionId: authHeaderValue, }, diff --git a/lib/build/recipe/dashboard/utils.js b/lib/build/recipe/dashboard/utils.js index 81f5cc881..c149c90bc 100644 --- a/lib/build/recipe/dashboard/utils.js +++ b/lib/build/recipe/dashboard/utils.js @@ -19,7 +19,13 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.getApiPathWithDashboardBase = exports.validateApiKey = exports.getUserForRecipeId = exports.isValidRecipeId = exports.sendUnauthorisedAccess = exports.validateAndNormaliseUserInput = void 0; +exports.getApiPathWithDashboardBase = + exports.validateApiKey = + exports.getUserForRecipeId = + exports.isValidRecipeId = + exports.sendUnauthorisedAccess = + exports.validateAndNormaliseUserInput = + void 0; const utils_1 = require("../../utils"); const constants_1 = require("./constants"); const recipe_1 = __importDefault(require("../accountlinking/recipe")); diff --git a/lib/build/recipe/emailpassword/api/implementation.js b/lib/build/recipe/emailpassword/api/implementation.js index 501fe1f30..48ae4ea6e 100644 --- a/lib/build/recipe/emailpassword/api/implementation.js +++ b/lib/build/recipe/emailpassword/api/implementation.js @@ -213,8 +213,7 @@ function getAPIImplementation() { if (!emailVerified && hasOtherEmailOrPhone) { return { status: "PASSWORD_RESET_NOT_ALLOWED", - reason: - "Reset password link was not created because of account take over risk. Please contact support. (ERR_CODE_001)", + reason: "Reset password link was not created because of account take over risk. Please contact support. (ERR_CODE_001)", }; } if (linkingCandidate.isPrimaryUser && emailPasswordAccount !== undefined) { @@ -311,14 +310,13 @@ function getAPIImplementation() { async function markEmailAsVerified(recipeUserId, email) { const emailVerificationInstance = recipe_2.default.getInstance(); if (emailVerificationInstance) { - const tokenResponse = await emailVerificationInstance.recipeInterfaceImpl.createEmailVerificationToken( - { + const tokenResponse = + await emailVerificationInstance.recipeInterfaceImpl.createEmailVerificationToken({ tenantId, recipeUserId, email, userContext, - } - ); + }); if (tokenResponse.status === "OK") { await emailVerificationInstance.recipeInterfaceImpl.verifyEmailUsingToken({ tenantId, diff --git a/lib/build/recipe/emailpassword/emaildelivery/services/backwardCompatibility/index.d.ts b/lib/build/recipe/emailpassword/emaildelivery/services/backwardCompatibility/index.d.ts index 7184fcbbd..bca6a6f17 100644 --- a/lib/build/recipe/emailpassword/emaildelivery/services/backwardCompatibility/index.d.ts +++ b/lib/build/recipe/emailpassword/emaildelivery/services/backwardCompatibility/index.d.ts @@ -3,7 +3,8 @@ import { TypeEmailPasswordEmailDeliveryInput } from "../../../types"; import { NormalisedAppinfo, UserContext } from "../../../../../types"; import { EmailDeliveryInterface } from "../../../../../ingredients/emaildelivery/types"; export default class BackwardCompatibilityService - implements EmailDeliveryInterface { + implements EmailDeliveryInterface +{ private isInServerlessEnv; private appInfo; constructor(appInfo: NormalisedAppinfo, isInServerlessEnv: boolean); diff --git a/lib/build/recipe/emailpassword/index.js b/lib/build/recipe/emailpassword/index.js index 2c77224c0..9e6939af6 100644 --- a/lib/build/recipe/emailpassword/index.js +++ b/lib/build/recipe/emailpassword/index.js @@ -19,7 +19,19 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.sendEmail = exports.sendResetPasswordEmail = exports.createResetPasswordLink = exports.updateEmailOrPassword = exports.consumePasswordResetToken = exports.resetPasswordUsingToken = exports.createResetPasswordToken = exports.verifyCredentials = exports.signIn = exports.signUp = exports.Error = exports.init = void 0; +exports.sendEmail = + exports.sendResetPasswordEmail = + exports.createResetPasswordLink = + exports.updateEmailOrPassword = + exports.consumePasswordResetToken = + exports.resetPasswordUsingToken = + exports.createResetPasswordToken = + exports.verifyCredentials = + exports.signIn = + exports.signUp = + exports.Error = + exports.init = + void 0; const recipe_1 = __importDefault(require("./recipe")); const error_1 = __importDefault(require("./error")); const recipeUserId_1 = __importDefault(require("../../recipeUserId")); diff --git a/lib/build/recipe/emailpassword/recipe.js b/lib/build/recipe/emailpassword/recipe.js index dc968c536..fde4dddb2 100644 --- a/lib/build/recipe/emailpassword/recipe.js +++ b/lib/build/recipe/emailpassword/recipe.js @@ -191,9 +191,8 @@ class Recipe extends recipeModule_1.default { return a.timeJoined - b.timeJoined; }); // Then we take the ones that belong to this recipe - const recipeLoginMethodsOrderedByTimeJoinedOldestFirst = orderedLoginMethodsByTimeJoinedOldestFirst.filter( - (lm) => lm.recipeId === Recipe.RECIPE_ID - ); + const recipeLoginMethodsOrderedByTimeJoinedOldestFirst = + orderedLoginMethodsByTimeJoinedOldestFirst.filter((lm) => lm.recipeId === Recipe.RECIPE_ID); let result; if (recipeLoginMethodsOrderedByTimeJoinedOldestFirst.length !== 0) { // If there are login methods belonging to this recipe, the factor is set up diff --git a/lib/build/recipe/emailpassword/recipeImplementation.js b/lib/build/recipe/emailpassword/recipeImplementation.js index acbbb1c7f..cb8473498 100644 --- a/lib/build/recipe/emailpassword/recipeImplementation.js +++ b/lib/build/recipe/emailpassword/recipeImplementation.js @@ -7,7 +7,6 @@ var __importDefault = Object.defineProperty(exports, "__esModule", { value: true }); const recipe_1 = __importDefault(require("../accountlinking/recipe")); const recipe_2 = __importDefault(require("../emailverification/recipe")); -const normalisedURLPath_1 = __importDefault(require("../../normalisedURLPath")); const __1 = require("../.."); const constants_1 = require("./constants"); const recipeUserId_1 = __importDefault(require("../../recipeUserId")); @@ -27,16 +26,15 @@ function getRecipeInterface(querier, getEmailPasswordConfig) { return response; } let updatedUser = response.user; - const linkResult = await authUtils_1.AuthUtils.linkToSessionIfRequiredElseCreatePrimaryUserIdOrLinkByAccountInfo( - { + const linkResult = + await authUtils_1.AuthUtils.linkToSessionIfRequiredElseCreatePrimaryUserIdOrLinkByAccountInfo({ tenantId, inputUser: response.user, recipeUserId: response.recipeUserId, session, shouldTryLinkingWithSessionUser, userContext, - } - ); + }); if (linkResult.status != "OK") { return linkResult; } @@ -49,9 +47,12 @@ function getRecipeInterface(querier, getEmailPasswordConfig) { }, createNewRecipeUser: async function (input) { const resp = await querier.sendPostRequest( - new normalisedURLPath_1.default( - `/${input.tenantId === undefined ? constants_2.DEFAULT_TENANT_ID : input.tenantId}/recipe/signup` - ), + { + path: "//recipe/signup", + params: { + tenantId: input.tenantId === undefined ? constants_2.DEFAULT_TENANT_ID : input.tenantId, + }, + }, { email: input.email, password: input.password, @@ -94,16 +95,15 @@ function getRecipeInterface(querier, getEmailPasswordConfig) { // function updated the verification status) and can return that response.user = await __1.getUser(response.recipeUserId.getAsString(), userContext); } - const linkResult = await authUtils_1.AuthUtils.linkToSessionIfRequiredElseCreatePrimaryUserIdOrLinkByAccountInfo( - { + const linkResult = + await authUtils_1.AuthUtils.linkToSessionIfRequiredElseCreatePrimaryUserIdOrLinkByAccountInfo({ tenantId, inputUser: response.user, recipeUserId: response.recipeUserId, session, shouldTryLinkingWithSessionUser, userContext, - } - ); + }); if (linkResult.status === "LINKING_TO_SESSION_USER_FAILED") { return linkResult; } @@ -113,9 +113,12 @@ function getRecipeInterface(querier, getEmailPasswordConfig) { }, verifyCredentials: async function ({ email, password, tenantId, userContext }) { const response = await querier.sendPostRequest( - new normalisedURLPath_1.default( - `/${tenantId === undefined ? constants_2.DEFAULT_TENANT_ID : tenantId}/recipe/signin` - ), + { + path: "//recipe/signin", + params: { + tenantId: tenantId === undefined ? constants_2.DEFAULT_TENANT_ID : tenantId, + }, + }, { email, password, @@ -136,11 +139,12 @@ function getRecipeInterface(querier, getEmailPasswordConfig) { createResetPasswordToken: async function ({ userId, email, tenantId, userContext }) { // the input user ID can be a recipe or a primary user ID. return await querier.sendPostRequest( - new normalisedURLPath_1.default( - `/${ - tenantId === undefined ? constants_2.DEFAULT_TENANT_ID : tenantId - }/recipe/user/password/reset/token` - ), + { + path: "//recipe/user/password/reset/token", + params: { + tenantId: tenantId === undefined ? constants_2.DEFAULT_TENANT_ID : tenantId, + }, + }, { userId, email, @@ -150,13 +154,13 @@ function getRecipeInterface(querier, getEmailPasswordConfig) { }, consumePasswordResetToken: async function ({ token, tenantId, userContext }) { return await querier.sendPostRequest( - new normalisedURLPath_1.default( - `/${ - tenantId === undefined ? constants_2.DEFAULT_TENANT_ID : tenantId - }/recipe/user/password/reset/token/consume` - ), { - method: "token", + path: "//recipe/user/password/reset/token/consume", + params: { + tenantId: tenantId === undefined ? constants_2.DEFAULT_TENANT_ID : tenantId, + }, + }, + { token, }, userContext @@ -219,7 +223,7 @@ function getRecipeInterface(querier, getEmailPasswordConfig) { // a change in email. The check for email verification should actually go in // an update email API (post login update). let response = await querier.sendPutRequest( - new normalisedURLPath_1.default(`/recipe/user`), + "/recipe/user", { recipeUserId: input.recipeUserId.getAsString(), email: input.email, diff --git a/lib/build/recipe/emailpassword/types.d.ts b/lib/build/recipe/emailpassword/types.d.ts index fa3eb1408..08a8e94d1 100644 --- a/lib/build/recipe/emailpassword/types.d.ts +++ b/lib/build/recipe/emailpassword/types.d.ts @@ -128,12 +128,7 @@ export declare type RecipeInterface = { | "SESSION_USER_ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; } >; - verifyCredentials(input: { - email: string; - password: string; - tenantId: string; - userContext: UserContext; - }): Promise< + verifyCredentials(input: { email: string; password: string; tenantId: string; userContext: UserContext }): Promise< | { status: "OK"; user: User; @@ -162,11 +157,7 @@ export declare type RecipeInterface = { status: "UNKNOWN_USER_ID_ERROR"; } >; - consumePasswordResetToken(input: { - token: string; - tenantId: string; - userContext: UserContext; - }): Promise< + consumePasswordResetToken(input: { token: string; tenantId: string; userContext: UserContext }): Promise< | { status: "OK"; email: string; @@ -210,12 +201,7 @@ export declare type APIOptions = { export declare type APIInterface = { emailExistsGET: | undefined - | ((input: { - email: string; - tenantId: string; - options: APIOptions; - userContext: UserContext; - }) => Promise< + | ((input: { email: string; tenantId: string; options: APIOptions; userContext: UserContext }) => Promise< | { status: "OK"; exists: boolean; diff --git a/lib/build/recipe/emailpassword/utils.js b/lib/build/recipe/emailpassword/utils.js index 18014af69..b36538a4f 100644 --- a/lib/build/recipe/emailpassword/utils.js +++ b/lib/build/recipe/emailpassword/utils.js @@ -19,7 +19,12 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.getPasswordResetLink = exports.defaultEmailValidator = exports.defaultPasswordValidator = exports.normaliseSignUpFormFields = exports.validateAndNormaliseUserInput = void 0; +exports.getPasswordResetLink = + exports.defaultEmailValidator = + exports.defaultPasswordValidator = + exports.normaliseSignUpFormFields = + exports.validateAndNormaliseUserInput = + void 0; const constants_1 = require("./constants"); const backwardCompatibility_1 = __importDefault(require("./emaildelivery/services/backwardCompatibility")); function validateAndNormaliseUserInput(recipeInstance, appInfo, config) { diff --git a/lib/build/recipe/emailverification/emaildelivery/services/backwardCompatibility/index.d.ts b/lib/build/recipe/emailverification/emaildelivery/services/backwardCompatibility/index.d.ts index d5c7479ac..572911269 100644 --- a/lib/build/recipe/emailverification/emaildelivery/services/backwardCompatibility/index.d.ts +++ b/lib/build/recipe/emailverification/emaildelivery/services/backwardCompatibility/index.d.ts @@ -3,7 +3,8 @@ import { TypeEmailVerificationEmailDeliveryInput } from "../../../types"; import { NormalisedAppinfo, UserContext } from "../../../../../types"; import { EmailDeliveryInterface } from "../../../../../ingredients/emaildelivery/types"; export default class BackwardCompatibilityService - implements EmailDeliveryInterface { + implements EmailDeliveryInterface +{ private appInfo; private isInServerlessEnv; constructor(appInfo: NormalisedAppinfo, isInServerlessEnv: boolean); diff --git a/lib/build/recipe/emailverification/index.js b/lib/build/recipe/emailverification/index.js index af145da81..084d1c0a7 100644 --- a/lib/build/recipe/emailverification/index.js +++ b/lib/build/recipe/emailverification/index.js @@ -19,7 +19,18 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.EmailVerificationClaim = exports.sendEmail = exports.unverifyEmail = exports.revokeEmailVerificationTokens = exports.isEmailVerified = exports.verifyEmailUsingToken = exports.sendEmailVerificationEmail = exports.createEmailVerificationLink = exports.createEmailVerificationToken = exports.Error = exports.init = void 0; +exports.EmailVerificationClaim = + exports.sendEmail = + exports.unverifyEmail = + exports.revokeEmailVerificationTokens = + exports.isEmailVerified = + exports.verifyEmailUsingToken = + exports.sendEmailVerificationEmail = + exports.createEmailVerificationLink = + exports.createEmailVerificationToken = + exports.Error = + exports.init = + void 0; const recipe_1 = __importDefault(require("./recipe")); const error_1 = __importDefault(require("./error")); const emailVerificationClaim_1 = require("./emailVerificationClaim"); diff --git a/lib/build/recipe/emailverification/recipeImplementation.js b/lib/build/recipe/emailverification/recipeImplementation.js index 347bc8f44..20739f9ac 100644 --- a/lib/build/recipe/emailverification/recipeImplementation.js +++ b/lib/build/recipe/emailverification/recipeImplementation.js @@ -5,14 +5,18 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -const normalisedURLPath_1 = __importDefault(require("../../normalisedURLPath")); const recipeUserId_1 = __importDefault(require("../../recipeUserId")); const __1 = require("../.."); function getRecipeInterface(querier, getEmailForRecipeUserId) { return { createEmailVerificationToken: async function ({ recipeUserId, email, tenantId, userContext }) { let response = await querier.sendPostRequest( - new normalisedURLPath_1.default(`/${tenantId}/recipe/user/email/verify/token`), + { + path: "//recipe/user/email/verify/token", + params: { + tenantId, + }, + }, { userId: recipeUserId.getAsString(), email, @@ -32,7 +36,12 @@ function getRecipeInterface(querier, getEmailForRecipeUserId) { }, verifyEmailUsingToken: async function ({ token, attemptAccountLinking, tenantId, userContext }) { let response = await querier.sendPostRequest( - new normalisedURLPath_1.default(`/${tenantId}/recipe/user/email/verify`), + { + path: "//recipe/user/email/verify", + params: { + tenantId, + }, + }, { method: "token", token, @@ -78,7 +87,7 @@ function getRecipeInterface(querier, getEmailForRecipeUserId) { }, isEmailVerified: async function ({ recipeUserId, email, userContext }) { let response = await querier.sendGetRequest( - new normalisedURLPath_1.default("/recipe/user/email/verify"), + "/recipe/user/email/verify", { userId: recipeUserId.getAsString(), email, @@ -89,7 +98,12 @@ function getRecipeInterface(querier, getEmailForRecipeUserId) { }, revokeEmailVerificationTokens: async function (input) { await querier.sendPostRequest( - new normalisedURLPath_1.default(`/${input.tenantId}/recipe/user/email/verify/token/remove`), + { + path: "//recipe/user/email/verify/token/remove", + params: { + tenantId: input.tenantId, + }, + }, { userId: input.recipeUserId.getAsString(), email: input.email, @@ -100,7 +114,7 @@ function getRecipeInterface(querier, getEmailForRecipeUserId) { }, unverifyEmail: async function (input) { await querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/user/email/verify/remove"), + "/recipe/user/email/verify/remove", { userId: input.recipeUserId.getAsString(), email: input.email, diff --git a/lib/build/recipe/emailverification/types.d.ts b/lib/build/recipe/emailverification/types.d.ts index fb0e7c24d..55f3e89d3 100644 --- a/lib/build/recipe/emailverification/types.d.ts +++ b/lib/build/recipe/emailverification/types.d.ts @@ -100,11 +100,7 @@ export declare type RecipeInterface = { }): Promise<{ status: "OK"; }>; - unverifyEmail(input: { - recipeUserId: RecipeUserId; - email: string; - userContext: UserContext; - }): Promise<{ + unverifyEmail(input: { recipeUserId: RecipeUserId; email: string; userContext: UserContext }): Promise<{ status: "OK"; }>; }; @@ -140,11 +136,7 @@ export declare type APIInterface = { >); isEmailVerifiedGET: | undefined - | ((input: { - options: APIOptions; - userContext: UserContext; - session: SessionContainerInterface; - }) => Promise< + | ((input: { options: APIOptions; userContext: UserContext; session: SessionContainerInterface }) => Promise< | { status: "OK"; isVerified: boolean; @@ -154,11 +146,7 @@ export declare type APIInterface = { >); generateEmailVerifyTokenPOST: | undefined - | ((input: { - options: APIOptions; - userContext: UserContext; - session: SessionContainerInterface; - }) => Promise< + | ((input: { options: APIOptions; userContext: UserContext; session: SessionContainerInterface }) => Promise< | { status: "OK"; } diff --git a/lib/build/recipe/jwt/index.d.ts b/lib/build/recipe/jwt/index.d.ts index ed6ab4c4e..734746418 100644 --- a/lib/build/recipe/jwt/index.d.ts +++ b/lib/build/recipe/jwt/index.d.ts @@ -17,9 +17,7 @@ export default class Wrapper { status: "UNSUPPORTED_ALGORITHM_ERROR"; } >; - static getJWKS( - userContext?: Record - ): Promise<{ + static getJWKS(userContext?: Record): Promise<{ keys: JsonWebKey[]; validityInSeconds?: number | undefined; }>; diff --git a/lib/build/recipe/jwt/recipeImplementation.js b/lib/build/recipe/jwt/recipeImplementation.js index 0ac8ddf6f..9cce12755 100644 --- a/lib/build/recipe/jwt/recipeImplementation.js +++ b/lib/build/recipe/jwt/recipeImplementation.js @@ -13,13 +13,7 @@ * License for the specific language governing permissions and limitations * under the License. */ -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; Object.defineProperty(exports, "__esModule", { value: true }); -const normalisedURLPath_1 = __importDefault(require("../../normalisedURLPath")); const defaultJWKSMaxAge = 60; // This corresponds to the dynamicSigningKeyOverlapMS in the core function getRecipeInterface(querier, config, appInfo) { return { @@ -29,7 +23,7 @@ function getRecipeInterface(querier, config, appInfo) { validitySeconds = config.jwtValiditySeconds; } let response = await querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/jwt"), + "/recipe/jwt", { payload: payload !== null && payload !== void 0 ? payload : {}, validity: validitySeconds, @@ -52,7 +46,7 @@ function getRecipeInterface(querier, config, appInfo) { }, getJWKS: async function ({ userContext }) { const { body, headers } = await querier.sendGetRequestWithResponseHeaders( - new normalisedURLPath_1.default("/.well-known/jwks.json"), + "/.well-known/jwks.json", {}, undefined, userContext diff --git a/lib/build/recipe/jwt/types.d.ts b/lib/build/recipe/jwt/types.d.ts index 84c1802ae..b78d5c45e 100644 --- a/lib/build/recipe/jwt/types.d.ts +++ b/lib/build/recipe/jwt/types.d.ts @@ -53,9 +53,7 @@ export declare type RecipeInterface = { status: "UNSUPPORTED_ALGORITHM_ERROR"; } >; - getJWKS(input: { - userContext: UserContext; - }): Promise<{ + getJWKS(input: { userContext: UserContext }): Promise<{ keys: JsonWebKey[]; validityInSeconds?: number; }>; @@ -63,10 +61,7 @@ export declare type RecipeInterface = { export declare type APIInterface = { getJWKSGET: | undefined - | ((input: { - options: APIOptions; - userContext: UserContext; - }) => Promise< + | ((input: { options: APIOptions; userContext: UserContext }) => Promise< | { keys: JsonWebKey[]; } diff --git a/lib/build/recipe/multifactorauth/api/implementation.js b/lib/build/recipe/multifactorauth/api/implementation.js index 954ae11bd..38d01101a 100644 --- a/lib/build/recipe/multifactorauth/api/implementation.js +++ b/lib/build/recipe/multifactorauth/api/implementation.js @@ -72,10 +72,11 @@ function getAPIInterface() { // ignore claims error and not add to the list of factors allowed to be set up } } - const nextSetOfUnsatisfiedFactors = multiFactorAuthClaim_1.MultiFactorAuthClaim.getNextSetOfUnsatisfiedFactors( - mfaInfo.completedFactors, - mfaInfo.mfaRequirementsForAuth - ); + const nextSetOfUnsatisfiedFactors = + multiFactorAuthClaim_1.MultiFactorAuthClaim.getNextSetOfUnsatisfiedFactors( + mfaInfo.completedFactors, + mfaInfo.mfaRequirementsForAuth + ); let getEmailsForFactorsResult = options.recipeInstance.getEmailsForFactors( sessionUser, session.getRecipeUserId(userContext) diff --git a/lib/build/recipe/multifactorauth/index.js b/lib/build/recipe/multifactorauth/index.js index 25e208c4c..8c114acf0 100644 --- a/lib/build/recipe/multifactorauth/index.js +++ b/lib/build/recipe/multifactorauth/index.js @@ -19,7 +19,17 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.FactorIds = exports.MultiFactorAuthClaim = exports.removeFromRequiredSecondaryFactorsForUser = exports.addToRequiredSecondaryFactorsForUser = exports.getMFARequirementsForAuth = exports.getRequiredSecondaryFactorsForUser = exports.getFactorsSetupForUser = exports.markFactorAsCompleteInSession = exports.assertAllowedToSetupFactorElseThrowInvalidClaimError = exports.init = void 0; +exports.FactorIds = + exports.MultiFactorAuthClaim = + exports.removeFromRequiredSecondaryFactorsForUser = + exports.addToRequiredSecondaryFactorsForUser = + exports.getMFARequirementsForAuth = + exports.getRequiredSecondaryFactorsForUser = + exports.getFactorsSetupForUser = + exports.markFactorAsCompleteInSession = + exports.assertAllowedToSetupFactorElseThrowInvalidClaimError = + exports.init = + void 0; const recipe_1 = __importDefault(require("./recipe")); const multiFactorAuthClaim_1 = require("./multiFactorAuthClaim"); Object.defineProperty(exports, "MultiFactorAuthClaim", { diff --git a/lib/build/recipe/multifactorauth/multiFactorAuthClaim.d.ts b/lib/build/recipe/multifactorauth/multiFactorAuthClaim.d.ts index 07976ada7..2ef6410b4 100644 --- a/lib/build/recipe/multifactorauth/multiFactorAuthClaim.d.ts +++ b/lib/build/recipe/multifactorauth/multiFactorAuthClaim.d.ts @@ -50,14 +50,10 @@ export declare class MultiFactorAuthClaimClass extends SessionClaim { + removeFromPayload: (payload: JSONObject) => { [x: string]: import("../../types").JSONValue; }; - removeFromPayloadByMerge_internal: ( - payload: JSONObject - ) => { + removeFromPayloadByMerge_internal: (payload: JSONObject) => { [x: string]: import("../../types").JSONValue; }; getValueFromPayload: (payload: JSONObject) => MFAClaimValue; diff --git a/lib/build/recipe/multifactorauth/recipeImplementation.js b/lib/build/recipe/multifactorauth/recipeImplementation.js index 611743da9..2217ce32f 100644 --- a/lib/build/recipe/multifactorauth/recipeImplementation.js +++ b/lib/build/recipe/multifactorauth/recipeImplementation.js @@ -88,10 +88,11 @@ function getRecipeInterface(recipeInstance) { ); return { isValid: true }; } - const setOfUnsatisfiedFactors = multiFactorAuthClaim_1.MultiFactorAuthClaim.getNextSetOfUnsatisfiedFactors( - claimVal.c, - await input.mfaRequirementsForAuth - ); + const setOfUnsatisfiedFactors = + multiFactorAuthClaim_1.MultiFactorAuthClaim.getNextSetOfUnsatisfiedFactors( + claimVal.c, + await input.mfaRequirementsForAuth + ); const factorsSetUpForUserRes = await input.factorsSetUpForUser; if (setOfUnsatisfiedFactors.factorIds.some((id) => factorsSetUpForUserRes.includes(id))) { logger_1.logDebugMessage( diff --git a/lib/build/recipe/multifactorauth/types.d.ts b/lib/build/recipe/multifactorauth/types.d.ts index e02cbadb4..40db1bdbc 100644 --- a/lib/build/recipe/multifactorauth/types.d.ts +++ b/lib/build/recipe/multifactorauth/types.d.ts @@ -89,11 +89,7 @@ export declare type APIOptions = { export declare type APIInterface = { resyncSessionAndFetchMFAInfoPUT: | undefined - | ((input: { - options: APIOptions; - session: SessionContainerInterface; - userContext: UserContext; - }) => Promise< + | ((input: { options: APIOptions; session: SessionContainerInterface; userContext: UserContext }) => Promise< | { status: "OK"; factors: { diff --git a/lib/build/recipe/multitenancy/index.d.ts b/lib/build/recipe/multitenancy/index.d.ts index 6aef31375..d592eb4be 100644 --- a/lib/build/recipe/multitenancy/index.d.ts +++ b/lib/build/recipe/multitenancy/index.d.ts @@ -36,9 +36,7 @@ export default class Wrapper { } & TenantConfig) | undefined >; - static listAllTenants( - userContext?: Record - ): Promise<{ + static listAllTenants(userContext?: Record): Promise<{ status: "OK"; tenants: ({ tenantId: string; diff --git a/lib/build/recipe/multitenancy/index.js b/lib/build/recipe/multitenancy/index.js index bb6446939..6beb76416 100644 --- a/lib/build/recipe/multitenancy/index.js +++ b/lib/build/recipe/multitenancy/index.js @@ -19,7 +19,17 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.AllowedDomainsClaim = exports.disassociateUserFromTenant = exports.associateUserToTenant = exports.deleteThirdPartyConfig = exports.createOrUpdateThirdPartyConfig = exports.listAllTenants = exports.getTenant = exports.deleteTenant = exports.createOrUpdateTenant = exports.init = void 0; +exports.AllowedDomainsClaim = + exports.disassociateUserFromTenant = + exports.associateUserToTenant = + exports.deleteThirdPartyConfig = + exports.createOrUpdateThirdPartyConfig = + exports.listAllTenants = + exports.getTenant = + exports.deleteTenant = + exports.createOrUpdateTenant = + exports.init = + void 0; const recipe_1 = __importDefault(require("./recipe")); const allowedDomainsClaim_1 = require("./allowedDomainsClaim"); Object.defineProperty(exports, "AllowedDomainsClaim", { diff --git a/lib/build/recipe/multitenancy/recipeImplementation.js b/lib/build/recipe/multitenancy/recipeImplementation.js index 044c7e319..50e21c8cb 100644 --- a/lib/build/recipe/multitenancy/recipeImplementation.js +++ b/lib/build/recipe/multitenancy/recipeImplementation.js @@ -1,11 +1,5 @@ "use strict"; -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; Object.defineProperty(exports, "__esModule", { value: true }); -const normalisedURLPath_1 = __importDefault(require("../../normalisedURLPath")); const constants_1 = require("./constants"); function getRecipeInterface(querier) { return { @@ -14,8 +8,20 @@ function getRecipeInterface(querier) { }, createOrUpdateTenant: async function ({ tenantId, config, userContext }) { let response = await querier.sendPutRequest( - new normalisedURLPath_1.default(`/recipe/multitenancy/tenant/v2`), - Object.assign({ tenantId }, config), + "/recipe/multitenancy/tenant/v2", + Object.assign( + { tenantId }, + { + config: Object.assign(Object.assign({}, config), { + firstFactors: + (config === null || config === void 0 ? void 0 : config.firstFactors) === null + ? undefined + : config === null || config === void 0 + ? void 0 + : config.firstFactors, + }), + } + ), {}, userContext ); @@ -23,7 +29,7 @@ function getRecipeInterface(querier) { }, deleteTenant: async function ({ tenantId, userContext }) { let response = await querier.sendPostRequest( - new normalisedURLPath_1.default(`/recipe/multitenancy/tenant/remove`), + "/recipe/multitenancy/tenant/remove", { tenantId, }, @@ -33,11 +39,12 @@ function getRecipeInterface(querier) { }, getTenant: async function ({ tenantId, userContext }) { let response = await querier.sendGetRequest( - new normalisedURLPath_1.default( - `/${ - tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId - }/recipe/multitenancy/tenant/v2` - ), + { + path: "//recipe/multitenancy/tenant/v2", + params: { + tenantId: tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId, + }, + }, {}, userContext ); @@ -47,20 +54,17 @@ function getRecipeInterface(querier) { return response; }, listAllTenants: async function ({ userContext }) { - let response = await querier.sendGetRequest( - new normalisedURLPath_1.default(`/recipe/multitenancy/tenant/list/v2`), - {}, - userContext - ); + let response = await querier.sendGetRequest("/recipe/multitenancy/tenant/list/v2", {}, userContext); return response; }, createOrUpdateThirdPartyConfig: async function ({ tenantId, config, skipValidation, userContext }) { let response = await querier.sendPutRequest( - new normalisedURLPath_1.default( - `/${ - tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId - }/recipe/multitenancy/config/thirdparty` - ), + { + path: "//recipe/multitenancy/config/thirdparty", + params: { + tenantId: tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId, + }, + }, { config, skipValidation, @@ -72,11 +76,12 @@ function getRecipeInterface(querier) { }, deleteThirdPartyConfig: async function ({ tenantId, thirdPartyId, userContext }) { let response = await querier.sendPostRequest( - new normalisedURLPath_1.default( - `/${ - tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId - }/recipe/multitenancy/config/thirdparty/remove` - ), + { + path: "//recipe/multitenancy/config/thirdparty/remove", + params: { + tenantId: tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId, + }, + }, { thirdPartyId, }, @@ -86,11 +91,12 @@ function getRecipeInterface(querier) { }, associateUserToTenant: async function ({ tenantId, recipeUserId, userContext }) { let response = await querier.sendPostRequest( - new normalisedURLPath_1.default( - `/${ - tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId - }/recipe/multitenancy/tenant/user` - ), + { + path: "//recipe/multitenancy/tenant/user", + params: { + tenantId: tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId, + }, + }, { recipeUserId: recipeUserId.getAsString(), }, @@ -100,11 +106,12 @@ function getRecipeInterface(querier) { }, disassociateUserFromTenant: async function ({ tenantId, recipeUserId, userContext }) { let response = await querier.sendPostRequest( - new normalisedURLPath_1.default( - `/${ - tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId - }/recipe/multitenancy/tenant/user/remove` - ), + { + path: "//recipe/multitenancy/tenant/user/remove", + params: { + tenantId: tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId, + }, + }, { recipeUserId: recipeUserId.getAsString(), }, diff --git a/lib/build/recipe/multitenancy/types.d.ts b/lib/build/recipe/multitenancy/types.d.ts index e3d0008a6..3aff87722 100644 --- a/lib/build/recipe/multitenancy/types.d.ts +++ b/lib/build/recipe/multitenancy/types.d.ts @@ -50,25 +50,17 @@ export declare type RecipeInterface = { status: "OK"; createdNew: boolean; }>; - deleteTenant: (input: { - tenantId: string; - userContext: UserContext; - }) => Promise<{ + deleteTenant: (input: { tenantId: string; userContext: UserContext }) => Promise<{ status: "OK"; didExist: boolean; }>; - getTenant: (input: { - tenantId: string; - userContext: UserContext; - }) => Promise< + getTenant: (input: { tenantId: string; userContext: UserContext }) => Promise< | ({ status: "OK"; } & TenantConfig) | undefined >; - listAllTenants: (input: { - userContext: UserContext; - }) => Promise<{ + listAllTenants: (input: { userContext: UserContext }) => Promise<{ status: "OK"; tenants: (TenantConfig & { tenantId: string; @@ -83,11 +75,7 @@ export declare type RecipeInterface = { status: "OK"; createdNew: boolean; }>; - deleteThirdPartyConfig: (input: { - tenantId: string; - thirdPartyId: string; - userContext: UserContext; - }) => Promise<{ + deleteThirdPartyConfig: (input: { tenantId: string; thirdPartyId: string; userContext: UserContext }) => Promise<{ status: "OK"; didConfigExist: boolean; }>; diff --git a/lib/build/recipe/oauth2provider/api/userInfo.js b/lib/build/recipe/oauth2provider/api/userInfo.js index cfa8f704b..402e6b0e7 100644 --- a/lib/build/recipe/oauth2provider/api/userInfo.js +++ b/lib/build/recipe/oauth2provider/api/userInfo.js @@ -34,12 +34,12 @@ async function userInfoGET(apiImplementation, tenantId, options, userContext) { const accessToken = authHeader.replace(/^Bearer /, "").trim(); let accessTokenPayload; try { - const { - payload, - } = await recipe_1.default.getInstanceOrThrowError().recipeInterfaceImpl.validateOAuth2AccessToken({ - token: accessToken, - userContext, - }); + const { payload } = await recipe_1.default + .getInstanceOrThrowError() + .recipeInterfaceImpl.validateOAuth2AccessToken({ + token: accessToken, + userContext, + }); accessTokenPayload = payload; } catch (error) { options.res.setHeader("WWW-Authenticate", 'Bearer error="invalid_token"', false); diff --git a/lib/build/recipe/oauth2provider/constants.js b/lib/build/recipe/oauth2provider/constants.js index 260e9eb50..e3550b35f 100644 --- a/lib/build/recipe/oauth2provider/constants.js +++ b/lib/build/recipe/oauth2provider/constants.js @@ -14,7 +14,16 @@ * under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -exports.LOGOUT_PATH = exports.END_SESSION_PATH = exports.INTROSPECT_TOKEN_PATH = exports.REVOKE_TOKEN_PATH = exports.USER_INFO_PATH = exports.LOGIN_INFO_PATH = exports.TOKEN_PATH = exports.AUTH_PATH = exports.LOGIN_PATH = void 0; +exports.LOGOUT_PATH = + exports.END_SESSION_PATH = + exports.INTROSPECT_TOKEN_PATH = + exports.REVOKE_TOKEN_PATH = + exports.USER_INFO_PATH = + exports.LOGIN_INFO_PATH = + exports.TOKEN_PATH = + exports.AUTH_PATH = + exports.LOGIN_PATH = + void 0; exports.LOGIN_PATH = "/oauth/login"; exports.AUTH_PATH = "/oauth/auth"; exports.TOKEN_PATH = "/oauth/token"; diff --git a/lib/build/recipe/oauth2provider/index.js b/lib/build/recipe/oauth2provider/index.js index ee4d9b5ed..14799b800 100644 --- a/lib/build/recipe/oauth2provider/index.js +++ b/lib/build/recipe/oauth2provider/index.js @@ -19,7 +19,19 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.revokeTokensBySessionHandle = exports.revokeTokensByClientId = exports.revokeToken = exports.createTokenForClientCredentials = exports.validateOAuth2RefreshToken = exports.validateOAuth2AccessToken = exports.deleteOAuth2Client = exports.updateOAuth2Client = exports.createOAuth2Client = exports.getOAuth2Clients = exports.getOAuth2Client = exports.init = void 0; +exports.revokeTokensBySessionHandle = + exports.revokeTokensByClientId = + exports.revokeToken = + exports.createTokenForClientCredentials = + exports.validateOAuth2RefreshToken = + exports.validateOAuth2AccessToken = + exports.deleteOAuth2Client = + exports.updateOAuth2Client = + exports.createOAuth2Client = + exports.getOAuth2Clients = + exports.getOAuth2Client = + exports.init = + void 0; const utils_1 = require("../../utils"); const recipe_1 = __importDefault(require("./recipe")); class Wrapper { diff --git a/lib/build/recipe/oauth2provider/recipeImplementation.js b/lib/build/recipe/oauth2provider/recipeImplementation.js index f40da4bce..c397127d3 100644 --- a/lib/build/recipe/oauth2provider/recipeImplementation.js +++ b/lib/build/recipe/oauth2provider/recipeImplementation.js @@ -56,7 +56,6 @@ var __importDefault = }; Object.defineProperty(exports, "__esModule", { value: true }); const jose = __importStar(require("jose")); -const normalisedURLPath_1 = __importDefault(require("../../normalisedURLPath")); const OAuth2Client_1 = require("./OAuth2Client"); const __1 = require("../.."); const combinedRemoteJWKSet_1 = require("../../combinedRemoteJWKSet"); @@ -88,7 +87,7 @@ function getRecipeInterface( return { getLoginRequest: async function (input) { const resp = await querier.sendGetRequest( - new normalisedURLPath_1.default("/recipe/oauth/auth/requests/login"), + "/recipe/oauth/auth/requests/login", { loginChallenge: input.challenge }, input.userContext ); @@ -115,7 +114,7 @@ function getRecipeInterface( }, acceptLoginRequest: async function (input) { const resp = await querier.sendPutRequest( - new normalisedURLPath_1.default(`/recipe/oauth/auth/requests/login/accept`), + "/recipe/oauth/auth/requests/login/accept", { acr: input.acr, amr: input.amr, @@ -135,7 +134,7 @@ function getRecipeInterface( }, rejectLoginRequest: async function (input) { const resp = await querier.sendPutRequest( - new normalisedURLPath_1.default(`/recipe/oauth/auth/requests/login/reject`), + "/recipe/oauth/auth/requests/login/reject", { error: input.error.error, errorDescription: input.error.errorDescription, @@ -152,7 +151,7 @@ function getRecipeInterface( }, getConsentRequest: async function (input) { const resp = await querier.sendGetRequest( - new normalisedURLPath_1.default("/recipe/oauth/auth/requests/consent"), + "/recipe/oauth/auth/requests/consent", { consentChallenge: input.challenge }, input.userContext ); @@ -173,7 +172,7 @@ function getRecipeInterface( }, acceptConsentRequest: async function (input) { const resp = await querier.sendPutRequest( - new normalisedURLPath_1.default(`/recipe/oauth/auth/requests/consent/accept`), + "/recipe/oauth/auth/requests/consent/accept", { context: input.context, grantAccessTokenAudience: input.grantAccessTokenAudience, @@ -197,7 +196,7 @@ function getRecipeInterface( }, rejectConsentRequest: async function (input) { const resp = await querier.sendPutRequest( - new normalisedURLPath_1.default(`/recipe/oauth/auth/requests/consent/reject`), + "/recipe/oauth/auth/requests/consent/reject", { error: input.error.error, errorDescription: input.error.errorDescription, @@ -291,7 +290,7 @@ function getRecipeInterface( }; } const resp = await querier.sendPostRequest( - new normalisedURLPath_1.default(`/recipe/oauth/auth`), + "/recipe/oauth/auth", { params: Object.assign(Object.assign({}, input.params), { scope: scopes.join(" ") }), iss: await recipe_2.default.getIssuer(input.userContext), @@ -318,7 +317,7 @@ function getRecipeInterface( } const redirectTo = getUpdatedRedirectTo(appInfo, resp.redirectTo); if (redirectTo === undefined) { - throw new Error(resp.body); + throw new Error("Got redirectTo as undefined, cannot continue"); } const redirectToURL = new URL(redirectTo); const consentChallenge = redirectToURL.searchParams.get("consent_challenge"); @@ -460,11 +459,7 @@ function getRecipeInterface( if (input.authorizationHeader) { body["authorizationHeader"] = input.authorizationHeader; } - const res = await querier.sendPostRequest( - new normalisedURLPath_1.default(`/recipe/oauth/token`), - body, - input.userContext - ); + const res = await querier.sendPostRequest("/recipe/oauth/token", body, input.userContext); if (res.status === "CLIENT_NOT_FOUND_ERROR") { return { status: "ERROR", @@ -485,7 +480,7 @@ function getRecipeInterface( }, getOAuth2Clients: async function (input) { let response = await querier.sendGetRequestWithResponseHeaders( - new normalisedURLPath_1.default(`/recipe/oauth/clients/list`), + "/recipe/oauth/clients/list", { pageSize: input.pageSize, clientName: input.clientName, @@ -510,7 +505,7 @@ function getRecipeInterface( }, getOAuth2Client: async function (input) { let response = await querier.sendGetRequestWithResponseHeaders( - new normalisedURLPath_1.default(`/recipe/oauth/clients`), + "/recipe/oauth/clients", { clientId: input.clientId }, {}, input.userContext @@ -536,7 +531,7 @@ function getRecipeInterface( }, createOAuth2Client: async function (input) { let response = await querier.sendPostRequest( - new normalisedURLPath_1.default(`/recipe/oauth/clients`), + "/recipe/oauth/clients", copyAndCleanRequestBodyInput(input), input.userContext ); @@ -555,7 +550,7 @@ function getRecipeInterface( }, updateOAuth2Client: async function (input) { let response = await querier.sendPutRequest( - new normalisedURLPath_1.default(`/recipe/oauth/clients`), + "/recipe/oauth/clients", copyAndCleanRequestBodyInput(input), { clientId: input.clientId }, input.userContext @@ -575,7 +570,7 @@ function getRecipeInterface( }, deleteOAuth2Client: async function (input) { let response = await querier.sendPostRequest( - new normalisedURLPath_1.default(`/recipe/oauth/clients/remove`), + "/recipe/oauth/clients/remove", { clientId: input.clientId }, input.userContext ); @@ -669,7 +664,7 @@ function getRecipeInterface( } if (input.checkDatabase) { let response = await querier.sendPostRequest( - new normalisedURLPath_1.default(`/recipe/oauth/introspect`), + "/recipe/oauth/introspect", { token: input.token, }, @@ -695,11 +690,7 @@ function getRecipeInterface( requestBody.client_secret = input.clientSecret; } } - const res = await querier.sendPostRequest( - new normalisedURLPath_1.default(`/recipe/oauth/token/revoke`), - requestBody, - input.userContext - ); + const res = await querier.sendPostRequest("/recipe/oauth/token/revoke", requestBody, input.userContext); if (res.status !== "OK") { return { status: "ERROR", @@ -712,7 +703,7 @@ function getRecipeInterface( }, revokeTokensBySessionHandle: async function (input) { await querier.sendPostRequest( - new normalisedURLPath_1.default(`/recipe/oauth/session/revoke`), + "/recipe/oauth/session/revoke", { sessionHandle: input.sessionHandle }, input.userContext ); @@ -720,7 +711,7 @@ function getRecipeInterface( }, revokeTokensByClientId: async function (input) { await querier.sendPostRequest( - new normalisedURLPath_1.default(`/recipe/oauth/tokens/revoke`), + "/recipe/oauth/tokens/revoke", { clientId: input.clientId }, input.userContext ); @@ -746,7 +737,7 @@ function getRecipeInterface( // For tokens that passed local validation or if it's a refresh token, // validate the token with the database by calling the core introspection endpoint const res = await querier.sendPostRequest( - new normalisedURLPath_1.default(`/recipe/oauth/introspect`), + "/recipe/oauth/introspect", { token, scope: scopes ? scopes.join(" ") : undefined, @@ -769,7 +760,7 @@ function getRecipeInterface( * - Redirects to the `post_logout_redirect_uri` or the default logout fallback page. */ const resp = await querier.sendGetRequest( - new normalisedURLPath_1.default(`/recipe/oauth/sessions/logout`), + "/recipe/oauth/sessions/logout", { clientId: input.params.client_id, idTokenHint: input.params.id_token_hint, @@ -828,7 +819,7 @@ function getRecipeInterface( }, acceptLogoutRequest: async function (input) { const resp = await querier.sendPutRequest( - new normalisedURLPath_1.default(`/recipe/oauth/auth/requests/logout/accept`), + "/recipe/oauth/auth/requests/logout/accept", { challenge: input.challenge }, {}, input.userContext @@ -854,7 +845,7 @@ function getRecipeInterface( }, rejectLogoutRequest: async function (input) { const resp = await querier.sendPutRequest( - new normalisedURLPath_1.default(`/recipe/oauth/auth/requests/logout/reject`), + "/recipe/oauth/auth/requests/logout/reject", {}, { challenge: input.challenge }, input.userContext diff --git a/lib/build/recipe/oauth2provider/types.d.ts b/lib/build/recipe/oauth2provider/types.d.ts index 97d4d4624..34805fb3b 100644 --- a/lib/build/recipe/oauth2provider/types.d.ts +++ b/lib/build/recipe/oauth2provider/types.d.ts @@ -129,17 +129,10 @@ export declare type RecipeInterface = { }): Promise<{ redirectTo: string; }>; - rejectConsentRequest(input: { - challenge: string; - error: ErrorOAuth2; - userContext: UserContext; - }): Promise<{ + rejectConsentRequest(input: { challenge: string; error: ErrorOAuth2; userContext: UserContext }): Promise<{ redirectTo: string; }>; - getLoginRequest(input: { - challenge: string; - userContext: UserContext; - }): Promise< + getLoginRequest(input: { challenge: string; userContext: UserContext }): Promise< | (LoginRequest & { status: "OK"; }) @@ -157,17 +150,10 @@ export declare type RecipeInterface = { }): Promise<{ redirectTo: string; }>; - rejectLoginRequest(input: { - challenge: string; - error: ErrorOAuth2; - userContext: UserContext; - }): Promise<{ + rejectLoginRequest(input: { challenge: string; error: ErrorOAuth2; userContext: UserContext }): Promise<{ redirectTo: string; }>; - getOAuth2Client(input: { - clientId: string; - userContext: UserContext; - }): Promise< + getOAuth2Client(input: { clientId: string; userContext: UserContext }): Promise< | { status: "OK"; client: OAuth2Client; @@ -323,16 +309,10 @@ export declare type RecipeInterface = { } | ErrorOAuth2 >; - revokeTokensByClientId(input: { - clientId: string; - userContext: UserContext; - }): Promise<{ + revokeTokensByClientId(input: { clientId: string; userContext: UserContext }): Promise<{ status: "OK"; }>; - revokeTokensBySessionHandle(input: { - sessionHandle: string; - userContext: UserContext; - }): Promise<{ + revokeTokensBySessionHandle(input: { sessionHandle: string; userContext: UserContext }): Promise<{ status: "OK"; }>; introspectToken(input: { @@ -351,19 +331,13 @@ export declare type RecipeInterface = { } | ErrorOAuth2 >; - acceptLogoutRequest(input: { - challenge: string; - userContext: UserContext; - }): Promise< + acceptLogoutRequest(input: { challenge: string; userContext: UserContext }): Promise< | { redirectTo: string; } | ErrorOAuth2 >; - rejectLogoutRequest(input: { - challenge: string; - userContext: UserContext; - }): Promise<{ + rejectLogoutRequest(input: { challenge: string; userContext: UserContext }): Promise<{ status: "OK"; }>; }; @@ -411,11 +385,7 @@ export declare type APIInterface = { }) => Promise); loginInfoGET: | undefined - | ((input: { - loginChallenge: string; - options: APIOptions; - userContext: UserContext; - }) => Promise< + | ((input: { loginChallenge: string; options: APIOptions; userContext: UserContext }) => Promise< | { status: "OK"; info: LoginInfo; diff --git a/lib/build/recipe/openid/index.d.ts b/lib/build/recipe/openid/index.d.ts index 84b55bd8c..7e921973b 100644 --- a/lib/build/recipe/openid/index.d.ts +++ b/lib/build/recipe/openid/index.d.ts @@ -2,9 +2,7 @@ import OpenIdRecipe from "./recipe"; export default class OpenIdRecipeWrapper { static init: typeof OpenIdRecipe.init; - static getOpenIdDiscoveryConfiguration( - userContext?: Record - ): Promise<{ + static getOpenIdDiscoveryConfiguration(userContext?: Record): Promise<{ status: "OK"; issuer: string; jwks_uri: string; diff --git a/lib/build/recipe/openid/types.d.ts b/lib/build/recipe/openid/types.d.ts index b0dda95fd..09cc3ab21 100644 --- a/lib/build/recipe/openid/types.d.ts +++ b/lib/build/recipe/openid/types.d.ts @@ -30,10 +30,7 @@ export declare type APIOptions = { export declare type APIInterface = { getOpenIdDiscoveryConfigurationGET: | undefined - | ((input: { - options: APIOptions; - userContext: UserContext; - }) => Promise< + | ((input: { options: APIOptions; userContext: UserContext }) => Promise< | { status: "OK"; issuer: string; @@ -52,9 +49,7 @@ export declare type APIInterface = { >); }; export declare type RecipeInterface = { - getOpenIdDiscoveryConfiguration(input: { - userContext: UserContext; - }): Promise<{ + getOpenIdDiscoveryConfiguration(input: { userContext: UserContext }): Promise<{ status: "OK"; issuer: string; jwks_uri: string; diff --git a/lib/build/recipe/passwordless/api/implementation.js b/lib/build/recipe/passwordless/api/implementation.js index 0936acc2c..171fdc6d2 100644 --- a/lib/build/recipe/passwordless/api/implementation.js +++ b/lib/build/recipe/passwordless/api/implementation.js @@ -120,14 +120,13 @@ function getAPIImplementation() { if (loginMethod.hasSameEmailAs(accountInfo.email) && !loginMethod.verified) { // We first check that the submitted code is actually valid if (await checkCredentials()) { - const tokenResponse = await emailVerificationInstance.recipeInterfaceImpl.createEmailVerificationToken( - { + const tokenResponse = + await emailVerificationInstance.recipeInterfaceImpl.createEmailVerificationToken({ tenantId: input.tenantId, recipeUserId: loginMethod.recipeUserId, email: accountInfo.email, userContext: input.userContext, - } - ); + }); if (tokenResponse.status === "OK") { await emailVerificationInstance.recipeInterfaceImpl.verifyEmailUsingToken({ tenantId: input.tenantId, diff --git a/lib/build/recipe/passwordless/emaildelivery/services/backwardCompatibility/index.d.ts b/lib/build/recipe/passwordless/emaildelivery/services/backwardCompatibility/index.d.ts index 3c47b9d5a..f062dc699 100644 --- a/lib/build/recipe/passwordless/emaildelivery/services/backwardCompatibility/index.d.ts +++ b/lib/build/recipe/passwordless/emaildelivery/services/backwardCompatibility/index.d.ts @@ -3,7 +3,8 @@ import { TypePasswordlessEmailDeliveryInput } from "../../../types"; import { EmailDeliveryInterface } from "../../../../../ingredients/emaildelivery/types"; import { NormalisedAppinfo, UserContext } from "../../../../../types"; export default class BackwardCompatibilityService - implements EmailDeliveryInterface { + implements EmailDeliveryInterface +{ private appInfo; constructor(appInfo: NormalisedAppinfo); sendEmail: ( diff --git a/lib/build/recipe/passwordless/index.js b/lib/build/recipe/passwordless/index.js index 285ccb9ed..68d007a27 100644 --- a/lib/build/recipe/passwordless/index.js +++ b/lib/build/recipe/passwordless/index.js @@ -19,7 +19,24 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.sendSms = exports.sendEmail = exports.checkCode = exports.signInUp = exports.createMagicLink = exports.revokeCode = exports.revokeAllCodes = exports.updateUser = exports.createNewCodeForDevice = exports.listCodesByPreAuthSessionId = exports.listCodesByPhoneNumber = exports.listCodesByEmail = exports.listCodesByDeviceId = exports.consumeCode = exports.createCode = exports.Error = exports.init = void 0; +exports.sendSms = + exports.sendEmail = + exports.checkCode = + exports.signInUp = + exports.createMagicLink = + exports.revokeCode = + exports.revokeAllCodes = + exports.updateUser = + exports.createNewCodeForDevice = + exports.listCodesByPreAuthSessionId = + exports.listCodesByPhoneNumber = + exports.listCodesByEmail = + exports.listCodesByDeviceId = + exports.consumeCode = + exports.createCode = + exports.Error = + exports.init = + void 0; const recipe_1 = __importDefault(require("./recipe")); const error_1 = __importDefault(require("./error")); const __1 = require("../.."); diff --git a/lib/build/recipe/passwordless/recipe.js b/lib/build/recipe/passwordless/recipe.js index 6ff155b8b..68109548e 100644 --- a/lib/build/recipe/passwordless/recipe.js +++ b/lib/build/recipe/passwordless/recipe.js @@ -378,14 +378,12 @@ class Recipe extends recipeModule_1.default { // object. let factorIdToEmailsMap = {}; if (allFactors.includes(multifactorauth_1.FactorIds.OTP_EMAIL)) { - factorIdToEmailsMap[ - multifactorauth_1.FactorIds.OTP_EMAIL - ] = nonFakeEmailsThatPasswordlessLoginMethodOrderedByTimeJoined; + factorIdToEmailsMap[multifactorauth_1.FactorIds.OTP_EMAIL] = + nonFakeEmailsThatPasswordlessLoginMethodOrderedByTimeJoined; } if (allFactors.includes(multifactorauth_1.FactorIds.LINK_EMAIL)) { - factorIdToEmailsMap[ - multifactorauth_1.FactorIds.LINK_EMAIL - ] = nonFakeEmailsThatPasswordlessLoginMethodOrderedByTimeJoined; + factorIdToEmailsMap[multifactorauth_1.FactorIds.LINK_EMAIL] = + nonFakeEmailsThatPasswordlessLoginMethodOrderedByTimeJoined; } return { status: "OK", @@ -498,14 +496,12 @@ class Recipe extends recipeModule_1.default { // object. let factorIdToPhoneNumberMap = {}; if (allFactors.includes(multifactorauth_1.FactorIds.OTP_PHONE)) { - factorIdToPhoneNumberMap[ - multifactorauth_1.FactorIds.OTP_PHONE - ] = phoneNumbersThatPasswordlessLoginMethodOrderedByTimeJoined; + factorIdToPhoneNumberMap[multifactorauth_1.FactorIds.OTP_PHONE] = + phoneNumbersThatPasswordlessLoginMethodOrderedByTimeJoined; } if (allFactors.includes(multifactorauth_1.FactorIds.LINK_PHONE)) { - factorIdToPhoneNumberMap[ - multifactorauth_1.FactorIds.LINK_PHONE - ] = phoneNumbersThatPasswordlessLoginMethodOrderedByTimeJoined; + factorIdToPhoneNumberMap[multifactorauth_1.FactorIds.LINK_PHONE] = + phoneNumbersThatPasswordlessLoginMethodOrderedByTimeJoined; } return { status: "OK", diff --git a/lib/build/recipe/passwordless/recipeImplementation.js b/lib/build/recipe/passwordless/recipeImplementation.js index d2fb36376..9b693b05a 100644 --- a/lib/build/recipe/passwordless/recipeImplementation.js +++ b/lib/build/recipe/passwordless/recipeImplementation.js @@ -7,7 +7,6 @@ var __importDefault = Object.defineProperty(exports, "__esModule", { value: true }); const recipe_1 = __importDefault(require("../accountlinking/recipe")); const recipe_2 = __importDefault(require("../emailverification/recipe")); -const normalisedURLPath_1 = __importDefault(require("../../normalisedURLPath")); const logger_1 = require("../../logger"); const user_1 = require("../../user"); const __1 = require("../.."); @@ -27,7 +26,12 @@ function getRecipeInterface(querier) { return { consumeCode: async function (input) { const response = await querier.sendPostRequest( - new normalisedURLPath_1.default(`/${input.tenantId}/recipe/signinup/code/consume`), + { + path: "//recipe/signinup/code/consume", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -35,35 +39,38 @@ function getRecipeInterface(querier) { return response; } logger_1.logDebugMessage("Passwordless.consumeCode code consumed OK"); - response.user = new user_1.User(response.user); - response.recipeUserId = new recipeUserId_1.default(response.recipeUserId); + const userAsObj = user_1.User.fromApi(response.user); + const recipeUserIdAsObj = new recipeUserId_1.default(response.recipeUserId); // Attempt account linking (this is a sign up) - let updatedUser = response.user; - const linkResult = await authUtils_1.AuthUtils.linkToSessionIfRequiredElseCreatePrimaryUserIdOrLinkByAccountInfo( - { + let updatedUser = userAsObj; + const linkResult = + await authUtils_1.AuthUtils.linkToSessionIfRequiredElseCreatePrimaryUserIdOrLinkByAccountInfo({ tenantId: input.tenantId, - inputUser: response.user, - recipeUserId: response.recipeUserId, + inputUser: userAsObj, + recipeUserId: recipeUserIdAsObj, session: input.session, shouldTryLinkingWithSessionUser: input.shouldTryLinkingWithSessionUser, userContext: input.userContext, - } - ); + }); if (linkResult.status !== "OK") { return linkResult; } updatedUser = linkResult.user; - response.user = updatedUser; return Object.assign(Object.assign({}, response), { consumedDevice: response.consumedDevice, createdNewRecipeUser: response.createdNewUser, - user: response.user, - recipeUserId: response.recipeUserId, + user: updatedUser, + recipeUserId: recipeUserIdAsObj, }); }, checkCode: async function (input) { let response = await querier.sendPostRequest( - new normalisedURLPath_1.default(`/${input.tenantId}/recipe/signinup/code/check`), + { + path: "//recipe/signinup/code/check", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -75,7 +82,12 @@ function getRecipeInterface(querier) { }, createCode: async function (input) { let response = await querier.sendPostRequest( - new normalisedURLPath_1.default(`/${input.tenantId}/recipe/signinup/code`), + { + path: "//recipe/signinup/code", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -83,7 +95,12 @@ function getRecipeInterface(querier) { }, createNewCodeForDevice: async function (input) { let response = await querier.sendPostRequest( - new normalisedURLPath_1.default(`/${input.tenantId}/recipe/signinup/code`), + { + path: "//recipe/signinup/code", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -91,7 +108,12 @@ function getRecipeInterface(querier) { }, listCodesByDeviceId: async function (input) { let response = await querier.sendGetRequest( - new normalisedURLPath_1.default(`/${input.tenantId}/recipe/signinup/codes`), + { + path: "//recipe/signinup/codes", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -99,7 +121,12 @@ function getRecipeInterface(querier) { }, listCodesByEmail: async function (input) { let response = await querier.sendGetRequest( - new normalisedURLPath_1.default(`/${input.tenantId}/recipe/signinup/codes`), + { + path: "//recipe/signinup/codes", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -107,7 +134,12 @@ function getRecipeInterface(querier) { }, listCodesByPhoneNumber: async function (input) { let response = await querier.sendGetRequest( - new normalisedURLPath_1.default(`/${input.tenantId}/recipe/signinup/codes`), + { + path: "//recipe/signinup/codes", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -115,7 +147,12 @@ function getRecipeInterface(querier) { }, listCodesByPreAuthSessionId: async function (input) { let response = await querier.sendGetRequest( - new normalisedURLPath_1.default(`/${input.tenantId}/recipe/signinup/codes`), + { + path: "//recipe/signinup/codes", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -123,7 +160,12 @@ function getRecipeInterface(querier) { }, revokeAllCodes: async function (input) { await querier.sendPostRequest( - new normalisedURLPath_1.default(`/${input.tenantId}/recipe/signinup/codes/remove`), + { + path: "//recipe/signinup/codes/remove", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -133,7 +175,12 @@ function getRecipeInterface(querier) { }, revokeCode: async function (input) { await querier.sendPostRequest( - new normalisedURLPath_1.default(`/${input.tenantId}/recipe/signinup/code/remove`), + { + path: "//recipe/signinup/code/remove", + params: { + tenantId: input.tenantId, + }, + }, copyAndRemoveUserContextAndTenantId(input), input.userContext ); @@ -173,7 +220,7 @@ function getRecipeInterface(querier) { } } let response = await querier.sendPutRequest( - new normalisedURLPath_1.default(`/recipe/user`), + "/recipe/user", copyAndRemoveUserContextAndTenantId(input), {}, input.userContext diff --git a/lib/build/recipe/passwordless/utils.js b/lib/build/recipe/passwordless/utils.js index 951335f9f..c21cf9b58 100644 --- a/lib/build/recipe/passwordless/utils.js +++ b/lib/build/recipe/passwordless/utils.js @@ -19,7 +19,11 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.getEnabledPwlessFactors = exports.defaultValidateEmail = exports.defaultValidatePhoneNumber = exports.validateAndNormaliseUserInput = void 0; +exports.getEnabledPwlessFactors = + exports.defaultValidateEmail = + exports.defaultValidatePhoneNumber = + exports.validateAndNormaliseUserInput = + void 0; const max_1 = __importDefault(require("libphonenumber-js/max")); const backwardCompatibility_1 = __importDefault(require("./emaildelivery/services/backwardCompatibility")); const backwardCompatibility_2 = __importDefault(require("./smsdelivery/services/backwardCompatibility")); diff --git a/lib/build/recipe/session/constants.js b/lib/build/recipe/session/constants.js index e196684e5..82fdcadde 100644 --- a/lib/build/recipe/session/constants.js +++ b/lib/build/recipe/session/constants.js @@ -14,7 +14,21 @@ * under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -exports.authModeHeaderKey = exports.frontTokenHeaderKey = exports.antiCsrfHeaderKey = exports.refreshTokenHeaderKey = exports.refreshTokenCookieKey = exports.accessTokenCookieKey = exports.accessTokenHeaderKey = exports.authorizationHeaderKey = exports.protectedProps = exports.JWKCacheCooldownInMs = exports.oneYearInMs = exports.availableTokenTransferMethods = exports.SIGNOUT_API_PATH = exports.REFRESH_API_PATH = void 0; +exports.authModeHeaderKey = + exports.frontTokenHeaderKey = + exports.antiCsrfHeaderKey = + exports.refreshTokenHeaderKey = + exports.refreshTokenCookieKey = + exports.accessTokenCookieKey = + exports.accessTokenHeaderKey = + exports.authorizationHeaderKey = + exports.protectedProps = + exports.JWKCacheCooldownInMs = + exports.oneYearInMs = + exports.availableTokenTransferMethods = + exports.SIGNOUT_API_PATH = + exports.REFRESH_API_PATH = + void 0; exports.REFRESH_API_PATH = "/session/refresh"; exports.SIGNOUT_API_PATH = "/signout"; exports.availableTokenTransferMethods = ["cookie", "header"]; diff --git a/lib/build/recipe/session/cookieAndHeaders.js b/lib/build/recipe/session/cookieAndHeaders.js index 2bf01f8aa..d103c3807 100644 --- a/lib/build/recipe/session/cookieAndHeaders.js +++ b/lib/build/recipe/session/cookieAndHeaders.js @@ -5,7 +5,21 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.hasMultipleCookiesForTokenType = exports.clearSessionCookiesFromOlderCookieDomain = exports.getAuthModeFromHeader = exports.setCookie = exports.setHeader = exports.setToken = exports.getToken = exports.getCORSAllowedHeaders = exports.setFrontTokenInHeaders = exports.buildFrontToken = exports.setAntiCsrfTokenInHeaders = exports.getAntiCsrfTokenFromHeaders = exports.clearSession = exports.clearSessionFromAllTokenTransferMethods = void 0; +exports.hasMultipleCookiesForTokenType = + exports.clearSessionCookiesFromOlderCookieDomain = + exports.getAuthModeFromHeader = + exports.setCookie = + exports.setHeader = + exports.setToken = + exports.getToken = + exports.getCORSAllowedHeaders = + exports.setFrontTokenInHeaders = + exports.buildFrontToken = + exports.setAntiCsrfTokenInHeaders = + exports.getAntiCsrfTokenFromHeaders = + exports.clearSession = + exports.clearSessionFromAllTokenTransferMethods = + void 0; /* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. * * This software is licensed under the Apache License, Version 2.0 (the diff --git a/lib/build/recipe/session/index.d.ts b/lib/build/recipe/session/index.d.ts index 8115d4727..034b3562f 100644 --- a/lib/build/recipe/session/index.d.ts +++ b/lib/build/recipe/session/index.d.ts @@ -166,15 +166,11 @@ export default class SessionWrapper { status: "UNSUPPORTED_ALGORITHM_ERROR"; } >; - static getJWKS( - userContext?: Record - ): Promise<{ + static getJWKS(userContext?: Record): Promise<{ keys: import("../jwt").JsonWebKey[]; validityInSeconds?: number | undefined; }>; - static getOpenIdDiscoveryConfiguration( - userContext?: Record - ): Promise<{ + static getOpenIdDiscoveryConfiguration(userContext?: Record): Promise<{ status: "OK"; issuer: string; jwks_uri: string; diff --git a/lib/build/recipe/session/index.js b/lib/build/recipe/session/index.js index ad7855e98..94a6c1f80 100644 --- a/lib/build/recipe/session/index.js +++ b/lib/build/recipe/session/index.js @@ -19,7 +19,30 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.getOpenIdDiscoveryConfiguration = exports.getJWKS = exports.createJWT = exports.Error = exports.validateClaimsForSessionHandle = exports.removeClaim = exports.getClaimValue = exports.setClaimValue = exports.fetchAndSetClaim = exports.mergeIntoAccessTokenPayload = exports.updateSessionDataInDatabase = exports.revokeMultipleSessions = exports.revokeSession = exports.getAllSessionHandlesForUser = exports.revokeAllSessionsForUser = exports.refreshSessionWithoutRequestResponse = exports.refreshSession = exports.getSessionInformation = exports.getSessionWithoutRequestResponse = exports.getSession = exports.createNewSessionWithoutRequestResponse = exports.createNewSession = exports.init = void 0; +exports.getOpenIdDiscoveryConfiguration = + exports.getJWKS = + exports.createJWT = + exports.Error = + exports.validateClaimsForSessionHandle = + exports.removeClaim = + exports.getClaimValue = + exports.setClaimValue = + exports.fetchAndSetClaim = + exports.mergeIntoAccessTokenPayload = + exports.updateSessionDataInDatabase = + exports.revokeMultipleSessions = + exports.revokeSession = + exports.getAllSessionHandlesForUser = + exports.revokeAllSessionsForUser = + exports.refreshSessionWithoutRequestResponse = + exports.refreshSession = + exports.getSessionInformation = + exports.getSessionWithoutRequestResponse = + exports.getSession = + exports.createNewSessionWithoutRequestResponse = + exports.createNewSession = + exports.init = + void 0; const error_1 = __importDefault(require("./error")); const recipe_1 = __importDefault(require("./recipe")); const recipe_2 = __importDefault(require("../openid/recipe")); diff --git a/lib/build/recipe/session/recipeImplementation.js b/lib/build/recipe/session/recipeImplementation.js index 7dbba30ec..2a1b8071f 100644 --- a/lib/build/recipe/session/recipeImplementation.js +++ b/lib/build/recipe/session/recipeImplementation.js @@ -45,7 +45,6 @@ const SessionFunctions = __importStar(require("./sessionFunctions")); const cookieAndHeaders_1 = require("./cookieAndHeaders"); const utils_1 = require("./utils"); const sessionClass_1 = __importDefault(require("./sessionClass")); -const normalisedURLPath_1 = __importDefault(require("../../normalisedURLPath")); const logger_1 = require("../../logger"); const jwt_1 = require("./jwt"); const accessToken_1 = require("./accessToken"); @@ -267,7 +266,7 @@ function getRecipeInterface(querier, config, appInfo, getRecipeImplAfterOverride ? {} : input.newAccessTokenPayload; let response = await querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/session/regenerate"), + "/recipe/session/regenerate", { accessToken: input.accessToken, userDataInJWT: newAccessTokenPayload, diff --git a/lib/build/recipe/session/sessionFunctions.js b/lib/build/recipe/session/sessionFunctions.js index f939f0367..0b1785610 100644 --- a/lib/build/recipe/session/sessionFunctions.js +++ b/lib/build/recipe/session/sessionFunctions.js @@ -5,7 +5,17 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.updateAccessTokenPayload = exports.updateSessionDataInDatabase = exports.revokeMultipleSessions = exports.revokeSession = exports.getAllSessionHandlesForUser = exports.revokeAllSessionsForUser = exports.refreshSession = exports.getSessionInformation = exports.getSession = exports.createNewSession = void 0; +exports.updateAccessTokenPayload = + exports.updateSessionDataInDatabase = + exports.revokeMultipleSessions = + exports.revokeSession = + exports.getAllSessionHandlesForUser = + exports.revokeAllSessionsForUser = + exports.refreshSession = + exports.getSessionInformation = + exports.getSession = + exports.createNewSession = + void 0; /* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. * * This software is licensed under the Apache License, Version 2.0 (the @@ -23,7 +33,6 @@ exports.updateAccessTokenPayload = exports.updateSessionDataInDatabase = exports const accessToken_1 = require("./accessToken"); const error_1 = __importDefault(require("./error")); const processState_1 = require("../../processState"); -const normalisedURLPath_1 = __importDefault(require("../../normalisedURLPath")); const utils_1 = require("../../utils"); const logger_1 = require("../../logger"); const recipeUserId_1 = __importDefault(require("../../recipeUserId")); @@ -53,7 +62,12 @@ async function createNewSession( enableAntiCsrf: !disableAntiCsrf && helpers.config.antiCsrfFunctionOrString === "VIA_TOKEN", }; let response = await helpers.querier.sendPostRequest( - new normalisedURLPath_1.default(`/${tenantId}/recipe/session`), + { + path: "//recipe/session", + params: { + tenantId: tenantId, + }, + }, requestBody, userContext ); @@ -219,14 +233,10 @@ async function getSession( enableAntiCsrf: helpers.config.antiCsrfFunctionOrString === "VIA_TOKEN", checkDatabase: alwaysCheckCore, }; - let response = await helpers.querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/session/verify"), - requestBody, - userContext - ); + let response = await helpers.querier.sendPostRequest("/recipe/session/verify", requestBody, userContext); if (response.status === "OK") { - delete response.status; - return Object.assign(Object.assign({}, response), { + return { + accessToken: response.accessToken, session: { handle: response.session.handle, userId: response.session.userId, @@ -241,7 +251,7 @@ async function getSession( constants_1.DEFAULT_TENANT_ID, userDataInJWT: response.session.userDataInJWT, }, - }); + }; } else if (response.status === "UNAUTHORISED") { logger_1.logDebugMessage("getSession: Returning UNAUTHORISED because of core response"); throw new error_1.default({ @@ -267,7 +277,7 @@ async function getSessionInformation(helpers, sessionHandle, userContext) { throw new Error("Please use core version >= 3.5 to call this function."); } let response = await helpers.querier.sendGetRequest( - new normalisedURLPath_1.default(`/recipe/session`), + "/recipe/session", { sessionHandle, }, @@ -317,11 +327,7 @@ async function refreshSession( // There we can add a bit more information to the error, so that's the primary check, this is just making sure. throw new Error("Please either use VIA_TOKEN, NONE or call with doAntiCsrfCheck false"); } - let response = await helpers.querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/session/refresh"), - requestBody, - userContext - ); + let response = await helpers.querier.sendPostRequest("/recipe/session/refresh", requestBody, userContext); if (response.status === "OK") { return { session: { @@ -378,15 +384,23 @@ async function revokeAllSessionsForUser( if (tenantId === undefined) { tenantId = constants_1.DEFAULT_TENANT_ID; } - let response = await helpers.querier.sendPostRequest( - new normalisedURLPath_1.default( - revokeAcrossAllTenants ? `/recipe/session/remove` : `/${tenantId}/recipe/session/remove` - ), + const body = { + userId, + revokeSessionsForLinkedAccounts, + revokeAcrossAllTenants, + }; + if (revokeAcrossAllTenants) { + const response = await helpers.querier.sendPostRequest("/recipe/session/remove", body, userContext); + return response.sessionHandlesRevoked; + } + const response = await helpers.querier.sendPostRequest( { - userId, - revokeSessionsForLinkedAccounts, - revokeAcrossAllTenants, + path: "//recipe/session/remove", + params: { + tenantId: tenantId, + }, }, + body, userContext ); return response.sessionHandlesRevoked; @@ -407,9 +421,14 @@ async function getAllSessionHandlesForUser( tenantId = constants_1.DEFAULT_TENANT_ID; } let response = await helpers.querier.sendGetRequest( - new normalisedURLPath_1.default( - fetchAcrossAllTenants ? `/recipe/session/user` : `/${tenantId}/recipe/session/user` - ), + fetchAcrossAllTenants + ? "/recipe/session/user" + : { + path: "//recipe/session/user", + params: { + tenantId: tenantId, + }, + }, { userId, fetchSessionsForAllLinkedAccounts, @@ -426,7 +445,7 @@ exports.getAllSessionHandlesForUser = getAllSessionHandlesForUser; */ async function revokeSession(helpers, sessionHandle, userContext) { let response = await helpers.querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/session/remove"), + "/recipe/session/remove", { sessionHandles: [sessionHandle], }, @@ -441,7 +460,7 @@ exports.revokeSession = revokeSession; */ async function revokeMultipleSessions(helpers, sessionHandles, userContext) { let response = await helpers.querier.sendPostRequest( - new normalisedURLPath_1.default(`/recipe/session/remove`), + "/recipe/session/remove", { sessionHandles, }, @@ -456,7 +475,7 @@ exports.revokeMultipleSessions = revokeMultipleSessions; async function updateSessionDataInDatabase(helpers, sessionHandle, newSessionData, userContext) { newSessionData = newSessionData === null || newSessionData === undefined ? {} : newSessionData; let response = await helpers.querier.sendPutRequest( - new normalisedURLPath_1.default(`/recipe/session/data`), + "/recipe/session/data", { sessionHandle, userDataInDatabase: newSessionData, @@ -474,7 +493,7 @@ async function updateAccessTokenPayload(helpers, sessionHandle, newAccessTokenPa newAccessTokenPayload = newAccessTokenPayload === null || newAccessTokenPayload === undefined ? {} : newAccessTokenPayload; let response = await helpers.querier.sendPutRequest( - new normalisedURLPath_1.default("/recipe/jwt/data"), + "/recipe/jwt/data", { sessionHandle, userDataInJWT: newAccessTokenPayload, diff --git a/lib/build/recipe/session/sessionRequestFunctions.js b/lib/build/recipe/session/sessionRequestFunctions.js index d3a49abbe..6d3b90857 100644 --- a/lib/build/recipe/session/sessionRequestFunctions.js +++ b/lib/build/recipe/session/sessionRequestFunctions.js @@ -5,7 +5,11 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.createNewSessionInRequest = exports.refreshSessionInRequest = exports.getAccessTokenFromRequest = exports.getSessionFromRequest = void 0; +exports.createNewSessionInRequest = + exports.refreshSessionInRequest = + exports.getAccessTokenFromRequest = + exports.getSessionFromRequest = + void 0; const framework_1 = __importDefault(require("../../framework")); const supertokens_1 = __importDefault(require("../../supertokens")); const recipe_1 = __importDefault(require("../openid/recipe")); diff --git a/lib/build/recipe/session/types.d.ts b/lib/build/recipe/session/types.d.ts index 8a1d06794..4fe3983b2 100644 --- a/lib/build/recipe/session/types.d.ts +++ b/lib/build/recipe/session/types.d.ts @@ -254,11 +254,7 @@ export declare type RecipeInterface = { value: T; userContext: UserContext; }): Promise; - getClaimValue(input: { - sessionHandle: string; - claim: SessionClaim; - userContext: UserContext; - }): Promise< + getClaimValue(input: { sessionHandle: string; claim: SessionClaim; userContext: UserContext }): Promise< | { status: "SESSION_DOES_NOT_EXIST_ERROR"; } @@ -315,11 +311,7 @@ export declare type APIInterface = { | ((input: { options: APIOptions; userContext: UserContext }) => Promise); signOutPOST: | undefined - | ((input: { - options: APIOptions; - session: SessionContainerInterface; - userContext: UserContext; - }) => Promise< + | ((input: { options: APIOptions; session: SessionContainerInterface; userContext: UserContext }) => Promise< | { status: "OK"; } diff --git a/lib/build/recipe/session/utils.js b/lib/build/recipe/session/utils.js index 501b39f96..c8a3f9848 100644 --- a/lib/build/recipe/session/utils.js +++ b/lib/build/recipe/session/utils.js @@ -19,7 +19,20 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.getResponseHeaderNameForTokenType = exports.getCookieNameForTokenType = exports.validateClaimsInPayload = exports.getRequiredClaimValidators = exports.setAccessTokenInResponse = exports.normaliseSameSiteOrThrowError = exports.validateAndNormaliseUserInput = exports.getURLProtocol = exports.normaliseSessionScopeOrThrowError = exports.sendTokenTheftDetectedResponse = exports.sendInvalidClaimResponse = exports.sendUnauthorisedResponse = exports.sendTryRefreshTokenResponse = void 0; +exports.getResponseHeaderNameForTokenType = + exports.getCookieNameForTokenType = + exports.validateClaimsInPayload = + exports.getRequiredClaimValidators = + exports.setAccessTokenInResponse = + exports.normaliseSameSiteOrThrowError = + exports.validateAndNormaliseUserInput = + exports.getURLProtocol = + exports.normaliseSessionScopeOrThrowError = + exports.sendTokenTheftDetectedResponse = + exports.sendInvalidClaimResponse = + exports.sendUnauthorisedResponse = + exports.sendTryRefreshTokenResponse = + void 0; const cookieAndHeaders_1 = require("./cookieAndHeaders"); const recipe_1 = __importDefault(require("./recipe")); const constants_1 = require("./constants"); diff --git a/lib/build/recipe/thirdparty/providers/configUtils.js b/lib/build/recipe/thirdparty/providers/configUtils.js index f0be656c4..90e4a4aa1 100644 --- a/lib/build/recipe/thirdparty/providers/configUtils.js +++ b/lib/build/recipe/thirdparty/providers/configUtils.js @@ -5,7 +5,11 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.mergeProvidersFromCoreAndStatic = exports.mergeConfig = exports.findAndCreateProviderInstance = exports.getProviderConfigForClient = void 0; +exports.mergeProvidersFromCoreAndStatic = + exports.mergeConfig = + exports.findAndCreateProviderInstance = + exports.getProviderConfigForClient = + void 0; const _1 = require("."); const custom_1 = __importDefault(require("./custom")); const utils_1 = require("./utils"); diff --git a/lib/build/recipe/thirdparty/providers/custom.js b/lib/build/recipe/thirdparty/providers/custom.js index 9c182c222..feb3b04c6 100644 --- a/lib/build/recipe/thirdparty/providers/custom.js +++ b/lib/build/recipe/thirdparty/providers/custom.js @@ -5,7 +5,10 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.getActualClientIdFromDevelopmentClientId = exports.isUsingDevelopmentClientId = exports.DEV_OAUTH_REDIRECT_URL = void 0; +exports.getActualClientIdFromDevelopmentClientId = + exports.isUsingDevelopmentClientId = + exports.DEV_OAUTH_REDIRECT_URL = + void 0; const thirdpartyUtils_1 = require("../../../thirdpartyUtils"); const utils_1 = require("../../../utils"); const pkce_challenge_1 = __importDefault(require("pkce-challenge")); @@ -285,13 +288,10 @@ function NewProvider(input) { if (jwks === undefined) { jwks = jose_1.createRemoteJWKSet(new URL(impl.config.jwksURI)); } - rawUserInfoFromProvider.fromIdTokenPayload = await thirdpartyUtils_1.verifyIdTokenFromJWKSEndpointAndGetPayload( - idToken, - jwks, - { + rawUserInfoFromProvider.fromIdTokenPayload = + await thirdpartyUtils_1.verifyIdTokenFromJWKSEndpointAndGetPayload(idToken, jwks, { audience: getActualClientIdFromDevelopmentClientId(impl.config.clientId), - } - ); + }); if (impl.config.validateIdTokenPayload !== undefined) { await impl.config.validateIdTokenPayload({ idTokenPayload: rawUserInfoFromProvider.fromIdTokenPayload, diff --git a/lib/build/recipe/thirdparty/providers/index.js b/lib/build/recipe/thirdparty/providers/index.js index 345d7f130..59f7195aa 100644 --- a/lib/build/recipe/thirdparty/providers/index.js +++ b/lib/build/recipe/thirdparty/providers/index.js @@ -5,7 +5,20 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.Twitter = exports.Gitlab = exports.Bitbucket = exports.Okta = exports.Linkedin = exports.GoogleWorkspaces = exports.Google = exports.Github = exports.Facebook = exports.Discord = exports.Apple = exports.BoxySAML = exports.ActiveDirectory = void 0; +exports.Twitter = + exports.Gitlab = + exports.Bitbucket = + exports.Okta = + exports.Linkedin = + exports.GoogleWorkspaces = + exports.Google = + exports.Github = + exports.Facebook = + exports.Discord = + exports.Apple = + exports.BoxySAML = + exports.ActiveDirectory = + void 0; const activeDirectory_1 = __importDefault(require("./activeDirectory")); const boxySaml_1 = __importDefault(require("./boxySaml")); const apple_1 = __importDefault(require("./apple")); diff --git a/lib/build/recipe/thirdparty/providers/utils.js b/lib/build/recipe/thirdparty/providers/utils.js index 52637b2dd..d5f5edfff 100644 --- a/lib/build/recipe/thirdparty/providers/utils.js +++ b/lib/build/recipe/thirdparty/providers/utils.js @@ -41,7 +41,12 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.normaliseOIDCEndpointToIncludeWellKnown = exports.discoverOIDCEndpoints = exports.verifyIdTokenFromJWKSEndpointAndGetPayload = exports.doPostRequest = exports.doGetRequest = void 0; +exports.normaliseOIDCEndpointToIncludeWellKnown = + exports.discoverOIDCEndpoints = + exports.verifyIdTokenFromJWKSEndpointAndGetPayload = + exports.doPostRequest = + exports.doGetRequest = + void 0; const jose = __importStar(require("jose")); const thirdpartyUtils_1 = require("../../../thirdpartyUtils"); const normalisedURLDomain_1 = __importDefault(require("../../../normalisedURLDomain")); diff --git a/lib/build/recipe/thirdparty/recipeImplementation.js b/lib/build/recipe/thirdparty/recipeImplementation.js index dce4ef1e6..5dcc2ca48 100644 --- a/lib/build/recipe/thirdparty/recipeImplementation.js +++ b/lib/build/recipe/thirdparty/recipeImplementation.js @@ -5,7 +5,6 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -const normalisedURLPath_1 = __importDefault(require("../../normalisedURLPath")); const configUtils_1 = require("./providers/configUtils"); const recipe_1 = __importDefault(require("../accountlinking/recipe")); const recipe_2 = __importDefault(require("../multitenancy/recipe")); @@ -53,7 +52,12 @@ function getRecipeImplementation(querier, providers) { } } let response = await querier.sendPostRequest( - new normalisedURLPath_1.default(`/${tenantId}/recipe/signinup`), + { + path: "//recipe/signinup", + params: { + tenantId: tenantId, + }, + }, { thirdPartyId, thirdPartyUserId, @@ -64,26 +68,22 @@ function getRecipeImplementation(querier, providers) { if (response.status !== "OK") { return response; } - response.user = new user_1.User(response.user); - response.recipeUserId = new recipeUserId_1.default(response.recipeUserId); + const userAsObj = user_1.User.fromApi(response.user); + const recipeUserIdAsObj = new recipeUserId_1.default(response.recipeUserId); await recipe_1.default.getInstance().verifyEmailForRecipeUserIfLinkedAccountsAreVerified({ - user: response.user, - recipeUserId: response.recipeUserId, + user: userAsObj, + recipeUserId: recipeUserIdAsObj, userContext, }); - // we do this so that we get the updated user (in case the above - // function updated the verification status) and can return that - response.user = await __1.getUser(response.recipeUserId.getAsString(), userContext); - const linkResult = await authUtils_1.AuthUtils.linkToSessionIfRequiredElseCreatePrimaryUserIdOrLinkByAccountInfo( - { + const linkResult = + await authUtils_1.AuthUtils.linkToSessionIfRequiredElseCreatePrimaryUserIdOrLinkByAccountInfo({ tenantId, shouldTryLinkingWithSessionUser, - inputUser: response.user, - recipeUserId: response.recipeUserId, + inputUser: userAsObj, + recipeUserId: recipeUserIdAsObj, session, userContext, - } - ); + }); if (linkResult.status !== "OK") { return linkResult; } @@ -91,7 +91,7 @@ function getRecipeImplementation(querier, providers) { status: "OK", createdNewRecipeUser: response.createdNewUser, user: linkResult.user, - recipeUserId: response.recipeUserId, + recipeUserId: recipeUserIdAsObj, }; }, signInUp: async function ({ diff --git a/lib/build/recipe/totp/index.js b/lib/build/recipe/totp/index.js index 579bb3332..c9f1c313b 100644 --- a/lib/build/recipe/totp/index.js +++ b/lib/build/recipe/totp/index.js @@ -19,7 +19,14 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.verifyTOTP = exports.verifyDevice = exports.removeDevice = exports.updateDevice = exports.listDevices = exports.createDevice = exports.init = void 0; +exports.verifyTOTP = + exports.verifyDevice = + exports.removeDevice = + exports.updateDevice = + exports.listDevices = + exports.createDevice = + exports.init = + void 0; const utils_1 = require("../../utils"); const recipe_1 = __importDefault(require("./recipe")); class Wrapper { diff --git a/lib/build/recipe/totp/recipeImplementation.js b/lib/build/recipe/totp/recipeImplementation.js index 5ad44874b..966784a86 100644 --- a/lib/build/recipe/totp/recipeImplementation.js +++ b/lib/build/recipe/totp/recipeImplementation.js @@ -13,13 +13,7 @@ * License for the specific language governing permissions and limitations * under the License. */ -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; Object.defineProperty(exports, "__esModule", { value: true }); -const normalisedURLPath_1 = __importDefault(require("../../normalisedURLPath")); const __1 = require("../.."); function getRecipeInterface(querier, config) { return { @@ -73,7 +67,7 @@ function getRecipeInterface(querier, config) { } } const response = await querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/totp/device"), + "/recipe/totp/device", { userId: input.userId, deviceName: input.deviceName, @@ -82,6 +76,9 @@ function getRecipeInterface(querier, config) { }, input.userContext ); + if (response.status !== "OK") { + return response; + } return Object.assign(Object.assign({}, response), { qrCodeString: `otpauth://totp/${encodeURI(config.issuer)}${ @@ -94,7 +91,7 @@ function getRecipeInterface(querier, config) { }, updateDevice: (input) => { return querier.sendPutRequest( - new normalisedURLPath_1.default("/recipe/totp/device"), + "/recipe/totp/device", { userId: input.userId, existingDeviceName: input.existingDeviceName, @@ -106,7 +103,7 @@ function getRecipeInterface(querier, config) { }, listDevices: (input) => { return querier.sendGetRequest( - new normalisedURLPath_1.default("/recipe/totp/device/list"), + "/recipe/totp/device/list", { userId: input.userId, }, @@ -115,7 +112,7 @@ function getRecipeInterface(querier, config) { }, removeDevice: (input) => { return querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/totp/device/remove"), + "/recipe/totp/device/remove", { userId: input.userId, deviceName: input.deviceName, @@ -125,7 +122,12 @@ function getRecipeInterface(querier, config) { }, verifyDevice: (input) => { return querier.sendPostRequest( - new normalisedURLPath_1.default(`${input.tenantId}/recipe/totp/device/verify`), + { + path: "//recipe/totp/device/verify", + params: { + tenantId: input.tenantId, + }, + }, { userId: input.userId, deviceName: input.deviceName, @@ -136,7 +138,12 @@ function getRecipeInterface(querier, config) { }, verifyTOTP: (input) => { return querier.sendPostRequest( - new normalisedURLPath_1.default(`${input.tenantId}/recipe/totp/verify`), + { + path: "//recipe/totp/verify", + params: { + tenantId: input.tenantId, + }, + }, { userId: input.userId, totp: input.totp, diff --git a/lib/build/recipe/totp/types.d.ts b/lib/build/recipe/totp/types.d.ts index f4016b9e1..9bbd8e1a8 100644 --- a/lib/build/recipe/totp/types.d.ts +++ b/lib/build/recipe/totp/types.d.ts @@ -28,10 +28,7 @@ export declare type TypeNormalisedInput = { }; }; export declare type RecipeInterface = { - getUserIdentifierInfoForUserId: (input: { - userId: string; - userContext: UserContext; - }) => Promise< + getUserIdentifierInfoForUserId: (input: { userId: string; userContext: UserContext }) => Promise< | { status: "OK"; info: string; @@ -69,10 +66,7 @@ export declare type RecipeInterface = { }) => Promise<{ status: "OK" | "UNKNOWN_DEVICE_ERROR" | "DEVICE_ALREADY_EXISTS_ERROR"; }>; - listDevices: (input: { - userId: string; - userContext: UserContext; - }) => Promise<{ + listDevices: (input: { userId: string; userContext: UserContext }) => Promise<{ status: "OK"; devices: { name: string; @@ -81,11 +75,7 @@ export declare type RecipeInterface = { verified: boolean; }[]; }>; - removeDevice: (input: { - userId: string; - deviceName: string; - userContext: UserContext; - }) => Promise<{ + removeDevice: (input: { userId: string; deviceName: string; userContext: UserContext }) => Promise<{ status: "OK"; didDeviceExist: boolean; }>; @@ -113,12 +103,7 @@ export declare type RecipeInterface = { retryAfterMs: number; } >; - verifyTOTP: (input: { - tenantId: string; - userId: string; - totp: string; - userContext: UserContext; - }) => Promise< + verifyTOTP: (input: { tenantId: string; userId: string; totp: string; userContext: UserContext }) => Promise< | { status: "OK" | "UNKNOWN_USER_ID_ERROR"; } @@ -163,11 +148,7 @@ export declare type APIInterface = { >); listDevicesGET: | undefined - | ((input: { - options: APIOptions; - session: SessionContainerInterface; - userContext: UserContext; - }) => Promise< + | ((input: { options: APIOptions; session: SessionContainerInterface; userContext: UserContext }) => Promise< | { status: "OK"; devices: { diff --git a/lib/build/recipe/usermetadata/recipeImplementation.js b/lib/build/recipe/usermetadata/recipeImplementation.js index 2fd78898b..ac7009fb5 100644 --- a/lib/build/recipe/usermetadata/recipeImplementation.js +++ b/lib/build/recipe/usermetadata/recipeImplementation.js @@ -13,25 +13,15 @@ * License for the specific language governing permissions and limitations * under the License. */ -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; Object.defineProperty(exports, "__esModule", { value: true }); -const normalisedURLPath_1 = __importDefault(require("../../normalisedURLPath")); function getRecipeInterface(querier) { return { getUserMetadata: function ({ userId, userContext }) { - return querier.sendGetRequest( - new normalisedURLPath_1.default("/recipe/user/metadata"), - { userId }, - userContext - ); + return querier.sendGetRequest("/recipe/user/metadata", { userId }, userContext); }, - updateUserMetadata: function ({ userId, metadataUpdate, userContext }) { - return querier.sendPutRequest( - new normalisedURLPath_1.default("/recipe/user/metadata"), + updateUserMetadata: async function ({ userId, metadataUpdate, userContext }) { + const response = await querier.sendPutRequest( + "/recipe/user/metadata", { userId, metadataUpdate, @@ -39,10 +29,11 @@ function getRecipeInterface(querier) { {}, userContext ); + return Object.assign(Object.assign({}, response), { metadata: response.metadata }); }, clearUserMetadata: function ({ userId, userContext }) { return querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/user/metadata/remove"), + "/recipe/user/metadata/remove", { userId, }, diff --git a/lib/build/recipe/usermetadata/types.d.ts b/lib/build/recipe/usermetadata/types.d.ts index 8dd434ac7..b2a05c249 100644 --- a/lib/build/recipe/usermetadata/types.d.ts +++ b/lib/build/recipe/usermetadata/types.d.ts @@ -21,10 +21,7 @@ export declare type TypeNormalisedInput = { }; export declare type APIInterface = {}; export declare type RecipeInterface = { - getUserMetadata: (input: { - userId: string; - userContext: UserContext; - }) => Promise<{ + getUserMetadata: (input: { userId: string; userContext: UserContext }) => Promise<{ status: "OK"; metadata: any; }>; @@ -36,18 +33,11 @@ export declare type RecipeInterface = { * - update: `{ "notifications": { "sms": true }, "todos": null }` * - result: `{ "preferences": { "theme":"dark" }, "notifications": { "sms": true } }` */ - updateUserMetadata: (input: { - userId: string; - metadataUpdate: JSONObject; - userContext: UserContext; - }) => Promise<{ + updateUserMetadata: (input: { userId: string; metadataUpdate: JSONObject; userContext: UserContext }) => Promise<{ status: "OK"; metadata: JSONObject; }>; - clearUserMetadata: (input: { - userId: string; - userContext: UserContext; - }) => Promise<{ + clearUserMetadata: (input: { userId: string; userContext: UserContext }) => Promise<{ status: "OK"; }>; }; diff --git a/lib/build/recipe/userroles/index.d.ts b/lib/build/recipe/userroles/index.d.ts index 11a803d66..17279d2f7 100644 --- a/lib/build/recipe/userroles/index.d.ts +++ b/lib/build/recipe/userroles/index.d.ts @@ -95,9 +95,7 @@ export default class Wrapper { status: "OK"; didRoleExist: boolean; }>; - static getAllRoles( - userContext?: Record - ): Promise<{ + static getAllRoles(userContext?: Record): Promise<{ status: "OK"; roles: string[]; }>; diff --git a/lib/build/recipe/userroles/index.js b/lib/build/recipe/userroles/index.js index 21e01ff10..46339d6bd 100644 --- a/lib/build/recipe/userroles/index.js +++ b/lib/build/recipe/userroles/index.js @@ -19,7 +19,20 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.PermissionClaim = exports.UserRoleClaim = exports.getAllRoles = exports.deleteRole = exports.getRolesThatHavePermission = exports.removePermissionsFromRole = exports.getPermissionsForRole = exports.createNewRoleOrAddPermissions = exports.getUsersThatHaveRole = exports.getRolesForUser = exports.removeUserRole = exports.addRoleToUser = exports.init = void 0; +exports.PermissionClaim = + exports.UserRoleClaim = + exports.getAllRoles = + exports.deleteRole = + exports.getRolesThatHavePermission = + exports.removePermissionsFromRole = + exports.getPermissionsForRole = + exports.createNewRoleOrAddPermissions = + exports.getUsersThatHaveRole = + exports.getRolesForUser = + exports.removeUserRole = + exports.addRoleToUser = + exports.init = + void 0; const utils_1 = require("../../utils"); const permissionClaim_1 = require("./permissionClaim"); const recipe_1 = __importDefault(require("./recipe")); diff --git a/lib/build/recipe/userroles/recipeImplementation.js b/lib/build/recipe/userroles/recipeImplementation.js index 47dbdc1ba..584369625 100644 --- a/lib/build/recipe/userroles/recipeImplementation.js +++ b/lib/build/recipe/userroles/recipeImplementation.js @@ -13,21 +13,17 @@ * License for the specific language governing permissions and limitations * under the License. */ -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; Object.defineProperty(exports, "__esModule", { value: true }); -const normalisedURLPath_1 = __importDefault(require("../../normalisedURLPath")); -const constants_1 = require("../multitenancy/constants"); function getRecipeInterface(querier) { return { addRoleToUser: function ({ userId, role, tenantId, userContext }) { return querier.sendPutRequest( - new normalisedURLPath_1.default( - `/${tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId}/recipe/user/role` - ), + { + path: "//recipe/user/role", + params: { + tenantId: tenantId, + }, + }, { userId, role }, {}, userContext @@ -35,49 +31,49 @@ function getRecipeInterface(querier) { }, removeUserRole: function ({ userId, role, tenantId, userContext }) { return querier.sendPostRequest( - new normalisedURLPath_1.default( - `/${tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId}/recipe/user/role/remove` - ), + { + path: "//recipe/user/role/remove", + params: { + tenantId: tenantId, + }, + }, { userId, role }, userContext ); }, getRolesForUser: function ({ userId, tenantId, userContext }) { return querier.sendGetRequest( - new normalisedURLPath_1.default( - `/${tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId}/recipe/user/roles` - ), + { + path: "//recipe/user/roles", + params: { + tenantId: tenantId, + }, + }, { userId }, userContext ); }, getUsersThatHaveRole: function ({ role, tenantId, userContext }) { return querier.sendGetRequest( - new normalisedURLPath_1.default( - `/${tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId}/recipe/role/users` - ), + { + path: "//recipe/role/users", + params: { + tenantId: tenantId, + }, + }, { role }, userContext ); }, createNewRoleOrAddPermissions: function ({ role, permissions, userContext }) { - return querier.sendPutRequest( - new normalisedURLPath_1.default("/recipe/role"), - { role, permissions }, - {}, - userContext - ); + return querier.sendPutRequest("/recipe/role", { role, permissions }, {}, userContext); }, getPermissionsForRole: function ({ role, userContext }) { - return querier.sendGetRequest( - new normalisedURLPath_1.default("/recipe/role/permissions"), - { role }, - userContext - ); + return querier.sendGetRequest("/recipe/role/permissions", { role }, userContext); }, removePermissionsFromRole: function ({ role, permissions, userContext }) { return querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/role/permissions/remove"), + "/recipe/role/permissions/remove", { role, permissions, @@ -86,21 +82,13 @@ function getRecipeInterface(querier) { ); }, getRolesThatHavePermission: function ({ permission, userContext }) { - return querier.sendGetRequest( - new normalisedURLPath_1.default("/recipe/permission/roles"), - { permission }, - userContext - ); + return querier.sendGetRequest("/recipe/permission/roles", { permission }, userContext); }, deleteRole: function ({ role, userContext }) { - return querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/role/remove"), - { role }, - userContext - ); + return querier.sendPostRequest("/recipe/role/remove", { role }, userContext); }, getAllRoles: function ({ userContext }) { - return querier.sendGetRequest(new normalisedURLPath_1.default("/recipe/roles"), {}, userContext); + return querier.sendGetRequest("/recipe/roles", {}, userContext); }, }; } diff --git a/lib/build/recipe/userroles/types.d.ts b/lib/build/recipe/userroles/types.d.ts index c79ca9b8d..8228a348a 100644 --- a/lib/build/recipe/userroles/types.d.ts +++ b/lib/build/recipe/userroles/types.d.ts @@ -25,12 +25,7 @@ export declare type TypeNormalisedInput = { }; export declare type APIInterface = {}; export declare type RecipeInterface = { - addRoleToUser: (input: { - userId: string; - role: string; - tenantId: string; - userContext: UserContext; - }) => Promise< + addRoleToUser: (input: { userId: string; role: string; tenantId: string; userContext: UserContext }) => Promise< | { status: "OK"; didUserAlreadyHaveRole: boolean; @@ -39,12 +34,7 @@ export declare type RecipeInterface = { status: "UNKNOWN_ROLE_ERROR"; } >; - removeUserRole: (input: { - userId: string; - role: string; - tenantId: string; - userContext: UserContext; - }) => Promise< + removeUserRole: (input: { userId: string; role: string; tenantId: string; userContext: UserContext }) => Promise< | { status: "OK"; didUserHaveRole: boolean; @@ -53,19 +43,11 @@ export declare type RecipeInterface = { status: "UNKNOWN_ROLE_ERROR"; } >; - getRolesForUser: (input: { - userId: string; - tenantId: string; - userContext: UserContext; - }) => Promise<{ + getRolesForUser: (input: { userId: string; tenantId: string; userContext: UserContext }) => Promise<{ status: "OK"; roles: string[]; }>; - getUsersThatHaveRole: (input: { - role: string; - tenantId: string; - userContext: UserContext; - }) => Promise< + getUsersThatHaveRole: (input: { role: string; tenantId: string; userContext: UserContext }) => Promise< | { status: "OK"; users: string[]; @@ -82,10 +64,7 @@ export declare type RecipeInterface = { status: "OK"; createdNewRole: boolean; }>; - getPermissionsForRole: (input: { - role: string; - userContext: UserContext; - }) => Promise< + getPermissionsForRole: (input: { role: string; userContext: UserContext }) => Promise< | { status: "OK"; permissions: string[]; @@ -94,30 +73,18 @@ export declare type RecipeInterface = { status: "UNKNOWN_ROLE_ERROR"; } >; - removePermissionsFromRole: (input: { - role: string; - permissions: string[]; - userContext: UserContext; - }) => Promise<{ + removePermissionsFromRole: (input: { role: string; permissions: string[]; userContext: UserContext }) => Promise<{ status: "OK" | "UNKNOWN_ROLE_ERROR"; }>; - getRolesThatHavePermission: (input: { - permission: string; - userContext: UserContext; - }) => Promise<{ + getRolesThatHavePermission: (input: { permission: string; userContext: UserContext }) => Promise<{ status: "OK"; roles: string[]; }>; - deleteRole: (input: { - role: string; - userContext: UserContext; - }) => Promise<{ + deleteRole: (input: { role: string; userContext: UserContext }) => Promise<{ status: "OK"; didRoleExist: boolean; }>; - getAllRoles: (input: { - userContext: UserContext; - }) => Promise<{ + getAllRoles: (input: { userContext: UserContext }) => Promise<{ status: "OK"; roles: string[]; }>; diff --git a/lib/build/recipe/webauthn/api/implementation.js b/lib/build/recipe/webauthn/api/implementation.js index 6621a5e44..b0e15937f 100644 --- a/lib/build/recipe/webauthn/api/implementation.js +++ b/lib/build/recipe/webauthn/api/implementation.js @@ -578,8 +578,7 @@ function getAPIImplementation() { if (!emailVerified && hasOtherEmailOrPhone) { return { status: "RECOVER_ACCOUNT_NOT_ALLOWED", - reason: - "Recover account link was not created because of account take over risk. Please contact support. (ERR_CODE_001)", + reason: "Recover account link was not created because of account take over risk. Please contact support. (ERR_CODE_001)", }; } const shouldDoAccountLinkingResponse = await recipe_1.default @@ -704,14 +703,13 @@ function getAPIImplementation() { async function markEmailAsVerified(recipeUserId, email) { const emailVerificationInstance = recipe_2.default.getInstance(); if (emailVerificationInstance) { - const tokenResponse = await emailVerificationInstance.recipeInterfaceImpl.createEmailVerificationToken( - { + const tokenResponse = + await emailVerificationInstance.recipeInterfaceImpl.createEmailVerificationToken({ tenantId, recipeUserId, email, userContext, - } - ); + }); if (tokenResponse.status === "OK") { await emailVerificationInstance.recipeInterfaceImpl.verifyEmailUsingToken({ tenantId, diff --git a/lib/build/recipe/webauthn/constants.js b/lib/build/recipe/webauthn/constants.js index 09f1ebdbf..ff345b144 100644 --- a/lib/build/recipe/webauthn/constants.js +++ b/lib/build/recipe/webauthn/constants.js @@ -14,7 +14,23 @@ * under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -exports.DEFAULT_SIGNIN_OPTIONS_USER_PRESENCE = exports.DEFAULT_SIGNIN_OPTIONS_USER_VERIFICATION = exports.DEFAULT_SIGNIN_OPTIONS_TIMEOUT = exports.DEFAULT_REGISTER_OPTIONS_SUPPORTED_ALGORITHM_IDS = exports.DEFAULT_REGISTER_OPTIONS_USER_PRESENCE = exports.DEFAULT_REGISTER_OPTIONS_USER_VERIFICATION = exports.DEFAULT_REGISTER_OPTIONS_RESIDENT_KEY = exports.DEFAULT_REGISTER_OPTIONS_ATTESTATION = exports.DEFAULT_REGISTER_OPTIONS_TIMEOUT = exports.SIGNUP_EMAIL_EXISTS_API = exports.RECOVER_ACCOUNT_API = exports.GENERATE_RECOVER_ACCOUNT_TOKEN_API = exports.SIGN_IN_API = exports.SIGN_UP_API = exports.SIGNIN_OPTIONS_API = exports.REGISTER_OPTIONS_API = void 0; +exports.DEFAULT_SIGNIN_OPTIONS_USER_PRESENCE = + exports.DEFAULT_SIGNIN_OPTIONS_USER_VERIFICATION = + exports.DEFAULT_SIGNIN_OPTIONS_TIMEOUT = + exports.DEFAULT_REGISTER_OPTIONS_SUPPORTED_ALGORITHM_IDS = + exports.DEFAULT_REGISTER_OPTIONS_USER_PRESENCE = + exports.DEFAULT_REGISTER_OPTIONS_USER_VERIFICATION = + exports.DEFAULT_REGISTER_OPTIONS_RESIDENT_KEY = + exports.DEFAULT_REGISTER_OPTIONS_ATTESTATION = + exports.DEFAULT_REGISTER_OPTIONS_TIMEOUT = + exports.SIGNUP_EMAIL_EXISTS_API = + exports.RECOVER_ACCOUNT_API = + exports.GENERATE_RECOVER_ACCOUNT_TOKEN_API = + exports.SIGN_IN_API = + exports.SIGN_UP_API = + exports.SIGNIN_OPTIONS_API = + exports.REGISTER_OPTIONS_API = + void 0; exports.REGISTER_OPTIONS_API = "/webauthn/options/register"; exports.SIGNIN_OPTIONS_API = "/webauthn/options/signin"; exports.SIGN_UP_API = "/webauthn/signup"; diff --git a/lib/build/recipe/webauthn/index.d.ts b/lib/build/recipe/webauthn/index.d.ts index c4e28c46d..bbedbb5d0 100644 --- a/lib/build/recipe/webauthn/index.d.ts +++ b/lib/build/recipe/webauthn/index.d.ts @@ -425,10 +425,7 @@ export default class Wrapper { createdAt: number; } >; - static listCredentials(input: { - recipeUserId: string; - userContext?: Record; - }): Promise<{ + static listCredentials(input: { recipeUserId: string; userContext?: Record }): Promise<{ status: "OK"; credentials: { webauthnCredentialId: string; diff --git a/lib/build/recipe/webauthn/index.js b/lib/build/recipe/webauthn/index.js index fda5d6388..125573f2d 100644 --- a/lib/build/recipe/webauthn/index.js +++ b/lib/build/recipe/webauthn/index.js @@ -19,7 +19,28 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.updateUserEmail = exports.listCredentials = exports.getCredential = exports.removeCredential = exports.removeGeneratedOptions = exports.getUserFromRecoverAccountToken = exports.getGeneratedOptions = exports.sendEmail = exports.sendRecoverAccountEmail = exports.createRecoverAccountLink = exports.registerCredential = exports.consumeRecoverAccountToken = exports.recoverAccount = exports.generateRecoverAccountToken = exports.verifyCredentials = exports.signUp = exports.signIn = exports.signInOptions = exports.registerOptions = exports.Error = exports.init = void 0; +exports.updateUserEmail = + exports.listCredentials = + exports.getCredential = + exports.removeCredential = + exports.removeGeneratedOptions = + exports.getUserFromRecoverAccountToken = + exports.getGeneratedOptions = + exports.sendEmail = + exports.sendRecoverAccountEmail = + exports.createRecoverAccountLink = + exports.registerCredential = + exports.consumeRecoverAccountToken = + exports.recoverAccount = + exports.generateRecoverAccountToken = + exports.verifyCredentials = + exports.signUp = + exports.signIn = + exports.signInOptions = + exports.registerOptions = + exports.Error = + exports.init = + void 0; const recipe_1 = __importDefault(require("./recipe")); const error_1 = __importDefault(require("./error")); const constants_1 = require("../multitenancy/constants"); diff --git a/lib/build/recipe/webauthn/recipe.js b/lib/build/recipe/webauthn/recipe.js index ba5ab2579..4155373f3 100644 --- a/lib/build/recipe/webauthn/recipe.js +++ b/lib/build/recipe/webauthn/recipe.js @@ -192,9 +192,8 @@ class Recipe extends recipeModule_1.default { return a.timeJoined - b.timeJoined; }); // Then we take the ones that belong to this recipe - const recipeLoginMethodsOrderedByTimeJoinedOldestFirst = orderedLoginMethodsByTimeJoinedOldestFirst.filter( - (lm) => lm.recipeId === Recipe.RECIPE_ID - ); + const recipeLoginMethodsOrderedByTimeJoinedOldestFirst = + orderedLoginMethodsByTimeJoinedOldestFirst.filter((lm) => lm.recipeId === Recipe.RECIPE_ID); let result; if (recipeLoginMethodsOrderedByTimeJoinedOldestFirst.length !== 0) { // If there are login methods belonging to this recipe, the factor is set up diff --git a/lib/build/recipe/webauthn/recipeImplementation.js b/lib/build/recipe/webauthn/recipeImplementation.js index 9b192bb8c..bfacd97c3 100644 --- a/lib/build/recipe/webauthn/recipeImplementation.js +++ b/lib/build/recipe/webauthn/recipeImplementation.js @@ -31,10 +31,8 @@ var __importDefault = }; Object.defineProperty(exports, "__esModule", { value: true }); const recipe_1 = __importDefault(require("../accountlinking/recipe")); -const normalisedURLPath_1 = __importDefault(require("../../normalisedURLPath")); const __1 = require("../.."); const recipeUserId_1 = __importDefault(require("../../recipeUserId")); -const constants_1 = require("../multitenancy/constants"); const user_1 = require("../../user"); const authUtils_1 = require("../../authUtils"); function getRecipeInterface(querier, getWebauthnConfig) { @@ -112,11 +110,12 @@ function getRecipeInterface(querier, getWebauthnConfig) { displayName = email; } return await querier.sendPostRequest( - new normalisedURLPath_1.default( - `/${ - tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId - }/recipe/webauthn/options/register` - ), + { + path: "//recipe/webauthn/options/register", + params: { + tenantId: tenantId, + }, + }, { email, displayName, @@ -144,11 +143,12 @@ function getRecipeInterface(querier, getWebauthnConfig) { userContext, }) { return await querier.sendPostRequest( - new normalisedURLPath_1.default( - `/${ - tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId - }/recipe/webauthn/options/signin` - ), + { + path: "//recipe/webauthn/options/signin", + params: { + tenantId: tenantId, + }, + }, { userVerification, userPresence, @@ -177,16 +177,15 @@ function getRecipeInterface(querier, getWebauthnConfig) { if (response.status !== "OK") { return response; } - const linkResult = await authUtils_1.AuthUtils.linkToSessionIfRequiredElseCreatePrimaryUserIdOrLinkByAccountInfo( - { + const linkResult = + await authUtils_1.AuthUtils.linkToSessionIfRequiredElseCreatePrimaryUserIdOrLinkByAccountInfo({ tenantId, inputUser: response.user, recipeUserId: response.recipeUserId, session, shouldTryLinkingWithSessionUser, userContext, - } - ); + }); if (linkResult.status != "OK") { return linkResult; } @@ -226,16 +225,15 @@ function getRecipeInterface(querier, getWebauthnConfig) { // function updated the verification status) and can return that response.user = await __1.getUser(response.recipeUserId.getAsString(), userContext); } - const linkResult = await authUtils_1.AuthUtils.linkToSessionIfRequiredElseCreatePrimaryUserIdOrLinkByAccountInfo( - { + const linkResult = + await authUtils_1.AuthUtils.linkToSessionIfRequiredElseCreatePrimaryUserIdOrLinkByAccountInfo({ tenantId, inputUser: response.user, recipeUserId: response.recipeUserId, session, shouldTryLinkingWithSessionUser, userContext, - } - ); + }); if (linkResult.status === "LINKING_TO_SESSION_USER_FAILED") { return linkResult; } @@ -244,9 +242,12 @@ function getRecipeInterface(querier, getWebauthnConfig) { }, verifyCredentials: async function ({ credential, webauthnGeneratedOptionsId, tenantId, userContext }) { const response = await querier.sendPostRequest( - new normalisedURLPath_1.default( - `/${tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId}/recipe/webauthn/signin` - ), + { + path: "//recipe/webauthn/signin", + params: { + tenantId: tenantId, + }, + }, { credential, webauthnGeneratedOptionsId, @@ -264,11 +265,12 @@ function getRecipeInterface(querier, getWebauthnConfig) { }, createNewRecipeUser: async function (input) { const resp = await querier.sendPostRequest( - new normalisedURLPath_1.default( - `/${ - input.tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : input.tenantId - }/recipe/webauthn/signup` - ), + { + path: "//recipe/webauthn/signup", + params: { + tenantId: input.tenantId, + }, + }, { webauthnGeneratedOptionsId: input.webauthnGeneratedOptionsId, credential: input.credential, @@ -286,11 +288,12 @@ function getRecipeInterface(querier, getWebauthnConfig) { }, generateRecoverAccountToken: async function ({ userId, email, tenantId, userContext }) { return await querier.sendPostRequest( - new normalisedURLPath_1.default( - `/${ - tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId - }/recipe/webauthn/user/recover/token` - ), + { + path: "//recipe/webauthn/user/recover/token", + params: { + tenantId: tenantId, + }, + }, { userId, email, @@ -300,11 +303,12 @@ function getRecipeInterface(querier, getWebauthnConfig) { }, consumeRecoverAccountToken: async function ({ token, tenantId, userContext }) { return await querier.sendPostRequest( - new normalisedURLPath_1.default( - `/${ - tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId - }/recipe/webauthn/user/recover/token/consume` - ), + { + path: "//recipe/webauthn/user/recover/token/consume", + params: { + tenantId: tenantId, + }, + }, { token, }, @@ -313,7 +317,7 @@ function getRecipeInterface(querier, getWebauthnConfig) { }, registerCredential: async function ({ webauthnGeneratedOptionsId, credential, userContext, recipeUserId }) { return await querier.sendPostRequest( - new normalisedURLPath_1.default(`/recipe/webauthn/user/credential/register`), + "/recipe/webauthn/user/credential/register", { recipeUserId, webauthnGeneratedOptionsId, @@ -324,9 +328,12 @@ function getRecipeInterface(querier, getWebauthnConfig) { }, getUserFromRecoverAccountToken: async function ({ token, tenantId, userContext }) { const resp = await querier.sendGetRequest( - new normalisedURLPath_1.default( - `/${tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId}/recipe/webauthn/user/recover` - ), + { + path: "//recipe/webauthn/user/recover", + params: { + tenantId: tenantId, + }, + }, { token }, userContext ); @@ -340,15 +347,15 @@ function getRecipeInterface(querier, getWebauthnConfig) { }, removeCredential: async function ({ webauthnCredentialId, recipeUserId, userContext }) { return await querier.sendDeleteRequest( - new normalisedURLPath_1.default(`/recipe/webauthn/user/credential/remove`), - {}, + "/recipe/webauthn/user/credential/remove", + undefined, { recipeUserId, webauthnCredentialId }, userContext ); }, getCredential: async function ({ webauthnCredentialId, recipeUserId, userContext }) { const resp = await querier.sendGetRequest( - new normalisedURLPath_1.default(`/recipe/webauthn/user/credential`), + "/recipe/webauthn/user/credential", { webauthnCredentialId, recipeUserId }, userContext ); @@ -360,38 +367,41 @@ function getRecipeInterface(querier, getWebauthnConfig) { return resp; }, listCredentials: async function ({ recipeUserId, userContext }) { - return await querier.sendGetRequest( - new normalisedURLPath_1.default(`/recipe/webauthn/user/credential/list`), - { recipeUserId }, - userContext - ); + return await querier.sendGetRequest("/recipe/webauthn/user/credential/list", { recipeUserId }, userContext); }, removeGeneratedOptions: async function ({ webauthnGeneratedOptionsId, tenantId, userContext }) { return await querier.sendDeleteRequest( - new normalisedURLPath_1.default( - `/${ - tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId - }/recipe/webauthn/options/remove` - ), - {}, + { + path: "//recipe/webauthn/options/remove", + params: { + tenantId: tenantId, + }, + }, + undefined, { webauthnGeneratedOptionsId }, userContext ); }, getGeneratedOptions: async function ({ webauthnGeneratedOptionsId, tenantId, userContext }) { return await querier.sendGetRequest( - new normalisedURLPath_1.default( - `/${tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId}/recipe/webauthn/options` - ), + { + path: "//recipe/webauthn/options", + params: { + tenantId: tenantId, + }, + }, { webauthnGeneratedOptionsId }, userContext ); }, updateUserEmail: async function ({ email, recipeUserId, tenantId, userContext }) { return await querier.sendPutRequest( - new normalisedURLPath_1.default( - `/${tenantId === undefined ? constants_1.DEFAULT_TENANT_ID : tenantId}/recipe/webauthn/user/email` - ), + { + path: "//recipe/webauthn/user/email", + params: { + tenantId: tenantId, + }, + }, { email, recipeUserId }, {}, userContext diff --git a/lib/build/recipe/webauthn/types.d.ts b/lib/build/recipe/webauthn/types.d.ts index 30fc60c1c..539de2b8c 100644 --- a/lib/build/recipe/webauthn/types.d.ts +++ b/lib/build/recipe/webauthn/types.d.ts @@ -349,11 +349,7 @@ export declare type RecipeInterface = { } | GenerateRecoverAccountTokenErrorResponse >; - consumeRecoverAccountToken(input: { - token: string; - tenantId: string; - userContext: UserContext; - }): Promise< + consumeRecoverAccountToken(input: { token: string; tenantId: string; userContext: UserContext }): Promise< | { status: "OK"; email: string; @@ -372,11 +368,7 @@ export declare type RecipeInterface = { } | RegisterCredentialErrorResponse >; - getUserFromRecoverAccountToken(input: { - token: string; - tenantId: string; - userContext: UserContext; - }): Promise< + getUserFromRecoverAccountToken(input: { token: string; tenantId: string; userContext: UserContext }): Promise< | { status: "OK"; user: User; @@ -384,21 +376,13 @@ export declare type RecipeInterface = { } | GetUserFromRecoverAccountTokenErrorResponse >; - removeCredential(input: { - webauthnCredentialId: string; - recipeUserId: string; - userContext: UserContext; - }): Promise< + removeCredential(input: { webauthnCredentialId: string; recipeUserId: string; userContext: UserContext }): Promise< | { status: "OK"; } | RemoveCredentialErrorResponse >; - getCredential(input: { - webauthnCredentialId: string; - recipeUserId: string; - userContext: UserContext; - }): Promise< + getCredential(input: { webauthnCredentialId: string; recipeUserId: string; userContext: UserContext }): Promise< | { status: "OK"; webauthnCredentialId: string; @@ -408,10 +392,7 @@ export declare type RecipeInterface = { } | GetCredentialErrorResponse >; - listCredentials(input: { - recipeUserId: string; - userContext: UserContext; - }): Promise<{ + listCredentials(input: { recipeUserId: string; userContext: UserContext }): Promise<{ status: "OK"; credentials: { webauthnCredentialId: string; @@ -598,11 +579,7 @@ export declare type APIInterface = { >); signInOptionsPOST: | undefined - | ((input: { - tenantId: string; - options: APIOptions; - userContext: UserContext; - }) => Promise< + | ((input: { tenantId: string; options: APIOptions; userContext: UserContext }) => Promise< | { status: "OK"; webauthnGeneratedOptionsId: string; @@ -656,12 +633,7 @@ export declare type APIInterface = { >); generateRecoverAccountTokenPOST: | undefined - | ((input: { - email: string; - tenantId: string; - options: APIOptions; - userContext: UserContext; - }) => Promise< + | ((input: { email: string; tenantId: string; options: APIOptions; userContext: UserContext }) => Promise< | { status: "OK"; } @@ -704,12 +676,7 @@ export declare type APIInterface = { >); emailExistsGET: | undefined - | ((input: { - email: string; - tenantId: string; - options: APIOptions; - userContext: UserContext; - }) => Promise< + | ((input: { email: string; tenantId: string; options: APIOptions; userContext: UserContext }) => Promise< | { status: "OK"; exists: boolean; diff --git a/lib/build/supertokens.js b/lib/build/supertokens.js index db7ceb9ef..58ef100ca 100644 --- a/lib/build/supertokens.js +++ b/lib/build/supertokens.js @@ -59,9 +59,12 @@ class SuperTokens { includeRecipeIdsStr = includeRecipeIds.join(","); } let response = await querier.sendGetRequest( - new normalisedURLPath_1.default( - `/${tenantId === undefined ? constants_2.DEFAULT_TENANT_ID : tenantId}/users/count` - ), + { + path: "//users/count", + params: { + tenantId: tenantId === undefined ? constants_2.DEFAULT_TENANT_ID : tenantId, + }, + }, { includeRecipeIds: includeRecipeIdsStr, includeAllTenants: tenantId === undefined, @@ -76,7 +79,7 @@ class SuperTokens { if (utils_1.maxVersion("2.15", cdiVersion) === cdiVersion) { // create userId mapping is only available >= CDI 2.15 return await querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/userid/map"), + "/recipe/userid/map", { superTokensUserId: input.superTokensUserId, externalUserId: input.externalUserId, @@ -95,7 +98,7 @@ class SuperTokens { if (utils_1.maxVersion("2.15", cdiVersion) === cdiVersion) { // create userId mapping is only available >= CDI 2.15 let response = await querier.sendGetRequest( - new normalisedURLPath_1.default("/recipe/userid/map"), + "/recipe/userid/map", { userId: input.userId, userIdType: input.userIdType, @@ -112,7 +115,7 @@ class SuperTokens { let cdiVersion = await querier.getAPIVersion(input.userContext); if (utils_1.maxVersion("2.15", cdiVersion) === cdiVersion) { return await querier.sendPostRequest( - new normalisedURLPath_1.default("/recipe/userid/map/remove"), + "/recipe/userid/map/remove", { userId: input.userId, userIdType: input.userIdType, @@ -129,11 +132,11 @@ class SuperTokens { let cdiVersion = await querier.getAPIVersion(input.userContext); if (utils_1.maxVersion("2.15", cdiVersion) === cdiVersion) { return await querier.sendPutRequest( - new normalisedURLPath_1.default("/recipe/userid/external-user-id-info"), + "/recipe/userid/external-user-id-info", { userId: input.userId, userIdType: input.userIdType, - externalUserIdInfo: input.externalUserIdInfo, + externalUserIdInfo: input.externalUserIdInfo || null, }, {}, input.userContext diff --git a/lib/build/thirdpartyUtils.js b/lib/build/thirdpartyUtils.js index 83cc3d405..ffaf83338 100644 --- a/lib/build/thirdpartyUtils.js +++ b/lib/build/thirdpartyUtils.js @@ -41,7 +41,11 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.getOIDCDiscoveryInfo = exports.verifyIdTokenFromJWKSEndpointAndGetPayload = exports.doPostRequest = exports.doGetRequest = void 0; +exports.getOIDCDiscoveryInfo = + exports.verifyIdTokenFromJWKSEndpointAndGetPayload = + exports.doPostRequest = + exports.doGetRequest = + void 0; const jose = __importStar(require("jose")); const logger_1 = require("./logger"); const utils_1 = require("./utils"); diff --git a/lib/build/user.d.ts b/lib/build/user.d.ts index b50e8f506..72e7a2d59 100644 --- a/lib/build/user.d.ts +++ b/lib/build/user.d.ts @@ -35,6 +35,11 @@ export declare class User implements UserType { readonly loginMethods: LoginMethod[]; readonly timeJoined: number; constructor(user: UserWithoutHelperFunctions); + static fromApi( + apiUser: Omit & { + id: string; + } + ): User; toJson(): JSONObject; } export declare type UserWithoutHelperFunctions = { diff --git a/lib/build/user.js b/lib/build/user.js index f89bf48bc..75d18ba4f 100644 --- a/lib/build/user.js +++ b/lib/build/user.js @@ -87,6 +87,11 @@ class User { this.timeJoined = user.timeJoined; this.loginMethods = user.loginMethods.map((m) => new LoginMethod(m)); } + static fromApi(apiUser) { + return new User( + Object.assign(Object.assign({}, apiUser), { id: new recipeUserId_1.default(apiUser.id).getAsString() }) + ); + } toJson() { return { id: this.id, diff --git a/lib/build/utils.js b/lib/build/utils.js index 93e6b1438..ec547d43f 100644 --- a/lib/build/utils.js +++ b/lib/build/utils.js @@ -5,7 +5,39 @@ var __importDefault = return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.isBuffer = exports.decodeBase64 = exports.encodeBase64 = exports.isTestEnv = exports.getBuffer = exports.getProcess = exports.transformObjectKeys = exports.toSnakeCase = exports.toCamelCase = exports.normaliseEmail = exports.postWithFetch = exports.getFromObjectCaseInsensitive = exports.getTopLevelDomainForSameSiteResolution = exports.setRequestInUserContextIfNotDefined = exports.getUserContext = exports.makeDefaultUserContextFromAPI = exports.humaniseMilliseconds = exports.frontendHasInterceptor = exports.getRidFromHeader = exports.hasGreaterThanEqualToFDI = exports.getLatestFDIVersionFromFDIList = exports.getBackwardsCompatibleUserInfo = exports.getNormalisedShouldTryLinkingWithSessionUserFlag = exports.isAnIpAddress = exports.send200Response = exports.sendNon200Response = exports.sendNon200ResponseWithMessage = exports.normaliseHttpMethod = exports.normaliseInputAppInfoOrThrowError = exports.maxVersion = exports.getLargestVersionFromIntersection = exports.doFetch = void 0; +exports.isBuffer = + exports.decodeBase64 = + exports.encodeBase64 = + exports.isTestEnv = + exports.getBuffer = + exports.getProcess = + exports.transformObjectKeys = + exports.toSnakeCase = + exports.toCamelCase = + exports.normaliseEmail = + exports.postWithFetch = + exports.getFromObjectCaseInsensitive = + exports.getTopLevelDomainForSameSiteResolution = + exports.setRequestInUserContextIfNotDefined = + exports.getUserContext = + exports.makeDefaultUserContextFromAPI = + exports.humaniseMilliseconds = + exports.frontendHasInterceptor = + exports.getRidFromHeader = + exports.hasGreaterThanEqualToFDI = + exports.getLatestFDIVersionFromFDIList = + exports.getBackwardsCompatibleUserInfo = + exports.getNormalisedShouldTryLinkingWithSessionUserFlag = + exports.isAnIpAddress = + exports.send200Response = + exports.sendNon200Response = + exports.sendNon200ResponseWithMessage = + exports.normaliseHttpMethod = + exports.normaliseInputAppInfoOrThrowError = + exports.maxVersion = + exports.getLargestVersionFromIntersection = + exports.doFetch = + void 0; const tldts_1 = require("tldts"); const normalisedURLDomain_1 = __importDefault(require("./normalisedURLDomain")); const normalisedURLPath_1 = __importDefault(require("./normalisedURLPath")); diff --git a/lib/core/paths.ts b/lib/ts/core/paths.ts similarity index 100% rename from lib/core/paths.ts rename to lib/ts/core/paths.ts diff --git a/lib/core/types.ts b/lib/ts/core/types.ts similarity index 80% rename from lib/core/types.ts rename to lib/ts/core/types.ts index aad43e9df..d93c449a4 100644 --- a/lib/core/types.ts +++ b/lib/ts/core/types.ts @@ -37,22 +37,20 @@ type MakeAllRequired = { type DeepRequireAllFields = T extends any ? MakeAllRequired : never; // Type to extract the request body from the method type -export type RequestBody

= - ExtractMethodType extends { - requestBody?: infer ReqBody; - } - ? ReqBody extends { content: { "application/json": infer R } } - ? R | undefined - : undefined - : undefined; +export type RequestBody

= ExtractMethodType extends { + requestBody?: infer ReqBody; +} + ? ReqBody extends { content: { "application/json": infer R } } + ? R | undefined + : undefined + : undefined; // Type to extract the response body from the method type -export type UncleanedResponseBody

= - ExtractMethodType extends { - responses: { 200: { content: { "application/json": infer R } } }; - } - ? R - : unknown; +export type UncleanedResponseBody

= ExtractMethodType extends { + responses: { 200: { content: { "application/json": infer R } } }; +} + ? R + : unknown; // Type to clean the response body from the method type export type ResponseBody

= DeepRequireAllFields>; @@ -63,8 +61,9 @@ type ExtractPathParams = T extends `${string}<${infer Param}>$ ? Param | ExtractPathParams : never; -type PathParamsObject = - ExtractPathParams extends never ? undefined : { [K in ExtractPathParams]: string }; +type PathParamsObject = ExtractPathParams extends never + ? undefined + : { [K in ExtractPathParams]: string }; // Type to handle the path parameter export type PathParam

= P | { path: P; params: PathParamsObject

}; diff --git a/lib/core/versions/5.3/schema.d.ts b/lib/ts/core/versions/5.3/schema.d.ts similarity index 85% rename from lib/core/versions/5.3/schema.d.ts rename to lib/ts/core/versions/5.3/schema.d.ts index 3bf697120..dc4083377 100644 --- a/lib/core/versions/5.3/schema.d.ts +++ b/lib/ts/core/versions/5.3/schema.d.ts @@ -1,3 +1,7 @@ +// @ts-nocheck +// @ts-nocheck +// @ts-nocheck +// @ts-nocheck /** * This file was auto-generated by openapi-typescript. * Do not make direct changes to the file. @@ -3442,13 +3446,18 @@ export interface components { bulkImportUserPasswordlessLoginMethod: (components["schemas"]["bulkImportUserLoginMethodFields"] & { /** @example passwordless */ recipeId?: string; - }) & (components["schemas"]["email"] | components["schemas"]["phoneNumber"]); + }) & + (components["schemas"]["email"] | components["schemas"]["phoneNumber"]); bulkImportUser: { externalUserId?: components["schemas"]["userId"]; userMetadata?: components["schemas"]["userMetadata"][]; userRoles?: components["schemas"]["bulkImportUserRole"][]; totpDevices?: components["schemas"]["bulkImportTotpDevice"][]; - loginMethods?: (components["schemas"]["bulkImportUserEmailPasswordLoginMethod"] | components["schemas"]["bulkImportUserThirdPartyLoginMethod"] | components["schemas"]["bulkImportUserPasswordlessLoginMethod"])[]; + loginMethods?: ( + | components["schemas"]["bulkImportUserEmailPasswordLoginMethod"] + | components["schemas"]["bulkImportUserThirdPartyLoginMethod"] + | components["schemas"]["bulkImportUserPasswordlessLoginMethod"] + )[]; }; addBulkImportUserResponse: { userId?: components["schemas"]["userId"]; @@ -3627,23 +3636,26 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example true */ - wasAlreadyAPrimaryUser?: boolean; - } | { - /** @enum {string} */ - status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId?: string; - description?: string; - } | { - /** @enum {string} */ - status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId?: string; - description?: string; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example true */ + wasAlreadyAPrimaryUser?: boolean; + } + | { + /** @enum {string} */ + status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + } + | { + /** @enum {string} */ + status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + }; }; }; 400: components["responses"]["400"]; @@ -3680,26 +3692,30 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example true */ - accountsAlreadyLinked?: boolean; - } | { - /** @enum {string} */ - status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId?: string; - description?: string; - } | { - /** @enum {string} */ - status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId?: string; - description?: string; - } | { - /** @enum {string} */ - status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example true */ + accountsAlreadyLinked?: boolean; + } + | { + /** @enum {string} */ + status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + } + | { + /** @enum {string} */ + status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + } + | { + /** @enum {string} */ + status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; + }; }; }; 400: components["responses"]["400"]; @@ -3740,23 +3756,26 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example true */ - wasAlreadyAPrimaryUser: boolean; - user: components["schemas"]["authRecipeUser"]; - } | { - /** @enum {string} */ - status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId: string; - description: string; - } | { - /** @enum {string} */ - status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId: string; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example true */ + wasAlreadyAPrimaryUser: boolean; + user: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId: string; + description: string; + } + | { + /** @enum {string} */ + status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId: string; + }; }; }; 400: components["responses"]["400"]; @@ -3800,28 +3819,32 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example true */ - accountsAlreadyLinked?: boolean; - user?: components["schemas"]["authRecipeUser"]; - } | { - /** @enum {string} */ - status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId?: string; - description?: string; - } | { - /** @enum {string} */ - status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - primaryUserId?: string; - user?: components["schemas"]["authRecipeUser"]; - description?: string; - } | { - /** @enum {string} */ - status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example true */ + accountsAlreadyLinked?: boolean; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + description?: string; + } + | { + /** @enum {string} */ + status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + primaryUserId?: string; + user?: components["schemas"]["authRecipeUser"]; + description?: string; + } + | { + /** @enum {string} */ + status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; + }; }; }; 400: components["responses"]["400"]; @@ -3913,15 +3936,18 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - } | { - /** @enum {string} */ - status: "UNKNOWN_DEVICE_ERROR"; - } | { - /** @enum {string} */ - status: "DEVICE_ALREADY_EXISTS_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + } + | { + /** @enum {string} */ + status: "UNKNOWN_DEVICE_ERROR"; + } + | { + /** @enum {string} */ + status: "DEVICE_ALREADY_EXISTS_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -3967,16 +3993,18 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example JBSWY3DPEHPK3PXP */ - secret?: string; - /** @example d1 */ - deviceName?: string; - } | { - /** @enum {string} */ - status: "DEVICE_ALREADY_EXISTS_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example JBSWY3DPEHPK3PXP */ + secret?: string; + /** @example d1 */ + deviceName?: string; + } + | { + /** @enum {string} */ + status: "DEVICE_ALREADY_EXISTS_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -4068,14 +4096,16 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example d1 */ - deviceName?: string; - } | { - /** @enum {string} */ - status: "DEVICE_ALREADY_EXISTS_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example d1 */ + deviceName?: string; + } + | { + /** @enum {string} */ + status: "DEVICE_ALREADY_EXISTS_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -4165,28 +4195,32 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - } | { - /** @enum {string} */ - status: "INVALID_TOTP_ERROR"; - /** @example 2 */ - currentNumberOfFailedAttempts?: number; - /** @example 5 */ - maxNumberOfFailedAttempts?: number; - } | { - /** @enum {string} */ - status: "UNKNOWN_USER_ID_ERROR"; - } | { - /** @enum {string} */ - status: "LIMIT_REACHED_ERROR"; - /** @example 90000 */ - retryAfterMs?: number; - /** @example 2 */ - currentNumberOfFailedAttempts?: number; - /** @example 5 */ - maxNumberOfFailedAttempts?: number; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + } + | { + /** @enum {string} */ + status: "INVALID_TOTP_ERROR"; + /** @example 2 */ + currentNumberOfFailedAttempts?: number; + /** @example 5 */ + maxNumberOfFailedAttempts?: number; + } + | { + /** @enum {string} */ + status: "UNKNOWN_USER_ID_ERROR"; + } + | { + /** @enum {string} */ + status: "LIMIT_REACHED_ERROR"; + /** @example 90000 */ + retryAfterMs?: number; + /** @example 2 */ + currentNumberOfFailedAttempts?: number; + /** @example 5 */ + maxNumberOfFailedAttempts?: number; + }; }; }; 400: components["responses"]["400"]; @@ -4230,30 +4264,34 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example false */ - wasAlreadyVerified?: boolean; - } | { - /** @enum {string} */ - status: "UNKNOWN_DEVICE_ERROR"; - } | { - /** @enum {string} */ - status: "INVALID_TOTP_ERROR"; - /** @example 2 */ - currentNumberOfFailedAttempts?: number; - /** @example 5 */ - maxNumberOfFailedAttempts?: number; - } | { - /** @enum {string} */ - status: "LIMIT_REACHED_ERROR"; - /** @example 90000 */ - retryAfterMs?: number; - /** @example 2 */ - currentNumberOfFailedAttempts?: number; - /** @example 5 */ - maxNumberOfFailedAttempts?: number; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example false */ + wasAlreadyVerified?: boolean; + } + | { + /** @enum {string} */ + status: "UNKNOWN_DEVICE_ERROR"; + } + | { + /** @enum {string} */ + status: "INVALID_TOTP_ERROR"; + /** @example 2 */ + currentNumberOfFailedAttempts?: number; + /** @example 5 */ + maxNumberOfFailedAttempts?: number; + } + | { + /** @enum {string} */ + status: "LIMIT_REACHED_ERROR"; + /** @example 90000 */ + retryAfterMs?: number; + /** @example 2 */ + currentNumberOfFailedAttempts?: number; + /** @example 5 */ + maxNumberOfFailedAttempts?: number; + }; }; }; 400: components["responses"]["400"]; @@ -4290,17 +4328,19 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - superTokensUserId: components["schemas"]["userId"]; - /** @example externalId */ - externalUserId: string; - /** @example Info about external userId */ - externalUserIdInfo?: string; - } | { - /** @enum {string} */ - status: "UNKNOWN_MAPPING_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + superTokensUserId: components["schemas"]["userId"]; + /** @example externalId */ + externalUserId: string; + /** @example Info about external userId */ + externalUserIdInfo?: string; + } + | { + /** @enum {string} */ + status: "UNKNOWN_MAPPING_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -4345,17 +4385,20 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - } | { - /** @enum {string} */ - status: "UNKNOWN_SUPERTOKENS_USER_ID_ERROR"; - } | { - /** @enum {string} */ - status: "USER_ID_MAPPING_ALREADY_EXISTS_ERROR"; - doesSuperTokensUserIdExist?: boolean; - doesExternalUserIdExist?: boolean; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + } + | { + /** @enum {string} */ + status: "UNKNOWN_SUPERTOKENS_USER_ID_ERROR"; + } + | { + /** @enum {string} */ + status: "USER_ID_MAPPING_ALREADY_EXISTS_ERROR"; + doesSuperTokensUserIdExist?: boolean; + doesExternalUserIdExist?: boolean; + }; }; }; 400: components["responses"]["400"]; @@ -4445,12 +4488,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - } | { - /** @enum {string} */ - status: "UNKNOWN_MAPPING_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + } + | { + /** @enum {string} */ + status: "UNKNOWN_MAPPING_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -4478,14 +4523,16 @@ export interface operations { }; requestBody?: { content: { - "application/json": { - preAuthSessionId: components["schemas"]["preAuthSessionId"]; - linkCode: components["schemas"]["linkCode"]; - } | { - preAuthSessionId: components["schemas"]["preAuthSessionId"]; - deviceId: components["schemas"]["deviceId"]; - userInputCode: components["schemas"]["userInputCode"]; - }; + "application/json": + | { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + linkCode: components["schemas"]["linkCode"]; + } + | { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + deviceId: components["schemas"]["deviceId"]; + userInputCode: components["schemas"]["userInputCode"]; + }; }; }; responses: { @@ -4495,26 +4542,29 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - consumedDevice?: { - preAuthSessionId: components["schemas"]["preAuthSessionId"]; - /** @example 2 */ - failedCodeInputAttemptCount: number; - email?: components["schemas"]["email"]; - phoneNumber?: components["schemas"]["phoneNumber"]; - }; - } | { - /** @enum {string} */ - status: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR"; - /** @example 2 */ - failedCodeInputAttemptCount?: number; - /** @example 5 */ - maximumCodeInputAttempts?: number; - } | { - /** @enum {string} */ - status: "RESTART_FLOW_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + consumedDevice?: { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + /** @example 2 */ + failedCodeInputAttemptCount: number; + email?: components["schemas"]["email"]; + phoneNumber?: components["schemas"]["phoneNumber"]; + }; + } + | { + /** @enum {string} */ + status: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR"; + /** @example 2 */ + failedCodeInputAttemptCount?: number; + /** @example 5 */ + maximumCodeInputAttempts?: number; + } + | { + /** @enum {string} */ + status: "RESTART_FLOW_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -4542,14 +4592,16 @@ export interface operations { }; requestBody?: { content: { - "application/json": { - preAuthSessionId: components["schemas"]["preAuthSessionId"]; - linkCode: components["schemas"]["linkCode"]; - } | { - preAuthSessionId: components["schemas"]["preAuthSessionId"]; - deviceId: components["schemas"]["deviceId"]; - userInputCode: components["schemas"]["userInputCode"]; - }; + "application/json": + | { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + linkCode: components["schemas"]["linkCode"]; + } + | { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + deviceId: components["schemas"]["deviceId"]; + userInputCode: components["schemas"]["userInputCode"]; + }; }; }; responses: { @@ -4559,30 +4611,33 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example true */ - createdNewUser?: boolean; - user?: components["schemas"]["authRecipeUser"]; - recipeUserId?: components["schemas"]["userId"]; - consumedDevice?: { - preAuthSessionId: components["schemas"]["preAuthSessionId"]; - /** @example 2 */ - failedCodeInputAttemptCount: number; - email?: components["schemas"]["email"]; - phoneNumber?: components["schemas"]["phoneNumber"]; - }; - } | { - /** @enum {string} */ - status: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR"; - /** @example 2 */ - failedCodeInputAttemptCount?: number; - /** @example 5 */ - maximumCodeInputAttempts?: number; - } | { - /** @enum {string} */ - status: "RESTART_FLOW_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example true */ + createdNewUser?: boolean; + user?: components["schemas"]["authRecipeUser"]; + recipeUserId?: components["schemas"]["userId"]; + consumedDevice?: { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + /** @example 2 */ + failedCodeInputAttemptCount: number; + email?: components["schemas"]["email"]; + phoneNumber?: components["schemas"]["phoneNumber"]; + }; + } + | { + /** @enum {string} */ + status: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR"; + /** @example 2 */ + failedCodeInputAttemptCount?: number; + /** @example 5 */ + maximumCodeInputAttempts?: number; + } + | { + /** @enum {string} */ + status: "RESTART_FLOW_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -4610,16 +4665,19 @@ export interface operations { }; requestBody?: { content: { - "application/json": { - email: components["schemas"]["email"]; - userInputCode?: components["schemas"]["userInputCode"]; - } | { - phoneNumber: components["schemas"]["phoneNumber"]; - userInputCode?: components["schemas"]["userInputCode"]; - } | { - deviceId: components["schemas"]["deviceId"]; - userInputCode?: components["schemas"]["userInputCode"]; - }; + "application/json": + | { + email: components["schemas"]["email"]; + userInputCode?: components["schemas"]["userInputCode"]; + } + | { + phoneNumber: components["schemas"]["phoneNumber"]; + userInputCode?: components["schemas"]["userInputCode"]; + } + | { + deviceId: components["schemas"]["deviceId"]; + userInputCode?: components["schemas"]["userInputCode"]; + }; }; }; responses: { @@ -4666,11 +4724,13 @@ export interface operations { }; requestBody?: { content: { - "application/json": { - codeId: components["schemas"]["codeId"]; - } | { - preAuthSessionId: components["schemas"]["preAuthSessionId"]; - }; + "application/json": + | { + codeId: components["schemas"]["codeId"]; + } + | { + preAuthSessionId: components["schemas"]["preAuthSessionId"]; + }; }; }; responses: { @@ -4767,11 +4827,13 @@ export interface operations { }; requestBody?: { content: { - "application/json": { - email: components["schemas"]["email"]; - } | { - phoneNumber: components["schemas"]["phoneNumber"]; - }; + "application/json": + | { + email: components["schemas"]["email"]; + } + | { + phoneNumber: components["schemas"]["phoneNumber"]; + }; }; }; responses: { @@ -4823,13 +4885,15 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - user?: components["schemas"]["authRecipeUser"]; - } | { - /** @enum {string} */ - status: "UNKNOWN_USER_ID_ERROR" | "UNKNOWN_EMAIL_ERROR" | "UNKNOWN_PHONE_NUMBER_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status: "UNKNOWN_USER_ID_ERROR" | "UNKNOWN_EMAIL_ERROR" | "UNKNOWN_PHONE_NUMBER_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -4871,14 +4935,20 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - /** @enum {string} */ - status: "OK" | "UNKNOWN_USER_ID_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR" | "PHONE_NUMBER_ALREADY_EXISTS_ERROR"; - } | { - /** @enum {string} */ - status: "EMAIL_CHANGE_NOT_ALLOWED_ERROR" | "PHONE_NUMBER_CHANGE_NOT_ALLOWED_ERROR"; - reason?: string; - }; + "application/json": + | { + /** @enum {string} */ + status: + | "OK" + | "UNKNOWN_USER_ID_ERROR" + | "EMAIL_ALREADY_EXISTS_ERROR" + | "PHONE_NUMBER_ALREADY_EXISTS_ERROR"; + } + | { + /** @enum {string} */ + status: "EMAIL_CHANGE_NOT_ALLOWED_ERROR" | "PHONE_NUMBER_CHANGE_NOT_ALLOWED_ERROR"; + reason?: string; + }; }; }; 400: components["responses"]["400"]; @@ -4919,11 +4989,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - user?: components["schemas"]["authRecipeUser"]; - recipeUserId?: components["schemas"]["userId"]; - } | components["schemas"]["wrongCredentialsResponse"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + recipeUserId?: components["schemas"]["userId"]; + } + | components["schemas"]["wrongCredentialsResponse"]; }; }; 400: components["responses"]["400"]; @@ -4964,14 +5036,16 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - user?: components["schemas"]["authRecipeUser"]; - recipeUserId?: components["schemas"]["userId"]; - } | { - /** @enum {string} */ - status: "EMAIL_ALREADY_EXISTS_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + recipeUserId?: components["schemas"]["userId"]; + } + | { + /** @enum {string} */ + status: "EMAIL_ALREADY_EXISTS_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -5010,13 +5084,15 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - user?: components["schemas"]["authRecipeUser"]; - } | { - /** @enum {string} */ - status: "UNKNOWN_USER_ID_ERROR" | "UNKNOWN_EMAIL_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status: "UNKNOWN_USER_ID_ERROR" | "UNKNOWN_EMAIL_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -5058,14 +5134,16 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - /** @enum {string} */ - status: "OK" | "UNKNOWN_USER_ID_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR"; - } | { - /** @enum {string} */ - status: "EMAIL_CHANGE_NOT_ALLOWED_ERROR"; - reason?: string; - }; + "application/json": + | { + /** @enum {string} */ + status: "OK" | "UNKNOWN_USER_ID_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR"; + } + | { + /** @enum {string} */ + status: "EMAIL_CHANGE_NOT_ALLOWED_ERROR"; + reason?: string; + }; }; }; 400: components["responses"]["400"]; @@ -5106,10 +5184,12 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - token?: components["schemas"]["token"]; - } | components["schemas"]["unknownUserIdResponse"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + token?: components["schemas"]["token"]; + } + | components["schemas"]["unknownUserIdResponse"]; }; }; 400: components["responses"]["400"]; @@ -5153,13 +5233,15 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - userId?: components["schemas"]["userId"]; - } | { - /** @enum {string} */ - status: "RESET_PASSWORD_INVALID_TOKEN_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + userId?: components["schemas"]["userId"]; + } + | { + /** @enum {string} */ + status: "RESET_PASSWORD_INVALID_TOKEN_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -5245,14 +5327,16 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - userId?: components["schemas"]["userId"]; - email?: components["schemas"]["email"]; - } | { - /** @enum {string} */ - status: "RESET_PASSWORD_INVALID_TOKEN_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + userId?: components["schemas"]["userId"]; + email?: components["schemas"]["email"]; + } + | { + /** @enum {string} */ + status: "RESET_PASSWORD_INVALID_TOKEN_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -5294,17 +5378,19 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example true */ - createdNewUser?: boolean; - user?: components["schemas"]["authRecipeUser"]; - recipeUserId?: components["schemas"]["userId"]; - } | { - /** @enum {string} */ - status: "EMAIL_CHANGE_NOT_ALLOWED_ERROR"; - reason?: string; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example true */ + createdNewUser?: boolean; + user?: components["schemas"]["authRecipeUser"]; + recipeUserId?: components["schemas"]["userId"]; + } + | { + /** @enum {string} */ + status: "EMAIL_CHANGE_NOT_ALLOWED_ERROR"; + reason?: string; + }; }; }; 400: components["responses"]["400"]; @@ -5344,13 +5430,15 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - user?: components["schemas"]["authRecipeUser"]; - } | { - /** @enum {string} */ - status: "UNKNOWN_USER_ID_ERROR" | "UNKNOWN_THIRD_PARTY_USER_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status: "UNKNOWN_USER_ID_ERROR" | "UNKNOWN_THIRD_PARTY_USER_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -5427,13 +5515,15 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - token?: components["schemas"]["token"]; - } | { - /** @enum {string} */ - status: "EMAIL_ALREADY_VERIFIED_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + token?: components["schemas"]["token"]; + } + | { + /** @enum {string} */ + status: "EMAIL_ALREADY_VERIFIED_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -5516,14 +5606,16 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - userId?: components["schemas"]["userId"]; - email?: components["schemas"]["email"]; - } | { - /** @enum {string} */ - status: "EMAIL_VERIFICATION_INVALID_TOKEN_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + userId?: components["schemas"]["userId"]; + email?: components["schemas"]["email"]; + } + | { + /** @enum {string} */ + status: "EMAIL_VERIFICATION_INVALID_TOKEN_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -5770,11 +5862,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example true */ - didUserAlreadyHaveRole?: boolean; - } | components["schemas"]["unknownRoleResponse"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example true */ + didUserAlreadyHaveRole?: boolean; + } + | components["schemas"]["unknownRoleResponse"]; }; }; 400: components["responses"]["400"]; @@ -5815,11 +5909,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example true */ - didUserHaveRole?: boolean; - } | components["schemas"]["unknownRoleResponse"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example true */ + didUserHaveRole?: boolean; + } + | components["schemas"]["unknownRoleResponse"]; }; }; 400: components["responses"]["400"]; @@ -5894,10 +5990,12 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - users?: components["schemas"]["userId"][]; - } | components["schemas"]["unknownRoleResponse"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + users?: components["schemas"]["userId"][]; + } + | components["schemas"]["unknownRoleResponse"]; }; }; 400: components["responses"]["400"]; @@ -5978,10 +6076,12 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - permissions?: string[]; - } | components["schemas"]["unknownRoleResponse"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + permissions?: string[]; + } + | components["schemas"]["unknownRoleResponse"]; }; }; 400: components["responses"]["400"]; @@ -6022,9 +6122,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - } | components["schemas"]["unknownRoleResponse"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + } + | components["schemas"]["unknownRoleResponse"]; }; }; 400: components["responses"]["400"]; @@ -6234,17 +6336,19 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - userDataInDatabase?: components["schemas"]["userDataInDatabase"]; - userDataInJWT?: components["schemas"]["userDataInJWT"]; - userId?: components["schemas"]["userId"]; - expiry?: components["schemas"]["expiry"]; - timeCreated?: components["schemas"]["timeCreated"]; - sessionHandle?: components["schemas"]["handle"]; - tenantId?: components["schemas"]["tenantId"]; - recipeUserId?: components["schemas"]["userId"]; - } | components["schemas"]["unauthorisedMessageResponse"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + userDataInDatabase?: components["schemas"]["userDataInDatabase"]; + userDataInJWT?: components["schemas"]["userDataInJWT"]; + userId?: components["schemas"]["userId"]; + expiry?: components["schemas"]["expiry"]; + timeCreated?: components["schemas"]["timeCreated"]; + sessionHandle?: components["schemas"]["handle"]; + tenantId?: components["schemas"]["tenantId"]; + recipeUserId?: components["schemas"]["userId"]; + } + | components["schemas"]["unauthorisedMessageResponse"]; }; }; 400: components["responses"]["400"]; @@ -6272,12 +6376,14 @@ export interface operations { }; requestBody?: { content: { - "application/json": { - sessionHandles?: components["schemas"]["sessionHandles"]; - } | { - userId: components["schemas"]["userId"]; - revokeAcrossAllTenants?: boolean; - }; + "application/json": + | { + sessionHandles?: components["schemas"]["sessionHandles"]; + } + | { + userId: components["schemas"]["userId"]; + revokeAcrossAllTenants?: boolean; + }; }; }; responses: { @@ -6318,12 +6424,14 @@ export interface operations { }; requestBody?: { content: { - "application/json": { - sessionHandles?: components["schemas"]["sessionHandles"]; - } | { - userId: components["schemas"]["userId"]; - revokeAcrossAllTenants?: boolean; - }; + "application/json": + | { + sessionHandles?: components["schemas"]["sessionHandles"]; + } + | { + userId: components["schemas"]["userId"]; + revokeAcrossAllTenants?: boolean; + }; }; }; responses: { @@ -6385,14 +6493,17 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - session?: components["schemas"]["session"]; - accessToken?: components["schemas"]["cookieInfo"]; - } | components["schemas"]["unauthorisedMessageResponse"] | { - status: components["schemas"]["tryRefreshTokenResponse"]; - message?: components["schemas"]["message"]; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + session?: components["schemas"]["session"]; + accessToken?: components["schemas"]["cookieInfo"]; + } + | components["schemas"]["unauthorisedMessageResponse"] + | { + status: components["schemas"]["tryRefreshTokenResponse"]; + message?: components["schemas"]["message"]; + }; }; }; 400: components["responses"]["400"]; @@ -6435,20 +6546,23 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - session?: components["schemas"]["session"]; - accessToken?: components["schemas"]["cookieInfo"]; - refreshToken?: components["schemas"]["cookieInfo"]; - antiCsrfToken?: components["schemas"]["token"]; - } | { - status: components["schemas"]["tokenTheftResponse"]; - session?: { - handle: components["schemas"]["handle"]; - userId: components["schemas"]["userId"]; - recipeUserId: components["schemas"]["userId"]; - }; - } | components["schemas"]["unauthorisedMessageResponse"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + session?: components["schemas"]["session"]; + accessToken?: components["schemas"]["cookieInfo"]; + refreshToken?: components["schemas"]["cookieInfo"]; + antiCsrfToken?: components["schemas"]["token"]; + } + | { + status: components["schemas"]["tokenTheftResponse"]; + session?: { + handle: components["schemas"]["handle"]; + userId: components["schemas"]["userId"]; + recipeUserId: components["schemas"]["userId"]; + }; + } + | components["schemas"]["unauthorisedMessageResponse"]; }; }; 400: components["responses"]["400"]; @@ -6569,11 +6683,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - session?: components["schemas"]["session"]; - accessToken?: components["schemas"]["cookieInfo"]; - } | components["schemas"]["unauthorisedMessageResponse"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + session?: components["schemas"]["session"]; + accessToken?: components["schemas"]["cookieInfo"]; + } + | components["schemas"]["unauthorisedMessageResponse"]; }; }; 400: components["responses"]["400"]; @@ -6610,10 +6726,12 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - userDataInDatabase?: components["schemas"]["userDataInDatabase"]; - } | components["schemas"]["unauthorisedMessageResponse"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + userDataInDatabase?: components["schemas"]["userDataInDatabase"]; + } + | components["schemas"]["unauthorisedMessageResponse"]; }; }; 400: components["responses"]["400"]; @@ -6654,7 +6772,9 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": components["schemas"]["statusOKResponse"] | components["schemas"]["unauthorisedMessageResponse"]; + "application/json": + | components["schemas"]["statusOKResponse"] + | components["schemas"]["unauthorisedMessageResponse"]; }; }; 400: components["responses"]["400"]; @@ -6702,14 +6822,16 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c */ - jwt?: string; - } | { - /** @enum {string} */ - status: "UNSUPPORTED_ALGORITHM_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c */ + jwt?: string; + } + | { + /** @enum {string} */ + status: "UNSUPPORTED_ALGORITHM_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -6745,10 +6867,12 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - userDataInJWT?: components["schemas"]["userDataInJWT"]; - } | components["schemas"]["unauthorisedMessageResponse"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + userDataInJWT?: components["schemas"]["userDataInJWT"]; + } + | components["schemas"]["unauthorisedMessageResponse"]; }; }; 400: components["responses"]["400"]; @@ -6789,7 +6913,9 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": components["schemas"]["statusOKResponse"] | components["schemas"]["unauthorisedMessageResponse"]; + "application/json": + | components["schemas"]["statusOKResponse"] + | components["schemas"]["unauthorisedMessageResponse"]; }; }; 400: components["responses"]["400"]; @@ -6817,21 +6943,23 @@ export interface operations { }; requestBody?: { content: { - "application/json": { - /** @example test@example.com */ - email?: string; - /** @example password@123 */ - newPassword?: string; - /** @example test2@example.com */ - newEmail?: string; - } | { - /** @example ue21r-fw32r3-d121-d1 */ - userId?: string; - /** @example password@123 */ - newPassword?: string; - /** @example test2@example.com */ - newEmail?: string; - }; + "application/json": + | { + /** @example test@example.com */ + email?: string; + /** @example password@123 */ + newPassword?: string; + /** @example test2@example.com */ + newEmail?: string; + } + | { + /** @example ue21r-fw32r3-d121-d1 */ + userId?: string; + /** @example password@123 */ + newPassword?: string; + /** @example test2@example.com */ + newEmail?: string; + }; }; }; responses: { @@ -6841,32 +6969,37 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - /** @enum {string} */ - status: "OK"; - user?: { - /** @example r23r-f235th54-g3413gf-r32dr2 */ - userId?: string; - /** @example test@example.com */ - email?: string; - /** @example 391238234792 */ - timeCreated?: number; - }; - } | { - /** @enum {string} */ - status: "EMAIL_ALREADY_EXISTS_ERROR"; - } | { - /** @enum {string} */ - status: "PASSWORD_WEAK_ERROR"; - /** @example Your password must have at least 8 characters */ - message?: string; - } | { - /** @enum {string} */ - status: "INVALID_EMAIL_ERROR"; - } | { - /** @enum {string} */ - status: "UNKNOWN_USER_ERROR"; - }; + "application/json": + | { + /** @enum {string} */ + status: "OK"; + user?: { + /** @example r23r-f235th54-g3413gf-r32dr2 */ + userId?: string; + /** @example test@example.com */ + email?: string; + /** @example 391238234792 */ + timeCreated?: number; + }; + } + | { + /** @enum {string} */ + status: "EMAIL_ALREADY_EXISTS_ERROR"; + } + | { + /** @enum {string} */ + status: "PASSWORD_WEAK_ERROR"; + /** @example Your password must have at least 8 characters */ + message?: string; + } + | { + /** @enum {string} */ + status: "INVALID_EMAIL_ERROR"; + } + | { + /** @enum {string} */ + status: "UNKNOWN_USER_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -6909,29 +7042,33 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - /** @enum {string} */ - status: "OK"; - user?: { - /** @example example-userid */ - userId?: string; - /** @example test@example.com */ - email?: string; - /** @example 1231321231 */ - timeCreated?: number; - }; - } | { - /** @enum {string} */ - status: "EMAIL_ALREADY_EXISTS_ERROR"; - } | { - /** @enum {string} */ - status: "PASSWORD_WEAK_ERROR"; - /** @example Your password must have at least 8 characters */ - message?: string; - } | { - /** @enum {string} */ - status: "INVALID_EMAIL_ERROR"; - }; + "application/json": + | { + /** @enum {string} */ + status: "OK"; + user?: { + /** @example example-userid */ + userId?: string; + /** @example test@example.com */ + email?: string; + /** @example 1231321231 */ + timeCreated?: number; + }; + } + | { + /** @enum {string} */ + status: "EMAIL_ALREADY_EXISTS_ERROR"; + } + | { + /** @enum {string} */ + status: "PASSWORD_WEAK_ERROR"; + /** @example Your password must have at least 8 characters */ + message?: string; + } + | { + /** @enum {string} */ + status: "INVALID_EMAIL_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -7073,19 +7210,22 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - /** @enum {string} */ - status: "OK"; - email?: string; - } | { - /** @enum {string} */ - status: "USER_SUSPENDED_ERROR"; - /** @example You have crossed the free dashboard user limit. Please purchase the dashboard feature or login with a valid user account */ - message?: string; - } | { - /** @enum {string} */ - status: "INVAlID_SESSION_ERROR"; - }; + "application/json": + | { + /** @enum {string} */ + status: "OK"; + email?: string; + } + | { + /** @enum {string} */ + status: "USER_SUSPENDED_ERROR"; + /** @example You have crossed the free dashboard user limit. Please purchase the dashboard feature or login with a valid user account */ + message?: string; + } + | { + /** @enum {string} */ + status: "INVAlID_SESSION_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -7166,20 +7306,23 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - /** @enum {string} */ - status: "OK"; - /** @example null */ - sessionId?: string; - } | { - /** @enum {string} */ - status: "USER_SUSPENDED_ERROR"; - /** @example You have crossed the free dashboard user limit. Please purchase the dashboard feature or login with a valid user account */ - message?: string; - } | { - /** @enum {string} */ - status: "INVAlID_CREDENTIALS_ERROR"; - }; + "application/json": + | { + /** @enum {string} */ + status: "OK"; + /** @example null */ + sessionId?: string; + } + | { + /** @enum {string} */ + status: "USER_SUSPENDED_ERROR"; + /** @example You have crossed the free dashboard user limit. Please purchase the dashboard feature or login with a valid user account */ + message?: string; + } + | { + /** @enum {string} */ + status: "INVAlID_CREDENTIALS_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -7291,14 +7434,16 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example /usr/lib/supertokens/config.yaml */ - path?: string; - } | { - /** @enum {string} */ - status: "NOT_ALLOWED"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example /usr/lib/supertokens/config.yaml */ + path?: string; + } + | { + /** @enum {string} */ + status: "NOT_ALLOWED"; + }; }; }; 400: components["responses"]["400"]; @@ -7395,15 +7540,17 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - /** @enum {boolean} */ - exists: true; - /** @example 99c87c72-1807-22d-9b39-7a88f95re56c */ - telemetryId: string; - } | { - /** @enum {boolean} */ - exists: false; - }; + "application/json": + | { + /** @enum {boolean} */ + exists: true; + /** @example 99c87c72-1807-22d-9b39-7a88f95re56c */ + telemetryId: string; + } + | { + /** @enum {boolean} */ + exists: false; + }; }; }; 400: components["responses"]["400"]; @@ -7680,14 +7827,16 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example eyJhbGciOiJIUzI1NiIsIn... */ - licenseKey?: string; - } | { - /** @enum {string} */ - status: "NO_LICENSE_KEY_FOUND_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example eyJhbGciOiJIUzI1NiIsIn... */ + licenseKey?: string; + } + | { + /** @enum {string} */ + status: "NO_LICENSE_KEY_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -7725,15 +7874,18 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - } | { - /** @enum {string} */ - status: "MISSING_EE_FOLDER_ERROR"; - } | { - /** @enum {string} */ - status: "INVALID_LICENSE_KEY_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + } + | { + /** @enum {string} */ + status: "MISSING_EE_FOLDER_ERROR"; + } + | { + /** @enum {string} */ + status: "INVALID_LICENSE_KEY_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -7799,13 +7951,15 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - user?: components["schemas"]["authRecipeUser"]; - } | { - /** @enum {string} */ - status: "UNKNOWN_USER_ID_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status: "UNKNOWN_USER_ID_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -8448,12 +8602,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": ({ - status: components["schemas"]["statusOK"]; - } & components["schemas"]["tenantConfig"]) | { - /** @enum {string} */ - status: "TENANT_NOT_FOUND_ERROR"; - }; + "application/json": + | ({ + status: components["schemas"]["statusOK"]; + } & components["schemas"]["tenantConfig"]) + | { + /** @enum {string} */ + status: "TENANT_NOT_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -8488,12 +8644,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": ({ - status: components["schemas"]["statusOK"]; - } & components["schemas"]["tenantConfigV2"]) | { - /** @enum {string} */ - status: "TENANT_NOT_FOUND_ERROR"; - }; + "application/json": + | ({ + status: components["schemas"]["statusOK"]; + } & components["schemas"]["tenantConfigV2"]) + | { + /** @enum {string} */ + status: "TENANT_NOT_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -8802,17 +8960,24 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - wasAlreadyAssociated: boolean; - } | { - /** @enum {string} */ - status: "UNKNOWN_USER_ID_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR" | "PHONE_NUMBER_ALREADY_EXISTS_ERROR" | "THIRD_PARTY_USER_ALREADY_EXISTS_ERROR"; - } | { - /** @enum {string} */ - status: "ASSOCIATION_NOT_ALLOWED_ERROR"; - reason?: string; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + wasAlreadyAssociated: boolean; + } + | { + /** @enum {string} */ + status: + | "UNKNOWN_USER_ID_ERROR" + | "EMAIL_ALREADY_EXISTS_ERROR" + | "PHONE_NUMBER_ALREADY_EXISTS_ERROR" + | "THIRD_PARTY_USER_ALREADY_EXISTS_ERROR"; + } + | { + /** @enum {string} */ + status: "ASSOCIATION_NOT_ALLOWED_ERROR"; + reason?: string; + }; }; }; 400: components["responses"]["400"]; @@ -8894,12 +9059,15 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": ({ - status: components["schemas"]["statusOK"]; - } & components["schemas"]["oauthClient"]) | components["schemas"]["oauthError"] | { - /** @enum {string} */ - status: "CLIENT_NOT_FOUND_ERROR"; - }; + "application/json": + | ({ + status: components["schemas"]["statusOK"]; + } & components["schemas"]["oauthClient"]) + | components["schemas"]["oauthError"] + | { + /** @enum {string} */ + status: "CLIENT_NOT_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -8938,9 +9106,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": ({ - status: components["schemas"]["statusOK"]; - } & components["schemas"]["oauthClient"]) | components["schemas"]["oauthError"]; + "application/json": + | ({ + status: components["schemas"]["statusOK"]; + } & components["schemas"]["oauthClient"]) + | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -8979,9 +9149,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": ({ - status: components["schemas"]["statusOK"]; - } & components["schemas"]["oauthClient"]) | components["schemas"]["oauthError"]; + "application/json": + | ({ + status: components["schemas"]["statusOK"]; + } & components["schemas"]["oauthClient"]) + | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9020,11 +9192,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - clients?: components["schemas"]["oauthClient"][]; - nextPaginationToken?: string; - } | components["schemas"]["oauthError"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + clients?: components["schemas"]["oauthClient"][]; + nextPaginationToken?: string; + } + | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9066,11 +9240,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example true */ - didExist?: boolean; - } | components["schemas"]["oauthError"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example true */ + didExist?: boolean; + } + | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9322,30 +9498,32 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - challenge?: string; - client?: components["schemas"]["oauthClient"]; - requestUrl: string; - requestedAccessTokenAudience?: string[]; - requestedScope?: string[]; - sessionId?: string; - skip?: boolean; - subject?: string; - oidcContext?: { - acrValues?: string[]; - display?: string; - idTokenHintClaims?: Record; - loginHint?: string; - uiLocales?: string[]; - requestUrl?: string; - requestedAccessTokenAudience?: string[]; - requestedScope?: string[]; - sessionId?: string; - skip?: boolean; - subject?: string; - }; - } | components["schemas"]["oauthError"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + challenge?: string; + client?: components["schemas"]["oauthClient"]; + requestUrl: string; + requestedAccessTokenAudience?: string[]; + requestedScope?: string[]; + sessionId?: string; + skip?: boolean; + subject?: string; + oidcContext?: { + acrValues?: string[]; + display?: string; + idTokenHintClaims?: Record; + loginHint?: string; + uiLocales?: string[]; + requestUrl?: string; + requestedAccessTokenAudience?: string[]; + requestedScope?: string[]; + sessionId?: string; + skip?: boolean; + subject?: string; + }; + } + | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9496,11 +9674,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example {apiDomain}/oauth/logout?... */ - redirectTo?: string; - } | components["schemas"]["oauthError"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example {apiDomain}/oauth/logout?... */ + redirectTo?: string; + } + | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9541,9 +9721,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - } | components["schemas"]["oauthError"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + } + | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9584,11 +9766,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example true */ - didExist?: boolean; - } | components["schemas"]["oauthError"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example true */ + didExist?: boolean; + } + | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9629,11 +9813,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example true */ - didExist?: boolean; - } | components["schemas"]["oauthError"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example true */ + didExist?: boolean; + } + | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9675,11 +9861,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example true */ - didExist?: boolean; - } | components["schemas"]["oauthError"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example true */ + didExist?: boolean; + } + | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9714,9 +9902,11 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": ({ - status: components["schemas"]["statusOK"]; - } & components["schemas"]["oauthClient"]) | components["schemas"]["oauthError"]; + "application/json": + | ({ + status: components["schemas"]["statusOK"]; + } & components["schemas"]["oauthClient"]) + | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9753,14 +9943,17 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - redirectTo: string; - cookies: string[]; - } | components["schemas"]["oauthError"] | { - /** @enum {string} */ - status: "CLIENT_NOT_FOUND_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + redirectTo: string; + cookies: string[]; + } + | components["schemas"]["oauthError"] + | { + /** @enum {string} */ + status: "CLIENT_NOT_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -9808,24 +10001,27 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example eyJraWQiOiJzLTBjZmVmMDdkLWQ2NDktNGIwOC04MTVjLWJkYjZlYTczNWQyZCIsInR5cCI6IkpXVCIsImFsZyI6IlJTMjU2In0.eyJpYXQiOjE3NDAzODU5MzcsImV4cCI6MTc0MDM4OTUzOCwiY2xpZW50X2lkIjoic3RjbF82NWUwODc1Mi0yYzU5LTQ5NjQtOTM0Yy02OTIwZDJmMDZlNjIiLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjMwMDEvYXV0aCIsImp0aSI6Ijc1NTc2MmFmLTUwYTUtNDc1ZS04YWRkLTg3MDA1ZmU3YWJlNiIsIm5iZiI6MTc0MDM4NTkzNywic2NwIjpbIm9wZW5pZCIsIm9mZmxpbmVfYWNjZXNzIl0sInN1YiI6InNvbWV1c2VyaWQiLCJzdHQiOjEsImdpZCI6ImRjOGQ0OGUzLTcwOTgtNDhhNi1hYjU0LTgxMWMyODQ4N2I4MiIsInRJZCI6InB1YmxpYyIsInJzdWIiOiJzb21ldXNlcmlkIiwic2Vzc2lvbkhhbmRsZSI6InNlc3Npb24taGFuZGxlIn0.DgVgtD2gXgzHrDsC2lIUBa-wsYm8KO4Pg8L1Ov3aSBVgjwtjiCO40ldjBZ9qKdQBq5Qqk0ElAZNj6Bzc40ESfQumLH3_N2XtOj568s71JPuEOIg5hs9XAdK4vYfXMhVQRWn9iPUKHKrpRVf73IIH0mpkN8i6_MhcDoMMOuG5XPlXajG9VOyoY_5saHA61-uTafZLdAgKqnmYGvS8KmNEcEbBWLGwFB4QQKiDAUvatIi5n3juFBUxyt9t6DrqT1D04shesRppa0XhCZbCFBv1dixSrprdtqKhlPOrMgvOGNZ3cBLbYBOG9zoJRD5YlVMGw-j_pE7IbvpDWKL7tTJS1Q */ - access_token: string; - /** @example 3599 */ - expires_in?: number; - /** @example eyJraWQiOiJzLTBjZmVmMDdkLWQ2NDktNGIwOC04MTVjLWJkYjZlYTczNWQyZCIsInR5cCI6IkpXVCIsImFsZyI6IlJTMjU2In0.eyJpYXQiOjE3NDAzODU5MzgsImV4cCI6MTc0MDM4OTUzOCwiYXRfaGFzaCI6IkNxOGNCSk01Nm5FcG9aaWREcnZvLVEiLCJhdWQiOiJzdGNsXzY1ZTA4NzUyLTJjNTktNDk2NC05MzRjLTY5MjBkMmYwNmU2MiIsImF1dGhfdGltZSI6MTc0MDM4NTkzNywiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDozMDAxL2F1dGgiLCJqdGkiOiIxZDA5OGUxZi04ZGIxLTQyNzUtYmMzYS0zYTA4NjdjOWE2NTAiLCJyYXQiOjE3NDAzODU3MzEsInNpZCI6InNlc3Npb24taGFuZGxlIiwic3ViIjoic29tZXVzZXJpZCIsInN0dCI6MiwiZ2lkIjoiYzk1OTVjYjItMWFjOS00MDI0LWFjNjMtNDJlZDEyODliY2RmIn0.PGsemf1qpLF-cE_616NHvKsRmanFiyba0yqF2j5fy87AWD5McI405A4eqi-wAlKsDxC-MPpuW8bx-08YUhs3x6ku4aFaDyA-M-Xhc65fJJ4SCPVaUL7qlUwl7wJwNs2rMRW3Ayyj4MDSlW5uqm39_K_bBqod2Qj1yqck-N0g78qh86uEcyX6Al3d5KSln1B21nwDsEgegk3xzE8lFMCQUTpZEYb5-1v2D0Bu_PblBfOCjA6mBtT1IIQkmSE27FvkTUS1H50EUyhFP4JH30kP3bUnQ9pOqGMTe405N2ruKtPyWsXHLPlQ4hcJCLO5GT5ZgtUjfz6Y3mCM9l69uDYDHg */ - id_token?: string; - /** @example st_rt_d7LI9mGYHF2TAaVEFJi7fqOWo8ZQ8zEGpuxhHQs0R18.UZ0nbTuuYuDD8G54PCD8AKHdsh9cezu8BTxVlTy7pYw */ - refresh_token?: string; - /** @example openid offline_access */ - scope?: string; - /** @example bearer */ - token_type?: string; - } | components["schemas"]["oauthError"] | { - /** @enum {string} */ - status: "CLIENT_NOT_FOUND_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example eyJraWQiOiJzLTBjZmVmMDdkLWQ2NDktNGIwOC04MTVjLWJkYjZlYTczNWQyZCIsInR5cCI6IkpXVCIsImFsZyI6IlJTMjU2In0.eyJpYXQiOjE3NDAzODU5MzcsImV4cCI6MTc0MDM4OTUzOCwiY2xpZW50X2lkIjoic3RjbF82NWUwODc1Mi0yYzU5LTQ5NjQtOTM0Yy02OTIwZDJmMDZlNjIiLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjMwMDEvYXV0aCIsImp0aSI6Ijc1NTc2MmFmLTUwYTUtNDc1ZS04YWRkLTg3MDA1ZmU3YWJlNiIsIm5iZiI6MTc0MDM4NTkzNywic2NwIjpbIm9wZW5pZCIsIm9mZmxpbmVfYWNjZXNzIl0sInN1YiI6InNvbWV1c2VyaWQiLCJzdHQiOjEsImdpZCI6ImRjOGQ0OGUzLTcwOTgtNDhhNi1hYjU0LTgxMWMyODQ4N2I4MiIsInRJZCI6InB1YmxpYyIsInJzdWIiOiJzb21ldXNlcmlkIiwic2Vzc2lvbkhhbmRsZSI6InNlc3Npb24taGFuZGxlIn0.DgVgtD2gXgzHrDsC2lIUBa-wsYm8KO4Pg8L1Ov3aSBVgjwtjiCO40ldjBZ9qKdQBq5Qqk0ElAZNj6Bzc40ESfQumLH3_N2XtOj568s71JPuEOIg5hs9XAdK4vYfXMhVQRWn9iPUKHKrpRVf73IIH0mpkN8i6_MhcDoMMOuG5XPlXajG9VOyoY_5saHA61-uTafZLdAgKqnmYGvS8KmNEcEbBWLGwFB4QQKiDAUvatIi5n3juFBUxyt9t6DrqT1D04shesRppa0XhCZbCFBv1dixSrprdtqKhlPOrMgvOGNZ3cBLbYBOG9zoJRD5YlVMGw-j_pE7IbvpDWKL7tTJS1Q */ + access_token: string; + /** @example 3599 */ + expires_in?: number; + /** @example eyJraWQiOiJzLTBjZmVmMDdkLWQ2NDktNGIwOC04MTVjLWJkYjZlYTczNWQyZCIsInR5cCI6IkpXVCIsImFsZyI6IlJTMjU2In0.eyJpYXQiOjE3NDAzODU5MzgsImV4cCI6MTc0MDM4OTUzOCwiYXRfaGFzaCI6IkNxOGNCSk01Nm5FcG9aaWREcnZvLVEiLCJhdWQiOiJzdGNsXzY1ZTA4NzUyLTJjNTktNDk2NC05MzRjLTY5MjBkMmYwNmU2MiIsImF1dGhfdGltZSI6MTc0MDM4NTkzNywiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDozMDAxL2F1dGgiLCJqdGkiOiIxZDA5OGUxZi04ZGIxLTQyNzUtYmMzYS0zYTA4NjdjOWE2NTAiLCJyYXQiOjE3NDAzODU3MzEsInNpZCI6InNlc3Npb24taGFuZGxlIiwic3ViIjoic29tZXVzZXJpZCIsInN0dCI6MiwiZ2lkIjoiYzk1OTVjYjItMWFjOS00MDI0LWFjNjMtNDJlZDEyODliY2RmIn0.PGsemf1qpLF-cE_616NHvKsRmanFiyba0yqF2j5fy87AWD5McI405A4eqi-wAlKsDxC-MPpuW8bx-08YUhs3x6ku4aFaDyA-M-Xhc65fJJ4SCPVaUL7qlUwl7wJwNs2rMRW3Ayyj4MDSlW5uqm39_K_bBqod2Qj1yqck-N0g78qh86uEcyX6Al3d5KSln1B21nwDsEgegk3xzE8lFMCQUTpZEYb5-1v2D0Bu_PblBfOCjA6mBtT1IIQkmSE27FvkTUS1H50EUyhFP4JH30kP3bUnQ9pOqGMTe405N2ruKtPyWsXHLPlQ4hcJCLO5GT5ZgtUjfz6Y3mCM9l69uDYDHg */ + id_token?: string; + /** @example st_rt_d7LI9mGYHF2TAaVEFJi7fqOWo8ZQ8zEGpuxhHQs0R18.UZ0nbTuuYuDD8G54PCD8AKHdsh9cezu8BTxVlTy7pYw */ + refresh_token?: string; + /** @example openid offline_access */ + scope?: string; + /** @example bearer */ + token_type?: string; + } + | components["schemas"]["oauthError"] + | { + /** @enum {string} */ + status: "CLIENT_NOT_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -9865,11 +10061,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example {apiDomain}/oauth/logout?... */ - redirectTo?: string; - } | components["schemas"]["oauthError"]; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example {apiDomain}/oauth/logout?... */ + redirectTo?: string; + } + | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -10134,20 +10332,22 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example ea7a0931-b533-4478-9253-0fde890ca23 */ - webauthnCredentialId?: string; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - recipeUserId?: string; - /** @example example.com */ - relyingPartyId?: string; - /** @example 1741793746 */ - createdAt?: number; - } | { - /** @enum {string} */ - status: "CREDENTIAL_NOT_FOUND_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example ea7a0931-b533-4478-9253-0fde890ca23 */ + webauthnCredentialId?: string; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId?: string; + /** @example example.com */ + relyingPartyId?: string; + /** @example 1741793746 */ + createdAt?: number; + } + | { + /** @enum {string} */ + status: "CREDENTIAL_NOT_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10292,15 +10492,17 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - recipeUserId?: string; - user?: components["schemas"]["authRecipeUser"]; - } | { - /** @enum {string} */ - status: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId?: string; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10358,56 +10560,58 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - webauthnGeneratedOptionsId?: string; - rp?: { - /** @example example.com */ - id?: string; - /** @example Example */ - name?: string; - }; - user?: { - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - id?: string; - /** @example John Doe */ - name?: string; - /** @example John Doe */ - displayName?: string; - }; - email?: components["schemas"]["email"]; - /** @example TQvEVDV8B64w_2zIifzKaPzBPfthqpx2uJkq_2PIB0k */ - challenge?: string; - /** @example 10000 */ - timeout?: number; - /** @example none */ - attestation?: string; - /** @example 1741793746 */ - createdAt?: number; - /** @example 1741793746 */ - expiresAt?: number; - pubKeyCredParams?: { - /** @example public-key */ - type?: string; - /** @example -7 */ - alg?: number; - }[]; - excludeCredentials?: { - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - id?: string; - transport?: string[]; - }[]; - authenticatorSelection?: { - userVerification?: components["schemas"]["userVerification"]; - /** @example true */ - requireResidentKey?: boolean; - }; - } | { - /** @enum {string} */ - status: "INVALID_OPTIONS_ERROR"; - reason?: string; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + webauthnGeneratedOptionsId?: string; + rp?: { + /** @example example.com */ + id?: string; + /** @example Example */ + name?: string; + }; + user?: { + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + id?: string; + /** @example John Doe */ + name?: string; + /** @example John Doe */ + displayName?: string; + }; + email?: components["schemas"]["email"]; + /** @example TQvEVDV8B64w_2zIifzKaPzBPfthqpx2uJkq_2PIB0k */ + challenge?: string; + /** @example 10000 */ + timeout?: number; + /** @example none */ + attestation?: string; + /** @example 1741793746 */ + createdAt?: number; + /** @example 1741793746 */ + expiresAt?: number; + pubKeyCredParams?: { + /** @example public-key */ + type?: string; + /** @example -7 */ + alg?: number; + }[]; + excludeCredentials?: { + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + id?: string; + transport?: string[]; + }[]; + authenticatorSelection?: { + userVerification?: components["schemas"]["userVerification"]; + /** @example true */ + requireResidentKey?: boolean; + }; + } + | { + /** @enum {string} */ + status: "INVALID_OPTIONS_ERROR"; + reason?: string; + }; }; }; 400: components["responses"]["400"]; @@ -10457,28 +10661,30 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - webauthnGeneratedOptionsId?: string; - /** @example example.com */ - relyingPartyId?: string; - /** @example TQvEVDV8B64w_2zIifzKaPzBPfthqpx2uJkq_2PIB0k */ - challenge?: string; - /** @example 10000 */ - timeout?: number; - userVerification?: components["schemas"]["userVerification"]; - /** @example true */ - userPresence?: boolean; - /** @example 1741793746 */ - createdAt?: string; - /** @example 1741793746 */ - expiresAt?: string; - } | { - /** @enum {string} */ - status: "INVALID_OPTIONS_ERROR"; - reason?: string; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + webauthnGeneratedOptionsId?: string; + /** @example example.com */ + relyingPartyId?: string; + /** @example TQvEVDV8B64w_2zIifzKaPzBPfthqpx2uJkq_2PIB0k */ + challenge?: string; + /** @example 10000 */ + timeout?: number; + userVerification?: components["schemas"]["userVerification"]; + /** @example true */ + userPresence?: boolean; + /** @example 1741793746 */ + createdAt?: string; + /** @example 1741793746 */ + expiresAt?: string; + } + | { + /** @enum {string} */ + status: "INVALID_OPTIONS_ERROR"; + reason?: string; + }; }; }; 400: components["responses"]["400"]; @@ -10522,25 +10728,28 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - webauthnCredentialId?: string; - /** @example example.com */ - relyingPartyId?: string; - /** @example Example */ - relyingPartyName?: string; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - recipeUserId?: string; - email?: components["schemas"]["email"]; - } | { - /** @enum {string} */ - status: "INVALID_AUTHENTICATOR_ERROR"; - reason?: string; - } | { - /** @enum {string} */ - status: "OPTIONS_NOT_FOUND_ERROR" | "INVALID_CREDENTIALS_ERROR" | "INVALID_OPTIONS_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + webauthnCredentialId?: string; + /** @example example.com */ + relyingPartyId?: string; + /** @example Example */ + relyingPartyName?: string; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId?: string; + email?: components["schemas"]["email"]; + } + | { + /** @enum {string} */ + status: "INVALID_AUTHENTICATOR_ERROR"; + reason?: string; + } + | { + /** @enum {string} */ + status: "OPTIONS_NOT_FOUND_ERROR" | "INVALID_CREDENTIALS_ERROR" | "INVALID_OPTIONS_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10583,25 +10792,31 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - webauthnCredentialId?: string; - /** @example example.com */ - relyingPartyId?: string; - /** @example Example */ - relyingPartyName?: string; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - recipeUserId?: string; - user?: components["schemas"]["authRecipeUser"]; - } | { - /** @enum {string} */ - status: "INVALID_OPTIONS_ERROR" | "INVALID_AUTHENTICATOR_ERROR" | "INVALID_CREDENTIALS_ERROR"; - reason?: string; - } | { - /** @enum {string} */ - status: "OPTIONS_NOT_FOUND_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + webauthnCredentialId?: string; + /** @example example.com */ + relyingPartyId?: string; + /** @example Example */ + relyingPartyName?: string; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId?: string; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status: + | "INVALID_OPTIONS_ERROR" + | "INVALID_AUTHENTICATOR_ERROR" + | "INVALID_CREDENTIALS_ERROR"; + reason?: string; + } + | { + /** @enum {string} */ + status: "OPTIONS_NOT_FOUND_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10644,19 +10859,28 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example fa7a0841-b533-4478-9253-0fde890c576 */ - recipeUserId?: string; - user?: components["schemas"]["authRecipeUser"]; - } | { - /** @enum {string} */ - status: "INVALID_OPTIONS_ERROR" | "INVALID_AUTHENTICATOR_ERROR" | "INVALID_CREDENTIALS_ERROR"; - reason?: string; - } | { - /** @enum {string} */ - status: "OPTIONS_NOT_FOUND_ERROR" | "CREDENTIAL_NOT_FOUND_ERROR" | "UNKNOWN_USER_ID_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example fa7a0841-b533-4478-9253-0fde890c576 */ + recipeUserId?: string; + user?: components["schemas"]["authRecipeUser"]; + } + | { + /** @enum {string} */ + status: + | "INVALID_OPTIONS_ERROR" + | "INVALID_AUTHENTICATOR_ERROR" + | "INVALID_CREDENTIALS_ERROR"; + reason?: string; + } + | { + /** @enum {string} */ + status: + | "OPTIONS_NOT_FOUND_ERROR" + | "CREDENTIAL_NOT_FOUND_ERROR" + | "UNKNOWN_USER_ID_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10697,14 +10921,16 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example ZmE3YTA4NDEtYjUzMy00NDc4LTkyNTMtMGZkZTg5MGM1NzY */ - token?: string; - } | { - /** @enum {string} */ - status: "UNKNOWN_USER_ID_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example ZmE3YTA4NDEtYjUzMy00NDc4LTkyNTMtMGZkZTg5MGM1NzY */ + token?: string; + } + | { + /** @enum {string} */ + status: "UNKNOWN_USER_ID_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10745,14 +10971,16 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - userId?: components["schemas"]["userId"]; - email?: components["schemas"]["email"]; - } | { - /** @enum {string} */ - status: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + userId?: components["schemas"]["userId"]; + email?: components["schemas"]["email"]; + } + | { + /** @enum {string} */ + status: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10793,12 +11021,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - } | { - /** @enum {string} */ - status: "UNKNOWN_USER_ID_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + } + | { + /** @enum {string} */ + status: "UNKNOWN_USER_ID_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10835,12 +11065,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - } | { - /** @enum {string} */ - status: "CREDENTIAL_NOT_FOUND_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + } + | { + /** @enum {string} */ + status: "CREDENTIAL_NOT_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; @@ -10876,12 +11108,14 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - } | { - /** @enum {string} */ - status: "OPTIONS_NOT_FOUND_ERROR"; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + } + | { + /** @enum {string} */ + status: "OPTIONS_NOT_FOUND_ERROR"; + }; }; }; 400: components["responses"]["400"]; diff --git a/lib/ts/customFramework.ts b/lib/ts/customFramework.ts index 36c273d26..e68ad6eaf 100644 --- a/lib/ts/customFramework.ts +++ b/lib/ts/customFramework.ts @@ -130,9 +130,7 @@ export async function getSessionForSSR - ): Promise<{ + static async getSSRSession(cookies: Array<{ name: string; value: string }>): Promise<{ accessTokenPayload: JWTPayload | undefined; hasToken: boolean; error: Error | undefined; diff --git a/lib/ts/querier.ts b/lib/ts/querier.ts index b1f3b18fd..010e0bbb5 100644 --- a/lib/ts/querier.ts +++ b/lib/ts/querier.ts @@ -23,8 +23,8 @@ import { UserContext } from "./types"; import { NetworkInterceptor } from "./types"; import SuperTokens from "./supertokens"; -import { PathParam, RequestBody, ResponseBody } from "../core/types"; -import { paths } from "../core/paths"; +import { PathParam, RequestBody, ResponseBody } from "./core/types"; +import { paths } from "./core/paths"; export class Querier { private static initCalled = false; @@ -46,7 +46,7 @@ export class Querier { // to support multiple rIds per API private constructor( hosts: { domain: NormalisedURLDomain; basePath: NormalisedURLPath }[] | undefined, - rIdToCore?: string, + rIdToCore?: string ) { this.__hosts = hosts; this.rIdToCore = rIdToCore; @@ -89,7 +89,7 @@ export class Querier { headers: headers, params: queryParamsObj, }, - userContext, + userContext ); url = request.url; headers = request.headers; @@ -101,13 +101,13 @@ export class Querier { }); return response; }, - this.__hosts?.length || 0, + this.__hosts?.length || 0 ); let cdiSupportedByServer: string[] = response.versions; let supportedVersion = getLargestVersionFromIntersection(cdiSupportedByServer, cdiSupported); if (supportedVersion === undefined) { throw Error( - "The running SuperTokens core version is not compatible with this NodeJS SDK. Please visit https://supertokens.io/docs/community/compatibility to find the right versions", + "The running SuperTokens core version is not compatible with this NodeJS SDK. Please visit https://supertokens.io/docs/community/compatibility to find the right versions" ); } Querier.apiVersion = supportedVersion; @@ -140,7 +140,7 @@ export class Querier { hosts?: { domain: NormalisedURLDomain; basePath: NormalisedURLPath }[], apiKey?: string, networkInterceptor?: NetworkInterceptor, - disableCache?: boolean, + disableCache?: boolean ) { if (!Querier.initCalled) { logDebugMessage("querier initialized"); @@ -157,7 +157,7 @@ export class Querier { private getPath =

(path: PathParam

): NormalisedURLPath => { const template = typeof path === "string" ? path : path.path; - const params = typeof path === "string" ? {} : (path.params ?? {}); + const params = typeof path === "string" ? {} : path.params ?? {}; let populated = String(template); for (const [key, value] of Object.entries(params)) { @@ -171,7 +171,7 @@ export class Querier { sendPostRequest = async

( template: PathParam

, body: RequestBody, - userContext: UserContext, + userContext: UserContext ): Promise> => { this.invalidateCoreCallCache(userContext); const path = this.getPath(template); @@ -206,7 +206,7 @@ export class Querier { headers: headers, body: body, }, - userContext, + userContext ); url = request.url; headers = request.headers; @@ -220,7 +220,7 @@ export class Querier { headers, }); }, - this.__hosts?.length || 0, + this.__hosts?.length || 0 ); return respBody; }; @@ -230,7 +230,7 @@ export class Querier { template: PathParam

, body: RequestBody, params: any | undefined, - userContext: UserContext, + userContext: UserContext ): Promise> => { this.invalidateCoreCallCache(userContext); const path = this.getPath(template); @@ -262,7 +262,7 @@ export class Querier { params: params, body: body, }, - userContext, + userContext ); url = request.url; headers = request.headers; @@ -284,7 +284,7 @@ export class Querier { headers, }); }, - this.__hosts?.length || 0, + this.__hosts?.length || 0 ); return respBody; }; @@ -293,7 +293,7 @@ export class Querier { sendGetRequest = async

( template: PathParam

, params: Record, - userContext: UserContext, + userContext: UserContext ): Promise> => { const path = this.getPath(template); const { body: respBody } = await this.sendRequestHelper( @@ -357,7 +357,7 @@ export class Querier { headers: headers, params: params, }, - userContext, + userContext ); url = request.url; headers = request.headers; @@ -367,7 +367,7 @@ export class Querier { } const finalURL = new URL(url); const searchParams = new URLSearchParams( - Object.entries(params).filter(([_, value]) => value !== undefined) as string[][], + Object.entries(params).filter(([_, value]) => value !== undefined) as string[][] ); finalURL.search = searchParams.toString(); @@ -396,7 +396,7 @@ export class Querier { return response; }, - this.__hosts?.length || 0, + this.__hosts?.length || 0 ); return respBody; @@ -406,7 +406,7 @@ export class Querier { template: PathParam

, params: Record, inpHeaders: Record | undefined, - userContext: UserContext, + userContext: UserContext ): Promise<{ body: ResponseBody; headers: Headers }> => { const path = this.getPath(template); return await this.sendRequestHelper( @@ -437,7 +437,7 @@ export class Querier { headers: headers, params: params, }, - userContext, + userContext ); url = request.url; headers = request.headers; @@ -447,7 +447,7 @@ export class Querier { } const finalURL = new URL(url); const searchParams = new URLSearchParams( - Object.entries(params).filter(([_, value]) => value !== undefined) as string[][], + Object.entries(params).filter(([_, value]) => value !== undefined) as string[][] ); finalURL.search = searchParams.toString(); return doFetch(finalURL.toString(), { @@ -455,7 +455,7 @@ export class Querier { headers, }); }, - this.__hosts?.length || 0, + this.__hosts?.length || 0 ); }; @@ -464,7 +464,7 @@ export class Querier { template: PathParam

, body: RequestBody, params: Record, - userContext: UserContext, + userContext: UserContext ): Promise> => { this.invalidateCoreCallCache(userContext); const path = this.getPath(template); @@ -496,7 +496,7 @@ export class Querier { body: body, params: params, }, - userContext, + userContext ); url = request.url; headers = request.headers; @@ -507,7 +507,7 @@ export class Querier { const finalURL = new URL(url); const searchParams = new URLSearchParams( - Object.entries(params).filter(([_, value]) => value !== undefined) as string[][], + Object.entries(params).filter(([_, value]) => value !== undefined) as string[][] ); finalURL.search = searchParams.toString(); @@ -517,7 +517,7 @@ export class Querier { headers, }); }, - this.__hosts?.length || 0, + this.__hosts?.length || 0 ); return respBody; }; @@ -526,7 +526,7 @@ export class Querier { sendPatchRequest = async

( template: PathParam

, body: RequestBody, - userContext: UserContext, + userContext: UserContext ): Promise> => { this.invalidateCoreCallCache(userContext); const path = this.getPath(template); @@ -557,7 +557,7 @@ export class Querier { headers: headers, body: body, }, - userContext, + userContext ); url = request.url; headers = request.headers; @@ -572,7 +572,7 @@ export class Querier { headers, }); }, - this.__hosts?.length || 0, + this.__hosts?.length || 0 ); return respBody; }; @@ -609,11 +609,11 @@ export class Querier { method: string, requestFunc: (url: string) => Promise, numberOfTries: number, - retryInfoMap?: Record, + retryInfoMap?: Record ): Promise => { if (this.__hosts === undefined) { throw Error( - "No SuperTokens core available to query. Please pass supertokens > connectionURI to the init function, or override all the functions of the recipe you are using.", + "No SuperTokens core available to query. Please pass supertokens > connectionURI to the init function, or override all the functions of the recipe you are using." ); } if (numberOfTries === 0) { @@ -652,7 +652,7 @@ export class Querier { return { body: await response.clone().text(), headers: response.headers }; } return { body: await response.clone().json(), headers: response.headers }; - } catch (err: any) { + } catch (err) { if ( err.message !== undefined && (err.message.includes("Failed to fetch") || @@ -687,7 +687,7 @@ export class Querier { "' with status code: " + err.status + " and message: " + - (await err.text()), + (await err.text()) ); } diff --git a/lib/ts/recipe/accountlinking/recipe.ts b/lib/ts/recipe/accountlinking/recipe.ts index e03366053..4c20aaa2d 100644 --- a/lib/ts/recipe/accountlinking/recipe.ts +++ b/lib/ts/recipe/accountlinking/recipe.ts @@ -730,17 +730,18 @@ export default class Recipe extends RecipeModule { }); if (shouldVerifyEmail) { - let resp = await EmailVerificationRecipe.getInstanceOrThrowError().recipeInterfaceImpl.createEmailVerificationToken( - { - // While the token we create here is tenant specific, the verification status is not - // So we can use any tenantId the user is associated with here as long as we use the - // same in the verifyEmailUsingToken call - tenantId: input.user.tenantIds[0], - recipeUserId: input.recipeUserId, - email: recipeUserEmail, - userContext: input.userContext, - } - ); + let resp = + await EmailVerificationRecipe.getInstanceOrThrowError().recipeInterfaceImpl.createEmailVerificationToken( + { + // While the token we create here is tenant specific, the verification status is not + // So we can use any tenantId the user is associated with here as long as we use the + // same in the verifyEmailUsingToken call + tenantId: input.user.tenantIds[0], + recipeUserId: input.recipeUserId, + email: recipeUserEmail, + userContext: input.userContext, + } + ); if (resp.status === "OK") { // we purposely pass in false below cause we don't want account // linking to happen diff --git a/lib/ts/recipe/accountlinking/recipeImplementation.ts b/lib/ts/recipe/accountlinking/recipeImplementation.ts index 5f5110146..f233b937a 100644 --- a/lib/ts/recipe/accountlinking/recipeImplementation.ts +++ b/lib/ts/recipe/accountlinking/recipeImplementation.ts @@ -85,16 +85,16 @@ export default function getRecipeImplementation( } ): Promise< | { - status: "OK"; - wasAlreadyAPrimaryUser: boolean; - } + status: "OK"; + wasAlreadyAPrimaryUser: boolean; + } | { - status: - | "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR" - | "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - primaryUserId: string; - description: string; - } + status: + | "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR" + | "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + primaryUserId: string; + description: string; + } > { return await querier.sendGetRequest( "/recipe/accountlinking/user/primary/check", @@ -116,19 +116,19 @@ export default function getRecipeImplementation( } ): Promise< | { - status: "OK"; - user: User; - wasAlreadyAPrimaryUser: boolean; - } + status: "OK"; + user: User; + wasAlreadyAPrimaryUser: boolean; + } | { - status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; - primaryUserId: string; - } + status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_PRIMARY_USER_ID_ERROR"; + primaryUserId: string; + } | { - status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - primaryUserId: string; - description: string; - } + status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + primaryUserId: string; + description: string; + } > { let response = await querier.sendPostRequest( "/recipe/accountlinking/user/primary", @@ -159,25 +159,25 @@ export default function getRecipeImplementation( } ): Promise< | { - status: "OK"; - accountsAlreadyLinked: boolean; - } + status: "OK"; + accountsAlreadyLinked: boolean; + } | { - status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - description: string; - primaryUserId: string; - } + status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + description: string; + primaryUserId: string; + } | { - status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - primaryUserId: string; - description: string; - } + status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + primaryUserId: string; + description: string; + } | { - status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; - } + status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; + } > { let result = await querier.sendGetRequest( - ("/recipe/accountlinking/user/link/check"), + "/recipe/accountlinking/user/link/check", { recipeUserId: recipeUserId.getAsString(), primaryUserId, @@ -201,23 +201,23 @@ export default function getRecipeImplementation( } ): Promise< | { - status: "OK"; - accountsAlreadyLinked: boolean; - user: User; - } + status: "OK"; + accountsAlreadyLinked: boolean; + user: User; + } | { - status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - user: User; - primaryUserId: string; - } + status: "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + user: User; + primaryUserId: string; + } | { - status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; - primaryUserId: string; - description: string; - } + status: "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; + primaryUserId: string; + description: string; + } | { - status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; - } + status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; + } > { const accountsLinkingResult = await querier.sendPostRequest( "/recipe/accountlinking/user/link", @@ -357,7 +357,7 @@ export default function getRecipeImplementation( status: "OK"; }> { return await querier.sendPostRequest( - ("/user/remove"), + "/user/remove", { userId, removeAllLinkedAccounts, diff --git a/lib/ts/recipe/accountlinking/types.ts b/lib/ts/recipe/accountlinking/types.ts index 2e1c07656..6874414d2 100644 --- a/lib/ts/recipe/accountlinking/types.ts +++ b/lib/ts/recipe/accountlinking/types.ts @@ -81,10 +81,7 @@ export type RecipeInterface = { users: User[]; nextPaginationToken?: string; }>; - canCreatePrimaryUser: (input: { - recipeUserId: RecipeUserId; - userContext: UserContext; - }) => Promise< + canCreatePrimaryUser: (input: { recipeUserId: RecipeUserId; userContext: UserContext }) => Promise< | { status: "OK"; wasAlreadyAPrimaryUser: boolean; @@ -97,10 +94,7 @@ export type RecipeInterface = { description: string; } >; - createPrimaryUser: (input: { - recipeUserId: RecipeUserId; - userContext: UserContext; - }) => Promise< + createPrimaryUser: (input: { recipeUserId: RecipeUserId; userContext: UserContext }) => Promise< | { status: "OK"; user: User; @@ -139,11 +133,7 @@ export type RecipeInterface = { status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; } >; - linkAccounts: (input: { - recipeUserId: RecipeUserId; - primaryUserId: string; - userContext: UserContext; - }) => Promise< + linkAccounts: (input: { recipeUserId: RecipeUserId; primaryUserId: string; userContext: UserContext }) => Promise< | { status: "OK"; accountsAlreadyLinked: boolean; @@ -163,10 +153,7 @@ export type RecipeInterface = { status: "INPUT_USER_IS_NOT_A_PRIMARY_USER"; } >; - unlinkAccount: (input: { - recipeUserId: RecipeUserId; - userContext: UserContext; - }) => Promise<{ + unlinkAccount: (input: { recipeUserId: RecipeUserId; userContext: UserContext }) => Promise<{ status: "OK"; wasRecipeUserDeleted: boolean; wasLinked: boolean; diff --git a/lib/ts/recipe/dashboard/api/multitenancy/getThirdPartyConfig.ts b/lib/ts/recipe/dashboard/api/multitenancy/getThirdPartyConfig.ts index 15eb75d9c..c11cdf26c 100644 --- a/lib/ts/recipe/dashboard/api/multitenancy/getThirdPartyConfig.ts +++ b/lib/ts/recipe/dashboard/api/multitenancy/getThirdPartyConfig.ts @@ -214,15 +214,8 @@ export default async function getThirdPartyConfig( client.clientType, userContext ); - const { - clientId, - clientSecret, - clientType, - scope, - additionalConfig, - forcePKCE, - ...commonConfig - } = providerInstance!.config; + const { clientId, clientSecret, clientType, scope, additionalConfig, forcePKCE, ...commonConfig } = + providerInstance!.config; clients.push({ clientId, diff --git a/lib/ts/recipe/emailpassword/api/implementation.ts b/lib/ts/recipe/emailpassword/api/implementation.ts index aef0c6fd0..58da60beb 100644 --- a/lib/ts/recipe/emailpassword/api/implementation.ts +++ b/lib/ts/recipe/emailpassword/api/implementation.ts @@ -53,12 +53,7 @@ export default function getAPIImplementation(): APIInterface { exists: emailPasswordUserExists, }; }, - generatePasswordResetTokenPOST: async function ({ - formFields, - tenantId, - options, - userContext, - }): Promise< + generatePasswordResetTokenPOST: async function ({ formFields, tenantId, options, userContext }): Promise< | { status: "OK"; } @@ -261,8 +256,7 @@ export default function getAPIImplementation(): APIInterface { if (!emailVerified && hasOtherEmailOrPhone) { return { status: "PASSWORD_RESET_NOT_ALLOWED", - reason: - "Reset password link was not created because of account take over risk. Please contact support. (ERR_CODE_001)", + reason: "Reset password link was not created because of account take over risk. Please contact support. (ERR_CODE_001)", }; } @@ -288,18 +282,19 @@ export default function getAPIImplementation(): APIInterface { // is verified, and if not, we need to make sure that there is no other email / phone number // associated with the primary user account. If there is, then we do not proceed. - let shouldDoAccountLinkingResponse = await AccountLinking.getInstance().config.shouldDoAutomaticAccountLinking( - emailPasswordAccount !== undefined - ? emailPasswordAccount - : { - recipeId: "emailpassword", - email, - }, - linkingCandidate, - undefined, - tenantId, - userContext - ); + let shouldDoAccountLinkingResponse = + await AccountLinking.getInstance().config.shouldDoAutomaticAccountLinking( + emailPasswordAccount !== undefined + ? emailPasswordAccount + : { + recipeId: "emailpassword", + email, + }, + linkingCandidate, + undefined, + tenantId, + userContext + ); // Now we need to check that if there exists any email password user at all // for the input email. If not, then it implies that when the token is consumed, @@ -391,14 +386,13 @@ export default function getAPIImplementation(): APIInterface { async function markEmailAsVerified(recipeUserId: RecipeUserId, email: string) { const emailVerificationInstance = EmailVerification.getInstance(); if (emailVerificationInstance) { - const tokenResponse = await emailVerificationInstance.recipeInterfaceImpl.createEmailVerificationToken( - { + const tokenResponse = + await emailVerificationInstance.recipeInterfaceImpl.createEmailVerificationToken({ tenantId, recipeUserId, email, userContext, - } - ); + }); if (tokenResponse.status === "OK") { await emailVerificationInstance.recipeInterfaceImpl.verifyEmailUsingToken({ @@ -413,9 +407,7 @@ export default function getAPIImplementation(): APIInterface { } } - async function doUpdatePasswordAndVerifyEmailAndTryLinkIfNotPrimary( - recipeUserId: RecipeUserId - ): Promise< + async function doUpdatePasswordAndVerifyEmailAndTryLinkIfNotPrimary(recipeUserId: RecipeUserId): Promise< | { status: "OK"; user: User; diff --git a/lib/ts/recipe/emailpassword/recipeImplementation.ts b/lib/ts/recipe/emailpassword/recipeImplementation.ts index 16dede2f4..218474559 100644 --- a/lib/ts/recipe/emailpassword/recipeImplementation.ts +++ b/lib/ts/recipe/emailpassword/recipeImplementation.ts @@ -156,12 +156,7 @@ export default function getRecipeInterface( return response; }, - verifyCredentials: async function ({ - email, - password, - tenantId, - userContext, - }): Promise< + verifyCredentials: async function ({ email, password, tenantId, userContext }): Promise< | { status: "OK"; user: User; diff --git a/lib/ts/recipe/emailpassword/types.ts b/lib/ts/recipe/emailpassword/types.ts index 0fdfbe088..93e30d52f 100644 --- a/lib/ts/recipe/emailpassword/types.ts +++ b/lib/ts/recipe/emailpassword/types.ts @@ -164,11 +164,7 @@ export type RecipeInterface = { userContext: UserContext; }): Promise<{ status: "OK"; token: string } | { status: "UNKNOWN_USER_ID_ERROR" }>; - consumePasswordResetToken(input: { - token: string; - tenantId: string; - userContext: UserContext; - }): Promise< + consumePasswordResetToken(input: { token: string; tenantId: string; userContext: UserContext }): Promise< | { status: "OK"; email: string; @@ -212,12 +208,7 @@ export type APIOptions = { export type APIInterface = { emailExistsGET: | undefined - | ((input: { - email: string; - tenantId: string; - options: APIOptions; - userContext: UserContext; - }) => Promise< + | ((input: { email: string; tenantId: string; options: APIOptions; userContext: UserContext }) => Promise< | { status: "OK"; exists: boolean; diff --git a/lib/ts/recipe/emailverification/recipeImplementation.ts b/lib/ts/recipe/emailverification/recipeImplementation.ts index 634239188..bdaa121af 100644 --- a/lib/ts/recipe/emailverification/recipeImplementation.ts +++ b/lib/ts/recipe/emailverification/recipeImplementation.ts @@ -87,7 +87,8 @@ export default function getRecipeInterface( if (emailInfo.status === "OK" && emailInfo.email === response.email) { // we do this here to prevent cyclic dependencies. // TODO: Fix this. - let AccountLinking = require("../accountlinking/recipe").default.getInstance() as AccountLinkingRecipe; + let AccountLinking = + require("../accountlinking/recipe").default.getInstance() as AccountLinkingRecipe; await AccountLinking.tryLinkingByAccountInfoOrCreatePrimaryUser({ tenantId, inputUser: updatedUser, diff --git a/lib/ts/recipe/multifactorauth/types.ts b/lib/ts/recipe/multifactorauth/types.ts index 693e8e646..0e0cd8acf 100644 --- a/lib/ts/recipe/multifactorauth/types.ts +++ b/lib/ts/recipe/multifactorauth/types.ts @@ -118,11 +118,7 @@ export type APIOptions = { export type APIInterface = { resyncSessionAndFetchMFAInfoPUT: | undefined - | ((input: { - options: APIOptions; - session: SessionContainerInterface; - userContext: UserContext; - }) => Promise< + | ((input: { options: APIOptions; session: SessionContainerInterface; userContext: UserContext }) => Promise< | { status: "OK"; factors: { diff --git a/lib/ts/recipe/multitenancy/recipeImplementation.ts b/lib/ts/recipe/multitenancy/recipeImplementation.ts index bdb55e756..e22df3a58 100644 --- a/lib/ts/recipe/multitenancy/recipeImplementation.ts +++ b/lib/ts/recipe/multitenancy/recipeImplementation.ts @@ -59,11 +59,7 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { }, listAllTenants: async function ({ userContext }) { - let response = await querier.sendGetRequest( - "/recipe/multitenancy/tenant/list/v2", - {}, - userContext - ); + let response = await querier.sendGetRequest("/recipe/multitenancy/tenant/list/v2", {}, userContext); return response; }, diff --git a/lib/ts/recipe/oauth2provider/api/userInfo.ts b/lib/ts/recipe/oauth2provider/api/userInfo.ts index 3e661068d..91b638352 100644 --- a/lib/ts/recipe/oauth2provider/api/userInfo.ts +++ b/lib/ts/recipe/oauth2provider/api/userInfo.ts @@ -41,12 +41,11 @@ export default async function userInfoGET( let accessTokenPayload: JSONObject; try { - const { - payload, - } = await OAuth2ProviderRecipe.getInstanceOrThrowError().recipeInterfaceImpl.validateOAuth2AccessToken({ - token: accessToken, - userContext, - }); + const { payload } = + await OAuth2ProviderRecipe.getInstanceOrThrowError().recipeInterfaceImpl.validateOAuth2AccessToken({ + token: accessToken, + userContext, + }); accessTokenPayload = payload; } catch (error) { options.res.setHeader("WWW-Authenticate", 'Bearer error="invalid_token"', false); diff --git a/lib/ts/recipe/oauth2provider/recipeImplementation.ts b/lib/ts/recipe/oauth2provider/recipeImplementation.ts index d1e476bad..4f52728dc 100644 --- a/lib/ts/recipe/oauth2provider/recipeImplementation.ts +++ b/lib/ts/recipe/oauth2provider/recipeImplementation.ts @@ -453,11 +453,7 @@ export default function getRecipeInterface( body["authorizationHeader"] = input.authorizationHeader; } - const res = await querier.sendPostRequest( - "/recipe/oauth/token", - body, - input.userContext - ); + const res = await querier.sendPostRequest("/recipe/oauth/token", body, input.userContext); if (res.status === "CLIENT_NOT_FOUND_ERROR") { return { @@ -697,11 +693,7 @@ export default function getRecipeInterface( } } - const res = await querier.sendPostRequest( - "/recipe/oauth/token/revoke", - requestBody, - input.userContext - ); + const res = await querier.sendPostRequest("/recipe/oauth/token/revoke", requestBody, input.userContext); if (res.status !== "OK") { return { diff --git a/lib/ts/recipe/oauth2provider/types.ts b/lib/ts/recipe/oauth2provider/types.ts index 6af8cd684..08f41f8d8 100644 --- a/lib/ts/recipe/oauth2provider/types.ts +++ b/lib/ts/recipe/oauth2provider/types.ts @@ -249,10 +249,7 @@ export type RecipeInterface = { userContext: UserContext; }): Promise<{ redirectTo: string }>; - getOAuth2Client(input: { - clientId: string; - userContext: UserContext; - }): Promise< + getOAuth2Client(input: { clientId: string; userContext: UserContext }): Promise< | { status: "OK"; client: OAuth2Client; diff --git a/lib/ts/recipe/openid/types.ts b/lib/ts/recipe/openid/types.ts index 11babcb13..2a3ec7c8f 100644 --- a/lib/ts/recipe/openid/types.ts +++ b/lib/ts/recipe/openid/types.ts @@ -47,10 +47,7 @@ export type APIOptions = { export type APIInterface = { getOpenIdDiscoveryConfigurationGET: | undefined - | ((input: { - options: APIOptions; - userContext: UserContext; - }) => Promise< + | ((input: { options: APIOptions; userContext: UserContext }) => Promise< | { status: "OK"; issuer: string; @@ -70,9 +67,7 @@ export type APIInterface = { }; export type RecipeInterface = { - getOpenIdDiscoveryConfiguration(input: { - userContext: UserContext; - }): Promise<{ + getOpenIdDiscoveryConfiguration(input: { userContext: UserContext }): Promise<{ status: "OK"; issuer: string; jwks_uri: string; diff --git a/lib/ts/recipe/passwordless/api/implementation.ts b/lib/ts/recipe/passwordless/api/implementation.ts index c769ad6ea..c9f793e59 100644 --- a/lib/ts/recipe/passwordless/api/implementation.ts +++ b/lib/ts/recipe/passwordless/api/implementation.ts @@ -125,14 +125,13 @@ export default function getAPIImplementation(): APIInterface { if (loginMethod.hasSameEmailAs(accountInfo.email) && !loginMethod.verified) { // We first check that the submitted code is actually valid if (await checkCredentials()) { - const tokenResponse = await emailVerificationInstance.recipeInterfaceImpl.createEmailVerificationToken( - { + const tokenResponse = + await emailVerificationInstance.recipeInterfaceImpl.createEmailVerificationToken({ tenantId: input.tenantId, recipeUserId: loginMethod.recipeUserId, email: accountInfo.email, userContext: input.userContext, - } - ); + }); if (tokenResponse.status === "OK") { await emailVerificationInstance.recipeInterfaceImpl.verifyEmailUsingToken({ diff --git a/lib/ts/recipe/passwordless/recipe.ts b/lib/ts/recipe/passwordless/recipe.ts index 8ad1c11c4..f8a40c4db 100644 --- a/lib/ts/recipe/passwordless/recipe.ts +++ b/lib/ts/recipe/passwordless/recipe.ts @@ -235,14 +235,12 @@ export default class Recipe extends RecipeModule { // object. let factorIdToEmailsMap: Record = {}; if (allFactors.includes(FactorIds.OTP_EMAIL)) { - factorIdToEmailsMap[ - FactorIds.OTP_EMAIL - ] = nonFakeEmailsThatPasswordlessLoginMethodOrderedByTimeJoined; + factorIdToEmailsMap[FactorIds.OTP_EMAIL] = + nonFakeEmailsThatPasswordlessLoginMethodOrderedByTimeJoined; } if (allFactors.includes(FactorIds.LINK_EMAIL)) { - factorIdToEmailsMap[ - FactorIds.LINK_EMAIL - ] = nonFakeEmailsThatPasswordlessLoginMethodOrderedByTimeJoined; + factorIdToEmailsMap[FactorIds.LINK_EMAIL] = + nonFakeEmailsThatPasswordlessLoginMethodOrderedByTimeJoined; } return { status: "OK", @@ -367,14 +365,12 @@ export default class Recipe extends RecipeModule { // object. let factorIdToPhoneNumberMap: Record = {}; if (allFactors.includes(FactorIds.OTP_PHONE)) { - factorIdToPhoneNumberMap[ - FactorIds.OTP_PHONE - ] = phoneNumbersThatPasswordlessLoginMethodOrderedByTimeJoined; + factorIdToPhoneNumberMap[FactorIds.OTP_PHONE] = + phoneNumbersThatPasswordlessLoginMethodOrderedByTimeJoined; } if (allFactors.includes(FactorIds.LINK_PHONE)) { - factorIdToPhoneNumberMap[ - FactorIds.LINK_PHONE - ] = phoneNumbersThatPasswordlessLoginMethodOrderedByTimeJoined; + factorIdToPhoneNumberMap[FactorIds.LINK_PHONE] = + phoneNumbersThatPasswordlessLoginMethodOrderedByTimeJoined; } return { status: "OK", diff --git a/lib/ts/recipe/session/index.ts b/lib/ts/recipe/session/index.ts index f09151583..76e060612 100644 --- a/lib/ts/recipe/session/index.ts +++ b/lib/ts/recipe/session/index.ts @@ -152,7 +152,8 @@ export default class SessionWrapper { }; } - const claimValidatorsAddedByOtherRecipes = Recipe.getInstanceOrThrowError().getClaimValidatorsAddedByOtherRecipes(); + const claimValidatorsAddedByOtherRecipes = + Recipe.getInstanceOrThrowError().getClaimValidatorsAddedByOtherRecipes(); const globalClaimValidators: SessionClaimValidator[] = await recipeImpl.getGlobalClaimValidators({ userId: sessionInfo.userId, recipeUserId: sessionInfo.recipeUserId, diff --git a/lib/ts/recipe/session/sessionFunctions.ts b/lib/ts/recipe/session/sessionFunctions.ts index 2526797d4..c4bd5f42b 100644 --- a/lib/ts/recipe/session/sessionFunctions.ts +++ b/lib/ts/recipe/session/sessionFunctions.ts @@ -119,7 +119,7 @@ export async function getSession( getCombinedJWKS(config), helpers.config.antiCsrfFunctionOrString === "VIA_TOKEN" && doAntiCsrfCheck ); - } catch (err: any) { + } catch (err) { /** * if error type is not TRY_REFRESH_TOKEN, we return the * error to the user @@ -245,11 +245,7 @@ export async function getSession( checkDatabase: alwaysCheckCore, }; - let response = await helpers.querier.sendPostRequest( - "/recipe/session/verify", - requestBody, - userContext - ); + let response = await helpers.querier.sendPostRequest("/recipe/session/verify", requestBody, userContext); if (response.status === "OK") { return { @@ -349,11 +345,7 @@ export async function refreshSession( throw new Error("Please either use VIA_TOKEN, NONE or call with doAntiCsrfCheck false"); } - let response = await helpers.querier.sendPostRequest( - "/recipe/session/refresh", - requestBody, - userContext - ); + let response = await helpers.querier.sendPostRequest("/recipe/session/refresh", requestBody, userContext); if (response.status === "OK") { return { @@ -419,11 +411,7 @@ export async function revokeAllSessionsForUser( }; if (revokeAcrossAllTenants) { - const response = await helpers.querier.sendPostRequest( - "/recipe/session/remove", - body, - userContext - ); + const response = await helpers.querier.sendPostRequest("/recipe/session/remove", body, userContext); return response.sessionHandlesRevoked; } @@ -455,12 +443,14 @@ export async function getAllSessionHandlesForUser( tenantId = DEFAULT_TENANT_ID; } let response = await helpers.querier.sendGetRequest( - fetchAcrossAllTenants ? "/recipe/session/user" : { - path: "//recipe/session/user", - params: { - tenantId: tenantId, - }, - }, + fetchAcrossAllTenants + ? "/recipe/session/user" + : { + path: "//recipe/session/user", + params: { + tenantId: tenantId, + }, + }, { userId, fetchSessionsForAllLinkedAccounts, diff --git a/lib/ts/recipe/session/types.ts b/lib/ts/recipe/session/types.ts index a05b172c1..83ff7492c 100644 --- a/lib/ts/recipe/session/types.ts +++ b/lib/ts/recipe/session/types.ts @@ -303,11 +303,7 @@ export type RecipeInterface = { userContext: UserContext; }): Promise; - getClaimValue(input: { - sessionHandle: string; - claim: SessionClaim; - userContext: UserContext; - }): Promise< + getClaimValue(input: { sessionHandle: string; claim: SessionClaim; userContext: UserContext }): Promise< | { status: "SESSION_DOES_NOT_EXIST_ERROR"; } diff --git a/lib/ts/recipe/session/utils.ts b/lib/ts/recipe/session/utils.ts index 02c018437..3a7b3439f 100644 --- a/lib/ts/recipe/session/utils.ts +++ b/lib/ts/recipe/session/utils.ts @@ -375,16 +375,16 @@ export async function getRequiredClaimValidators( overrideGlobalClaimValidators: VerifySessionOptions["overrideGlobalClaimValidators"], userContext: UserContext ) { - const claimValidatorsAddedByOtherRecipes = SessionRecipe.getInstanceOrThrowError().getClaimValidatorsAddedByOtherRecipes(); - const globalClaimValidators: SessionClaimValidator[] = await SessionRecipe.getInstanceOrThrowError().recipeInterfaceImpl.getGlobalClaimValidators( - { + const claimValidatorsAddedByOtherRecipes = + SessionRecipe.getInstanceOrThrowError().getClaimValidatorsAddedByOtherRecipes(); + const globalClaimValidators: SessionClaimValidator[] = + await SessionRecipe.getInstanceOrThrowError().recipeInterfaceImpl.getGlobalClaimValidators({ userId: session.getUserId(userContext), recipeUserId: session.getRecipeUserId(userContext), tenantId: session.getTenantId(userContext), claimValidatorsAddedByOtherRecipes, userContext, - } - ); + }); return overrideGlobalClaimValidators !== undefined ? await overrideGlobalClaimValidators(globalClaimValidators, session, userContext) diff --git a/lib/ts/recipe/userroles/recipeImplementation.ts b/lib/ts/recipe/userroles/recipeImplementation.ts index ae1fa9090..1793e79bc 100644 --- a/lib/ts/recipe/userroles/recipeImplementation.ts +++ b/lib/ts/recipe/userroles/recipeImplementation.ts @@ -72,12 +72,7 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { }, createNewRoleOrAddPermissions: function ({ role, permissions, userContext }) { - return querier.sendPutRequest( - "/recipe/role", - { role, permissions }, - {}, - userContext - ); + return querier.sendPutRequest("/recipe/role", { role, permissions }, {}, userContext); }, getPermissionsForRole: function ({ role, userContext }) { @@ -96,11 +91,7 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { }, getRolesThatHavePermission: function ({ permission, userContext }) { - return querier.sendGetRequest( - "/recipe/permission/roles", - { permission }, - userContext - ); + return querier.sendGetRequest("/recipe/permission/roles", { permission }, userContext); }, deleteRole: function ({ role, userContext }) { diff --git a/lib/ts/recipe/webauthn/api/implementation.ts b/lib/ts/recipe/webauthn/api/implementation.ts index d1444a501..e03256fc7 100644 --- a/lib/ts/recipe/webauthn/api/implementation.ts +++ b/lib/ts/recipe/webauthn/api/implementation.ts @@ -591,23 +591,23 @@ export default function getAPIImplementation(): APIInterface { if (!emailVerified && hasOtherEmailOrPhone) { return { status: "RECOVER_ACCOUNT_NOT_ALLOWED", - reason: - "Recover account link was not created because of account take over risk. Please contact support. (ERR_CODE_001)", + reason: "Recover account link was not created because of account take over risk. Please contact support. (ERR_CODE_001)", }; } - const shouldDoAccountLinkingResponse = await AccountLinking.getInstance().config.shouldDoAutomaticAccountLinking( - webauthnAccount !== undefined - ? webauthnAccount - : { - recipeId: "webauthn", - email, - }, - primaryUserAssociatedWithEmail, - undefined, - tenantId, - userContext - ); + const shouldDoAccountLinkingResponse = + await AccountLinking.getInstance().config.shouldDoAutomaticAccountLinking( + webauthnAccount !== undefined + ? webauthnAccount + : { + recipeId: "webauthn", + email, + }, + primaryUserAssociatedWithEmail, + undefined, + tenantId, + userContext + ); // Now we need to check that if there exists any webauthn user at all // for the input email. If not, then it implies that when the token is consumed, @@ -728,14 +728,13 @@ export default function getAPIImplementation(): APIInterface { async function markEmailAsVerified(recipeUserId: RecipeUserId, email: string) { const emailVerificationInstance = EmailVerification.getInstance(); if (emailVerificationInstance) { - const tokenResponse = await emailVerificationInstance.recipeInterfaceImpl.createEmailVerificationToken( - { + const tokenResponse = + await emailVerificationInstance.recipeInterfaceImpl.createEmailVerificationToken({ tenantId, recipeUserId, email, userContext, - } - ); + }); if (tokenResponse.status === "OK") { await emailVerificationInstance.recipeInterfaceImpl.verifyEmailUsingToken({ diff --git a/lib/ts/recipe/webauthn/recipe.ts b/lib/ts/recipe/webauthn/recipe.ts index b94af64ab..324c9401f 100644 --- a/lib/ts/recipe/webauthn/recipe.ts +++ b/lib/ts/recipe/webauthn/recipe.ts @@ -136,9 +136,8 @@ export default class Recipe extends RecipeModule { return a.timeJoined - b.timeJoined; }); // Then we take the ones that belong to this recipe - const recipeLoginMethodsOrderedByTimeJoinedOldestFirst = orderedLoginMethodsByTimeJoinedOldestFirst.filter( - (lm) => lm.recipeId === Recipe.RECIPE_ID - ); + const recipeLoginMethodsOrderedByTimeJoinedOldestFirst = + orderedLoginMethodsByTimeJoinedOldestFirst.filter((lm) => lm.recipeId === Recipe.RECIPE_ID); let result: string[]; if (recipeLoginMethodsOrderedByTimeJoinedOldestFirst.length !== 0) { diff --git a/lib/ts/recipe/webauthn/recipeImplementation.ts b/lib/ts/recipe/webauthn/recipeImplementation.ts index e4bb9a18c..b6adb661c 100644 --- a/lib/ts/recipe/webauthn/recipeImplementation.ts +++ b/lib/ts/recipe/webauthn/recipeImplementation.ts @@ -362,11 +362,7 @@ export default function getRecipeInterface( }, listCredentials: async function ({ recipeUserId, userContext }) { - return await querier.sendGetRequest( - "/recipe/webauthn/user/credential/list", - { recipeUserId }, - userContext - ); + return await querier.sendGetRequest("/recipe/webauthn/user/credential/list", { recipeUserId }, userContext); }, removeGeneratedOptions: async function ({ webauthnGeneratedOptionsId, tenantId, userContext }) { diff --git a/lib/ts/recipe/webauthn/types.ts b/lib/ts/recipe/webauthn/types.ts index a25c86070..8855bade1 100644 --- a/lib/ts/recipe/webauthn/types.ts +++ b/lib/ts/recipe/webauthn/types.ts @@ -319,11 +319,7 @@ export type RecipeInterface = { userContext: UserContext; }): Promise<{ status: "OK"; token: string } | GenerateRecoverAccountTokenErrorResponse>; - consumeRecoverAccountToken(input: { - token: string; - tenantId: string; - userContext: UserContext; - }): Promise< + consumeRecoverAccountToken(input: { token: string; tenantId: string; userContext: UserContext }): Promise< | { status: "OK"; email: string; @@ -350,22 +346,14 @@ export type RecipeInterface = { userContext: UserContext; }): Promise<{ status: "OK"; user: User; recipeUserId: RecipeUserId } | GetUserFromRecoverAccountTokenErrorResponse>; - removeCredential(input: { - webauthnCredentialId: string; - recipeUserId: string; - userContext: UserContext; - }): Promise< + removeCredential(input: { webauthnCredentialId: string; recipeUserId: string; userContext: UserContext }): Promise< | { status: "OK"; } | RemoveCredentialErrorResponse >; - getCredential(input: { - webauthnCredentialId: string; - recipeUserId: string; - userContext: UserContext; - }): Promise< + getCredential(input: { webauthnCredentialId: string; recipeUserId: string; userContext: UserContext }): Promise< | { status: "OK"; webauthnCredentialId: string; @@ -376,10 +364,7 @@ export type RecipeInterface = { | GetCredentialErrorResponse >; - listCredentials(input: { - recipeUserId: string; - userContext: UserContext; - }): Promise<{ + listCredentials(input: { recipeUserId: string; userContext: UserContext }): Promise<{ status: "OK"; credentials: { webauthnCredentialId: string; @@ -533,11 +518,7 @@ export type APIInterface = { signInOptionsPOST: | undefined - | ((input: { - tenantId: string; - options: APIOptions; - userContext: UserContext; - }) => Promise< + | ((input: { tenantId: string; options: APIOptions; userContext: UserContext }) => Promise< | { status: "OK"; webauthnGeneratedOptionsId: string; @@ -594,12 +575,7 @@ export type APIInterface = { generateRecoverAccountTokenPOST: | undefined - | ((input: { - email: string; - tenantId: string; - options: APIOptions; - userContext: UserContext; - }) => Promise< + | ((input: { email: string; tenantId: string; options: APIOptions; userContext: UserContext }) => Promise< | { status: "OK"; } @@ -645,12 +621,7 @@ export type APIInterface = { emailExistsGET: | undefined - | ((input: { - email: string; - tenantId: string; - options: APIOptions; - userContext: UserContext; - }) => Promise< + | ((input: { email: string; tenantId: string; options: APIOptions; userContext: UserContext }) => Promise< | { status: "OK"; exists: boolean; diff --git a/lib/ts/supertokens.ts b/lib/ts/supertokens.ts index 1bb8de28d..06470ccc7 100644 --- a/lib/ts/supertokens.ts +++ b/lib/ts/supertokens.ts @@ -59,14 +59,14 @@ export default class SuperTokens { config.appInfo.origin === undefined ? undefined : typeof config.appInfo.origin === "string" - ? config.appInfo.origin - : "function"; + ? config.appInfo.origin + : "function"; logDebugMessage( "appInfo: " + JSON.stringify({ ...config.appInfo, origin: originToPrint, - }), + }) ); this.framework = config.framework !== undefined ? config.framework : "express"; @@ -86,7 +86,7 @@ export default class SuperTokens { }), config.supertokens?.apiKey, config.supertokens?.networkInterceptor, - config.supertokens?.disableCoreCallCache, + config.supertokens?.disableCoreCallCache ); if (config.recipeList === undefined || config.recipeList.length === 0) { throw new Error("Please provide at least one recipe to the supertokens.init function call"); @@ -209,7 +209,7 @@ export default class SuperTokens { response: BaseResponse, path: NormalisedURLPath, method: HTTPMethod, - userContext: UserContext, + userContext: UserContext ) => { return await matchedRecipe.handleAPIRequest(id, tenantId, request, response, path, method, userContext); }; @@ -230,13 +230,13 @@ export default class SuperTokens { getUserCount = async ( includeRecipeIds: string[] | undefined, tenantId: string | undefined, - userContext: UserContext, + userContext: UserContext ): Promise => { let querier = Querier.getNewInstanceOrThrowError(undefined); let apiVersion = await querier.getAPIVersion(userContext); if (maxVersion(apiVersion, "2.7") === "2.7") { throw new Error( - "Please use core version >= 3.5 to call this function. Otherwise, you can call .getUserCount() instead (for example, EmailPassword.getUserCount())", + "Please use core version >= 3.5 to call this function. Otherwise, you can call .getUserCount() instead (for example, EmailPassword.getUserCount())" ); } let includeRecipeIdsStr = undefined; @@ -255,7 +255,7 @@ export default class SuperTokens { includeRecipeIds: includeRecipeIdsStr, includeAllTenants: tenantId === undefined, }, - userContext, + userContext ); return Number(response.count); }; @@ -288,7 +288,7 @@ export default class SuperTokens { externalUserIdInfo: input.externalUserIdInfo, force: input.force, }, - input.userContext, + input.userContext ); } else { throw new global.Error("Please upgrade the SuperTokens core to >= 3.15.0"); @@ -320,7 +320,7 @@ export default class SuperTokens { userId: input.userId, userIdType: input.userIdType, }, - input.userContext, + input.userContext ); return response; } else { @@ -347,7 +347,7 @@ export default class SuperTokens { userIdType: input.userIdType, force: input.force, }, - input.userContext, + input.userContext ); } else { throw new global.Error("Please upgrade the SuperTokens core to >= 3.15.0"); @@ -373,7 +373,7 @@ export default class SuperTokens { externalUserIdInfo: input.externalUserIdInfo || null, }, {}, - input.userContext, + input.userContext ); } else { throw new global.Error("Please upgrade the SuperTokens core to >= 3.15.0"); @@ -389,7 +389,7 @@ export default class SuperTokens { if (!path.startsWith(this.appInfo.apiBasePath)) { logDebugMessage( "middleware: Not handling because request path did not start with config path. Request path: " + - path.getAsStringDangerous(), + path.getAsStringDangerous() ); return false; } @@ -416,7 +416,7 @@ export default class SuperTokens { " with path: " + path.getAsStringDangerous() + " and method: " + - method, + method ); let idResult = await recipeModules[i].returnAPIIdIfCanHandleRequest(path, method, userContext); if (idResult !== undefined) { @@ -445,7 +445,7 @@ export default class SuperTokens { response, path, method, - userContext, + userContext ); if (!requestHandled) { logDebugMessage("middleware: Not handled because API returned requestHandled as false"); @@ -517,7 +517,7 @@ export default class SuperTokens { idResult = currIdResult; } else { throw new Error( - "Two recipes have matched the same API path and method! This is a bug in the SDK. Please contact support.", + "Two recipes have matched the same API path and method! This is a bug in the SDK. Please contact support." ); } } @@ -536,7 +536,7 @@ export default class SuperTokens { response, path, method, - userContext, + userContext ); if (!requestHandled) { logDebugMessage("middleware: Not handled because API returned requestHandled as false"); diff --git a/package-lock.json b/package-lock.json index b9c026dd8..b3c6ed571 100644 --- a/package-lock.json +++ b/package-lock.json @@ -59,9 +59,10 @@ "next": "^14.0.4", "next-test-api-route-handler": "^3.1.10", "nock": "11.7.0", + "node-fetch": "^3.3.2", "nyc": "^15.1.0", "otpauth": "9.1.5", - "prettier": "2.0.5", + "prettier": "^2.3.2", "pretty-quick": "^3.1.1", "react": "^18.2.0", "sinon": "^14.0.0", @@ -2951,6 +2952,25 @@ "node-fetch": "^2.6.12" } }, + "node_modules/cross-fetch/node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -2979,6 +2999,15 @@ "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz", "integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==" }, + "node_modules/data-uri-to-buffer": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz", + "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==", + "dev": true, + "engines": { + "node": ">= 12" + } + }, "node_modules/dayjs": { "version": "1.11.10", "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz", @@ -3547,6 +3576,29 @@ "reusify": "^1.0.4" } }, + "node_modules/fetch-blob": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", + "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "paypal", + "url": "https://paypal.me/jimmywarting" + } + ], + "dependencies": { + "node-domexception": "^1.0.0", + "web-streams-polyfill": "^3.0.3" + }, + "engines": { + "node": "^12.20 || >= 14.13" + } + }, "node_modules/filelist": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz", @@ -3740,6 +3792,18 @@ "node": ">= 0.12" } }, + "node_modules/formdata-polyfill": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", + "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", + "dev": true, + "dependencies": { + "fetch-blob": "^3.1.2" + }, + "engines": { + "node": ">=12.20.0" + } + }, "node_modules/formidable": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/formidable/-/formidable-1.2.6.tgz", @@ -5717,6 +5781,26 @@ "node": ">= 0.6" } }, + "node_modules/next-test-api-route-handler/node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dev": true, + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, "node_modules/nise": { "version": "5.1.9", "resolved": "https://registry.npmjs.org/nise/-/nise-5.1.9.tgz", @@ -5775,23 +5859,42 @@ "node": ">= 8.0" } }, + "node_modules/node-domexception": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", + "deprecated": "Use your platform's native DOMException instead", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "github", + "url": "https://paypal.me/jimmywarting" + } + ], + "engines": { + "node": ">=10.5.0" + } + }, "node_modules/node-fetch": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz", + "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==", + "dev": true, "dependencies": { - "whatwg-url": "^5.0.0" + "data-uri-to-buffer": "^4.0.0", + "fetch-blob": "^3.1.4", + "formdata-polyfill": "^4.0.10" }, "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/node-fetch" } }, "node_modules/node-preload": { @@ -6476,9 +6579,9 @@ } }, "node_modules/prettier": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz", - "integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.3.2.tgz", + "integrity": "sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==", "dev": true, "bin": { "prettier": "bin-prettier.js" @@ -8011,6 +8114,15 @@ "integrity": "sha512-Uw5ooOQxRASHgu6C7GVvUxisKXfSgW4oFlO+aa+PAkgmH89O3CXxEEzNRNtHSqtXFTl0nAC1uYj0GMSH27uwtQ==", "dev": true }, + "node_modules/web-streams-polyfill": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz", + "integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", diff --git a/package.json b/package.json index 8376ece46..b648fb5a0 100644 --- a/package.json +++ b/package.json @@ -179,7 +179,7 @@ "node-fetch": "^3.3.2", "nyc": "^15.1.0", "otpauth": "9.1.5", - "prettier": "2.0.5", + "prettier": "2.3.2", "pretty-quick": "^3.1.1", "react": "^18.2.0", "sinon": "^14.0.0", diff --git a/test/emailpassword/signinFeature.test.js b/test/emailpassword/signinFeature.test.js index 15f95f7d6..d617c5bb4 100644 --- a/test/emailpassword/signinFeature.test.js +++ b/test/emailpassword/signinFeature.test.js @@ -1239,7 +1239,8 @@ describe(`signinFeature: ${printPath("[test/emailpassword/signinFeature.test.js] loginMethods: [ { ...response.user.loginMethods[0], - recipeUserId: response.user.loginMethods[0].recipeUserId.getAsString(), + recipeUserId: + response.user.loginMethods[0].recipeUserId.getAsString(), }, ], }; diff --git a/test/emailverification/apiInterface.test.js b/test/emailverification/apiInterface.test.js index e7142606f..63a033de9 100644 --- a/test/emailverification/apiInterface.test.js +++ b/test/emailverification/apiInterface.test.js @@ -78,14 +78,15 @@ describe(`apiInterface: ${printPath("[test/emailverification/apiInterface.js]")} assert.equal(typeof signUpResult.user.id, "string"); assert.equal(typeof signUpResult.recipeUserId.getAsString(), "string"); - const tokenResult = await EmailVerificationRecipe.getInstanceOrThrowError().recipeInterfaceImpl.createEmailVerificationToken( - { - email, - recipeUserId: signUpResult.recipeUserId, - tenantId: "public", - userContext: {}, - } - ); + const tokenResult = + await EmailVerificationRecipe.getInstanceOrThrowError().recipeInterfaceImpl.createEmailVerificationToken( + { + email, + recipeUserId: signUpResult.recipeUserId, + tenantId: "public", + userContext: {}, + } + ); assert.equal(tokenResult.status, "OK"); assert.equal(typeof tokenResult.token, "string"); @@ -168,14 +169,15 @@ describe(`apiInterface: ${printPath("[test/emailverification/apiInterface.js]")} signUpResponse.user?.loginMethods?.find((method) => method.recipeId === "webauthn")?.recipeUserId ); - const tokenResult = await EmailVerificationRecipe.getInstanceOrThrowError().recipeInterfaceImpl.createEmailVerificationToken( - { - email, - recipeUserId, - tenantId: "public", - userContext: {}, - } - ); + const tokenResult = + await EmailVerificationRecipe.getInstanceOrThrowError().recipeInterfaceImpl.createEmailVerificationToken( + { + email, + recipeUserId, + tenantId: "public", + userContext: {}, + } + ); assert.equal(tokenResult.status, "OK"); assert.equal(typeof tokenResult.token, "string"); From 8a705349314c8bbefb9acf4ac113a1846a315bb2 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Fri, 9 May 2025 11:36:27 +0530 Subject: [PATCH 38/64] Bumps version to 22.2.0 --- CHANGELOG.md | 4 ++++ lib/build/version.d.ts | 2 +- lib/build/version.js | 2 +- lib/ts/core/versions/5.3/schema.d.ts | 1 + lib/ts/version.ts | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 7 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd87f6667..fbfaf56c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Sets up workflow to run auth-react tests - Updates test-servers to work with updated tests +## [22.2.0] - 2025-05-09 + +- Refactors querier to use dynamic request body and response body types inference + ## [22.1.0] - 2025-04-04 - Adds support for using `code_challenge_method` from OIDC provider response to determine whether to use PKCE or not. diff --git a/lib/build/version.d.ts b/lib/build/version.d.ts index 39f082328..3ea03c7f3 100644 --- a/lib/build/version.d.ts +++ b/lib/build/version.d.ts @@ -1,4 +1,4 @@ // @ts-nocheck -export declare const version = "22.1.0"; +export declare const version = "22.2.0"; export declare const cdiSupported: string[]; export declare const dashboardVersion = "0.15"; diff --git a/lib/build/version.js b/lib/build/version.js index 4f9a887ac..afd8a3b91 100644 --- a/lib/build/version.js +++ b/lib/build/version.js @@ -15,7 +15,7 @@ exports.dashboardVersion = exports.cdiSupported = exports.version = void 0; * License for the specific language governing permissions and limitations * under the License. */ -exports.version = "22.1.0"; +exports.version = "22.2.0"; exports.cdiSupported = ["5.3"]; // Note: The actual script import for dashboard uses v{DASHBOARD_VERSION} exports.dashboardVersion = "0.15"; diff --git a/lib/ts/core/versions/5.3/schema.d.ts b/lib/ts/core/versions/5.3/schema.d.ts index dc4083377..877cf9c89 100644 --- a/lib/ts/core/versions/5.3/schema.d.ts +++ b/lib/ts/core/versions/5.3/schema.d.ts @@ -2,6 +2,7 @@ // @ts-nocheck // @ts-nocheck // @ts-nocheck +// @ts-nocheck /** * This file was auto-generated by openapi-typescript. * Do not make direct changes to the file. diff --git a/lib/ts/version.ts b/lib/ts/version.ts index 46b29d786..21474d062 100644 --- a/lib/ts/version.ts +++ b/lib/ts/version.ts @@ -12,7 +12,7 @@ * License for the specific language governing permissions and limitations * under the License. */ -export const version = "22.1.0"; +export const version = "22.2.0"; export const cdiSupported = ["5.3"]; diff --git a/package-lock.json b/package-lock.json index b3c6ed571..d82dd371c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "supertokens-node", - "version": "22.1.0", + "version": "22.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "supertokens-node", - "version": "22.1.0", + "version": "22.2.0", "license": "Apache-2.0", "dependencies": { "buffer": "^6.0.3", diff --git a/package.json b/package.json index b648fb5a0..2c8b6f0d8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "supertokens-node", - "version": "22.1.0", + "version": "22.2.0", "description": "NodeJS driver for SuperTokens core", "main": "index.js", "scripts": { From 645ce92949a985a1908a52041052328a1db93c26 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Fri, 16 May 2025 12:00:06 +0530 Subject: [PATCH 39/64] Fix a path in the generate script --- scripts/generate-schema.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/generate-schema.js b/scripts/generate-schema.js index d8502046c..b11dee10f 100644 --- a/scripts/generate-schema.js +++ b/scripts/generate-schema.js @@ -7,7 +7,7 @@ const fetch = (...args) => import("node-fetch").then(({ default: fetch }) => fet const coreJsonPath = path.join(__dirname, "..", "coreDriverInterfaceSupported.json"); const specsDir = path.join(__dirname, "..", "specs"); -const libDir = path.join(__dirname, "..", "lib", "core", "versions"); +const libDir = path.join(__dirname, "..", "lib", "ts", "core", "versions"); const BASE_URL = "https://raw.githubusercontent.com/supertokens/core-driver-interface/refs/heads"; From 3dc0ec38f00df44bada0e2338ed7ab4b63573c45 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Fri, 16 May 2025 12:01:07 +0530 Subject: [PATCH 40/64] Rename template to template_path in querier --- lib/ts/querier.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/ts/querier.ts b/lib/ts/querier.ts index 010e0bbb5..4b706c505 100644 --- a/lib/ts/querier.ts +++ b/lib/ts/querier.ts @@ -169,12 +169,12 @@ export class Querier { // path should start with "/" sendPostRequest = async

( - template: PathParam

, + template_path: PathParam

, body: RequestBody, userContext: UserContext ): Promise> => { this.invalidateCoreCallCache(userContext); - const path = this.getPath(template); + const path = this.getPath(template_path); const { body: respBody } = await this.sendRequestHelper( path, @@ -227,13 +227,13 @@ export class Querier { // path should start with "/" sendDeleteRequest = async

( - template: PathParam

, + template_path: PathParam

, body: RequestBody, params: any | undefined, userContext: UserContext ): Promise> => { this.invalidateCoreCallCache(userContext); - const path = this.getPath(template); + const path = this.getPath(template_path); const { body: respBody } = await this.sendRequestHelper( path, @@ -291,11 +291,11 @@ export class Querier { // path should start with "/" sendGetRequest = async

( - template: PathParam

, + template_path: PathParam

, params: Record, userContext: UserContext ): Promise> => { - const path = this.getPath(template); + const path = this.getPath(template_path); const { body: respBody } = await this.sendRequestHelper( path, "GET", @@ -403,12 +403,12 @@ export class Querier { }; sendGetRequestWithResponseHeaders = async

( - template: PathParam

, + template_path: PathParam

, params: Record, inpHeaders: Record | undefined, userContext: UserContext ): Promise<{ body: ResponseBody; headers: Headers }> => { - const path = this.getPath(template); + const path = this.getPath(template_path); return await this.sendRequestHelper( path, "GET", @@ -461,13 +461,13 @@ export class Querier { // path should start with "/" sendPutRequest = async

( - template: PathParam

, + template_path: PathParam

, body: RequestBody, params: Record, userContext: UserContext ): Promise> => { this.invalidateCoreCallCache(userContext); - const path = this.getPath(template); + const path = this.getPath(template_path); const { body: respBody } = await this.sendRequestHelper( path, @@ -524,12 +524,12 @@ export class Querier { // path should start with "/" sendPatchRequest = async

( - template: PathParam

, + template_path: PathParam

, body: RequestBody, userContext: UserContext ): Promise> => { this.invalidateCoreCallCache(userContext); - const path = this.getPath(template); + const path = this.getPath(template_path); const { body: respBody } = await this.sendRequestHelper( path, From 4e2bbc6a3582c83d16cd244adc2053365dde93f9 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Fri, 16 May 2025 12:08:21 +0530 Subject: [PATCH 41/64] Move to using Required instead of MakeAllRequired --- lib/build/core/types.d.ts | 5 +-- lib/build/querier.d.ts | 48 +++++++--------------------- lib/build/querier.js | 24 +++++++------- lib/ts/core/types.ts | 17 ++-------- lib/ts/core/versions/5.3/schema.d.ts | 2 ++ 5 files changed, 29 insertions(+), 67 deletions(-) diff --git a/lib/build/core/types.d.ts b/lib/build/core/types.d.ts index 4bc9dd71f..a915ddf39 100644 --- a/lib/build/core/types.d.ts +++ b/lib/build/core/types.d.ts @@ -15,10 +15,7 @@ export declare type ExtractMethodType

= ExtractMethodTypeWithUndefined, undefined >; -declare type MakeAllRequired = { - [K in keyof T]-?: NonNullable; -}; -declare type DeepRequireAllFields = T extends any ? MakeAllRequired : never; +declare type DeepRequireAllFields = T extends any ? Required : never; export declare type RequestBody

= ExtractMethodType extends { requestBody?: infer ReqBody; } diff --git a/lib/build/querier.d.ts b/lib/build/querier.d.ts index d91f6fc11..97d683020 100644 --- a/lib/build/querier.d.ts +++ b/lib/build/querier.d.ts @@ -32,85 +32,61 @@ export declare class Querier { ): void; private getPath; sendPostRequest:

( - template: PathParam

, + template_path: PathParam

, body: RequestBody, userContext: UserContext ) => Promise< import("./core/types").UncleanedResponseBody extends any - ? { - [K in keyof import("./core/types").UncleanedResponseBody]-?: NonNullable< - import("./core/types").UncleanedResponseBody[K] - >; - } + ? Required> : never >; sendDeleteRequest:

( - template: PathParam

, + template_path: PathParam

, body: RequestBody, params: any | undefined, userContext: UserContext ) => Promise< import("./core/types").UncleanedResponseBody extends any - ? { - [K in keyof import("./core/types").UncleanedResponseBody]-?: NonNullable< - import("./core/types").UncleanedResponseBody[K] - >; - } + ? Required> : never >; sendGetRequest:

( - template: PathParam

, + template_path: PathParam

, params: Record, userContext: UserContext ) => Promise< import("./core/types").UncleanedResponseBody extends any - ? { - [K in keyof import("./core/types").UncleanedResponseBody]-?: NonNullable< - import("./core/types").UncleanedResponseBody[K] - >; - } + ? Required> : never >; sendGetRequestWithResponseHeaders:

( - template: PathParam

, + template_path: PathParam

, params: Record, inpHeaders: Record | undefined, userContext: UserContext ) => Promise<{ body: import("./core/types").UncleanedResponseBody extends any - ? { - [K in keyof import("./core/types").UncleanedResponseBody]-?: NonNullable< - import("./core/types").UncleanedResponseBody[K] - >; - } + ? Required> : never; headers: Headers; }>; sendPutRequest:

( - template: PathParam

, + template_path: PathParam

, body: RequestBody, params: Record, userContext: UserContext ) => Promise< import("./core/types").UncleanedResponseBody extends any - ? { - [K in keyof import("./core/types").UncleanedResponseBody]-?: NonNullable< - import("./core/types").UncleanedResponseBody[K] - >; - } + ? Required> : never >; sendPatchRequest:

( - template: PathParam

, + template_path: PathParam

, body: RequestBody, userContext: UserContext ) => Promise< import("./core/types").UncleanedResponseBody extends any - ? { - [K in keyof import("./core/types").UncleanedResponseBody]-?: NonNullable< - import("./core/types").UncleanedResponseBody[K] - >; - } + ? Required> : never >; invalidateCoreCallCache: (userContext: UserContext, updGlobalCacheTagIfNecessary?: boolean) => void; diff --git a/lib/build/querier.js b/lib/build/querier.js index 812ae4bcc..d1fe33adc 100644 --- a/lib/build/querier.js +++ b/lib/build/querier.js @@ -108,10 +108,10 @@ class Querier { return new normalisedURLPath_1.default(populated); }; // path should start with "/" - this.sendPostRequest = async (template, body, userContext) => { + this.sendPostRequest = async (template_path, body, userContext) => { var _a; this.invalidateCoreCallCache(userContext); - const path = this.getPath(template); + const path = this.getPath(template_path); const { body: respBody } = await this.sendRequestHelper( path, "POST", @@ -154,10 +154,10 @@ class Querier { return respBody; }; // path should start with "/" - this.sendDeleteRequest = async (template, body, params, userContext) => { + this.sendDeleteRequest = async (template_path, body, params, userContext) => { var _a; this.invalidateCoreCallCache(userContext); - const path = this.getPath(template); + const path = this.getPath(template_path); const { body: respBody } = await this.sendRequestHelper( path, "DELETE", @@ -204,9 +204,9 @@ class Querier { return respBody; }; // path should start with "/" - this.sendGetRequest = async (template, params, userContext) => { + this.sendGetRequest = async (template_path, params, userContext) => { var _a; - const path = this.getPath(template); + const path = this.getPath(template_path); const { body: respBody } = await this.sendRequestHelper( path, "GET", @@ -308,9 +308,9 @@ class Querier { ); return respBody; }; - this.sendGetRequestWithResponseHeaders = async (template, params, inpHeaders, userContext) => { + this.sendGetRequestWithResponseHeaders = async (template_path, params, inpHeaders, userContext) => { var _a; - const path = this.getPath(template); + const path = this.getPath(template_path); return await this.sendRequestHelper( path, "GET", @@ -354,10 +354,10 @@ class Querier { ); }; // path should start with "/" - this.sendPutRequest = async (template, body, params, userContext) => { + this.sendPutRequest = async (template_path, body, params, userContext) => { var _a; this.invalidateCoreCallCache(userContext); - const path = this.getPath(template); + const path = this.getPath(template_path); const { body: respBody } = await this.sendRequestHelper( path, "PUT", @@ -403,10 +403,10 @@ class Querier { return respBody; }; // path should start with "/" - this.sendPatchRequest = async (template, body, userContext) => { + this.sendPatchRequest = async (template_path, body, userContext) => { var _a; this.invalidateCoreCallCache(userContext); - const path = this.getPath(template); + const path = this.getPath(template_path); const { body: respBody } = await this.sendRequestHelper( path, "PATCH", diff --git a/lib/ts/core/types.ts b/lib/ts/core/types.ts index d93c449a4..6c5db8e19 100644 --- a/lib/ts/core/types.ts +++ b/lib/ts/core/types.ts @@ -19,22 +19,9 @@ export type ExtractMethodType

= Exclude undefined >; -// Type to ensure that the `status` is a required field instead of -// it being optional. We should use this until the spec is not updated. -// TODO: Remove if we decide to go ahead with MakeAllRequired -// type MakeStatusRequired = T extends { status?: infer S } -// ? Omit & { status: S } -// : T; - -// Type to make all fields required. This should be used only if -// it is absolutely guaranteed that the fields are not optional. -type MakeAllRequired = { - [K in keyof T]-?: NonNullable; -}; - -// Wrapper around MakeAllRequired to ensure that it is applied recursively +// Wrapper around Required to ensure that it is applied recursively // to all unions. -type DeepRequireAllFields = T extends any ? MakeAllRequired : never; +type DeepRequireAllFields = T extends any ? Required : never; // Type to extract the request body from the method type export type RequestBody

= ExtractMethodType extends { diff --git a/lib/ts/core/versions/5.3/schema.d.ts b/lib/ts/core/versions/5.3/schema.d.ts index 877cf9c89..993ca1677 100644 --- a/lib/ts/core/versions/5.3/schema.d.ts +++ b/lib/ts/core/versions/5.3/schema.d.ts @@ -3,6 +3,8 @@ // @ts-nocheck // @ts-nocheck // @ts-nocheck +// @ts-nocheck +// @ts-nocheck /** * This file was auto-generated by openapi-typescript. * Do not make direct changes to the file. From 4d269e7e6781cc3318af8dfffaa6b868c7c46004 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Fri, 16 May 2025 12:10:14 +0530 Subject: [PATCH 42/64] Get rid of word boundary in regex --- lib/ts/querier.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ts/querier.ts b/lib/ts/querier.ts index 4b706c505..a5c4fe2da 100644 --- a/lib/ts/querier.ts +++ b/lib/ts/querier.ts @@ -161,7 +161,7 @@ export class Querier { let populated = String(template); for (const [key, value] of Object.entries(params)) { - populated = populated.replace(new RegExp(`<${key}>\\b`, "g"), String(value)); + populated = populated.replace(new RegExp(`<${key}>`, "g"), String(value)); } return new NormalisedURLPath(populated); From 22e068df190511e5e3532724e8e87361f75b006a Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Fri, 16 May 2025 12:25:27 +0530 Subject: [PATCH 43/64] Get rid of some unused code --- lib/build/querier.js | 2 +- lib/build/user.js | 4 +--- lib/ts/core/versions/5.3/schema.d.ts | 1 + lib/ts/user.ts | 5 +---- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/build/querier.js b/lib/build/querier.js index d1fe33adc..a35fd770d 100644 --- a/lib/build/querier.js +++ b/lib/build/querier.js @@ -103,7 +103,7 @@ class Querier { const params = typeof path === "string" ? {} : (_a = path.params) !== null && _a !== void 0 ? _a : {}; let populated = String(template); for (const [key, value] of Object.entries(params)) { - populated = populated.replace(new RegExp(`<${key}>\\b`, "g"), String(value)); + populated = populated.replace(new RegExp(`<${key}>`, "g"), String(value)); } return new normalisedURLPath_1.default(populated); }; diff --git a/lib/build/user.js b/lib/build/user.js index 75d18ba4f..9323abb66 100644 --- a/lib/build/user.js +++ b/lib/build/user.js @@ -88,9 +88,7 @@ class User { this.loginMethods = user.loginMethods.map((m) => new LoginMethod(m)); } static fromApi(apiUser) { - return new User( - Object.assign(Object.assign({}, apiUser), { id: new recipeUserId_1.default(apiUser.id).getAsString() }) - ); + return new User(apiUser); } toJson() { return { diff --git a/lib/ts/core/versions/5.3/schema.d.ts b/lib/ts/core/versions/5.3/schema.d.ts index 993ca1677..fedbf8f7c 100644 --- a/lib/ts/core/versions/5.3/schema.d.ts +++ b/lib/ts/core/versions/5.3/schema.d.ts @@ -5,6 +5,7 @@ // @ts-nocheck // @ts-nocheck // @ts-nocheck +// @ts-nocheck /** * This file was auto-generated by openapi-typescript. * Do not make direct changes to the file. diff --git a/lib/ts/user.ts b/lib/ts/user.ts index 156e92ccf..c284b586b 100644 --- a/lib/ts/user.ts +++ b/lib/ts/user.ts @@ -121,10 +121,7 @@ export class User implements UserType { } static fromApi(apiUser: Omit & { id: string }): User { - return new User({ - ...apiUser, - id: new RecipeUserId(apiUser.id).getAsString(), - }); + return new User(apiUser); } toJson(): JSONObject { From 95869015aac6452f333911e69f1a391e15c4d569 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Fri, 16 May 2025 12:40:49 +0530 Subject: [PATCH 44/64] Add support for auto generating paths.ts --- lib/ts/core/paths.ts | 32 ++--------------- scripts/generate-schema.js | 71 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 29 deletions(-) diff --git a/lib/ts/core/paths.ts b/lib/ts/core/paths.ts index b7f4883fd..8757686b9 100644 --- a/lib/ts/core/paths.ts +++ b/lib/ts/core/paths.ts @@ -1,29 +1,3 @@ -import { paths as pathsV5_3 } from "./versions/5.3/schema"; - -// NOTE: Uncomment the following code if there -// are more than one CDI versions being used. -// E.g. usage: export type paths = MergePaths; - -// type MergePaths = { -// [K in keyof P1 | keyof P2]: -// K extends keyof P1 -// ? K extends keyof P2 -// ? MergeMethods -// : P1[K] -// : K extends keyof P2 -// ? P2[K] -// : never; -// }; - -// type MergeMethods = { -// [K in keyof M1 | keyof M2]: -// K extends keyof M1 -// ? K extends keyof M2 -// ? M1[K] | M2[K] -// : M1[K] -// : K extends keyof M2 -// ? M2[K] -// : never; -// }; - -export type paths = pathsV5_3; +/* This file was auto-generated by scripts/generate-schema.js */ +import { paths } from "./versions/5.3/schema"; +export { paths }; diff --git a/scripts/generate-schema.js b/scripts/generate-schema.js index b11dee10f..edf456ee3 100644 --- a/scripts/generate-schema.js +++ b/scripts/generate-schema.js @@ -39,6 +39,8 @@ async function processLocalSpec(filePath, version) { await fs.writeFile(outputPath, schemaContent, "utf-8"); console.log(`✅ Generated and cleaned schema for local version ${version}`); + + console.log("⚠️ Skipping remote specs generation for local version"); } async function processRemoteSpecs() { @@ -92,9 +94,78 @@ async function processRemoteSpecs() { console.log("✅ Specs directory deleted."); } + await generatePathsFile(versions); + console.log("✅ Generated paths.ts for remote versions"); + console.log("🎉 All done!"); } +async function generatePathsFile(versions) { + const outputPath = path.join(libDir, "..", "paths.ts"); + + if (versions.length === 0) { + console.warn("⚠️ No versions found — skipping paths.ts generation."); + return; + } + + if (versions.length === 1) { + const singleTemplate = (version) => `/* This file was auto-generated by scripts/generate-schema.js */ +import { paths } from "./versions/${version}/schema"; +export { paths }; +`; + + await fs.writeFile(outputPath, singleTemplate(versions[0]), "utf-8"); + console.log(`✅ Created single-version paths.ts for ${versions[0]}`); + } else { + const imports = versions + .map((v) => `import { paths as pathsV${v.replace(/\./g, "_")} } from "./versions/${v}/schema";`) + .join("\n"); + + const mergedTemplate = `type MergeMethods = { + [K in keyof M1 | keyof M2]: K extends keyof M1 + ? K extends keyof M2 + ? M1[K] | M2[K] + : M1[K] + : K extends keyof M2 + ? M2[K] + : never; +}; + +type MergePaths = { + [K in keyof P1 | keyof P2]: K extends keyof P1 + ? K extends keyof P2 + ? MergeMethods + : P1[K] + : K extends keyof P2 + ? P2[K] + : never; +}; + +type MergeManyPaths[]> = T extends [infer First, ...infer Rest] + ? First extends Record + ? Rest extends Record[] + ? MergePaths> + : First + : never + : {}; +`; + + const mergedTypes = `export type paths = MergeManyPaths<[${versions + .map((v) => `pathsV${v.replace(/\./g, "_")}`) + .join(", ")}]>;`; + + const fullContent = `/* This file was auto-generated by scripts/generate-schema.js */ +${imports} + +${mergedTemplate} +${mergedTypes} +`; + + await fs.writeFile(outputPath, fullContent, "utf-8"); + console.log(`✅ Created merged paths.ts for ${versions.length} versions`); + } +} + function execPromise(command) { return new Promise((resolve, reject) => { exec(command, (err, stdout, stderr) => { From c328ab62b0f0346517589d6e513904545384d86b Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Fri, 16 May 2025 12:42:06 +0530 Subject: [PATCH 45/64] Add build files after changes --- lib/build/core/paths.d.ts | 4 ++-- lib/build/querier.d.ts | 13 +++++++------ lib/ts/core/versions/5.3/schema.d.ts | 1 + 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/build/core/paths.d.ts b/lib/build/core/paths.d.ts index 59a51999c..8a800ab02 100644 --- a/lib/build/core/paths.d.ts +++ b/lib/build/core/paths.d.ts @@ -1,3 +1,3 @@ // @ts-nocheck -import { paths as pathsV5_3 } from "./versions/5.3/schema"; -export declare type paths = pathsV5_3; +import { paths } from "./versions/5.3/schema"; +export { paths }; diff --git a/lib/build/querier.d.ts b/lib/build/querier.d.ts index 97d683020..236f07327 100644 --- a/lib/build/querier.d.ts +++ b/lib/build/querier.d.ts @@ -4,6 +4,7 @@ import NormalisedURLPath from "./normalisedURLPath"; import { UserContext } from "./types"; import { NetworkInterceptor } from "./types"; import { PathParam, RequestBody, ResponseBody } from "./core/types"; +import { paths } from "./core/paths"; export declare class Querier { private static initCalled; private static hosts; @@ -31,7 +32,7 @@ export declare class Querier { disableCache?: boolean ): void; private getPath; - sendPostRequest:

( + sendPostRequest:

( template_path: PathParam

, body: RequestBody, userContext: UserContext @@ -40,7 +41,7 @@ export declare class Querier { ? Required> : never >; - sendDeleteRequest:

( + sendDeleteRequest:

( template_path: PathParam

, body: RequestBody, params: any | undefined, @@ -50,7 +51,7 @@ export declare class Querier { ? Required> : never >; - sendGetRequest:

( + sendGetRequest:

( template_path: PathParam

, params: Record, userContext: UserContext @@ -59,7 +60,7 @@ export declare class Querier { ? Required> : never >; - sendGetRequestWithResponseHeaders:

( + sendGetRequestWithResponseHeaders:

( template_path: PathParam

, params: Record, inpHeaders: Record | undefined, @@ -70,7 +71,7 @@ export declare class Querier { : never; headers: Headers; }>; - sendPutRequest:

( + sendPutRequest:

( template_path: PathParam

, body: RequestBody, params: Record, @@ -80,7 +81,7 @@ export declare class Querier { ? Required> : never >; - sendPatchRequest:

( + sendPatchRequest:

( template_path: PathParam

, body: RequestBody, userContext: UserContext diff --git a/lib/ts/core/versions/5.3/schema.d.ts b/lib/ts/core/versions/5.3/schema.d.ts index fedbf8f7c..7aa76c2e7 100644 --- a/lib/ts/core/versions/5.3/schema.d.ts +++ b/lib/ts/core/versions/5.3/schema.d.ts @@ -6,6 +6,7 @@ // @ts-nocheck // @ts-nocheck // @ts-nocheck +// @ts-nocheck /** * This file was auto-generated by openapi-typescript. * Do not make direct changes to the file. From df9c3891dcf86bbef48fc8f6d7ef5674a5fc6548 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Fri, 16 May 2025 12:48:55 +0530 Subject: [PATCH 46/64] Add comment explaining fromApi method in User --- lib/build/user.d.ts | 6 ++++++ lib/build/user.js | 6 ++++++ lib/ts/core/versions/5.3/schema.d.ts | 1 + lib/ts/user.ts | 6 ++++++ 4 files changed, 19 insertions(+) diff --git a/lib/build/user.d.ts b/lib/build/user.d.ts index 72e7a2d59..fdf9c682f 100644 --- a/lib/build/user.d.ts +++ b/lib/build/user.d.ts @@ -35,6 +35,12 @@ export declare class User implements UserType { readonly loginMethods: LoginMethod[]; readonly timeJoined: number; constructor(user: UserWithoutHelperFunctions); + /** + * This function is used to create a User object from the API response. + * + * @param apiUser - The API response from the user endpoint. + * @returns A User object. + */ static fromApi( apiUser: Omit & { id: string; diff --git a/lib/build/user.js b/lib/build/user.js index 9323abb66..f2abee3ef 100644 --- a/lib/build/user.js +++ b/lib/build/user.js @@ -87,6 +87,12 @@ class User { this.timeJoined = user.timeJoined; this.loginMethods = user.loginMethods.map((m) => new LoginMethod(m)); } + /** + * This function is used to create a User object from the API response. + * + * @param apiUser - The API response from the user endpoint. + * @returns A User object. + */ static fromApi(apiUser) { return new User(apiUser); } diff --git a/lib/ts/core/versions/5.3/schema.d.ts b/lib/ts/core/versions/5.3/schema.d.ts index 7aa76c2e7..6e3c3adac 100644 --- a/lib/ts/core/versions/5.3/schema.d.ts +++ b/lib/ts/core/versions/5.3/schema.d.ts @@ -7,6 +7,7 @@ // @ts-nocheck // @ts-nocheck // @ts-nocheck +// @ts-nocheck /** * This file was auto-generated by openapi-typescript. * Do not make direct changes to the file. diff --git a/lib/ts/user.ts b/lib/ts/user.ts index c284b586b..0abe3eecc 100644 --- a/lib/ts/user.ts +++ b/lib/ts/user.ts @@ -120,6 +120,12 @@ export class User implements UserType { this.loginMethods = user.loginMethods.map((m) => new LoginMethod(m)); } + /** + * This function is used to create a User object from the API response. + * + * @param apiUser - The API response from the user endpoint. + * @returns A User object. + */ static fromApi(apiUser: Omit & { id: string }): User { return new User(apiUser); } From 0cd1a507cdd1dc013a80fb49a62c19e7f929f34c Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Fri, 16 May 2025 13:33:07 +0530 Subject: [PATCH 47/64] Fix type mismatch in multitenancy routes --- .../recipe/multitenancy/recipeImplementation.js | 14 +------------- lib/ts/core/versions/5.3/schema.d.ts | 13 ++----------- lib/ts/recipe/multitenancy/recipeImplementation.ts | 7 +------ 3 files changed, 4 insertions(+), 30 deletions(-) diff --git a/lib/build/recipe/multitenancy/recipeImplementation.js b/lib/build/recipe/multitenancy/recipeImplementation.js index 50e21c8cb..3bf1dcd2c 100644 --- a/lib/build/recipe/multitenancy/recipeImplementation.js +++ b/lib/build/recipe/multitenancy/recipeImplementation.js @@ -9,19 +9,7 @@ function getRecipeInterface(querier) { createOrUpdateTenant: async function ({ tenantId, config, userContext }) { let response = await querier.sendPutRequest( "/recipe/multitenancy/tenant/v2", - Object.assign( - { tenantId }, - { - config: Object.assign(Object.assign({}, config), { - firstFactors: - (config === null || config === void 0 ? void 0 : config.firstFactors) === null - ? undefined - : config === null || config === void 0 - ? void 0 - : config.firstFactors, - }), - } - ), + Object.assign({ tenantId }, config), {}, userContext ); diff --git a/lib/ts/core/versions/5.3/schema.d.ts b/lib/ts/core/versions/5.3/schema.d.ts index 6e3c3adac..52696142c 100644 --- a/lib/ts/core/versions/5.3/schema.d.ts +++ b/lib/ts/core/versions/5.3/schema.d.ts @@ -1,13 +1,4 @@ // @ts-nocheck -// @ts-nocheck -// @ts-nocheck -// @ts-nocheck -// @ts-nocheck -// @ts-nocheck -// @ts-nocheck -// @ts-nocheck -// @ts-nocheck -// @ts-nocheck /** * This file was auto-generated by openapi-typescript. * Do not make direct changes to the file. @@ -3372,8 +3363,8 @@ export interface components { coreConfig?: Record; }; tenantInputV2: { - firstFactors?: components["schemas"]["firstFactors"]; - requiredSecondaryFactors?: components["schemas"]["requiredSecondaryFactors"]; + firstFactors?: components["schemas"]["firstFactors"] | null; + requiredSecondaryFactors?: components["schemas"]["requiredSecondaryFactors"] | null; coreConfig?: Record; }; tenantConfig: { diff --git a/lib/ts/recipe/multitenancy/recipeImplementation.ts b/lib/ts/recipe/multitenancy/recipeImplementation.ts index e22df3a58..316fcf39b 100644 --- a/lib/ts/recipe/multitenancy/recipeImplementation.ts +++ b/lib/ts/recipe/multitenancy/recipeImplementation.ts @@ -13,12 +13,7 @@ export default function getRecipeInterface(querier: Querier): RecipeInterface { "/recipe/multitenancy/tenant/v2", { tenantId, - ...{ - config: { - ...config, - firstFactors: config?.firstFactors === null ? undefined : config?.firstFactors, - }, - }, + ...config, }, {}, userContext From d08660f2fe5ec7fbb3eed0e35d8cd0d5795e8d35 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Fri, 16 May 2025 13:52:11 +0530 Subject: [PATCH 48/64] Fix name of template path to camelCase --- CHANGELOG.md | 4 ---- lib/ts/querier.ts | 24 ++++++++++++------------ 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 680c3d538..c20354587 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,10 +19,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Refactors querier to use dynamic request body and response body types inference -## [22.2.0] - 2025-05-09 - -- Refactors querier to use dynamic request body and response body types inference - ## [22.1.0] - 2025-04-04 - Adds support for using `code_challenge_method` from OIDC provider response to determine whether to use PKCE or not. diff --git a/lib/ts/querier.ts b/lib/ts/querier.ts index a5c4fe2da..a71a4fccc 100644 --- a/lib/ts/querier.ts +++ b/lib/ts/querier.ts @@ -169,12 +169,12 @@ export class Querier { // path should start with "/" sendPostRequest = async

( - template_path: PathParam

, + templatePath: PathParam

, body: RequestBody, userContext: UserContext ): Promise> => { this.invalidateCoreCallCache(userContext); - const path = this.getPath(template_path); + const path = this.getPath(templatePath); const { body: respBody } = await this.sendRequestHelper( path, @@ -227,13 +227,13 @@ export class Querier { // path should start with "/" sendDeleteRequest = async

( - template_path: PathParam

, + templatePath: PathParam

, body: RequestBody, params: any | undefined, userContext: UserContext ): Promise> => { this.invalidateCoreCallCache(userContext); - const path = this.getPath(template_path); + const path = this.getPath(templatePath); const { body: respBody } = await this.sendRequestHelper( path, @@ -291,11 +291,11 @@ export class Querier { // path should start with "/" sendGetRequest = async

( - template_path: PathParam

, + templatePath: PathParam

, params: Record, userContext: UserContext ): Promise> => { - const path = this.getPath(template_path); + const path = this.getPath(templatePath); const { body: respBody } = await this.sendRequestHelper( path, "GET", @@ -403,12 +403,12 @@ export class Querier { }; sendGetRequestWithResponseHeaders = async

( - template_path: PathParam

, + templatePath: PathParam

, params: Record, inpHeaders: Record | undefined, userContext: UserContext ): Promise<{ body: ResponseBody; headers: Headers }> => { - const path = this.getPath(template_path); + const path = this.getPath(templatePath); return await this.sendRequestHelper( path, "GET", @@ -461,13 +461,13 @@ export class Querier { // path should start with "/" sendPutRequest = async

( - template_path: PathParam

, + templatePath: PathParam

, body: RequestBody, params: Record, userContext: UserContext ): Promise> => { this.invalidateCoreCallCache(userContext); - const path = this.getPath(template_path); + const path = this.getPath(templatePath); const { body: respBody } = await this.sendRequestHelper( path, @@ -524,12 +524,12 @@ export class Querier { // path should start with "/" sendPatchRequest = async

( - template_path: PathParam

, + templatePath: PathParam

, body: RequestBody, userContext: UserContext ): Promise> => { this.invalidateCoreCallCache(userContext); - const path = this.getPath(template_path); + const path = this.getPath(templatePath); const { body: respBody } = await this.sendRequestHelper( path, From ab48e5cbbc9ea742d6a26f3ddb6c5f876bedfac6 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Fri, 16 May 2025 13:53:45 +0530 Subject: [PATCH 49/64] Fix querier change in build --- lib/build/querier.d.ts | 12 ++++++------ lib/build/querier.js | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/build/querier.d.ts b/lib/build/querier.d.ts index 236f07327..fb8933c90 100644 --- a/lib/build/querier.d.ts +++ b/lib/build/querier.d.ts @@ -33,7 +33,7 @@ export declare class Querier { ): void; private getPath; sendPostRequest:

( - template_path: PathParam

, + templatePath: PathParam

, body: RequestBody, userContext: UserContext ) => Promise< @@ -42,7 +42,7 @@ export declare class Querier { : never >; sendDeleteRequest:

( - template_path: PathParam

, + templatePath: PathParam

, body: RequestBody, params: any | undefined, userContext: UserContext @@ -52,7 +52,7 @@ export declare class Querier { : never >; sendGetRequest:

( - template_path: PathParam

, + templatePath: PathParam

, params: Record, userContext: UserContext ) => Promise< @@ -61,7 +61,7 @@ export declare class Querier { : never >; sendGetRequestWithResponseHeaders:

( - template_path: PathParam

, + templatePath: PathParam

, params: Record, inpHeaders: Record | undefined, userContext: UserContext @@ -72,7 +72,7 @@ export declare class Querier { headers: Headers; }>; sendPutRequest:

( - template_path: PathParam

, + templatePath: PathParam

, body: RequestBody, params: Record, userContext: UserContext @@ -82,7 +82,7 @@ export declare class Querier { : never >; sendPatchRequest:

( - template_path: PathParam

, + templatePath: PathParam

, body: RequestBody, userContext: UserContext ) => Promise< diff --git a/lib/build/querier.js b/lib/build/querier.js index a35fd770d..04eeb5096 100644 --- a/lib/build/querier.js +++ b/lib/build/querier.js @@ -108,10 +108,10 @@ class Querier { return new normalisedURLPath_1.default(populated); }; // path should start with "/" - this.sendPostRequest = async (template_path, body, userContext) => { + this.sendPostRequest = async (templatePath, body, userContext) => { var _a; this.invalidateCoreCallCache(userContext); - const path = this.getPath(template_path); + const path = this.getPath(templatePath); const { body: respBody } = await this.sendRequestHelper( path, "POST", @@ -154,10 +154,10 @@ class Querier { return respBody; }; // path should start with "/" - this.sendDeleteRequest = async (template_path, body, params, userContext) => { + this.sendDeleteRequest = async (templatePath, body, params, userContext) => { var _a; this.invalidateCoreCallCache(userContext); - const path = this.getPath(template_path); + const path = this.getPath(templatePath); const { body: respBody } = await this.sendRequestHelper( path, "DELETE", @@ -204,9 +204,9 @@ class Querier { return respBody; }; // path should start with "/" - this.sendGetRequest = async (template_path, params, userContext) => { + this.sendGetRequest = async (templatePath, params, userContext) => { var _a; - const path = this.getPath(template_path); + const path = this.getPath(templatePath); const { body: respBody } = await this.sendRequestHelper( path, "GET", @@ -308,9 +308,9 @@ class Querier { ); return respBody; }; - this.sendGetRequestWithResponseHeaders = async (template_path, params, inpHeaders, userContext) => { + this.sendGetRequestWithResponseHeaders = async (templatePath, params, inpHeaders, userContext) => { var _a; - const path = this.getPath(template_path); + const path = this.getPath(templatePath); return await this.sendRequestHelper( path, "GET", @@ -354,10 +354,10 @@ class Querier { ); }; // path should start with "/" - this.sendPutRequest = async (template_path, body, params, userContext) => { + this.sendPutRequest = async (templatePath, body, params, userContext) => { var _a; this.invalidateCoreCallCache(userContext); - const path = this.getPath(template_path); + const path = this.getPath(templatePath); const { body: respBody } = await this.sendRequestHelper( path, "PUT", @@ -403,10 +403,10 @@ class Querier { return respBody; }; // path should start with "/" - this.sendPatchRequest = async (template_path, body, userContext) => { + this.sendPatchRequest = async (templatePath, body, userContext) => { var _a; this.invalidateCoreCallCache(userContext); - const path = this.getPath(template_path); + const path = this.getPath(templatePath); const { body: respBody } = await this.sendRequestHelper( path, "PATCH", From 896f1630e63b399f9697da8b07054ee7a28c718f Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Mon, 2 Jun 2025 15:19:56 +0530 Subject: [PATCH 50/64] Fix use of a param key in token revoke endpoint --- lib/build/recipe/oauth2provider/recipeImplementation.js | 2 +- lib/ts/core/versions/5.3/schema.d.ts | 2 +- lib/ts/recipe/oauth2provider/recipeImplementation.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/build/recipe/oauth2provider/recipeImplementation.js b/lib/build/recipe/oauth2provider/recipeImplementation.js index c397127d3..84585b789 100644 --- a/lib/build/recipe/oauth2provider/recipeImplementation.js +++ b/lib/build/recipe/oauth2provider/recipeImplementation.js @@ -712,7 +712,7 @@ function getRecipeInterface( revokeTokensByClientId: async function (input) { await querier.sendPostRequest( "/recipe/oauth/tokens/revoke", - { clientId: input.clientId }, + { client_id: input.clientId }, input.userContext ); return { status: "OK" }; diff --git a/lib/ts/core/versions/5.3/schema.d.ts b/lib/ts/core/versions/5.3/schema.d.ts index 52696142c..1e0bb42da 100644 --- a/lib/ts/core/versions/5.3/schema.d.ts +++ b/lib/ts/core/versions/5.3/schema.d.ts @@ -9847,7 +9847,7 @@ export interface operations { content: { "application/json": { /** @example stcl_fed7cff0-cc6e-406e-b7a6-766148675a4a */ - clientId?: string; + client_id?: string; }; }; }; diff --git a/lib/ts/recipe/oauth2provider/recipeImplementation.ts b/lib/ts/recipe/oauth2provider/recipeImplementation.ts index 4f52728dc..340e38653 100644 --- a/lib/ts/recipe/oauth2provider/recipeImplementation.ts +++ b/lib/ts/recipe/oauth2provider/recipeImplementation.ts @@ -718,7 +718,7 @@ export default function getRecipeInterface( revokeTokensByClientId: async function (this: RecipeInterface, input) { await querier.sendPostRequest( "/recipe/oauth/tokens/revoke", - { clientId: input.clientId }, + { client_id: input.clientId }, input.userContext ); From 38ac57c581a28665db74ca76f33c4a62b7211457 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Tue, 3 Jun 2025 11:58:02 +0530 Subject: [PATCH 51/64] Fix issues of unhandled OAUTH_ERROR in oauth accept/reject endpoint --- .../recipe/oauth2provider/api/utils.d.ts | 4 ++- lib/build/recipe/oauth2provider/api/utils.js | 15 ++++++++++ .../oauth2provider/recipeImplementation.js | 8 +++++ lib/build/recipe/oauth2provider/types.d.ts | 28 ++++++++++++++---- lib/ts/core/versions/5.3/schema.d.ts | 24 ++++++++------- lib/ts/recipe/oauth2provider/api/utils.ts | 29 +++++++++++++++++-- .../oauth2provider/recipeImplementation.ts | 21 ++++++++++++-- lib/ts/recipe/oauth2provider/types.ts | 25 +++++++++++++--- 8 files changed, 129 insertions(+), 25 deletions(-) diff --git a/lib/build/recipe/oauth2provider/api/utils.d.ts b/lib/build/recipe/oauth2provider/api/utils.d.ts index be94270dc..695aab13a 100644 --- a/lib/build/recipe/oauth2provider/api/utils.d.ts +++ b/lib/build/recipe/oauth2provider/api/utils.d.ts @@ -1,7 +1,7 @@ // @ts-nocheck import { UserContext } from "../../../types"; import { SessionContainerInterface } from "../../session/types"; -import { ErrorOAuth2, RecipeInterface } from "../types"; +import { ErrorOAuth2, RecipeInterface, OauthError } from "../types"; export declare function loginGET({ recipeImplementation, loginChallenge, @@ -20,6 +20,7 @@ export declare function loginGET({ isDirectCall: boolean; }): Promise< | ErrorOAuth2 + | OauthError | { status: string; redirectTo: string; @@ -54,6 +55,7 @@ export declare function handleLoginInternalRedirects({ cookies?: string[]; } | ErrorOAuth2 + | OauthError >; export declare function handleLogoutInternalRedirects({ response, diff --git a/lib/build/recipe/oauth2provider/api/utils.js b/lib/build/recipe/oauth2provider/api/utils.js index 859ed1d24..3b4f14e3b 100644 --- a/lib/build/recipe/oauth2provider/api/utils.js +++ b/lib/build/recipe/oauth2provider/api/utils.js @@ -58,6 +58,9 @@ async function loginGET({ }, userContext, }); + if (reject.status === "OAUTH_ERROR") { + return reject; + } return { status: "REDIRECT", redirectTo: reject.redirectTo, cookies }; } if (maxAgeParsed < 0) { @@ -70,6 +73,9 @@ async function loginGET({ }, userContext, }); + if (reject.status === "OAUTH_ERROR") { + return reject; + } return { status: "REDIRECT", redirectTo: reject.redirectTo, cookies }; } } catch (_c) { @@ -82,6 +88,9 @@ async function loginGET({ }, userContext, }); + if (reject.status === "OAUTH_ERROR") { + return reject; + } return { status: "REDIRECT", redirectTo: reject.redirectTo, cookies }; } } @@ -101,6 +110,9 @@ async function loginGET({ identityProviderSessionId: session.getHandle(), userContext, }); + if (accept.status === "OAUTH_ERROR") { + return accept; + } return { status: "REDIRECT", redirectTo: accept.redirectTo, cookies: cookies }; } if (shouldTryRefresh && promptParam !== "login") { @@ -124,6 +136,9 @@ async function loginGET({ }, userContext, }); + if (reject.status === "OAUTH_ERROR") { + return reject; + } return { status: "REDIRECT", redirectTo: reject.redirectTo, cookies }; } return { diff --git a/lib/build/recipe/oauth2provider/recipeImplementation.js b/lib/build/recipe/oauth2provider/recipeImplementation.js index 84585b789..374602366 100644 --- a/lib/build/recipe/oauth2provider/recipeImplementation.js +++ b/lib/build/recipe/oauth2provider/recipeImplementation.js @@ -128,8 +128,12 @@ function getRecipeInterface( }, input.userContext ); + if (resp.status === "OAUTH_ERROR") { + return resp; + } return { redirectTo: getUpdatedRedirectTo(appInfo, resp.redirectTo), + status: "OK", }; }, rejectLoginRequest: async function (input) { @@ -145,8 +149,12 @@ function getRecipeInterface( }, input.userContext ); + if (resp.status === "OAUTH_ERROR") { + return resp; + } return { redirectTo: getUpdatedRedirectTo(appInfo, resp.redirectTo), + status: "OK", }; }, getConsentRequest: async function (input) { diff --git a/lib/build/recipe/oauth2provider/types.d.ts b/lib/build/recipe/oauth2provider/types.d.ts index 34805fb3b..ceb0241ad 100644 --- a/lib/build/recipe/oauth2provider/types.d.ts +++ b/lib/build/recipe/oauth2provider/types.d.ts @@ -38,6 +38,12 @@ export declare type ErrorOAuth2 = { errorDescription: string; statusCode?: number; }; +export declare type OauthError = { + status: "OAUTH_ERROR"; + error: string; + errorDescription: string; + statusCode: number; +}; export declare type ConsentRequest = { acr?: string; amr?: string[]; @@ -147,12 +153,20 @@ export declare type RecipeInterface = { identityProviderSessionId?: string; subject: string; userContext: UserContext; - }): Promise<{ - redirectTo: string; - }>; - rejectLoginRequest(input: { challenge: string; error: ErrorOAuth2; userContext: UserContext }): Promise<{ - redirectTo: string; - }>; + }): Promise< + | { + redirectTo: string; + status: "OK"; + } + | OauthError + >; + rejectLoginRequest(input: { challenge: string; error: ErrorOAuth2; userContext: UserContext }): Promise< + | { + redirectTo: string; + status: "OK"; + } + | OauthError + >; getOAuth2Client(input: { clientId: string; userContext: UserContext }): Promise< | { status: "OK"; @@ -356,6 +370,7 @@ export declare type APIInterface = { cookies?: string[]; } | ErrorOAuth2 + | OauthError | GeneralErrorResponse >); authGET: @@ -373,6 +388,7 @@ export declare type APIInterface = { cookies?: string[]; } | ErrorOAuth2 + | OauthError | GeneralErrorResponse >); tokenPOST: diff --git a/lib/ts/core/versions/5.3/schema.d.ts b/lib/ts/core/versions/5.3/schema.d.ts index 1e0bb42da..1c967f23a 100644 --- a/lib/ts/core/versions/5.3/schema.d.ts +++ b/lib/ts/core/versions/5.3/schema.d.ts @@ -9574,11 +9574,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example {apiDomain}/oauth/login?... */ - redirectTo?: string; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example {apiDomain}/oauth/login?... */ + redirectTo?: string; + } + | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9626,11 +9628,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example {apiDomain}/oauth/login?... */ - redirectTo?: string; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example {apiDomain}/oauth/login?... */ + redirectTo?: string; + } + | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; diff --git a/lib/ts/recipe/oauth2provider/api/utils.ts b/lib/ts/recipe/oauth2provider/api/utils.ts index 29f9c0e60..e69ce546f 100644 --- a/lib/ts/recipe/oauth2provider/api/utils.ts +++ b/lib/ts/recipe/oauth2provider/api/utils.ts @@ -4,7 +4,7 @@ import { DEFAULT_TENANT_ID } from "../../multitenancy/constants"; import { getSessionInformation } from "../../session"; import { SessionContainerInterface } from "../../session/types"; import { AUTH_PATH, LOGIN_PATH, END_SESSION_PATH } from "../constants"; -import { ErrorOAuth2, RecipeInterface } from "../types"; +import { ErrorOAuth2, RecipeInterface, OauthError } from "../types"; import setCookieParser from "set-cookie-parser"; // API implementation for the loginGET function. @@ -58,6 +58,11 @@ export async function loginGET({ }, userContext, }); + + if (reject.status === "OAUTH_ERROR") { + return reject; + } + return { status: "REDIRECT", redirectTo: reject.redirectTo, cookies }; } @@ -71,6 +76,11 @@ export async function loginGET({ }, userContext, }); + + if (reject.status === "OAUTH_ERROR") { + return reject; + } + return { status: "REDIRECT", redirectTo: reject.redirectTo, cookies }; } } catch { @@ -83,6 +93,11 @@ export async function loginGET({ }, userContext, }); + + if (reject.status === "OAUTH_ERROR") { + return reject; + } + return { status: "REDIRECT", redirectTo: reject.redirectTo, cookies }; } } @@ -102,6 +117,11 @@ export async function loginGET({ identityProviderSessionId: session.getHandle(), userContext, }); + + if (accept.status === "OAUTH_ERROR") { + return accept; + } + return { status: "REDIRECT", redirectTo: accept.redirectTo, cookies: cookies }; } @@ -126,6 +146,11 @@ export async function loginGET({ }, userContext, }); + + if (reject.status === "OAUTH_ERROR") { + return reject; + } + return { status: "REDIRECT", redirectTo: reject.redirectTo, cookies }; } @@ -212,7 +237,7 @@ export async function handleLoginInternalRedirects({ shouldTryRefresh: boolean; cookie?: string; userContext: UserContext; -}): Promise<{ redirectTo: string; cookies?: string[] } | ErrorOAuth2> { +}): Promise<{ redirectTo: string; cookies?: string[] } | ErrorOAuth2 | OauthError> { if (!isLoginInternalRedirect(response.redirectTo)) { return response; } diff --git a/lib/ts/recipe/oauth2provider/recipeImplementation.ts b/lib/ts/recipe/oauth2provider/recipeImplementation.ts index 340e38653..67656dfa5 100644 --- a/lib/ts/recipe/oauth2provider/recipeImplementation.ts +++ b/lib/ts/recipe/oauth2provider/recipeImplementation.ts @@ -22,6 +22,7 @@ import { ConsentRequest, PayloadBuilderFunction, UserInfoBuilderFunction, + OauthError, } from "./types"; import { OAuth2Client } from "./OAuth2Client"; import { getUser } from "../.."; @@ -85,7 +86,10 @@ export default function getRecipeInterface( subject: resp.subject, }; }, - acceptLoginRequest: async function (this: RecipeInterface, input): Promise<{ redirectTo: string }> { + acceptLoginRequest: async function ( + this: RecipeInterface, + input + ): Promise<{ redirectTo: string; status: "OK" } | OauthError> { const resp = await querier.sendPutRequest( "/recipe/oauth/auth/requests/login/accept", { @@ -102,11 +106,19 @@ export default function getRecipeInterface( input.userContext ); + if (resp.status === "OAUTH_ERROR") { + return resp; + } + return { redirectTo: getUpdatedRedirectTo(appInfo, resp.redirectTo), + status: "OK", }; }, - rejectLoginRequest: async function (this: RecipeInterface, input): Promise<{ redirectTo: string }> { + rejectLoginRequest: async function ( + this: RecipeInterface, + input + ): Promise<{ redirectTo: string; status: "OK" } | OauthError> { const resp = await querier.sendPutRequest( "/recipe/oauth/auth/requests/login/reject", { @@ -120,8 +132,13 @@ export default function getRecipeInterface( input.userContext ); + if (resp.status === "OAUTH_ERROR") { + return resp; + } + return { redirectTo: getUpdatedRedirectTo(appInfo, resp.redirectTo), + status: "OK", }; }, getConsentRequest: async function (this: RecipeInterface, input): Promise { diff --git a/lib/ts/recipe/oauth2provider/types.ts b/lib/ts/recipe/oauth2provider/types.ts index 08f41f8d8..7e28c86ad 100644 --- a/lib/ts/recipe/oauth2provider/types.ts +++ b/lib/ts/recipe/oauth2provider/types.ts @@ -65,6 +65,21 @@ export type ErrorOAuth2 = { statusCode?: number; }; +export type OauthError = { + status: "OAUTH_ERROR"; + + // The error should follow the OAuth2 error format (e.g. invalid_request, login_required). + // Defaults to request_denied. + error: string; + + // Description of the error in a human readable format. + errorDescription: string; + + // Represents the HTTP status code of the error (e.g. 401 or 403) + // Defaults to 400 + statusCode: number; +}; + export type ConsentRequest = { // ACR represents the Authentication AuthorizationContext Class Reference value for this authentication session. You can use it to express that, for example, a user authenticated using two factor authentication. acr?: string; @@ -242,12 +257,12 @@ export type RecipeInterface = { // Subject is the user ID of the end-user that authenticated. subject: string; userContext: UserContext; - }): Promise<{ redirectTo: string }>; + }): Promise<{ redirectTo: string; status: "OK" } | OauthError>; rejectLoginRequest(input: { challenge: string; error: ErrorOAuth2; userContext: UserContext; - }): Promise<{ redirectTo: string }>; + }): Promise<{ redirectTo: string; status: "OK" } | OauthError>; getOAuth2Client(input: { clientId: string; userContext: UserContext }): Promise< | { @@ -425,7 +440,9 @@ export type APIInterface = { session?: SessionContainerInterface; shouldTryRefresh: boolean; userContext: UserContext; - }) => Promise<{ frontendRedirectTo: string; cookies?: string[] } | ErrorOAuth2 | GeneralErrorResponse>); + }) => Promise< + { frontendRedirectTo: string; cookies?: string[] } | ErrorOAuth2 | OauthError | GeneralErrorResponse + >); authGET: | undefined @@ -436,7 +453,7 @@ export type APIInterface = { shouldTryRefresh: boolean; options: APIOptions; userContext: UserContext; - }) => Promise<{ redirectTo: string; cookies?: string[] } | ErrorOAuth2 | GeneralErrorResponse>); + }) => Promise<{ redirectTo: string; cookies?: string[] } | ErrorOAuth2 | OauthError | GeneralErrorResponse>); tokenPOST: | undefined | ((input: { From 126ea18a1f1e5c4b83c6332068cf554b5a33d44c Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Wed, 4 Jun 2025 11:50:14 +0530 Subject: [PATCH 52/64] Fix issue with failing email verification test for thirdparty --- .github/workflows/tests-pass-check-pr.yml | 24 ------------------- .../recipe/thirdparty/recipeImplementation.js | 5 +++- .../recipe/thirdparty/recipeImplementation.ts | 8 +++++-- 3 files changed, 10 insertions(+), 27 deletions(-) delete mode 100644 .github/workflows/tests-pass-check-pr.yml diff --git a/.github/workflows/tests-pass-check-pr.yml b/.github/workflows/tests-pass-check-pr.yml deleted file mode 100644 index cfa2cbaec..000000000 --- a/.github/workflows/tests-pass-check-pr.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: 'Check if "Run tests" action succeeded' - -on: - pull_request: - types: - - opened - - reopened - - edited - - synchronize - -jobs: - pr-run-test-action: - name: Check if "Run tests" action succeeded - timeout-minutes: 60 - concurrency: - group: ${{ github.head_ref }} - cancel-in-progress: true - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: node install - run: cd ./.github/helpers && npm i - - name: Calling github API - run: cd ./.github/helpers && GITHUB_TOKEN=${{ github.token }} REPO=${{ github.repository }} RUN_ID=${{ github.run_id }} BRANCH=${{ github.head_ref }} JOB_ID=${{ github.job }} SOURCE_OWNER=${{ github.event.pull_request.head.repo.owner.login }} CURRENT_SHA=${{ github.event.pull_request.head.sha }} node node_modules/github-workflow-helpers/test-pass-check-pr.js diff --git a/lib/build/recipe/thirdparty/recipeImplementation.js b/lib/build/recipe/thirdparty/recipeImplementation.js index 5dcc2ca48..480a37a38 100644 --- a/lib/build/recipe/thirdparty/recipeImplementation.js +++ b/lib/build/recipe/thirdparty/recipeImplementation.js @@ -68,13 +68,16 @@ function getRecipeImplementation(querier, providers) { if (response.status !== "OK") { return response; } - const userAsObj = user_1.User.fromApi(response.user); + let userAsObj = user_1.User.fromApi(response.user); const recipeUserIdAsObj = new recipeUserId_1.default(response.recipeUserId); await recipe_1.default.getInstance().verifyEmailForRecipeUserIfLinkedAccountsAreVerified({ user: userAsObj, recipeUserId: recipeUserIdAsObj, userContext, }); + // we do this so that we get the updated user (in case the above + // function updated the verification status) and can return that + userAsObj = await __1.getUser(recipeUserIdAsObj.getAsString(), userContext); const linkResult = await authUtils_1.AuthUtils.linkToSessionIfRequiredElseCreatePrimaryUserIdOrLinkByAccountInfo({ tenantId, diff --git a/lib/ts/recipe/thirdparty/recipeImplementation.ts b/lib/ts/recipe/thirdparty/recipeImplementation.ts index 08b43568c..ddc306353 100644 --- a/lib/ts/recipe/thirdparty/recipeImplementation.ts +++ b/lib/ts/recipe/thirdparty/recipeImplementation.ts @@ -4,7 +4,7 @@ import { findAndCreateProviderInstance, mergeProvidersFromCoreAndStatic } from " import AccountLinking from "../accountlinking/recipe"; import MultitenancyRecipe from "../multitenancy/recipe"; import RecipeUserId from "../../recipeUserId"; -import { listUsersByAccountInfo } from "../.."; +import { getUser, listUsersByAccountInfo } from "../.."; import { User as UserType } from "../../types"; import { User } from "../../user"; import { AuthUtils } from "../../authUtils"; @@ -71,7 +71,7 @@ export default function getRecipeImplementation(querier: Querier, providers: Pro return response; } - const userAsObj = User.fromApi(response.user); + let userAsObj = User.fromApi(response.user); const recipeUserIdAsObj = new RecipeUserId(response.recipeUserId); await AccountLinking.getInstance().verifyEmailForRecipeUserIfLinkedAccountsAreVerified({ @@ -80,6 +80,10 @@ export default function getRecipeImplementation(querier: Querier, providers: Pro userContext, }); + // we do this so that we get the updated user (in case the above + // function updated the verification status) and can return that + userAsObj = (await getUser(recipeUserIdAsObj.getAsString(), userContext))!; + const linkResult = await AuthUtils.linkToSessionIfRequiredElseCreatePrimaryUserIdOrLinkByAccountInfo({ tenantId, shouldTryLinkingWithSessionUser, From 8930783bb069b5a9922440f6647fde872d242942 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Wed, 4 Jun 2025 12:13:24 +0530 Subject: [PATCH 53/64] Add support for falling back to public as tenantId for webauthn options --- lib/build/recipe/webauthn/recipeImplementation.js | 2 +- lib/ts/recipe/webauthn/recipeImplementation.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/build/recipe/webauthn/recipeImplementation.js b/lib/build/recipe/webauthn/recipeImplementation.js index bfacd97c3..0e6b2f29d 100644 --- a/lib/build/recipe/webauthn/recipeImplementation.js +++ b/lib/build/recipe/webauthn/recipeImplementation.js @@ -387,7 +387,7 @@ function getRecipeInterface(querier, getWebauthnConfig) { { path: "//recipe/webauthn/options", params: { - tenantId: tenantId, + tenantId: tenantId || "public", }, }, { webauthnGeneratedOptionsId }, diff --git a/lib/ts/recipe/webauthn/recipeImplementation.ts b/lib/ts/recipe/webauthn/recipeImplementation.ts index b6adb661c..8c5cc7ba4 100644 --- a/lib/ts/recipe/webauthn/recipeImplementation.ts +++ b/lib/ts/recipe/webauthn/recipeImplementation.ts @@ -384,7 +384,7 @@ export default function getRecipeInterface( { path: "//recipe/webauthn/options", params: { - tenantId: tenantId, + tenantId: tenantId || "public", }, }, { webauthnGeneratedOptionsId }, From 089b289c5c1627cedab5e3d9dfb7871a991c04a1 Mon Sep 17 00:00:00 2001 From: Namit Nathwani Date: Wed, 4 Jun 2025 12:30:54 +0530 Subject: [PATCH 54/64] update: dumps server logs to directory --- .github/workflows/website-test.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/website-test.yml b/.github/workflows/website-test.yml index 62bb2a87b..2c7d6bf62 100644 --- a/.github/workflows/website-test.yml +++ b/.github/workflows/website-test.yml @@ -38,6 +38,14 @@ jobs: fdi-version: ${{ fromJSON(needs.define-versions.outputs.fdiVersions) }} steps: + - name: Setup ENVs + id: envs + run: | + APP_SERVER_LOG_DIR=${{ github.workspace }}/logs + echo "APP_SERVER_LOG_DIR=$APP_SERVER_LOG_DIR" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV" + + mkdir -p $APP_SERVER_LOG_DIR + - uses: actions/checkout@v4 with: path: supertokens-node @@ -69,8 +77,8 @@ jobs: run: | npm i - NODE_PORT=8080 node . &> app-server.log & - NODE_PORT=8082 node . &> app-server-cross-domain.log & + NODE_PORT=8080 node . &> ${{ steps.envs.outputs.APP_SERVER_LOG_DIR }}/app-server.log & + NODE_PORT=8082 node . &> ${{ steps.envs.outputs.APP_SERVER_LOG_DIR }}/app-server-cross-domain.log & - uses: supertokens/website-testing-action@main with: @@ -78,3 +86,4 @@ jobs: node-sdk-version: ${{ steps.versions.outputs.nodeTag }} path: supertokens-website check-name-suffix: "[Node=${{ matrix.node-version }}][FDI=${{ matrix.fdi-version }}]" + app-server-logs: ${{ steps.envs.outputs.APP_SERVER_LOG_DIR }} From 937528c6f067356541dbd2e622e38a72708de62b Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Wed, 4 Jun 2025 13:10:42 +0530 Subject: [PATCH 55/64] Fix querier calls in plain JS to use new signature --- test/frontendIntegration/index.js | 2 +- test/session/accessTokenVersions.test.js | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test/frontendIntegration/index.js b/test/frontendIntegration/index.js index 958384121..ad679f2ed 100644 --- a/test/frontendIntegration/index.js +++ b/test/frontendIntegration/index.js @@ -275,7 +275,7 @@ app.post("/login-2.18", async (req, res) => { const payload = req.body.payload || {}; const userId = req.body.userId; const legacySessionResp = await Querier.getNewInstanceOrThrowError().sendPostRequest( - new NormalisedURLPath("/recipe/session"), + "/recipe/session", { userId, enableAntiCsrf: false, diff --git a/test/session/accessTokenVersions.test.js b/test/session/accessTokenVersions.test.js index b4e5d03c7..66fee7c61 100644 --- a/test/session/accessTokenVersions.test.js +++ b/test/session/accessTokenVersions.test.js @@ -338,7 +338,7 @@ describe(`AccessToken versions: ${printPath("[test/session/accessTokenVersions.t // We can hard-code the structure of the request&response, since this is a fixed CDI version and it's not going to change Querier.apiVersion = "2.18"; const legacySessionResp = await Querier.getNewInstanceOrThrowError().sendPostRequest( - new NormalisedURLPath("/recipe/session"), + "/recipe/session", { userId: "test-user-id", enableAntiCsrf: false, @@ -439,7 +439,7 @@ describe(`AccessToken versions: ${printPath("[test/session/accessTokenVersions.t // We can hard-code the structure of the request&response, since this is a fixed CDI version and it's not going to change Querier.apiVersion = "2.18"; const legacySessionResp = await Querier.getNewInstanceOrThrowError().sendPostRequest( - new NormalisedURLPath("/recipe/session"), + "/recipe/session", { userId: "test-user-id", enableAntiCsrf: false, @@ -508,7 +508,7 @@ describe(`AccessToken versions: ${printPath("[test/session/accessTokenVersions.t // We can hard-code the structure of the request&response, since this is a fixed CDI version and it's not going to change Querier.apiVersion = "2.18"; const legacySessionResp = await Querier.getNewInstanceOrThrowError().sendPostRequest( - new NormalisedURLPath("/recipe/session"), + "/recipe/session", { userId: "test-user-id", enableAntiCsrf: false, @@ -567,7 +567,7 @@ describe(`AccessToken versions: ${printPath("[test/session/accessTokenVersions.t // We can hard-code the structure of the request&response, since this is a fixed CDI version and it's not going to change Querier.apiVersion = "2.18"; const legacySessionResp = await Querier.getNewInstanceOrThrowError().sendPostRequest( - new NormalisedURLPath("/recipe/session"), + "/recipe/session", { userId: "test-user-id", enableAntiCsrf: false, @@ -656,7 +656,7 @@ describe(`AccessToken versions: ${printPath("[test/session/accessTokenVersions.t // We can hard-code the structure of the request&response, since this is a fixed CDI version and it's not going to change Querier.apiVersion = "3.0"; const legacySessionResp = await Querier.getNewInstanceOrThrowError().sendPostRequest( - new NormalisedURLPath("/recipe/session"), + "/recipe/session", { userId: "test-user-id", enableAntiCsrf: false, @@ -724,7 +724,7 @@ describe(`AccessToken versions: ${printPath("[test/session/accessTokenVersions.t // We can hard-code the structure of the request&response, since this is a fixed CDI version and it's not going to change Querier.apiVersion = "3.0"; const legacySessionResp = await Querier.getNewInstanceOrThrowError().sendPostRequest( - new NormalisedURLPath("/recipe/session"), + "/recipe/session", { userId: "test-user-id", enableAntiCsrf: false, @@ -979,7 +979,7 @@ describe(`AccessToken versions: ${printPath("[test/session/accessTokenVersions.t // We can hard-code the structure of the request&response, since this is a fixed CDI version and it's not going to change Querier.apiVersion = "2.18"; const legacySessionResp = await Querier.getNewInstanceOrThrowError().sendPostRequest( - new NormalisedURLPath("/recipe/session"), + "/recipe/session", { userId: "test-user-id", enableAntiCsrf: false, @@ -1034,7 +1034,7 @@ describe(`AccessToken versions: ${printPath("[test/session/accessTokenVersions.t // We can hard-code the structure of the request&response, since this is a fixed CDI version and it's not going to change Querier.apiVersion = "2.18"; const legacySessionResp = await Querier.getNewInstanceOrThrowError().sendPostRequest( - new NormalisedURLPath("/recipe/session"), + "/recipe/session", { userId: "test-user-id", enableAntiCsrf: false, From 2c6bda18f422c7307b1087be1e92f1e16f26e5b0 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Thu, 5 Jun 2025 12:43:23 +0530 Subject: [PATCH 56/64] Bump version and update changelog with more details of changes --- .github/workflows/website-test.yml | 8 ++++---- CHANGELOG.md | 8 ++++++-- lib/build/version.d.ts | 2 +- lib/build/version.js | 2 +- lib/ts/version.ts | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 7 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.github/workflows/website-test.yml b/.github/workflows/website-test.yml index 2c7d6bf62..c3f2cc0c6 100644 --- a/.github/workflows/website-test.yml +++ b/.github/workflows/website-test.yml @@ -41,11 +41,11 @@ jobs: - name: Setup ENVs id: envs run: | - APP_SERVER_LOG_DIR=${{ github.workspace }}/logs - echo "APP_SERVER_LOG_DIR=$APP_SERVER_LOG_DIR" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV" + APP_SERVER_LOG_DIR=${{ github.workspace }}/logs + echo "APP_SERVER_LOG_DIR=$APP_SERVER_LOG_DIR" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV" + + mkdir -p $APP_SERVER_LOG_DIR - mkdir -p $APP_SERVER_LOG_DIR - - uses: actions/checkout@v4 with: path: supertokens-node diff --git a/CHANGELOG.md b/CHANGELOG.md index c20354587..de6bd9ba8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,9 +15,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Sets up workflow to run auth-react tests - Updates test-servers to work with updated tests -## [22.2.0] - 2025-05-09 +## [23.0.0] - 2025-06-05 -- Refactors querier to use dynamic request body and response body types inference +- The `rejectLoginRequest` and `acceptLoginRequest` can now possibly return a `OauthError`. +- The `loginGET` and `authGET` can now possibly return a `OauthError`. +- The `User` class now has a `fromApi` function to normalize the user object returned from the API. +- Refactors querier to use dynamic request body and response body types inference. +- Refactor internal network calls made with querier to use the new dynamic types. ## [22.1.0] - 2025-04-04 diff --git a/lib/build/version.d.ts b/lib/build/version.d.ts index 3ea03c7f3..d2b706d72 100644 --- a/lib/build/version.d.ts +++ b/lib/build/version.d.ts @@ -1,4 +1,4 @@ // @ts-nocheck -export declare const version = "22.2.0"; +export declare const version = "23.0.0"; export declare const cdiSupported: string[]; export declare const dashboardVersion = "0.15"; diff --git a/lib/build/version.js b/lib/build/version.js index afd8a3b91..c8e5c7629 100644 --- a/lib/build/version.js +++ b/lib/build/version.js @@ -15,7 +15,7 @@ exports.dashboardVersion = exports.cdiSupported = exports.version = void 0; * License for the specific language governing permissions and limitations * under the License. */ -exports.version = "22.2.0"; +exports.version = "23.0.0"; exports.cdiSupported = ["5.3"]; // Note: The actual script import for dashboard uses v{DASHBOARD_VERSION} exports.dashboardVersion = "0.15"; diff --git a/lib/ts/version.ts b/lib/ts/version.ts index 21474d062..1038f2b99 100644 --- a/lib/ts/version.ts +++ b/lib/ts/version.ts @@ -12,7 +12,7 @@ * License for the specific language governing permissions and limitations * under the License. */ -export const version = "22.2.0"; +export const version = "23.0.0"; export const cdiSupported = ["5.3"]; diff --git a/package-lock.json b/package-lock.json index d82dd371c..1161bb618 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "supertokens-node", - "version": "22.2.0", + "version": "23.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "supertokens-node", - "version": "22.2.0", + "version": "23.0.0", "license": "Apache-2.0", "dependencies": { "buffer": "^6.0.3", diff --git a/package.json b/package.json index 2c8b6f0d8..161e4f3f7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "supertokens-node", - "version": "22.2.0", + "version": "23.0.0", "description": "NodeJS driver for SuperTokens core", "main": "index.js", "scripts": { From 8576fe7ac5d636a46fa04005be53e736bf907661 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Tue, 10 Jun 2025 12:56:44 +0530 Subject: [PATCH 57/64] Make changes based on the spec update for OauthError --- CHANGELOG.md | 7 +- .../recipe/oauth2provider/api/userInfo.js | 12 +- lib/build/recipe/oauth2provider/index.d.ts | 20 +- .../oauth2provider/recipeImplementation.js | 23 +- lib/build/recipe/oauth2provider/types.d.ts | 49 ++-- lib/ts/core/versions/5.3/schema.d.ts | 216 +++++++++--------- lib/ts/recipe/oauth2provider/api/userInfo.ts | 14 +- .../oauth2provider/recipeImplementation.ts | 37 ++- lib/ts/recipe/oauth2provider/types.ts | 18 +- 9 files changed, 247 insertions(+), 149 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de6bd9ba8..cf248fffa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,11 +15,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Sets up workflow to run auth-react tests - Updates test-servers to work with updated tests -## [23.0.0] - 2025-06-05 +## [23.0.0] - 2025-06-10 -- The `rejectLoginRequest` and `acceptLoginRequest` can now possibly return a `OauthError`. -- The `loginGET` and `authGET` can now possibly return a `OauthError`. +- The `rejectLoginRequest`, `acceptLoginRequest`, `authorization`, `tokenExchange`, `getConsentRequest`, `acceptConsentRequest`, `rejectConsentRequest`, `validateOAuth2AccessToken` and `introspectToken` can now possibly return a `OauthError`. +- The `loginGET`, `authGET`, `tokenPOST` and `introspectTokenPOST` can now possibly return a `OauthError`. - The `User` class now has a `fromApi` function to normalize the user object returned from the API. +- The `/oauth/userinfo` endpoint can now possibly return a `OAUTH_ERROR`. - Refactors querier to use dynamic request body and response body types inference. - Refactor internal network calls made with querier to use the new dynamic types. diff --git a/lib/build/recipe/oauth2provider/api/userInfo.js b/lib/build/recipe/oauth2provider/api/userInfo.js index 402e6b0e7..6d16f92ca 100644 --- a/lib/build/recipe/oauth2provider/api/userInfo.js +++ b/lib/build/recipe/oauth2provider/api/userInfo.js @@ -34,13 +34,21 @@ async function userInfoGET(apiImplementation, tenantId, options, userContext) { const accessToken = authHeader.replace(/^Bearer /, "").trim(); let accessTokenPayload; try { - const { payload } = await recipe_1.default + const validateTokenResponse = await recipe_1.default .getInstanceOrThrowError() .recipeInterfaceImpl.validateOAuth2AccessToken({ token: accessToken, userContext, }); - accessTokenPayload = payload; + if (validateTokenResponse.status === "OAUTH_ERROR") { + utils_1.sendNon200ResponseWithMessage( + options.res, + validateTokenResponse.errorDescription, + validateTokenResponse.statusCode + ); + return true; + } + accessTokenPayload = validateTokenResponse.payload; } catch (error) { options.res.setHeader("WWW-Authenticate", 'Bearer error="invalid_token"', false); options.res.setHeader("Access-Control-Expose-Headers", "WWW-Authenticate", true); diff --git a/lib/build/recipe/oauth2provider/index.d.ts b/lib/build/recipe/oauth2provider/index.d.ts index f859cac0d..c619937a8 100644 --- a/lib/build/recipe/oauth2provider/index.d.ts +++ b/lib/build/recipe/oauth2provider/index.d.ts @@ -90,17 +90,20 @@ export default class Wrapper { }, checkDatabase?: boolean, userContext?: Record - ): Promise<{ - status: "OK"; - payload: import("../usermetadata").JSONObject; - }>; + ): Promise< + | import("./types").OauthError + | { + status: "OK"; + payload: import("../usermetadata").JSONObject; + } + >; static createTokenForClientCredentials( clientId: string, clientSecret: string, scope?: string[], audience?: string, userContext?: Record - ): Promise; + ): Promise; static revokeToken( token: string, clientId: string, @@ -128,7 +131,12 @@ export default class Wrapper { token: string, scopes?: string[], userContext?: Record - ): Promise; + ): Promise< + | import("./types").OauthError + | (import("./types").InstrospectTokenResponse & { + status: "OK"; + }) + >; } export declare let init: typeof Recipe.init; export declare let getOAuth2Client: typeof Wrapper.getOAuth2Client; diff --git a/lib/build/recipe/oauth2provider/recipeImplementation.js b/lib/build/recipe/oauth2provider/recipeImplementation.js index 374602366..e14b63786 100644 --- a/lib/build/recipe/oauth2provider/recipeImplementation.js +++ b/lib/build/recipe/oauth2provider/recipeImplementation.js @@ -163,6 +163,9 @@ function getRecipeInterface( { consentChallenge: input.challenge }, input.userContext ); + if (resp.status === "OAUTH_ERROR") { + return resp; + } return { acr: resp.acr, amr: resp.amr, @@ -198,6 +201,9 @@ function getRecipeInterface( }, input.userContext ); + if (resp.status === "OAUTH_ERROR") { + return resp; + } return { redirectTo: getUpdatedRedirectTo(appInfo, resp.redirectTo), }; @@ -215,6 +221,9 @@ function getRecipeInterface( }, input.userContext ); + if (resp.status === "OAUTH_ERROR") { + return resp; + } return { redirectTo: getUpdatedRedirectTo(appInfo, resp.redirectTo), }; @@ -334,6 +343,9 @@ function getRecipeInterface( challenge: consentChallenge, userContext: input.userContext, }); + if ("error" in consentRequest) { + return consentRequest; + } const consentRes = await this.acceptConsentRequest({ userContext: input.userContext, challenge: consentRequest.challenge, @@ -345,6 +357,9 @@ function getRecipeInterface( initialAccessTokenPayload: payloads === null || payloads === void 0 ? void 0 : payloads.accessToken, initialIdTokenPayload: payloads === null || payloads === void 0 ? void 0 : payloads.idToken, }); + if ("error" in consentRes) { + return consentRes; + } return { redirectTo: consentRes.redirectTo, cookies: resp.cookies, @@ -424,6 +439,9 @@ function getRecipeInterface( scopes, userContext: input.userContext, }); + if (tokenInfo.status === "OAUTH_ERROR") { + return tokenInfo; + } if (tokenInfo.active === true) { const sessionHandle = tokenInfo.sessionHandle; const clientInfo = await this.getOAuth2Client({ @@ -678,6 +696,9 @@ function getRecipeInterface( }, input.userContext ); + if (response.status === "OAUTH_ERROR") { + return response; + } if (response.active !== true) { throw new Error("The token is expired, invalid or has been revoked"); } @@ -739,7 +760,7 @@ function getRecipeInterface( userContext, }); } catch (error) { - return { active: false }; + return { active: false, status: "OK" }; } } // For tokens that passed local validation or if it's a refresh token, diff --git a/lib/build/recipe/oauth2provider/types.d.ts b/lib/build/recipe/oauth2provider/types.d.ts index ceb0241ad..70853f903 100644 --- a/lib/build/recipe/oauth2provider/types.d.ts +++ b/lib/build/recipe/oauth2provider/types.d.ts @@ -113,13 +113,14 @@ export declare type RecipeInterface = { cookies: string[] | undefined; } | ErrorOAuth2 + | OauthError >; tokenExchange(input: { authorizationHeader?: string; body: Record; userContext: UserContext; - }): Promise; - getConsentRequest(input: { challenge: string; userContext: UserContext }): Promise; + }): Promise; + getConsentRequest(input: { challenge: string; userContext: UserContext }): Promise; acceptConsentRequest(input: { challenge: string; context?: any; @@ -132,12 +133,18 @@ export declare type RecipeInterface = { initialAccessTokenPayload: JSONObject | undefined; initialIdTokenPayload: JSONObject | undefined; userContext: UserContext; - }): Promise<{ - redirectTo: string; - }>; - rejectConsentRequest(input: { challenge: string; error: ErrorOAuth2; userContext: UserContext }): Promise<{ - redirectTo: string; - }>; + }): Promise< + | { + redirectTo: string; + } + | OauthError + >; + rejectConsentRequest(input: { challenge: string; error: ErrorOAuth2; userContext: UserContext }): Promise< + | { + redirectTo: string; + } + | OauthError + >; getLoginRequest(input: { challenge: string; userContext: UserContext }): Promise< | (LoginRequest & { status: "OK"; @@ -247,10 +254,13 @@ export declare type RecipeInterface = { }; checkDatabase?: boolean; userContext: UserContext; - }): Promise<{ - status: "OK"; - payload: JSONObject; - }>; + }): Promise< + | { + status: "OK"; + payload: JSONObject; + } + | OauthError + >; getRequestedScopes(input: { recipeUserId: RecipeUserId | undefined; sessionHandle: string | undefined; @@ -329,11 +339,12 @@ export declare type RecipeInterface = { revokeTokensBySessionHandle(input: { sessionHandle: string; userContext: UserContext }): Promise<{ status: "OK"; }>; - introspectToken(input: { - token: string; - scopes?: string[]; - userContext: UserContext; - }): Promise; + introspectToken(input: { token: string; scopes?: string[]; userContext: UserContext }): Promise< + | (InstrospectTokenResponse & { + status: "OK"; + }) + | OauthError + >; endSession(input: { params: Record; session?: SessionContainerInterface; @@ -398,7 +409,7 @@ export declare type APIInterface = { body: any; options: APIOptions; userContext: UserContext; - }) => Promise); + }) => Promise); loginInfoGET: | undefined | ((input: { loginChallenge: string; options: APIOptions; userContext: UserContext }) => Promise< @@ -448,7 +459,7 @@ export declare type APIInterface = { scopes?: string[]; options: APIOptions; userContext: UserContext; - }) => Promise); + }) => Promise); endSessionGET: | undefined | ((input: { diff --git a/lib/ts/core/versions/5.3/schema.d.ts b/lib/ts/core/versions/5.3/schema.d.ts index 1c967f23a..f207540f5 100644 --- a/lib/ts/core/versions/5.3/schema.d.ts +++ b/lib/ts/core/versions/5.3/schema.d.ts @@ -9280,63 +9280,65 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - client?: components["schemas"]["oauthClient"]; - requestedScope?: string[]; - requestedAudience?: string[]; - requestedClaims?: { - idToken?: { - property1?: string; - property2?: string; - }; - }; - loginHint?: string; - uiLocales?: string[]; - acrValues?: string[]; - subject?: string; - requestUrl?: string; - skip?: boolean; - clientId?: string; - redirectUri?: string; - forceSubjectIdentifier?: string; - requestedAccessTokenAudience?: string[]; - context?: Record; - sessionId?: string; - loginSessionId?: string; - loginChallenge?: string; - loginRequestedAt?: string; - consentRequestedAt?: string; - consentChallenge?: string; - consentSkip?: boolean; - consentRemember?: boolean; - consentRememberFor?: number; - consentError?: { - name?: string; - description?: string; - }; - consentErrorDebug?: string; - consentErrorDescription?: string; - consentErrorHint?: string; - consentErrorCode?: string; - consentStatusCode?: number; - sessionIdToken?: { - property1?: string; - property2?: string; - }; - sessionAccessToken?: { - property1?: string; - property2?: string; - }; - sessionToken?: { - property1?: string; - property2?: string; - }; - acr?: string; - amr?: string[]; - challenge: string; - oidcContext?: Record; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + client?: components["schemas"]["oauthClient"]; + requestedScope?: string[]; + requestedAudience?: string[]; + requestedClaims?: { + idToken?: { + property1?: string; + property2?: string; + }; + }; + loginHint?: string; + uiLocales?: string[]; + acrValues?: string[]; + subject?: string; + requestUrl?: string; + skip?: boolean; + clientId?: string; + redirectUri?: string; + forceSubjectIdentifier?: string; + requestedAccessTokenAudience?: string[]; + context?: Record; + sessionId?: string; + loginSessionId?: string; + loginChallenge?: string; + loginRequestedAt?: string; + consentRequestedAt?: string; + consentChallenge?: string; + consentSkip?: boolean; + consentRemember?: boolean; + consentRememberFor?: number; + consentError?: { + name?: string; + description?: string; + }; + consentErrorDebug?: string; + consentErrorDescription?: string; + consentErrorHint?: string; + consentErrorCode?: string; + consentStatusCode?: number; + sessionIdToken?: { + property1?: string; + property2?: string; + }; + sessionAccessToken?: { + property1?: string; + property2?: string; + }; + sessionToken?: { + property1?: string; + property2?: string; + }; + acr?: string; + amr?: string[]; + challenge: string; + oidcContext?: Record; + } + | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9402,11 +9404,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example {apiDomain}/oauth/consent?... */ - redirectTo?: string; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example {apiDomain}/oauth/consent?... */ + redirectTo?: string; + } + | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -9454,11 +9458,13 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - /** @example {apiDomain}/oauth/consent?... */ - redirectTo?: string; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + /** @example {apiDomain}/oauth/consent?... */ + redirectTo?: string; + } + | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; @@ -10110,43 +10116,45 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - status: components["schemas"]["statusOK"]; - active?: boolean; - /** @example 1740992368 */ - iat?: number; - /** @example 1740995969 */ - exp?: number; - /** @example stcl_fed7cff0-cc6e-406e-b7a6-766148675a4a */ - client_id?: string; - /** @example http://localhost:3001/auth */ - iss?: string; - /** @example 1c229efe-c55b-44c1-98cf-9fa3a366502e */ - jti?: string; - /** @example 1740992368 */ - nbf?: number; - /** @example [ - * "openid", - * "offline_access" - * ] */ - scp?: string[]; - /** @example 137d053d-0d69-4dea-8a19-06ddbdfa4f96 */ - sub?: string; - /** @example 1 */ - stt?: number; - /** @example 87bcc2d8-f159-4e10-a097-0898179a2d7d */ - sessionHandle?: string; - /** @example 137d053d-0d69-4dea-8a19-06ddbdfa4f96 */ - rsub?: string; - /** @example public */ - tId?: string; - /** @example 575b7130-d982-4945-be49-3ecde2a49eaa */ - gid?: string; - /** @example Bearer */ - token_type?: string; - /** @example access_token */ - token_use?: string; - }; + "application/json": + | { + status: components["schemas"]["statusOK"]; + active?: boolean; + /** @example 1740992368 */ + iat?: number; + /** @example 1740995969 */ + exp?: number; + /** @example stcl_fed7cff0-cc6e-406e-b7a6-766148675a4a */ + client_id?: string; + /** @example http://localhost:3001/auth */ + iss?: string; + /** @example 1c229efe-c55b-44c1-98cf-9fa3a366502e */ + jti?: string; + /** @example 1740992368 */ + nbf?: number; + /** @example [ + * "openid", + * "offline_access" + * ] */ + scp?: string[]; + /** @example 137d053d-0d69-4dea-8a19-06ddbdfa4f96 */ + sub?: string; + /** @example 1 */ + stt?: number; + /** @example 87bcc2d8-f159-4e10-a097-0898179a2d7d */ + sessionHandle?: string; + /** @example 137d053d-0d69-4dea-8a19-06ddbdfa4f96 */ + rsub?: string; + /** @example public */ + tId?: string; + /** @example 575b7130-d982-4945-be49-3ecde2a49eaa */ + gid?: string; + /** @example Bearer */ + token_type?: string; + /** @example access_token */ + token_use?: string; + } + | components["schemas"]["oauthError"]; }; }; 400: components["responses"]["400"]; diff --git a/lib/ts/recipe/oauth2provider/api/userInfo.ts b/lib/ts/recipe/oauth2provider/api/userInfo.ts index 91b638352..740eb18e6 100644 --- a/lib/ts/recipe/oauth2provider/api/userInfo.ts +++ b/lib/ts/recipe/oauth2provider/api/userInfo.ts @@ -41,12 +41,22 @@ export default async function userInfoGET( let accessTokenPayload: JSONObject; try { - const { payload } = + const validateTokenResponse = await OAuth2ProviderRecipe.getInstanceOrThrowError().recipeInterfaceImpl.validateOAuth2AccessToken({ token: accessToken, userContext, }); - accessTokenPayload = payload; + + if (validateTokenResponse.status === "OAUTH_ERROR") { + sendNon200ResponseWithMessage( + options.res, + validateTokenResponse.errorDescription, + validateTokenResponse.statusCode + ); + return true; + } + + accessTokenPayload = validateTokenResponse.payload; } catch (error) { options.res.setHeader("WWW-Authenticate", 'Bearer error="invalid_token"', false); options.res.setHeader("Access-Control-Expose-Headers", "WWW-Authenticate", true); diff --git a/lib/ts/recipe/oauth2provider/recipeImplementation.ts b/lib/ts/recipe/oauth2provider/recipeImplementation.ts index 67656dfa5..8731ec84f 100644 --- a/lib/ts/recipe/oauth2provider/recipeImplementation.ts +++ b/lib/ts/recipe/oauth2provider/recipeImplementation.ts @@ -141,13 +141,17 @@ export default function getRecipeInterface( status: "OK", }; }, - getConsentRequest: async function (this: RecipeInterface, input): Promise { + getConsentRequest: async function (this: RecipeInterface, input): Promise { const resp = await querier.sendGetRequest( "/recipe/oauth/auth/requests/consent", { consentChallenge: input.challenge }, input.userContext ); + if (resp.status === "OAUTH_ERROR") { + return resp; + } + return { acr: resp.acr, amr: resp.amr, @@ -163,7 +167,10 @@ export default function getRecipeInterface( subject: resp.subject, }; }, - acceptConsentRequest: async function (this: RecipeInterface, input): Promise<{ redirectTo: string }> { + acceptConsentRequest: async function ( + this: RecipeInterface, + input + ): Promise<{ redirectTo: string } | OauthError> { const resp = await querier.sendPutRequest( "/recipe/oauth/auth/requests/consent/accept", { @@ -184,6 +191,10 @@ export default function getRecipeInterface( input.userContext ); + if (resp.status === "OAUTH_ERROR") { + return resp; + } + return { redirectTo: getUpdatedRedirectTo(appInfo, resp.redirectTo), }; @@ -203,6 +214,10 @@ export default function getRecipeInterface( input.userContext ); + if (resp.status === "OAUTH_ERROR") { + return resp; + } + return { redirectTo: getUpdatedRedirectTo(appInfo, resp.redirectTo), }; @@ -333,6 +348,10 @@ export default function getRecipeInterface( userContext: input.userContext, }); + if ("error" in consentRequest) { + return consentRequest; + } + const consentRes = await this.acceptConsentRequest({ userContext: input.userContext, challenge: consentRequest.challenge, @@ -345,6 +364,10 @@ export default function getRecipeInterface( initialIdTokenPayload: payloads?.idToken, }); + if ("error" in consentRes) { + return consentRes; + } + return { redirectTo: consentRes.redirectTo, cookies: resp.cookies, @@ -424,6 +447,10 @@ export default function getRecipeInterface( userContext: input.userContext, }); + if (tokenInfo.status === "OAUTH_ERROR") { + return tokenInfo; + } + if (tokenInfo.active === true) { const sessionHandle = tokenInfo.sessionHandle as string; @@ -688,6 +715,10 @@ export default function getRecipeInterface( input.userContext ); + if (response.status === "OAUTH_ERROR") { + return response; + } + if (response.active !== true) { throw new Error("The token is expired, invalid or has been revoked"); } @@ -757,7 +788,7 @@ export default function getRecipeInterface( userContext, }); } catch (error) { - return { active: false }; + return { active: false, status: "OK" }; } } diff --git a/lib/ts/recipe/oauth2provider/types.ts b/lib/ts/recipe/oauth2provider/types.ts index 7e28c86ad..e3e409c43 100644 --- a/lib/ts/recipe/oauth2provider/types.ts +++ b/lib/ts/recipe/oauth2provider/types.ts @@ -196,13 +196,13 @@ export type RecipeInterface = { cookies: string | undefined; session: SessionContainerInterface | undefined; userContext: UserContext; - }): Promise<{ redirectTo: string; cookies: string[] | undefined } | ErrorOAuth2>; + }): Promise<{ redirectTo: string; cookies: string[] | undefined } | ErrorOAuth2 | OauthError>; tokenExchange(input: { authorizationHeader?: string; body: Record; userContext: UserContext; - }): Promise; - getConsentRequest(input: { challenge: string; userContext: UserContext }): Promise; + }): Promise; + getConsentRequest(input: { challenge: string; userContext: UserContext }): Promise; acceptConsentRequest(input: { challenge: string; @@ -222,13 +222,13 @@ export type RecipeInterface = { initialIdTokenPayload: JSONObject | undefined; userContext: UserContext; - }): Promise<{ redirectTo: string }>; + }): Promise<{ redirectTo: string } | OauthError>; rejectConsentRequest(input: { challenge: string; error: ErrorOAuth2; userContext: UserContext; - }): Promise<{ redirectTo: string }>; + }): Promise<{ redirectTo: string } | OauthError>; getLoginRequest(input: { challenge: string; @@ -345,7 +345,7 @@ export type RecipeInterface = { }; checkDatabase?: boolean; userContext: UserContext; - }): Promise<{ status: "OK"; payload: JSONObject }>; + }): Promise<{ status: "OK"; payload: JSONObject } | OauthError>; getRequestedScopes(input: { recipeUserId: RecipeUserId | undefined; @@ -417,7 +417,7 @@ export type RecipeInterface = { token: string; scopes?: string[]; userContext: UserContext; - }): Promise; + }): Promise<(InstrospectTokenResponse & { status: "OK" }) | OauthError>; endSession(input: { params: Record; session?: SessionContainerInterface; @@ -461,7 +461,7 @@ export type APIInterface = { body: any; options: APIOptions; userContext: UserContext; - }) => Promise); + }) => Promise); loginInfoGET: | undefined | ((input: { @@ -495,7 +495,7 @@ export type APIInterface = { scopes?: string[]; options: APIOptions; userContext: UserContext; - }) => Promise); + }) => Promise); endSessionGET: | undefined | ((input: { From 787844892730253082ff3a31a40d33a4f2d77e25 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Wed, 11 Jun 2025 20:35:25 +0530 Subject: [PATCH 58/64] Remove duplicate Oauth error type --- .../recipe/oauth2provider/api/userInfo.js | 8 -- .../recipe/oauth2provider/api/utils.d.ts | 4 +- lib/build/recipe/oauth2provider/api/utils.js | 15 ---- lib/build/recipe/oauth2provider/index.d.ts | 20 ++--- .../oauth2provider/recipeImplementation.js | 24 +++--- lib/build/recipe/oauth2provider/types.d.ts | 75 +++++++------------ lib/ts/core/versions/5.3/schema.d.ts | 1 + lib/ts/recipe/oauth2provider/api/userInfo.ts | 9 --- lib/ts/recipe/oauth2provider/api/utils.ts | 24 +----- .../oauth2provider/recipeImplementation.ts | 40 ++++------ lib/ts/recipe/oauth2provider/types.ts | 43 ++++------- 11 files changed, 73 insertions(+), 190 deletions(-) diff --git a/lib/build/recipe/oauth2provider/api/userInfo.js b/lib/build/recipe/oauth2provider/api/userInfo.js index 6d16f92ca..3abc45a46 100644 --- a/lib/build/recipe/oauth2provider/api/userInfo.js +++ b/lib/build/recipe/oauth2provider/api/userInfo.js @@ -40,14 +40,6 @@ async function userInfoGET(apiImplementation, tenantId, options, userContext) { token: accessToken, userContext, }); - if (validateTokenResponse.status === "OAUTH_ERROR") { - utils_1.sendNon200ResponseWithMessage( - options.res, - validateTokenResponse.errorDescription, - validateTokenResponse.statusCode - ); - return true; - } accessTokenPayload = validateTokenResponse.payload; } catch (error) { options.res.setHeader("WWW-Authenticate", 'Bearer error="invalid_token"', false); diff --git a/lib/build/recipe/oauth2provider/api/utils.d.ts b/lib/build/recipe/oauth2provider/api/utils.d.ts index 695aab13a..be94270dc 100644 --- a/lib/build/recipe/oauth2provider/api/utils.d.ts +++ b/lib/build/recipe/oauth2provider/api/utils.d.ts @@ -1,7 +1,7 @@ // @ts-nocheck import { UserContext } from "../../../types"; import { SessionContainerInterface } from "../../session/types"; -import { ErrorOAuth2, RecipeInterface, OauthError } from "../types"; +import { ErrorOAuth2, RecipeInterface } from "../types"; export declare function loginGET({ recipeImplementation, loginChallenge, @@ -20,7 +20,6 @@ export declare function loginGET({ isDirectCall: boolean; }): Promise< | ErrorOAuth2 - | OauthError | { status: string; redirectTo: string; @@ -55,7 +54,6 @@ export declare function handleLoginInternalRedirects({ cookies?: string[]; } | ErrorOAuth2 - | OauthError >; export declare function handleLogoutInternalRedirects({ response, diff --git a/lib/build/recipe/oauth2provider/api/utils.js b/lib/build/recipe/oauth2provider/api/utils.js index 3b4f14e3b..859ed1d24 100644 --- a/lib/build/recipe/oauth2provider/api/utils.js +++ b/lib/build/recipe/oauth2provider/api/utils.js @@ -58,9 +58,6 @@ async function loginGET({ }, userContext, }); - if (reject.status === "OAUTH_ERROR") { - return reject; - } return { status: "REDIRECT", redirectTo: reject.redirectTo, cookies }; } if (maxAgeParsed < 0) { @@ -73,9 +70,6 @@ async function loginGET({ }, userContext, }); - if (reject.status === "OAUTH_ERROR") { - return reject; - } return { status: "REDIRECT", redirectTo: reject.redirectTo, cookies }; } } catch (_c) { @@ -88,9 +82,6 @@ async function loginGET({ }, userContext, }); - if (reject.status === "OAUTH_ERROR") { - return reject; - } return { status: "REDIRECT", redirectTo: reject.redirectTo, cookies }; } } @@ -110,9 +101,6 @@ async function loginGET({ identityProviderSessionId: session.getHandle(), userContext, }); - if (accept.status === "OAUTH_ERROR") { - return accept; - } return { status: "REDIRECT", redirectTo: accept.redirectTo, cookies: cookies }; } if (shouldTryRefresh && promptParam !== "login") { @@ -136,9 +124,6 @@ async function loginGET({ }, userContext, }); - if (reject.status === "OAUTH_ERROR") { - return reject; - } return { status: "REDIRECT", redirectTo: reject.redirectTo, cookies }; } return { diff --git a/lib/build/recipe/oauth2provider/index.d.ts b/lib/build/recipe/oauth2provider/index.d.ts index c619937a8..073627b0d 100644 --- a/lib/build/recipe/oauth2provider/index.d.ts +++ b/lib/build/recipe/oauth2provider/index.d.ts @@ -90,20 +90,17 @@ export default class Wrapper { }, checkDatabase?: boolean, userContext?: Record - ): Promise< - | import("./types").OauthError - | { - status: "OK"; - payload: import("../usermetadata").JSONObject; - } - >; + ): Promise<{ + status: "OK"; + payload: import("../usermetadata").JSONObject; + }>; static createTokenForClientCredentials( clientId: string, clientSecret: string, scope?: string[], audience?: string, userContext?: Record - ): Promise; + ): Promise; static revokeToken( token: string, clientId: string, @@ -132,10 +129,9 @@ export default class Wrapper { scopes?: string[], userContext?: Record ): Promise< - | import("./types").OauthError - | (import("./types").InstrospectTokenResponse & { - status: "OK"; - }) + import("./types").InstrospectTokenResponse & { + status: "OK"; + } >; } export declare let init: typeof Recipe.init; diff --git a/lib/build/recipe/oauth2provider/recipeImplementation.js b/lib/build/recipe/oauth2provider/recipeImplementation.js index e14b63786..30e1a56cb 100644 --- a/lib/build/recipe/oauth2provider/recipeImplementation.js +++ b/lib/build/recipe/oauth2provider/recipeImplementation.js @@ -129,7 +129,7 @@ function getRecipeInterface( input.userContext ); if (resp.status === "OAUTH_ERROR") { - return resp; + throw new Error("The token is expired, invalid or has been revoked"); } return { redirectTo: getUpdatedRedirectTo(appInfo, resp.redirectTo), @@ -150,7 +150,7 @@ function getRecipeInterface( input.userContext ); if (resp.status === "OAUTH_ERROR") { - return resp; + throw new Error("The token is expired, invalid or has been revoked"); } return { redirectTo: getUpdatedRedirectTo(appInfo, resp.redirectTo), @@ -164,7 +164,7 @@ function getRecipeInterface( input.userContext ); if (resp.status === "OAUTH_ERROR") { - return resp; + throw new Error("The token is expired, invalid or has been revoked"); } return { acr: resp.acr, @@ -202,7 +202,7 @@ function getRecipeInterface( input.userContext ); if (resp.status === "OAUTH_ERROR") { - return resp; + throw new Error("The token is expired, invalid or has been revoked"); } return { redirectTo: getUpdatedRedirectTo(appInfo, resp.redirectTo), @@ -222,7 +222,7 @@ function getRecipeInterface( input.userContext ); if (resp.status === "OAUTH_ERROR") { - return resp; + throw new Error("The token is expired, invalid or has been revoked"); } return { redirectTo: getUpdatedRedirectTo(appInfo, resp.redirectTo), @@ -343,9 +343,6 @@ function getRecipeInterface( challenge: consentChallenge, userContext: input.userContext, }); - if ("error" in consentRequest) { - return consentRequest; - } const consentRes = await this.acceptConsentRequest({ userContext: input.userContext, challenge: consentRequest.challenge, @@ -357,9 +354,6 @@ function getRecipeInterface( initialAccessTokenPayload: payloads === null || payloads === void 0 ? void 0 : payloads.accessToken, initialIdTokenPayload: payloads === null || payloads === void 0 ? void 0 : payloads.idToken, }); - if ("error" in consentRes) { - return consentRes; - } return { redirectTo: consentRes.redirectTo, cookies: resp.cookies, @@ -439,9 +433,6 @@ function getRecipeInterface( scopes, userContext: input.userContext, }); - if (tokenInfo.status === "OAUTH_ERROR") { - return tokenInfo; - } if (tokenInfo.active === true) { const sessionHandle = tokenInfo.sessionHandle; const clientInfo = await this.getOAuth2Client({ @@ -697,7 +688,7 @@ function getRecipeInterface( input.userContext ); if (response.status === "OAUTH_ERROR") { - return response; + throw new Error("The token is expired, invalid or has been revoked"); } if (response.active !== true) { throw new Error("The token is expired, invalid or has been revoked"); @@ -773,6 +764,9 @@ function getRecipeInterface( }, userContext ); + if (res.status === "OAUTH_ERROR") { + throw new Error("The token is expired, invalid or has been revoked"); + } return res; }, endSession: async function (input) { diff --git a/lib/build/recipe/oauth2provider/types.d.ts b/lib/build/recipe/oauth2provider/types.d.ts index 70853f903..3de43d016 100644 --- a/lib/build/recipe/oauth2provider/types.d.ts +++ b/lib/build/recipe/oauth2provider/types.d.ts @@ -38,12 +38,6 @@ export declare type ErrorOAuth2 = { errorDescription: string; statusCode?: number; }; -export declare type OauthError = { - status: "OAUTH_ERROR"; - error: string; - errorDescription: string; - statusCode: number; -}; export declare type ConsentRequest = { acr?: string; amr?: string[]; @@ -113,14 +107,13 @@ export declare type RecipeInterface = { cookies: string[] | undefined; } | ErrorOAuth2 - | OauthError >; tokenExchange(input: { authorizationHeader?: string; body: Record; userContext: UserContext; - }): Promise; - getConsentRequest(input: { challenge: string; userContext: UserContext }): Promise; + }): Promise; + getConsentRequest(input: { challenge: string; userContext: UserContext }): Promise; acceptConsentRequest(input: { challenge: string; context?: any; @@ -133,18 +126,12 @@ export declare type RecipeInterface = { initialAccessTokenPayload: JSONObject | undefined; initialIdTokenPayload: JSONObject | undefined; userContext: UserContext; - }): Promise< - | { - redirectTo: string; - } - | OauthError - >; - rejectConsentRequest(input: { challenge: string; error: ErrorOAuth2; userContext: UserContext }): Promise< - | { - redirectTo: string; - } - | OauthError - >; + }): Promise<{ + redirectTo: string; + }>; + rejectConsentRequest(input: { challenge: string; error: ErrorOAuth2; userContext: UserContext }): Promise<{ + redirectTo: string; + }>; getLoginRequest(input: { challenge: string; userContext: UserContext }): Promise< | (LoginRequest & { status: "OK"; @@ -160,20 +147,14 @@ export declare type RecipeInterface = { identityProviderSessionId?: string; subject: string; userContext: UserContext; - }): Promise< - | { - redirectTo: string; - status: "OK"; - } - | OauthError - >; - rejectLoginRequest(input: { challenge: string; error: ErrorOAuth2; userContext: UserContext }): Promise< - | { - redirectTo: string; - status: "OK"; - } - | OauthError - >; + }): Promise<{ + redirectTo: string; + status: "OK"; + }>; + rejectLoginRequest(input: { challenge: string; error: ErrorOAuth2; userContext: UserContext }): Promise<{ + redirectTo: string; + status: "OK"; + }>; getOAuth2Client(input: { clientId: string; userContext: UserContext }): Promise< | { status: "OK"; @@ -254,13 +235,10 @@ export declare type RecipeInterface = { }; checkDatabase?: boolean; userContext: UserContext; - }): Promise< - | { - status: "OK"; - payload: JSONObject; - } - | OauthError - >; + }): Promise<{ + status: "OK"; + payload: JSONObject; + }>; getRequestedScopes(input: { recipeUserId: RecipeUserId | undefined; sessionHandle: string | undefined; @@ -340,10 +318,9 @@ export declare type RecipeInterface = { status: "OK"; }>; introspectToken(input: { token: string; scopes?: string[]; userContext: UserContext }): Promise< - | (InstrospectTokenResponse & { - status: "OK"; - }) - | OauthError + InstrospectTokenResponse & { + status: "OK"; + } >; endSession(input: { params: Record; @@ -381,7 +358,6 @@ export declare type APIInterface = { cookies?: string[]; } | ErrorOAuth2 - | OauthError | GeneralErrorResponse >); authGET: @@ -399,7 +375,6 @@ export declare type APIInterface = { cookies?: string[]; } | ErrorOAuth2 - | OauthError | GeneralErrorResponse >); tokenPOST: @@ -409,7 +384,7 @@ export declare type APIInterface = { body: any; options: APIOptions; userContext: UserContext; - }) => Promise); + }) => Promise); loginInfoGET: | undefined | ((input: { loginChallenge: string; options: APIOptions; userContext: UserContext }) => Promise< @@ -459,7 +434,7 @@ export declare type APIInterface = { scopes?: string[]; options: APIOptions; userContext: UserContext; - }) => Promise); + }) => Promise); endSessionGET: | undefined | ((input: { diff --git a/lib/ts/core/versions/5.3/schema.d.ts b/lib/ts/core/versions/5.3/schema.d.ts index f207540f5..8ff3eb3ed 100644 --- a/lib/ts/core/versions/5.3/schema.d.ts +++ b/lib/ts/core/versions/5.3/schema.d.ts @@ -1,4 +1,5 @@ // @ts-nocheck +// @ts-nocheck /** * This file was auto-generated by openapi-typescript. * Do not make direct changes to the file. diff --git a/lib/ts/recipe/oauth2provider/api/userInfo.ts b/lib/ts/recipe/oauth2provider/api/userInfo.ts index 740eb18e6..f1ae402ad 100644 --- a/lib/ts/recipe/oauth2provider/api/userInfo.ts +++ b/lib/ts/recipe/oauth2provider/api/userInfo.ts @@ -47,15 +47,6 @@ export default async function userInfoGET( userContext, }); - if (validateTokenResponse.status === "OAUTH_ERROR") { - sendNon200ResponseWithMessage( - options.res, - validateTokenResponse.errorDescription, - validateTokenResponse.statusCode - ); - return true; - } - accessTokenPayload = validateTokenResponse.payload; } catch (error) { options.res.setHeader("WWW-Authenticate", 'Bearer error="invalid_token"', false); diff --git a/lib/ts/recipe/oauth2provider/api/utils.ts b/lib/ts/recipe/oauth2provider/api/utils.ts index e69ce546f..1151cab4d 100644 --- a/lib/ts/recipe/oauth2provider/api/utils.ts +++ b/lib/ts/recipe/oauth2provider/api/utils.ts @@ -4,7 +4,7 @@ import { DEFAULT_TENANT_ID } from "../../multitenancy/constants"; import { getSessionInformation } from "../../session"; import { SessionContainerInterface } from "../../session/types"; import { AUTH_PATH, LOGIN_PATH, END_SESSION_PATH } from "../constants"; -import { ErrorOAuth2, RecipeInterface, OauthError } from "../types"; +import { ErrorOAuth2, RecipeInterface } from "../types"; import setCookieParser from "set-cookie-parser"; // API implementation for the loginGET function. @@ -59,10 +59,6 @@ export async function loginGET({ userContext, }); - if (reject.status === "OAUTH_ERROR") { - return reject; - } - return { status: "REDIRECT", redirectTo: reject.redirectTo, cookies }; } @@ -77,10 +73,6 @@ export async function loginGET({ userContext, }); - if (reject.status === "OAUTH_ERROR") { - return reject; - } - return { status: "REDIRECT", redirectTo: reject.redirectTo, cookies }; } } catch { @@ -94,10 +86,6 @@ export async function loginGET({ userContext, }); - if (reject.status === "OAUTH_ERROR") { - return reject; - } - return { status: "REDIRECT", redirectTo: reject.redirectTo, cookies }; } } @@ -118,10 +106,6 @@ export async function loginGET({ userContext, }); - if (accept.status === "OAUTH_ERROR") { - return accept; - } - return { status: "REDIRECT", redirectTo: accept.redirectTo, cookies: cookies }; } @@ -147,10 +131,6 @@ export async function loginGET({ userContext, }); - if (reject.status === "OAUTH_ERROR") { - return reject; - } - return { status: "REDIRECT", redirectTo: reject.redirectTo, cookies }; } @@ -237,7 +217,7 @@ export async function handleLoginInternalRedirects({ shouldTryRefresh: boolean; cookie?: string; userContext: UserContext; -}): Promise<{ redirectTo: string; cookies?: string[] } | ErrorOAuth2 | OauthError> { +}): Promise<{ redirectTo: string; cookies?: string[] } | ErrorOAuth2> { if (!isLoginInternalRedirect(response.redirectTo)) { return response; } diff --git a/lib/ts/recipe/oauth2provider/recipeImplementation.ts b/lib/ts/recipe/oauth2provider/recipeImplementation.ts index 8731ec84f..0a87e164b 100644 --- a/lib/ts/recipe/oauth2provider/recipeImplementation.ts +++ b/lib/ts/recipe/oauth2provider/recipeImplementation.ts @@ -22,7 +22,6 @@ import { ConsentRequest, PayloadBuilderFunction, UserInfoBuilderFunction, - OauthError, } from "./types"; import { OAuth2Client } from "./OAuth2Client"; import { getUser } from "../.."; @@ -89,7 +88,7 @@ export default function getRecipeInterface( acceptLoginRequest: async function ( this: RecipeInterface, input - ): Promise<{ redirectTo: string; status: "OK" } | OauthError> { + ): Promise<{ redirectTo: string; status: "OK" }> { const resp = await querier.sendPutRequest( "/recipe/oauth/auth/requests/login/accept", { @@ -107,7 +106,7 @@ export default function getRecipeInterface( ); if (resp.status === "OAUTH_ERROR") { - return resp; + throw new Error("The token is expired, invalid or has been revoked"); } return { @@ -118,7 +117,7 @@ export default function getRecipeInterface( rejectLoginRequest: async function ( this: RecipeInterface, input - ): Promise<{ redirectTo: string; status: "OK" } | OauthError> { + ): Promise<{ redirectTo: string; status: "OK" }> { const resp = await querier.sendPutRequest( "/recipe/oauth/auth/requests/login/reject", { @@ -133,7 +132,7 @@ export default function getRecipeInterface( ); if (resp.status === "OAUTH_ERROR") { - return resp; + throw new Error("The token is expired, invalid or has been revoked"); } return { @@ -141,7 +140,7 @@ export default function getRecipeInterface( status: "OK", }; }, - getConsentRequest: async function (this: RecipeInterface, input): Promise { + getConsentRequest: async function (this: RecipeInterface, input): Promise { const resp = await querier.sendGetRequest( "/recipe/oauth/auth/requests/consent", { consentChallenge: input.challenge }, @@ -149,7 +148,7 @@ export default function getRecipeInterface( ); if (resp.status === "OAUTH_ERROR") { - return resp; + throw new Error("The token is expired, invalid or has been revoked"); } return { @@ -167,10 +166,7 @@ export default function getRecipeInterface( subject: resp.subject, }; }, - acceptConsentRequest: async function ( - this: RecipeInterface, - input - ): Promise<{ redirectTo: string } | OauthError> { + acceptConsentRequest: async function (this: RecipeInterface, input): Promise<{ redirectTo: string }> { const resp = await querier.sendPutRequest( "/recipe/oauth/auth/requests/consent/accept", { @@ -192,7 +188,7 @@ export default function getRecipeInterface( ); if (resp.status === "OAUTH_ERROR") { - return resp; + throw new Error("The token is expired, invalid or has been revoked"); } return { @@ -215,7 +211,7 @@ export default function getRecipeInterface( ); if (resp.status === "OAUTH_ERROR") { - return resp; + throw new Error("The token is expired, invalid or has been revoked"); } return { @@ -348,10 +344,6 @@ export default function getRecipeInterface( userContext: input.userContext, }); - if ("error" in consentRequest) { - return consentRequest; - } - const consentRes = await this.acceptConsentRequest({ userContext: input.userContext, challenge: consentRequest.challenge, @@ -364,10 +356,6 @@ export default function getRecipeInterface( initialIdTokenPayload: payloads?.idToken, }); - if ("error" in consentRes) { - return consentRes; - } - return { redirectTo: consentRes.redirectTo, cookies: resp.cookies, @@ -447,10 +435,6 @@ export default function getRecipeInterface( userContext: input.userContext, }); - if (tokenInfo.status === "OAUTH_ERROR") { - return tokenInfo; - } - if (tokenInfo.active === true) { const sessionHandle = tokenInfo.sessionHandle as string; @@ -716,7 +700,7 @@ export default function getRecipeInterface( ); if (response.status === "OAUTH_ERROR") { - return response; + throw new Error("The token is expired, invalid or has been revoked"); } if (response.active !== true) { @@ -803,6 +787,10 @@ export default function getRecipeInterface( userContext ); + if (res.status === "OAUTH_ERROR") { + throw new Error("The token is expired, invalid or has been revoked"); + } + return res; }, diff --git a/lib/ts/recipe/oauth2provider/types.ts b/lib/ts/recipe/oauth2provider/types.ts index e3e409c43..aa2ea3774 100644 --- a/lib/ts/recipe/oauth2provider/types.ts +++ b/lib/ts/recipe/oauth2provider/types.ts @@ -65,21 +65,6 @@ export type ErrorOAuth2 = { statusCode?: number; }; -export type OauthError = { - status: "OAUTH_ERROR"; - - // The error should follow the OAuth2 error format (e.g. invalid_request, login_required). - // Defaults to request_denied. - error: string; - - // Description of the error in a human readable format. - errorDescription: string; - - // Represents the HTTP status code of the error (e.g. 401 or 403) - // Defaults to 400 - statusCode: number; -}; - export type ConsentRequest = { // ACR represents the Authentication AuthorizationContext Class Reference value for this authentication session. You can use it to express that, for example, a user authenticated using two factor authentication. acr?: string; @@ -196,13 +181,13 @@ export type RecipeInterface = { cookies: string | undefined; session: SessionContainerInterface | undefined; userContext: UserContext; - }): Promise<{ redirectTo: string; cookies: string[] | undefined } | ErrorOAuth2 | OauthError>; + }): Promise<{ redirectTo: string; cookies: string[] | undefined } | ErrorOAuth2>; tokenExchange(input: { authorizationHeader?: string; body: Record; userContext: UserContext; - }): Promise; - getConsentRequest(input: { challenge: string; userContext: UserContext }): Promise; + }): Promise; + getConsentRequest(input: { challenge: string; userContext: UserContext }): Promise; acceptConsentRequest(input: { challenge: string; @@ -222,13 +207,13 @@ export type RecipeInterface = { initialIdTokenPayload: JSONObject | undefined; userContext: UserContext; - }): Promise<{ redirectTo: string } | OauthError>; + }): Promise<{ redirectTo: string }>; rejectConsentRequest(input: { challenge: string; error: ErrorOAuth2; userContext: UserContext; - }): Promise<{ redirectTo: string } | OauthError>; + }): Promise<{ redirectTo: string }>; getLoginRequest(input: { challenge: string; @@ -257,12 +242,12 @@ export type RecipeInterface = { // Subject is the user ID of the end-user that authenticated. subject: string; userContext: UserContext; - }): Promise<{ redirectTo: string; status: "OK" } | OauthError>; + }): Promise<{ redirectTo: string; status: "OK" }>; rejectLoginRequest(input: { challenge: string; error: ErrorOAuth2; userContext: UserContext; - }): Promise<{ redirectTo: string; status: "OK" } | OauthError>; + }): Promise<{ redirectTo: string; status: "OK" }>; getOAuth2Client(input: { clientId: string; userContext: UserContext }): Promise< | { @@ -345,7 +330,7 @@ export type RecipeInterface = { }; checkDatabase?: boolean; userContext: UserContext; - }): Promise<{ status: "OK"; payload: JSONObject } | OauthError>; + }): Promise<{ status: "OK"; payload: JSONObject }>; getRequestedScopes(input: { recipeUserId: RecipeUserId | undefined; @@ -417,7 +402,7 @@ export type RecipeInterface = { token: string; scopes?: string[]; userContext: UserContext; - }): Promise<(InstrospectTokenResponse & { status: "OK" }) | OauthError>; + }): Promise; endSession(input: { params: Record; session?: SessionContainerInterface; @@ -440,9 +425,7 @@ export type APIInterface = { session?: SessionContainerInterface; shouldTryRefresh: boolean; userContext: UserContext; - }) => Promise< - { frontendRedirectTo: string; cookies?: string[] } | ErrorOAuth2 | OauthError | GeneralErrorResponse - >); + }) => Promise<{ frontendRedirectTo: string; cookies?: string[] } | ErrorOAuth2 | GeneralErrorResponse>); authGET: | undefined @@ -453,7 +436,7 @@ export type APIInterface = { shouldTryRefresh: boolean; options: APIOptions; userContext: UserContext; - }) => Promise<{ redirectTo: string; cookies?: string[] } | ErrorOAuth2 | OauthError | GeneralErrorResponse>); + }) => Promise<{ redirectTo: string; cookies?: string[] } | ErrorOAuth2 | GeneralErrorResponse>); tokenPOST: | undefined | ((input: { @@ -461,7 +444,7 @@ export type APIInterface = { body: any; options: APIOptions; userContext: UserContext; - }) => Promise); + }) => Promise); loginInfoGET: | undefined | ((input: { @@ -495,7 +478,7 @@ export type APIInterface = { scopes?: string[]; options: APIOptions; userContext: UserContext; - }) => Promise); + }) => Promise); endSessionGET: | undefined | ((input: { From 96e5fdaa387fa6221c733e6e615f473a24bc72e6 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Wed, 11 Jun 2025 20:42:47 +0530 Subject: [PATCH 59/64] Remove some unintended type changes in oauth methods --- lib/build/recipe/oauth2provider/index.d.ts | 6 +----- .../recipe/oauth2provider/recipeImplementation.js | 4 +--- lib/build/recipe/oauth2provider/types.d.ts | 12 +++++------- lib/ts/core/versions/5.3/schema.d.ts | 2 ++ .../recipe/oauth2provider/recipeImplementation.ts | 14 +++----------- lib/ts/recipe/oauth2provider/types.ts | 6 +++--- 6 files changed, 15 insertions(+), 29 deletions(-) diff --git a/lib/build/recipe/oauth2provider/index.d.ts b/lib/build/recipe/oauth2provider/index.d.ts index 073627b0d..f859cac0d 100644 --- a/lib/build/recipe/oauth2provider/index.d.ts +++ b/lib/build/recipe/oauth2provider/index.d.ts @@ -128,11 +128,7 @@ export default class Wrapper { token: string, scopes?: string[], userContext?: Record - ): Promise< - import("./types").InstrospectTokenResponse & { - status: "OK"; - } - >; + ): Promise; } export declare let init: typeof Recipe.init; export declare let getOAuth2Client: typeof Wrapper.getOAuth2Client; diff --git a/lib/build/recipe/oauth2provider/recipeImplementation.js b/lib/build/recipe/oauth2provider/recipeImplementation.js index 30e1a56cb..a13264b92 100644 --- a/lib/build/recipe/oauth2provider/recipeImplementation.js +++ b/lib/build/recipe/oauth2provider/recipeImplementation.js @@ -133,7 +133,6 @@ function getRecipeInterface( } return { redirectTo: getUpdatedRedirectTo(appInfo, resp.redirectTo), - status: "OK", }; }, rejectLoginRequest: async function (input) { @@ -154,7 +153,6 @@ function getRecipeInterface( } return { redirectTo: getUpdatedRedirectTo(appInfo, resp.redirectTo), - status: "OK", }; }, getConsentRequest: async function (input) { @@ -751,7 +749,7 @@ function getRecipeInterface( userContext, }); } catch (error) { - return { active: false, status: "OK" }; + return { active: false }; } } // For tokens that passed local validation or if it's a refresh token, diff --git a/lib/build/recipe/oauth2provider/types.d.ts b/lib/build/recipe/oauth2provider/types.d.ts index 3de43d016..34805fb3b 100644 --- a/lib/build/recipe/oauth2provider/types.d.ts +++ b/lib/build/recipe/oauth2provider/types.d.ts @@ -149,11 +149,9 @@ export declare type RecipeInterface = { userContext: UserContext; }): Promise<{ redirectTo: string; - status: "OK"; }>; rejectLoginRequest(input: { challenge: string; error: ErrorOAuth2; userContext: UserContext }): Promise<{ redirectTo: string; - status: "OK"; }>; getOAuth2Client(input: { clientId: string; userContext: UserContext }): Promise< | { @@ -317,11 +315,11 @@ export declare type RecipeInterface = { revokeTokensBySessionHandle(input: { sessionHandle: string; userContext: UserContext }): Promise<{ status: "OK"; }>; - introspectToken(input: { token: string; scopes?: string[]; userContext: UserContext }): Promise< - InstrospectTokenResponse & { - status: "OK"; - } - >; + introspectToken(input: { + token: string; + scopes?: string[]; + userContext: UserContext; + }): Promise; endSession(input: { params: Record; session?: SessionContainerInterface; diff --git a/lib/ts/core/versions/5.3/schema.d.ts b/lib/ts/core/versions/5.3/schema.d.ts index 8ff3eb3ed..36879037d 100644 --- a/lib/ts/core/versions/5.3/schema.d.ts +++ b/lib/ts/core/versions/5.3/schema.d.ts @@ -1,5 +1,7 @@ // @ts-nocheck // @ts-nocheck +// @ts-nocheck +// @ts-nocheck /** * This file was auto-generated by openapi-typescript. * Do not make direct changes to the file. diff --git a/lib/ts/recipe/oauth2provider/recipeImplementation.ts b/lib/ts/recipe/oauth2provider/recipeImplementation.ts index 0a87e164b..08f0b34a8 100644 --- a/lib/ts/recipe/oauth2provider/recipeImplementation.ts +++ b/lib/ts/recipe/oauth2provider/recipeImplementation.ts @@ -85,10 +85,7 @@ export default function getRecipeInterface( subject: resp.subject, }; }, - acceptLoginRequest: async function ( - this: RecipeInterface, - input - ): Promise<{ redirectTo: string; status: "OK" }> { + acceptLoginRequest: async function (this: RecipeInterface, input): Promise<{ redirectTo: string }> { const resp = await querier.sendPutRequest( "/recipe/oauth/auth/requests/login/accept", { @@ -111,13 +108,9 @@ export default function getRecipeInterface( return { redirectTo: getUpdatedRedirectTo(appInfo, resp.redirectTo), - status: "OK", }; }, - rejectLoginRequest: async function ( - this: RecipeInterface, - input - ): Promise<{ redirectTo: string; status: "OK" }> { + rejectLoginRequest: async function (this: RecipeInterface, input): Promise<{ redirectTo: string }> { const resp = await querier.sendPutRequest( "/recipe/oauth/auth/requests/login/reject", { @@ -137,7 +130,6 @@ export default function getRecipeInterface( return { redirectTo: getUpdatedRedirectTo(appInfo, resp.redirectTo), - status: "OK", }; }, getConsentRequest: async function (this: RecipeInterface, input): Promise { @@ -772,7 +764,7 @@ export default function getRecipeInterface( userContext, }); } catch (error) { - return { active: false, status: "OK" }; + return { active: false }; } } diff --git a/lib/ts/recipe/oauth2provider/types.ts b/lib/ts/recipe/oauth2provider/types.ts index aa2ea3774..08f41f8d8 100644 --- a/lib/ts/recipe/oauth2provider/types.ts +++ b/lib/ts/recipe/oauth2provider/types.ts @@ -242,12 +242,12 @@ export type RecipeInterface = { // Subject is the user ID of the end-user that authenticated. subject: string; userContext: UserContext; - }): Promise<{ redirectTo: string; status: "OK" }>; + }): Promise<{ redirectTo: string }>; rejectLoginRequest(input: { challenge: string; error: ErrorOAuth2; userContext: UserContext; - }): Promise<{ redirectTo: string; status: "OK" }>; + }): Promise<{ redirectTo: string }>; getOAuth2Client(input: { clientId: string; userContext: UserContext }): Promise< | { @@ -402,7 +402,7 @@ export type RecipeInterface = { token: string; scopes?: string[]; userContext: UserContext; - }): Promise; + }): Promise; endSession(input: { params: Record; session?: SessionContainerInterface; From ad250c4df71b228501b97a7fab3b130e7d8ba609 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Wed, 11 Jun 2025 20:45:25 +0530 Subject: [PATCH 60/64] Remove some removed changes from changelog --- CHANGELOG.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf248fffa..0c57bf248 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,10 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [23.0.0] - 2025-06-10 -- The `rejectLoginRequest`, `acceptLoginRequest`, `authorization`, `tokenExchange`, `getConsentRequest`, `acceptConsentRequest`, `rejectConsentRequest`, `validateOAuth2AccessToken` and `introspectToken` can now possibly return a `OauthError`. -- The `loginGET`, `authGET`, `tokenPOST` and `introspectTokenPOST` can now possibly return a `OauthError`. - The `User` class now has a `fromApi` function to normalize the user object returned from the API. -- The `/oauth/userinfo` endpoint can now possibly return a `OAUTH_ERROR`. - Refactors querier to use dynamic request body and response body types inference. - Refactor internal network calls made with querier to use the new dynamic types. From 9731f82050c36b94c181a34ed02b1ccd33f6428c Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Thu, 12 Jun 2025 12:19:47 +0530 Subject: [PATCH 61/64] Update handling of OAUTH_ERROR in some methods to return them --- lib/build/recipe/oauth2provider/api/utils.js | 15 ++++ lib/build/recipe/oauth2provider/index.d.ts | 7 +- .../oauth2provider/recipeImplementation.js | 32 ++++++-- lib/build/recipe/oauth2provider/types.d.ts | 55 ++++++++----- lib/ts/core/versions/5.3/schema.d.ts | 3 - lib/ts/recipe/oauth2provider/api/utils.ts | 20 +++++ .../oauth2provider/recipeImplementation.ts | 79 ++++++++++++++++--- lib/ts/recipe/oauth2provider/types.ts | 14 ++-- 8 files changed, 174 insertions(+), 51 deletions(-) diff --git a/lib/build/recipe/oauth2provider/api/utils.js b/lib/build/recipe/oauth2provider/api/utils.js index 859ed1d24..77f617184 100644 --- a/lib/build/recipe/oauth2provider/api/utils.js +++ b/lib/build/recipe/oauth2provider/api/utils.js @@ -58,6 +58,9 @@ async function loginGET({ }, userContext, }); + if ("error" in reject) { + return reject; + } return { status: "REDIRECT", redirectTo: reject.redirectTo, cookies }; } if (maxAgeParsed < 0) { @@ -70,6 +73,9 @@ async function loginGET({ }, userContext, }); + if ("error" in reject) { + return reject; + } return { status: "REDIRECT", redirectTo: reject.redirectTo, cookies }; } } catch (_c) { @@ -82,6 +88,9 @@ async function loginGET({ }, userContext, }); + if (reject.status === "ERROR") { + return reject; + } return { status: "REDIRECT", redirectTo: reject.redirectTo, cookies }; } } @@ -101,6 +110,9 @@ async function loginGET({ identityProviderSessionId: session.getHandle(), userContext, }); + if (accept.status === "ERROR") { + return accept; + } return { status: "REDIRECT", redirectTo: accept.redirectTo, cookies: cookies }; } if (shouldTryRefresh && promptParam !== "login") { @@ -124,6 +136,9 @@ async function loginGET({ }, userContext, }); + if (reject.status === "ERROR") { + return reject; + } return { status: "REDIRECT", redirectTo: reject.redirectTo, cookies }; } return { diff --git a/lib/build/recipe/oauth2provider/index.d.ts b/lib/build/recipe/oauth2provider/index.d.ts index f859cac0d..b4ae088a0 100644 --- a/lib/build/recipe/oauth2provider/index.d.ts +++ b/lib/build/recipe/oauth2provider/index.d.ts @@ -128,7 +128,12 @@ export default class Wrapper { token: string, scopes?: string[], userContext?: Record - ): Promise; + ): Promise< + | import("./types").ErrorOAuth2 + | (import("./types").InstrospectTokenResponse & { + status: "OK"; + }) + >; } export declare let init: typeof Recipe.init; export declare let getOAuth2Client: typeof Wrapper.getOAuth2Client; diff --git a/lib/build/recipe/oauth2provider/recipeImplementation.js b/lib/build/recipe/oauth2provider/recipeImplementation.js index a13264b92..a624c1cc4 100644 --- a/lib/build/recipe/oauth2provider/recipeImplementation.js +++ b/lib/build/recipe/oauth2provider/recipeImplementation.js @@ -129,10 +129,11 @@ function getRecipeInterface( input.userContext ); if (resp.status === "OAUTH_ERROR") { - throw new Error("The token is expired, invalid or has been revoked"); + return Object.assign(Object.assign({}, resp), { status: "ERROR" }); } return { redirectTo: getUpdatedRedirectTo(appInfo, resp.redirectTo), + status: "OK", }; }, rejectLoginRequest: async function (input) { @@ -149,10 +150,11 @@ function getRecipeInterface( input.userContext ); if (resp.status === "OAUTH_ERROR") { - throw new Error("The token is expired, invalid or has been revoked"); + return Object.assign(Object.assign({}, resp), { status: "ERROR" }); } return { redirectTo: getUpdatedRedirectTo(appInfo, resp.redirectTo), + status: "OK", }; }, getConsentRequest: async function (input) { @@ -162,7 +164,7 @@ function getRecipeInterface( input.userContext ); if (resp.status === "OAUTH_ERROR") { - throw new Error("The token is expired, invalid or has been revoked"); + return Object.assign(Object.assign({}, resp), { status: "ERROR" }); } return { acr: resp.acr, @@ -200,10 +202,11 @@ function getRecipeInterface( input.userContext ); if (resp.status === "OAUTH_ERROR") { - throw new Error("The token is expired, invalid or has been revoked"); + return Object.assign(Object.assign({}, resp), { status: "ERROR" }); } return { redirectTo: getUpdatedRedirectTo(appInfo, resp.redirectTo), + status: "OK", }; }, rejectConsentRequest: async function (input) { @@ -220,10 +223,11 @@ function getRecipeInterface( input.userContext ); if (resp.status === "OAUTH_ERROR") { - throw new Error("The token is expired, invalid or has been revoked"); + return Object.assign(Object.assign({}, resp), { status: "ERROR" }); } return { redirectTo: getUpdatedRedirectTo(appInfo, resp.redirectTo), + status: "OK", }; }, authorization: async function (input) { @@ -341,6 +345,9 @@ function getRecipeInterface( challenge: consentChallenge, userContext: input.userContext, }); + if ("error" in consentRequest) { + return consentRequest; + } const consentRes = await this.acceptConsentRequest({ userContext: input.userContext, challenge: consentRequest.challenge, @@ -352,6 +359,9 @@ function getRecipeInterface( initialAccessTokenPayload: payloads === null || payloads === void 0 ? void 0 : payloads.accessToken, initialIdTokenPayload: payloads === null || payloads === void 0 ? void 0 : payloads.idToken, }); + if ("error" in consentRes) { + return consentRes; + } return { redirectTo: consentRes.redirectTo, cookies: resp.cookies, @@ -431,6 +441,9 @@ function getRecipeInterface( scopes, userContext: input.userContext, }); + if (tokenInfo.status === "ERROR") { + return tokenInfo; + } if (tokenInfo.active === true) { const sessionHandle = tokenInfo.sessionHandle; const clientInfo = await this.getOAuth2Client({ @@ -749,7 +762,10 @@ function getRecipeInterface( userContext, }); } catch (error) { - return { active: false }; + return { + active: false, + status: "OK", + }; } } // For tokens that passed local validation or if it's a refresh token, @@ -763,9 +779,9 @@ function getRecipeInterface( userContext ); if (res.status === "OAUTH_ERROR") { - throw new Error("The token is expired, invalid or has been revoked"); + return Object.assign(Object.assign({}, res), { status: "ERROR" }); } - return res; + return Object.assign(Object.assign({}, res), { status: "OK" }); }, endSession: async function (input) { /** diff --git a/lib/build/recipe/oauth2provider/types.d.ts b/lib/build/recipe/oauth2provider/types.d.ts index 34805fb3b..8dcb6711a 100644 --- a/lib/build/recipe/oauth2provider/types.d.ts +++ b/lib/build/recipe/oauth2provider/types.d.ts @@ -113,7 +113,7 @@ export declare type RecipeInterface = { body: Record; userContext: UserContext; }): Promise; - getConsentRequest(input: { challenge: string; userContext: UserContext }): Promise; + getConsentRequest(input: { challenge: string; userContext: UserContext }): Promise; acceptConsentRequest(input: { challenge: string; context?: any; @@ -126,12 +126,20 @@ export declare type RecipeInterface = { initialAccessTokenPayload: JSONObject | undefined; initialIdTokenPayload: JSONObject | undefined; userContext: UserContext; - }): Promise<{ - redirectTo: string; - }>; - rejectConsentRequest(input: { challenge: string; error: ErrorOAuth2; userContext: UserContext }): Promise<{ - redirectTo: string; - }>; + }): Promise< + | { + redirectTo: string; + status: "OK"; + } + | ErrorOAuth2 + >; + rejectConsentRequest(input: { challenge: string; error: ErrorOAuth2; userContext: UserContext }): Promise< + | { + redirectTo: string; + status: "OK"; + } + | ErrorOAuth2 + >; getLoginRequest(input: { challenge: string; userContext: UserContext }): Promise< | (LoginRequest & { status: "OK"; @@ -147,12 +155,20 @@ export declare type RecipeInterface = { identityProviderSessionId?: string; subject: string; userContext: UserContext; - }): Promise<{ - redirectTo: string; - }>; - rejectLoginRequest(input: { challenge: string; error: ErrorOAuth2; userContext: UserContext }): Promise<{ - redirectTo: string; - }>; + }): Promise< + | { + redirectTo: string; + status: "OK"; + } + | ErrorOAuth2 + >; + rejectLoginRequest(input: { challenge: string; error: ErrorOAuth2; userContext: UserContext }): Promise< + | { + redirectTo: string; + status: "OK"; + } + | ErrorOAuth2 + >; getOAuth2Client(input: { clientId: string; userContext: UserContext }): Promise< | { status: "OK"; @@ -315,11 +331,12 @@ export declare type RecipeInterface = { revokeTokensBySessionHandle(input: { sessionHandle: string; userContext: UserContext }): Promise<{ status: "OK"; }>; - introspectToken(input: { - token: string; - scopes?: string[]; - userContext: UserContext; - }): Promise; + introspectToken(input: { token: string; scopes?: string[]; userContext: UserContext }): Promise< + | (InstrospectTokenResponse & { + status: "OK"; + }) + | ErrorOAuth2 + >; endSession(input: { params: Record; session?: SessionContainerInterface; @@ -432,7 +449,7 @@ export declare type APIInterface = { scopes?: string[]; options: APIOptions; userContext: UserContext; - }) => Promise); + }) => Promise); endSessionGET: | undefined | ((input: { diff --git a/lib/ts/core/versions/5.3/schema.d.ts b/lib/ts/core/versions/5.3/schema.d.ts index 36879037d..f207540f5 100644 --- a/lib/ts/core/versions/5.3/schema.d.ts +++ b/lib/ts/core/versions/5.3/schema.d.ts @@ -1,7 +1,4 @@ // @ts-nocheck -// @ts-nocheck -// @ts-nocheck -// @ts-nocheck /** * This file was auto-generated by openapi-typescript. * Do not make direct changes to the file. diff --git a/lib/ts/recipe/oauth2provider/api/utils.ts b/lib/ts/recipe/oauth2provider/api/utils.ts index 1151cab4d..c0aebacf4 100644 --- a/lib/ts/recipe/oauth2provider/api/utils.ts +++ b/lib/ts/recipe/oauth2provider/api/utils.ts @@ -59,6 +59,10 @@ export async function loginGET({ userContext, }); + if ("error" in reject) { + return reject; + } + return { status: "REDIRECT", redirectTo: reject.redirectTo, cookies }; } @@ -73,6 +77,10 @@ export async function loginGET({ userContext, }); + if ("error" in reject) { + return reject; + } + return { status: "REDIRECT", redirectTo: reject.redirectTo, cookies }; } } catch { @@ -86,6 +94,10 @@ export async function loginGET({ userContext, }); + if (reject.status === "ERROR") { + return reject; + } + return { status: "REDIRECT", redirectTo: reject.redirectTo, cookies }; } } @@ -106,6 +118,10 @@ export async function loginGET({ userContext, }); + if (accept.status === "ERROR") { + return accept; + } + return { status: "REDIRECT", redirectTo: accept.redirectTo, cookies: cookies }; } @@ -131,6 +147,10 @@ export async function loginGET({ userContext, }); + if (reject.status === "ERROR") { + return reject; + } + return { status: "REDIRECT", redirectTo: reject.redirectTo, cookies }; } diff --git a/lib/ts/recipe/oauth2provider/recipeImplementation.ts b/lib/ts/recipe/oauth2provider/recipeImplementation.ts index 08f0b34a8..9eac99c48 100644 --- a/lib/ts/recipe/oauth2provider/recipeImplementation.ts +++ b/lib/ts/recipe/oauth2provider/recipeImplementation.ts @@ -22,6 +22,7 @@ import { ConsentRequest, PayloadBuilderFunction, UserInfoBuilderFunction, + ErrorOAuth2, } from "./types"; import { OAuth2Client } from "./OAuth2Client"; import { getUser } from "../.."; @@ -85,7 +86,10 @@ export default function getRecipeInterface( subject: resp.subject, }; }, - acceptLoginRequest: async function (this: RecipeInterface, input): Promise<{ redirectTo: string }> { + acceptLoginRequest: async function ( + this: RecipeInterface, + input + ): Promise<{ redirectTo: string; status: "OK" } | ErrorOAuth2> { const resp = await querier.sendPutRequest( "/recipe/oauth/auth/requests/login/accept", { @@ -103,14 +107,21 @@ export default function getRecipeInterface( ); if (resp.status === "OAUTH_ERROR") { - throw new Error("The token is expired, invalid or has been revoked"); + return { + ...resp, + status: "ERROR", + }; } return { redirectTo: getUpdatedRedirectTo(appInfo, resp.redirectTo), + status: "OK", }; }, - rejectLoginRequest: async function (this: RecipeInterface, input): Promise<{ redirectTo: string }> { + rejectLoginRequest: async function ( + this: RecipeInterface, + input + ): Promise<{ redirectTo: string; status: "OK" } | ErrorOAuth2> { const resp = await querier.sendPutRequest( "/recipe/oauth/auth/requests/login/reject", { @@ -125,14 +136,18 @@ export default function getRecipeInterface( ); if (resp.status === "OAUTH_ERROR") { - throw new Error("The token is expired, invalid or has been revoked"); + return { + ...resp, + status: "ERROR", + }; } return { redirectTo: getUpdatedRedirectTo(appInfo, resp.redirectTo), + status: "OK", }; }, - getConsentRequest: async function (this: RecipeInterface, input): Promise { + getConsentRequest: async function (this: RecipeInterface, input): Promise { const resp = await querier.sendGetRequest( "/recipe/oauth/auth/requests/consent", { consentChallenge: input.challenge }, @@ -140,7 +155,10 @@ export default function getRecipeInterface( ); if (resp.status === "OAUTH_ERROR") { - throw new Error("The token is expired, invalid or has been revoked"); + return { + ...resp, + status: "ERROR", + }; } return { @@ -158,7 +176,10 @@ export default function getRecipeInterface( subject: resp.subject, }; }, - acceptConsentRequest: async function (this: RecipeInterface, input): Promise<{ redirectTo: string }> { + acceptConsentRequest: async function ( + this: RecipeInterface, + input + ): Promise<{ redirectTo: string; status: "OK" } | ErrorOAuth2> { const resp = await querier.sendPutRequest( "/recipe/oauth/auth/requests/consent/accept", { @@ -180,15 +201,22 @@ export default function getRecipeInterface( ); if (resp.status === "OAUTH_ERROR") { - throw new Error("The token is expired, invalid or has been revoked"); + return { + ...resp, + status: "ERROR", + }; } return { redirectTo: getUpdatedRedirectTo(appInfo, resp.redirectTo), + status: "OK", }; }, - rejectConsentRequest: async function (this: RecipeInterface, input) { + rejectConsentRequest: async function ( + this: RecipeInterface, + input + ): Promise<{ redirectTo: string; status: "OK" } | ErrorOAuth2> { const resp = await querier.sendPutRequest( "/recipe/oauth/auth/requests/consent/reject", { @@ -203,11 +231,15 @@ export default function getRecipeInterface( ); if (resp.status === "OAUTH_ERROR") { - throw new Error("The token is expired, invalid or has been revoked"); + return { + ...resp, + status: "ERROR", + }; } return { redirectTo: getUpdatedRedirectTo(appInfo, resp.redirectTo), + status: "OK", }; }, authorization: async function (this: RecipeInterface, input) { @@ -336,6 +368,10 @@ export default function getRecipeInterface( userContext: input.userContext, }); + if ("error" in consentRequest) { + return consentRequest; + } + const consentRes = await this.acceptConsentRequest({ userContext: input.userContext, challenge: consentRequest.challenge, @@ -348,6 +384,10 @@ export default function getRecipeInterface( initialIdTokenPayload: payloads?.idToken, }); + if ("error" in consentRes) { + return consentRes; + } + return { redirectTo: consentRes.redirectTo, cookies: resp.cookies, @@ -427,6 +467,10 @@ export default function getRecipeInterface( userContext: input.userContext, }); + if (tokenInfo.status === "ERROR") { + return tokenInfo; + } + if (tokenInfo.active === true) { const sessionHandle = tokenInfo.sessionHandle as string; @@ -764,7 +808,10 @@ export default function getRecipeInterface( userContext, }); } catch (error) { - return { active: false }; + return { + active: false, + status: "OK", + }; } } @@ -780,10 +827,16 @@ export default function getRecipeInterface( ); if (res.status === "OAUTH_ERROR") { - throw new Error("The token is expired, invalid or has been revoked"); + return { + ...res, + status: "ERROR", + }; } - return res; + return { + ...res, + status: "OK", + }; }, endSession: async function (this: RecipeInterface, input) { diff --git a/lib/ts/recipe/oauth2provider/types.ts b/lib/ts/recipe/oauth2provider/types.ts index 08f41f8d8..3639c07ba 100644 --- a/lib/ts/recipe/oauth2provider/types.ts +++ b/lib/ts/recipe/oauth2provider/types.ts @@ -187,7 +187,7 @@ export type RecipeInterface = { body: Record; userContext: UserContext; }): Promise; - getConsentRequest(input: { challenge: string; userContext: UserContext }): Promise; + getConsentRequest(input: { challenge: string; userContext: UserContext }): Promise; acceptConsentRequest(input: { challenge: string; @@ -207,13 +207,13 @@ export type RecipeInterface = { initialIdTokenPayload: JSONObject | undefined; userContext: UserContext; - }): Promise<{ redirectTo: string }>; + }): Promise<{ redirectTo: string; status: "OK" } | ErrorOAuth2>; rejectConsentRequest(input: { challenge: string; error: ErrorOAuth2; userContext: UserContext; - }): Promise<{ redirectTo: string }>; + }): Promise<{ redirectTo: string; status: "OK" } | ErrorOAuth2>; getLoginRequest(input: { challenge: string; @@ -242,12 +242,12 @@ export type RecipeInterface = { // Subject is the user ID of the end-user that authenticated. subject: string; userContext: UserContext; - }): Promise<{ redirectTo: string }>; + }): Promise<{ redirectTo: string; status: "OK" } | ErrorOAuth2>; rejectLoginRequest(input: { challenge: string; error: ErrorOAuth2; userContext: UserContext; - }): Promise<{ redirectTo: string }>; + }): Promise<{ redirectTo: string; status: "OK" } | ErrorOAuth2>; getOAuth2Client(input: { clientId: string; userContext: UserContext }): Promise< | { @@ -402,7 +402,7 @@ export type RecipeInterface = { token: string; scopes?: string[]; userContext: UserContext; - }): Promise; + }): Promise<(InstrospectTokenResponse & { status: "OK" }) | ErrorOAuth2>; endSession(input: { params: Record; session?: SessionContainerInterface; @@ -478,7 +478,7 @@ export type APIInterface = { scopes?: string[]; options: APIOptions; userContext: UserContext; - }) => Promise); + }) => Promise); endSessionGET: | undefined | ((input: { From a81b3a03e7c64836abbbe96ac2e799399de1de37 Mon Sep 17 00:00:00 2001 From: Deepjyoti Barman Date: Thu, 12 Jun 2025 12:26:56 +0530 Subject: [PATCH 62/64] Update changelog with details of changes --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c57bf248..37e43b167 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [23.0.0] - 2025-06-10 +- The `getConsentRequest`, `acceptConsentRequest`, `rejectConsentRequest`, `acceptLoginRequest`, `rejectLoginRequest` and `introspectToken` can now possibly return an `ErrorOAuth2`. +- The `/oauth/introspect` can now possibly return an `ErrorAuth2`. - The `User` class now has a `fromApi` function to normalize the user object returned from the API. - Refactors querier to use dynamic request body and response body types inference. - Refactor internal network calls made with querier to use the new dynamic types. From ebdc52c5a0105ea254acdc13e2569be08431f05e Mon Sep 17 00:00:00 2001 From: Victor Date: Fri, 13 Jun 2025 17:07:15 +0300 Subject: [PATCH 63/64] fix: WebAuthn type fixes to align with CDI (#1002) * fix: handle optional recipeUserId in getUserFromRecoverAccountToken response * rebuilt code * fix: update WebAuthn types to use number for createdAt, expiresAt and timout fields and made email optional in for register options * changelog updates --------- Co-authored-by: Victor Bojica --- CHANGELOG.md | 2 ++ lib/build/recipe/webauthn/index.d.ts | 14 +++++------ .../recipe/webauthn/recipeImplementation.js | 2 +- lib/build/recipe/webauthn/types.d.ts | 22 ++++++++--------- .../recipe/webauthn/recipeImplementation.ts | 2 +- lib/ts/recipe/webauthn/types.ts | 24 ++++++++++--------- 6 files changed, 35 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 37e43b167..efeda9070 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixes broken workflows (Example Tests, AWS Edge function compatibility) - Sets up workflow to run auth-react tests - Updates test-servers to work with updated tests +- Fixes wrong types types from `string` to `number` on `createdAt`, `expiresAt` and `timeout` from the WebAuthn recipe +- Fixed `email` property by making it optional on `getGeneratedOptions` recipe implementation method ## [23.0.0] - 2025-06-10 diff --git a/lib/build/recipe/webauthn/index.d.ts b/lib/build/recipe/webauthn/index.d.ts index bbedbb5d0..6815bd487 100644 --- a/lib/build/recipe/webauthn/index.d.ts +++ b/lib/build/recipe/webauthn/index.d.ts @@ -52,8 +52,8 @@ export default class Wrapper { | { status: "OK"; webauthnGeneratedOptionsId: string; - createdAt: string; - expiresAt: string; + createdAt: number; + expiresAt: number; rp: { id: string; name: string; @@ -98,8 +98,8 @@ export default class Wrapper { | { status: "OK"; webauthnGeneratedOptionsId: string; - createdAt: string; - expiresAt: string; + createdAt: number; + expiresAt: number; challenge: string; timeout: number; userVerification: UserVerification; @@ -121,8 +121,8 @@ export default class Wrapper { userVerification: UserVerification; userPresence: boolean; origin: string; - email: string; - timeout: string; + email?: string | undefined; + timeout: number; challenge: string; createdAt: number; expiresAt: number; @@ -382,7 +382,7 @@ export default class Wrapper { | { status: "OK"; user: import("../../types").User; - recipeUserId: import("../..").RecipeUserId; + recipeUserId?: import("../..").RecipeUserId | undefined; } >; static removeGeneratedOptions(input: { diff --git a/lib/build/recipe/webauthn/recipeImplementation.js b/lib/build/recipe/webauthn/recipeImplementation.js index 0e6b2f29d..6af48cf0e 100644 --- a/lib/build/recipe/webauthn/recipeImplementation.js +++ b/lib/build/recipe/webauthn/recipeImplementation.js @@ -340,7 +340,7 @@ function getRecipeInterface(querier, getWebauthnConfig) { if (resp.status === "OK") { return Object.assign(Object.assign({}, resp), { user: new user_1.User(resp.user), - recipeUserId: new recipeUserId_1.default(resp.recipeUserId), + recipeUserId: resp.recipeUserId ? new recipeUserId_1.default(resp.recipeUserId) : undefined, }); } return resp; diff --git a/lib/build/recipe/webauthn/types.d.ts b/lib/build/recipe/webauthn/types.d.ts index 539de2b8c..a703b668a 100644 --- a/lib/build/recipe/webauthn/types.d.ts +++ b/lib/build/recipe/webauthn/types.d.ts @@ -218,8 +218,8 @@ export declare type RecipeInterface = { | { status: "OK"; webauthnGeneratedOptionsId: string; - createdAt: string; - expiresAt: string; + createdAt: number; + expiresAt: number; rp: { id: string; name: string; @@ -262,8 +262,8 @@ export declare type RecipeInterface = { | { status: "OK"; webauthnGeneratedOptionsId: string; - createdAt: string; - expiresAt: string; + createdAt: number; + expiresAt: number; challenge: string; timeout: number; userVerification: UserVerification; @@ -372,7 +372,7 @@ export declare type RecipeInterface = { | { status: "OK"; user: User; - recipeUserId: RecipeUserId; + recipeUserId?: RecipeUserId; } | GetUserFromRecoverAccountTokenErrorResponse >; @@ -424,8 +424,8 @@ export declare type RecipeInterface = { userVerification: UserVerification; userPresence: boolean; origin: string; - email: string; - timeout: string; + email?: string; + timeout: number; challenge: string; createdAt: number; expiresAt: number; @@ -545,8 +545,8 @@ export declare type APIInterface = { | { status: "OK"; webauthnGeneratedOptionsId: string; - createdAt: string; - expiresAt: string; + createdAt: number; + expiresAt: number; rp: { id: string; name: string; @@ -583,8 +583,8 @@ export declare type APIInterface = { | { status: "OK"; webauthnGeneratedOptionsId: string; - createdAt: string; - expiresAt: string; + createdAt: number; + expiresAt: number; rpId: string; challenge: string; timeout: number; diff --git a/lib/ts/recipe/webauthn/recipeImplementation.ts b/lib/ts/recipe/webauthn/recipeImplementation.ts index 8c5cc7ba4..3b6249487 100644 --- a/lib/ts/recipe/webauthn/recipeImplementation.ts +++ b/lib/ts/recipe/webauthn/recipeImplementation.ts @@ -328,7 +328,7 @@ export default function getRecipeInterface( return { ...resp, user: new User(resp.user), - recipeUserId: new RecipeUserId(resp.recipeUserId), + recipeUserId: resp.recipeUserId ? new RecipeUserId(resp.recipeUserId) : undefined, }; } diff --git a/lib/ts/recipe/webauthn/types.ts b/lib/ts/recipe/webauthn/types.ts index 8855bade1..5e82f1a33 100644 --- a/lib/ts/recipe/webauthn/types.ts +++ b/lib/ts/recipe/webauthn/types.ts @@ -199,8 +199,8 @@ export type RecipeInterface = { | { status: "OK"; webauthnGeneratedOptionsId: string; - createdAt: string; - expiresAt: string; + createdAt: number; + expiresAt: number; // for understanding the response, see https://www.w3.org/TR/webauthn-3/#sctn-registering-a-new-credential and https://developer.mozilla.org/en-US/docs/Web/API/PublicKeyCredential rp: { id: string; @@ -246,8 +246,8 @@ export type RecipeInterface = { | { status: "OK"; webauthnGeneratedOptionsId: string; - createdAt: string; - expiresAt: string; + createdAt: number; + expiresAt: number; challenge: string; timeout: number; userVerification: UserVerification; @@ -344,7 +344,9 @@ export type RecipeInterface = { token: string; tenantId: string; userContext: UserContext; - }): Promise<{ status: "OK"; user: User; recipeUserId: RecipeUserId } | GetUserFromRecoverAccountTokenErrorResponse>; + }): Promise< + { status: "OK"; user: User; recipeUserId?: RecipeUserId } | GetUserFromRecoverAccountTokenErrorResponse + >; removeCredential(input: { webauthnCredentialId: string; recipeUserId: string; userContext: UserContext }): Promise< | { @@ -393,8 +395,8 @@ export type RecipeInterface = { userVerification: UserVerification; userPresence: boolean; origin: string; - email: string; - timeout: string; + email?: string; + timeout: number; challenge: string; createdAt: number; expiresAt: number; @@ -483,8 +485,8 @@ export type APIInterface = { | { status: "OK"; webauthnGeneratedOptionsId: string; - createdAt: string; - expiresAt: string; + createdAt: number; + expiresAt: number; rp: { id: string; name: string; @@ -522,8 +524,8 @@ export type APIInterface = { | { status: "OK"; webauthnGeneratedOptionsId: string; - createdAt: string; - expiresAt: string; + createdAt: number; + expiresAt: number; rpId: string; challenge: string; timeout: number; From b4cd8d7d1b70cf1f908a48fa9dacd55bd6647548 Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Fri, 13 Jun 2025 19:35:25 +0200 Subject: [PATCH 64/64] fix: update after rebuilding core-types --- lib/build/recipe/oauth2provider/constants.js | 11 +---------- lib/build/recipe/session/constants.js | 16 +--------------- lib/build/recipe/webauthn/constants.js | 18 +----------------- lib/ts/core/versions/5.3/schema.d.ts | 6 +++--- 4 files changed, 6 insertions(+), 45 deletions(-) diff --git a/lib/build/recipe/oauth2provider/constants.js b/lib/build/recipe/oauth2provider/constants.js index e3550b35f..260e9eb50 100644 --- a/lib/build/recipe/oauth2provider/constants.js +++ b/lib/build/recipe/oauth2provider/constants.js @@ -14,16 +14,7 @@ * under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -exports.LOGOUT_PATH = - exports.END_SESSION_PATH = - exports.INTROSPECT_TOKEN_PATH = - exports.REVOKE_TOKEN_PATH = - exports.USER_INFO_PATH = - exports.LOGIN_INFO_PATH = - exports.TOKEN_PATH = - exports.AUTH_PATH = - exports.LOGIN_PATH = - void 0; +exports.LOGOUT_PATH = exports.END_SESSION_PATH = exports.INTROSPECT_TOKEN_PATH = exports.REVOKE_TOKEN_PATH = exports.USER_INFO_PATH = exports.LOGIN_INFO_PATH = exports.TOKEN_PATH = exports.AUTH_PATH = exports.LOGIN_PATH = void 0; exports.LOGIN_PATH = "/oauth/login"; exports.AUTH_PATH = "/oauth/auth"; exports.TOKEN_PATH = "/oauth/token"; diff --git a/lib/build/recipe/session/constants.js b/lib/build/recipe/session/constants.js index 82fdcadde..e196684e5 100644 --- a/lib/build/recipe/session/constants.js +++ b/lib/build/recipe/session/constants.js @@ -14,21 +14,7 @@ * under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -exports.authModeHeaderKey = - exports.frontTokenHeaderKey = - exports.antiCsrfHeaderKey = - exports.refreshTokenHeaderKey = - exports.refreshTokenCookieKey = - exports.accessTokenCookieKey = - exports.accessTokenHeaderKey = - exports.authorizationHeaderKey = - exports.protectedProps = - exports.JWKCacheCooldownInMs = - exports.oneYearInMs = - exports.availableTokenTransferMethods = - exports.SIGNOUT_API_PATH = - exports.REFRESH_API_PATH = - void 0; +exports.authModeHeaderKey = exports.frontTokenHeaderKey = exports.antiCsrfHeaderKey = exports.refreshTokenHeaderKey = exports.refreshTokenCookieKey = exports.accessTokenCookieKey = exports.accessTokenHeaderKey = exports.authorizationHeaderKey = exports.protectedProps = exports.JWKCacheCooldownInMs = exports.oneYearInMs = exports.availableTokenTransferMethods = exports.SIGNOUT_API_PATH = exports.REFRESH_API_PATH = void 0; exports.REFRESH_API_PATH = "/session/refresh"; exports.SIGNOUT_API_PATH = "/signout"; exports.availableTokenTransferMethods = ["cookie", "header"]; diff --git a/lib/build/recipe/webauthn/constants.js b/lib/build/recipe/webauthn/constants.js index ff345b144..09f1ebdbf 100644 --- a/lib/build/recipe/webauthn/constants.js +++ b/lib/build/recipe/webauthn/constants.js @@ -14,23 +14,7 @@ * under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -exports.DEFAULT_SIGNIN_OPTIONS_USER_PRESENCE = - exports.DEFAULT_SIGNIN_OPTIONS_USER_VERIFICATION = - exports.DEFAULT_SIGNIN_OPTIONS_TIMEOUT = - exports.DEFAULT_REGISTER_OPTIONS_SUPPORTED_ALGORITHM_IDS = - exports.DEFAULT_REGISTER_OPTIONS_USER_PRESENCE = - exports.DEFAULT_REGISTER_OPTIONS_USER_VERIFICATION = - exports.DEFAULT_REGISTER_OPTIONS_RESIDENT_KEY = - exports.DEFAULT_REGISTER_OPTIONS_ATTESTATION = - exports.DEFAULT_REGISTER_OPTIONS_TIMEOUT = - exports.SIGNUP_EMAIL_EXISTS_API = - exports.RECOVER_ACCOUNT_API = - exports.GENERATE_RECOVER_ACCOUNT_TOKEN_API = - exports.SIGN_IN_API = - exports.SIGN_UP_API = - exports.SIGNIN_OPTIONS_API = - exports.REGISTER_OPTIONS_API = - void 0; +exports.DEFAULT_SIGNIN_OPTIONS_USER_PRESENCE = exports.DEFAULT_SIGNIN_OPTIONS_USER_VERIFICATION = exports.DEFAULT_SIGNIN_OPTIONS_TIMEOUT = exports.DEFAULT_REGISTER_OPTIONS_SUPPORTED_ALGORITHM_IDS = exports.DEFAULT_REGISTER_OPTIONS_USER_PRESENCE = exports.DEFAULT_REGISTER_OPTIONS_USER_VERIFICATION = exports.DEFAULT_REGISTER_OPTIONS_RESIDENT_KEY = exports.DEFAULT_REGISTER_OPTIONS_ATTESTATION = exports.DEFAULT_REGISTER_OPTIONS_TIMEOUT = exports.SIGNUP_EMAIL_EXISTS_API = exports.RECOVER_ACCOUNT_API = exports.GENERATE_RECOVER_ACCOUNT_TOKEN_API = exports.SIGN_IN_API = exports.SIGN_UP_API = exports.SIGNIN_OPTIONS_API = exports.REGISTER_OPTIONS_API = void 0; exports.REGISTER_OPTIONS_API = "/webauthn/options/register"; exports.SIGNIN_OPTIONS_API = "/webauthn/options/signin"; exports.SIGN_UP_API = "/webauthn/signup"; diff --git a/lib/ts/core/versions/5.3/schema.d.ts b/lib/ts/core/versions/5.3/schema.d.ts index f207540f5..7d935227a 100644 --- a/lib/ts/core/versions/5.3/schema.d.ts +++ b/lib/ts/core/versions/5.3/schema.d.ts @@ -10453,7 +10453,7 @@ export interface operations { /** @example TQvEVDV8B64w_2zIifzKaPzBPfthqpx2uJkq_2PIB0k */ challenge?: string; /** @example 10000 */ - timeout?: string; + timeout?: number; /** @example http://example.com */ origin?: string; /** @example email@example.com */ @@ -10685,9 +10685,9 @@ export interface operations { /** @example true */ userPresence?: boolean; /** @example 1741793746 */ - createdAt?: string; + createdAt?: number; /** @example 1741793746 */ - expiresAt?: string; + expiresAt?: number; } | { /** @enum {string} */