From b8d4b8b6da4cc02de7424d5b81ffc4f7cebbc293 Mon Sep 17 00:00:00 2001 From: Kunal Dawar Date: Fri, 10 Oct 2025 15:16:59 +0530 Subject: [PATCH 1/4] Update Auth0 Version to V5 --- package-lock.json | 65 ++++++++++++++++--- package.json | 2 +- .../directory/handlers/clientGrants.ts | 2 +- .../directory/handlers/resourceServers.ts | 2 +- .../handlers/userAttributeProfiles.ts | 2 +- src/context/directory/index.ts | 2 +- src/context/index.ts | 20 +++--- src/context/yaml/handlers/clientGrants.ts | 2 +- src/context/yaml/handlers/prompts.ts | 2 +- src/context/yaml/handlers/resourceServers.ts | 2 +- .../yaml/handlers/userAttributeProfiles.ts | 2 +- src/context/yaml/index.ts | 2 +- src/tools/auth0/client.ts | 2 +- src/tools/auth0/handlers/actions.ts | 2 +- src/tools/auth0/handlers/branding.ts | 2 +- src/tools/auth0/handlers/clientGrants.ts | 2 +- src/tools/auth0/handlers/connections.ts | 2 +- src/tools/auth0/handlers/customDomains.ts | 4 +- src/tools/auth0/handlers/databases.ts | 2 +- src/tools/auth0/handlers/default.ts | 12 ++-- src/tools/auth0/handlers/emailProvider.ts | 2 +- .../auth0/handlers/flowVaultConnections.ts | 2 +- src/tools/auth0/handlers/flows.ts | 2 +- src/tools/auth0/handlers/forms.ts | 2 +- .../auth0/handlers/guardianFactorTemplates.ts | 2 +- src/tools/auth0/handlers/guardianFactors.ts | 2 +- .../guardianPhoneFactorMessageTypes.ts | 2 +- .../guardianPhoneFactorSelectedProvider.ts | 2 +- src/tools/auth0/handlers/hooks.ts | 2 +- src/tools/auth0/handlers/networkACLs.ts | 7 +- src/tools/auth0/handlers/organizations.ts | 2 +- src/tools/auth0/handlers/pages.ts | 2 +- src/tools/auth0/handlers/phoneProvider.ts | 2 +- src/tools/auth0/handlers/prompts.ts | 2 +- src/tools/auth0/handlers/resourceServers.ts | 2 +- src/tools/auth0/handlers/roles.ts | 2 +- src/tools/auth0/handlers/rules.ts | 2 +- src/tools/auth0/handlers/scimHandler.ts | 5 +- .../auth0/handlers/selfServiceProfiles.ts | 4 +- src/tools/auth0/handlers/tenant.ts | 8 +-- src/tools/auth0/handlers/themes.ts | 2 +- .../auth0/handlers/userAttributeProfiles.ts | 2 +- src/tools/constants.ts | 2 +- src/types.ts | 10 +-- test/context/context.test.js | 2 +- test/context/directory/networkACLs.test.ts | 2 +- test/context/yaml/networkACLs.test.ts | 2 +- 47 files changed, 125 insertions(+), 86 deletions(-) diff --git a/package-lock.json b/package-lock.json index 19a903b0..fd88e613 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "MIT", "dependencies": { "ajv": "^6.12.6", - "auth0": "^4.32.0", + "auth0": "^5.0.0", "dot-prop": "^5.3.0", "fs-extra": "^10.1.0", "js-yaml": "^4.1.0", @@ -1369,6 +1369,21 @@ } }, "node_modules/auth0": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/auth0/-/auth0-5.0.0.tgz", + "integrity": "sha512-UFPHnq41NCB/iYgn/MTkbhOyjZ/16eZleWlox3N2YjGYICliDpQz/vPMUkSLRZfJMxZy+ttjtojItIv4i3KSIA==", + "license": "MIT", + "dependencies": { + "auth0-legacy": "npm:auth0@^4.27.0", + "jose": "^4.13.2", + "uuid": "^11.1.0" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || ^24.0.0" + } + }, + "node_modules/auth0-legacy": { + "name": "auth0", "version": "4.32.0", "resolved": "https://registry.npmjs.org/auth0/-/auth0-4.32.0.tgz", "integrity": "sha512-PYi17311JJ4aTrdCFxWGfDzD1dR0Vmqg+pOqKtfPKW3kaWg77M35sFQTeNwFk8bFtqk9bLQDr8zckMH/jxSy/Q==", @@ -1382,7 +1397,7 @@ "node": ">=18" } }, - "node_modules/auth0/node_modules/uuid": { + "node_modules/auth0-legacy/node_modules/uuid": { "version": "9.0.1", "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", @@ -1390,10 +1405,24 @@ "https://github.com/sponsors/broofa", "https://github.com/sponsors/ctavan" ], + "license": "MIT", "bin": { "uuid": "dist/bin/uuid" } }, + "node_modules/auth0/node_modules/uuid": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz", + "integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist/esm/bin/uuid" + } + }, "node_modules/available-typed-arrays": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", @@ -6543,9 +6572,10 @@ } }, "node_modules/undici-types": { - "version": "6.19.4", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.4.tgz", - "integrity": "sha512-BiKTnNSkjSEYzxd0X3KQ/ZNoA8/aFlS598kds3PuZ55csLy3fFqGap0aP84Ekb/VWYG5um4MgilNs3kAx4LHMg==" + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "license": "MIT" }, "node_modules/universalify": { "version": "2.0.0", @@ -8003,7 +8033,24 @@ "dev": true }, "auth0": { - "version": "4.32.0", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/auth0/-/auth0-5.0.0.tgz", + "integrity": "sha512-UFPHnq41NCB/iYgn/MTkbhOyjZ/16eZleWlox3N2YjGYICliDpQz/vPMUkSLRZfJMxZy+ttjtojItIv4i3KSIA==", + "requires": { + "auth0-legacy": "npm:auth0@^4.27.0", + "jose": "^4.13.2", + "uuid": "^11.1.0" + }, + "dependencies": { + "uuid": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz", + "integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==" + } + } + }, + "auth0-legacy": { + "version": "npm:auth0@4.32.0", "resolved": "https://registry.npmjs.org/auth0/-/auth0-4.32.0.tgz", "integrity": "sha512-PYi17311JJ4aTrdCFxWGfDzD1dR0Vmqg+pOqKtfPKW3kaWg77M35sFQTeNwFk8bFtqk9bLQDr8zckMH/jxSy/Q==", "requires": { @@ -11671,9 +11718,9 @@ "integrity": "sha512-QEg3HPMll0o3t2ourKwOeUAZ159Kn9mx5pnzHRQO8+Wixmh88YdZRiIwat0iNzNNXn0yoEtXJqFpyW7eM8BV7g==" }, "undici-types": { - "version": "6.19.4", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.4.tgz", - "integrity": "sha512-BiKTnNSkjSEYzxd0X3KQ/ZNoA8/aFlS598kds3PuZ55csLy3fFqGap0aP84Ekb/VWYG5um4MgilNs3kAx4LHMg==" + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==" }, "universalify": { "version": "2.0.0", diff --git a/package.json b/package.json index f9f54ee2..3dac51a6 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "homepage": "https://github.com/auth0/auth0-deploy-cli#readme", "dependencies": { "ajv": "^6.12.6", - "auth0": "^4.32.0", + "auth0": "^5.0.0", "dot-prop": "^5.3.0", "fs-extra": "^10.1.0", "js-yaml": "^4.1.0", diff --git a/src/context/directory/handlers/clientGrants.ts b/src/context/directory/handlers/clientGrants.ts index ebea6de7..3c210808 100644 --- a/src/context/directory/handlers/clientGrants.ts +++ b/src/context/directory/handlers/clientGrants.ts @@ -1,6 +1,6 @@ import path from 'path'; import fs from 'fs-extra'; -import { Client, ResourceServer } from 'auth0'; +import { Client, ResourceServer } from 'auth0/legacy'; import { constants, keywordReplace } from '../../../tools'; import { diff --git a/src/context/directory/handlers/resourceServers.ts b/src/context/directory/handlers/resourceServers.ts index 6b48bb2d..4c0bda33 100644 --- a/src/context/directory/handlers/resourceServers.ts +++ b/src/context/directory/handlers/resourceServers.ts @@ -1,4 +1,4 @@ -import { Client, ResourceServer } from 'auth0'; +import { Client, ResourceServer } from 'auth0/legacy'; import path from 'path'; import fs from 'fs-extra'; import { constants } from '../../../tools'; diff --git a/src/context/directory/handlers/userAttributeProfiles.ts b/src/context/directory/handlers/userAttributeProfiles.ts index 7b01a6c8..6d513f3f 100644 --- a/src/context/directory/handlers/userAttributeProfiles.ts +++ b/src/context/directory/handlers/userAttributeProfiles.ts @@ -1,6 +1,6 @@ import path from 'path'; import fs from 'fs-extra'; -import { UserAttributeProfile } from 'auth0'; +import { UserAttributeProfile } from 'auth0/legacy'; import { constants } from '../../../tools'; import DirectoryContext from '..'; import { dumpJSON, existsMustBeDir, getFiles, loadJSON, sanitize } from '../../../utils'; diff --git a/src/context/directory/index.ts b/src/context/directory/index.ts index d6e51cdb..c785419d 100644 --- a/src/context/directory/index.ts +++ b/src/context/directory/index.ts @@ -1,5 +1,5 @@ import * as path from 'path'; -import { ManagementClient } from 'auth0'; +import { ManagementClient } from 'auth0/legacy'; import { loadFileAndReplaceKeywords, Auth0 } from '../../tools'; import pagedClient from '../../tools/auth0/client'; diff --git a/src/context/index.ts b/src/context/index.ts index 1d846e99..3ae70c05 100644 --- a/src/context/index.ts +++ b/src/context/index.ts @@ -1,6 +1,6 @@ import { lstatSync, readdirSync, readFileSync, existsSync } from 'fs'; import path from 'path'; -import { AuthenticationClient, ManagementClient } from 'auth0'; +import { AuthenticationClient, ManagementClient } from 'auth0/legacy'; import YAMLContext from './yaml'; import DirectoryContext from './directory'; @@ -127,8 +127,7 @@ export const setupContext = async ( }); if (usedDeprecatedParams.length > 0) { log.warn( - `Usage of the ${usedDeprecatedParams.join(', ')} exclusion ${ - usedDeprecatedParams.length > 1 ? 'params are' : 'param is' + `Usage of the ${usedDeprecatedParams.join(', ')} exclusion ${usedDeprecatedParams.length > 1 ? 'params are' : 'param is' } deprecated and may be removed from future major versions. See: https://github.com/auth0/auth0-deploy-cli/issues/451#user-content-deprecated-exclusion-props for details.` ); } @@ -138,10 +137,9 @@ export const setupContext = async ( // Check if experimental early access features are enabled if (config.AUTH0_EXPERIMENTAL_EA) { log.warn( - `Experimental early access ${ - EA_FEATURES.length === 1 - ? 'feature [' + EA_FEATURES.join('') + '] is' - : 'features [' + EA_FEATURES.join(',') + '] are' + `Experimental early access ${EA_FEATURES.length === 1 + ? 'feature [' + EA_FEATURES.join('') + '] is' + : 'features [' + EA_FEATURES.join(',') + '] are' } enabled. These are in a pre-release state and may change in future release.` ); } else { @@ -250,7 +248,7 @@ export const setupContext = async ( export const filterOnlyIncludedResourceTypes = (includedAssetTypes: AssetTypes[] | undefined) => - ([handlerName, _]: [AssetTypes, any]) => { - if (includedAssetTypes === undefined) return true; - return includedAssetTypes.includes(handlerName); - }; + ([handlerName, _]: [AssetTypes, any]) => { + if (includedAssetTypes === undefined) return true; + return includedAssetTypes.includes(handlerName); + }; diff --git a/src/context/yaml/handlers/clientGrants.ts b/src/context/yaml/handlers/clientGrants.ts index 5c14c985..b15d2fd5 100644 --- a/src/context/yaml/handlers/clientGrants.ts +++ b/src/context/yaml/handlers/clientGrants.ts @@ -1,4 +1,4 @@ -import { Client } from 'auth0'; +import { Client } from 'auth0/legacy'; import { convertClientIdToName } from '../../../utils'; import { YAMLHandler } from '.'; import YAMLContext from '..'; diff --git a/src/context/yaml/handlers/prompts.ts b/src/context/yaml/handlers/prompts.ts index aa20e0f6..055c5e1f 100644 --- a/src/context/yaml/handlers/prompts.ts +++ b/src/context/yaml/handlers/prompts.ts @@ -1,6 +1,6 @@ import path from 'path'; import { ensureDirSync, writeFileSync } from 'fs-extra'; -import { GetRendering200Response } from 'auth0'; +import { GetRendering200Response } from 'auth0/legacy'; import { YAMLHandler } from '.'; import YAMLContext from '..'; import { constants } from '../../../tools'; diff --git a/src/context/yaml/handlers/resourceServers.ts b/src/context/yaml/handlers/resourceServers.ts index 81a62518..e91913c7 100644 --- a/src/context/yaml/handlers/resourceServers.ts +++ b/src/context/yaml/handlers/resourceServers.ts @@ -1,4 +1,4 @@ -import { Client, ResourceServer } from 'auth0'; +import { Client, ResourceServer } from 'auth0/legacy'; import { YAMLHandler } from '.'; import YAMLContext from '..'; import { ParsedAsset } from '../../../types'; diff --git a/src/context/yaml/handlers/userAttributeProfiles.ts b/src/context/yaml/handlers/userAttributeProfiles.ts index 42e0b451..08e8b803 100644 --- a/src/context/yaml/handlers/userAttributeProfiles.ts +++ b/src/context/yaml/handlers/userAttributeProfiles.ts @@ -1,4 +1,4 @@ -import { UserAttributeProfile } from 'auth0'; +import { UserAttributeProfile } from 'auth0/legacy'; import { YAMLHandler } from '.'; import YAMLContext from '..'; import { ParsedAsset } from '../../../types'; diff --git a/src/context/yaml/index.ts b/src/context/yaml/index.ts index 385f5cf2..c96b54fc 100644 --- a/src/context/yaml/index.ts +++ b/src/context/yaml/index.ts @@ -1,7 +1,7 @@ import fs from 'fs-extra'; import yaml from 'js-yaml'; import path from 'path'; -import { ManagementClient } from 'auth0'; +import { ManagementClient } from 'auth0/legacy'; import { loadFileAndReplaceKeywords, keywordReplace, diff --git a/src/tools/auth0/client.ts b/src/tools/auth0/client.ts index 00a26280..98ba4ffb 100644 --- a/src/tools/auth0/client.ts +++ b/src/tools/auth0/client.ts @@ -1,7 +1,7 @@ import { PromisePoolExecutor } from 'promise-pool-executor'; import _ from 'lodash'; -import { JSONApiResponse, ManagementClient } from 'auth0'; +import { JSONApiResponse, ManagementClient } from 'auth0/legacy'; import { flatten } from '../utils'; import { Asset, diff --git a/src/tools/auth0/handlers/actions.ts b/src/tools/auth0/handlers/actions.ts index 3111cd25..4cb1481d 100644 --- a/src/tools/auth0/handlers/actions.ts +++ b/src/tools/auth0/handlers/actions.ts @@ -1,5 +1,5 @@ import _ from 'lodash'; -import { GetActions200ResponseActionsInner, PostActionRequest } from 'auth0'; +import { GetActions200ResponseActionsInner, PostActionRequest } from 'auth0/legacy'; import DefaultAPIHandler, { order } from './default'; import log from '../../../logger'; import { areArraysEquals, sleep } from '../../utils'; diff --git a/src/tools/auth0/handlers/branding.ts b/src/tools/auth0/handlers/branding.ts index 8f847143..179f9940 100644 --- a/src/tools/auth0/handlers/branding.ts +++ b/src/tools/auth0/handlers/branding.ts @@ -1,4 +1,4 @@ -import { CustomDomain, GetBranding200Response, GetUniversalLogin200ResponseOneOf } from 'auth0'; +import { CustomDomain, GetBranding200Response, GetUniversalLogin200ResponseOneOf } from 'auth0/legacy'; import DefaultHandler, { order } from './default'; import constants from '../../constants'; import log from '../../../logger'; diff --git a/src/tools/auth0/handlers/clientGrants.ts b/src/tools/auth0/handlers/clientGrants.ts index 47f80e9a..795234ee 100644 --- a/src/tools/auth0/handlers/clientGrants.ts +++ b/src/tools/auth0/handlers/clientGrants.ts @@ -1,4 +1,4 @@ -import { Client, ClientGrantSubjectTypeEnum } from 'auth0'; +import { Client, ClientGrantSubjectTypeEnum } from 'auth0/legacy'; import DefaultHandler, { order } from './default'; import { convertClientNamesToIds } from '../../utils'; import { Assets, CalculatedChanges } from '../../../types'; diff --git a/src/tools/auth0/handlers/connections.ts b/src/tools/auth0/handlers/connections.ts index ddf2d162..239bd37f 100644 --- a/src/tools/auth0/handlers/connections.ts +++ b/src/tools/auth0/handlers/connections.ts @@ -1,6 +1,6 @@ import dotProp from 'dot-prop'; import _ from 'lodash'; -import { Client, Connection, GetConnectionsStrategyEnum, PatchClientsRequestInner } from 'auth0'; +import { Client, Connection, GetConnectionsStrategyEnum, PatchClientsRequestInner } from 'auth0/legacy'; import DefaultAPIHandler, { order } from './default'; import { filterExcluded, convertClientNameToId, getEnabledClients, sleep } from '../../utils'; import { CalculatedChanges, Asset, Assets, Auth0APIClient } from '../../../types'; diff --git a/src/tools/auth0/handlers/customDomains.ts b/src/tools/auth0/handlers/customDomains.ts index bb6d185e..e8361a25 100644 --- a/src/tools/auth0/handlers/customDomains.ts +++ b/src/tools/auth0/handlers/customDomains.ts @@ -1,4 +1,4 @@ -import { CustomDomain } from 'auth0'; +import { CustomDomain } from 'auth0/legacy'; import DefaultAPIHandler, { order } from './default'; import { Asset, Assets } from '../../../types'; import log from '../../../logger'; @@ -95,7 +95,7 @@ export default class CustomDomainsHadnler extends DefaultAPIHandler { if ( err.statusCode === 403 && err.message === - 'The account is not allowed to perform this operation, please contact our support team' + 'The account is not allowed to perform this operation, please contact our support team' ) { return null; } diff --git a/src/tools/auth0/handlers/databases.ts b/src/tools/auth0/handlers/databases.ts index ebb340ef..c8b6ac67 100644 --- a/src/tools/auth0/handlers/databases.ts +++ b/src/tools/auth0/handlers/databases.ts @@ -1,4 +1,4 @@ -import { Client, Connection, GetConnectionsStrategyEnum } from 'auth0'; +import { Client, Connection, GetConnectionsStrategyEnum } from 'auth0/legacy'; import DefaultAPIHandler, { order } from './default'; import constants from '../../constants'; import { filterExcluded, getEnabledClients } from '../../utils'; diff --git a/src/tools/auth0/handlers/default.ts b/src/tools/auth0/handlers/default.ts index 8c13ab67..8f3746e5 100644 --- a/src/tools/auth0/handlers/default.ts +++ b/src/tools/auth0/handlers/default.ts @@ -1,4 +1,4 @@ -import { JSONApiResponse } from 'auth0'; +import { JSONApiResponse } from 'auth0/legacy'; import ValidationError from '../../validationError'; import { @@ -195,9 +195,8 @@ export default class APIHandler { const duplicateIDs = duplicateItems(typeAssets, this.id); if (duplicateIDs.length > 0) { const formatted = duplicateIDs.map((dups) => dups.map((d) => `${d[this.id]}`)); - throw new ValidationError(`There are multiple ${ - this.type - } for the following stage-order combinations + throw new ValidationError(`There are multiple ${this.type + } for the following stage-order combinations ${convertJsonToString(formatted)}. Only one rule must be defined for the same order number in a stage.`); } @@ -226,9 +225,8 @@ export default class APIHandler { (this.type === 'rules' || this.type === 'resourceServers'); const shouldDelete = allowDelete || byExtension; if (!shouldDelete) { - log.warn(`Detected the following ${ - this.type - } should be deleted. Doing so may be destructive.\nYou can enable deletes by setting 'AUTH0_ALLOW_DELETE' to true in the config + log.warn(`Detected the following ${this.type + } should be deleted. Doing so may be destructive.\nYou can enable deletes by setting 'AUTH0_ALLOW_DELETE' to true in the config \n${changes.del.map((i) => this.objString(i)).join('\n')} `); } else { diff --git a/src/tools/auth0/handlers/emailProvider.ts b/src/tools/auth0/handlers/emailProvider.ts index ac838735..127ab302 100644 --- a/src/tools/auth0/handlers/emailProvider.ts +++ b/src/tools/auth0/handlers/emailProvider.ts @@ -1,4 +1,4 @@ -import { EmailProviderCreate } from 'auth0'; +import { EmailProviderCreate } from 'auth0/legacy'; import { isEmpty } from 'lodash'; import DefaultHandler, { order } from './default'; import { Asset, Assets } from '../../../types'; diff --git a/src/tools/auth0/handlers/flowVaultConnections.ts b/src/tools/auth0/handlers/flowVaultConnections.ts index 6502405c..aba1dd8b 100644 --- a/src/tools/auth0/handlers/flowVaultConnections.ts +++ b/src/tools/auth0/handlers/flowVaultConnections.ts @@ -1,7 +1,7 @@ import { GetFlowsVaultConnections200ResponseOneOfInner, PatchFlowsVaultConnectionsByIdRequest, -} from 'auth0'; +} from 'auth0/legacy'; import { isArray, isEmpty } from 'lodash'; import DefaultHandler, { order } from './default'; import { Asset, Assets, CalculatedChanges } from '../../../types'; diff --git a/src/tools/auth0/handlers/flows.ts b/src/tools/auth0/handlers/flows.ts index 2ca1609a..9db95186 100644 --- a/src/tools/auth0/handlers/flows.ts +++ b/src/tools/auth0/handlers/flows.ts @@ -3,7 +3,7 @@ import { GetFlows200ResponseOneOfInner, GetFlowsVaultConnections200ResponseOneOfInner, PostFlows201Response, -} from 'auth0'; +} from 'auth0/legacy'; import dotProp from 'dot-prop'; import DefaultHandler, { order } from './default'; import { Asset, Assets, CalculatedChanges } from '../../../types'; diff --git a/src/tools/auth0/handlers/forms.ts b/src/tools/auth0/handlers/forms.ts index 5b8425bd..c86bf489 100644 --- a/src/tools/auth0/handlers/forms.ts +++ b/src/tools/auth0/handlers/forms.ts @@ -2,7 +2,7 @@ import { GetFlows200ResponseOneOfInner, GetForms200ResponseOneOfInner, PostForms201Response, -} from 'auth0'; +} from 'auth0/legacy'; import dotProp from 'dot-prop'; import { isEmpty } from 'lodash'; import DefaultHandler, { order } from './default'; diff --git a/src/tools/auth0/handlers/guardianFactorTemplates.ts b/src/tools/auth0/handlers/guardianFactorTemplates.ts index ffef826b..2e4b3e68 100644 --- a/src/tools/auth0/handlers/guardianFactorTemplates.ts +++ b/src/tools/auth0/handlers/guardianFactorTemplates.ts @@ -1,4 +1,4 @@ -import { TemplateMessages } from 'auth0'; +import { TemplateMessages } from 'auth0/legacy'; import DefaultHandler from './default'; import constants from '../../constants'; import { Assets, Asset } from '../../../types'; diff --git a/src/tools/auth0/handlers/guardianFactors.ts b/src/tools/auth0/handlers/guardianFactors.ts index aa2b9a15..2ff135c8 100644 --- a/src/tools/auth0/handlers/guardianFactors.ts +++ b/src/tools/auth0/handlers/guardianFactors.ts @@ -1,4 +1,4 @@ -import { Factor, FactorNameEnum } from 'auth0'; +import { Factor, FactorNameEnum } from 'auth0/legacy'; import DefaultHandler from './default'; import constants from '../../constants'; import { Asset, Assets } from '../../../types'; diff --git a/src/tools/auth0/handlers/guardianPhoneFactorMessageTypes.ts b/src/tools/auth0/handlers/guardianPhoneFactorMessageTypes.ts index 639e2ec6..1643b692 100644 --- a/src/tools/auth0/handlers/guardianPhoneFactorMessageTypes.ts +++ b/src/tools/auth0/handlers/guardianPhoneFactorMessageTypes.ts @@ -1,4 +1,4 @@ -import { GetMessageTypes200Response } from 'auth0'; +import { GetMessageTypes200Response } from 'auth0/legacy'; import DefaultHandler from './default'; import constants from '../../constants'; import { Asset, Assets } from '../../../types'; diff --git a/src/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.ts b/src/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.ts index cb1197a2..d9359069 100644 --- a/src/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.ts +++ b/src/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.ts @@ -1,4 +1,4 @@ -import { GetPhoneProviders200Response } from 'auth0'; +import { GetPhoneProviders200Response } from 'auth0/legacy'; import DefaultHandler from './default'; import constants from '../../constants'; import { Asset, Assets } from '../../../types'; diff --git a/src/tools/auth0/handlers/hooks.ts b/src/tools/auth0/handlers/hooks.ts index 6bb1fccd..fcd9f526 100644 --- a/src/tools/auth0/handlers/hooks.ts +++ b/src/tools/auth0/handlers/hooks.ts @@ -1,4 +1,4 @@ -import { Hook } from 'auth0'; +import { Hook } from 'auth0/legacy'; import DefaultHandler from './default'; import constants from '../../constants'; import { Asset, Assets, CalculatedChanges } from '../../../types'; diff --git a/src/tools/auth0/handlers/networkACLs.ts b/src/tools/auth0/handlers/networkACLs.ts index 13792dd9..16ed2edf 100644 --- a/src/tools/auth0/handlers/networkACLs.ts +++ b/src/tools/auth0/handlers/networkACLs.ts @@ -1,4 +1,4 @@ -import { GetNetworkAclsById200Response } from 'auth0'; +import { GetNetworkAclsById200Response } from 'auth0/legacy'; import DefaultAPIHandler from './default'; import { Asset, Assets, CalculatedChanges } from '../../../types'; import { paginate } from '../client'; @@ -346,9 +346,8 @@ export default class NetworkACLsHandler extends DefaultAPIHandler { }) .promise(); } else { - log.warn(`Detected the following ${ - this.type - } should be deleted. Doing so may be destructive.\nYou can enable deletes by setting 'AUTH0_ALLOW_DELETE' to true in the config + log.warn(`Detected the following ${this.type + } should be deleted. Doing so may be destructive.\nYou can enable deletes by setting 'AUTH0_ALLOW_DELETE' to true in the config \n${data.map((i) => this.objString(i)).join('\n')}`); } } diff --git a/src/tools/auth0/handlers/organizations.ts b/src/tools/auth0/handlers/organizations.ts index 508b42a1..684b6ef0 100644 --- a/src/tools/auth0/handlers/organizations.ts +++ b/src/tools/auth0/handlers/organizations.ts @@ -6,7 +6,7 @@ import { GetOrganizationClientGrants200ResponseOneOfInner, GetOrganizations200ResponseOneOfInner, PostEnabledConnectionsRequest, -} from 'auth0'; +} from 'auth0/legacy'; import DefaultHandler, { order } from './default'; import { calculateChanges } from '../../calculateChanges'; import log from '../../../logger'; diff --git a/src/tools/auth0/handlers/pages.ts b/src/tools/auth0/handlers/pages.ts index 745ce7be..3d0edba5 100644 --- a/src/tools/auth0/handlers/pages.ts +++ b/src/tools/auth0/handlers/pages.ts @@ -1,4 +1,4 @@ -import { Client } from 'auth0'; +import { Client } from 'auth0/legacy'; import DefaultHandler from './default'; import constants from '../../constants'; import { Asset, Assets } from '../../../types'; diff --git a/src/tools/auth0/handlers/phoneProvider.ts b/src/tools/auth0/handlers/phoneProvider.ts index 2c60baeb..67c25923 100644 --- a/src/tools/auth0/handlers/phoneProvider.ts +++ b/src/tools/auth0/handlers/phoneProvider.ts @@ -3,7 +3,7 @@ import { DeletePhoneProviderRequest, GetBrandingPhoneProviders200ResponseProvidersInner, UpdatePhoneProviderOperationRequest, -} from 'auth0'; +} from 'auth0/legacy'; import DefaultHandler, { order } from './default'; import { Assets } from '../../../types'; import log from '../../../logger'; diff --git a/src/tools/auth0/handlers/prompts.ts b/src/tools/auth0/handlers/prompts.ts index 97792184..5735bbce 100644 --- a/src/tools/auth0/handlers/prompts.ts +++ b/src/tools/auth0/handlers/prompts.ts @@ -6,7 +6,7 @@ import { PatchRenderingRequest, PatchRenderingRequestRenderingModeEnum, PutPartialsRequest, -} from 'auth0'; +} from 'auth0/legacy'; import DefaultHandler from './default'; import { Assets, Language, languages } from '../../../types'; import log from '../../../logger'; diff --git a/src/tools/auth0/handlers/resourceServers.ts b/src/tools/auth0/handlers/resourceServers.ts index d8bc012b..322cd96c 100644 --- a/src/tools/auth0/handlers/resourceServers.ts +++ b/src/tools/auth0/handlers/resourceServers.ts @@ -3,7 +3,7 @@ import { ResourceServerProofOfPossessionMechanismEnum, ResourceServerSubjectTypeAuthorizationClientPolicyEnum, ResourceServerSubjectTypeAuthorizationUserPolicyEnum, -} from 'auth0'; +} from 'auth0/legacy'; import ValidationError from '../../validationError'; import constants from '../../constants'; diff --git a/src/tools/auth0/handlers/roles.ts b/src/tools/auth0/handlers/roles.ts index d40f55dd..630197d1 100644 --- a/src/tools/auth0/handlers/roles.ts +++ b/src/tools/auth0/handlers/roles.ts @@ -1,4 +1,4 @@ -import { GetOrganizationMemberRoles200ResponseOneOfInner, Permission, ResourceServer } from 'auth0'; +import { GetOrganizationMemberRoles200ResponseOneOfInner, Permission, ResourceServer } from 'auth0/legacy'; import { isArray } from 'lodash'; import DefaultHandler, { order } from './default'; import { calculateChanges } from '../../calculateChanges'; diff --git a/src/tools/auth0/handlers/rules.ts b/src/tools/auth0/handlers/rules.ts index b88df00c..7530eae6 100644 --- a/src/tools/auth0/handlers/rules.ts +++ b/src/tools/auth0/handlers/rules.ts @@ -1,4 +1,4 @@ -import { Rule } from 'auth0'; +import { Rule } from 'auth0/legacy'; import ValidationError from '../../validationError'; import { convertJsonToString, stripFields, duplicateItems, isDeprecatedError } from '../../utils'; import DefaultHandler from './default'; diff --git a/src/tools/auth0/handlers/scimHandler.ts b/src/tools/auth0/handlers/scimHandler.ts index bf3acb89..32751a22 100644 --- a/src/tools/auth0/handlers/scimHandler.ts +++ b/src/tools/auth0/handlers/scimHandler.ts @@ -1,5 +1,5 @@ import { PromisePoolExecutor } from 'promise-pool-executor'; -import { ConnectionCreate } from 'auth0'; +import { ConnectionCreate } from 'auth0/legacy'; import { Asset, Auth0APIClient } from '../../../types'; import log from '../../../logger'; import { ConfigFunction } from '../../../configFactory'; @@ -206,8 +206,7 @@ export default class ScimHandler { } log.error( - `SCIM request failed with status code ${error.statusCode}. ${ - error.message || error.toString() + `SCIM request failed with status code ${error.statusCode}. ${error.message || error.toString() }.` ); throw error; diff --git a/src/tools/auth0/handlers/selfServiceProfiles.ts b/src/tools/auth0/handlers/selfServiceProfiles.ts index 541df782..7b4ae331 100644 --- a/src/tools/auth0/handlers/selfServiceProfiles.ts +++ b/src/tools/auth0/handlers/selfServiceProfiles.ts @@ -3,7 +3,7 @@ import { GetSelfServiceProfileCustomTextPageEnum, SsProfile, UserAttributeProfile, -} from 'auth0'; +} from 'auth0/legacy'; import { isEmpty } from 'lodash'; import { Asset, Assets, CalculatedChanges } from '../../../types'; import log from '../../../logger'; @@ -233,7 +233,7 @@ export default class SelfServiceProfileHandler extends DefaultAPIHandler { }, { ...customText[GetSelfServiceProfileCustomTextLanguageEnum.en][ - GetSelfServiceProfileCustomTextPageEnum.get_started + GetSelfServiceProfileCustomTextPageEnum.get_started ], } ); diff --git a/src/tools/auth0/handlers/tenant.ts b/src/tools/auth0/handlers/tenant.ts index 6a537b0e..e542bd4f 100644 --- a/src/tools/auth0/handlers/tenant.ts +++ b/src/tools/auth0/handlers/tenant.ts @@ -3,7 +3,7 @@ import { TenantSettingsFlags, TenantSettingsUpdate, TenantSettingsUpdateFlags, -} from 'auth0'; +} from 'auth0/legacy'; import ValidationError from '../../validationError'; import DefaultHandler, { order } from './default'; import { supportedPages, pageNameMap } from './pages'; @@ -119,11 +119,9 @@ export const removeUnallowedTenantFlags = ( if (removedFlags.length > 0) { log.warn( - `The following tenant flag${ - removedFlags.length > 1 ? 's have not been' : ' has not been' + `The following tenant flag${removedFlags.length > 1 ? 's have not been' : ' has not been' } updated because deemed incompatible with the target tenant: ${removedFlags.join(', ')} - ${ - removedFlags.length > 1 ? 'These flags' : 'This flag' + ${removedFlags.length > 1 ? 'These flags' : 'This flag' } can likely be removed from the tenant definition file. If you believe this removal is an error, please report via a Github issue.` ); } diff --git a/src/tools/auth0/handlers/themes.ts b/src/tools/auth0/handlers/themes.ts index e4e149ce..e13ce480 100644 --- a/src/tools/auth0/handlers/themes.ts +++ b/src/tools/auth0/handlers/themes.ts @@ -1,4 +1,4 @@ -import { PostBrandingTheme200Response } from 'auth0'; +import { PostBrandingTheme200Response } from 'auth0/legacy'; import { Assets } from '../../../types'; import log from '../../../logger'; import DefaultHandler, { order } from './default'; diff --git a/src/tools/auth0/handlers/userAttributeProfiles.ts b/src/tools/auth0/handlers/userAttributeProfiles.ts index fde2b8ab..65ed9391 100644 --- a/src/tools/auth0/handlers/userAttributeProfiles.ts +++ b/src/tools/auth0/handlers/userAttributeProfiles.ts @@ -1,4 +1,4 @@ -import { UserAttributeProfile } from 'auth0'; +import { UserAttributeProfile } from 'auth0/legacy'; import DefaultAPIHandler, { order } from './default'; import { Assets } from '../../../types'; diff --git a/src/tools/constants.ts b/src/tools/constants.ts index b001199a..5c59a8e2 100644 --- a/src/tools/constants.ts +++ b/src/tools/constants.ts @@ -1,4 +1,4 @@ -import { GetEmailTemplatesByTemplateNameTemplateNameEnum } from 'auth0'; +import { GetEmailTemplatesByTemplateNameTemplateNameEnum } from 'auth0/legacy'; const PAGE_GUARDIAN_MULTIFACTOR = 'guardian_multifactor'; const PAGE_PASSWORD_RESET = 'password_reset'; diff --git a/src/types.ts b/src/types.ts index 15e1cc09..31f70458 100644 --- a/src/types.ts +++ b/src/types.ts @@ -4,7 +4,7 @@ import { ManagementClient, ResourceServer, UserAttributeProfile, -} from 'auth0'; +} from 'auth0/legacy'; import { PromisePoolExecutor } from 'promise-pool-executor'; import { Action } from './tools/auth0/handlers/actions'; import { Prompts } from './tools/auth0/handlers/prompts'; @@ -95,10 +95,10 @@ export type Assets = Partial<{ actions: Action[] | null; attackProtection: Asset | null; branding: - | (Asset & { - templates?: { template: string; body: string }[] | null; - }) - | null; + | (Asset & { + templates?: { template: string; body: string }[] | null; + }) + | null; phoneProviders: PhoneProvider[] | null; clients: Client[] | null; clientGrants: ClientGrant[] | null; diff --git a/test/context/context.test.js b/test/context/context.test.js index dd4560bf..f616077b 100644 --- a/test/context/context.test.js +++ b/test/context/context.test.js @@ -1,5 +1,5 @@ import path from 'path'; -import { ResponseError } from 'auth0'; +import { ResponseError } from 'auth0/legacy'; import fs from 'fs-extra'; import chai, { expect } from 'chai'; import sinon from 'sinon'; diff --git a/test/context/directory/networkACLs.test.ts b/test/context/directory/networkACLs.test.ts index 016af164..3e900318 100644 --- a/test/context/directory/networkACLs.test.ts +++ b/test/context/directory/networkACLs.test.ts @@ -1,7 +1,7 @@ import path from 'path'; import { expect } from 'chai'; import fs from 'fs-extra'; -import { ManagementClient } from 'auth0'; +import { ManagementClient } from 'auth0/legacy'; import Context from '../../../src/context/directory'; import handler from '../../../src/context/directory/handlers/networkACLs'; diff --git a/test/context/yaml/networkACLs.test.ts b/test/context/yaml/networkACLs.test.ts index bdd90e37..c892abd2 100644 --- a/test/context/yaml/networkACLs.test.ts +++ b/test/context/yaml/networkACLs.test.ts @@ -2,7 +2,7 @@ import path from 'path'; import fs from 'fs-extra'; import { expect } from 'chai'; import { cloneDeep } from 'lodash'; -import { ManagementClient } from 'auth0'; +import { ManagementClient } from 'auth0/legacy'; import Context from '../../../src/context/yaml'; import handler from '../../../src/context/yaml/handlers/networkACLs'; From 3efc00a5cd09b17e69debb24e1fc92558c1888ce Mon Sep 17 00:00:00 2001 From: Kunal Dawar Date: Fri, 10 Oct 2025 15:19:49 +0530 Subject: [PATCH 2/4] fix: update module and moduleResolution to node16 in tsconfig --- tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index 772ad734..726bd785 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "target": "es2016", "experimentalDecorators": true, - "module": "commonjs", + "module": "node16", + "moduleResolution": "node16", "rootDir": "./src", "allowJs": true, "outDir": "./lib", From 8b1951c5e6259e00894a1371af8d2f5374680acc Mon Sep 17 00:00:00 2001 From: Kunal Dawar Date: Fri, 10 Oct 2025 15:22:50 +0530 Subject: [PATCH 3/4] fix: add "auth0/legacy" to import/core-modules in ESLint configuration --- .eslintrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.eslintrc b/.eslintrc index 20b5beeb..37462909 100644 --- a/.eslintrc +++ b/.eslintrc @@ -14,7 +14,8 @@ "node": { "extensions": [".js", ".ts"] } - } + }, + "import/core-modules": ["auth0/legacy"] }, "rules": { "max-len": 0, From d8ee9f1bcc492ebe53f2de0638adb54aad4bfd79 Mon Sep 17 00:00:00 2001 From: Kunal Dawar Date: Fri, 10 Oct 2025 16:32:42 +0530 Subject: [PATCH 4/4] fix: change module and moduleResolution to nodenext in tsconfig --- tsconfig.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index 726bd785..98984511 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,8 +2,8 @@ "compilerOptions": { "target": "es2016", "experimentalDecorators": true, - "module": "node16", - "moduleResolution": "node16", + "module": "nodenext", + "moduleResolution": "nodenext", "rootDir": "./src", "allowJs": true, "outDir": "./lib",