auth0-deploy-cli 8.22.0 → 8.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.circleci/config.yml +57 -5
- package/CHANGELOG.md +41 -2
- package/README.md +1 -1
- package/eslint.config.js +131 -0
- package/lib/args.js +0 -1
- package/lib/commands/export.js +41 -49
- package/lib/commands/import.js +36 -43
- package/lib/commands/index.js +0 -1
- package/lib/configFactory.js +0 -1
- package/lib/context/defaults.d.ts +1 -0
- package/lib/context/defaults.js +57 -10
- package/lib/context/directory/handlers/actions.js +40 -39
- package/lib/context/directory/handlers/attackProtection.js +22 -34
- package/lib/context/directory/handlers/branding.js +12 -21
- package/lib/context/directory/handlers/clientGrants.js +52 -62
- package/lib/context/directory/handlers/clients.js +44 -57
- package/lib/context/directory/handlers/connectionProfiles.d.ts +1 -1
- package/lib/context/directory/handlers/connectionProfiles.js +20 -30
- package/lib/context/directory/handlers/connections.js +32 -41
- package/lib/context/directory/handlers/customDomains.js +9 -21
- package/lib/context/directory/handlers/databases.js +37 -35
- package/lib/context/directory/handlers/emailProvider.js +22 -36
- package/lib/context/directory/handlers/emailTemplates.js +20 -29
- package/lib/context/directory/handlers/flowVaultConnections.js +40 -49
- package/lib/context/directory/handlers/flows.js +38 -48
- package/lib/context/directory/handlers/forms.js +38 -48
- package/lib/context/directory/handlers/guardianFactorProviders.js +9 -21
- package/lib/context/directory/handlers/guardianFactorTemplates.js +9 -21
- package/lib/context/directory/handlers/guardianFactors.js +9 -21
- package/lib/context/directory/handlers/guardianPhoneFactorMessageTypes.js +8 -20
- package/lib/context/directory/handlers/guardianPhoneFactorSelectedProvider.js +8 -20
- package/lib/context/directory/handlers/guardianPolicies.js +8 -20
- package/lib/context/directory/handlers/hooks.js +24 -34
- package/lib/context/directory/handlers/index.js +4 -1
- package/lib/context/directory/handlers/logStreams.js +12 -24
- package/lib/context/directory/handlers/networkACLs.js +22 -34
- package/lib/context/directory/handlers/organizations.js +39 -44
- package/lib/context/directory/handlers/pages.js +31 -37
- package/lib/context/directory/handlers/phoneProvider.js +12 -24
- package/lib/context/directory/handlers/phoneTemplates.d.ts +6 -0
- package/lib/context/directory/handlers/phoneTemplates.js +39 -0
- package/lib/context/directory/handlers/prompts.js +58 -76
- package/lib/context/directory/handlers/resourceServers.d.ts +1 -1
- package/lib/context/directory/handlers/resourceServers.js +18 -30
- package/lib/context/directory/handlers/roles.js +21 -31
- package/lib/context/directory/handlers/rules.js +22 -32
- package/lib/context/directory/handlers/rulesConfigs.js +3 -15
- package/lib/context/directory/handlers/selfServiceProfiles.js +28 -40
- package/lib/context/directory/handlers/tenant.js +14 -34
- package/lib/context/directory/handlers/themes.js +9 -21
- package/lib/context/directory/handlers/tokenExchangeProfiles.d.ts +5 -0
- package/lib/context/directory/handlers/tokenExchangeProfiles.js +41 -0
- package/lib/context/directory/handlers/triggers.d.ts +1 -1
- package/lib/context/directory/handlers/triggers.js +16 -26
- package/lib/context/directory/handlers/userAttributeProfiles.d.ts +1 -1
- package/lib/context/directory/handlers/userAttributeProfiles.js +16 -26
- package/lib/context/directory/index.js +66 -80
- package/lib/context/index.js +7 -18
- package/lib/context/yaml/handlers/actions.js +39 -41
- package/lib/context/yaml/handlers/attackProtection.js +27 -41
- package/lib/context/yaml/handlers/branding.js +47 -69
- package/lib/context/yaml/handlers/clientGrants.js +26 -40
- package/lib/context/yaml/handlers/clients.js +69 -84
- package/lib/context/yaml/handlers/connectionProfiles.d.ts +1 -1
- package/lib/context/yaml/handlers/connectionProfiles.js +20 -34
- package/lib/context/yaml/handlers/connections.js +63 -67
- package/lib/context/yaml/handlers/customDomains.js +7 -19
- package/lib/context/yaml/handlers/databases.js +63 -65
- package/lib/context/yaml/handlers/emailProvider.js +22 -37
- package/lib/context/yaml/handlers/emailTemplates.js +28 -39
- package/lib/context/yaml/handlers/flowVaultConnections.js +37 -50
- package/lib/context/yaml/handlers/flows.js +55 -66
- package/lib/context/yaml/handlers/forms.js +55 -66
- package/lib/context/yaml/handlers/guardianFactorProviders.js +7 -19
- package/lib/context/yaml/handlers/guardianFactorTemplates.js +7 -19
- package/lib/context/yaml/handlers/guardianFactors.js +7 -19
- package/lib/context/yaml/handlers/guardianPhoneFactorMessageTypes.js +7 -19
- package/lib/context/yaml/handlers/guardianPhoneFactorSelectedProvider.js +7 -19
- package/lib/context/yaml/handlers/guardianPolicies.js +7 -19
- package/lib/context/yaml/handlers/hooks.js +34 -48
- package/lib/context/yaml/handlers/index.js +4 -1
- package/lib/context/yaml/handlers/logStreams.js +16 -30
- package/lib/context/yaml/handlers/networkACLs.js +25 -39
- package/lib/context/yaml/handlers/organizations.js +37 -46
- package/lib/context/yaml/handlers/pages.js +31 -39
- package/lib/context/yaml/handlers/phoneProvider.js +17 -31
- package/lib/context/yaml/handlers/phoneTemplates.d.ts +6 -0
- package/lib/context/yaml/handlers/phoneTemplates.js +25 -0
- package/lib/context/yaml/handlers/prompts.js +22 -47
- package/lib/context/yaml/handlers/resourceServers.d.ts +1 -1
- package/lib/context/yaml/handlers/resourceServers.js +21 -33
- package/lib/context/yaml/handlers/roles.js +19 -33
- package/lib/context/yaml/handlers/rules.js +28 -39
- package/lib/context/yaml/handlers/rulesConfigs.js +14 -28
- package/lib/context/yaml/handlers/selfServiceProfiles.js +29 -43
- package/lib/context/yaml/handlers/tenant.js +19 -41
- package/lib/context/yaml/handlers/themes.js +7 -19
- package/lib/context/yaml/handlers/tokenExchangeProfiles.d.ts +5 -0
- package/lib/context/yaml/handlers/tokenExchangeProfiles.js +27 -0
- package/lib/context/yaml/handlers/triggers.d.ts +1 -1
- package/lib/context/yaml/handlers/triggers.js +15 -29
- package/lib/context/yaml/handlers/userAttributeProfiles.d.ts +1 -1
- package/lib/context/yaml/handlers/userAttributeProfiles.js +7 -19
- package/lib/context/yaml/index.js +120 -128
- package/lib/index.d.ts +4 -96
- package/lib/index.js +24 -34
- package/lib/keywordPreservation.d.ts +1 -1
- package/lib/keywordPreservation.js +11 -6
- package/lib/logger.js +0 -1
- package/lib/readonly.js +3 -4
- package/lib/sessionDurationsToMinutes.js +0 -1
- package/lib/tools/auth0/client.js +108 -127
- package/lib/tools/auth0/handlers/actions.d.ts +8 -26
- package/lib/tools/auth0/handlers/actions.js +138 -149
- package/lib/tools/auth0/handlers/attackProtection.js +80 -92
- package/lib/tools/auth0/handlers/branding.js +75 -99
- package/lib/tools/auth0/handlers/clientGrants.d.ts +2 -9
- package/lib/tools/auth0/handlers/clientGrants.js +68 -73
- package/lib/tools/auth0/handlers/clients.d.ts +17 -16
- package/lib/tools/auth0/handlers/clients.js +120 -106
- package/lib/tools/auth0/handlers/connectionProfiles.d.ts +3 -1
- package/lib/tools/auth0/handlers/connectionProfiles.js +36 -32
- package/lib/tools/auth0/handlers/connections.d.ts +3 -1
- package/lib/tools/auth0/handlers/connections.js +130 -135
- package/lib/tools/auth0/handlers/customDomains.d.ts +4 -1
- package/lib/tools/auth0/handlers/customDomains.js +43 -53
- package/lib/tools/auth0/handlers/databases.js +94 -114
- package/lib/tools/auth0/handlers/default.d.ts +2 -2
- package/lib/tools/auth0/handlers/default.js +210 -171
- package/lib/tools/auth0/handlers/emailProvider.js +41 -52
- package/lib/tools/auth0/handlers/emailTemplates.d.ts +1 -0
- package/lib/tools/auth0/handlers/emailTemplates.js +54 -70
- package/lib/tools/auth0/handlers/flowVaultConnections.d.ts +5 -12
- package/lib/tools/auth0/handlers/flowVaultConnections.js +102 -145
- package/lib/tools/auth0/handlers/flows.d.ts +2 -3
- package/lib/tools/auth0/handlers/flows.js +92 -129
- package/lib/tools/auth0/handlers/forms.d.ts +3 -3
- package/lib/tools/auth0/handlers/forms.js +98 -112
- package/lib/tools/auth0/handlers/guardianFactorProviders.js +61 -84
- package/lib/tools/auth0/handlers/guardianFactorTemplates.js +46 -68
- package/lib/tools/auth0/handlers/guardianFactors.js +35 -45
- package/lib/tools/auth0/handlers/guardianPhoneFactorMessageTypes.js +29 -45
- package/lib/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.js +29 -45
- package/lib/tools/auth0/handlers/guardianPolicies.js +20 -35
- package/lib/tools/auth0/handlers/hooks.js +123 -153
- package/lib/tools/auth0/handlers/index.js +4 -1
- package/lib/tools/auth0/handlers/logStreams.js +42 -47
- package/lib/tools/auth0/handlers/networkACLs.d.ts +5 -4
- package/lib/tools/auth0/handlers/networkACLs.js +115 -133
- package/lib/tools/auth0/handlers/organizations.d.ts +10 -9
- package/lib/tools/auth0/handlers/organizations.js +350 -431
- package/lib/tools/auth0/handlers/pages.js +74 -83
- package/lib/tools/auth0/handlers/phoneProvider.d.ts +2 -2
- package/lib/tools/auth0/handlers/phoneProvider.js +69 -82
- package/lib/tools/auth0/handlers/phoneTemplates.d.ts +63 -0
- package/lib/tools/auth0/handlers/phoneTemplates.js +221 -0
- package/lib/tools/auth0/handlers/prompts.d.ts +7 -7
- package/lib/tools/auth0/handlers/prompts.js +246 -240
- package/lib/tools/auth0/handlers/resourceServers.d.ts +6 -2
- package/lib/tools/auth0/handlers/resourceServers.js +94 -105
- package/lib/tools/auth0/handlers/roles.js +149 -178
- package/lib/tools/auth0/handlers/rules.js +144 -162
- package/lib/tools/auth0/handlers/rulesConfigs.js +30 -39
- package/lib/tools/auth0/handlers/scimHandler.d.ts +4 -3
- package/lib/tools/auth0/handlers/scimHandler.js +110 -132
- package/lib/tools/auth0/handlers/selfServiceProfiles.d.ts +12 -3
- package/lib/tools/auth0/handlers/selfServiceProfiles.js +173 -203
- package/lib/tools/auth0/handlers/tenant.d.ts +5 -3
- package/lib/tools/auth0/handlers/tenant.js +46 -52
- package/lib/tools/auth0/handlers/themes.d.ts +12 -12
- package/lib/tools/auth0/handlers/themes.js +86 -102
- package/lib/tools/auth0/handlers/tokenExchangeProfiles.d.ts +60 -0
- package/lib/tools/auth0/handlers/tokenExchangeProfiles.js +263 -0
- package/lib/tools/auth0/handlers/triggers.js +59 -75
- package/lib/tools/auth0/handlers/userAttributeProfiles.d.ts +3 -2
- package/lib/tools/auth0/handlers/userAttributeProfiles.js +41 -43
- package/lib/tools/auth0/index.js +35 -48
- package/lib/tools/auth0/schema.js +6 -4
- package/lib/tools/calculateChanges.js +24 -15
- package/lib/tools/constants.d.ts +4 -2
- package/lib/tools/constants.js +3 -1
- package/lib/tools/deploy.js +17 -29
- package/lib/tools/index.d.ts +3 -89
- package/lib/tools/index.js +3 -2
- package/lib/tools/utils.d.ts +1 -1
- package/lib/tools/utils.js +12 -22
- package/lib/tools/validationError.js +0 -1
- package/lib/types.d.ts +13 -5
- package/lib/types.js +0 -1
- package/lib/utils.d.ts +3 -58
- package/lib/utils.js +8 -5
- package/package.json +11 -10
- package/tsconfig.json +4 -3
- package/.eslintignore +0 -5
- package/.eslintrc +0 -69
- package/lib/args.js.map +0 -1
- package/lib/commands/export.js.map +0 -1
- package/lib/commands/import.js.map +0 -1
- package/lib/commands/index.js.map +0 -1
- package/lib/configFactory.js.map +0 -1
- package/lib/context/defaults.js.map +0 -1
- package/lib/context/directory/handlers/actions.js.map +0 -1
- package/lib/context/directory/handlers/attackProtection.js.map +0 -1
- package/lib/context/directory/handlers/branding.js.map +0 -1
- package/lib/context/directory/handlers/clientGrants.js.map +0 -1
- package/lib/context/directory/handlers/clients.js.map +0 -1
- package/lib/context/directory/handlers/connectionProfiles.js.map +0 -1
- package/lib/context/directory/handlers/connections.js.map +0 -1
- package/lib/context/directory/handlers/customDomains.js.map +0 -1
- package/lib/context/directory/handlers/databases.js.map +0 -1
- package/lib/context/directory/handlers/emailProvider.js.map +0 -1
- package/lib/context/directory/handlers/emailTemplates.js.map +0 -1
- package/lib/context/directory/handlers/flowVaultConnections.js.map +0 -1
- package/lib/context/directory/handlers/flows.js.map +0 -1
- package/lib/context/directory/handlers/forms.js.map +0 -1
- package/lib/context/directory/handlers/guardianFactorProviders.js.map +0 -1
- package/lib/context/directory/handlers/guardianFactorTemplates.js.map +0 -1
- package/lib/context/directory/handlers/guardianFactors.js.map +0 -1
- package/lib/context/directory/handlers/guardianPhoneFactorMessageTypes.js.map +0 -1
- package/lib/context/directory/handlers/guardianPhoneFactorSelectedProvider.js.map +0 -1
- package/lib/context/directory/handlers/guardianPolicies.js.map +0 -1
- package/lib/context/directory/handlers/hooks.js.map +0 -1
- package/lib/context/directory/handlers/index.js.map +0 -1
- package/lib/context/directory/handlers/logStreams.js.map +0 -1
- package/lib/context/directory/handlers/networkACLs.js.map +0 -1
- package/lib/context/directory/handlers/organizations.js.map +0 -1
- package/lib/context/directory/handlers/pages.js.map +0 -1
- package/lib/context/directory/handlers/phoneProvider.js.map +0 -1
- package/lib/context/directory/handlers/prompts.js.map +0 -1
- package/lib/context/directory/handlers/resourceServers.js.map +0 -1
- package/lib/context/directory/handlers/roles.js.map +0 -1
- package/lib/context/directory/handlers/rules.js.map +0 -1
- package/lib/context/directory/handlers/rulesConfigs.js.map +0 -1
- package/lib/context/directory/handlers/selfServiceProfiles.js.map +0 -1
- package/lib/context/directory/handlers/tenant.js.map +0 -1
- package/lib/context/directory/handlers/themes.js.map +0 -1
- package/lib/context/directory/handlers/triggers.js.map +0 -1
- package/lib/context/directory/handlers/userAttributeProfiles.js.map +0 -1
- package/lib/context/directory/index.js.map +0 -1
- package/lib/context/index.js.map +0 -1
- package/lib/context/yaml/handlers/actions.js.map +0 -1
- package/lib/context/yaml/handlers/attackProtection.js.map +0 -1
- package/lib/context/yaml/handlers/branding.js.map +0 -1
- package/lib/context/yaml/handlers/clientGrants.js.map +0 -1
- package/lib/context/yaml/handlers/clients.js.map +0 -1
- package/lib/context/yaml/handlers/connectionProfiles.js.map +0 -1
- package/lib/context/yaml/handlers/connections.js.map +0 -1
- package/lib/context/yaml/handlers/customDomains.js.map +0 -1
- package/lib/context/yaml/handlers/databases.js.map +0 -1
- package/lib/context/yaml/handlers/emailProvider.js.map +0 -1
- package/lib/context/yaml/handlers/emailTemplates.js.map +0 -1
- package/lib/context/yaml/handlers/flowVaultConnections.js.map +0 -1
- package/lib/context/yaml/handlers/flows.js.map +0 -1
- package/lib/context/yaml/handlers/forms.js.map +0 -1
- package/lib/context/yaml/handlers/guardianFactorProviders.js.map +0 -1
- package/lib/context/yaml/handlers/guardianFactorTemplates.js.map +0 -1
- package/lib/context/yaml/handlers/guardianFactors.js.map +0 -1
- package/lib/context/yaml/handlers/guardianPhoneFactorMessageTypes.js.map +0 -1
- package/lib/context/yaml/handlers/guardianPhoneFactorSelectedProvider.js.map +0 -1
- package/lib/context/yaml/handlers/guardianPolicies.js.map +0 -1
- package/lib/context/yaml/handlers/hooks.js.map +0 -1
- package/lib/context/yaml/handlers/index.js.map +0 -1
- package/lib/context/yaml/handlers/logStreams.js.map +0 -1
- package/lib/context/yaml/handlers/networkACLs.js.map +0 -1
- package/lib/context/yaml/handlers/organizations.js.map +0 -1
- package/lib/context/yaml/handlers/pages.js.map +0 -1
- package/lib/context/yaml/handlers/phoneProvider.js.map +0 -1
- package/lib/context/yaml/handlers/prompts.js.map +0 -1
- package/lib/context/yaml/handlers/resourceServers.js.map +0 -1
- package/lib/context/yaml/handlers/roles.js.map +0 -1
- package/lib/context/yaml/handlers/rules.js.map +0 -1
- package/lib/context/yaml/handlers/rulesConfigs.js.map +0 -1
- package/lib/context/yaml/handlers/selfServiceProfiles.js.map +0 -1
- package/lib/context/yaml/handlers/tenant.js.map +0 -1
- package/lib/context/yaml/handlers/themes.js.map +0 -1
- package/lib/context/yaml/handlers/triggers.js.map +0 -1
- package/lib/context/yaml/handlers/userAttributeProfiles.js.map +0 -1
- package/lib/context/yaml/index.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/keywordPreservation.js.map +0 -1
- package/lib/logger.js.map +0 -1
- package/lib/readonly.js.map +0 -1
- package/lib/sessionDurationsToMinutes.js.map +0 -1
- package/lib/tools/auth0/client.js.map +0 -1
- package/lib/tools/auth0/handlers/actions.js.map +0 -1
- package/lib/tools/auth0/handlers/attackProtection.js.map +0 -1
- package/lib/tools/auth0/handlers/branding.js.map +0 -1
- package/lib/tools/auth0/handlers/clientGrants.js.map +0 -1
- package/lib/tools/auth0/handlers/clients.js.map +0 -1
- package/lib/tools/auth0/handlers/connectionProfiles.js.map +0 -1
- package/lib/tools/auth0/handlers/connections.js.map +0 -1
- package/lib/tools/auth0/handlers/customDomains.js.map +0 -1
- package/lib/tools/auth0/handlers/databases.js.map +0 -1
- package/lib/tools/auth0/handlers/default.js.map +0 -1
- package/lib/tools/auth0/handlers/emailProvider.js.map +0 -1
- package/lib/tools/auth0/handlers/emailTemplates.js.map +0 -1
- package/lib/tools/auth0/handlers/flowVaultConnections.js.map +0 -1
- package/lib/tools/auth0/handlers/flows.js.map +0 -1
- package/lib/tools/auth0/handlers/forms.js.map +0 -1
- package/lib/tools/auth0/handlers/guardianFactorProviders.js.map +0 -1
- package/lib/tools/auth0/handlers/guardianFactorTemplates.js.map +0 -1
- package/lib/tools/auth0/handlers/guardianFactors.js.map +0 -1
- package/lib/tools/auth0/handlers/guardianPhoneFactorMessageTypes.js.map +0 -1
- package/lib/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.js.map +0 -1
- package/lib/tools/auth0/handlers/guardianPolicies.js.map +0 -1
- package/lib/tools/auth0/handlers/hooks.js.map +0 -1
- package/lib/tools/auth0/handlers/index.js.map +0 -1
- package/lib/tools/auth0/handlers/logStreams.js.map +0 -1
- package/lib/tools/auth0/handlers/networkACLs.js.map +0 -1
- package/lib/tools/auth0/handlers/organizations.js.map +0 -1
- package/lib/tools/auth0/handlers/pages.js.map +0 -1
- package/lib/tools/auth0/handlers/phoneProvider.js.map +0 -1
- package/lib/tools/auth0/handlers/prompts.js.map +0 -1
- package/lib/tools/auth0/handlers/resourceServers.js.map +0 -1
- package/lib/tools/auth0/handlers/roles.js.map +0 -1
- package/lib/tools/auth0/handlers/rules.js.map +0 -1
- package/lib/tools/auth0/handlers/rulesConfigs.js.map +0 -1
- package/lib/tools/auth0/handlers/scimHandler.js.map +0 -1
- package/lib/tools/auth0/handlers/selfServiceProfiles.js.map +0 -1
- package/lib/tools/auth0/handlers/tenant.js.map +0 -1
- package/lib/tools/auth0/handlers/themes.js.map +0 -1
- package/lib/tools/auth0/handlers/triggers.js.map +0 -1
- package/lib/tools/auth0/handlers/userAttributeProfiles.js.map +0 -1
- package/lib/tools/auth0/index.js.map +0 -1
- package/lib/tools/auth0/schema.js.map +0 -1
- package/lib/tools/calculateChanges.js.map +0 -1
- package/lib/tools/constants.js.map +0 -1
- package/lib/tools/deploy.js.map +0 -1
- package/lib/tools/index.js.map +0 -1
- package/lib/tools/utils.js.map +0 -1
- package/lib/tools/validationError.js.map +0 -1
- package/lib/types.js.map +0 -1
- package/lib/utils.js.map +0 -1
|
@@ -38,15 +38,6 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
38
38
|
return result;
|
|
39
39
|
};
|
|
40
40
|
})();
|
|
41
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
42
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
43
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
44
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
45
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
46
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
47
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
41
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
51
42
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
52
43
|
};
|
|
@@ -54,98 +45,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
54
45
|
exports.schema = void 0;
|
|
55
46
|
const logger_1 = __importDefault(require("../../../logger"));
|
|
56
47
|
const default_1 = __importStar(require("./default"));
|
|
57
|
-
class ThemesHandler extends default_1.default {
|
|
58
|
-
constructor(options) {
|
|
59
|
-
super(Object.assign(Object.assign({}, options), { type: 'themes', id: 'themeId' }));
|
|
60
|
-
}
|
|
61
|
-
objString(theme) {
|
|
62
|
-
return theme.displayName || JSON.stringify(theme);
|
|
63
|
-
}
|
|
64
|
-
getType() {
|
|
65
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
-
if (!this.existing) {
|
|
67
|
-
this.existing = yield this.getThemes();
|
|
68
|
-
}
|
|
69
|
-
return this.existing;
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
processChanges(assets) {
|
|
73
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
-
const { themes } = assets;
|
|
75
|
-
// Non existing section means themes doesn't need to be processed
|
|
76
|
-
if (!themes) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
// Empty array means themes should be deleted
|
|
80
|
-
if (themes.length === 0) {
|
|
81
|
-
return this.deleteThemes();
|
|
82
|
-
}
|
|
83
|
-
return this.updateThemes(themes);
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
deleteThemes() {
|
|
87
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
-
if (!this.config('AUTH0_ALLOW_DELETE')) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
// if theme exists we need to delete it
|
|
92
|
-
const currentThemes = yield this.getThemes();
|
|
93
|
-
if (currentThemes === null || currentThemes.length === 0) {
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
const currentTheme = currentThemes[0];
|
|
97
|
-
yield this.client.branding.deleteTheme({ themeId: currentTheme.themeId });
|
|
98
|
-
this.deleted += 1;
|
|
99
|
-
this.didDelete(currentTheme);
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
updateThemes(themes) {
|
|
103
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
104
|
-
if (themes.length > 1) {
|
|
105
|
-
logger_1.default.warn('Only one theme is supported per tenant');
|
|
106
|
-
}
|
|
107
|
-
const currentThemes = yield this.getThemes();
|
|
108
|
-
const themeReqPayload = (() => {
|
|
109
|
-
// Removing themeId from update and create payloads, otherwise API will error
|
|
110
|
-
// Theme ID may be required to handle if `--export_ids=true`
|
|
111
|
-
const payload = themes[0];
|
|
112
|
-
//@ts-ignore to quell non-optional themeId property, but we know that it's ok to delete
|
|
113
|
-
delete payload.themeId;
|
|
114
|
-
return payload;
|
|
115
|
-
})();
|
|
116
|
-
if (currentThemes === null || currentThemes.length === 0) {
|
|
117
|
-
yield this.client.branding.createTheme(themeReqPayload);
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
const currentTheme = currentThemes[0];
|
|
121
|
-
// if theme exists, overwrite it otherwise create it
|
|
122
|
-
yield this.client.branding.updateTheme({ themeId: currentTheme.themeId }, themeReqPayload);
|
|
123
|
-
}
|
|
124
|
-
this.updated += 1;
|
|
125
|
-
this.didUpdate(themes[0]);
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
getThemes() {
|
|
129
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
-
try {
|
|
131
|
-
const { data: theme } = yield this.client.branding.getDefaultTheme();
|
|
132
|
-
return [theme];
|
|
133
|
-
}
|
|
134
|
-
catch (err) {
|
|
135
|
-
if (err.statusCode === 404)
|
|
136
|
-
return [];
|
|
137
|
-
if (err.statusCode === 400)
|
|
138
|
-
return null;
|
|
139
|
-
// Errors other than 404 (theme doesn't exist) or 400 (no-code not enabled) shouldn't be expected
|
|
140
|
-
throw err;
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
exports.default = ThemesHandler;
|
|
146
|
-
__decorate([
|
|
147
|
-
(0, default_1.order)('60') // Run after custom domains.
|
|
148
|
-
], ThemesHandler.prototype, "processChanges", null);
|
|
149
48
|
/**
|
|
150
49
|
* Schema
|
|
151
50
|
*/
|
|
@@ -558,4 +457,89 @@ exports.schema = {
|
|
|
558
457
|
type: 'object',
|
|
559
458
|
},
|
|
560
459
|
};
|
|
561
|
-
|
|
460
|
+
class ThemesHandler extends default_1.default {
|
|
461
|
+
constructor(options) {
|
|
462
|
+
super({
|
|
463
|
+
...options,
|
|
464
|
+
type: 'themes',
|
|
465
|
+
id: 'themeId',
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
objString(theme) {
|
|
469
|
+
return theme.displayName || JSON.stringify(theme);
|
|
470
|
+
}
|
|
471
|
+
async getType() {
|
|
472
|
+
if (!this.existing) {
|
|
473
|
+
this.existing = await this.getThemes();
|
|
474
|
+
}
|
|
475
|
+
return this.existing;
|
|
476
|
+
}
|
|
477
|
+
async processChanges(assets) {
|
|
478
|
+
const { themes } = assets;
|
|
479
|
+
// Non existing section means themes doesn't need to be processed
|
|
480
|
+
if (!themes) {
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
// Empty array means themes should be deleted
|
|
484
|
+
if (themes.length === 0) {
|
|
485
|
+
return this.deleteThemes();
|
|
486
|
+
}
|
|
487
|
+
return this.updateThemes(themes);
|
|
488
|
+
}
|
|
489
|
+
async deleteThemes() {
|
|
490
|
+
if (!this.config('AUTH0_ALLOW_DELETE')) {
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
// if theme exists we need to delete it
|
|
494
|
+
const currentThemes = await this.getThemes();
|
|
495
|
+
if (currentThemes === null || currentThemes.length === 0) {
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
498
|
+
const currentTheme = currentThemes[0];
|
|
499
|
+
await this.client.branding.themes.delete(currentTheme.themeId);
|
|
500
|
+
this.deleted += 1;
|
|
501
|
+
this.didDelete(currentTheme);
|
|
502
|
+
}
|
|
503
|
+
async updateThemes(themes) {
|
|
504
|
+
if (themes.length > 1) {
|
|
505
|
+
logger_1.default.warn('Only one theme is supported per tenant');
|
|
506
|
+
}
|
|
507
|
+
const currentThemes = await this.getThemes();
|
|
508
|
+
const themeReqPayload = (() => {
|
|
509
|
+
// Removing themeId from update and create payloads, otherwise API will error
|
|
510
|
+
// Theme ID may be required to handle if `--export_ids=true`
|
|
511
|
+
const payload = themes[0];
|
|
512
|
+
// @ts-ignore to quell non-optional themeId property, but we know that it's ok to delete
|
|
513
|
+
delete payload.themeId;
|
|
514
|
+
return payload;
|
|
515
|
+
})();
|
|
516
|
+
if (currentThemes === null || currentThemes.length === 0) {
|
|
517
|
+
await this.client.branding.themes.create(themeReqPayload);
|
|
518
|
+
}
|
|
519
|
+
else {
|
|
520
|
+
const currentTheme = currentThemes[0];
|
|
521
|
+
// if theme exists, overwrite it otherwise create it
|
|
522
|
+
await this.client.branding.themes.update(currentTheme.themeId, themeReqPayload);
|
|
523
|
+
}
|
|
524
|
+
this.updated += 1;
|
|
525
|
+
this.didUpdate(themes[0]);
|
|
526
|
+
}
|
|
527
|
+
async getThemes() {
|
|
528
|
+
try {
|
|
529
|
+
const theme = await this.client.branding.themes.getDefault();
|
|
530
|
+
return [theme];
|
|
531
|
+
}
|
|
532
|
+
catch (err) {
|
|
533
|
+
if (err.statusCode === 404)
|
|
534
|
+
return [];
|
|
535
|
+
if (err.statusCode === 400)
|
|
536
|
+
return null;
|
|
537
|
+
// Errors other than 404 (theme doesn't exist) or 400 (no-code not enabled) shouldn't be expected
|
|
538
|
+
throw err;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
exports.default = ThemesHandler;
|
|
543
|
+
__decorate([
|
|
544
|
+
(0, default_1.order)('60') // Run after custom domains.
|
|
545
|
+
], ThemesHandler.prototype, "processChanges", null);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Management } from 'auth0';
|
|
2
|
+
import DefaultHandler from './default';
|
|
3
|
+
import { Asset, Assets } from '../../../types';
|
|
4
|
+
export type TokenExchangeProfile = Management.TokenExchangeProfileResponseContent;
|
|
5
|
+
export declare const schema: {
|
|
6
|
+
type: string;
|
|
7
|
+
items: {
|
|
8
|
+
type: string;
|
|
9
|
+
properties: {
|
|
10
|
+
name: {
|
|
11
|
+
type: string;
|
|
12
|
+
description: string;
|
|
13
|
+
};
|
|
14
|
+
id: {
|
|
15
|
+
type: string;
|
|
16
|
+
description: string;
|
|
17
|
+
};
|
|
18
|
+
subject_token_type: {
|
|
19
|
+
type: string;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
action: {
|
|
23
|
+
type: string;
|
|
24
|
+
description: string;
|
|
25
|
+
};
|
|
26
|
+
type: {
|
|
27
|
+
type: string;
|
|
28
|
+
enum: string[];
|
|
29
|
+
description: string;
|
|
30
|
+
};
|
|
31
|
+
created_at: {
|
|
32
|
+
type: string;
|
|
33
|
+
format: string;
|
|
34
|
+
description: string;
|
|
35
|
+
};
|
|
36
|
+
updated_at: {
|
|
37
|
+
type: string;
|
|
38
|
+
format: string;
|
|
39
|
+
description: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
required: string[];
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export default class TokenExchangeProfilesHandler extends DefaultHandler {
|
|
46
|
+
existing: TokenExchangeProfile[];
|
|
47
|
+
private actions;
|
|
48
|
+
constructor(config: DefaultHandler);
|
|
49
|
+
private sanitizeForExport;
|
|
50
|
+
private sanitizeForAPI;
|
|
51
|
+
getActions(): Promise<Asset[]>;
|
|
52
|
+
getType(): Promise<TokenExchangeProfile[]>;
|
|
53
|
+
processChanges(assets: Assets): Promise<void>;
|
|
54
|
+
createTokenExchangeProfile(profile: TokenExchangeProfile): Promise<TokenExchangeProfile>;
|
|
55
|
+
createTokenExchangeProfiles(creates: TokenExchangeProfile[]): Promise<void>;
|
|
56
|
+
updateTokenExchangeProfile(profile: TokenExchangeProfile): Promise<void>;
|
|
57
|
+
updateTokenExchangeProfiles(updates: TokenExchangeProfile[]): Promise<void>;
|
|
58
|
+
deleteTokenExchangeProfile(profile: TokenExchangeProfile): Promise<void>;
|
|
59
|
+
deleteTokenExchangeProfiles(data: TokenExchangeProfile[]): Promise<void>;
|
|
60
|
+
}
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
42
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.schema = void 0;
|
|
46
|
+
const default_1 = __importStar(require("./default"));
|
|
47
|
+
const client_1 = require("../client");
|
|
48
|
+
const logger_1 = __importDefault(require("../../../logger"));
|
|
49
|
+
exports.schema = {
|
|
50
|
+
type: 'array',
|
|
51
|
+
items: {
|
|
52
|
+
type: 'object',
|
|
53
|
+
properties: {
|
|
54
|
+
name: {
|
|
55
|
+
type: 'string',
|
|
56
|
+
description: 'The name of the token exchange profile',
|
|
57
|
+
},
|
|
58
|
+
id: {
|
|
59
|
+
type: 'string',
|
|
60
|
+
description: 'The unique identifier of the token exchange profile',
|
|
61
|
+
},
|
|
62
|
+
subject_token_type: {
|
|
63
|
+
type: 'string',
|
|
64
|
+
description: 'The URI representing the subject token type',
|
|
65
|
+
},
|
|
66
|
+
action: {
|
|
67
|
+
type: 'string',
|
|
68
|
+
description: 'The name of the action associated with this profile',
|
|
69
|
+
},
|
|
70
|
+
type: {
|
|
71
|
+
type: 'string',
|
|
72
|
+
enum: ['custom_authentication'],
|
|
73
|
+
description: 'The type of token exchange profile',
|
|
74
|
+
},
|
|
75
|
+
created_at: {
|
|
76
|
+
type: 'string',
|
|
77
|
+
format: 'date-time',
|
|
78
|
+
description: 'The timestamp when the profile was created',
|
|
79
|
+
},
|
|
80
|
+
updated_at: {
|
|
81
|
+
type: 'string',
|
|
82
|
+
format: 'date-time',
|
|
83
|
+
description: 'The timestamp when the profile was last updated',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
required: ['name', 'subject_token_type', 'action', 'type'],
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
class TokenExchangeProfilesHandler extends default_1.default {
|
|
90
|
+
constructor(config) {
|
|
91
|
+
super({
|
|
92
|
+
...config,
|
|
93
|
+
type: 'tokenExchangeProfiles',
|
|
94
|
+
id: 'id',
|
|
95
|
+
identifiers: ['id', 'name'],
|
|
96
|
+
// Only name and subject_token_type can be updated
|
|
97
|
+
stripUpdateFields: ['id', 'created_at', 'updated_at', 'action_id', 'type'],
|
|
98
|
+
stripCreateFields: ['id', 'created_at', 'updated_at'],
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
sanitizeForExport(profile, actions) {
|
|
102
|
+
if (profile.action_id) {
|
|
103
|
+
const action = actions?.find((a) => a.id === profile.action_id);
|
|
104
|
+
if (action) {
|
|
105
|
+
const { action_id, ...rest } = profile;
|
|
106
|
+
return { ...rest, action: action.name };
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
logger_1.default.warn(`Token exchange profile "${profile.name}" references action with ID "${profile.action_id}" which was not found`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return profile;
|
|
113
|
+
}
|
|
114
|
+
sanitizeForAPI(profile, actions) {
|
|
115
|
+
if (profile.action) {
|
|
116
|
+
const foundAction = actions?.find((a) => a.name === profile.action);
|
|
117
|
+
if (foundAction) {
|
|
118
|
+
const { action, ...rest } = profile;
|
|
119
|
+
return { ...rest, action_id: foundAction.id };
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
throw new Error(`Token exchange profile "${profile.name}" references action "${profile.action}" which was not found`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (!profile.action_id) {
|
|
126
|
+
throw new Error(`Token exchange profile "${profile.name}" is missing action reference. ` +
|
|
127
|
+
`Expected "action" (name) or "action_id" (ID) field.`);
|
|
128
|
+
}
|
|
129
|
+
return profile;
|
|
130
|
+
}
|
|
131
|
+
async getActions() {
|
|
132
|
+
if (this.actions)
|
|
133
|
+
return this.actions;
|
|
134
|
+
this.actions = await (0, client_1.paginate)(this.client.actions.list, {
|
|
135
|
+
paginate: true,
|
|
136
|
+
});
|
|
137
|
+
return this.actions;
|
|
138
|
+
}
|
|
139
|
+
async getType() {
|
|
140
|
+
if (this.existing)
|
|
141
|
+
return this.existing;
|
|
142
|
+
try {
|
|
143
|
+
// Fetch all token exchange profiles
|
|
144
|
+
const profiles = await (0, client_1.paginate)(this.client.tokenExchangeProfiles.list, {
|
|
145
|
+
paginate: true,
|
|
146
|
+
});
|
|
147
|
+
// Fetch all actions to map action_id to action name
|
|
148
|
+
const actions = await this.getActions();
|
|
149
|
+
// Map action_id to action name for each profile
|
|
150
|
+
this.existing = profiles.map((profile) => this.sanitizeForExport(profile, actions));
|
|
151
|
+
return this.existing;
|
|
152
|
+
}
|
|
153
|
+
catch (err) {
|
|
154
|
+
if (err.statusCode === 403) {
|
|
155
|
+
logger_1.default.warn('Token Exchange Profiles feature is not available on this tenant. Please contact Auth0 support to enable this feature.');
|
|
156
|
+
return [];
|
|
157
|
+
}
|
|
158
|
+
throw err;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
async processChanges(assets) {
|
|
162
|
+
const { tokenExchangeProfiles } = assets;
|
|
163
|
+
// Do nothing if not set
|
|
164
|
+
if (!tokenExchangeProfiles)
|
|
165
|
+
return;
|
|
166
|
+
// Fetch actions to resolve action names to IDs
|
|
167
|
+
const actions = await this.getActions();
|
|
168
|
+
// Map action names to action_ids before processing
|
|
169
|
+
const sanitizedProfiles = tokenExchangeProfiles.map((profile) => this.sanitizeForAPI(profile, actions));
|
|
170
|
+
// Create modified assets with sanitized profiles
|
|
171
|
+
const modifiedAssets = {
|
|
172
|
+
...assets,
|
|
173
|
+
tokenExchangeProfiles: sanitizedProfiles,
|
|
174
|
+
};
|
|
175
|
+
// Calculate changes
|
|
176
|
+
const { del, update, create, conflicts } = await this.calcChanges(modifiedAssets);
|
|
177
|
+
logger_1.default.debug(`Start processChanges for tokenExchangeProfiles [delete:${del.length}] [update:${update.length}], [create:${create.length}], [conflicts:${conflicts.length}]`);
|
|
178
|
+
// Process changes in order: delete, create, update
|
|
179
|
+
if (del.length > 0) {
|
|
180
|
+
await this.deleteTokenExchangeProfiles(del);
|
|
181
|
+
}
|
|
182
|
+
if (create.length > 0) {
|
|
183
|
+
await this.createTokenExchangeProfiles(create);
|
|
184
|
+
}
|
|
185
|
+
if (update.length > 0) {
|
|
186
|
+
await this.updateTokenExchangeProfiles(update);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
async createTokenExchangeProfile(profile) {
|
|
190
|
+
const { id, created_at, updated_at, ...createParams } = profile;
|
|
191
|
+
const created = await this.client.tokenExchangeProfiles.create(createParams);
|
|
192
|
+
return created;
|
|
193
|
+
}
|
|
194
|
+
async createTokenExchangeProfiles(creates) {
|
|
195
|
+
await this.client.pool
|
|
196
|
+
.addEachTask({
|
|
197
|
+
data: creates || [],
|
|
198
|
+
generator: (item) => this.createTokenExchangeProfile(item)
|
|
199
|
+
.then((data) => {
|
|
200
|
+
this.didCreate(data);
|
|
201
|
+
this.created += 1;
|
|
202
|
+
})
|
|
203
|
+
.catch((err) => {
|
|
204
|
+
throw new Error(`Problem creating ${this.type} ${this.objString(item)}\n${err}`);
|
|
205
|
+
}),
|
|
206
|
+
})
|
|
207
|
+
.promise();
|
|
208
|
+
}
|
|
209
|
+
async updateTokenExchangeProfile(profile) {
|
|
210
|
+
const { id, created_at, updated_at, action_id, type, ...updateParams } = profile;
|
|
211
|
+
if (!id) {
|
|
212
|
+
throw new Error(`Cannot update token exchange profile "${profile.name}" - missing id`);
|
|
213
|
+
}
|
|
214
|
+
await this.client.tokenExchangeProfiles.update(id, updateParams);
|
|
215
|
+
}
|
|
216
|
+
async updateTokenExchangeProfiles(updates) {
|
|
217
|
+
await this.client.pool
|
|
218
|
+
.addEachTask({
|
|
219
|
+
data: updates || [],
|
|
220
|
+
generator: (item) => this.updateTokenExchangeProfile(item)
|
|
221
|
+
.then(() => {
|
|
222
|
+
this.didUpdate(item);
|
|
223
|
+
this.updated += 1;
|
|
224
|
+
})
|
|
225
|
+
.catch((err) => {
|
|
226
|
+
throw new Error(`Problem updating ${this.type} ${this.objString(item)}\n${err}`);
|
|
227
|
+
}),
|
|
228
|
+
})
|
|
229
|
+
.promise();
|
|
230
|
+
}
|
|
231
|
+
async deleteTokenExchangeProfile(profile) {
|
|
232
|
+
if (!profile.id) {
|
|
233
|
+
throw new Error(`Cannot delete token exchange profile "${profile.name}" - missing id`);
|
|
234
|
+
}
|
|
235
|
+
await this.client.tokenExchangeProfiles.delete(profile.id);
|
|
236
|
+
}
|
|
237
|
+
async deleteTokenExchangeProfiles(data) {
|
|
238
|
+
if (this.config('AUTH0_ALLOW_DELETE') === 'true' ||
|
|
239
|
+
this.config('AUTH0_ALLOW_DELETE') === true) {
|
|
240
|
+
await this.client.pool
|
|
241
|
+
.addEachTask({
|
|
242
|
+
data: data || [],
|
|
243
|
+
generator: (item) => this.deleteTokenExchangeProfile(item)
|
|
244
|
+
.then(() => {
|
|
245
|
+
this.didDelete(item);
|
|
246
|
+
this.deleted += 1;
|
|
247
|
+
})
|
|
248
|
+
.catch((err) => {
|
|
249
|
+
throw new Error(`Problem deleting ${this.type} ${this.objString(item)}\n${err}`);
|
|
250
|
+
}),
|
|
251
|
+
})
|
|
252
|
+
.promise();
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
logger_1.default.warn(`Detected the following tokenExchangeProfile should be deleted. Doing so may be destructive.\nYou can enable deletes by setting 'AUTH0_ALLOW_DELETE' to true in the config
|
|
256
|
+
\n${data.map((i) => this.objString(i)).join('\n')}`);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
exports.default = TokenExchangeProfilesHandler;
|
|
261
|
+
__decorate([
|
|
262
|
+
(0, default_1.order)('65')
|
|
263
|
+
], TokenExchangeProfilesHandler.prototype, "processChanges", null);
|
|
@@ -38,15 +38,6 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
38
38
|
return result;
|
|
39
39
|
};
|
|
40
40
|
})();
|
|
41
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
42
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
43
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
44
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
45
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
46
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
47
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
41
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
51
42
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
52
43
|
};
|
|
@@ -79,81 +70,74 @@ function isActionsDisabled(err) {
|
|
|
79
70
|
}
|
|
80
71
|
class TriggersHandler extends default_1.default {
|
|
81
72
|
constructor(options) {
|
|
82
|
-
super(
|
|
73
|
+
super({
|
|
74
|
+
...options,
|
|
75
|
+
type: 'triggers',
|
|
76
|
+
id: 'name',
|
|
77
|
+
});
|
|
83
78
|
}
|
|
84
|
-
getType() {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const triggerId = triggers[i];
|
|
99
|
-
let bindings;
|
|
100
|
-
try {
|
|
101
|
-
const { data } = yield this.client.actions.getTriggerBindings({
|
|
102
|
-
triggerId: triggerId,
|
|
103
|
-
});
|
|
104
|
-
bindings = data === null || data === void 0 ? void 0 : data.bindings;
|
|
105
|
-
}
|
|
106
|
-
catch (err) {
|
|
107
|
-
logger_1.default.warn(`${err.message} (trigger: ${triggerId}). Skipping this trigger and continuing.`);
|
|
108
|
-
continue;
|
|
109
|
-
}
|
|
110
|
-
if (bindings && bindings.length > 0) {
|
|
111
|
-
triggerBindings[triggerId] = bindings.map((binding) => ({
|
|
112
|
-
action_name: binding.action.name,
|
|
113
|
-
display_name: binding.display_name,
|
|
114
|
-
}));
|
|
115
|
-
}
|
|
79
|
+
async getType() {
|
|
80
|
+
if (this.existing) {
|
|
81
|
+
return this.existing;
|
|
82
|
+
}
|
|
83
|
+
const triggerBindings = {};
|
|
84
|
+
try {
|
|
85
|
+
const res = await this.client.actions.triggers.list();
|
|
86
|
+
const triggers = (0, lodash_1.default)(res?.triggers).map('id').uniq().value();
|
|
87
|
+
for (let i = 0; i < triggers.length; i++) {
|
|
88
|
+
const triggerId = triggers[i];
|
|
89
|
+
let bindings;
|
|
90
|
+
try {
|
|
91
|
+
const { data } = await this.client.actions.triggers.bindings.list(triggerId);
|
|
92
|
+
bindings = data;
|
|
116
93
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
catch (err) {
|
|
121
|
-
if (err.statusCode === 404 || err.statusCode === 501) {
|
|
122
|
-
return [];
|
|
94
|
+
catch (err) {
|
|
95
|
+
logger_1.default.warn(`${err.message} (trigger: ${triggerId}). Skipping this trigger and continuing.`);
|
|
96
|
+
bindings = null;
|
|
123
97
|
}
|
|
124
|
-
if (
|
|
125
|
-
|
|
126
|
-
|
|
98
|
+
if (bindings && bindings.length > 0) {
|
|
99
|
+
triggerBindings[triggerId] = bindings.map((binding) => ({
|
|
100
|
+
action_name: binding.action.name,
|
|
101
|
+
display_name: binding.display_name,
|
|
102
|
+
}));
|
|
127
103
|
}
|
|
128
|
-
throw err;
|
|
129
104
|
}
|
|
130
|
-
|
|
105
|
+
this.existing = triggerBindings;
|
|
106
|
+
return this.existing;
|
|
107
|
+
}
|
|
108
|
+
catch (err) {
|
|
109
|
+
if (err.statusCode === 404 || err.statusCode === 501) {
|
|
110
|
+
return [];
|
|
111
|
+
}
|
|
112
|
+
if (isActionsDisabled(err)) {
|
|
113
|
+
logger_1.default.info('Skipping triggers because Actions is not enabled.');
|
|
114
|
+
return {};
|
|
115
|
+
}
|
|
116
|
+
throw err;
|
|
117
|
+
}
|
|
131
118
|
}
|
|
132
|
-
processChanges(assets) {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
})));
|
|
152
|
-
});
|
|
119
|
+
async processChanges(assets) {
|
|
120
|
+
// No API to delete or create triggers, we can only update.
|
|
121
|
+
const { triggers } = assets;
|
|
122
|
+
// Do nothing if not set
|
|
123
|
+
if (!triggers)
|
|
124
|
+
return;
|
|
125
|
+
await (0, utils_1.sleep)(2000); // Delay to allow newly-deployed actions to register in backend
|
|
126
|
+
await Promise.all(Object.entries(triggers).map(async ([name, data]) => {
|
|
127
|
+
const bindings = data.map((binding) => ({
|
|
128
|
+
ref: {
|
|
129
|
+
type: 'action_name',
|
|
130
|
+
value: binding.action_name,
|
|
131
|
+
},
|
|
132
|
+
display_name: binding.display_name,
|
|
133
|
+
}));
|
|
134
|
+
await this.client.actions.triggers.bindings.updateMany(name, { bindings });
|
|
135
|
+
this.didUpdate({ trigger_id: name });
|
|
136
|
+
this.updated += 1;
|
|
137
|
+
}));
|
|
153
138
|
}
|
|
154
139
|
}
|
|
155
140
|
exports.default = TriggersHandler;
|
|
156
141
|
__decorate([
|
|
157
142
|
(0, default_1.order)('80')
|
|
158
143
|
], TriggersHandler.prototype, "processChanges", null);
|
|
159
|
-
//# sourceMappingURL=triggers.js.map
|