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
|
@@ -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
|
};
|
|
@@ -17,87 +8,81 @@ const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
|
17
8
|
const tools_1 = require("../../../tools");
|
|
18
9
|
const logger_1 = __importDefault(require("../../../logger"));
|
|
19
10
|
const utils_1 = require("../../../utils");
|
|
20
|
-
function parse(context) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
clients
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
client.custom_login_page = context.loadFile(htmlFileName);
|
|
35
|
-
}
|
|
11
|
+
async function parse(context) {
|
|
12
|
+
// Load the HTML file for custom_login_page
|
|
13
|
+
const { clients } = context.assets;
|
|
14
|
+
const clientsFolder = path_1.default.join(context.basePath, tools_1.constants.CLIENTS_DIRECTORY);
|
|
15
|
+
if (!clients) {
|
|
16
|
+
return { clients: null };
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
clients: [
|
|
20
|
+
...clients.map((client) => {
|
|
21
|
+
if (client.custom_login_page) {
|
|
22
|
+
const htmlFileName = path_1.default.join(clientsFolder, client.custom_login_page);
|
|
23
|
+
if ((0, utils_1.isFile)(htmlFileName)) {
|
|
24
|
+
client.custom_login_page = context.loadFile(htmlFileName);
|
|
36
25
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
26
|
+
}
|
|
27
|
+
return client;
|
|
28
|
+
}),
|
|
29
|
+
],
|
|
30
|
+
};
|
|
42
31
|
}
|
|
43
|
-
function dump(context) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
return client;
|
|
70
|
-
});
|
|
71
|
-
return {
|
|
72
|
-
clients: [
|
|
73
|
-
...clients.map((client) => {
|
|
74
|
-
if (client.custom_login_page) {
|
|
75
|
-
const clientName = (0, utils_1.sanitize)(client.name);
|
|
76
|
-
const html = client.custom_login_page;
|
|
77
|
-
const customLoginHtml = path_1.default.join(clientsFolder, `${clientName}_custom_login_page.html`);
|
|
78
|
-
logger_1.default.info(`Writing ${customLoginHtml}`);
|
|
79
|
-
fs_extra_1.default.ensureDirSync(clientsFolder);
|
|
80
|
-
fs_extra_1.default.writeFileSync(customLoginHtml, html);
|
|
81
|
-
client.custom_login_page = `./${clientName}_custom_login_page.html`;
|
|
82
|
-
}
|
|
83
|
-
if (client.app_type === 'express_configuration') {
|
|
84
|
-
// only keep relevant fields for express configuration
|
|
85
|
-
client = {
|
|
86
|
-
name: client.name,
|
|
87
|
-
app_type: client.app_type,
|
|
88
|
-
client_authentication_methods: client.client_authentication_methods,
|
|
89
|
-
organization_require_behavior: client.organization_require_behavior,
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
return (0, utils_1.clearClientArrays)(client);
|
|
93
|
-
}),
|
|
94
|
-
],
|
|
95
|
-
};
|
|
32
|
+
async function dump(context) {
|
|
33
|
+
// Save custom_login_page to a separate html file
|
|
34
|
+
const clientsFolder = path_1.default.join(context.basePath, tools_1.constants.CLIENTS_DIRECTORY);
|
|
35
|
+
let { clients } = context.assets;
|
|
36
|
+
const { userAttributeProfiles, connectionProfiles } = context.assets;
|
|
37
|
+
if (!clients)
|
|
38
|
+
return { clients: null };
|
|
39
|
+
// map ids to names for user attribute profiles and connection profiles
|
|
40
|
+
clients = clients.map((client) => {
|
|
41
|
+
const userAttributeProfileId = client?.express_configuration?.user_attribute_profile_id;
|
|
42
|
+
if (client.express_configuration && userAttributeProfileId) {
|
|
43
|
+
const p = userAttributeProfiles?.find((uap) => uap.id === userAttributeProfileId);
|
|
44
|
+
client.express_configuration.user_attribute_profile_id = p?.name || userAttributeProfileId;
|
|
45
|
+
}
|
|
46
|
+
const connectionProfilesProfileId = client?.express_configuration?.connection_profile_id;
|
|
47
|
+
if (client.express_configuration && connectionProfilesProfileId) {
|
|
48
|
+
const c = connectionProfiles?.find((uap) => uap.id === connectionProfilesProfileId);
|
|
49
|
+
client.express_configuration.connection_profile_id = c?.name || connectionProfilesProfileId;
|
|
50
|
+
}
|
|
51
|
+
const oktaOinClientId = client?.express_configuration?.okta_oin_client_id;
|
|
52
|
+
if (client.express_configuration && oktaOinClientId) {
|
|
53
|
+
const o = clients?.find((uap) => uap.client_id === oktaOinClientId);
|
|
54
|
+
client.express_configuration.okta_oin_client_id = o?.name || oktaOinClientId;
|
|
55
|
+
}
|
|
56
|
+
return client;
|
|
96
57
|
});
|
|
58
|
+
return {
|
|
59
|
+
clients: [
|
|
60
|
+
...clients.map((client) => {
|
|
61
|
+
if (client.custom_login_page) {
|
|
62
|
+
const clientName = (0, utils_1.sanitize)(client.name);
|
|
63
|
+
const html = client.custom_login_page;
|
|
64
|
+
const customLoginHtml = path_1.default.join(clientsFolder, `${clientName}_custom_login_page.html`);
|
|
65
|
+
logger_1.default.info(`Writing ${customLoginHtml}`);
|
|
66
|
+
fs_extra_1.default.ensureDirSync(clientsFolder);
|
|
67
|
+
fs_extra_1.default.writeFileSync(customLoginHtml, html);
|
|
68
|
+
client.custom_login_page = `./${clientName}_custom_login_page.html`;
|
|
69
|
+
}
|
|
70
|
+
if (client.app_type === 'express_configuration') {
|
|
71
|
+
// only keep relevant fields for express configuration
|
|
72
|
+
client = {
|
|
73
|
+
name: client.name,
|
|
74
|
+
app_type: client.app_type,
|
|
75
|
+
client_authentication_methods: client.client_authentication_methods,
|
|
76
|
+
organization_require_behavior: client.organization_require_behavior,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
return (0, utils_1.clearClientArrays)(client);
|
|
80
|
+
}),
|
|
81
|
+
],
|
|
82
|
+
};
|
|
97
83
|
}
|
|
98
84
|
const clientsHandler = {
|
|
99
85
|
parse,
|
|
100
86
|
dump,
|
|
101
87
|
};
|
|
102
88
|
exports.default = clientsHandler;
|
|
103
|
-
//# sourceMappingURL=clients.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ConnectionProfile } from 'auth0';
|
|
2
1
|
import YAMLContext from '..';
|
|
2
|
+
import { ConnectionProfile } from '../../../tools/auth0/handlers/connectionProfiles';
|
|
3
3
|
import { ParsedAsset } from '../../../types';
|
|
4
4
|
type ParsedConnectionProfiles = ParsedAsset<'connectionProfiles', Partial<ConnectionProfile>[]>;
|
|
5
5
|
declare function parse(context: YAMLContext): Promise<ParsedConnectionProfiles>;
|
|
@@ -1,44 +1,30 @@
|
|
|
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
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
function parse(context) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
});
|
|
3
|
+
async function parse(context) {
|
|
4
|
+
const { connectionProfiles } = context.assets;
|
|
5
|
+
if (!connectionProfiles)
|
|
6
|
+
return { connectionProfiles: null };
|
|
7
|
+
return {
|
|
8
|
+
connectionProfiles,
|
|
9
|
+
};
|
|
21
10
|
}
|
|
22
|
-
function dump(context) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return profile;
|
|
33
|
-
});
|
|
34
|
-
return {
|
|
35
|
-
connectionProfiles,
|
|
36
|
-
};
|
|
11
|
+
async function dump(context) {
|
|
12
|
+
let { connectionProfiles } = context.assets;
|
|
13
|
+
if (!connectionProfiles)
|
|
14
|
+
return { connectionProfiles: null };
|
|
15
|
+
connectionProfiles = connectionProfiles.map((profile) => {
|
|
16
|
+
// Remove read-only fields
|
|
17
|
+
if ('id' in profile) {
|
|
18
|
+
delete profile.id;
|
|
19
|
+
}
|
|
20
|
+
return profile;
|
|
37
21
|
});
|
|
22
|
+
return {
|
|
23
|
+
connectionProfiles,
|
|
24
|
+
};
|
|
38
25
|
}
|
|
39
26
|
const connectionProfilesHandler = {
|
|
40
27
|
parse,
|
|
41
28
|
dump,
|
|
42
29
|
};
|
|
43
30
|
exports.default = connectionProfilesHandler;
|
|
44
|
-
//# sourceMappingURL=connectionProfiles.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,81 +9,86 @@ const tools_1 = require("../../../tools");
|
|
|
18
9
|
const logger_1 = __importDefault(require("../../../logger"));
|
|
19
10
|
const utils_1 = require("../../../utils");
|
|
20
11
|
const defaults_1 = require("../../defaults");
|
|
21
|
-
function parse(context) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
connections
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
throw new Error(missingTemplateErrorMessage);
|
|
38
|
-
}
|
|
39
|
-
connection.options.email.body = context.loadFile(htmlFileName);
|
|
12
|
+
async function parse(context) {
|
|
13
|
+
const { connections } = context.assets;
|
|
14
|
+
const connectionsFolder = path_1.default.join(context.basePath, tools_1.constants.CONNECTIONS_DIRECTORY);
|
|
15
|
+
if (!connections) {
|
|
16
|
+
return { connections: null };
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
connections: [
|
|
20
|
+
...connections.map((connection) => {
|
|
21
|
+
if (connection.strategy === 'email') {
|
|
22
|
+
(0, utils_1.ensureProp)(connection, 'options.email.body');
|
|
23
|
+
const htmlFileName = path_1.default.join(connectionsFolder, connection.options.email.body);
|
|
24
|
+
if (!(0, utils_1.isFile)(htmlFileName)) {
|
|
25
|
+
const missingTemplateErrorMessage = `Passwordless email template purportedly located at ${htmlFileName} does not exist for connection. Ensure the existence of this file to proceed with deployment.`;
|
|
26
|
+
logger_1.default.error(missingTemplateErrorMessage);
|
|
27
|
+
throw new Error(missingTemplateErrorMessage);
|
|
40
28
|
}
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
29
|
+
connection.options.email.body = context.loadFile(htmlFileName);
|
|
30
|
+
}
|
|
31
|
+
return connection;
|
|
32
|
+
}),
|
|
33
|
+
],
|
|
34
|
+
};
|
|
46
35
|
}
|
|
47
36
|
const getFormattedOptions = (connection, clients) => {
|
|
48
37
|
try {
|
|
49
38
|
return {
|
|
50
|
-
options:
|
|
39
|
+
options: {
|
|
40
|
+
...connection.options,
|
|
41
|
+
idpinitiated: {
|
|
42
|
+
...connection.options.idpinitiated,
|
|
43
|
+
client_id: (0, utils_1.convertClientIdToName)(connection.options.idpinitiated.client_id, clients),
|
|
44
|
+
},
|
|
45
|
+
},
|
|
51
46
|
};
|
|
52
47
|
}
|
|
53
48
|
catch (e) {
|
|
54
49
|
return {};
|
|
55
50
|
}
|
|
56
51
|
};
|
|
57
|
-
function dump(context) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
52
|
+
async function dump(context) {
|
|
53
|
+
const { connections, clients } = context.assets;
|
|
54
|
+
if (!connections)
|
|
55
|
+
return { connections: null };
|
|
56
|
+
return {
|
|
57
|
+
connections: connections.map((connection) => {
|
|
58
|
+
let dumpedConnection = {
|
|
59
|
+
...connection,
|
|
60
|
+
...getFormattedOptions(connection, clients),
|
|
61
|
+
...(connection.enabled_clients && {
|
|
65
62
|
enabled_clients: (0, utils_1.mapClientID2NameSorted)(connection.enabled_clients, clients || []),
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
63
|
+
}),
|
|
64
|
+
};
|
|
65
|
+
// Mask secrets
|
|
66
|
+
dumpedConnection = (0, defaults_1.connectionDefaults)(dumpedConnection);
|
|
67
|
+
if (dumpedConnection.strategy === 'email') {
|
|
68
|
+
(0, utils_1.ensureProp)(connection, 'options.email.body');
|
|
69
|
+
const connectionsFolder = path_1.default.join(context.basePath, tools_1.constants.CONNECTIONS_DIRECTORY);
|
|
70
|
+
const connectionName = (0, utils_1.sanitize)(dumpedConnection.name);
|
|
71
|
+
const html = dumpedConnection.options.email.body;
|
|
72
|
+
const emailConnectionHtml = path_1.default.join(connectionsFolder, `${connectionName}.html`);
|
|
73
|
+
logger_1.default.info(`Writing ${emailConnectionHtml}`);
|
|
74
|
+
fs_extra_1.default.ensureDirSync(connectionsFolder);
|
|
75
|
+
fs_extra_1.default.writeFileSync(emailConnectionHtml, html);
|
|
76
|
+
dumpedConnection.options.email.body = `./${connectionName}.html`;
|
|
77
|
+
}
|
|
78
|
+
if (dumpedConnection.strategy === 'samlp' && dumpedConnection.options) {
|
|
79
|
+
if ('cert' in dumpedConnection.options) {
|
|
80
|
+
dumpedConnection.options.cert = (0, utils_1.encodeCertStringToBase64)(dumpedConnection.options.cert);
|
|
79
81
|
}
|
|
80
|
-
if (
|
|
81
|
-
|
|
82
|
-
dumpedConnection.options.cert = (0, utils_1.encodeCertStringToBase64)(dumpedConnection.options.cert);
|
|
83
|
-
}
|
|
84
|
-
if ('signingCert' in dumpedConnection.options) {
|
|
85
|
-
dumpedConnection.options.signingCert = (0, utils_1.encodeCertStringToBase64)(dumpedConnection.options.signingCert);
|
|
86
|
-
}
|
|
82
|
+
if ('signingCert' in dumpedConnection.options) {
|
|
83
|
+
dumpedConnection.options.signingCert = (0, utils_1.encodeCertStringToBase64)(dumpedConnection.options.signingCert);
|
|
87
84
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
}
|
|
85
|
+
}
|
|
86
|
+
return dumpedConnection;
|
|
87
|
+
}),
|
|
88
|
+
};
|
|
92
89
|
}
|
|
93
90
|
const connectionsHandler = {
|
|
94
91
|
parse,
|
|
95
92
|
dump,
|
|
96
93
|
};
|
|
97
94
|
exports.default = connectionsHandler;
|
|
98
|
-
//# sourceMappingURL=connections.js.map
|
|
@@ -1,27 +1,15 @@
|
|
|
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
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
function parseAndDump(context) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
});
|
|
3
|
+
async function parseAndDump(context) {
|
|
4
|
+
const { customDomains } = context.assets;
|
|
5
|
+
if (!customDomains)
|
|
6
|
+
return { customDomains: null };
|
|
7
|
+
return {
|
|
8
|
+
customDomains,
|
|
9
|
+
};
|
|
21
10
|
}
|
|
22
11
|
const customDomainsHandler = {
|
|
23
12
|
parse: parseAndDump,
|
|
24
13
|
dump: parseAndDump,
|
|
25
14
|
};
|
|
26
15
|
exports.default = customDomainsHandler;
|
|
27
|
-
//# 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
|
};
|
|
@@ -16,67 +7,74 @@ const path_1 = __importDefault(require("path"));
|
|
|
16
7
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
17
8
|
const utils_1 = require("../../../utils");
|
|
18
9
|
const logger_1 = __importDefault(require("../../../logger"));
|
|
19
|
-
function parse(context) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
databases
|
|
27
|
-
...
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
10
|
+
async function parse(context) {
|
|
11
|
+
// Load the script file for custom db
|
|
12
|
+
const { databases } = context.assets;
|
|
13
|
+
if (!databases)
|
|
14
|
+
return { databases: null };
|
|
15
|
+
return {
|
|
16
|
+
databases: [
|
|
17
|
+
...databases.map((database) => ({
|
|
18
|
+
...database,
|
|
19
|
+
options: {
|
|
20
|
+
...(database.options || {}),
|
|
21
|
+
// customScripts option only written if there are scripts
|
|
22
|
+
...(database.options?.customScripts && {
|
|
23
|
+
customScripts: Object.entries(database.options.customScripts).reduce((scripts, [name, script]) => ({
|
|
24
|
+
...scripts,
|
|
25
|
+
[name]: context.loadFile(script),
|
|
26
|
+
}), {}),
|
|
27
|
+
}),
|
|
28
|
+
},
|
|
29
|
+
})),
|
|
30
|
+
],
|
|
31
|
+
};
|
|
36
32
|
}
|
|
37
|
-
function dump(context) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
databases
|
|
49
|
-
...
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
enabled_clients: (0, utils_1.mapClientID2NameSorted)(database.enabled_clients, clients || []),
|
|
53
|
-
})), { options: Object.assign(Object.assign({}, (database.options || {})), (((_a = database.options) === null || _a === void 0 ? void 0 : _a.customScripts) && {
|
|
54
|
-
customScripts: Object.entries(database.options.customScripts)
|
|
55
|
-
//@ts-ignore because we'll fix this in subsequent PR
|
|
56
|
-
.sort(sortCustomScripts)
|
|
57
|
-
.reduce((scripts, [name, script]) => {
|
|
58
|
-
// Create Database folder
|
|
59
|
-
const dbName = (0, utils_1.sanitize)(database.name);
|
|
60
|
-
const dbFolder = path_1.default.join(context.basePath, 'databases', (0, utils_1.sanitize)(dbName));
|
|
61
|
-
fs_extra_1.default.ensureDirSync(dbFolder);
|
|
62
|
-
// Dump custom script to file
|
|
63
|
-
const scriptName = (0, utils_1.sanitize)(name);
|
|
64
|
-
const scriptFile = path_1.default.join(dbFolder, `${scriptName}.js`);
|
|
65
|
-
logger_1.default.info(`Writing ${scriptFile}`);
|
|
66
|
-
//@ts-ignore because we'll fix this in subsequent PR
|
|
67
|
-
fs_extra_1.default.writeFileSync(scriptFile, script);
|
|
68
|
-
scripts[name] = `./databases/${dbName}/${scriptName}.js`;
|
|
69
|
-
return scripts;
|
|
70
|
-
}, {}),
|
|
71
|
-
})) }));
|
|
33
|
+
async function dump(context) {
|
|
34
|
+
const { databases, clients } = context.assets;
|
|
35
|
+
if (!databases)
|
|
36
|
+
return { databases: null };
|
|
37
|
+
const sortCustomScripts = ([name1], [name2]) => {
|
|
38
|
+
if (name1 === name2)
|
|
39
|
+
return 0;
|
|
40
|
+
return name1 > name2 ? 1 : -1;
|
|
41
|
+
};
|
|
42
|
+
return {
|
|
43
|
+
databases: [
|
|
44
|
+
...databases.map((database) => ({
|
|
45
|
+
...database,
|
|
46
|
+
...(database.enabled_clients && {
|
|
47
|
+
enabled_clients: (0, utils_1.mapClientID2NameSorted)(database.enabled_clients, clients || []),
|
|
72
48
|
}),
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
49
|
+
options: {
|
|
50
|
+
...(database.options || {}),
|
|
51
|
+
// customScripts option only written if there are scripts
|
|
52
|
+
...(database.options?.customScripts && {
|
|
53
|
+
customScripts: Object.entries(database.options.customScripts)
|
|
54
|
+
//@ts-ignore because we'll fix this in subsequent PR
|
|
55
|
+
.sort(sortCustomScripts)
|
|
56
|
+
.reduce((scripts, [name, script]) => {
|
|
57
|
+
// Create Database folder
|
|
58
|
+
const dbName = (0, utils_1.sanitize)(database.name);
|
|
59
|
+
const dbFolder = path_1.default.join(context.basePath, 'databases', (0, utils_1.sanitize)(dbName));
|
|
60
|
+
fs_extra_1.default.ensureDirSync(dbFolder);
|
|
61
|
+
// Dump custom script to file
|
|
62
|
+
const scriptName = (0, utils_1.sanitize)(name);
|
|
63
|
+
const scriptFile = path_1.default.join(dbFolder, `${scriptName}.js`);
|
|
64
|
+
logger_1.default.info(`Writing ${scriptFile}`);
|
|
65
|
+
//@ts-ignore because we'll fix this in subsequent PR
|
|
66
|
+
fs_extra_1.default.writeFileSync(scriptFile, script);
|
|
67
|
+
scripts[name] = `./databases/${dbName}/${scriptName}.js`;
|
|
68
|
+
return scripts;
|
|
69
|
+
}, {}),
|
|
70
|
+
}),
|
|
71
|
+
},
|
|
72
|
+
})),
|
|
73
|
+
],
|
|
74
|
+
};
|
|
76
75
|
}
|
|
77
76
|
const databasesHandler = {
|
|
78
77
|
parse,
|
|
79
78
|
dump,
|
|
80
79
|
};
|
|
81
80
|
exports.default = databasesHandler;
|
|
82
|
-
//# sourceMappingURL=databases.js.map
|