auth0-deploy-cli 7.3.6 → 7.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.circleci/config.yml +15 -0
- package/.github/CODEOWNERS +1 -0
- package/.husky/pre-commit +6 -0
- package/.husky/pre-push +4 -0
- package/.nyc_output/60b76a45-577b-4171-9982-a8e836ab7fd6.json +1 -0
- package/.nyc_output/processinfo/60b76a45-577b-4171-9982-a8e836ab7fd6.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -1
- package/CHANGELOG.md +35 -2
- package/lib/args.js +89 -81
- package/lib/commands/export.js +51 -77
- package/lib/commands/import.js +45 -69
- package/lib/commands/index.js +11 -20
- package/lib/configFactory.js +19 -27
- package/lib/context/defaults.js +18 -41
- package/lib/context/directory/handlers/actions.js +77 -107
- package/lib/context/directory/handlers/attackProtection.js +59 -0
- package/lib/context/directory/handlers/clientGrants.js +45 -54
- package/lib/context/directory/handlers/clients.js +60 -79
- package/lib/context/directory/handlers/connections.js +65 -89
- package/lib/context/directory/handlers/databases.js +91 -123
- package/lib/context/directory/handlers/emailProvider.js +46 -57
- package/lib/context/directory/handlers/emailTemplates.js +67 -80
- package/lib/context/directory/handlers/guardianFactorProviders.js +41 -49
- package/lib/context/directory/handlers/guardianFactorTemplates.js +41 -49
- package/lib/context/directory/handlers/guardianFactors.js +41 -49
- package/lib/context/directory/handlers/guardianPhoneFactorMessageTypes.js +40 -50
- package/lib/context/directory/handlers/guardianPhoneFactorSelectedProvider.js +40 -50
- package/lib/context/directory/handlers/guardianPolicies.js +40 -50
- package/lib/context/directory/handlers/hooks.js +55 -70
- package/lib/context/directory/handlers/index.js +53 -123
- package/lib/context/directory/handlers/migrations.js +36 -41
- package/lib/context/directory/handlers/organizations.js +54 -69
- package/lib/context/directory/handlers/pages.js +72 -86
- package/lib/context/directory/handlers/resourceServers.js +41 -49
- package/lib/context/directory/handlers/roles.js +49 -62
- package/lib/context/directory/handlers/rules.js +52 -68
- package/lib/context/directory/handlers/rulesConfigs.js +33 -32
- package/lib/context/directory/handlers/tenant.js +52 -47
- package/lib/context/directory/handlers/triggers.js +39 -54
- package/lib/context/directory/index.js +113 -101
- package/lib/context/index.js +96 -105
- package/lib/context/yaml/handlers/actions.js +71 -88
- package/lib/context/yaml/handlers/attackProtection.js +29 -0
- package/lib/context/yaml/handlers/clientGrants.js +36 -29
- package/lib/context/yaml/handlers/clients.js +61 -76
- package/lib/context/yaml/handlers/connections.js +76 -103
- package/lib/context/yaml/handlers/databases.js +64 -79
- package/lib/context/yaml/handlers/emailProvider.js +33 -30
- package/lib/context/yaml/handlers/emailTemplates.js +45 -54
- package/lib/context/yaml/handlers/guardianFactorProviders.js +27 -18
- package/lib/context/yaml/handlers/guardianFactorTemplates.js +27 -18
- package/lib/context/yaml/handlers/guardianFactors.js +27 -18
- package/lib/context/yaml/handlers/guardianPhoneFactorMessageTypes.js +27 -20
- package/lib/context/yaml/handlers/guardianPhoneFactorSelectedProvider.js +27 -20
- package/lib/context/yaml/handlers/guardianPolicies.js +27 -20
- package/lib/context/yaml/handlers/hooks.js +57 -67
- package/lib/context/yaml/handlers/index.js +53 -123
- package/lib/context/yaml/handlers/migrations.js +23 -24
- package/lib/context/yaml/handlers/organizations.js +40 -38
- package/lib/context/yaml/handlers/pages.js +49 -58
- package/lib/context/yaml/handlers/resourceServers.js +27 -18
- package/lib/context/yaml/handlers/roles.js +34 -24
- package/lib/context/yaml/handlers/rules.js +48 -58
- package/lib/context/yaml/handlers/rulesConfigs.js +27 -18
- package/lib/context/yaml/handlers/tenant.js +44 -30
- package/lib/context/yaml/handlers/triggers.js +32 -23
- package/lib/context/yaml/index.js +127 -142
- package/lib/index.js +73 -79
- package/lib/logger.js +18 -22
- package/lib/readonly.js +74 -66
- package/lib/tools/ValidationError.js +8 -13
- package/lib/tools/auth0/client.js +143 -133
- package/lib/tools/auth0/handlers/actions.js +231 -241
- package/lib/tools/auth0/handlers/attackProtection.js +86 -0
- package/lib/tools/auth0/handlers/branding.js +47 -46
- package/lib/tools/auth0/handlers/clientGrants.js +118 -116
- package/lib/tools/auth0/handlers/clients.js +72 -90
- package/lib/tools/auth0/handlers/connections.js +150 -118
- package/lib/tools/auth0/handlers/databases.js +127 -124
- package/lib/tools/auth0/handlers/default.js +186 -189
- package/lib/tools/auth0/handlers/emailProvider.js +67 -78
- package/lib/tools/auth0/handlers/emailTemplates.js +116 -92
- package/lib/tools/auth0/handlers/guardianFactorProviders.js +66 -81
- package/lib/tools/auth0/handlers/guardianFactorTemplates.js +60 -71
- package/lib/tools/auth0/handlers/guardianFactors.js +56 -63
- package/lib/tools/auth0/handlers/guardianPhoneFactorMessageTypes.js +80 -79
- package/lib/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.js +77 -76
- package/lib/tools/auth0/handlers/guardianPolicies.js +59 -62
- package/lib/tools/auth0/handlers/hooks.js +201 -227
- package/lib/tools/auth0/handlers/index.js +53 -111
- package/lib/tools/auth0/handlers/migrations.js +99 -79
- package/lib/tools/auth0/handlers/organizations.js +225 -247
- package/lib/tools/auth0/handlers/pages.js +116 -154
- package/lib/tools/auth0/handlers/prompts.js +47 -46
- package/lib/tools/auth0/handlers/resourceServers.js +88 -112
- package/lib/tools/auth0/handlers/roles.js +203 -220
- package/lib/tools/auth0/handlers/rules.js +168 -189
- package/lib/tools/auth0/handlers/rulesConfigs.js +54 -63
- package/lib/tools/auth0/handlers/tenant.js +88 -64
- package/lib/tools/auth0/handlers/triggers.js +126 -126
- package/lib/tools/auth0/index.js +92 -85
- package/lib/tools/auth0/schema.js +39 -31
- package/lib/tools/constants.js +111 -21
- package/lib/tools/deploy.js +35 -32
- package/lib/tools/index.js +19 -32
- package/lib/tools/logger.js +11 -12
- package/lib/tools/utils.js +258 -254
- package/lib/utils.js +167 -190
- package/package.json +6 -3
- package/tsconfig.json +96 -0
- package/typescript-migration-progress.sh +22 -0
- package/.nyc_output/8cf4dd0c-1f3a-4ac1-899c-8e453a64221e.json +0 -1
- package/.nyc_output/processinfo/8cf4dd0c-1f3a-4ac1-899c-8e453a64221e.json +0 -1
|
@@ -1,98 +1,122 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
5
17
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
|
-
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
|
|
21
|
-
|
|
22
|
-
const supportedTemplates = exports.supportedTemplates = _constants2.default.EMAIL_TEMPLATES_NAMES.filter(p => p.includes('.json')).map(p => p.replace('.json', ''));
|
|
23
|
-
|
|
24
|
-
const schema = exports.schema = {
|
|
25
|
-
type: 'array',
|
|
26
|
-
items: {
|
|
27
|
-
type: 'object',
|
|
28
|
-
properties: {
|
|
29
|
-
template: {
|
|
30
|
-
type: 'string',
|
|
31
|
-
enum: supportedTemplates
|
|
32
|
-
},
|
|
33
|
-
body: {
|
|
34
|
-
type: 'string',
|
|
35
|
-
default: ''
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
required: ['template']
|
|
39
|
-
}
|
|
18
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
|
+
if (mod && mod.__esModule) return mod;
|
|
26
|
+
var result = {};
|
|
27
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
28
|
+
__setModuleDefault(result, mod);
|
|
29
|
+
return result;
|
|
40
30
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
31
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
32
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
33
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
34
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
35
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
36
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
37
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
46
38
|
});
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
39
|
+
};
|
|
40
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
41
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
42
|
+
};
|
|
43
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
exports.schema = exports.supportedTemplates = void 0;
|
|
45
|
+
const default_1 = __importStar(require("./default"));
|
|
46
|
+
const constants_1 = __importDefault(require("../../constants"));
|
|
47
|
+
exports.supportedTemplates = constants_1.default.EMAIL_TEMPLATES_NAMES
|
|
48
|
+
.filter((p) => p.includes('.json'))
|
|
49
|
+
.map((p) => p.replace('.json', ''));
|
|
50
|
+
exports.schema = {
|
|
51
|
+
type: 'array',
|
|
52
|
+
items: {
|
|
53
|
+
type: 'object',
|
|
54
|
+
properties: {
|
|
55
|
+
template: { type: 'string', enum: exports.supportedTemplates },
|
|
56
|
+
body: { type: 'string', default: '' }
|
|
57
|
+
},
|
|
58
|
+
required: ['template']
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
class EmailTemplateHandler extends default_1.default {
|
|
62
|
+
constructor(options) {
|
|
63
|
+
super(Object.assign(Object.assign({}, options), { type: 'emailTemplates', id: 'template' }));
|
|
64
|
+
}
|
|
65
|
+
getType() {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
const emailTemplates = [];
|
|
68
|
+
yield Promise.all(constants_1.default.EMAIL_TEMPLATES_TYPES.map((name) => __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
try {
|
|
70
|
+
const template = yield this.client.emailTemplates.get({ name });
|
|
71
|
+
emailTemplates.push(template);
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
// Ignore if not found, else throw error
|
|
75
|
+
if (err.statusCode !== 404) {
|
|
76
|
+
throw err;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
})));
|
|
80
|
+
return emailTemplates;
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
updateOrCreate(emailTemplate) {
|
|
84
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
+
try {
|
|
86
|
+
const params = { name: emailTemplate[this.id] };
|
|
87
|
+
const updated = yield this.client.emailTemplates.update(params, emailTemplate);
|
|
88
|
+
delete updated.body;
|
|
89
|
+
this.didUpdate(updated);
|
|
90
|
+
this.updated += 1;
|
|
91
|
+
}
|
|
92
|
+
catch (err) {
|
|
93
|
+
if (err.statusCode === 404) {
|
|
94
|
+
// Create if it does not exist
|
|
95
|
+
const created = yield this.client.emailTemplates.create(emailTemplate);
|
|
96
|
+
delete created.body;
|
|
97
|
+
this.didCreate(created);
|
|
98
|
+
this.created += 1;
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
throw err;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
// Run after email provider changes
|
|
107
|
+
processChanges(assets) {
|
|
108
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
109
|
+
const { emailTemplates } = assets;
|
|
110
|
+
// Do nothing if not set
|
|
111
|
+
if (!emailTemplates || !emailTemplates.length)
|
|
112
|
+
return;
|
|
113
|
+
yield Promise.all(emailTemplates.map((emailTemplate) => __awaiter(this, void 0, void 0, function* () {
|
|
114
|
+
yield this.updateOrCreate(emailTemplate);
|
|
115
|
+
})));
|
|
55
116
|
});
|
|
56
|
-
emailTemplates.push(template);
|
|
57
|
-
} catch (err) {
|
|
58
|
-
if (err.statusCode !== 404) {
|
|
59
|
-
throw err;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}));
|
|
63
|
-
return emailTemplates;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
async updateOrCreate(emailTemplate) {
|
|
67
|
-
try {
|
|
68
|
-
const params = {
|
|
69
|
-
name: emailTemplate[this.id]
|
|
70
|
-
};
|
|
71
|
-
const updated = await this.client.emailTemplates.update(params, emailTemplate);
|
|
72
|
-
delete updated.body;
|
|
73
|
-
this.didUpdate(updated);
|
|
74
|
-
this.updated += 1;
|
|
75
|
-
} catch (err) {
|
|
76
|
-
if (err.statusCode === 404) {
|
|
77
|
-
const created = await this.client.emailTemplates.create(emailTemplate);
|
|
78
|
-
delete created.body;
|
|
79
|
-
this.didCreate(created);
|
|
80
|
-
this.created += 1;
|
|
81
|
-
} else {
|
|
82
|
-
throw err;
|
|
83
|
-
}
|
|
84
117
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
} = assets;
|
|
91
|
-
if (!emailTemplates || !emailTemplates.length) return;
|
|
92
|
-
await Promise.all(emailTemplates.map(async emailTemplate => {
|
|
93
|
-
await this.updateOrCreate(emailTemplate);
|
|
94
|
-
}));
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
}, (_applyDecoratedDescriptor(_class.prototype, "processChanges", [_dec], Object.getOwnPropertyDescriptor(_class.prototype, "processChanges"), _class.prototype)), _class));
|
|
98
|
-
exports.default = EmailTemplateHandler;
|
|
118
|
+
}
|
|
119
|
+
__decorate([
|
|
120
|
+
(0, default_1.order)('60')
|
|
121
|
+
], EmailTemplateHandler.prototype, "processChanges", null);
|
|
122
|
+
exports.default = EmailTemplateHandler;
|
|
@@ -1,86 +1,71 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _default2 = _interopRequireDefault(_default);
|
|
11
|
-
|
|
12
|
-
var _constants = require("../../constants");
|
|
13
|
-
|
|
14
|
-
var _constants2 = _interopRequireDefault(_constants);
|
|
15
|
-
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
|
-
const mappings = Object.entries(_constants2.default.GUARDIAN_FACTOR_PROVIDERS).reduce((accum, [name, providers]) => {
|
|
19
|
-
providers.forEach(p => {
|
|
20
|
-
accum.push({
|
|
21
|
-
name,
|
|
22
|
-
provider: p
|
|
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());
|
|
23
9
|
});
|
|
24
|
-
});
|
|
25
|
-
return accum;
|
|
26
|
-
}, []);
|
|
27
|
-
const schema = exports.schema = {
|
|
28
|
-
type: 'array',
|
|
29
|
-
items: {
|
|
30
|
-
type: 'object',
|
|
31
|
-
properties: {
|
|
32
|
-
name: {
|
|
33
|
-
type: 'string',
|
|
34
|
-
enum: _constants2.default.GUARDIAN_FACTORS
|
|
35
|
-
},
|
|
36
|
-
provider: {
|
|
37
|
-
type: 'string',
|
|
38
|
-
enum: mappings.map(p => p.provider)
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
required: ['name', 'provider']
|
|
42
|
-
}
|
|
43
10
|
};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
+
const constants_1 = __importDefault(require("../../constants"));
|
|
18
|
+
const mappings = Object.entries(constants_1.default.GUARDIAN_FACTOR_PROVIDERS).reduce((accum, [name, providers]) => {
|
|
19
|
+
providers.forEach((p) => {
|
|
20
|
+
accum.push({ name, provider: p });
|
|
50
21
|
});
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
22
|
+
return accum;
|
|
23
|
+
}, []);
|
|
24
|
+
exports.schema = {
|
|
25
|
+
type: 'array',
|
|
26
|
+
items: {
|
|
27
|
+
type: 'object',
|
|
28
|
+
properties: {
|
|
29
|
+
name: { type: 'string', enum: constants_1.default.GUARDIAN_FACTORS },
|
|
30
|
+
provider: { type: 'string', enum: mappings.map((p) => p.provider) }
|
|
31
|
+
},
|
|
32
|
+
required: ['name', 'provider']
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
class GuardianFactorProvidersHandler extends default_1.default {
|
|
36
|
+
constructor(options) {
|
|
37
|
+
super(Object.assign(Object.assign({}, options), { type: 'guardianFactorProviders', id: 'name' }));
|
|
38
|
+
}
|
|
39
|
+
getType() {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
if (this.existing)
|
|
42
|
+
return this.existing;
|
|
43
|
+
const data = yield Promise.all(mappings.map((m) => __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
const provider = yield this.client.guardian.getFactorProvider(m);
|
|
45
|
+
return Object.assign(Object.assign({}, m), provider);
|
|
46
|
+
})));
|
|
47
|
+
// Filter out empty, should have more then 2 keys (name, provider)
|
|
48
|
+
return data.filter((d) => Object.keys(d).length > 2);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
processChanges(assets) {
|
|
52
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
// No API to delete or create guardianFactorProviders, we can only update.
|
|
54
|
+
const { guardianFactorProviders } = assets;
|
|
55
|
+
// Do nothing if not set
|
|
56
|
+
if (!guardianFactorProviders || !guardianFactorProviders.length)
|
|
57
|
+
return;
|
|
58
|
+
// Process each factor
|
|
59
|
+
yield Promise.all(guardianFactorProviders.map((factorProvider) => __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
const data = Object.assign({}, factorProvider);
|
|
61
|
+
const params = { name: factorProvider.name, provider: factorProvider.provider };
|
|
62
|
+
delete data.name;
|
|
63
|
+
delete data.provider;
|
|
64
|
+
yield this.client.guardian.updateFactorProvider(params, data);
|
|
65
|
+
this.didUpdate(params);
|
|
66
|
+
this.updated += 1;
|
|
67
|
+
})));
|
|
68
|
+
});
|
|
69
|
+
}
|
|
84
70
|
}
|
|
85
|
-
|
|
86
|
-
exports.default = GuardianFactorProvidersHandler;
|
|
71
|
+
exports.default = GuardianFactorProvidersHandler;
|
|
@@ -1,74 +1,63 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _default2 = _interopRequireDefault(_default);
|
|
11
|
-
|
|
12
|
-
var _constants = require("../../constants");
|
|
13
|
-
|
|
14
|
-
var _constants2 = _interopRequireDefault(_constants);
|
|
15
|
-
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
|
-
const schema = exports.schema = {
|
|
19
|
-
type: 'array',
|
|
20
|
-
items: {
|
|
21
|
-
type: 'object',
|
|
22
|
-
properties: {
|
|
23
|
-
name: {
|
|
24
|
-
type: 'string',
|
|
25
|
-
enum: _constants2.default.GUARDIAN_FACTOR_TEMPLATES
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
required: ['name']
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
class GuardianFactorTemplatesHandler extends _default2.default {
|
|
33
|
-
constructor(options) {
|
|
34
|
-
super({ ...options,
|
|
35
|
-
type: 'guardianFactorTemplates',
|
|
36
|
-
id: 'name'
|
|
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());
|
|
37
9
|
});
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
+
const constants_1 = __importDefault(require("../../constants"));
|
|
18
|
+
exports.schema = {
|
|
19
|
+
type: 'array',
|
|
20
|
+
items: {
|
|
21
|
+
type: 'object',
|
|
22
|
+
properties: {
|
|
23
|
+
name: { type: 'string', enum: constants_1.default.GUARDIAN_FACTOR_TEMPLATES }
|
|
24
|
+
},
|
|
25
|
+
required: ['name']
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
class GuardianFactorTemplatesHandler extends default_1.default {
|
|
29
|
+
constructor(options) {
|
|
30
|
+
super(Object.assign(Object.assign({}, options), { type: 'guardianFactorTemplates', id: 'name' }));
|
|
31
|
+
}
|
|
32
|
+
getType() {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
if (this.existing)
|
|
35
|
+
return this.existing;
|
|
36
|
+
const data = yield Promise.all(constants_1.default.GUARDIAN_FACTOR_TEMPLATES.map((name) => __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
const templates = yield this.client.guardian.getFactorTemplates({ name });
|
|
38
|
+
return Object.assign({ name }, templates);
|
|
39
|
+
})));
|
|
40
|
+
// Filter out empty, should have more then 1 keys (name)
|
|
41
|
+
return data.filter((d) => Object.keys(d).length > 1);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
processChanges(assets) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
// No API to delete or create guardianFactorTemplates, we can only update.
|
|
47
|
+
const { guardianFactorTemplates } = assets;
|
|
48
|
+
// Do nothing if not set
|
|
49
|
+
if (!guardianFactorTemplates || !guardianFactorTemplates.length)
|
|
50
|
+
return;
|
|
51
|
+
// Process each factor templates
|
|
52
|
+
yield Promise.all(guardianFactorTemplates.map((fatorTemplates) => __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
const data = Object.assign({}, fatorTemplates);
|
|
54
|
+
const params = { name: fatorTemplates.name };
|
|
55
|
+
delete data.name;
|
|
56
|
+
yield this.client.guardian.updateFactorTemplates(params, data);
|
|
57
|
+
this.didUpdate(params);
|
|
58
|
+
this.updated += 1;
|
|
59
|
+
})));
|
|
60
|
+
});
|
|
61
|
+
}
|
|
72
62
|
}
|
|
73
|
-
|
|
74
|
-
exports.default = GuardianFactorTemplatesHandler;
|
|
63
|
+
exports.default = GuardianFactorTemplatesHandler;
|
|
@@ -1,66 +1,59 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _default2 = _interopRequireDefault(_default);
|
|
11
|
-
|
|
12
|
-
var _constants = require("../../constants");
|
|
13
|
-
|
|
14
|
-
var _constants2 = _interopRequireDefault(_constants);
|
|
15
|
-
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
|
-
const schema = exports.schema = {
|
|
19
|
-
type: 'array',
|
|
20
|
-
items: {
|
|
21
|
-
type: 'object',
|
|
22
|
-
properties: {
|
|
23
|
-
name: {
|
|
24
|
-
type: 'string',
|
|
25
|
-
enum: _constants2.default.GUARDIAN_FACTORS
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
required: ['name']
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
class GuardianFactorsHandler extends _default2.default {
|
|
33
|
-
constructor(options) {
|
|
34
|
-
super({ ...options,
|
|
35
|
-
type: 'guardianFactors',
|
|
36
|
-
id: 'name'
|
|
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());
|
|
37
9
|
});
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
+
const constants_1 = __importDefault(require("../../constants"));
|
|
18
|
+
exports.schema = {
|
|
19
|
+
type: 'array',
|
|
20
|
+
items: {
|
|
21
|
+
type: 'object',
|
|
22
|
+
properties: {
|
|
23
|
+
name: { type: 'string', enum: constants_1.default.GUARDIAN_FACTORS }
|
|
24
|
+
},
|
|
25
|
+
required: ['name']
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
class GuardianFactorsHandler extends default_1.default {
|
|
29
|
+
constructor(options) {
|
|
30
|
+
super(Object.assign(Object.assign({}, options), { type: 'guardianFactors', id: 'name' }));
|
|
31
|
+
}
|
|
32
|
+
getType() {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
if (this.existing)
|
|
35
|
+
return this.existing;
|
|
36
|
+
this.existing = yield this.client.guardian.getFactors();
|
|
37
|
+
return this.existing;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
processChanges(assets) {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
// No API to delete or create guardianFactors, we can only update.
|
|
43
|
+
const { guardianFactors } = assets;
|
|
44
|
+
// Do nothing if not set
|
|
45
|
+
if (!guardianFactors || !guardianFactors.length)
|
|
46
|
+
return;
|
|
47
|
+
// Process each factor
|
|
48
|
+
yield Promise.all(guardianFactors.map((factor) => __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
const data = Object.assign({}, factor);
|
|
50
|
+
const params = { name: factor.name };
|
|
51
|
+
delete data.name;
|
|
52
|
+
yield this.client.guardian.updateFactor(params, data);
|
|
53
|
+
this.didUpdate(params);
|
|
54
|
+
this.updated += 1;
|
|
55
|
+
})));
|
|
56
|
+
});
|
|
57
|
+
}
|
|
64
58
|
}
|
|
65
|
-
|
|
66
|
-
exports.default = GuardianFactorsHandler;
|
|
59
|
+
exports.default = GuardianFactorsHandler;
|