auth0-deploy-cli 7.4.0 → 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 +2 -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 +13 -1
- 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 -243
- 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 +255 -282
- package/lib/utils.js +167 -190
- package/package.json +4 -3
- package/tsconfig.json +96 -0
- package/typescript-migration-progress.sh +22 -0
- package/.nyc_output/597f412e-a239-4319-ad5b-ddb87fc39e67.json +0 -1
- package/.nyc_output/processinfo/597f412e-a239-4319-ad5b-ddb87fc39e67.json +0 -1
|
@@ -1,164 +1,126 @@
|
|
|
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 supportedPages = exports.supportedPages = _constants2.default.PAGE_NAMES.filter(p => p.includes('.json')).map(p => p.replace('.json', ''));
|
|
19
|
-
|
|
20
|
-
const pageNameMap = exports.pageNameMap = {
|
|
21
|
-
guardian_multifactor: 'guardian_mfa_page',
|
|
22
|
-
password_reset: 'change_password',
|
|
23
|
-
error_page: 'error_page'
|
|
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
|
+
});
|
|
24
10
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
items: {
|
|
28
|
-
type: 'object',
|
|
29
|
-
properties: {
|
|
30
|
-
name: {
|
|
31
|
-
type: 'string',
|
|
32
|
-
enum: supportedPages
|
|
33
|
-
},
|
|
34
|
-
html: {
|
|
35
|
-
type: 'string',
|
|
36
|
-
default: ''
|
|
37
|
-
},
|
|
38
|
-
url: {
|
|
39
|
-
type: 'string'
|
|
40
|
-
},
|
|
41
|
-
show_log_link: {
|
|
42
|
-
type: 'boolean'
|
|
43
|
-
},
|
|
44
|
-
enabled: {
|
|
45
|
-
type: 'boolean'
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
required: ['name']
|
|
49
|
-
}
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
50
13
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.schema = exports.pageNameMap = exports.supportedPages = void 0;
|
|
16
|
+
const default_1 = __importDefault(require("./default"));
|
|
17
|
+
const constants_1 = __importDefault(require("../../constants"));
|
|
18
|
+
exports.supportedPages = constants_1.default.PAGE_NAMES
|
|
19
|
+
.filter((p) => p.includes('.json'))
|
|
20
|
+
.map((p) => p.replace('.json', ''));
|
|
21
|
+
exports.pageNameMap = {
|
|
22
|
+
guardian_multifactor: 'guardian_mfa_page',
|
|
23
|
+
password_reset: 'change_password',
|
|
24
|
+
error_page: 'error_page'
|
|
25
|
+
};
|
|
26
|
+
// With this schema, we can only validate property types but not valid properties on per type basis
|
|
27
|
+
exports.schema = {
|
|
28
|
+
type: 'array',
|
|
29
|
+
items: {
|
|
30
|
+
type: 'object',
|
|
31
|
+
properties: {
|
|
32
|
+
name: { type: 'string', enum: exports.supportedPages },
|
|
33
|
+
html: { type: 'string', default: '' },
|
|
34
|
+
url: { type: 'string' },
|
|
35
|
+
show_log_link: { type: 'boolean' },
|
|
36
|
+
enabled: { type: 'boolean' }
|
|
37
|
+
},
|
|
38
|
+
required: ['name']
|
|
75
39
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
custom_login_page: page.html,
|
|
81
|
-
custom_login_page_on: page.enabled
|
|
82
|
-
});
|
|
83
|
-
this.updated += 1;
|
|
84
|
-
this.didUpdate(page);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
async updatePages(pages) {
|
|
88
|
-
const toUpdate = pages.filter(p => supportedPages.includes(p.name));
|
|
89
|
-
const update = toUpdate.reduce((accum, page) => {
|
|
90
|
-
if (supportedPages.includes(page.name)) {
|
|
91
|
-
const pageName = pageNameMap[page.name];
|
|
92
|
-
|
|
93
|
-
if (!pageName) {
|
|
94
|
-
throw new Error(`Unable to map page ${page.name} into tenant level page setting`);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
accum[pageName] = { ...page
|
|
98
|
-
};
|
|
99
|
-
delete accum[pageName].name;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return accum;
|
|
103
|
-
}, {});
|
|
104
|
-
|
|
105
|
-
if (Object.keys(update).length) {
|
|
106
|
-
await this.client.tenant.updateSettings(update);
|
|
40
|
+
};
|
|
41
|
+
class PageHandler extends default_1.default {
|
|
42
|
+
constructor(options) {
|
|
43
|
+
super(Object.assign(Object.assign({}, options), { type: 'pages' }));
|
|
107
44
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
this.updated += 1;
|
|
111
|
-
this.didUpdate(page);
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
async getType() {
|
|
116
|
-
const pages = [];
|
|
117
|
-
const globalClient = await this.client.clients.getAll({
|
|
118
|
-
is_global: true,
|
|
119
|
-
paginate: true,
|
|
120
|
-
include_totals: true
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
if (!globalClient[0]) {
|
|
124
|
-
throw new Error('Unable to find global client id when trying to dump the login page');
|
|
45
|
+
objString(page) {
|
|
46
|
+
return super.objString({ name: page.name, enabled: page.enabled });
|
|
125
47
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
48
|
+
updateLoginPage(page) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const globalClient = yield this.client.clients.getAll({ is_global: true, paginate: true, include_totals: true });
|
|
51
|
+
if (!globalClient[0]) {
|
|
52
|
+
throw new Error('Unable to find global client id when trying to update the login page');
|
|
53
|
+
}
|
|
54
|
+
yield this.client.clients.update({ client_id: globalClient[0].client_id }, {
|
|
55
|
+
custom_login_page: page.html,
|
|
56
|
+
custom_login_page_on: page.enabled
|
|
57
|
+
});
|
|
58
|
+
this.updated += 1;
|
|
59
|
+
this.didUpdate(page);
|
|
60
|
+
});
|
|
133
61
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
62
|
+
updatePages(pages) {
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
const toUpdate = pages.filter((p) => exports.supportedPages.includes(p.name));
|
|
65
|
+
const update = toUpdate.reduce((accum, page) => {
|
|
66
|
+
if (exports.supportedPages.includes(page.name)) {
|
|
67
|
+
const pageName = exports.pageNameMap[page.name];
|
|
68
|
+
if (!pageName) {
|
|
69
|
+
throw new Error(`Unable to map page ${page.name} into tenant level page setting`);
|
|
70
|
+
}
|
|
71
|
+
accum[pageName] = Object.assign({}, page);
|
|
72
|
+
delete accum[pageName].name;
|
|
73
|
+
}
|
|
74
|
+
return accum;
|
|
75
|
+
}, {});
|
|
76
|
+
if (Object.keys(update).length) {
|
|
77
|
+
yield this.client.tenant.updateSettings(update);
|
|
78
|
+
}
|
|
79
|
+
toUpdate.forEach((page) => {
|
|
80
|
+
this.updated += 1;
|
|
81
|
+
this.didUpdate(page);
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
getType() {
|
|
86
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
const pages = [];
|
|
88
|
+
// Login page is handled via the global client
|
|
89
|
+
const globalClient = yield this.client.clients.getAll({ is_global: true, paginate: true, include_totals: true });
|
|
90
|
+
if (!globalClient[0]) {
|
|
91
|
+
throw new Error('Unable to find global client id when trying to dump the login page');
|
|
92
|
+
}
|
|
93
|
+
if (globalClient[0].custom_login_page) {
|
|
94
|
+
pages.push({
|
|
95
|
+
name: 'login',
|
|
96
|
+
enabled: globalClient[0].custom_login_page_on,
|
|
97
|
+
html: globalClient[0].custom_login_page
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
const tenantSettings = yield this.client.tenant.getSettings();
|
|
101
|
+
Object.entries(exports.pageNameMap).forEach(([key, name]) => {
|
|
102
|
+
const page = tenantSettings[name];
|
|
103
|
+
if (tenantSettings[name]) {
|
|
104
|
+
pages.push(Object.assign(Object.assign({}, page), { name: key }));
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
return pages;
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
processChanges(assets) {
|
|
111
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
const { pages } = assets;
|
|
113
|
+
// Do nothing if not set
|
|
114
|
+
if (!pages)
|
|
115
|
+
return;
|
|
116
|
+
// Login page is handled via the global client
|
|
117
|
+
const loginPage = pages.find((p) => p.name === 'login');
|
|
118
|
+
if (loginPage) {
|
|
119
|
+
yield this.updateLoginPage(loginPage);
|
|
120
|
+
}
|
|
121
|
+
// Rest of pages are on tenant level settings
|
|
122
|
+
yield this.updatePages(pages.filter((p) => p.name !== 'login'));
|
|
142
123
|
});
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
return pages;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
async processChanges(assets) {
|
|
149
|
-
const {
|
|
150
|
-
pages
|
|
151
|
-
} = assets;
|
|
152
|
-
if (!pages) return;
|
|
153
|
-
const loginPage = pages.find(p => p.name === 'login');
|
|
154
|
-
|
|
155
|
-
if (loginPage) {
|
|
156
|
-
await this.updateLoginPage(loginPage);
|
|
157
124
|
}
|
|
158
|
-
|
|
159
|
-
await this.updatePages(pages.filter(p => p.name !== 'login'));
|
|
160
|
-
}
|
|
161
|
-
|
|
162
125
|
}
|
|
163
|
-
|
|
164
|
-
exports.default = PageHandler;
|
|
126
|
+
exports.default = PageHandler;
|
|
@@ -1,51 +1,52 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _default2 = _interopRequireDefault(_default);
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
const schema = exports.schema = {
|
|
15
|
-
type: 'object'
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
class PromptsHandler extends _default2.default {
|
|
19
|
-
constructor(options) {
|
|
20
|
-
super({ ...options,
|
|
21
|
-
type: 'prompts'
|
|
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());
|
|
22
9
|
});
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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 = { type: 'object' };
|
|
18
|
+
class PromptsHandler extends default_1.default {
|
|
19
|
+
constructor(options) {
|
|
20
|
+
super(Object.assign(Object.assign({}, options), { type: 'prompts' }));
|
|
21
|
+
}
|
|
22
|
+
getType() {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
// in case client version does not support branding
|
|
25
|
+
if (!this.client.prompts || typeof this.client.prompts.getSettings !== 'function') {
|
|
26
|
+
return {};
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
return yield this.client.prompts.getSettings();
|
|
30
|
+
}
|
|
31
|
+
catch (err) {
|
|
32
|
+
if (err.statusCode === 404)
|
|
33
|
+
return {};
|
|
34
|
+
if (err.statusCode === 501)
|
|
35
|
+
return {};
|
|
36
|
+
throw err;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
28
39
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
40
|
+
processChanges(assets) {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
const { prompts } = assets;
|
|
43
|
+
// Do nothing if not set
|
|
44
|
+
if (!prompts || !Object.keys(prompts).length)
|
|
45
|
+
return;
|
|
46
|
+
yield this.client.prompts.updateSettings({}, prompts);
|
|
47
|
+
this.updated += 1;
|
|
48
|
+
this.didUpdate(prompts);
|
|
49
|
+
});
|
|
36
50
|
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
async processChanges(assets) {
|
|
40
|
-
const {
|
|
41
|
-
prompts
|
|
42
|
-
} = assets;
|
|
43
|
-
if (!prompts || !Object.keys(prompts).length) return;
|
|
44
|
-
await this.client.prompts.updateSettings({}, prompts);
|
|
45
|
-
this.updated += 1;
|
|
46
|
-
this.didUpdate(prompts);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
51
|
}
|
|
50
|
-
|
|
51
|
-
exports.default = PromptsHandler;
|
|
52
|
+
exports.default = PromptsHandler;
|
|
@@ -1,118 +1,94 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var _constants2 = _interopRequireDefault(_constants);
|
|
15
|
-
|
|
16
|
-
var _default = require("./default");
|
|
17
|
-
|
|
18
|
-
var _default2 = _interopRequireDefault(_default);
|
|
19
|
-
|
|
20
|
-
var _utils = require("../../utils");
|
|
21
|
-
|
|
22
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
-
|
|
24
|
-
const excludeSchema = exports.excludeSchema = {
|
|
25
|
-
type: 'array',
|
|
26
|
-
items: {
|
|
27
|
-
type: 'string'
|
|
28
|
-
}
|
|
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 };
|
|
29
13
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.schema = exports.excludeSchema = void 0;
|
|
16
|
+
const ValidationError_1 = __importDefault(require("../../ValidationError"));
|
|
17
|
+
const constants_1 = __importDefault(require("../../constants"));
|
|
18
|
+
const default_1 = __importDefault(require("./default"));
|
|
19
|
+
const utils_1 = require("../../utils");
|
|
20
|
+
exports.excludeSchema = {
|
|
21
|
+
type: 'array',
|
|
22
|
+
items: { type: 'string' }
|
|
23
|
+
};
|
|
24
|
+
exports.schema = {
|
|
25
|
+
type: 'array',
|
|
26
|
+
items: {
|
|
27
|
+
type: 'object',
|
|
28
|
+
properties: {
|
|
29
|
+
name: { type: 'string' },
|
|
30
|
+
identifier: { type: 'string' },
|
|
31
|
+
scopes: {
|
|
32
|
+
type: 'array',
|
|
33
|
+
items: {
|
|
34
|
+
type: 'object',
|
|
35
|
+
properties: {
|
|
36
|
+
name: { type: 'string' },
|
|
37
|
+
description: { type: 'string' }
|
|
38
|
+
}
|
|
39
|
+
}
|
|
48
40
|
},
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
},
|
|
55
|
-
enforce_policies: {
|
|
56
|
-
type: 'boolean'
|
|
57
|
-
},
|
|
58
|
-
token_dialect: {
|
|
59
|
-
type: 'string'
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
required: ['name', 'identifier']
|
|
63
|
-
}
|
|
41
|
+
enforce_policies: { type: 'boolean' },
|
|
42
|
+
token_dialect: { type: 'string' }
|
|
43
|
+
},
|
|
44
|
+
required: ['name', 'identifier']
|
|
45
|
+
}
|
|
64
46
|
};
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
throw new _ValidationError2.default(`You can not configure the '${_constants2.default.RESOURCE_SERVERS_MANAGEMENT_API_NAME}'.`);
|
|
47
|
+
class ResourceServersHandler extends default_1.default {
|
|
48
|
+
constructor(options) {
|
|
49
|
+
super(Object.assign(Object.assign({}, options), { type: 'resourceServers', stripUpdateFields: ['identifier'] // Fields not allowed in updates
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
objString(resourceServer) {
|
|
53
|
+
return super.objString({ name: resourceServer.name, identifier: resourceServer.identifier });
|
|
54
|
+
}
|
|
55
|
+
getType() {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
if (this.existing)
|
|
58
|
+
return this.existing;
|
|
59
|
+
const resourceServers = yield this.client.resourceServers.getAll({ paginate: true, include_totals: true });
|
|
60
|
+
return resourceServers.filter((rs) => rs.name !== constants_1.default.RESOURCE_SERVERS_MANAGEMENT_API_NAME);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
calcChanges(assets) {
|
|
64
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
+
let { resourceServers } = assets;
|
|
66
|
+
// Do nothing if not set
|
|
67
|
+
if (!resourceServers)
|
|
68
|
+
return {};
|
|
69
|
+
const excluded = (assets.exclude && assets.exclude.resourceServers) || [];
|
|
70
|
+
let existing = yield this.getType();
|
|
71
|
+
// Filter excluded
|
|
72
|
+
resourceServers = resourceServers.filter((r) => !excluded.includes(r.name));
|
|
73
|
+
existing = existing.filter((r) => !excluded.includes(r.name));
|
|
74
|
+
return (0, utils_1.calcChanges)(this, resourceServers, existing, ['id', 'identifier']);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
validate(assets) {
|
|
78
|
+
const _super = Object.create(null, {
|
|
79
|
+
validate: { get: () => super.validate }
|
|
80
|
+
});
|
|
81
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
const { resourceServers } = assets;
|
|
83
|
+
// Do nothing if not set
|
|
84
|
+
if (!resourceServers)
|
|
85
|
+
return;
|
|
86
|
+
const mgmtAPIResource = resourceServers.find((r) => r.name === constants_1.default.RESOURCE_SERVERS_MANAGEMENT_API_NAME);
|
|
87
|
+
if (mgmtAPIResource) {
|
|
88
|
+
throw new ValidationError_1.default(`You can not configure the '${constants_1.default.RESOURCE_SERVERS_MANAGEMENT_API_NAME}'.`);
|
|
89
|
+
}
|
|
90
|
+
yield _super.validate.call(this, assets);
|
|
91
|
+
});
|
|
111
92
|
}
|
|
112
|
-
|
|
113
|
-
await super.validate(assets);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
93
|
}
|
|
117
|
-
|
|
118
|
-
exports.default = ResourceServersHandler;
|
|
94
|
+
exports.default = ResourceServersHandler;
|