auth0-deploy-cli 8.20.2 → 8.20.4-beta.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 +46 -5
- package/CHANGELOG.md +17 -1
- package/eslint.config.js +130 -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.js +38 -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 +17 -29
- 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 +39 -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 +0 -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/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/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 +41 -55
- 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 +36 -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 +0 -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/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/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 -95
- package/lib/index.js +24 -34
- package/lib/keywordPreservation.d.ts +1 -1
- package/lib/keywordPreservation.js +10 -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 +111 -120
- 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 -8
- package/lib/tools/auth0/handlers/clientGrants.js +65 -70
- package/lib/tools/auth0/handlers/clients.d.ts +3 -9
- package/lib/tools/auth0/handlers/clients.js +59 -63
- 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.js +49 -71
- package/lib/tools/auth0/handlers/flowVaultConnections.d.ts +5 -12
- package/lib/tools/auth0/handlers/flowVaultConnections.js +108 -143
- 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 +0 -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 +360 -429
- 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/prompts.d.ts +5 -5
- package/lib/tools/auth0/handlers/prompts.js +242 -249
- package/lib/tools/auth0/handlers/resourceServers.d.ts +3 -1
- package/lib/tools/auth0/handlers/resourceServers.js +59 -60
- package/lib/tools/auth0/handlers/roles.js +162 -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 +11 -3
- package/lib/tools/auth0/handlers/selfServiceProfiles.js +170 -208
- package/lib/tools/auth0/handlers/tenant.d.ts +5 -3
- package/lib/tools/auth0/handlers/tenant.js +45 -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/triggers.js +59 -75
- package/lib/tools/auth0/handlers/userAttributeProfiles.d.ts +3 -2
- package/lib/tools/auth0/handlers/userAttributeProfiles.js +54 -56
- 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 +2 -2
- package/lib/tools/constants.js +0 -1
- package/lib/tools/deploy.js +17 -29
- package/lib/tools/index.d.ts +3 -88
- 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 +8 -4
- package/lib/types.js +0 -1
- package/lib/utils.d.ts +3 -57
- package/lib/utils.js +8 -5
- package/package.json +12 -11
- 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/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/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/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
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -68,34 +59,31 @@ function parse(context) {
|
|
|
68
59
|
attackProtection,
|
|
69
60
|
};
|
|
70
61
|
}
|
|
71
|
-
function dump(context) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
});
|
|
62
|
+
async function dump(context) {
|
|
63
|
+
const { attackProtection } = context.assets;
|
|
64
|
+
if (!attackProtection)
|
|
65
|
+
return;
|
|
66
|
+
const files = attackProtectionFiles(context.filePath);
|
|
67
|
+
fs_extra_1.default.ensureDirSync(files.directory);
|
|
68
|
+
const maskedAttackProtection = (0, defaults_1.attackProtectionDefaults)(attackProtection);
|
|
69
|
+
if (maskedAttackProtection.botDetection) {
|
|
70
|
+
(0, utils_1.dumpJSON)(files.botDetection, maskedAttackProtection.botDetection);
|
|
71
|
+
}
|
|
72
|
+
if (maskedAttackProtection.breachedPasswordDetection) {
|
|
73
|
+
(0, utils_1.dumpJSON)(files.breachedPasswordDetection, maskedAttackProtection.breachedPasswordDetection);
|
|
74
|
+
}
|
|
75
|
+
if (maskedAttackProtection.bruteForceProtection) {
|
|
76
|
+
(0, utils_1.dumpJSON)(files.bruteForceProtection, maskedAttackProtection.bruteForceProtection);
|
|
77
|
+
}
|
|
78
|
+
if (maskedAttackProtection.captcha) {
|
|
79
|
+
(0, utils_1.dumpJSON)(files.captcha, maskedAttackProtection.captcha);
|
|
80
|
+
}
|
|
81
|
+
if (maskedAttackProtection.suspiciousIpThrottling) {
|
|
82
|
+
(0, utils_1.dumpJSON)(files.suspiciousIpThrottling, maskedAttackProtection.suspiciousIpThrottling);
|
|
83
|
+
}
|
|
95
84
|
}
|
|
96
85
|
const attackProtectionHandler = {
|
|
97
86
|
parse,
|
|
98
87
|
dump,
|
|
99
88
|
};
|
|
100
89
|
exports.default = attackProtectionHandler;
|
|
101
|
-
//# sourceMappingURL=attackProtection.js.map
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -47,18 +38,19 @@ function parse(context) {
|
|
|
47
38
|
return definition;
|
|
48
39
|
}, {});
|
|
49
40
|
return {
|
|
50
|
-
branding:
|
|
41
|
+
branding: {
|
|
42
|
+
...brandingSettings,
|
|
43
|
+
templates,
|
|
44
|
+
},
|
|
51
45
|
};
|
|
52
46
|
}
|
|
53
|
-
function dump(context) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
dumpBrandingTemplates(context);
|
|
61
|
-
});
|
|
47
|
+
async function dump(context) {
|
|
48
|
+
const { branding } = context.assets;
|
|
49
|
+
if (!branding)
|
|
50
|
+
return;
|
|
51
|
+
dumpBranding(context);
|
|
52
|
+
if (!!branding.templates)
|
|
53
|
+
dumpBrandingTemplates(context);
|
|
62
54
|
}
|
|
63
55
|
const dumpBrandingTemplates = ({ filePath, assets }) => {
|
|
64
56
|
if (!assets.branding || !assets.branding.templates)
|
|
@@ -84,7 +76,7 @@ const dumpBranding = ({ filePath, assets }) => {
|
|
|
84
76
|
return;
|
|
85
77
|
const { branding } = assets;
|
|
86
78
|
const brandingWithoutTemplates = (() => {
|
|
87
|
-
const newBranding =
|
|
79
|
+
const newBranding = { ...branding };
|
|
88
80
|
delete newBranding.templates;
|
|
89
81
|
return newBranding;
|
|
90
82
|
})();
|
|
@@ -98,4 +90,3 @@ const brandingHandler = {
|
|
|
98
90
|
dump,
|
|
99
91
|
};
|
|
100
92
|
exports.default = brandingHandler;
|
|
101
|
-
//# sourceMappingURL=branding.js.map
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -33,58 +24,58 @@ function parse(context) {
|
|
|
33
24
|
clientGrants,
|
|
34
25
|
};
|
|
35
26
|
}
|
|
36
|
-
function dump(context) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
return
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
27
|
+
async function dump(context) {
|
|
28
|
+
const { clientGrants } = context.assets;
|
|
29
|
+
if (!clientGrants)
|
|
30
|
+
return; // Skip, nothing to dump
|
|
31
|
+
const grantsFolder = path_1.default.join(context.filePath, tools_1.constants.CLIENTS_GRANTS_DIRECTORY);
|
|
32
|
+
fs_extra_1.default.ensureDirSync(grantsFolder);
|
|
33
|
+
if (clientGrants.length === 0)
|
|
34
|
+
return;
|
|
35
|
+
const allResourceServers = await (0, client_1.paginate)(context.mgmtClient.resourceServers.list, {
|
|
36
|
+
paginate: true,
|
|
37
|
+
include_totals: true,
|
|
38
|
+
});
|
|
39
|
+
const allClients = await (0, client_1.paginate)(context.mgmtClient.clients.list, {
|
|
40
|
+
paginate: true,
|
|
41
|
+
include_totals: true,
|
|
42
|
+
});
|
|
43
|
+
// Convert client_id to the client name for readability
|
|
44
|
+
clientGrants.forEach((grant) => {
|
|
45
|
+
const dumpGrant = { ...grant };
|
|
46
|
+
if (context.assets.clientsOrig) {
|
|
47
|
+
dumpGrant.client_id = (0, utils_1.convertClientIdToName)(dumpGrant.client_id, context.assets.clientsOrig);
|
|
48
|
+
}
|
|
49
|
+
const clientName = (() => {
|
|
50
|
+
const associatedClient = allClients.find((client) => client.client_id === grant.client_id);
|
|
51
|
+
if (associatedClient === undefined)
|
|
52
|
+
return grant.client_id;
|
|
53
|
+
return associatedClient.name;
|
|
54
|
+
})();
|
|
55
|
+
// Convert audience to the API name for readability
|
|
56
|
+
const apiName = (grantAudience) => {
|
|
57
|
+
if (!grantAudience)
|
|
58
|
+
return grantAudience;
|
|
59
|
+
const associatedAPI = allResourceServers.find((resourceServer) => resourceServer.identifier === grantAudience);
|
|
60
|
+
if (associatedAPI === undefined)
|
|
61
|
+
return grantAudience; // Use the audience if the API is not found
|
|
62
|
+
return associatedAPI.name; // Use the name of the API
|
|
63
|
+
};
|
|
64
|
+
// Replace keyword markers if necessary
|
|
65
|
+
const clientNameNonMarker = (0, keywordPreservation_1.doesHaveKeywordMarker)(clientName, context.mappings)
|
|
66
|
+
? (0, tools_1.keywordReplace)(clientName, context.mappings)
|
|
67
|
+
: clientName;
|
|
68
|
+
const apiAudienceNonMarker = (0, keywordPreservation_1.doesHaveKeywordMarker)(grant.audience, context.mappings)
|
|
69
|
+
? (0, tools_1.keywordReplace)(grant.audience, context.mappings)
|
|
70
|
+
: grant.audience;
|
|
71
|
+
// Construct the name using non-marker names
|
|
72
|
+
const name = (0, utils_1.sanitize)(`${clientNameNonMarker}-${apiName(apiAudienceNonMarker)}`);
|
|
73
|
+
// Ensure the name is not empty or invalid
|
|
74
|
+
if (!name || name.trim().length === 0) {
|
|
75
|
+
throw new Error(`Invalid name generated for client grant: ${JSON.stringify(grant)}`);
|
|
76
|
+
}
|
|
77
|
+
const grantFile = path_1.default.join(grantsFolder, `${name}.json`);
|
|
78
|
+
(0, utils_1.dumpJSON)(grantFile, dumpGrant);
|
|
88
79
|
});
|
|
89
80
|
}
|
|
90
81
|
const clientGrantsHandler = {
|
|
@@ -92,4 +83,3 @@ const clientGrantsHandler = {
|
|
|
92
83
|
dump,
|
|
93
84
|
};
|
|
94
85
|
exports.default = clientGrantsHandler;
|
|
95
|
-
//# sourceMappingURL=clientGrants.js.map
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -44,25 +35,23 @@ function parse(context) {
|
|
|
44
35
|
clients,
|
|
45
36
|
};
|
|
46
37
|
}
|
|
47
|
-
function dump(context) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
(0, utils_1.dumpJSON)(clientFile, (0, utils_1.clearClientArrays)(client));
|
|
65
|
-
});
|
|
38
|
+
async function dump(context) {
|
|
39
|
+
const { clients } = context.assets;
|
|
40
|
+
if (!clients)
|
|
41
|
+
return; // Skip, nothing to dump
|
|
42
|
+
const clientsFolder = path_1.default.join(context.filePath, tools_1.constants.CLIENTS_DIRECTORY);
|
|
43
|
+
fs_extra_1.default.ensureDirSync(clientsFolder);
|
|
44
|
+
clients.forEach((client) => {
|
|
45
|
+
const clientName = (0, utils_1.sanitize)(client.name);
|
|
46
|
+
const clientFile = path_1.default.join(clientsFolder, `${clientName}.json`);
|
|
47
|
+
if (client.custom_login_page) {
|
|
48
|
+
const html = client.custom_login_page;
|
|
49
|
+
const customLoginHtml = path_1.default.join(clientsFolder, `${clientName}_custom_login_page.html`);
|
|
50
|
+
logger_1.default.info(`Writing ${customLoginHtml}`);
|
|
51
|
+
fs_extra_1.default.writeFileSync(customLoginHtml, html);
|
|
52
|
+
client.custom_login_page = `./${clientName}_custom_login_page.html`;
|
|
53
|
+
}
|
|
54
|
+
(0, utils_1.dumpJSON)(clientFile, (0, utils_1.clearClientArrays)(client));
|
|
66
55
|
});
|
|
67
56
|
}
|
|
68
57
|
const clientsHandler = {
|
|
@@ -70,4 +59,3 @@ const clientsHandler = {
|
|
|
70
59
|
dump,
|
|
71
60
|
};
|
|
72
61
|
exports.default = clientsHandler;
|
|
73
|
-
//# sourceMappingURL=clients.js.map
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -48,40 +39,41 @@ function parse(context) {
|
|
|
48
39
|
connections,
|
|
49
40
|
};
|
|
50
41
|
}
|
|
51
|
-
function dump(context) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
42
|
+
async function dump(context) {
|
|
43
|
+
const { connections, clientsOrig } = context.assets;
|
|
44
|
+
if (!connections)
|
|
45
|
+
return; // Skip, nothing to dump
|
|
46
|
+
const connectionsFolder = path_1.default.join(context.filePath, tools_1.constants.CONNECTIONS_DIRECTORY);
|
|
47
|
+
fs_extra_1.default.ensureDirSync(connectionsFolder);
|
|
48
|
+
// Convert enabled_clients from id to name
|
|
49
|
+
connections.forEach((connection) => {
|
|
50
|
+
let dumpedConnection = {
|
|
51
|
+
...connection,
|
|
52
|
+
...(connection.enabled_clients && {
|
|
61
53
|
enabled_clients: (0, utils_1.mapClientID2NameSorted)(connection.enabled_clients, clientsOrig || []),
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
54
|
+
}),
|
|
55
|
+
};
|
|
56
|
+
const connectionName = (0, utils_1.sanitize)(dumpedConnection.name);
|
|
57
|
+
// Mask secrets
|
|
58
|
+
dumpedConnection = (0, defaults_1.connectionDefaults)(dumpedConnection);
|
|
59
|
+
if (dumpedConnection.strategy === 'email') {
|
|
60
|
+
(0, utils_1.ensureProp)(dumpedConnection, 'options.email.body');
|
|
61
|
+
const html = dumpedConnection.options.email.body;
|
|
62
|
+
const emailConnectionHtml = path_1.default.join(connectionsFolder, `${connectionName}.html`);
|
|
63
|
+
logger_1.default.info(`Writing ${emailConnectionHtml}`);
|
|
64
|
+
fs_extra_1.default.writeFileSync(emailConnectionHtml, html);
|
|
65
|
+
dumpedConnection.options.email.body = `./${connectionName}.html`;
|
|
66
|
+
}
|
|
67
|
+
if (dumpedConnection.strategy === 'samlp' && dumpedConnection.options) {
|
|
68
|
+
if ('cert' in dumpedConnection.options) {
|
|
69
|
+
dumpedConnection.options.cert = (0, utils_1.encodeCertStringToBase64)(dumpedConnection.options.cert);
|
|
73
70
|
}
|
|
74
|
-
if (
|
|
75
|
-
|
|
76
|
-
dumpedConnection.options.cert = (0, utils_1.encodeCertStringToBase64)(dumpedConnection.options.cert);
|
|
77
|
-
}
|
|
78
|
-
if ('signingCert' in dumpedConnection.options) {
|
|
79
|
-
dumpedConnection.options.signingCert = (0, utils_1.encodeCertStringToBase64)(dumpedConnection.options.signingCert);
|
|
80
|
-
}
|
|
71
|
+
if ('signingCert' in dumpedConnection.options) {
|
|
72
|
+
dumpedConnection.options.signingCert = (0, utils_1.encodeCertStringToBase64)(dumpedConnection.options.signingCert);
|
|
81
73
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
74
|
+
}
|
|
75
|
+
const connectionFile = path_1.default.join(connectionsFolder, `${connectionName}.json`);
|
|
76
|
+
(0, utils_1.dumpJSON)(connectionFile, dumpedConnection);
|
|
85
77
|
});
|
|
86
78
|
}
|
|
87
79
|
const connectionsHandler = {
|
|
@@ -89,4 +81,3 @@ const connectionsHandler = {
|
|
|
89
81
|
dump,
|
|
90
82
|
};
|
|
91
83
|
exports.default = connectionsHandler;
|
|
92
|
-
//# sourceMappingURL=connections.js.map
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -30,21 +21,18 @@ function parse(context) {
|
|
|
30
21
|
}),
|
|
31
22
|
};
|
|
32
23
|
}
|
|
33
|
-
function dump(context) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
(0, utils_1.dumpJSON)(customDomainsFile, customDomains);
|
|
43
|
-
});
|
|
24
|
+
async function dump(context) {
|
|
25
|
+
const { customDomains } = context.assets;
|
|
26
|
+
if (!customDomains)
|
|
27
|
+
return; // Skip, nothing to dump
|
|
28
|
+
// Create Rules folder
|
|
29
|
+
const customDomainsDirectory = getCustomDomainsDirectory(context.filePath);
|
|
30
|
+
fs_extra_1.default.ensureDirSync(customDomainsDirectory);
|
|
31
|
+
const customDomainsFile = getCustomDomainsFile(context.filePath);
|
|
32
|
+
(0, utils_1.dumpJSON)(customDomainsFile, customDomains);
|
|
44
33
|
}
|
|
45
34
|
const customDomainsHandler = {
|
|
46
35
|
parse,
|
|
47
36
|
dump,
|
|
48
37
|
};
|
|
49
38
|
exports.default = customDomainsHandler;
|
|
50
|
-
//# sourceMappingURL=customDomains.js.map
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -18,7 +9,6 @@ const tools_1 = require("../../../tools");
|
|
|
18
9
|
const logger_1 = __importDefault(require("../../../logger"));
|
|
19
10
|
const utils_1 = require("../../../utils");
|
|
20
11
|
function getDatabase(folder, mappingOpts) {
|
|
21
|
-
var _a;
|
|
22
12
|
const metaFile = path_1.default.join(folder, 'database.json');
|
|
23
13
|
const metaData = (() => {
|
|
24
14
|
try {
|
|
@@ -33,9 +23,17 @@ function getDatabase(folder, mappingOpts) {
|
|
|
33
23
|
logger_1.default.warn(`Skipping database folder ${folder} as ${metaFile} is empty`);
|
|
34
24
|
return {};
|
|
35
25
|
}
|
|
36
|
-
const database =
|
|
26
|
+
const database = {
|
|
27
|
+
...metaData,
|
|
28
|
+
options: {
|
|
29
|
+
// @ts-ignore because this code exists currently, but still needs to be understood if it is correct or not
|
|
30
|
+
...(metaData.options || {}),
|
|
31
|
+
// @ts-ignore because this code exists currently, but still needs to be understood if it is correct or not
|
|
32
|
+
...(metaData?.customScripts && { customScripts: metaData?.customScripts }),
|
|
33
|
+
},
|
|
34
|
+
};
|
|
37
35
|
// If any customScripts configured then load content of files
|
|
38
|
-
if (
|
|
36
|
+
if (database.options?.customScripts) {
|
|
39
37
|
Object.entries(database.options.customScripts).forEach(([name, script]) => {
|
|
40
38
|
if (!tools_1.constants.DATABASE_SCRIPTS.includes(name)) {
|
|
41
39
|
// skip invalid keys in customScripts object
|
|
@@ -66,25 +64,29 @@ function parse(context) {
|
|
|
66
64
|
databases,
|
|
67
65
|
};
|
|
68
66
|
}
|
|
69
|
-
function dump(context) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
67
|
+
async function dump(context) {
|
|
68
|
+
const { databases } = context.assets;
|
|
69
|
+
if (!databases)
|
|
70
|
+
return; // Skip, nothing to dump
|
|
71
|
+
const databasesFolder = path_1.default.join(context.filePath, tools_1.constants.DATABASE_CONNECTIONS_DIRECTORY);
|
|
72
|
+
fs_extra_1.default.ensureDirSync(databasesFolder);
|
|
73
|
+
databases.forEach((database) => {
|
|
74
|
+
const dbFolder = path_1.default.join(databasesFolder, (0, utils_1.sanitize)(database.name));
|
|
75
|
+
fs_extra_1.default.ensureDirSync(dbFolder);
|
|
76
|
+
const sortCustomScripts = (name1, name2) => {
|
|
77
|
+
if (name1 === name2)
|
|
78
|
+
return 0;
|
|
79
|
+
return name1 > name2 ? 1 : -1;
|
|
80
|
+
};
|
|
81
|
+
const formatted = {
|
|
82
|
+
...database,
|
|
83
|
+
...(database.enabled_clients && {
|
|
86
84
|
enabled_clients: (0, utils_1.mapClientID2NameSorted)(database.enabled_clients, context.assets.clientsOrig || []),
|
|
87
|
-
})
|
|
85
|
+
}),
|
|
86
|
+
options: {
|
|
87
|
+
...(database.options || {}),
|
|
88
|
+
// customScripts option only written if there are scripts
|
|
89
|
+
...(database.options?.customScripts && {
|
|
88
90
|
customScripts: Object.entries(database.options.customScripts)
|
|
89
91
|
// @ts-ignore because we'll fix this in subsequent PR
|
|
90
92
|
.sort(sortCustomScripts)
|
|
@@ -98,10 +100,11 @@ function dump(context) {
|
|
|
98
100
|
scripts[name] = `./${scriptName}`;
|
|
99
101
|
return scripts;
|
|
100
102
|
}, {}),
|
|
101
|
-
})
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
}),
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
const databaseFile = path_1.default.join(dbFolder, 'database.json');
|
|
107
|
+
(0, utils_1.dumpJSON)(databaseFile, formatted);
|
|
105
108
|
});
|
|
106
109
|
}
|
|
107
110
|
const databasesHandler = {
|
|
@@ -109,4 +112,3 @@ const databasesHandler = {
|
|
|
109
112
|
dump,
|
|
110
113
|
};
|
|
111
114
|
exports.default = databasesHandler;
|
|
112
|
-
//# sourceMappingURL=databases.js.map
|