auth0-deploy-cli 8.20.4-beta.0 → 8.22.0
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 +5 -46
- package/.eslintignore +5 -0
- package/.eslintrc +69 -0
- package/CHANGELOG.md +30 -6
- package/lib/args.js +1 -0
- package/lib/args.js.map +1 -0
- package/lib/commands/export.js +49 -41
- package/lib/commands/export.js.map +1 -0
- package/lib/commands/import.js +43 -36
- package/lib/commands/import.js.map +1 -0
- package/lib/commands/index.js +1 -0
- package/lib/commands/index.js.map +1 -0
- package/lib/configFactory.js +1 -0
- package/lib/configFactory.js.map +1 -0
- package/lib/context/defaults.js +10 -38
- package/lib/context/defaults.js.map +1 -0
- package/lib/context/directory/handlers/actions.js +39 -40
- package/lib/context/directory/handlers/actions.js.map +1 -0
- package/lib/context/directory/handlers/attackProtection.js +34 -22
- package/lib/context/directory/handlers/attackProtection.js.map +1 -0
- package/lib/context/directory/handlers/branding.js +21 -12
- package/lib/context/directory/handlers/branding.js.map +1 -0
- package/lib/context/directory/handlers/clientGrants.js +62 -52
- package/lib/context/directory/handlers/clientGrants.js.map +1 -0
- package/lib/context/directory/handlers/clients.js +60 -17
- package/lib/context/directory/handlers/clients.js.map +1 -0
- package/lib/context/directory/handlers/connectionProfiles.d.ts +11 -0
- package/lib/context/directory/handlers/connectionProfiles.js +59 -0
- package/lib/context/directory/handlers/connectionProfiles.js.map +1 -0
- package/lib/context/directory/handlers/connections.js +41 -32
- package/lib/context/directory/handlers/connections.js.map +1 -0
- package/lib/context/directory/handlers/customDomains.js +21 -9
- package/lib/context/directory/handlers/customDomains.js.map +1 -0
- package/lib/context/directory/handlers/databases.js +35 -37
- package/lib/context/directory/handlers/databases.js.map +1 -0
- package/lib/context/directory/handlers/emailProvider.js +36 -22
- package/lib/context/directory/handlers/emailProvider.js.map +1 -0
- package/lib/context/directory/handlers/emailTemplates.js +29 -20
- package/lib/context/directory/handlers/emailTemplates.js.map +1 -0
- package/lib/context/directory/handlers/flowVaultConnections.js +49 -39
- package/lib/context/directory/handlers/flowVaultConnections.js.map +1 -0
- package/lib/context/directory/handlers/flows.js +48 -38
- package/lib/context/directory/handlers/flows.js.map +1 -0
- package/lib/context/directory/handlers/forms.js +48 -38
- package/lib/context/directory/handlers/forms.js.map +1 -0
- package/lib/context/directory/handlers/guardianFactorProviders.js +21 -9
- package/lib/context/directory/handlers/guardianFactorProviders.js.map +1 -0
- package/lib/context/directory/handlers/guardianFactorTemplates.js +21 -9
- package/lib/context/directory/handlers/guardianFactorTemplates.js.map +1 -0
- package/lib/context/directory/handlers/guardianFactors.js +21 -9
- package/lib/context/directory/handlers/guardianFactors.js.map +1 -0
- package/lib/context/directory/handlers/guardianPhoneFactorMessageTypes.js +20 -8
- package/lib/context/directory/handlers/guardianPhoneFactorMessageTypes.js.map +1 -0
- package/lib/context/directory/handlers/guardianPhoneFactorSelectedProvider.js +20 -8
- package/lib/context/directory/handlers/guardianPhoneFactorSelectedProvider.js.map +1 -0
- package/lib/context/directory/handlers/guardianPolicies.js +20 -8
- package/lib/context/directory/handlers/guardianPolicies.js.map +1 -0
- package/lib/context/directory/handlers/hooks.js +34 -24
- package/lib/context/directory/handlers/hooks.js.map +1 -0
- package/lib/context/directory/handlers/index.js +3 -0
- package/lib/context/directory/handlers/index.js.map +1 -0
- package/lib/context/directory/handlers/logStreams.js +24 -12
- package/lib/context/directory/handlers/logStreams.js.map +1 -0
- package/lib/context/directory/handlers/networkACLs.js +34 -22
- package/lib/context/directory/handlers/networkACLs.js.map +1 -0
- package/lib/context/directory/handlers/organizations.js +44 -39
- package/lib/context/directory/handlers/organizations.js.map +1 -0
- package/lib/context/directory/handlers/pages.js +37 -31
- package/lib/context/directory/handlers/pages.js.map +1 -0
- package/lib/context/directory/handlers/phoneProvider.js +24 -12
- package/lib/context/directory/handlers/phoneProvider.js.map +1 -0
- package/lib/context/directory/handlers/prompts.js +76 -58
- package/lib/context/directory/handlers/prompts.js.map +1 -0
- package/lib/context/directory/handlers/resourceServers.d.ts +1 -1
- package/lib/context/directory/handlers/resourceServers.js +30 -18
- package/lib/context/directory/handlers/resourceServers.js.map +1 -0
- package/lib/context/directory/handlers/roles.js +31 -21
- package/lib/context/directory/handlers/roles.js.map +1 -0
- package/lib/context/directory/handlers/rules.js +32 -22
- package/lib/context/directory/handlers/rules.js.map +1 -0
- package/lib/context/directory/handlers/rulesConfigs.js +15 -3
- package/lib/context/directory/handlers/rulesConfigs.js.map +1 -0
- package/lib/context/directory/handlers/selfServiceProfiles.js +40 -28
- package/lib/context/directory/handlers/selfServiceProfiles.js.map +1 -0
- package/lib/context/directory/handlers/tenant.js +34 -14
- package/lib/context/directory/handlers/tenant.js.map +1 -0
- package/lib/context/directory/handlers/themes.js +21 -9
- package/lib/context/directory/handlers/themes.js.map +1 -0
- package/lib/context/directory/handlers/triggers.d.ts +1 -1
- package/lib/context/directory/handlers/triggers.js +26 -16
- package/lib/context/directory/handlers/triggers.js.map +1 -0
- package/lib/context/directory/handlers/userAttributeProfiles.d.ts +1 -1
- package/lib/context/directory/handlers/userAttributeProfiles.js +26 -16
- package/lib/context/directory/handlers/userAttributeProfiles.js.map +1 -0
- package/lib/context/directory/index.js +80 -66
- package/lib/context/directory/index.js.map +1 -0
- package/lib/context/index.js +20 -9
- package/lib/context/index.js.map +1 -0
- package/lib/context/yaml/handlers/actions.js +41 -39
- package/lib/context/yaml/handlers/actions.js.map +1 -0
- package/lib/context/yaml/handlers/attackProtection.js +41 -27
- package/lib/context/yaml/handlers/attackProtection.js.map +1 -0
- package/lib/context/yaml/handlers/branding.js +69 -47
- package/lib/context/yaml/handlers/branding.js.map +1 -0
- package/lib/context/yaml/handlers/clientGrants.js +40 -26
- package/lib/context/yaml/handlers/clientGrants.js.map +1 -0
- package/lib/context/yaml/handlers/clients.js +85 -41
- package/lib/context/yaml/handlers/clients.js.map +1 -0
- package/lib/context/yaml/handlers/connectionProfiles.d.ts +11 -0
- package/lib/context/yaml/handlers/connectionProfiles.js +44 -0
- package/lib/context/yaml/handlers/connectionProfiles.js.map +1 -0
- package/lib/context/yaml/handlers/connections.js +67 -63
- package/lib/context/yaml/handlers/connections.js.map +1 -0
- package/lib/context/yaml/handlers/customDomains.js +19 -7
- package/lib/context/yaml/handlers/customDomains.js.map +1 -0
- package/lib/context/yaml/handlers/databases.js +65 -63
- package/lib/context/yaml/handlers/databases.js.map +1 -0
- package/lib/context/yaml/handlers/emailProvider.js +37 -22
- package/lib/context/yaml/handlers/emailProvider.js.map +1 -0
- package/lib/context/yaml/handlers/emailTemplates.js +39 -28
- package/lib/context/yaml/handlers/emailTemplates.js.map +1 -0
- package/lib/context/yaml/handlers/flowVaultConnections.js +50 -36
- package/lib/context/yaml/handlers/flowVaultConnections.js.map +1 -0
- package/lib/context/yaml/handlers/flows.js +66 -55
- package/lib/context/yaml/handlers/flows.js.map +1 -0
- package/lib/context/yaml/handlers/forms.js +66 -55
- package/lib/context/yaml/handlers/forms.js.map +1 -0
- package/lib/context/yaml/handlers/guardianFactorProviders.js +19 -7
- package/lib/context/yaml/handlers/guardianFactorProviders.js.map +1 -0
- package/lib/context/yaml/handlers/guardianFactorTemplates.js +19 -7
- package/lib/context/yaml/handlers/guardianFactorTemplates.js.map +1 -0
- package/lib/context/yaml/handlers/guardianFactors.js +19 -7
- package/lib/context/yaml/handlers/guardianFactors.js.map +1 -0
- package/lib/context/yaml/handlers/guardianPhoneFactorMessageTypes.js +19 -7
- package/lib/context/yaml/handlers/guardianPhoneFactorMessageTypes.js.map +1 -0
- package/lib/context/yaml/handlers/guardianPhoneFactorSelectedProvider.js +19 -7
- package/lib/context/yaml/handlers/guardianPhoneFactorSelectedProvider.js.map +1 -0
- package/lib/context/yaml/handlers/guardianPolicies.js +19 -7
- package/lib/context/yaml/handlers/guardianPolicies.js.map +1 -0
- package/lib/context/yaml/handlers/hooks.js +48 -34
- package/lib/context/yaml/handlers/hooks.js.map +1 -0
- package/lib/context/yaml/handlers/index.js +3 -0
- package/lib/context/yaml/handlers/index.js.map +1 -0
- package/lib/context/yaml/handlers/logStreams.js +30 -16
- package/lib/context/yaml/handlers/logStreams.js.map +1 -0
- package/lib/context/yaml/handlers/networkACLs.js +39 -25
- package/lib/context/yaml/handlers/networkACLs.js.map +1 -0
- package/lib/context/yaml/handlers/organizations.js +46 -37
- package/lib/context/yaml/handlers/organizations.js.map +1 -0
- package/lib/context/yaml/handlers/pages.js +39 -31
- package/lib/context/yaml/handlers/pages.js.map +1 -0
- package/lib/context/yaml/handlers/phoneProvider.js +31 -17
- package/lib/context/yaml/handlers/phoneProvider.js.map +1 -0
- package/lib/context/yaml/handlers/prompts.js +47 -22
- package/lib/context/yaml/handlers/prompts.js.map +1 -0
- package/lib/context/yaml/handlers/resourceServers.d.ts +1 -1
- package/lib/context/yaml/handlers/resourceServers.js +33 -21
- package/lib/context/yaml/handlers/resourceServers.js.map +1 -0
- package/lib/context/yaml/handlers/roles.js +33 -19
- package/lib/context/yaml/handlers/roles.js.map +1 -0
- package/lib/context/yaml/handlers/rules.js +39 -28
- package/lib/context/yaml/handlers/rules.js.map +1 -0
- package/lib/context/yaml/handlers/rulesConfigs.js +28 -14
- package/lib/context/yaml/handlers/rulesConfigs.js.map +1 -0
- package/lib/context/yaml/handlers/selfServiceProfiles.js +43 -29
- package/lib/context/yaml/handlers/selfServiceProfiles.js.map +1 -0
- package/lib/context/yaml/handlers/tenant.js +41 -19
- package/lib/context/yaml/handlers/tenant.js.map +1 -0
- package/lib/context/yaml/handlers/themes.js +19 -7
- package/lib/context/yaml/handlers/themes.js.map +1 -0
- package/lib/context/yaml/handlers/triggers.d.ts +1 -1
- package/lib/context/yaml/handlers/triggers.js +29 -15
- package/lib/context/yaml/handlers/triggers.js.map +1 -0
- package/lib/context/yaml/handlers/userAttributeProfiles.d.ts +1 -1
- package/lib/context/yaml/handlers/userAttributeProfiles.js +19 -7
- package/lib/context/yaml/handlers/userAttributeProfiles.js.map +1 -0
- package/lib/context/yaml/index.js +128 -120
- package/lib/context/yaml/index.js.map +1 -0
- package/lib/index.d.ts +96 -4
- package/lib/index.js +34 -24
- package/lib/index.js.map +1 -0
- package/lib/keywordPreservation.d.ts +1 -1
- package/lib/keywordPreservation.js +6 -10
- package/lib/keywordPreservation.js.map +1 -0
- package/lib/logger.js +1 -0
- package/lib/logger.js.map +1 -0
- package/lib/readonly.js +4 -3
- package/lib/readonly.js.map +1 -0
- package/lib/sessionDurationsToMinutes.js +1 -0
- package/lib/sessionDurationsToMinutes.js.map +1 -0
- package/lib/tools/auth0/client.js +127 -108
- package/lib/tools/auth0/client.js.map +1 -0
- package/lib/tools/auth0/handlers/actions.d.ts +26 -8
- package/lib/tools/auth0/handlers/actions.js +149 -138
- package/lib/tools/auth0/handlers/actions.js.map +1 -0
- package/lib/tools/auth0/handlers/attackProtection.js +92 -80
- package/lib/tools/auth0/handlers/attackProtection.js.map +1 -0
- package/lib/tools/auth0/handlers/branding.js +99 -75
- package/lib/tools/auth0/handlers/branding.js.map +1 -0
- package/lib/tools/auth0/handlers/clientGrants.d.ts +9 -2
- package/lib/tools/auth0/handlers/clientGrants.js +72 -65
- package/lib/tools/auth0/handlers/clientGrants.js.map +1 -0
- package/lib/tools/auth0/handlers/clients.d.ts +96 -7
- package/lib/tools/auth0/handlers/clients.js +221 -66
- package/lib/tools/auth0/handlers/clients.js.map +1 -0
- package/lib/tools/auth0/handlers/connectionProfiles.d.ts +182 -0
- package/lib/tools/auth0/handlers/connectionProfiles.js +239 -0
- package/lib/tools/auth0/handlers/connectionProfiles.js.map +1 -0
- package/lib/tools/auth0/handlers/connections.d.ts +1 -3
- package/lib/tools/auth0/handlers/connections.js +135 -130
- package/lib/tools/auth0/handlers/connections.js.map +1 -0
- package/lib/tools/auth0/handlers/customDomains.d.ts +1 -4
- package/lib/tools/auth0/handlers/customDomains.js +53 -43
- package/lib/tools/auth0/handlers/customDomains.js.map +1 -0
- package/lib/tools/auth0/handlers/databases.js +114 -94
- package/lib/tools/auth0/handlers/databases.js.map +1 -0
- package/lib/tools/auth0/handlers/default.d.ts +2 -2
- package/lib/tools/auth0/handlers/default.js +171 -210
- package/lib/tools/auth0/handlers/default.js.map +1 -0
- package/lib/tools/auth0/handlers/emailProvider.js +52 -41
- package/lib/tools/auth0/handlers/emailProvider.js.map +1 -0
- package/lib/tools/auth0/handlers/emailTemplates.js +71 -49
- package/lib/tools/auth0/handlers/emailTemplates.js.map +1 -0
- package/lib/tools/auth0/handlers/flowVaultConnections.d.ts +12 -5
- package/lib/tools/auth0/handlers/flowVaultConnections.js +143 -108
- package/lib/tools/auth0/handlers/flowVaultConnections.js.map +1 -0
- package/lib/tools/auth0/handlers/flows.d.ts +3 -2
- package/lib/tools/auth0/handlers/flows.js +129 -92
- package/lib/tools/auth0/handlers/flows.js.map +1 -0
- package/lib/tools/auth0/handlers/forms.d.ts +3 -3
- package/lib/tools/auth0/handlers/forms.js +112 -98
- package/lib/tools/auth0/handlers/forms.js.map +1 -0
- package/lib/tools/auth0/handlers/guardianFactorProviders.js +84 -61
- package/lib/tools/auth0/handlers/guardianFactorProviders.js.map +1 -0
- package/lib/tools/auth0/handlers/guardianFactorTemplates.js +68 -46
- package/lib/tools/auth0/handlers/guardianFactorTemplates.js.map +1 -0
- package/lib/tools/auth0/handlers/guardianFactors.js +45 -35
- package/lib/tools/auth0/handlers/guardianFactors.js.map +1 -0
- package/lib/tools/auth0/handlers/guardianPhoneFactorMessageTypes.js +45 -29
- package/lib/tools/auth0/handlers/guardianPhoneFactorMessageTypes.js.map +1 -0
- package/lib/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.js +45 -29
- package/lib/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.js.map +1 -0
- package/lib/tools/auth0/handlers/guardianPolicies.js +35 -20
- package/lib/tools/auth0/handlers/guardianPolicies.js.map +1 -0
- package/lib/tools/auth0/handlers/hooks.js +153 -123
- package/lib/tools/auth0/handlers/hooks.js.map +1 -0
- package/lib/tools/auth0/handlers/index.js +3 -0
- package/lib/tools/auth0/handlers/index.js.map +1 -0
- package/lib/tools/auth0/handlers/logStreams.js +47 -42
- package/lib/tools/auth0/handlers/logStreams.js.map +1 -0
- package/lib/tools/auth0/handlers/networkACLs.d.ts +4 -5
- package/lib/tools/auth0/handlers/networkACLs.js +133 -115
- package/lib/tools/auth0/handlers/networkACLs.js.map +1 -0
- package/lib/tools/auth0/handlers/organizations.d.ts +9 -10
- package/lib/tools/auth0/handlers/organizations.js +429 -360
- package/lib/tools/auth0/handlers/organizations.js.map +1 -0
- package/lib/tools/auth0/handlers/pages.js +83 -74
- package/lib/tools/auth0/handlers/pages.js.map +1 -0
- package/lib/tools/auth0/handlers/phoneProvider.d.ts +2 -2
- package/lib/tools/auth0/handlers/phoneProvider.js +82 -69
- package/lib/tools/auth0/handlers/phoneProvider.js.map +1 -0
- package/lib/tools/auth0/handlers/prompts.d.ts +5 -5
- package/lib/tools/auth0/handlers/prompts.js +235 -240
- package/lib/tools/auth0/handlers/prompts.js.map +1 -0
- package/lib/tools/auth0/handlers/resourceServers.d.ts +2 -3
- package/lib/tools/auth0/handlers/resourceServers.js +106 -57
- package/lib/tools/auth0/handlers/resourceServers.js.map +1 -0
- package/lib/tools/auth0/handlers/roles.js +178 -162
- package/lib/tools/auth0/handlers/roles.js.map +1 -0
- package/lib/tools/auth0/handlers/rules.js +162 -144
- package/lib/tools/auth0/handlers/rules.js.map +1 -0
- package/lib/tools/auth0/handlers/rulesConfigs.js +39 -30
- package/lib/tools/auth0/handlers/rulesConfigs.js.map +1 -0
- package/lib/tools/auth0/handlers/scimHandler.d.ts +3 -4
- package/lib/tools/auth0/handlers/scimHandler.js +132 -110
- package/lib/tools/auth0/handlers/scimHandler.js.map +1 -0
- package/lib/tools/auth0/handlers/selfServiceProfiles.d.ts +5 -13
- package/lib/tools/auth0/handlers/selfServiceProfiles.js +204 -170
- package/lib/tools/auth0/handlers/selfServiceProfiles.js.map +1 -0
- package/lib/tools/auth0/handlers/tenant.d.ts +3 -5
- package/lib/tools/auth0/handlers/tenant.js +52 -45
- package/lib/tools/auth0/handlers/tenant.js.map +1 -0
- package/lib/tools/auth0/handlers/themes.d.ts +12 -12
- package/lib/tools/auth0/handlers/themes.js +102 -86
- package/lib/tools/auth0/handlers/themes.js.map +1 -0
- package/lib/tools/auth0/handlers/triggers.js +75 -59
- package/lib/tools/auth0/handlers/triggers.js.map +1 -0
- package/lib/tools/auth0/handlers/userAttributeProfiles.d.ts +4 -4
- package/lib/tools/auth0/handlers/userAttributeProfiles.js +63 -56
- package/lib/tools/auth0/handlers/userAttributeProfiles.js.map +1 -0
- package/lib/tools/auth0/index.js +48 -35
- package/lib/tools/auth0/index.js.map +1 -0
- package/lib/tools/auth0/schema.js +4 -6
- package/lib/tools/auth0/schema.js.map +1 -0
- package/lib/tools/calculateChanges.js +15 -24
- package/lib/tools/calculateChanges.js.map +1 -0
- package/lib/tools/constants.d.ts +3 -2
- package/lib/tools/constants.js +2 -0
- package/lib/tools/constants.js.map +1 -0
- package/lib/tools/deploy.js +29 -17
- package/lib/tools/deploy.js.map +1 -0
- package/lib/tools/index.d.ts +89 -3
- package/lib/tools/index.js +2 -3
- package/lib/tools/index.js.map +1 -0
- package/lib/tools/utils.d.ts +1 -1
- package/lib/tools/utils.js +22 -12
- package/lib/tools/utils.js.map +1 -0
- package/lib/tools/validationError.js +1 -0
- package/lib/tools/validationError.js.map +1 -0
- package/lib/types.d.ts +8 -9
- package/lib/types.js +1 -0
- package/lib/types.js.map +1 -0
- package/lib/utils.d.ts +58 -3
- package/lib/utils.js +5 -8
- package/lib/utils.js.map +1 -0
- package/package.json +12 -13
- package/tsconfig.json +3 -4
- package/eslint.config.js +0 -130
|
@@ -38,6 +38,15 @@ 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
|
+
};
|
|
41
50
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
42
51
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
43
52
|
};
|
|
@@ -49,7 +58,6 @@ const default_1 = __importStar(require("./default"));
|
|
|
49
58
|
const client_1 = require("../client");
|
|
50
59
|
const logger_1 = __importDefault(require("../../../logger"));
|
|
51
60
|
const utils_1 = require("../../../utils");
|
|
52
|
-
const flowVaultConnections_1 = require("./flowVaultConnections");
|
|
53
61
|
exports.schema = {
|
|
54
62
|
type: 'array',
|
|
55
63
|
items: {
|
|
@@ -64,114 +72,143 @@ exports.schema = {
|
|
|
64
72
|
};
|
|
65
73
|
class FlowHandler extends default_1.default {
|
|
66
74
|
constructor(options) {
|
|
67
|
-
super({
|
|
68
|
-
...options,
|
|
69
|
-
type: 'flows',
|
|
70
|
-
id: 'id',
|
|
71
|
-
stripCreateFields: ['created_at', 'updated_at', 'executed_at'],
|
|
72
|
-
stripUpdateFields: ['created_at', 'updated_at', 'executed_at'],
|
|
73
|
-
functions: {
|
|
74
|
-
update: async ({ id }, bodyParams) => this.client.flows.update(id, bodyParams),
|
|
75
|
-
},
|
|
76
|
-
});
|
|
75
|
+
super(Object.assign(Object.assign({}, options), { type: 'flows', id: 'id', stripCreateFields: ['created_at', 'updated_at', 'executed_at'], stripUpdateFields: ['created_at', 'updated_at', 'executed_at'] }));
|
|
77
76
|
}
|
|
78
77
|
objString(item) {
|
|
79
78
|
return super.objString({ id: item.id, name: item.name });
|
|
80
79
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
.
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
80
|
+
getFlows(flows) {
|
|
81
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
const allFlows = yield this.client.pool
|
|
83
|
+
.addEachTask({
|
|
84
|
+
data: flows,
|
|
85
|
+
generator: ({ id }) => this.client.flows.get({ id: id }).then((response) => {
|
|
86
|
+
if ((0, lodash_1.isEmpty)(response === null || response === void 0 ? void 0 : response.data))
|
|
87
|
+
return null;
|
|
88
|
+
return response.data;
|
|
89
|
+
}),
|
|
90
|
+
})
|
|
91
|
+
.promise();
|
|
92
|
+
return allFlows.filter((flow) => flow !== null);
|
|
93
|
+
});
|
|
93
94
|
}
|
|
94
|
-
|
|
95
|
-
|
|
95
|
+
getType() {
|
|
96
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
if (this.existing) {
|
|
98
|
+
return this.existing;
|
|
99
|
+
}
|
|
100
|
+
const [flows, allFlowConnections] = yield Promise.all([
|
|
101
|
+
(0, client_1.paginate)(this.client.flows.getAll, {
|
|
102
|
+
paginate: true,
|
|
103
|
+
include_totals: true,
|
|
104
|
+
}),
|
|
105
|
+
this.getAllFlowConnections(),
|
|
106
|
+
]);
|
|
107
|
+
// get more details for each flows
|
|
108
|
+
const allFlows = yield this.getFlows(flows);
|
|
109
|
+
// create a map for id to name from allFlowConnections
|
|
110
|
+
const connectionIdMap = {};
|
|
111
|
+
allFlowConnections.forEach((c) => {
|
|
112
|
+
connectionIdMap[c.id] = c.name;
|
|
113
|
+
});
|
|
114
|
+
this.existing = yield this.formateFlowConnectionId(allFlows, connectionIdMap);
|
|
96
115
|
return this.existing;
|
|
97
|
-
}
|
|
98
|
-
const [flows, allFlowConnections] = await Promise.all([
|
|
99
|
-
(0, client_1.paginate)(this.client.flows.list, {
|
|
100
|
-
paginate: true,
|
|
101
|
-
}),
|
|
102
|
-
(0, flowVaultConnections_1.getAllFlowConnections)(this.client),
|
|
103
|
-
]);
|
|
104
|
-
// get more details for each flows
|
|
105
|
-
const allFlows = await this.getFlows(flows);
|
|
106
|
-
// create a map for id to name from allFlowConnections
|
|
107
|
-
const connectionIdMap = {};
|
|
108
|
-
allFlowConnections.forEach((c) => {
|
|
109
|
-
connectionIdMap[c.id] = c.name;
|
|
110
116
|
});
|
|
111
|
-
this.existing = await this.formateFlowConnectionId(allFlows, connectionIdMap);
|
|
112
|
-
return this.existing;
|
|
113
117
|
}
|
|
114
|
-
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
if (!flows)
|
|
118
|
-
return;
|
|
119
|
-
const allFlowConnections = await (0, flowVaultConnections_1.getAllFlowConnections)(this.client);
|
|
120
|
-
// create a map for name to id from allFlowConnections
|
|
121
|
-
const connectionNameMap = {};
|
|
122
|
-
allFlowConnections.forEach((c) => {
|
|
123
|
-
connectionNameMap[c.name] = c.id;
|
|
118
|
+
processChanges(assets) {
|
|
119
|
+
const _super = Object.create(null, {
|
|
120
|
+
processChanges: { get: () => super.processChanges }
|
|
124
121
|
});
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
122
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
123
|
+
const { flows } = assets;
|
|
124
|
+
// Do nothing if not set
|
|
125
|
+
if (!flows)
|
|
126
|
+
return;
|
|
127
|
+
const allFlowConnections = yield this.getAllFlowConnections();
|
|
128
|
+
// create a map for name to id from allFlowConnections
|
|
129
|
+
const connectionNameMap = {};
|
|
130
|
+
allFlowConnections.forEach((c) => {
|
|
131
|
+
connectionNameMap[c.name] = c.id;
|
|
132
|
+
});
|
|
133
|
+
assets.flows = yield this.pargeFlowConnectionName(flows, connectionNameMap);
|
|
134
|
+
const { del, update, create, conflicts } = yield this.calcChanges(assets);
|
|
135
|
+
const changes = {
|
|
136
|
+
del: del,
|
|
137
|
+
update: update,
|
|
138
|
+
create: create,
|
|
139
|
+
conflicts: conflicts,
|
|
140
|
+
};
|
|
141
|
+
yield _super.processChanges.call(this, assets, Object.assign({}, changes));
|
|
135
142
|
});
|
|
136
143
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
getAllFlowConnections() {
|
|
145
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
146
|
+
const allFlowConnections = [];
|
|
147
|
+
// paginate without paginate<T> helper as this is not getAll but getAllConnections
|
|
148
|
+
// paginate through all flow connections
|
|
149
|
+
let page = 0;
|
|
150
|
+
while (true) {
|
|
151
|
+
const { data: { connections, total }, } = yield this.client.flows.getAllConnections({
|
|
152
|
+
page: page,
|
|
153
|
+
per_page: 100,
|
|
154
|
+
include_totals: true,
|
|
155
|
+
});
|
|
156
|
+
// if we get an unexpected response, break the loop to avoid infinite loop
|
|
157
|
+
if (!(0, lodash_1.isArray)(allFlowConnections) || typeof total !== 'number') {
|
|
158
|
+
break;
|
|
146
159
|
}
|
|
147
|
-
|
|
148
|
-
|
|
160
|
+
allFlowConnections.push(...connections);
|
|
161
|
+
page += 1;
|
|
162
|
+
if (allFlowConnections.length === total) {
|
|
163
|
+
break;
|
|
149
164
|
}
|
|
150
|
-
}
|
|
151
|
-
return
|
|
152
|
-
})
|
|
153
|
-
return flows;
|
|
165
|
+
}
|
|
166
|
+
return allFlowConnections;
|
|
167
|
+
});
|
|
154
168
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
169
|
+
formateFlowConnectionId(flows, connectionIdMap) {
|
|
170
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
171
|
+
// replace connection_id with flow connection names
|
|
172
|
+
yield Promise.all(flows.map((flow) => __awaiter(this, void 0, void 0, function* () {
|
|
173
|
+
const flowConnetions = (0, utils_1.findKeyPathWithValue)(flow, 'connection_id');
|
|
174
|
+
yield Promise.all(flowConnetions.map((f) => __awaiter(this, void 0, void 0, function* () {
|
|
175
|
+
const connectionId = (dot_prop_1.default.get(flow, f.path) || '');
|
|
176
|
+
const flowConnectionName = connectionIdMap[connectionId];
|
|
177
|
+
if (!flowConnectionName) {
|
|
178
|
+
logger_1.default.warn(`Flow connection: ${connectionId} not found for flow:${flow.name}, please verify the flow connection id.`);
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
dot_prop_1.default.set(flow, f.path, flowConnectionName);
|
|
182
|
+
}
|
|
183
|
+
})));
|
|
184
|
+
return flow;
|
|
185
|
+
})));
|
|
186
|
+
return flows;
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
pargeFlowConnectionName(flows, connectionNameMap) {
|
|
190
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
191
|
+
// replace connection_id with flow connection names
|
|
192
|
+
const parsedFlows = yield Promise.all(flows.map((flow) => __awaiter(this, void 0, void 0, function* () {
|
|
193
|
+
const flowConnetions = (0, utils_1.findKeyPathWithValue)(flow, 'connection_id');
|
|
194
|
+
yield Promise.all(flowConnetions.map((f) => __awaiter(this, void 0, void 0, function* () {
|
|
195
|
+
const connectionName = (dot_prop_1.default.get(flow, f.path) || '');
|
|
196
|
+
const flowConnectionId = connectionNameMap[connectionName];
|
|
197
|
+
if (!flowConnectionId) {
|
|
198
|
+
logger_1.default.error(`Flow connection: ${flowConnectionId} not found for flow:${flow.name}, please verify the flow connection name.`);
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
dot_prop_1.default.set(flow, f.path, flowConnectionId);
|
|
202
|
+
}
|
|
203
|
+
})));
|
|
204
|
+
return flow;
|
|
205
|
+
})));
|
|
206
|
+
return parsedFlows;
|
|
207
|
+
});
|
|
172
208
|
}
|
|
173
209
|
}
|
|
174
210
|
exports.default = FlowHandler;
|
|
175
211
|
__decorate([
|
|
176
212
|
(0, default_1.order)('80')
|
|
177
213
|
], FlowHandler.prototype, "processChanges", null);
|
|
214
|
+
//# sourceMappingURL=flows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flows.js","sourceRoot":"","sources":["../../../../src/tools/auth0/handlers/flows.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAA0C;AAM1C,wDAA+B;AAC/B,qDAAkD;AAElD,sCAAqC;AACrC,6DAAkC;AAClC,0CAAsD;AAOzC,QAAA,MAAM,GAAG;IACpB,IAAI,EAAE,OAAO;IACb,KAAK,EAAE;QACL,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACxB,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SACzB;QACD,QAAQ,EAAE,CAAC,MAAM,CAAC;KACnB;IACD,oBAAoB,EAAE,KAAK;CAC5B,CAAC;AAEF,MAAqB,WAAY,SAAQ,iBAAc;IAGrD,YAAY,OAAuB;QACjC,KAAK,iCACA,OAAO,KACV,IAAI,EAAE,OAAO,EACb,EAAE,EAAE,IAAI,EACR,iBAAiB,EAAE,CAAC,YAAY,EAAE,YAAY,EAAE,aAAa,CAAC,EAC9D,iBAAiB,EAAE,CAAC,YAAY,EAAE,YAAY,EAAE,aAAa,CAAC,IAC9D,CAAC;IACL,CAAC;IAED,SAAS,CAAC,IAAI;QACZ,OAAO,KAAK,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,E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C;iDA6BX"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PostForms201Response } from 'auth0';
|
|
2
2
|
import DefaultHandler from './default';
|
|
3
3
|
import { Asset, Assets } from '../../../types';
|
|
4
4
|
export type Form = {
|
|
5
5
|
name: string;
|
|
6
6
|
body: string;
|
|
7
7
|
};
|
|
8
|
-
export type FormResponse =
|
|
8
|
+
export type FormResponse = PostForms201Response;
|
|
9
9
|
export declare const schema: {
|
|
10
10
|
type: string;
|
|
11
11
|
items: {
|
|
@@ -26,7 +26,7 @@ export default class FormsHandler extends DefaultHandler {
|
|
|
26
26
|
existing: Asset;
|
|
27
27
|
constructor(options: DefaultHandler);
|
|
28
28
|
objString(item: any): string;
|
|
29
|
-
getForms(forms: Array<
|
|
29
|
+
getForms(forms: Array<PostForms201Response>): Promise<PostForms201Response[]>;
|
|
30
30
|
getType(): Promise<Asset>;
|
|
31
31
|
formateFormFlowId(forms: any, flowIdMap: any): Promise<Asset>;
|
|
32
32
|
pargeFormFlowName(forms: any, flowNameMap: any): Promise<Form[]>;
|
|
@@ -38,6 +38,15 @@ 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
|
+
};
|
|
41
50
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
42
51
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
43
52
|
};
|
|
@@ -63,115 +72,119 @@ exports.schema = {
|
|
|
63
72
|
};
|
|
64
73
|
class FormsHandler extends default_1.default {
|
|
65
74
|
constructor(options) {
|
|
66
|
-
super({
|
|
67
|
-
...options,
|
|
68
|
-
type: 'forms',
|
|
69
|
-
id: 'id',
|
|
70
|
-
stripCreateFields: ['created_at', 'updated_at', 'submitted_at', 'embedded_at'],
|
|
71
|
-
stripUpdateFields: ['created_at', 'updated_at', 'submitted_at', 'embedded_at'],
|
|
72
|
-
functions: {
|
|
73
|
-
update: async ({ id }, bodyParams) => this.client.forms.update(id, bodyParams),
|
|
74
|
-
},
|
|
75
|
-
});
|
|
75
|
+
super(Object.assign(Object.assign({}, options), { type: 'forms', id: 'id', stripCreateFields: ['created_at', 'updated_at', 'submitted_at', 'embedded_at'], stripUpdateFields: ['created_at', 'updated_at', 'submitted_at', 'embedded_at'] }));
|
|
76
76
|
}
|
|
77
77
|
objString(item) {
|
|
78
78
|
return super.objString({ id: item.id, name: item.name });
|
|
79
79
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
.
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
80
|
+
getForms(forms) {
|
|
81
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
const allForms = yield this.client.pool
|
|
83
|
+
.addEachTask({
|
|
84
|
+
data: forms,
|
|
85
|
+
generator: ({ id }) => this.client.forms.get({ id: id }).then((response) => {
|
|
86
|
+
if ((0, lodash_1.isEmpty)(response === null || response === void 0 ? void 0 : response.data))
|
|
87
|
+
return null;
|
|
88
|
+
return response.data;
|
|
89
|
+
}),
|
|
90
|
+
})
|
|
91
|
+
.promise();
|
|
92
|
+
return allForms.filter((form) => form !== null);
|
|
93
|
+
});
|
|
92
94
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
+
getType() {
|
|
96
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
if (this.existing) {
|
|
98
|
+
return this.existing;
|
|
99
|
+
}
|
|
100
|
+
const [forms, flows] = yield Promise.all([
|
|
101
|
+
(0, client_1.paginate)(this.client.forms.getAll, {
|
|
102
|
+
paginate: true,
|
|
103
|
+
include_totals: true,
|
|
104
|
+
}),
|
|
105
|
+
(0, client_1.paginate)(this.client.flows.getAll, {
|
|
106
|
+
paginate: true,
|
|
107
|
+
include_totals: true,
|
|
108
|
+
}),
|
|
109
|
+
]);
|
|
110
|
+
// get more details for each form
|
|
111
|
+
const allForms = yield this.getForms(forms);
|
|
112
|
+
// create a map for id to name from allFlows
|
|
113
|
+
const flowIdMap = {};
|
|
114
|
+
flows.forEach((f) => {
|
|
115
|
+
flowIdMap[f.id] = f.name;
|
|
116
|
+
});
|
|
117
|
+
this.existing = yield this.formateFormFlowId(allForms, flowIdMap);
|
|
95
118
|
return this.existing;
|
|
96
|
-
}
|
|
97
|
-
const [forms, flows] = await Promise.all([
|
|
98
|
-
(0, client_1.paginate)(this.client.forms.list, {
|
|
99
|
-
paginate: true,
|
|
100
|
-
}),
|
|
101
|
-
(0, client_1.paginate)(this.client.flows.list, {
|
|
102
|
-
paginate: true,
|
|
103
|
-
}),
|
|
104
|
-
]);
|
|
105
|
-
// get more details for each form
|
|
106
|
-
const allForms = await this.getForms(forms);
|
|
107
|
-
// create a map for id to name from allFlows
|
|
108
|
-
const flowIdMap = {};
|
|
109
|
-
flows.forEach((f) => {
|
|
110
|
-
flowIdMap[f.id] = f.name;
|
|
111
119
|
});
|
|
112
|
-
this.existing = await this.formateFormFlowId(allForms, flowIdMap);
|
|
113
|
-
return this.existing;
|
|
114
120
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
// replace flow names with flow_id
|
|
135
|
-
await Promise.all(forms.map(async (form) => {
|
|
136
|
-
const flows = (0, utils_1.findKeyPathWithValue)(form, 'flow_id');
|
|
137
|
-
await Promise.all(flows.map(async (f) => {
|
|
138
|
-
const flowName = (dot_prop_1.default.get(form, f.path) || '');
|
|
139
|
-
const flowId = flowNameMap[flowName];
|
|
140
|
-
if (!flowId) {
|
|
141
|
-
logger_1.default.error(`Flow: ${flowName} not found for form:${form.name}, please verify the flow name.`);
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
dot_prop_1.default.set(form, f.path, flowNameMap[flowName]);
|
|
145
|
-
}
|
|
146
|
-
}));
|
|
147
|
-
return form;
|
|
148
|
-
}));
|
|
149
|
-
return forms;
|
|
121
|
+
formateFormFlowId(forms, flowIdMap) {
|
|
122
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
123
|
+
// replace flow_id with flow names
|
|
124
|
+
yield Promise.all(forms.map((form) => __awaiter(this, void 0, void 0, function* () {
|
|
125
|
+
const flows = (0, utils_1.findKeyPathWithValue)(form, 'flow_id');
|
|
126
|
+
yield Promise.all(flows.map((f) => __awaiter(this, void 0, void 0, function* () {
|
|
127
|
+
const flowId = (dot_prop_1.default.get(form, f.path) || '');
|
|
128
|
+
const flowName = flowIdMap[flowId];
|
|
129
|
+
if (!flowName) {
|
|
130
|
+
logger_1.default.warn(`Flow: ${flowId} not found for form:${form.name}, please verify the flow id.`);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
dot_prop_1.default.set(form, f.path, flowName);
|
|
134
|
+
}
|
|
135
|
+
})));
|
|
136
|
+
return form;
|
|
137
|
+
})));
|
|
138
|
+
return forms;
|
|
139
|
+
});
|
|
150
140
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
141
|
+
pargeFormFlowName(forms, flowNameMap) {
|
|
142
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
143
|
+
// replace flow names with flow_id
|
|
144
|
+
yield Promise.all(forms.map((form) => __awaiter(this, void 0, void 0, function* () {
|
|
145
|
+
const flows = (0, utils_1.findKeyPathWithValue)(form, 'flow_id');
|
|
146
|
+
yield Promise.all(flows.map((f) => __awaiter(this, void 0, void 0, function* () {
|
|
147
|
+
const flowName = (dot_prop_1.default.get(form, f.path) || '');
|
|
148
|
+
const flowId = flowNameMap[flowName];
|
|
149
|
+
if (!flowId) {
|
|
150
|
+
logger_1.default.error(`Flow: ${flowName} not found for form:${form.name}, please verify the flow name.`);
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
dot_prop_1.default.set(form, f.path, flowNameMap[flowName]);
|
|
154
|
+
}
|
|
155
|
+
})));
|
|
156
|
+
return form;
|
|
157
|
+
})));
|
|
158
|
+
return forms;
|
|
159
159
|
});
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
160
|
+
}
|
|
161
|
+
processChanges(assets) {
|
|
162
|
+
const _super = Object.create(null, {
|
|
163
|
+
processChanges: { get: () => super.processChanges }
|
|
164
164
|
});
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
165
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
166
|
+
const { forms } = assets;
|
|
167
|
+
// Do nothing if not set
|
|
168
|
+
if (!forms)
|
|
169
|
+
return;
|
|
170
|
+
const flows = yield (0, client_1.paginate)(this.client.flows.getAll, {
|
|
171
|
+
paginate: true,
|
|
172
|
+
include_totals: true,
|
|
173
|
+
});
|
|
174
|
+
// create a map for id to name from flows
|
|
175
|
+
const flowNamMap = {};
|
|
176
|
+
flows.forEach((f) => {
|
|
177
|
+
flowNamMap[f.name] = f.id;
|
|
178
|
+
});
|
|
179
|
+
assets.forms = yield this.pargeFormFlowName(forms, flowNamMap);
|
|
180
|
+
const { del, update, create, conflicts } = yield this.calcChanges(assets);
|
|
181
|
+
const changes = {
|
|
182
|
+
del: del,
|
|
183
|
+
update: update,
|
|
184
|
+
create: create,
|
|
185
|
+
conflicts: conflicts,
|
|
186
|
+
};
|
|
187
|
+
yield _super.processChanges.call(this, assets, Object.assign({}, changes));
|
|
175
188
|
});
|
|
176
189
|
}
|
|
177
190
|
}
|
|
@@ -179,3 +192,4 @@ exports.default = FormsHandler;
|
|
|
179
192
|
__decorate([
|
|
180
193
|
(0, default_1.order)('90')
|
|
181
194
|
], FormsHandler.prototype, "processChanges", null);
|
|
195
|
+
//# sourceMappingURL=forms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forms.js","sourceRoot":"","sources":["../../../../src/tools/auth0/handlers/forms.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,wDAA+B;AAC/B,mCAAiC;AACjC,qDAAkD;AAClD,6DAAkC;AAElC,sCAAqC;AACrC,0CAAsD;AASzC,QAAA,MAAM,GAAG;IACpB,IAAI,EAAE,OAAO;IACb,KAAK,EAAE;QACL,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACxB,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SACzB;QACD,QAAQ,EAAE,CAAC,MAAM,CAAC;KACnB;IACD,oBAAoB,EAAE,KAAK;CAC5B,CAAC;AAEF,MAAqB,YAAa,SAAQ,iBAAc;IAGtD,YAAY,OAAuB;QACjC,KAAK,iCACA,OAAO,KACV,IAAI,EAAE,OAAO,EACb,EAAE,EAAE,IAAI,EACR,iBAAiB,EAAE,CAAC,YAAY,EAAE,YAAY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