auth0-deploy-cli 7.5.2 → 7.6.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 +11 -1
- package/lib/args.js +0 -2
- package/lib/commands/import.js +1 -0
- package/lib/context/directory/handlers/actions.js +3 -2
- package/lib/context/directory/handlers/attackProtection.js +3 -2
- package/lib/context/directory/handlers/branding.js +59 -0
- package/lib/context/directory/handlers/clientGrants.js +3 -2
- package/lib/context/directory/handlers/clients.js +3 -2
- package/lib/context/directory/handlers/connections.js +3 -2
- package/lib/context/directory/handlers/databases.js +18 -16
- package/lib/context/directory/handlers/emailProvider.js +3 -2
- package/lib/context/directory/handlers/emailTemplates.js +11 -9
- package/lib/context/directory/handlers/guardianFactorProviders.js +3 -2
- package/lib/context/directory/handlers/guardianFactorTemplates.js +3 -2
- package/lib/context/directory/handlers/guardianFactors.js +3 -2
- package/lib/context/directory/handlers/guardianPhoneFactorMessageTypes.js +3 -2
- package/lib/context/directory/handlers/guardianPhoneFactorSelectedProvider.js +3 -2
- package/lib/context/directory/handlers/guardianPolicies.js +3 -2
- package/lib/context/directory/handlers/hooks.js +3 -2
- package/lib/context/directory/handlers/index.js +3 -1
- package/lib/context/directory/handlers/migrations.js +8 -8
- package/lib/context/directory/handlers/organizations.js +3 -2
- package/lib/context/directory/handlers/pages.js +18 -18
- package/lib/context/directory/handlers/resourceServers.js +3 -2
- package/lib/context/directory/handlers/roles.js +3 -2
- package/lib/context/directory/handlers/rules.js +3 -2
- package/lib/context/directory/handlers/rulesConfigs.js +4 -3
- package/lib/context/directory/handlers/tenant.js +5 -3
- package/lib/context/directory/handlers/triggers.js +3 -2
- package/lib/context/directory/index.js +2 -4
- package/lib/context/yaml/handlers/actions.js +4 -3
- package/lib/context/yaml/handlers/attackProtection.js +5 -11
- package/lib/context/yaml/handlers/branding.js +65 -0
- package/lib/context/yaml/handlers/clientGrants.js +3 -2
- package/lib/context/yaml/handlers/clients.js +3 -2
- package/lib/context/yaml/handlers/connections.js +3 -2
- package/lib/context/yaml/handlers/databases.js +3 -2
- package/lib/context/yaml/handlers/emailProvider.js +3 -2
- package/lib/context/yaml/handlers/emailTemplates.js +3 -2
- package/lib/context/yaml/handlers/guardianFactorProviders.js +5 -12
- package/lib/context/yaml/handlers/guardianFactorTemplates.js +5 -12
- package/lib/context/yaml/handlers/guardianFactors.js +5 -12
- package/lib/context/yaml/handlers/guardianPhoneFactorMessageTypes.js +5 -12
- package/lib/context/yaml/handlers/guardianPhoneFactorSelectedProvider.js +5 -12
- package/lib/context/yaml/handlers/guardianPolicies.js +5 -12
- package/lib/context/yaml/handlers/hooks.js +3 -2
- package/lib/context/yaml/handlers/index.js +3 -1
- package/lib/context/yaml/handlers/migrations.js +3 -2
- package/lib/context/yaml/handlers/organizations.js +3 -2
- package/lib/context/yaml/handlers/pages.js +3 -2
- package/lib/context/yaml/handlers/resourceServers.js +3 -2
- package/lib/context/yaml/handlers/roles.js +3 -2
- package/lib/context/yaml/handlers/rules.js +3 -2
- package/lib/context/yaml/handlers/rulesConfigs.js +4 -3
- package/lib/context/yaml/handlers/tenant.js +3 -2
- package/lib/context/yaml/handlers/triggers.js +3 -2
- package/lib/context/yaml/index.js +2 -1
- package/lib/tools/auth0/handlers/branding.js +67 -13
- package/lib/tools/auth0/handlers/default.js +7 -1
- package/lib/tools/auth0/handlers/organizations.js +7 -2
- package/lib/tools/auth0/handlers/resourceServers.js +7 -2
- package/lib/tools/auth0/handlers/roles.js +7 -2
- package/lib/tools/auth0/handlers/rules.js +7 -1
- package/lib/tools/calculateChanges.js +144 -0
- package/lib/tools/constants.js +7 -0
- package/lib/tools/utils.js +1 -142
- package/package.json +2 -2
- package/tsconfig.json +1 -0
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
16
|
+
const path_1 = __importDefault(require("path"));
|
|
17
|
+
const tools_1 = require("../../../tools");
|
|
18
|
+
function parse(context) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
// Load the HTML file for each page
|
|
21
|
+
const { branding } = context.assets;
|
|
22
|
+
if (!branding || !branding.templates)
|
|
23
|
+
return { branding };
|
|
24
|
+
const templates = branding.templates.map((templateDefinition) => {
|
|
25
|
+
const markupFile = path_1.default.join(templateDefinition.body);
|
|
26
|
+
return {
|
|
27
|
+
template: templateDefinition.template,
|
|
28
|
+
body: (0, tools_1.loadFileAndReplaceKeywords)(markupFile, context.mappings)
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
return {
|
|
32
|
+
branding: Object.assign(Object.assign({}, branding), { templates })
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function dump(context) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
const { branding } = context.assets || { branding: undefined };
|
|
39
|
+
branding.templates = branding.templates || [];
|
|
40
|
+
// create templates folder
|
|
41
|
+
if (branding.templates.length) {
|
|
42
|
+
const brandingTemplatesFolder = path_1.default.join(context.basePath, tools_1.constants.BRANDING_TEMPLATES_YAML_DIRECTORY);
|
|
43
|
+
fs_extra_1.default.ensureDirSync(brandingTemplatesFolder);
|
|
44
|
+
branding.templates = branding.templates.map((templateDefinition) => {
|
|
45
|
+
const file = `${templateDefinition.template}.html`;
|
|
46
|
+
const templateMarkupFile = path_1.default.join(brandingTemplatesFolder, file);
|
|
47
|
+
const markup = templateDefinition.body;
|
|
48
|
+
try {
|
|
49
|
+
fs_extra_1.default.writeFileSync(templateMarkupFile, markup);
|
|
50
|
+
}
|
|
51
|
+
catch (e) {
|
|
52
|
+
throw new Error(`Error writing template file: ${templateDefinition.template}, because: ${e.message}`);
|
|
53
|
+
}
|
|
54
|
+
// save the location as relative file.
|
|
55
|
+
templateDefinition.body = `.${path_1.default.sep}${path_1.default.join(tools_1.constants.BRANDING_TEMPLATES_YAML_DIRECTORY, file)}`;
|
|
56
|
+
return templateDefinition;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return { branding };
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
exports.default = {
|
|
63
|
+
parse,
|
|
64
|
+
dump
|
|
65
|
+
};
|
|
@@ -9,15 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
function
|
|
13
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
-
// nothing to do, set default if empty
|
|
15
|
-
return {
|
|
16
|
-
guardianFactorProviders: [...context.assets.guardianFactorProviders || []]
|
|
17
|
-
};
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
function dump(context) {
|
|
12
|
+
function parseAndDump(context) {
|
|
21
13
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
14
|
// nothing to do, set default empty
|
|
23
15
|
return {
|
|
@@ -25,7 +17,8 @@ function dump(context) {
|
|
|
25
17
|
};
|
|
26
18
|
});
|
|
27
19
|
}
|
|
28
|
-
|
|
29
|
-
parse,
|
|
30
|
-
dump
|
|
20
|
+
const guardianFactorProvidersHandler = {
|
|
21
|
+
parse: parseAndDump,
|
|
22
|
+
dump: parseAndDump,
|
|
31
23
|
};
|
|
24
|
+
exports.default = guardianFactorProvidersHandler;
|
|
@@ -9,7 +9,7 @@ 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 parseAndDump(context) {
|
|
13
13
|
return __awaiter(this, void 0, void 0, function* () {
|
|
14
14
|
// nothing to do, set default if empty
|
|
15
15
|
return {
|
|
@@ -17,15 +17,8 @@ function parse(context) {
|
|
|
17
17
|
};
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return {
|
|
24
|
-
guardianFactorTemplates: [...context.assets.guardianFactorTemplates || []]
|
|
25
|
-
};
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
exports.default = {
|
|
29
|
-
parse,
|
|
30
|
-
dump
|
|
20
|
+
const guardianFactorTemplatesHandler = {
|
|
21
|
+
parse: parseAndDump,
|
|
22
|
+
dump: parseAndDump,
|
|
31
23
|
};
|
|
24
|
+
exports.default = guardianFactorTemplatesHandler;
|
|
@@ -9,7 +9,7 @@ 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 parseAndDump(context) {
|
|
13
13
|
return __awaiter(this, void 0, void 0, function* () {
|
|
14
14
|
// nothing to do, set default if empty
|
|
15
15
|
return {
|
|
@@ -17,15 +17,8 @@ function parse(context) {
|
|
|
17
17
|
};
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return {
|
|
24
|
-
guardianFactors: [...context.assets.guardianFactors || []]
|
|
25
|
-
};
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
exports.default = {
|
|
29
|
-
parse,
|
|
30
|
-
dump
|
|
20
|
+
const guardianFactorsHandler = {
|
|
21
|
+
parse: parseAndDump,
|
|
22
|
+
dump: parseAndDump,
|
|
31
23
|
};
|
|
24
|
+
exports.default = guardianFactorsHandler;
|
|
@@ -9,7 +9,7 @@ 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 parseAndDump(context) {
|
|
13
13
|
return __awaiter(this, void 0, void 0, function* () {
|
|
14
14
|
// nothing to do, set default if empty
|
|
15
15
|
return {
|
|
@@ -17,15 +17,8 @@ function parse(context) {
|
|
|
17
17
|
};
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return {
|
|
24
|
-
guardianPhoneFactorMessageTypes: Object.assign({}, context.assets.guardianPhoneFactorMessageTypes || {})
|
|
25
|
-
};
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
exports.default = {
|
|
29
|
-
parse,
|
|
30
|
-
dump
|
|
20
|
+
const guardianPhoneFactorMessageTypesHandler = {
|
|
21
|
+
parse: parseAndDump,
|
|
22
|
+
dump: parseAndDump,
|
|
31
23
|
};
|
|
24
|
+
exports.default = guardianPhoneFactorMessageTypesHandler;
|
|
@@ -9,15 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
function
|
|
13
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
-
// nothing to do, set default if empty
|
|
15
|
-
return {
|
|
16
|
-
guardianPhoneFactorSelectedProvider: Object.assign({}, context.assets.guardianPhoneFactorSelectedProvider || {})
|
|
17
|
-
};
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
function dump(context) {
|
|
12
|
+
function parseAndDump(context) {
|
|
21
13
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
14
|
// nothing to do, set default empty
|
|
23
15
|
return {
|
|
@@ -25,7 +17,8 @@ function dump(context) {
|
|
|
25
17
|
};
|
|
26
18
|
});
|
|
27
19
|
}
|
|
28
|
-
|
|
29
|
-
parse,
|
|
30
|
-
dump
|
|
20
|
+
const guardianPhoneFactorSelectedProviderHandler = {
|
|
21
|
+
parse: parseAndDump,
|
|
22
|
+
dump: parseAndDump,
|
|
31
23
|
};
|
|
24
|
+
exports.default = guardianPhoneFactorSelectedProviderHandler;
|
|
@@ -9,7 +9,7 @@ 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 parseAndDump(context) {
|
|
13
13
|
return __awaiter(this, void 0, void 0, function* () {
|
|
14
14
|
// nothing to do, set default if empty
|
|
15
15
|
return {
|
|
@@ -17,15 +17,8 @@ function parse(context) {
|
|
|
17
17
|
};
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return {
|
|
24
|
-
guardianPolicies: Object.assign({}, context.assets.guardianPolicies || {})
|
|
25
|
-
};
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
exports.default = {
|
|
29
|
-
parse,
|
|
30
|
-
dump
|
|
20
|
+
const guardianPoliciesHandler = {
|
|
21
|
+
parse: parseAndDump,
|
|
22
|
+
dump: parseAndDump,
|
|
31
23
|
};
|
|
24
|
+
exports.default = guardianPoliciesHandler;
|
|
@@ -27,6 +27,7 @@ const migrations_1 = __importDefault(require("./migrations"));
|
|
|
27
27
|
const actions_1 = __importDefault(require("./actions"));
|
|
28
28
|
const triggers_1 = __importDefault(require("./triggers"));
|
|
29
29
|
const attackProtection_1 = __importDefault(require("./attackProtection"));
|
|
30
|
+
const branding_1 = __importDefault(require("./branding"));
|
|
30
31
|
exports.default = {
|
|
31
32
|
rules: rules_1.default,
|
|
32
33
|
hooks: hooks_1.default,
|
|
@@ -51,5 +52,6 @@ exports.default = {
|
|
|
51
52
|
actions: actions_1.default,
|
|
52
53
|
organizations: organizations_1.default,
|
|
53
54
|
triggers: triggers_1.default,
|
|
54
|
-
attackProtection: attackProtection_1.default
|
|
55
|
+
attackProtection: attackProtection_1.default,
|
|
56
|
+
branding: branding_1.default
|
|
55
57
|
};
|
|
@@ -17,7 +17,7 @@ function parse(context) {
|
|
|
17
17
|
};
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
function dump() {
|
|
20
|
+
function dump(_context) {
|
|
21
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
22
|
// do not export rulesConfigs as its values cannot be extracted
|
|
23
23
|
return {
|
|
@@ -25,7 +25,8 @@ function dump() {
|
|
|
25
25
|
};
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
const rulesConfigsHandler = {
|
|
29
29
|
parse,
|
|
30
|
-
dump
|
|
30
|
+
dump,
|
|
31
31
|
};
|
|
32
|
+
exports.default = rulesConfigsHandler;
|
|
@@ -39,6 +39,7 @@ class default_1 {
|
|
|
39
39
|
};
|
|
40
40
|
this.basePath = config.AUTH0_BASE_PATH;
|
|
41
41
|
if (!this.basePath) {
|
|
42
|
+
//@ts-ignore because this looks to be a bug, but do not want to introduce regression; more investigation needed
|
|
42
43
|
this.basePath = (typeof configFile === 'object') ? process.cwd() : path_1.default.dirname(this.configFile);
|
|
43
44
|
}
|
|
44
45
|
}
|
|
@@ -69,7 +70,7 @@ class default_1 {
|
|
|
69
70
|
}
|
|
70
71
|
// Run initial schema check to ensure valid YAML
|
|
71
72
|
const auth0 = new tools_1.Auth0(this.mgmtClient, this.assets, (0, utils_1.toConfigFn)(this.config));
|
|
72
|
-
yield auth0.validate(
|
|
73
|
+
yield auth0.validate();
|
|
73
74
|
// Allow handlers to process the assets such as loading files etc
|
|
74
75
|
yield Promise.all(Object.entries(handlers_1.default).map(([name, handler]) => __awaiter(this, void 0, void 0, function* () {
|
|
75
76
|
try {
|
|
@@ -14,25 +14,59 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.schema = void 0;
|
|
16
16
|
const default_1 = __importDefault(require("./default"));
|
|
17
|
-
|
|
17
|
+
const constants_1 = __importDefault(require("../../constants"));
|
|
18
|
+
const logger_1 = __importDefault(require("../../../logger"));
|
|
19
|
+
exports.schema = {
|
|
20
|
+
type: 'object',
|
|
21
|
+
properties: {
|
|
22
|
+
templates: {
|
|
23
|
+
type: 'array',
|
|
24
|
+
items: {
|
|
25
|
+
type: 'object',
|
|
26
|
+
properties: {
|
|
27
|
+
template: { type: 'string' },
|
|
28
|
+
body: { type: 'string' }
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
18
34
|
class BrandingHandler extends default_1.default {
|
|
19
35
|
constructor(options) {
|
|
20
36
|
super(Object.assign(Object.assign({}, options), { type: 'branding' }));
|
|
21
37
|
}
|
|
22
38
|
getType() {
|
|
23
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
|
|
25
|
-
if (!this.client.branding || typeof this.client.branding.getSettings !== 'function') {
|
|
26
|
-
return {};
|
|
27
|
-
}
|
|
40
|
+
let branding = {};
|
|
28
41
|
try {
|
|
29
|
-
|
|
42
|
+
// in case client version does not support branding
|
|
43
|
+
if (this.client.branding && typeof this.client.branding.getSettings === 'function') {
|
|
44
|
+
branding = yield this.client.branding.getSettings();
|
|
45
|
+
}
|
|
46
|
+
// in case client version does not custom domains
|
|
47
|
+
if (this.client.customDomains && typeof this.client.customDomains.getAll === 'function') {
|
|
48
|
+
const customDomains = yield this.client.customDomains.getAll();
|
|
49
|
+
// templates are only supported if there's custom domains.
|
|
50
|
+
if (customDomains && customDomains.length) {
|
|
51
|
+
const payload = yield this.client.branding.getUniversalLoginTemplate();
|
|
52
|
+
branding.templates = [
|
|
53
|
+
{
|
|
54
|
+
template: constants_1.default.UNIVERSAL_LOGIN_TEMPLATE,
|
|
55
|
+
body: payload.body
|
|
56
|
+
}
|
|
57
|
+
];
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return branding;
|
|
30
61
|
}
|
|
31
62
|
catch (err) {
|
|
63
|
+
logger_1.default.debug(`Error calling branding API, ${err.message}, status code: ${err.statusCode}`);
|
|
64
|
+
if (err.statusCode === 403)
|
|
65
|
+
return branding;
|
|
32
66
|
if (err.statusCode === 404)
|
|
33
|
-
return
|
|
67
|
+
return branding;
|
|
34
68
|
if (err.statusCode === 501)
|
|
35
|
-
return
|
|
69
|
+
return branding;
|
|
36
70
|
throw err;
|
|
37
71
|
}
|
|
38
72
|
});
|
|
@@ -40,12 +74,32 @@ class BrandingHandler extends default_1.default {
|
|
|
40
74
|
processChanges(assets) {
|
|
41
75
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
76
|
const { branding } = assets;
|
|
43
|
-
//
|
|
44
|
-
if (!branding
|
|
77
|
+
// quit early if there's no branding to process.
|
|
78
|
+
if (!branding)
|
|
45
79
|
return;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
80
|
+
// remove templates, we only want top level branding settings for this API call
|
|
81
|
+
const brandingSettings = Object.assign({}, branding);
|
|
82
|
+
delete brandingSettings.templates;
|
|
83
|
+
// Do nothing if not set
|
|
84
|
+
if (brandingSettings && Object.keys(brandingSettings).length) {
|
|
85
|
+
yield this.client.branding.updateSettings({}, brandingSettings);
|
|
86
|
+
this.updated += 1;
|
|
87
|
+
this.didUpdate(brandingSettings);
|
|
88
|
+
}
|
|
89
|
+
// handle templates
|
|
90
|
+
if (branding.templates && branding.templates.length) {
|
|
91
|
+
const unknownTemplates = branding.templates.filter((t) => !constants_1.default.SUPPORTED_BRANDING_TEMPLATES.includes(t.template)).map((t) => t.template);
|
|
92
|
+
if (unknownTemplates.length) {
|
|
93
|
+
// throw a helpful warning for unknown templates, the context handlers are unaware of which are supported, that's all handled here.
|
|
94
|
+
logger_1.default.warn(`Found unknown branding template(s): ${unknownTemplates.join().toString()}. Supported branding templates are: ${constants_1.default.SUPPORTED_BRANDING_TEMPLATES.join()}.`);
|
|
95
|
+
}
|
|
96
|
+
const templateDefinition = branding.templates.find((t) => t.template === constants_1.default.UNIVERSAL_LOGIN_TEMPLATE);
|
|
97
|
+
if (templateDefinition && templateDefinition.body) {
|
|
98
|
+
yield this.client.branding.setUniversalLoginTemplate({}, { template: templateDefinition.body });
|
|
99
|
+
this.updated += 1;
|
|
100
|
+
this.didUpdate(branding.templates);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
49
103
|
});
|
|
50
104
|
}
|
|
51
105
|
}
|
|
@@ -16,6 +16,7 @@ exports.order = void 0;
|
|
|
16
16
|
const ValidationError_1 = __importDefault(require("../../ValidationError"));
|
|
17
17
|
const logger_1 = __importDefault(require("../../logger"));
|
|
18
18
|
const utils_1 = require("../../utils");
|
|
19
|
+
const calculateChanges_1 = require("../../calculateChanges");
|
|
19
20
|
function order(value) {
|
|
20
21
|
return function decorator(t, n, descriptor) {
|
|
21
22
|
descriptor.value.order = value; // eslint-disable-line
|
|
@@ -82,7 +83,12 @@ class DefaultHandler {
|
|
|
82
83
|
return {};
|
|
83
84
|
const existing = yield this.getType();
|
|
84
85
|
// Figure out what needs to be updated vs created
|
|
85
|
-
return (0,
|
|
86
|
+
return (0, calculateChanges_1.calculateChanges)({
|
|
87
|
+
handler: this,
|
|
88
|
+
assets: typeAssets,
|
|
89
|
+
existing,
|
|
90
|
+
identifiers: this.identifiers
|
|
91
|
+
});
|
|
86
92
|
});
|
|
87
93
|
}
|
|
88
94
|
validate(assets) {
|
|
@@ -44,7 +44,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
44
44
|
exports.schema = void 0;
|
|
45
45
|
const lodash_1 = __importDefault(require("lodash"));
|
|
46
46
|
const default_1 = __importStar(require("./default"));
|
|
47
|
-
const
|
|
47
|
+
const calculateChanges_1 = require("../../calculateChanges");
|
|
48
48
|
const logger_1 = __importDefault(require("../../logger"));
|
|
49
49
|
exports.schema = {
|
|
50
50
|
type: 'array',
|
|
@@ -208,7 +208,12 @@ class OrganizationsHandler extends default_1.default {
|
|
|
208
208
|
return Object.assign(Object.assign({}, connection), { connection_id: (existingConnections.find((c) => c.name === name) || {}).id });
|
|
209
209
|
}).filter((connection) => !!connection.connection_id);
|
|
210
210
|
});
|
|
211
|
-
const changes = (0,
|
|
211
|
+
const changes = (0, calculateChanges_1.calculateChanges)({
|
|
212
|
+
handler: this,
|
|
213
|
+
assets: organizations,
|
|
214
|
+
existing,
|
|
215
|
+
identifiers: ['id', 'name']
|
|
216
|
+
});
|
|
212
217
|
logger_1.default.debug(`Start processChanges for organizations [delete:${changes.del.length}] [update:${changes.update.length}], [create:${changes.create.length}]`);
|
|
213
218
|
const myChanges = [{ del: changes.del }, { create: changes.create }, { update: changes.update }];
|
|
214
219
|
yield Promise.all(myChanges.map((change) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -16,7 +16,7 @@ exports.schema = exports.excludeSchema = void 0;
|
|
|
16
16
|
const ValidationError_1 = __importDefault(require("../../ValidationError"));
|
|
17
17
|
const constants_1 = __importDefault(require("../../constants"));
|
|
18
18
|
const default_1 = __importDefault(require("./default"));
|
|
19
|
-
const
|
|
19
|
+
const calculateChanges_1 = require("../../calculateChanges");
|
|
20
20
|
exports.excludeSchema = {
|
|
21
21
|
type: 'array',
|
|
22
22
|
items: { type: 'string' }
|
|
@@ -71,7 +71,12 @@ class ResourceServersHandler extends default_1.default {
|
|
|
71
71
|
// Filter excluded
|
|
72
72
|
resourceServers = resourceServers.filter((r) => !excluded.includes(r.name));
|
|
73
73
|
existing = existing.filter((r) => !excluded.includes(r.name));
|
|
74
|
-
return (0,
|
|
74
|
+
return (0, calculateChanges_1.calculateChanges)({
|
|
75
|
+
handler: this,
|
|
76
|
+
assets: resourceServers,
|
|
77
|
+
existing,
|
|
78
|
+
identifiers: ['id', 'identifier']
|
|
79
|
+
});
|
|
75
80
|
});
|
|
76
81
|
}
|
|
77
82
|
validate(assets) {
|