auth0-deploy-cli 7.3.7 → 7.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.circleci/config.yml +15 -0
- package/.eslintrc +66 -17
- package/.github/CODEOWNERS +1 -0
- package/.husky/pre-commit +6 -0
- package/.husky/pre-push +4 -0
- package/CHANGELOG.md +37 -2
- package/lib/args.js +94 -81
- package/lib/commands/export.js +54 -78
- package/lib/commands/import.js +46 -70
- 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 +258 -254
- package/lib/utils.js +167 -190
- package/package.json +13 -17
- package/tsconfig.json +17 -0
- package/typescript-migration-progress.sh +22 -0
- package/.babelrc +0 -17
- package/.nyc_output/32e2bffd-d561-4814-9aa3-fe929a1e178a.json +0 -1
- package/.nyc_output/processinfo/32e2bffd-d561-4814-9aa3-fe929a1e178a.json +0 -1
- package/.nyc_output/processinfo/index.json +0 -1
|
@@ -1,243 +1,217 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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 = exports.excludeSchema = void 0;
|
|
16
|
+
const default_1 = __importDefault(require("./default"));
|
|
17
|
+
const constants_1 = __importDefault(require("../../constants"));
|
|
18
18
|
const ALLOWED_TRIGGER_IDS = ['credentials-exchange', 'pre-user-registration', 'post-user-registration', 'post-change-password', 'send-phone-message'];
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
type: 'string'
|
|
23
|
-
}
|
|
19
|
+
exports.excludeSchema = {
|
|
20
|
+
type: 'array',
|
|
21
|
+
items: { type: 'string' }
|
|
24
22
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
type: 'object',
|
|
29
|
-
default: [],
|
|
30
|
-
properties: {
|
|
31
|
-
script: {
|
|
32
|
-
type: 'string',
|
|
33
|
-
description: 'A script that contains the hook\'s code',
|
|
34
|
-
default: ''
|
|
35
|
-
},
|
|
36
|
-
name: {
|
|
37
|
-
type: 'string',
|
|
38
|
-
description: 'The name of the hook. Can only contain alphanumeric characters, spaces and \'-\'. Can neither start nor end with \'-\' or spaces',
|
|
39
|
-
pattern: '^[^-\\s][a-zA-Z0-9-\\s]+[^-\\s]$'
|
|
40
|
-
},
|
|
41
|
-
enabled: {
|
|
42
|
-
type: 'boolean',
|
|
43
|
-
description: 'true if the hook is active, false otherwise',
|
|
44
|
-
default: false
|
|
45
|
-
},
|
|
46
|
-
triggerId: {
|
|
47
|
-
type: 'string',
|
|
48
|
-
description: 'The hooks\'s trigger ID',
|
|
49
|
-
enum: ALLOWED_TRIGGER_IDS
|
|
50
|
-
},
|
|
51
|
-
secrets: {
|
|
23
|
+
exports.schema = {
|
|
24
|
+
type: 'array',
|
|
25
|
+
items: {
|
|
52
26
|
type: 'object',
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
27
|
+
default: [],
|
|
28
|
+
properties: {
|
|
29
|
+
script: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
description: 'A script that contains the hook\'s code',
|
|
32
|
+
default: ''
|
|
33
|
+
},
|
|
34
|
+
name: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
description: 'The name of the hook. Can only contain alphanumeric characters, spaces and \'-\'. Can neither start nor end with \'-\' or spaces',
|
|
37
|
+
pattern: '^[^-\\s][a-zA-Z0-9-\\s]+[^-\\s]$'
|
|
38
|
+
},
|
|
39
|
+
enabled: {
|
|
40
|
+
type: 'boolean',
|
|
41
|
+
description: 'true if the hook is active, false otherwise',
|
|
42
|
+
default: false
|
|
43
|
+
},
|
|
44
|
+
triggerId: {
|
|
45
|
+
type: 'string',
|
|
46
|
+
description: 'The hooks\'s trigger ID',
|
|
47
|
+
enum: ALLOWED_TRIGGER_IDS
|
|
48
|
+
},
|
|
49
|
+
secrets: {
|
|
50
|
+
type: 'object',
|
|
51
|
+
description: 'List of key-value pairs containing secrets available to the hook.',
|
|
52
|
+
default: {}
|
|
53
|
+
},
|
|
54
|
+
dependencies: {
|
|
55
|
+
type: 'object',
|
|
56
|
+
default: {},
|
|
57
|
+
description: 'List of key-value pairs of NPM dependencies available to the hook.'
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
required: ['script', 'name', 'triggerId']
|
|
71
61
|
}
|
|
72
|
-
});
|
|
73
|
-
return result;
|
|
74
62
|
};
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return result;
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
class HooksHandler extends _default2.default {
|
|
85
|
-
constructor(options) {
|
|
86
|
-
super({ ...options,
|
|
87
|
-
type: 'hooks',
|
|
88
|
-
stripUpdateFields: ['id', 'triggerId']
|
|
63
|
+
const getCertainHook = (hooks, name, triggerId) => {
|
|
64
|
+
let result = null;
|
|
65
|
+
hooks.forEach((hook) => {
|
|
66
|
+
if (hook.name === name && hook.triggerId === triggerId) {
|
|
67
|
+
result = hook;
|
|
68
|
+
}
|
|
89
69
|
});
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
70
|
+
return result;
|
|
71
|
+
};
|
|
72
|
+
const getActive = (hooks) => {
|
|
73
|
+
const result = {};
|
|
74
|
+
ALLOWED_TRIGGER_IDS.forEach((type) => {
|
|
75
|
+
result[type] = hooks.filter((h) => h.active && h.triggerId === type);
|
|
96
76
|
});
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
hooks
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
77
|
+
return result;
|
|
78
|
+
};
|
|
79
|
+
class HooksHandler extends default_1.default {
|
|
80
|
+
constructor(options) {
|
|
81
|
+
super(Object.assign(Object.assign({}, options), { type: 'hooks', stripUpdateFields: ['id', 'triggerId'] }));
|
|
82
|
+
}
|
|
83
|
+
objString(hook) {
|
|
84
|
+
return super.objString({ name: hook.name, triggerId: hook.triggerId });
|
|
85
|
+
}
|
|
86
|
+
processSecrets(hooks) {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
const allHooks = yield this.getType(true);
|
|
89
|
+
const changes = {
|
|
90
|
+
create: [],
|
|
91
|
+
update: [],
|
|
92
|
+
del: []
|
|
93
|
+
};
|
|
94
|
+
hooks.forEach((hook) => {
|
|
95
|
+
const current = getCertainHook(allHooks, hook.name, hook.triggerId);
|
|
96
|
+
if (current) { // if the hook was deleted we don't care about its secrets
|
|
97
|
+
const oldSecrets = current.secrets || {};
|
|
98
|
+
const newSecrets = hook.secrets || {};
|
|
99
|
+
const create = {};
|
|
100
|
+
const update = {};
|
|
101
|
+
const del = [];
|
|
102
|
+
Object.keys(newSecrets).forEach((key) => {
|
|
103
|
+
if (!oldSecrets[key]) {
|
|
104
|
+
create[key] = newSecrets[key];
|
|
105
|
+
}
|
|
106
|
+
else if (newSecrets[key] !== constants_1.default.HOOKS_HIDDEN_SECRET_VALUE) {
|
|
107
|
+
update[key] = newSecrets[key];
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
Object.keys(oldSecrets).forEach((key) => {
|
|
111
|
+
if (!newSecrets[key]) {
|
|
112
|
+
del.push(key);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
if (Object.keys(create).length)
|
|
116
|
+
changes.create.push({ hookId: current.id, secrets: create });
|
|
117
|
+
if (Object.keys(update).length)
|
|
118
|
+
changes.update.push({ hookId: current.id, secrets: update });
|
|
119
|
+
if (del.length)
|
|
120
|
+
changes.del.push({ hookId: current.id, secrets: del });
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
yield Promise.all(changes.del.map((data) => __awaiter(this, void 0, void 0, function* () {
|
|
124
|
+
yield this.client.hooks.removeSecrets({ id: data.hookId }, data.secrets);
|
|
125
|
+
})));
|
|
126
|
+
yield Promise.all(changes.update.map((data) => __awaiter(this, void 0, void 0, function* () {
|
|
127
|
+
yield this.client.hooks.updateSecrets({ id: data.hookId }, data.secrets);
|
|
128
|
+
})));
|
|
129
|
+
yield Promise.all(changes.create.map((data) => __awaiter(this, void 0, void 0, function* () {
|
|
130
|
+
yield this.client.hooks.addSecrets({ id: data.hookId }, data.secrets);
|
|
131
|
+
})));
|
|
126
132
|
});
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
133
|
+
}
|
|
134
|
+
getType(reload) {
|
|
135
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
136
|
+
if (this.existing && !reload) {
|
|
137
|
+
return this.existing;
|
|
138
|
+
}
|
|
139
|
+
// in case client version does not support hooks
|
|
140
|
+
if (!this.client.hooks || typeof this.client.hooks.getAll !== 'function') {
|
|
141
|
+
return [];
|
|
142
|
+
}
|
|
143
|
+
try {
|
|
144
|
+
const hooks = yield this.client.hooks.getAll({ paginate: true, include_totals: true });
|
|
145
|
+
// hooks.getAll does not return code and secrets, we have to fetch hooks one-by-one
|
|
146
|
+
this.existing = yield Promise.all(hooks.map((hook) => this.client.hooks.get({ id: hook.id })
|
|
147
|
+
.then((hookWithCode) => this.client.hooks.getSecrets({ id: hook.id })
|
|
148
|
+
.then((secrets) => (Object.assign(Object.assign({}, hookWithCode), { secrets }))))));
|
|
149
|
+
return this.existing;
|
|
150
|
+
}
|
|
151
|
+
catch (err) {
|
|
152
|
+
if (err.statusCode === 404 || err.statusCode === 501) {
|
|
153
|
+
return [];
|
|
154
|
+
}
|
|
155
|
+
throw err;
|
|
156
|
+
}
|
|
130
157
|
});
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
158
|
+
}
|
|
159
|
+
calcChanges(assets) {
|
|
160
|
+
const _super = Object.create(null, {
|
|
161
|
+
calcChanges: { get: () => super.calcChanges }
|
|
134
162
|
});
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
163
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
164
|
+
const { del, update, create, conflicts } = yield _super.calcChanges.call(this, assets);
|
|
165
|
+
// strip secrets before hooks creating/updating, secrets have to be handled separately
|
|
166
|
+
const stripSecrets = (list) => list.map((item) => (Object.assign(Object.assign({}, item), { secrets: undefined })));
|
|
167
|
+
return {
|
|
168
|
+
del,
|
|
169
|
+
update: stripSecrets(update),
|
|
170
|
+
create: stripSecrets(create),
|
|
171
|
+
conflicts: stripSecrets(conflicts)
|
|
172
|
+
};
|
|
138
173
|
});
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
await Promise.all(changes.del.map(async data => {
|
|
142
|
-
await this.client.hooks.removeSecrets({
|
|
143
|
-
id: data.hookId
|
|
144
|
-
}, data.secrets);
|
|
145
|
-
}));
|
|
146
|
-
await Promise.all(changes.update.map(async data => {
|
|
147
|
-
await this.client.hooks.updateSecrets({
|
|
148
|
-
id: data.hookId
|
|
149
|
-
}, data.secrets);
|
|
150
|
-
}));
|
|
151
|
-
await Promise.all(changes.create.map(async data => {
|
|
152
|
-
await this.client.hooks.addSecrets({
|
|
153
|
-
id: data.hookId
|
|
154
|
-
}, data.secrets);
|
|
155
|
-
}));
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
async getType(reload) {
|
|
159
|
-
if (this.existing && !reload) {
|
|
160
|
-
return this.existing;
|
|
161
174
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
175
|
+
validate(assets) {
|
|
176
|
+
const _super = Object.create(null, {
|
|
177
|
+
validate: { get: () => super.validate }
|
|
178
|
+
});
|
|
179
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
180
|
+
const { hooks } = assets;
|
|
181
|
+
// Do nothing if not set
|
|
182
|
+
if (!hooks)
|
|
183
|
+
return;
|
|
184
|
+
const activeHooks = getActive(hooks);
|
|
185
|
+
ALLOWED_TRIGGER_IDS.forEach((type) => {
|
|
186
|
+
if (activeHooks[type].length > 1) { // There can be only one!
|
|
187
|
+
const conflict = activeHooks[type].map((h) => h.name).join(', ');
|
|
188
|
+
const err = new Error(`Only one active hook allowed for "${type}" extensibility point. Conflicting hooks: ${conflict}`);
|
|
189
|
+
err.status = 409;
|
|
190
|
+
throw err;
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
yield _super.validate.call(this, assets);
|
|
194
|
+
});
|
|
165
195
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
throw err;
|
|
196
|
+
processChanges(assets) {
|
|
197
|
+
const _super = Object.create(null, {
|
|
198
|
+
processChanges: { get: () => super.processChanges }
|
|
199
|
+
});
|
|
200
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
201
|
+
const { hooks } = assets;
|
|
202
|
+
// Do nothing if not set
|
|
203
|
+
if (!hooks)
|
|
204
|
+
return;
|
|
205
|
+
// Figure out what needs to be updated vs created
|
|
206
|
+
const changes = yield this.calcChanges(assets);
|
|
207
|
+
yield _super.processChanges.call(this, assets, {
|
|
208
|
+
del: changes.del,
|
|
209
|
+
create: changes.create,
|
|
210
|
+
update: changes.update,
|
|
211
|
+
conflicts: changes.conflicts
|
|
212
|
+
});
|
|
213
|
+
yield this.processSecrets(hooks);
|
|
214
|
+
});
|
|
186
215
|
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
async calcChanges(assets) {
|
|
190
|
-
const {
|
|
191
|
-
del,
|
|
192
|
-
update,
|
|
193
|
-
create,
|
|
194
|
-
conflicts
|
|
195
|
-
} = await super.calcChanges(assets);
|
|
196
|
-
|
|
197
|
-
const stripSecrets = list => list.map(item => ({ ...item,
|
|
198
|
-
secrets: undefined
|
|
199
|
-
}));
|
|
200
|
-
|
|
201
|
-
return {
|
|
202
|
-
del,
|
|
203
|
-
update: stripSecrets(update),
|
|
204
|
-
create: stripSecrets(create),
|
|
205
|
-
conflicts: stripSecrets(conflicts)
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
async validate(assets) {
|
|
210
|
-
const {
|
|
211
|
-
hooks
|
|
212
|
-
} = assets;
|
|
213
|
-
if (!hooks) return;
|
|
214
|
-
const activeHooks = getActive(hooks);
|
|
215
|
-
ALLOWED_TRIGGER_IDS.forEach(type => {
|
|
216
|
-
if (activeHooks[type].length > 1) {
|
|
217
|
-
const conflict = activeHooks[type].map(h => h.name).join(', ');
|
|
218
|
-
const err = new Error(`Only one active hook allowed for "${type}" extensibility point. Conflicting hooks: ${conflict}`);
|
|
219
|
-
err.status = 409;
|
|
220
|
-
throw err;
|
|
221
|
-
}
|
|
222
|
-
});
|
|
223
|
-
await super.validate(assets);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
async processChanges(assets) {
|
|
227
|
-
const {
|
|
228
|
-
hooks
|
|
229
|
-
} = assets;
|
|
230
|
-
if (!hooks) return;
|
|
231
|
-
const changes = await this.calcChanges(assets);
|
|
232
|
-
await super.processChanges(assets, {
|
|
233
|
-
del: changes.del,
|
|
234
|
-
create: changes.create,
|
|
235
|
-
update: changes.update,
|
|
236
|
-
conflicts: changes.conflicts
|
|
237
|
-
});
|
|
238
|
-
await this.processSecrets(hooks);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
216
|
}
|
|
242
|
-
|
|
243
|
-
exports.default = HooksHandler;
|
|
217
|
+
exports.default = HooksHandler;
|
|
@@ -1,136 +1,78 @@
|
|
|
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
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var _hooks = require("./hooks");
|
|
17
|
-
|
|
18
|
-
var hooks = _interopRequireWildcard(_hooks);
|
|
19
|
-
|
|
20
|
-
var _pages = require("./pages");
|
|
21
|
-
|
|
22
|
-
var pages = _interopRequireWildcard(_pages);
|
|
23
|
-
|
|
24
|
-
var _resourceServers = require("./resourceServers");
|
|
25
|
-
|
|
26
|
-
var resourceServers = _interopRequireWildcard(_resourceServers);
|
|
27
|
-
|
|
28
|
-
var _databases = require("./databases");
|
|
29
|
-
|
|
30
|
-
var databases = _interopRequireWildcard(_databases);
|
|
31
|
-
|
|
32
|
-
var _connections = require("./connections");
|
|
33
|
-
|
|
34
|
-
var connections = _interopRequireWildcard(_connections);
|
|
35
|
-
|
|
36
|
-
var _clients = require("./clients");
|
|
37
|
-
|
|
38
|
-
var clients = _interopRequireWildcard(_clients);
|
|
39
|
-
|
|
40
|
-
var _tenant = require("./tenant");
|
|
41
|
-
|
|
42
|
-
var tenant = _interopRequireWildcard(_tenant);
|
|
43
|
-
|
|
44
|
-
var _emailProvider = require("./emailProvider");
|
|
45
|
-
|
|
46
|
-
var emailProvider = _interopRequireWildcard(_emailProvider);
|
|
47
|
-
|
|
48
|
-
var _emailTemplates = require("./emailTemplates");
|
|
49
|
-
|
|
50
|
-
var emailTemplates = _interopRequireWildcard(_emailTemplates);
|
|
51
|
-
|
|
52
|
-
var _clientGrants = require("./clientGrants");
|
|
53
|
-
|
|
54
|
-
var clientGrants = _interopRequireWildcard(_clientGrants);
|
|
55
|
-
|
|
56
|
-
var _guardianFactors = require("./guardianFactors");
|
|
57
|
-
|
|
58
|
-
var guardianFactors = _interopRequireWildcard(_guardianFactors);
|
|
59
|
-
|
|
60
|
-
var _guardianFactorProviders = require("./guardianFactorProviders");
|
|
61
|
-
|
|
62
|
-
var guardianFactorProviders = _interopRequireWildcard(_guardianFactorProviders);
|
|
63
|
-
|
|
64
|
-
var _guardianFactorTemplates = require("./guardianFactorTemplates");
|
|
65
|
-
|
|
66
|
-
var guardianFactorTemplates = _interopRequireWildcard(_guardianFactorTemplates);
|
|
67
|
-
|
|
68
|
-
var _guardianPolicies = require("./guardianPolicies");
|
|
69
|
-
|
|
70
|
-
var guardianPolicies = _interopRequireWildcard(_guardianPolicies);
|
|
71
|
-
|
|
72
|
-
var _guardianPhoneFactorSelectedProvider = require("./guardianPhoneFactorSelectedProvider");
|
|
73
|
-
|
|
74
|
-
var guardianPhoneFactorSelectedProvider = _interopRequireWildcard(_guardianPhoneFactorSelectedProvider);
|
|
75
|
-
|
|
76
|
-
var _guardianPhoneFactorMessageTypes = require("./guardianPhoneFactorMessageTypes");
|
|
77
|
-
|
|
78
|
-
var guardianPhoneFactorMessageTypes = _interopRequireWildcard(_guardianPhoneFactorMessageTypes);
|
|
79
|
-
|
|
80
|
-
var _roles = require("./roles");
|
|
81
|
-
|
|
82
|
-
var roles = _interopRequireWildcard(_roles);
|
|
83
|
-
|
|
84
|
-
var _branding = require("./branding");
|
|
85
|
-
|
|
86
|
-
var branding = _interopRequireWildcard(_branding);
|
|
87
|
-
|
|
88
|
-
var _prompts = require("./prompts");
|
|
89
|
-
|
|
90
|
-
var prompts = _interopRequireWildcard(_prompts);
|
|
91
|
-
|
|
92
|
-
var _migrations = require("./migrations");
|
|
93
|
-
|
|
94
|
-
var migrations = _interopRequireWildcard(_migrations);
|
|
95
|
-
|
|
96
|
-
var _actions = require("./actions");
|
|
97
|
-
|
|
98
|
-
var actions = _interopRequireWildcard(_actions);
|
|
99
|
-
|
|
100
|
-
var _triggers = require("./triggers");
|
|
101
|
-
|
|
102
|
-
var triggers = _interopRequireWildcard(_triggers);
|
|
103
|
-
|
|
104
|
-
var _organizations = require("./organizations");
|
|
105
|
-
|
|
106
|
-
var organizations = _interopRequireWildcard(_organizations);
|
|
107
|
-
|
|
108
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
109
|
-
|
|
110
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
111
|
-
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.attackProtection = exports.organizations = exports.triggers = exports.actions = exports.migrations = exports.prompts = exports.branding = exports.roles = exports.guardianPhoneFactorMessageTypes = exports.guardianPhoneFactorSelectedProvider = exports.guardianPolicies = exports.guardianFactorTemplates = exports.guardianFactorProviders = exports.guardianFactors = exports.clientGrants = exports.emailTemplates = exports.emailProvider = exports.tenant = exports.connections = exports.databases = exports.clients = exports.resourceServers = exports.pages = exports.hooks = exports.rulesConfigs = exports.rules = void 0;
|
|
27
|
+
const rules = __importStar(require("./rules"));
|
|
112
28
|
exports.rules = rules;
|
|
29
|
+
const rulesConfigs = __importStar(require("./rulesConfigs"));
|
|
113
30
|
exports.rulesConfigs = rulesConfigs;
|
|
31
|
+
const hooks = __importStar(require("./hooks"));
|
|
114
32
|
exports.hooks = hooks;
|
|
33
|
+
const pages = __importStar(require("./pages"));
|
|
115
34
|
exports.pages = pages;
|
|
35
|
+
const resourceServers = __importStar(require("./resourceServers"));
|
|
116
36
|
exports.resourceServers = resourceServers;
|
|
117
|
-
|
|
37
|
+
const databases = __importStar(require("./databases"));
|
|
118
38
|
exports.databases = databases;
|
|
39
|
+
const connections = __importStar(require("./connections"));
|
|
119
40
|
exports.connections = connections;
|
|
41
|
+
const clients = __importStar(require("./clients"));
|
|
42
|
+
exports.clients = clients;
|
|
43
|
+
const tenant = __importStar(require("./tenant"));
|
|
120
44
|
exports.tenant = tenant;
|
|
45
|
+
const emailProvider = __importStar(require("./emailProvider"));
|
|
121
46
|
exports.emailProvider = emailProvider;
|
|
47
|
+
const emailTemplates = __importStar(require("./emailTemplates"));
|
|
122
48
|
exports.emailTemplates = emailTemplates;
|
|
49
|
+
const clientGrants = __importStar(require("./clientGrants"));
|
|
123
50
|
exports.clientGrants = clientGrants;
|
|
51
|
+
const guardianFactors = __importStar(require("./guardianFactors"));
|
|
124
52
|
exports.guardianFactors = guardianFactors;
|
|
53
|
+
const guardianFactorProviders = __importStar(require("./guardianFactorProviders"));
|
|
125
54
|
exports.guardianFactorProviders = guardianFactorProviders;
|
|
55
|
+
const guardianFactorTemplates = __importStar(require("./guardianFactorTemplates"));
|
|
126
56
|
exports.guardianFactorTemplates = guardianFactorTemplates;
|
|
57
|
+
const guardianPolicies = __importStar(require("./guardianPolicies"));
|
|
127
58
|
exports.guardianPolicies = guardianPolicies;
|
|
59
|
+
const guardianPhoneFactorSelectedProvider = __importStar(require("./guardianPhoneFactorSelectedProvider"));
|
|
128
60
|
exports.guardianPhoneFactorSelectedProvider = guardianPhoneFactorSelectedProvider;
|
|
61
|
+
const guardianPhoneFactorMessageTypes = __importStar(require("./guardianPhoneFactorMessageTypes"));
|
|
129
62
|
exports.guardianPhoneFactorMessageTypes = guardianPhoneFactorMessageTypes;
|
|
63
|
+
const roles = __importStar(require("./roles"));
|
|
130
64
|
exports.roles = roles;
|
|
65
|
+
const branding = __importStar(require("./branding"));
|
|
131
66
|
exports.branding = branding;
|
|
67
|
+
const prompts = __importStar(require("./prompts"));
|
|
132
68
|
exports.prompts = prompts;
|
|
69
|
+
const migrations = __importStar(require("./migrations"));
|
|
133
70
|
exports.migrations = migrations;
|
|
71
|
+
const actions = __importStar(require("./actions"));
|
|
134
72
|
exports.actions = actions;
|
|
73
|
+
const triggers = __importStar(require("./triggers"));
|
|
135
74
|
exports.triggers = triggers;
|
|
136
|
-
|
|
75
|
+
const organizations = __importStar(require("./organizations"));
|
|
76
|
+
exports.organizations = organizations;
|
|
77
|
+
const attackProtection = __importStar(require("./attackProtection"));
|
|
78
|
+
exports.attackProtection = attackProtection;
|