auth0-deploy-cli 7.10.0 → 7.12.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/CHANGELOG.md +34 -1
- package/lib/context/directory/handlers/actions.d.ts +2 -3
- package/lib/context/directory/handlers/actions.js +4 -4
- package/lib/context/directory/handlers/attackProtection.d.ts +6 -7
- package/lib/context/directory/handlers/attackProtection.js +3 -1
- package/lib/context/directory/handlers/branding.d.ts +2 -3
- package/lib/context/directory/handlers/branding.js +8 -18
- package/lib/context/directory/handlers/clientGrants.d.ts +2 -3
- package/lib/context/directory/handlers/clientGrants.js +3 -2
- package/lib/context/directory/handlers/clients.d.ts +2 -3
- package/lib/context/directory/handlers/clients.js +1 -1
- package/lib/context/directory/handlers/connections.d.ts +2 -3
- package/lib/context/directory/handlers/connections.js +3 -3
- package/lib/context/directory/handlers/customDomains.d.ts +5 -0
- package/lib/context/directory/handlers/customDomains.js +46 -0
- package/lib/context/directory/handlers/databases.d.ts +2 -3
- package/lib/context/directory/handlers/databases.js +2 -2
- package/lib/context/directory/handlers/emailProvider.d.ts +2 -3
- package/lib/context/directory/handlers/emailProvider.js +12 -10
- package/lib/context/directory/handlers/emailTemplates.d.ts +2 -3
- package/lib/context/directory/handlers/emailTemplates.js +2 -2
- package/lib/context/directory/handlers/guardianFactorProviders.d.ts +2 -3
- package/lib/context/directory/handlers/guardianFactorProviders.js +1 -1
- package/lib/context/directory/handlers/guardianFactorTemplates.d.ts +2 -3
- package/lib/context/directory/handlers/guardianFactorTemplates.js +1 -1
- package/lib/context/directory/handlers/guardianFactors.d.ts +2 -3
- package/lib/context/directory/handlers/guardianFactors.js +1 -1
- package/lib/context/directory/handlers/guardianPhoneFactorMessageTypes.d.ts +2 -3
- package/lib/context/directory/handlers/guardianPhoneFactorMessageTypes.js +6 -6
- package/lib/context/directory/handlers/guardianPhoneFactorSelectedProvider.d.ts +2 -3
- package/lib/context/directory/handlers/guardianPhoneFactorSelectedProvider.js +6 -6
- package/lib/context/directory/handlers/guardianPolicies.d.ts +2 -3
- package/lib/context/directory/handlers/guardianPolicies.js +6 -6
- package/lib/context/directory/handlers/hooks.d.ts +2 -3
- package/lib/context/directory/handlers/hooks.js +3 -3
- package/lib/context/directory/handlers/index.d.ts +2 -2
- package/lib/context/directory/handlers/index.js +4 -0
- package/lib/context/directory/handlers/logStreams.d.ts +2 -4
- package/lib/context/directory/handlers/logStreams.js +2 -2
- package/lib/context/directory/handlers/migrations.d.ts +2 -3
- package/lib/context/directory/handlers/migrations.js +2 -2
- package/lib/context/directory/handlers/organizations.d.ts +2 -3
- package/lib/context/directory/handlers/organizations.js +1 -1
- package/lib/context/directory/handlers/pages.d.ts +2 -3
- package/lib/context/directory/handlers/pages.js +2 -2
- package/lib/context/directory/handlers/prompts.d.ts +6 -0
- package/lib/context/directory/handlers/prompts.js +81 -0
- package/lib/context/directory/handlers/resourceServers.d.ts +2 -3
- package/lib/context/directory/handlers/resourceServers.js +1 -1
- package/lib/context/directory/handlers/roles.d.ts +2 -3
- package/lib/context/directory/handlers/roles.js +1 -1
- package/lib/context/directory/handlers/rules.d.ts +2 -3
- package/lib/context/directory/handlers/rules.js +2 -2
- package/lib/context/directory/handlers/rulesConfigs.d.ts +2 -3
- package/lib/context/directory/handlers/rulesConfigs.js +1 -1
- package/lib/context/directory/handlers/tenant.d.ts +7 -7
- package/lib/context/directory/handlers/tenant.js +11 -10
- package/lib/context/directory/handlers/triggers.d.ts +2 -3
- package/lib/context/directory/handlers/triggers.js +1 -1
- package/lib/context/yaml/handlers/actions.d.ts +2 -3
- package/lib/context/yaml/handlers/actions.js +6 -8
- package/lib/context/yaml/handlers/attackProtection.d.ts +6 -3
- package/lib/context/yaml/handlers/attackProtection.js +9 -1
- package/lib/context/yaml/handlers/branding.d.ts +6 -6
- package/lib/context/yaml/handlers/branding.js +11 -6
- package/lib/context/yaml/handlers/clientGrants.d.ts +2 -3
- package/lib/context/yaml/handlers/clientGrants.js +7 -6
- package/lib/context/yaml/handlers/clients.d.ts +2 -3
- package/lib/context/yaml/handlers/clients.js +6 -3
- package/lib/context/yaml/handlers/connections.d.ts +2 -3
- package/lib/context/yaml/handlers/connections.js +6 -9
- package/lib/context/yaml/handlers/customDomains.d.ts +5 -0
- package/lib/context/yaml/handlers/customDomains.js +26 -0
- package/lib/context/yaml/handlers/databases.d.ts +3 -4
- package/lib/context/yaml/handlers/databases.js +7 -7
- package/lib/context/yaml/handlers/emailProvider.d.ts +2 -3
- package/lib/context/yaml/handlers/emailProvider.js +17 -10
- package/lib/context/yaml/handlers/emailTemplates.d.ts +2 -3
- package/lib/context/yaml/handlers/emailTemplates.js +16 -13
- package/lib/context/yaml/handlers/guardianFactorProviders.d.ts +2 -3
- package/lib/context/yaml/handlers/guardianFactorProviders.js +4 -2
- package/lib/context/yaml/handlers/guardianFactorTemplates.d.ts +2 -3
- package/lib/context/yaml/handlers/guardianFactorTemplates.js +4 -2
- package/lib/context/yaml/handlers/guardianFactors.d.ts +2 -3
- package/lib/context/yaml/handlers/guardianFactors.js +4 -2
- package/lib/context/yaml/handlers/guardianPhoneFactorMessageTypes.d.ts +2 -3
- package/lib/context/yaml/handlers/guardianPhoneFactorMessageTypes.js +4 -2
- package/lib/context/yaml/handlers/guardianPhoneFactorSelectedProvider.d.ts +2 -3
- package/lib/context/yaml/handlers/guardianPhoneFactorSelectedProvider.js +4 -2
- package/lib/context/yaml/handlers/guardianPolicies.d.ts +4 -3
- package/lib/context/yaml/handlers/guardianPolicies.js +4 -2
- package/lib/context/yaml/handlers/hooks.d.ts +2 -3
- package/lib/context/yaml/handlers/hooks.js +20 -19
- package/lib/context/yaml/handlers/index.d.ts +1 -1
- package/lib/context/yaml/handlers/index.js +4 -0
- package/lib/context/yaml/handlers/logStreams.d.ts +2 -4
- package/lib/context/yaml/handlers/logStreams.js +4 -1
- package/lib/context/yaml/handlers/migrations.d.ts +2 -3
- package/lib/context/yaml/handlers/migrations.js +5 -9
- package/lib/context/yaml/handlers/organizations.d.ts +2 -1
- package/lib/context/yaml/handlers/organizations.js +17 -15
- package/lib/context/yaml/handlers/pages.d.ts +2 -3
- package/lib/context/yaml/handlers/pages.js +20 -18
- package/lib/context/yaml/handlers/prompts.d.ts +6 -0
- package/lib/context/yaml/handlers/prompts.js +26 -0
- package/lib/context/yaml/handlers/resourceServers.d.ts +2 -3
- package/lib/context/yaml/handlers/resourceServers.js +8 -13
- package/lib/context/yaml/handlers/roles.d.ts +2 -3
- package/lib/context/yaml/handlers/roles.js +13 -11
- package/lib/context/yaml/handlers/rules.d.ts +2 -3
- package/lib/context/yaml/handlers/rules.js +18 -17
- package/lib/context/yaml/handlers/rulesConfigs.d.ts +2 -3
- package/lib/context/yaml/handlers/rulesConfigs.js +9 -5
- package/lib/context/yaml/handlers/tenant.d.ts +2 -3
- package/lib/context/yaml/handlers/tenant.js +4 -3
- package/lib/context/yaml/handlers/triggers.d.ts +2 -3
- package/lib/context/yaml/handlers/triggers.js +2 -2
- package/lib/context/yaml/index.js +2 -1
- package/lib/index.d.ts +2 -0
- package/lib/tools/auth0/handlers/actions.js +23 -7
- package/lib/tools/auth0/handlers/branding.d.ts +2 -2
- package/lib/tools/auth0/handlers/clientGrants.js +1 -1
- package/lib/tools/auth0/handlers/connections.js +1 -1
- package/lib/tools/auth0/handlers/customDomains.d.ts +43 -0
- package/lib/tools/auth0/handlers/customDomains.js +85 -0
- package/lib/tools/auth0/handlers/default.js +9 -2
- package/lib/tools/auth0/handlers/index.d.ts +34 -24
- package/lib/tools/auth0/handlers/index.js +2 -0
- package/lib/tools/auth0/handlers/prompts.d.ts +41 -3
- package/lib/tools/auth0/handlers/prompts.js +139 -19
- package/lib/tools/auth0/handlers/rules.js +2 -2
- package/lib/tools/auth0/index.js +5 -2
- package/lib/tools/constants.d.ts +2 -0
- package/lib/tools/constants.js +2 -0
- package/lib/tools/index.d.ts +2 -0
- package/lib/tools/utils.d.ts +9 -0
- package/lib/tools/utils.js +33 -1
- package/lib/types.d.ts +60 -37
- package/lib/types.js +46 -0
- package/lib/utils.d.ts +82 -29
- package/lib/utils.js +1 -1
- package/package.json +7 -4
|
@@ -18,33 +18,35 @@ const logger_1 = __importDefault(require("../../../logger"));
|
|
|
18
18
|
function parse(context) {
|
|
19
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20
20
|
// Load the HTML file for each page
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
const { pages } = context.assets;
|
|
22
|
+
if (!pages)
|
|
23
|
+
return { pages: null };
|
|
23
24
|
return {
|
|
24
25
|
pages: [
|
|
25
|
-
...
|
|
26
|
+
...pages.map((page) => (Object.assign(Object.assign({}, page), { html: page.html ? context.loadFile(page.html) : '' }))),
|
|
26
27
|
],
|
|
27
28
|
};
|
|
28
29
|
});
|
|
29
30
|
}
|
|
30
31
|
function dump(context) {
|
|
31
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
-
let pages =
|
|
33
|
-
if (pages
|
|
34
|
-
|
|
35
|
-
const pagesFolder = path_1.default.join(context.basePath, 'pages');
|
|
36
|
-
fs_extra_1.default.ensureDirSync(pagesFolder);
|
|
37
|
-
pages = pages.map((page) => {
|
|
38
|
-
if (page.name === 'error_page' && page.html === undefined) {
|
|
39
|
-
return page;
|
|
40
|
-
}
|
|
41
|
-
// Dump html to file
|
|
42
|
-
const htmlFile = path_1.default.join(pagesFolder, `${page.name}.html`);
|
|
43
|
-
logger_1.default.info(`Writing ${htmlFile}`);
|
|
44
|
-
fs_extra_1.default.writeFileSync(htmlFile, page.html);
|
|
45
|
-
return Object.assign(Object.assign({}, page), { html: `./pages/${page.name}.html` });
|
|
46
|
-
});
|
|
33
|
+
let pages = context.assets.pages;
|
|
34
|
+
if (!pages) {
|
|
35
|
+
return { pages: null };
|
|
47
36
|
}
|
|
37
|
+
// Create Pages folder
|
|
38
|
+
const pagesFolder = path_1.default.join(context.basePath, 'pages');
|
|
39
|
+
fs_extra_1.default.ensureDirSync(pagesFolder);
|
|
40
|
+
pages = pages.map((page) => {
|
|
41
|
+
if (page.name === 'error_page' && page.html === undefined) {
|
|
42
|
+
return page;
|
|
43
|
+
}
|
|
44
|
+
// Dump html to file
|
|
45
|
+
const htmlFile = path_1.default.join(pagesFolder, `${page.name}.html`);
|
|
46
|
+
logger_1.default.info(`Writing ${htmlFile}`);
|
|
47
|
+
fs_extra_1.default.writeFileSync(htmlFile, page.html);
|
|
48
|
+
return Object.assign(Object.assign({}, page), { html: `./pages/${page.name}.html` });
|
|
49
|
+
});
|
|
48
50
|
return { pages };
|
|
49
51
|
});
|
|
50
52
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { YAMLHandler } from '.';
|
|
2
|
+
import { ParsedAsset } from '../../../types';
|
|
3
|
+
import { Prompts } from '../../../tools/auth0/handlers/prompts';
|
|
4
|
+
declare type ParsedPrompts = ParsedAsset<'prompts', Prompts>;
|
|
5
|
+
declare const promptsHandler: YAMLHandler<ParsedPrompts>;
|
|
6
|
+
export default promptsHandler;
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
function parseAndDump(context) {
|
|
13
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
const { prompts } = context.assets;
|
|
15
|
+
if (!prompts)
|
|
16
|
+
return { prompts: null };
|
|
17
|
+
return {
|
|
18
|
+
prompts,
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
const promptsHandler = {
|
|
23
|
+
parse: parseAndDump,
|
|
24
|
+
dump: parseAndDump,
|
|
25
|
+
};
|
|
26
|
+
exports.default = promptsHandler;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { YAMLHandler } from '.';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
2
|
+
import { Asset, ParsedAsset } from '../../../types';
|
|
3
|
+
declare type ParsedResourceServers = ParsedAsset<'resourceServers', Asset[]>;
|
|
5
4
|
declare const resourceServersHandler: YAMLHandler<ParsedResourceServers>;
|
|
6
5
|
export default resourceServersHandler;
|
|
@@ -9,24 +9,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
function
|
|
12
|
+
function dumpAndParse(context) {
|
|
13
13
|
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
-
|
|
14
|
+
const { resourceServers } = context.assets;
|
|
15
|
+
if (!resourceServers) {
|
|
16
|
+
return { resourceServers: null };
|
|
17
|
+
}
|
|
15
18
|
return {
|
|
16
|
-
resourceServers
|
|
17
|
-
};
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
function dump(context) {
|
|
21
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
// nothing to do, set default if empty
|
|
23
|
-
return {
|
|
24
|
-
resourceServers: [...(context.assets.resourceServers || [])],
|
|
19
|
+
resourceServers,
|
|
25
20
|
};
|
|
26
21
|
});
|
|
27
22
|
}
|
|
28
23
|
const resourceServersHandler = {
|
|
29
|
-
parse,
|
|
30
|
-
dump,
|
|
24
|
+
parse: dumpAndParse,
|
|
25
|
+
dump: dumpAndParse,
|
|
31
26
|
};
|
|
32
27
|
exports.default = resourceServersHandler;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { YAMLHandler } from '.';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
2
|
+
import { Asset, ParsedAsset } from '../../../types';
|
|
3
|
+
declare type ParsedRoles = ParsedAsset<'roles', Asset[]>;
|
|
5
4
|
declare const rolesHandler: YAMLHandler<ParsedRoles>;
|
|
6
5
|
export default rolesHandler;
|
|
@@ -11,24 +11,26 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
function parse(context) {
|
|
13
13
|
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
-
|
|
14
|
+
const { roles } = context.assets;
|
|
15
|
+
if (!roles)
|
|
16
|
+
return { roles: null };
|
|
15
17
|
return {
|
|
16
|
-
roles
|
|
18
|
+
roles,
|
|
17
19
|
};
|
|
18
20
|
});
|
|
19
21
|
}
|
|
20
22
|
function dump(context) {
|
|
21
23
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
|
|
24
|
+
const { roles } = context.assets;
|
|
25
|
+
if (!roles)
|
|
26
|
+
return { roles: null };
|
|
23
27
|
return {
|
|
24
|
-
roles:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}),
|
|
31
|
-
],
|
|
28
|
+
roles: roles.map((role) => {
|
|
29
|
+
if (role.description === null) {
|
|
30
|
+
delete role.description;
|
|
31
|
+
}
|
|
32
|
+
return role;
|
|
33
|
+
}),
|
|
32
34
|
};
|
|
33
35
|
});
|
|
34
36
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { YAMLHandler } from '.';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} | {};
|
|
2
|
+
import { Asset, ParsedAsset } from '../../../types';
|
|
3
|
+
declare type ParsedRules = ParsedAsset<'rules', Asset[]>;
|
|
5
4
|
declare const rulesHandler: YAMLHandler<ParsedRules>;
|
|
6
5
|
export default rulesHandler;
|
|
@@ -18,32 +18,33 @@ const utils_1 = require("../../../utils");
|
|
|
18
18
|
const logger_1 = __importDefault(require("../../../logger"));
|
|
19
19
|
function parse(context) {
|
|
20
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
|
|
22
|
-
if (!
|
|
23
|
-
return {};
|
|
21
|
+
const { rules } = context.assets;
|
|
22
|
+
if (!rules)
|
|
23
|
+
return { rules: null };
|
|
24
24
|
return {
|
|
25
25
|
rules: [
|
|
26
|
-
...
|
|
26
|
+
...rules.map((rule) => (Object.assign(Object.assign({}, rule), { script: context.loadFile(rule.script) }))),
|
|
27
27
|
],
|
|
28
28
|
};
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
function dump(context) {
|
|
32
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
let rules =
|
|
34
|
-
if (rules
|
|
35
|
-
|
|
36
|
-
const rulesFolder = path_1.default.join(context.basePath, 'rules');
|
|
37
|
-
fs_extra_1.default.ensureDirSync(rulesFolder);
|
|
38
|
-
rules = rules.map((rule) => {
|
|
39
|
-
// Dump rule to file
|
|
40
|
-
const scriptName = (0, utils_1.sanitize)(`${rule.name}.js`);
|
|
41
|
-
const scriptFile = path_1.default.join(rulesFolder, scriptName);
|
|
42
|
-
logger_1.default.info(`Writing ${scriptFile}`);
|
|
43
|
-
fs_extra_1.default.writeFileSync(scriptFile, rule.script);
|
|
44
|
-
return Object.assign(Object.assign({}, rule), { script: `./rules/${scriptName}` });
|
|
45
|
-
});
|
|
33
|
+
let { rules } = context.assets;
|
|
34
|
+
if (!rules) {
|
|
35
|
+
return { rules: null };
|
|
46
36
|
}
|
|
37
|
+
// Create Rules folder
|
|
38
|
+
const rulesFolder = path_1.default.join(context.basePath, 'rules');
|
|
39
|
+
fs_extra_1.default.ensureDirSync(rulesFolder);
|
|
40
|
+
rules = rules.map((rule) => {
|
|
41
|
+
// Dump rule to file
|
|
42
|
+
const scriptName = (0, utils_1.sanitize)(`${rule.name}.js`);
|
|
43
|
+
const scriptFile = path_1.default.join(rulesFolder, scriptName);
|
|
44
|
+
logger_1.default.info(`Writing ${scriptFile}`);
|
|
45
|
+
fs_extra_1.default.writeFileSync(scriptFile, rule.script);
|
|
46
|
+
return Object.assign(Object.assign({}, rule), { script: `./rules/${scriptName}` });
|
|
47
|
+
});
|
|
47
48
|
return { rules };
|
|
48
49
|
});
|
|
49
50
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { YAMLHandler } from '.';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} | {};
|
|
2
|
+
import { Asset, ParsedAsset } from '../../../types';
|
|
3
|
+
declare type ParsedRulesConfigs = ParsedAsset<'rulesConfigs', Asset[]>;
|
|
5
4
|
declare const rulesConfigsHandler: YAMLHandler<ParsedRulesConfigs>;
|
|
6
5
|
export default rulesConfigsHandler;
|
|
@@ -11,17 +11,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
function parse(context) {
|
|
13
13
|
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
-
|
|
14
|
+
const { rulesConfigs } = context.assets;
|
|
15
|
+
if (!rulesConfigs)
|
|
16
|
+
return { rulesConfigs: null };
|
|
15
17
|
return {
|
|
16
|
-
rulesConfigs
|
|
18
|
+
rulesConfigs,
|
|
17
19
|
};
|
|
18
20
|
});
|
|
19
21
|
}
|
|
20
|
-
function dump(
|
|
22
|
+
function dump(context) {
|
|
21
23
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
|
|
24
|
+
const { rulesConfigs } = context.assets;
|
|
25
|
+
if (!rulesConfigs)
|
|
26
|
+
return { rulesConfigs: null };
|
|
23
27
|
return {
|
|
24
|
-
rulesConfigs: [],
|
|
28
|
+
rulesConfigs: [], // even if they exist, do not export rulesConfigs as its values cannot be extracted
|
|
25
29
|
};
|
|
26
30
|
});
|
|
27
31
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { YAMLHandler } from '.';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} | {};
|
|
2
|
+
import { Asset, ParsedAsset } from '../../../types';
|
|
3
|
+
declare type ParsedTenant = ParsedAsset<'tenant', Asset>;
|
|
5
4
|
declare const tenantHandler: YAMLHandler<ParsedTenant>;
|
|
6
5
|
export default tenantHandler;
|
|
@@ -24,9 +24,8 @@ const utils_1 = require("../../../utils");
|
|
|
24
24
|
const sessionDurationsToMinutes_1 = require("../../../sessionDurationsToMinutes");
|
|
25
25
|
function parse(context) {
|
|
26
26
|
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
-
// Nothing to do
|
|
28
27
|
if (!context.assets.tenant)
|
|
29
|
-
return {};
|
|
28
|
+
return { tenant: null };
|
|
30
29
|
/* eslint-disable camelcase */
|
|
31
30
|
const _a = context.assets.tenant, { session_lifetime, idle_session_lifetime } = _a, tenant = __rest(_a, ["session_lifetime", "idle_session_lifetime"]);
|
|
32
31
|
(0, utils_1.clearTenantFlags)(tenant);
|
|
@@ -38,7 +37,9 @@ function parse(context) {
|
|
|
38
37
|
}
|
|
39
38
|
function dump(context) {
|
|
40
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
const tenant =
|
|
40
|
+
const tenant = context.assets.tenant;
|
|
41
|
+
if (!tenant)
|
|
42
|
+
return { tenant: null };
|
|
42
43
|
(0, utils_1.clearTenantFlags)(tenant);
|
|
43
44
|
return { tenant };
|
|
44
45
|
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { YAMLHandler } from '.';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} | {};
|
|
2
|
+
import { Asset, ParsedAsset } from '../../../types';
|
|
3
|
+
declare type ParsedTriggers = ParsedAsset<'triggers', Asset[]>;
|
|
5
4
|
declare const triggersHandler: YAMLHandler<ParsedTriggers>;
|
|
6
5
|
export default triggersHandler;
|
|
@@ -13,7 +13,7 @@ function parse(context) {
|
|
|
13
13
|
return __awaiter(this, void 0, void 0, function* () {
|
|
14
14
|
// Load the script file for each action
|
|
15
15
|
if (!context.assets.triggers)
|
|
16
|
-
return {};
|
|
16
|
+
return { triggers: null };
|
|
17
17
|
return {
|
|
18
18
|
triggers: context.assets.triggers,
|
|
19
19
|
};
|
|
@@ -24,7 +24,7 @@ function dump(context) {
|
|
|
24
24
|
const { triggers } = context.assets;
|
|
25
25
|
// Nothing to do
|
|
26
26
|
if (!triggers)
|
|
27
|
-
return {};
|
|
27
|
+
return { triggers: null };
|
|
28
28
|
return {
|
|
29
29
|
triggers: triggers,
|
|
30
30
|
};
|
|
@@ -111,7 +111,8 @@ class YAMLContext {
|
|
|
111
111
|
try {
|
|
112
112
|
const data = yield handler.dump(this);
|
|
113
113
|
if (data) {
|
|
114
|
-
|
|
114
|
+
if (data[name] !== null)
|
|
115
|
+
logger_1.default.info(`Exporting ${name}`);
|
|
115
116
|
Object.entries(data).forEach(([k, v]) => {
|
|
116
117
|
this.assets[k] = Array.isArray(v)
|
|
117
118
|
? v.map(utils_1.formatResults).sort(utils_1.recordsSorter)
|
package/lib/index.d.ts
CHANGED
|
@@ -77,6 +77,8 @@ declare const _default: {
|
|
|
77
77
|
EMAIL_TEMPLATES_NAMES: string[];
|
|
78
78
|
SUPPORTED_BRANDING_TEMPLATES: string[];
|
|
79
79
|
LOG_STREAMS_DIRECTORY: string;
|
|
80
|
+
PROMPTS_DIRECTORY: string;
|
|
81
|
+
CUSTOM_DOMAINS_DIRECTORY: string;
|
|
80
82
|
};
|
|
81
83
|
deploy: typeof import("./tools").deploy;
|
|
82
84
|
keywordReplace: typeof import("./tools").keywordReplace;
|
|
@@ -46,7 +46,7 @@ const lodash_1 = __importDefault(require("lodash"));
|
|
|
46
46
|
const default_1 = __importStar(require("./default"));
|
|
47
47
|
const logger_1 = __importDefault(require("../../../logger"));
|
|
48
48
|
const utils_1 = require("../../utils");
|
|
49
|
-
const
|
|
49
|
+
const MAX_ACTION_DEPLOY_RETRY_ATTEMPTS = 60; // 60 * 2s => 2 min timeout
|
|
50
50
|
// With this schema, we can only validate property types but not valid properties on per type basis
|
|
51
51
|
exports.schema = {
|
|
52
52
|
type: 'array',
|
|
@@ -162,10 +162,10 @@ class ActionHandler extends default_1.default {
|
|
|
162
162
|
logger_1.default.info(`[${this.type}]: Waiting for build to complete ${this.objString(action)}`);
|
|
163
163
|
action.retry_count = 1;
|
|
164
164
|
}
|
|
165
|
-
if (action.retry_count >
|
|
165
|
+
if (action.retry_count > MAX_ACTION_DEPLOY_RETRY_ATTEMPTS) {
|
|
166
166
|
throw err;
|
|
167
167
|
}
|
|
168
|
-
yield sleep(
|
|
168
|
+
yield sleep(2000);
|
|
169
169
|
action.retry_count += 1;
|
|
170
170
|
yield this.deployAction(action);
|
|
171
171
|
}
|
|
@@ -211,12 +211,12 @@ class ActionHandler extends default_1.default {
|
|
|
211
211
|
return this.existing;
|
|
212
212
|
}
|
|
213
213
|
catch (err) {
|
|
214
|
-
if (err.statusCode ===
|
|
215
|
-
return
|
|
214
|
+
if (err.statusCode === 404 || err.statusCode === 501) {
|
|
215
|
+
return null;
|
|
216
216
|
}
|
|
217
217
|
if (isActionsDisabled(err)) {
|
|
218
218
|
logger_1.default.info('Skipping actions because it is not enabled.');
|
|
219
|
-
return
|
|
219
|
+
return null;
|
|
220
220
|
}
|
|
221
221
|
throw err;
|
|
222
222
|
}
|
|
@@ -233,9 +233,25 @@ class ActionHandler extends default_1.default {
|
|
|
233
233
|
return;
|
|
234
234
|
const changes = yield this.calcChanges(assets);
|
|
235
235
|
yield _super.processChanges.call(this, assets, changes);
|
|
236
|
+
const postProcessedActions = yield (() => __awaiter(this, void 0, void 0, function* () {
|
|
237
|
+
this.existing = null; //Clear the cache
|
|
238
|
+
const actions = yield this.getType();
|
|
239
|
+
return actions;
|
|
240
|
+
}))();
|
|
236
241
|
// Deploy actions
|
|
237
242
|
const deployActions = [
|
|
238
|
-
...changes.create
|
|
243
|
+
...changes.create
|
|
244
|
+
.filter((action) => action.deployed)
|
|
245
|
+
.map((actionWithoutId) => {
|
|
246
|
+
var _a;
|
|
247
|
+
// Add IDs to just-created actions
|
|
248
|
+
const actionId = (_a = postProcessedActions === null || postProcessedActions === void 0 ? void 0 : postProcessedActions.find((postProcessedAction) => {
|
|
249
|
+
return postProcessedAction.name === actionWithoutId.name;
|
|
250
|
+
})) === null || _a === void 0 ? void 0 : _a.id;
|
|
251
|
+
const actionWithId = Object.assign(Object.assign({}, actionWithoutId), { id: actionId });
|
|
252
|
+
return actionWithId;
|
|
253
|
+
})
|
|
254
|
+
.filter((action) => !!action.id),
|
|
239
255
|
...changes.update.filter((action) => action.deployed),
|
|
240
256
|
];
|
|
241
257
|
yield this.deployActions(deployActions);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import DefaultHandler from './default';
|
|
2
|
-
import { Asset } from '../../../types';
|
|
2
|
+
import { Asset, Assets } from '../../../types';
|
|
3
3
|
export declare const schema: {
|
|
4
4
|
type: string;
|
|
5
5
|
properties: {
|
|
@@ -23,5 +23,5 @@ export default class BrandingHandler extends DefaultHandler {
|
|
|
23
23
|
existing: Asset;
|
|
24
24
|
constructor(options: DefaultHandler);
|
|
25
25
|
getType(): Promise<Asset>;
|
|
26
|
-
processChanges(assets:
|
|
26
|
+
processChanges(assets: Assets): Promise<void>;
|
|
27
27
|
}
|
|
@@ -93,7 +93,7 @@ class ClientGrantsHandler extends default_1.default {
|
|
|
93
93
|
const excludedClientsByNames = (assets.exclude && assets.exclude.clients) || [];
|
|
94
94
|
const excludedClients = (0, utils_1.convertClientNamesToIds)(excludedClientsByNames, clients);
|
|
95
95
|
// Convert clients by name to the id
|
|
96
|
-
const formatted =
|
|
96
|
+
const formatted = clientGrants.map((clientGrant) => {
|
|
97
97
|
const grant = Object.assign({}, clientGrant);
|
|
98
98
|
const found = clients.find((c) => c.name === grant.client_id);
|
|
99
99
|
if (found)
|
|
@@ -145,7 +145,7 @@ class ConnectionsHandler extends default_1.default {
|
|
|
145
145
|
paginate: true,
|
|
146
146
|
include_totals: true,
|
|
147
147
|
});
|
|
148
|
-
const formatted =
|
|
148
|
+
const formatted = connections.map((connection) => (Object.assign(Object.assign(Object.assign({}, connection), this.getFormattedOptions(connection, clients)), { enabled_clients: (0, utils_1.getEnabledClients)(assets, connection, existingConnections, clients) })));
|
|
149
149
|
const proposedChanges = yield _super.calcChanges.call(this, Object.assign(Object.assign({}, assets), { connections: formatted }));
|
|
150
150
|
const proposedChangesWithExcludedProperties = (0, exports.addExcludedConnectionPropertiesToChanges)({
|
|
151
151
|
proposedChanges,
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import DefaultAPIHandler from './default';
|
|
2
|
+
import { Asset, Assets } from '../../../types';
|
|
3
|
+
export declare const schema: {
|
|
4
|
+
type: string;
|
|
5
|
+
items: {
|
|
6
|
+
type: string;
|
|
7
|
+
properties: {
|
|
8
|
+
custom_domain_id: {
|
|
9
|
+
type: string;
|
|
10
|
+
};
|
|
11
|
+
custom_client_ip_header: {
|
|
12
|
+
type: string;
|
|
13
|
+
nullable: boolean;
|
|
14
|
+
enum: (string | null)[];
|
|
15
|
+
};
|
|
16
|
+
domain: {
|
|
17
|
+
type: string;
|
|
18
|
+
};
|
|
19
|
+
primary: {
|
|
20
|
+
type: string;
|
|
21
|
+
};
|
|
22
|
+
status: {
|
|
23
|
+
type: string;
|
|
24
|
+
enum: string[];
|
|
25
|
+
};
|
|
26
|
+
type: {
|
|
27
|
+
type: string;
|
|
28
|
+
enum: string[];
|
|
29
|
+
};
|
|
30
|
+
verification: {
|
|
31
|
+
type: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
required: string[];
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export default class CustomDomainsHadnler extends DefaultAPIHandler {
|
|
38
|
+
existing: Asset[] | null;
|
|
39
|
+
constructor(config: DefaultAPIHandler);
|
|
40
|
+
objString(item: Asset): string;
|
|
41
|
+
getType(): Promise<Asset>;
|
|
42
|
+
processChanges(assets: Assets): Promise<void>;
|
|
43
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.schema = void 0;
|
|
16
|
+
const default_1 = __importDefault(require("./default"));
|
|
17
|
+
exports.schema = {
|
|
18
|
+
type: 'array',
|
|
19
|
+
items: {
|
|
20
|
+
type: 'object',
|
|
21
|
+
properties: {
|
|
22
|
+
custom_domain_id: { type: 'string' },
|
|
23
|
+
custom_client_ip_header: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
nullable: true,
|
|
26
|
+
enum: ['true-client-ip', 'cf-connecting-ip', 'x-forwarded-for', null],
|
|
27
|
+
},
|
|
28
|
+
domain: { type: 'string' },
|
|
29
|
+
primary: { type: 'boolean' },
|
|
30
|
+
status: { type: 'string', enum: ['pending_verification', 'ready', 'disabled', 'pending'] },
|
|
31
|
+
type: { type: 'string', enum: ['auth0_managed_certs', 'self_managed_certs'] },
|
|
32
|
+
verification: { type: 'object' },
|
|
33
|
+
},
|
|
34
|
+
required: ['domain', 'type'],
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
class CustomDomainsHadnler extends default_1.default {
|
|
38
|
+
constructor(config) {
|
|
39
|
+
super(Object.assign(Object.assign({}, config), { type: 'customDomains', id: 'custom_domain_id', identifiers: ['domain'], stripCreateFields: ['status', 'primary', 'verification'], functions: {
|
|
40
|
+
//@ts-ignore
|
|
41
|
+
delete: (args) => {
|
|
42
|
+
return this.client.customDomains.delete({ id: args.custom_domain_id });
|
|
43
|
+
},
|
|
44
|
+
} }));
|
|
45
|
+
}
|
|
46
|
+
objString(item) {
|
|
47
|
+
return super.objString(item.domain);
|
|
48
|
+
}
|
|
49
|
+
getType() {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
if (this.existing) {
|
|
52
|
+
return this.existing;
|
|
53
|
+
}
|
|
54
|
+
const customDomains = yield this.client.customDomains.getAll({ paginate: false });
|
|
55
|
+
this.existing = customDomains;
|
|
56
|
+
return customDomains;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
processChanges(assets) {
|
|
60
|
+
const _super = Object.create(null, {
|
|
61
|
+
processChanges: { get: () => super.processChanges }
|
|
62
|
+
});
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
const { customDomains } = assets;
|
|
65
|
+
if (!customDomains)
|
|
66
|
+
return;
|
|
67
|
+
const changes = yield this.calcChanges(assets).then((changes) => {
|
|
68
|
+
const changesWithoutUpdates = Object.assign(Object.assign({}, changes), { create: changes.create.map((customDomainToCreate) => {
|
|
69
|
+
const newCustomDomain = Object.assign({}, customDomainToCreate);
|
|
70
|
+
if (customDomainToCreate.custom_client_ip_header === null) {
|
|
71
|
+
delete newCustomDomain.custom_client_ip_header;
|
|
72
|
+
}
|
|
73
|
+
return newCustomDomain;
|
|
74
|
+
}), delete: changes.del.map((deleteToMake) => {
|
|
75
|
+
const deleteWithSDKCompatibleID = Object.assign(Object.assign({}, deleteToMake), { id: deleteToMake.custom_domain_id });
|
|
76
|
+
delete deleteWithSDKCompatibleID['custom_domain_id'];
|
|
77
|
+
return deleteWithSDKCompatibleID;
|
|
78
|
+
}), update: [] });
|
|
79
|
+
return changesWithoutUpdates;
|
|
80
|
+
});
|
|
81
|
+
yield _super.processChanges.call(this, assets, changes);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
exports.default = CustomDomainsHadnler;
|
|
@@ -69,8 +69,15 @@ class APIHandler {
|
|
|
69
69
|
load() {
|
|
70
70
|
return __awaiter(this, void 0, void 0, function* () {
|
|
71
71
|
// Load Asset from Tenant
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
const data = yield (() => __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
const { data, hadSufficientScopes, requiredScopes } = yield (0, utils_1.detectInsufficientScopeError)(this.getType.bind(this));
|
|
74
|
+
if (!hadSufficientScopes) {
|
|
75
|
+
logger_1.default.warn(`Cannot retrieve ${this.type} due to missing scopes: ${requiredScopes}`);
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
logger_1.default.info(`Retrieving ${this.type} data from Auth0`);
|
|
79
|
+
return data;
|
|
80
|
+
}))();
|
|
74
81
|
this.existing = (0, utils_1.obfuscateSensitiveValues)(data, this.sensitiveFieldsToObfuscate);
|
|
75
82
|
return { [this.type]: this.existing };
|
|
76
83
|
});
|