auth0-deploy-cli 7.6.0 → 7.8.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/.eslintrc +7 -41
- package/.husky/pre-commit +4 -0
- package/.husky/pre-push +3 -1
- package/.prettierignore +10 -0
- package/.prettierrc.json +4 -0
- package/CHANGELOG.md +222 -7
- package/CONTRIBUTING.md +2 -2
- package/README.md +3 -0
- package/lib/args.d.ts +29 -0
- package/lib/args.js +16 -15
- package/lib/commands/export.d.ts +2 -0
- package/lib/commands/export.js +3 -3
- package/lib/commands/import.d.ts +2 -0
- package/lib/commands/import.js +6 -6
- package/lib/commands/index.d.ts +9 -0
- package/lib/commands/index.js +1 -1
- package/lib/configFactory.d.ts +7 -0
- package/lib/configFactory.js +5 -1
- package/lib/context/defaults.d.ts +1 -0
- package/lib/context/defaults.js +4 -3
- package/lib/context/directory/handlers/actions.d.ts +6 -0
- package/lib/context/directory/handlers/actions.js +3 -3
- package/lib/context/directory/handlers/attackProtection.d.ts +10 -0
- package/lib/context/directory/handlers/attackProtection.js +7 -7
- package/lib/context/directory/handlers/branding.d.ts +6 -0
- package/lib/context/directory/handlers/branding.js +6 -5
- package/lib/context/directory/handlers/clientGrants.d.ts +6 -0
- package/lib/context/directory/handlers/clientGrants.js +3 -2
- package/lib/context/directory/handlers/clients.d.ts +6 -0
- package/lib/context/directory/handlers/clients.js +1 -1
- package/lib/context/directory/handlers/connections.d.ts +6 -0
- package/lib/context/directory/handlers/connections.js +4 -2
- package/lib/context/directory/handlers/databases.d.ts +6 -0
- package/lib/context/directory/handlers/databases.js +13 -7
- package/lib/context/directory/handlers/emailProvider.d.ts +6 -0
- package/lib/context/directory/handlers/emailProvider.js +3 -2
- package/lib/context/directory/handlers/emailTemplates.d.ts +6 -0
- package/lib/context/directory/handlers/emailTemplates.js +2 -2
- package/lib/context/directory/handlers/guardianFactorProviders.d.ts +6 -0
- package/lib/context/directory/handlers/guardianFactorProviders.js +3 -2
- package/lib/context/directory/handlers/guardianFactorTemplates.d.ts +6 -0
- package/lib/context/directory/handlers/guardianFactorTemplates.js +3 -2
- package/lib/context/directory/handlers/guardianFactors.d.ts +6 -0
- package/lib/context/directory/handlers/guardianFactors.js +3 -2
- package/lib/context/directory/handlers/guardianPhoneFactorMessageTypes.d.ts +6 -0
- package/lib/context/directory/handlers/guardianPhoneFactorMessageTypes.js +1 -1
- package/lib/context/directory/handlers/guardianPhoneFactorSelectedProvider.d.ts +6 -0
- package/lib/context/directory/handlers/guardianPhoneFactorSelectedProvider.js +1 -1
- package/lib/context/directory/handlers/guardianPolicies.d.ts +6 -0
- package/lib/context/directory/handlers/guardianPolicies.js +1 -1
- package/lib/context/directory/handlers/hooks.d.ts +6 -0
- package/lib/context/directory/handlers/hooks.js +2 -2
- package/lib/context/directory/handlers/index.d.ts +12 -0
- package/lib/context/directory/handlers/index.js +3 -2
- package/lib/context/directory/handlers/migrations.d.ts +6 -0
- package/lib/context/directory/handlers/organizations.d.ts +6 -0
- package/lib/context/directory/handlers/organizations.js +1 -1
- package/lib/context/directory/handlers/pages.d.ts +6 -0
- package/lib/context/directory/handlers/pages.js +2 -2
- package/lib/context/directory/handlers/resourceServers.d.ts +6 -0
- package/lib/context/directory/handlers/resourceServers.js +3 -2
- package/lib/context/directory/handlers/roles.d.ts +6 -0
- package/lib/context/directory/handlers/roles.js +1 -1
- package/lib/context/directory/handlers/rules.d.ts +6 -0
- package/lib/context/directory/handlers/rules.js +2 -2
- package/lib/context/directory/handlers/rulesConfigs.d.ts +6 -0
- package/lib/context/directory/handlers/rulesConfigs.js +3 -2
- package/lib/context/directory/handlers/tenant.d.ts +10 -0
- package/lib/context/directory/handlers/tenant.js +3 -2
- package/lib/context/directory/handlers/triggers.d.ts +6 -0
- package/lib/context/directory/index.d.ts +17 -0
- package/lib/context/directory/index.js +21 -18
- package/lib/context/index.d.ts +4 -0
- package/lib/context/index.js +83 -61
- package/lib/context/yaml/handlers/actions.d.ts +6 -0
- package/lib/context/yaml/handlers/actions.js +9 -6
- package/lib/context/yaml/handlers/attackProtection.d.ts +6 -0
- package/lib/context/yaml/handlers/attackProtection.js +1 -1
- package/lib/context/yaml/handlers/branding.d.ts +6 -0
- package/lib/context/yaml/handlers/branding.js +5 -4
- package/lib/context/yaml/handlers/clientGrants.d.ts +6 -0
- package/lib/context/yaml/handlers/clientGrants.js +2 -2
- package/lib/context/yaml/handlers/clients.d.ts +6 -0
- package/lib/context/yaml/handlers/clients.js +6 -4
- package/lib/context/yaml/handlers/connections.d.ts +6 -0
- package/lib/context/yaml/handlers/connections.js +7 -5
- package/lib/context/yaml/handlers/databases.d.ts +6 -0
- package/lib/context/yaml/handlers/databases.js +12 -8
- package/lib/context/yaml/handlers/emailProvider.d.ts +6 -0
- package/lib/context/yaml/handlers/emailProvider.js +4 -3
- package/lib/context/yaml/handlers/emailTemplates.d.ts +6 -0
- package/lib/context/yaml/handlers/emailTemplates.js +3 -3
- package/lib/context/yaml/handlers/guardianFactorProviders.d.ts +6 -0
- package/lib/context/yaml/handlers/guardianFactorProviders.js +1 -1
- package/lib/context/yaml/handlers/guardianFactorTemplates.d.ts +6 -0
- package/lib/context/yaml/handlers/guardianFactorTemplates.js +1 -1
- package/lib/context/yaml/handlers/guardianFactors.d.ts +6 -0
- package/lib/context/yaml/handlers/guardianFactors.js +1 -1
- package/lib/context/yaml/handlers/guardianPhoneFactorMessageTypes.d.ts +6 -0
- package/lib/context/yaml/handlers/guardianPhoneFactorMessageTypes.js +1 -1
- package/lib/context/yaml/handlers/guardianPhoneFactorSelectedProvider.d.ts +6 -0
- package/lib/context/yaml/handlers/guardianPhoneFactorSelectedProvider.js +1 -1
- package/lib/context/yaml/handlers/guardianPolicies.d.ts +6 -0
- package/lib/context/yaml/handlers/guardianPolicies.js +1 -1
- package/lib/context/yaml/handlers/hooks.d.ts +6 -0
- package/lib/context/yaml/handlers/hooks.js +4 -3
- package/lib/context/yaml/handlers/index.d.ts +12 -0
- package/lib/context/yaml/handlers/index.js +3 -2
- package/lib/context/yaml/handlers/migrations.d.ts +6 -0
- package/lib/context/yaml/handlers/organizations.d.ts +6 -0
- package/lib/context/yaml/handlers/organizations.js +3 -3
- package/lib/context/yaml/handlers/pages.d.ts +6 -0
- package/lib/context/yaml/handlers/pages.js +3 -3
- package/lib/context/yaml/handlers/resourceServers.d.ts +6 -0
- package/lib/context/yaml/handlers/resourceServers.js +2 -2
- package/lib/context/yaml/handlers/roles.d.ts +6 -0
- package/lib/context/yaml/handlers/roles.js +3 -3
- package/lib/context/yaml/handlers/rules.d.ts +6 -0
- package/lib/context/yaml/handlers/rules.js +3 -3
- package/lib/context/yaml/handlers/rulesConfigs.d.ts +6 -0
- package/lib/context/yaml/handlers/rulesConfigs.js +2 -2
- package/lib/context/yaml/handlers/tenant.d.ts +6 -0
- package/lib/context/yaml/handlers/tenant.js +4 -3
- package/lib/context/yaml/handlers/triggers.d.ts +6 -0
- package/lib/context/yaml/handlers/triggers.js +2 -2
- package/lib/context/yaml/index.d.ts +13 -0
- package/lib/context/yaml/index.js +31 -23
- package/lib/index.d.ts +88 -0
- package/lib/index.js +25 -17
- package/lib/logger.d.ts +2 -0
- package/lib/logger.js +8 -17
- package/lib/readonly.d.ts +2 -0
- package/lib/readonly.js +11 -16
- package/lib/sessionDurationsToMinutes.d.ts +7 -0
- package/lib/sessionDurationsToMinutes.js +15 -0
- package/lib/tools/auth0/client.d.ts +2 -0
- package/lib/tools/auth0/client.js +12 -12
- package/lib/tools/auth0/handlers/actions.d.ts +95 -0
- package/lib/tools/auth0/handlers/actions.js +22 -24
- package/lib/tools/auth0/handlers/attackProtection.d.ts +28 -0
- package/lib/tools/auth0/handlers/attackProtection.js +14 -17
- package/lib/tools/auth0/handlers/branding.d.ts +27 -0
- package/lib/tools/auth0/handlers/branding.js +13 -9
- package/lib/tools/auth0/handlers/clientGrants.d.ts +32 -0
- package/lib/tools/auth0/handlers/clientGrants.js +17 -10
- package/lib/tools/auth0/handlers/clients.d.ts +23 -0
- package/lib/tools/auth0/handlers/clients.js +15 -8
- package/lib/tools/auth0/handlers/connections.d.ts +54 -0
- package/lib/tools/auth0/handlers/connections.js +30 -10
- package/lib/tools/auth0/handlers/databases.d.ts +36 -0
- package/lib/tools/auth0/handlers/databases.js +25 -13
- package/lib/tools/auth0/handlers/default.d.ts +54 -0
- package/lib/tools/auth0/handlers/default.js +62 -36
- package/lib/tools/auth0/handlers/emailProvider.d.ts +11 -0
- package/lib/tools/auth0/handlers/emailTemplates.d.ts +26 -0
- package/lib/tools/auth0/handlers/emailTemplates.js +8 -10
- package/lib/tools/auth0/handlers/guardianFactorProviders.d.ts +25 -0
- package/lib/tools/auth0/handlers/guardianFactorProviders.js +3 -3
- package/lib/tools/auth0/handlers/guardianFactorTemplates.d.ts +21 -0
- package/lib/tools/auth0/handlers/guardianFactorTemplates.js +3 -3
- package/lib/tools/auth0/handlers/guardianFactors.d.ts +21 -0
- package/lib/tools/auth0/handlers/guardianFactors.js +3 -3
- package/lib/tools/auth0/handlers/guardianPhoneFactorMessageTypes.d.ts +21 -0
- package/lib/tools/auth0/handlers/guardianPhoneFactorMessageTypes.js +11 -10
- package/lib/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.d.ts +18 -0
- package/lib/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.js +10 -9
- package/lib/tools/auth0/handlers/guardianPolicies.d.ts +23 -0
- package/lib/tools/auth0/handlers/guardianPolicies.js +5 -4
- package/lib/tools/auth0/handlers/hooks.d.ts +58 -0
- package/lib/tools/auth0/handlers/hooks.js +34 -21
- package/lib/tools/auth0/handlers/index.d.ts +129 -0
- package/lib/tools/auth0/handlers/index.js +31 -27
- package/lib/tools/auth0/handlers/migrations.d.ts +15 -0
- package/lib/tools/auth0/handlers/migrations.js +3 -2
- package/lib/tools/auth0/handlers/organizations.d.ts +51 -0
- package/lib/tools/auth0/handlers/organizations.js +62 -32
- package/lib/tools/auth0/handlers/pages.d.ts +42 -0
- package/lib/tools/auth0/handlers/pages.js +20 -14
- package/lib/tools/auth0/handlers/prompts.d.ts +11 -0
- package/lib/tools/auth0/handlers/prompts.js +1 -0
- package/lib/tools/auth0/handlers/resourceServers.d.ts +51 -0
- package/lib/tools/auth0/handlers/resourceServers.js +22 -14
- package/lib/tools/auth0/handlers/roles.d.ts +48 -0
- package/lib/tools/auth0/handlers/roles.js +56 -32
- package/lib/tools/auth0/handlers/rules.d.ts +55 -0
- package/lib/tools/auth0/handlers/rules.js +53 -36
- package/lib/tools/auth0/handlers/rulesConfigs.d.ts +25 -0
- package/lib/tools/auth0/handlers/rulesConfigs.js +12 -6
- package/lib/tools/auth0/handlers/tenant.d.ts +11 -0
- package/lib/tools/auth0/handlers/tenant.js +8 -4
- package/lib/tools/auth0/handlers/triggers.d.ts +35 -0
- package/lib/tools/auth0/handlers/triggers.js +12 -13
- package/lib/tools/auth0/index.d.ts +15 -0
- package/lib/tools/auth0/index.js +15 -31
- package/lib/tools/auth0/schema.d.ts +15 -0
- package/lib/tools/auth0/schema.js +7 -27
- package/lib/tools/calculateChanges.d.ts +26 -0
- package/lib/tools/calculateChanges.js +12 -7
- package/lib/tools/constants.d.ts +71 -0
- package/lib/tools/constants.js +164 -161
- package/lib/tools/deploy.d.ts +3 -0
- package/lib/tools/deploy.js +3 -3
- package/lib/tools/index.d.ts +82 -0
- package/lib/tools/index.js +1 -1
- package/lib/tools/utils.d.ts +18 -0
- package/lib/tools/utils.js +68 -10
- package/lib/tools/validationError.d.ts +5 -0
- package/lib/tools/{ValidationError.js → validationError.js} +3 -1
- package/lib/types.d.ts +255 -0
- package/lib/types.js +2 -0
- package/lib/utils.d.ts +66 -0
- package/lib/utils.js +18 -25
- package/package.json +16 -7
- package/tsconfig.json +3 -4
- package/typescript-migration-progress.sh +1 -1
- package/lib/tools/logger.js +0 -15
|
@@ -20,21 +20,21 @@ exports.schema = {
|
|
|
20
20
|
properties: {
|
|
21
21
|
provider: {
|
|
22
22
|
type: 'string',
|
|
23
|
-
enum: constants_1.default.GUARDIAN_PHONE_PROVIDERS
|
|
24
|
-
}
|
|
23
|
+
enum: constants_1.default.GUARDIAN_PHONE_PROVIDERS,
|
|
24
|
+
},
|
|
25
25
|
},
|
|
26
|
-
additionalProperties: false
|
|
26
|
+
additionalProperties: false,
|
|
27
27
|
};
|
|
28
28
|
const isFeatureUnavailableError = (err) => {
|
|
29
29
|
if (err.statusCode === 404) {
|
|
30
30
|
// Older Management API version where the endpoint is not available.
|
|
31
31
|
return true;
|
|
32
32
|
}
|
|
33
|
-
if (err.statusCode === 403
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
if (err.statusCode === 403 &&
|
|
34
|
+
err.originalError &&
|
|
35
|
+
err.originalError.response &&
|
|
36
|
+
err.originalError.response.body &&
|
|
37
|
+
err.originalError.response.body.errorCode === 'hooks_not_allowed') {
|
|
38
38
|
// Recent Management API version, but with feature explicitly disabled.
|
|
39
39
|
return true;
|
|
40
40
|
}
|
|
@@ -47,7 +47,8 @@ class GuardianPhoneSelectedProviderHandler extends default_1.default {
|
|
|
47
47
|
getType() {
|
|
48
48
|
return __awaiter(this, void 0, void 0, function* () {
|
|
49
49
|
// in case client version does not support the operation
|
|
50
|
-
if (!this.client.guardian ||
|
|
50
|
+
if (!this.client.guardian ||
|
|
51
|
+
typeof this.client.guardian.getPhoneFactorSelectedProvider !== 'function') {
|
|
51
52
|
return {};
|
|
52
53
|
}
|
|
53
54
|
if (this.existing)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import DefaultHandler from './default';
|
|
2
|
+
import { Asset, Assets } from '../../../types';
|
|
3
|
+
export declare const schema: {
|
|
4
|
+
type: string;
|
|
5
|
+
properties: {
|
|
6
|
+
policies: {
|
|
7
|
+
type: string;
|
|
8
|
+
items: {
|
|
9
|
+
type: string;
|
|
10
|
+
enum: string[];
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
additionalProperties: boolean;
|
|
15
|
+
};
|
|
16
|
+
export default class GuardianPoliciesHandler extends DefaultHandler {
|
|
17
|
+
existing: {
|
|
18
|
+
policies: Asset[];
|
|
19
|
+
};
|
|
20
|
+
constructor(options: any);
|
|
21
|
+
getType(): Promise<GuardianPoliciesHandler['existing'] | {}>;
|
|
22
|
+
processChanges(assets: Assets): Promise<void>;
|
|
23
|
+
}
|
|
@@ -22,16 +22,17 @@ exports.schema = {
|
|
|
22
22
|
type: 'array',
|
|
23
23
|
items: {
|
|
24
24
|
type: 'string',
|
|
25
|
-
enum: constants_1.default.GUARDIAN_POLICIES
|
|
26
|
-
}
|
|
27
|
-
}
|
|
25
|
+
enum: constants_1.default.GUARDIAN_POLICIES,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
28
|
},
|
|
29
|
-
additionalProperties: false
|
|
29
|
+
additionalProperties: false,
|
|
30
30
|
};
|
|
31
31
|
class GuardianPoliciesHandler extends default_1.default {
|
|
32
32
|
constructor(options) {
|
|
33
33
|
super(Object.assign(Object.assign({}, options), { type: 'guardianPolicies' }));
|
|
34
34
|
}
|
|
35
|
+
//TODO: standardize empty object literal with more intentional empty indicator
|
|
35
36
|
getType() {
|
|
36
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
37
38
|
// in case client version does not support the operation
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import DefaultHandler from './default';
|
|
2
|
+
import { Asset, Assets, CalculatedChanges } from '../../../types';
|
|
3
|
+
export declare const excludeSchema: {
|
|
4
|
+
type: string;
|
|
5
|
+
items: {
|
|
6
|
+
type: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export declare const schema: {
|
|
10
|
+
type: string;
|
|
11
|
+
items: {
|
|
12
|
+
type: string;
|
|
13
|
+
default: never[];
|
|
14
|
+
properties: {
|
|
15
|
+
script: {
|
|
16
|
+
type: string;
|
|
17
|
+
description: string;
|
|
18
|
+
default: string;
|
|
19
|
+
};
|
|
20
|
+
name: {
|
|
21
|
+
type: string;
|
|
22
|
+
description: string;
|
|
23
|
+
pattern: string;
|
|
24
|
+
};
|
|
25
|
+
enabled: {
|
|
26
|
+
type: string;
|
|
27
|
+
description: string;
|
|
28
|
+
default: boolean;
|
|
29
|
+
};
|
|
30
|
+
triggerId: {
|
|
31
|
+
type: string;
|
|
32
|
+
description: string;
|
|
33
|
+
enum: string[];
|
|
34
|
+
};
|
|
35
|
+
secrets: {
|
|
36
|
+
type: string;
|
|
37
|
+
description: string;
|
|
38
|
+
default: {};
|
|
39
|
+
};
|
|
40
|
+
dependencies: {
|
|
41
|
+
type: string;
|
|
42
|
+
default: {};
|
|
43
|
+
description: string;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
required: string[];
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export default class HooksHandler extends DefaultHandler {
|
|
50
|
+
existing: Asset[];
|
|
51
|
+
constructor(options: DefaultHandler);
|
|
52
|
+
objString(hook: any): string;
|
|
53
|
+
processSecrets(hooks: any): Promise<void>;
|
|
54
|
+
getType(reload: boolean): Promise<Asset[]>;
|
|
55
|
+
calcChanges(assets: Assets): Promise<CalculatedChanges>;
|
|
56
|
+
validate(assets: any): Promise<void>;
|
|
57
|
+
processChanges(assets: Assets): Promise<void>;
|
|
58
|
+
}
|
|
@@ -15,10 +15,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.schema = exports.excludeSchema = void 0;
|
|
16
16
|
const default_1 = __importDefault(require("./default"));
|
|
17
17
|
const constants_1 = __importDefault(require("../../constants"));
|
|
18
|
-
const ALLOWED_TRIGGER_IDS = [
|
|
18
|
+
const ALLOWED_TRIGGER_IDS = [
|
|
19
|
+
'credentials-exchange',
|
|
20
|
+
'pre-user-registration',
|
|
21
|
+
'post-user-registration',
|
|
22
|
+
'post-change-password',
|
|
23
|
+
'send-phone-message',
|
|
24
|
+
];
|
|
19
25
|
exports.excludeSchema = {
|
|
20
26
|
type: 'array',
|
|
21
|
-
items: { type: 'string' }
|
|
27
|
+
items: { type: 'string' },
|
|
22
28
|
};
|
|
23
29
|
exports.schema = {
|
|
24
30
|
type: 'array',
|
|
@@ -28,37 +34,37 @@ exports.schema = {
|
|
|
28
34
|
properties: {
|
|
29
35
|
script: {
|
|
30
36
|
type: 'string',
|
|
31
|
-
description:
|
|
32
|
-
default: ''
|
|
37
|
+
description: "A script that contains the hook's code",
|
|
38
|
+
default: '',
|
|
33
39
|
},
|
|
34
40
|
name: {
|
|
35
41
|
type: 'string',
|
|
36
|
-
description:
|
|
37
|
-
pattern: '^[^-\\s][a-zA-Z0-9-\\s]+[^-\\s]$'
|
|
42
|
+
description: "The name of the hook. Can only contain alphanumeric characters, spaces and '-'. Can neither start nor end with '-' or spaces",
|
|
43
|
+
pattern: '^[^-\\s][a-zA-Z0-9-\\s]+[^-\\s]$',
|
|
38
44
|
},
|
|
39
45
|
enabled: {
|
|
40
46
|
type: 'boolean',
|
|
41
47
|
description: 'true if the hook is active, false otherwise',
|
|
42
|
-
default: false
|
|
48
|
+
default: false,
|
|
43
49
|
},
|
|
44
50
|
triggerId: {
|
|
45
51
|
type: 'string',
|
|
46
|
-
description:
|
|
47
|
-
enum: ALLOWED_TRIGGER_IDS
|
|
52
|
+
description: "The hooks's trigger ID",
|
|
53
|
+
enum: ALLOWED_TRIGGER_IDS,
|
|
48
54
|
},
|
|
49
55
|
secrets: {
|
|
50
56
|
type: 'object',
|
|
51
57
|
description: 'List of key-value pairs containing secrets available to the hook.',
|
|
52
|
-
default: {}
|
|
58
|
+
default: {},
|
|
53
59
|
},
|
|
54
60
|
dependencies: {
|
|
55
61
|
type: 'object',
|
|
56
62
|
default: {},
|
|
57
|
-
description: 'List of key-value pairs of NPM dependencies available to the hook.'
|
|
58
|
-
}
|
|
63
|
+
description: 'List of key-value pairs of NPM dependencies available to the hook.',
|
|
64
|
+
},
|
|
59
65
|
},
|
|
60
|
-
required: ['script', 'name', 'triggerId']
|
|
61
|
-
}
|
|
66
|
+
required: ['script', 'name', 'triggerId'],
|
|
67
|
+
},
|
|
62
68
|
};
|
|
63
69
|
const getCertainHook = (hooks, name, triggerId) => {
|
|
64
70
|
let result = null;
|
|
@@ -89,11 +95,13 @@ class HooksHandler extends default_1.default {
|
|
|
89
95
|
const changes = {
|
|
90
96
|
create: [],
|
|
91
97
|
update: [],
|
|
92
|
-
del: []
|
|
98
|
+
del: [],
|
|
99
|
+
conflicts: [],
|
|
93
100
|
};
|
|
94
101
|
hooks.forEach((hook) => {
|
|
95
102
|
const current = getCertainHook(allHooks, hook.name, hook.triggerId);
|
|
96
|
-
if (current) {
|
|
103
|
+
if (current) {
|
|
104
|
+
// if the hook was deleted we don't care about its secrets
|
|
97
105
|
const oldSecrets = current.secrets || {};
|
|
98
106
|
const newSecrets = hook.secrets || {};
|
|
99
107
|
const create = {};
|
|
@@ -131,6 +139,7 @@ class HooksHandler extends default_1.default {
|
|
|
131
139
|
})));
|
|
132
140
|
});
|
|
133
141
|
}
|
|
142
|
+
//@ts-ignore because hooks use a special reload argument
|
|
134
143
|
getType(reload) {
|
|
135
144
|
return __awaiter(this, void 0, void 0, function* () {
|
|
136
145
|
if (this.existing && !reload) {
|
|
@@ -143,8 +152,10 @@ class HooksHandler extends default_1.default {
|
|
|
143
152
|
try {
|
|
144
153
|
const hooks = yield this.client.hooks.getAll({ paginate: true, include_totals: true });
|
|
145
154
|
// 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
|
|
147
|
-
.
|
|
155
|
+
this.existing = yield Promise.all(hooks.map((hook) => this.client.hooks
|
|
156
|
+
.get({ id: hook.id })
|
|
157
|
+
.then((hookWithCode) => this.client.hooks
|
|
158
|
+
.getSecrets({ id: hook.id })
|
|
148
159
|
.then((secrets) => (Object.assign(Object.assign({}, hookWithCode), { secrets }))))));
|
|
149
160
|
return this.existing;
|
|
150
161
|
}
|
|
@@ -168,7 +179,7 @@ class HooksHandler extends default_1.default {
|
|
|
168
179
|
del,
|
|
169
180
|
update: stripSecrets(update),
|
|
170
181
|
create: stripSecrets(create),
|
|
171
|
-
conflicts: stripSecrets(conflicts)
|
|
182
|
+
conflicts: stripSecrets(conflicts),
|
|
172
183
|
};
|
|
173
184
|
});
|
|
174
185
|
}
|
|
@@ -183,9 +194,11 @@ class HooksHandler extends default_1.default {
|
|
|
183
194
|
return;
|
|
184
195
|
const activeHooks = getActive(hooks);
|
|
185
196
|
ALLOWED_TRIGGER_IDS.forEach((type) => {
|
|
186
|
-
if (activeHooks[type].length > 1) {
|
|
197
|
+
if (activeHooks[type].length > 1) {
|
|
198
|
+
// There can be only one!
|
|
187
199
|
const conflict = activeHooks[type].map((h) => h.name).join(', ');
|
|
188
200
|
const err = new Error(`Only one active hook allowed for "${type}" extensibility point. Conflicting hooks: ${conflict}`);
|
|
201
|
+
//@ts-ignore need to investigate if appending status actually works here
|
|
189
202
|
err.status = 409;
|
|
190
203
|
throw err;
|
|
191
204
|
}
|
|
@@ -208,7 +221,7 @@ class HooksHandler extends default_1.default {
|
|
|
208
221
|
del: changes.del,
|
|
209
222
|
create: changes.create,
|
|
210
223
|
update: changes.update,
|
|
211
|
-
conflicts: changes.conflicts
|
|
224
|
+
conflicts: changes.conflicts,
|
|
212
225
|
});
|
|
213
226
|
yield this.processSecrets(hooks);
|
|
214
227
|
});
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import APIHandler from './default';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
rules: {
|
|
4
|
+
default: typeof APIHandler;
|
|
5
|
+
excludeSchema?: any;
|
|
6
|
+
schema: any;
|
|
7
|
+
};
|
|
8
|
+
rulesConfigs: {
|
|
9
|
+
default: typeof APIHandler;
|
|
10
|
+
excludeSchema?: any;
|
|
11
|
+
schema: any;
|
|
12
|
+
};
|
|
13
|
+
hooks: {
|
|
14
|
+
default: typeof APIHandler;
|
|
15
|
+
excludeSchema?: any;
|
|
16
|
+
schema: any;
|
|
17
|
+
};
|
|
18
|
+
pages: {
|
|
19
|
+
default: typeof APIHandler;
|
|
20
|
+
excludeSchema?: any;
|
|
21
|
+
schema: any;
|
|
22
|
+
};
|
|
23
|
+
databases: {
|
|
24
|
+
default: typeof APIHandler;
|
|
25
|
+
excludeSchema?: any;
|
|
26
|
+
schema: any;
|
|
27
|
+
};
|
|
28
|
+
clientGrants: {
|
|
29
|
+
default: typeof APIHandler;
|
|
30
|
+
excludeSchema?: any;
|
|
31
|
+
schema: any;
|
|
32
|
+
};
|
|
33
|
+
resourceServers: {
|
|
34
|
+
default: typeof APIHandler;
|
|
35
|
+
excludeSchema?: any;
|
|
36
|
+
schema: any;
|
|
37
|
+
};
|
|
38
|
+
clients: {
|
|
39
|
+
default: typeof APIHandler;
|
|
40
|
+
excludeSchema?: any;
|
|
41
|
+
schema: any;
|
|
42
|
+
};
|
|
43
|
+
connections: {
|
|
44
|
+
default: typeof APIHandler;
|
|
45
|
+
excludeSchema?: any;
|
|
46
|
+
schema: any;
|
|
47
|
+
};
|
|
48
|
+
tenant: {
|
|
49
|
+
default: typeof APIHandler;
|
|
50
|
+
excludeSchema?: any;
|
|
51
|
+
schema: any;
|
|
52
|
+
};
|
|
53
|
+
emailProvider: {
|
|
54
|
+
default: typeof APIHandler;
|
|
55
|
+
excludeSchema?: any;
|
|
56
|
+
schema: any;
|
|
57
|
+
};
|
|
58
|
+
emailTemplates: {
|
|
59
|
+
default: typeof APIHandler;
|
|
60
|
+
excludeSchema?: any;
|
|
61
|
+
schema: any;
|
|
62
|
+
};
|
|
63
|
+
guardianFactors: {
|
|
64
|
+
default: typeof APIHandler;
|
|
65
|
+
excludeSchema?: any;
|
|
66
|
+
schema: any;
|
|
67
|
+
};
|
|
68
|
+
guardianFactorProviders: {
|
|
69
|
+
default: typeof APIHandler;
|
|
70
|
+
excludeSchema?: any;
|
|
71
|
+
schema: any;
|
|
72
|
+
};
|
|
73
|
+
guardianFactorTemplates: {
|
|
74
|
+
default: typeof APIHandler;
|
|
75
|
+
excludeSchema?: any;
|
|
76
|
+
schema: any;
|
|
77
|
+
};
|
|
78
|
+
migrations: {
|
|
79
|
+
default: typeof APIHandler;
|
|
80
|
+
excludeSchema?: any;
|
|
81
|
+
schema: any;
|
|
82
|
+
};
|
|
83
|
+
guardianPhoneFactorMessageTypes: {
|
|
84
|
+
default: typeof APIHandler;
|
|
85
|
+
excludeSchema?: any;
|
|
86
|
+
schema: any;
|
|
87
|
+
};
|
|
88
|
+
guardianPhoneFactorSelectedProvider: {
|
|
89
|
+
default: typeof APIHandler;
|
|
90
|
+
excludeSchema?: any;
|
|
91
|
+
schema: any;
|
|
92
|
+
};
|
|
93
|
+
guardianPolicies: {
|
|
94
|
+
default: typeof APIHandler;
|
|
95
|
+
excludeSchema?: any;
|
|
96
|
+
schema: any;
|
|
97
|
+
};
|
|
98
|
+
roles: {
|
|
99
|
+
default: typeof APIHandler;
|
|
100
|
+
excludeSchema?: any;
|
|
101
|
+
schema: any;
|
|
102
|
+
};
|
|
103
|
+
actions: {
|
|
104
|
+
default: typeof APIHandler;
|
|
105
|
+
excludeSchema?: any;
|
|
106
|
+
schema: any;
|
|
107
|
+
};
|
|
108
|
+
organizations: {
|
|
109
|
+
default: typeof APIHandler;
|
|
110
|
+
excludeSchema?: any;
|
|
111
|
+
schema: any;
|
|
112
|
+
};
|
|
113
|
+
triggers: {
|
|
114
|
+
default: typeof APIHandler;
|
|
115
|
+
excludeSchema?: any;
|
|
116
|
+
schema: any;
|
|
117
|
+
};
|
|
118
|
+
attackProtection: {
|
|
119
|
+
default: typeof APIHandler;
|
|
120
|
+
excludeSchema?: any;
|
|
121
|
+
schema: any;
|
|
122
|
+
};
|
|
123
|
+
branding: {
|
|
124
|
+
default: typeof APIHandler;
|
|
125
|
+
excludeSchema?: any;
|
|
126
|
+
schema: any;
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
export default _default;
|
|
@@ -23,56 +23,60 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
|
|
26
|
+
//TODO:
|
|
27
27
|
const rules = __importStar(require("./rules"));
|
|
28
|
-
exports.rules = rules;
|
|
29
28
|
const rulesConfigs = __importStar(require("./rulesConfigs"));
|
|
30
|
-
exports.rulesConfigs = rulesConfigs;
|
|
31
29
|
const hooks = __importStar(require("./hooks"));
|
|
32
|
-
exports.hooks = hooks;
|
|
33
30
|
const pages = __importStar(require("./pages"));
|
|
34
|
-
exports.pages = pages;
|
|
35
31
|
const resourceServers = __importStar(require("./resourceServers"));
|
|
36
|
-
exports.resourceServers = resourceServers;
|
|
37
32
|
const databases = __importStar(require("./databases"));
|
|
38
|
-
exports.databases = databases;
|
|
39
33
|
const connections = __importStar(require("./connections"));
|
|
40
|
-
exports.connections = connections;
|
|
41
34
|
const clients = __importStar(require("./clients"));
|
|
42
|
-
exports.clients = clients;
|
|
43
35
|
const tenant = __importStar(require("./tenant"));
|
|
44
|
-
exports.tenant = tenant;
|
|
45
36
|
const emailProvider = __importStar(require("./emailProvider"));
|
|
46
|
-
exports.emailProvider = emailProvider;
|
|
47
37
|
const emailTemplates = __importStar(require("./emailTemplates"));
|
|
48
|
-
exports.emailTemplates = emailTemplates;
|
|
49
38
|
const clientGrants = __importStar(require("./clientGrants"));
|
|
50
|
-
exports.clientGrants = clientGrants;
|
|
51
39
|
const guardianFactors = __importStar(require("./guardianFactors"));
|
|
52
|
-
exports.guardianFactors = guardianFactors;
|
|
53
40
|
const guardianFactorProviders = __importStar(require("./guardianFactorProviders"));
|
|
54
|
-
exports.guardianFactorProviders = guardianFactorProviders;
|
|
55
41
|
const guardianFactorTemplates = __importStar(require("./guardianFactorTemplates"));
|
|
56
|
-
exports.guardianFactorTemplates = guardianFactorTemplates;
|
|
57
42
|
const guardianPolicies = __importStar(require("./guardianPolicies"));
|
|
58
|
-
exports.guardianPolicies = guardianPolicies;
|
|
59
43
|
const guardianPhoneFactorSelectedProvider = __importStar(require("./guardianPhoneFactorSelectedProvider"));
|
|
60
|
-
exports.guardianPhoneFactorSelectedProvider = guardianPhoneFactorSelectedProvider;
|
|
61
44
|
const guardianPhoneFactorMessageTypes = __importStar(require("./guardianPhoneFactorMessageTypes"));
|
|
62
|
-
exports.guardianPhoneFactorMessageTypes = guardianPhoneFactorMessageTypes;
|
|
63
45
|
const roles = __importStar(require("./roles"));
|
|
64
|
-
exports.roles = roles;
|
|
65
46
|
const branding = __importStar(require("./branding"));
|
|
66
|
-
exports.branding = branding;
|
|
67
47
|
const prompts = __importStar(require("./prompts"));
|
|
68
|
-
exports.prompts = prompts;
|
|
69
48
|
const migrations = __importStar(require("./migrations"));
|
|
70
|
-
exports.migrations = migrations;
|
|
71
49
|
const actions = __importStar(require("./actions"));
|
|
72
|
-
exports.actions = actions;
|
|
73
50
|
const triggers = __importStar(require("./triggers"));
|
|
74
|
-
exports.triggers = triggers;
|
|
75
51
|
const organizations = __importStar(require("./organizations"));
|
|
76
|
-
exports.organizations = organizations;
|
|
77
52
|
const attackProtection = __importStar(require("./attackProtection"));
|
|
78
|
-
|
|
53
|
+
const auth0ApiHandlers = {
|
|
54
|
+
rules,
|
|
55
|
+
rulesConfigs,
|
|
56
|
+
hooks,
|
|
57
|
+
pages,
|
|
58
|
+
resourceServers,
|
|
59
|
+
clients,
|
|
60
|
+
databases,
|
|
61
|
+
connections,
|
|
62
|
+
tenant,
|
|
63
|
+
emailProvider,
|
|
64
|
+
emailTemplates,
|
|
65
|
+
clientGrants,
|
|
66
|
+
guardianFactors,
|
|
67
|
+
guardianFactorProviders,
|
|
68
|
+
guardianFactorTemplates,
|
|
69
|
+
guardianPolicies,
|
|
70
|
+
guardianPhoneFactorSelectedProvider,
|
|
71
|
+
guardianPhoneFactorMessageTypes,
|
|
72
|
+
roles,
|
|
73
|
+
branding,
|
|
74
|
+
//@ts-ignore because prompts have not been universally implemented yet
|
|
75
|
+
prompts,
|
|
76
|
+
migrations,
|
|
77
|
+
actions,
|
|
78
|
+
triggers,
|
|
79
|
+
organizations,
|
|
80
|
+
attackProtection,
|
|
81
|
+
};
|
|
82
|
+
exports.default = auth0ApiHandlers; // TODO: apply stronger types to schema properties
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import DefaultHandler from './default';
|
|
2
|
+
import { Asset, Assets } from '../../../types';
|
|
3
|
+
export declare const schema: {
|
|
4
|
+
type: string;
|
|
5
|
+
additionalProperties: {
|
|
6
|
+
type: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export default class MigrationsHandler extends DefaultHandler {
|
|
10
|
+
constructor(options: DefaultHandler);
|
|
11
|
+
getType(): Promise<Asset[] | {}>;
|
|
12
|
+
processChanges(assets: Assets): Promise<void>;
|
|
13
|
+
logUnavailableMigrations(ignoreUnavailableMigrations: boolean, ignoredMigrations: string[]): void;
|
|
14
|
+
removeUnavailableMigrations(migrations: Asset[]): Promise<Asset[]>;
|
|
15
|
+
}
|
|
@@ -43,15 +43,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
43
43
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
44
|
exports.schema = void 0;
|
|
45
45
|
const default_1 = __importStar(require("./default"));
|
|
46
|
-
const logger_1 = __importDefault(require("
|
|
46
|
+
const logger_1 = __importDefault(require("../../../logger"));
|
|
47
47
|
exports.schema = {
|
|
48
48
|
type: 'object',
|
|
49
|
-
additionalProperties: { type: 'boolean' }
|
|
49
|
+
additionalProperties: { type: 'boolean' },
|
|
50
50
|
};
|
|
51
51
|
class MigrationsHandler extends default_1.default {
|
|
52
52
|
constructor(options) {
|
|
53
53
|
super(Object.assign(Object.assign({}, options), { type: 'migrations' }));
|
|
54
54
|
}
|
|
55
|
+
//TODO: standardize empty object literal with more intentional empty indicator
|
|
55
56
|
getType() {
|
|
56
57
|
return __awaiter(this, void 0, void 0, function* () {
|
|
57
58
|
try {
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import DefaultHandler from './default';
|
|
2
|
+
import { Asset, Assets, CalculatedChanges } from '../../../types';
|
|
3
|
+
export declare const schema: {
|
|
4
|
+
type: string;
|
|
5
|
+
items: {
|
|
6
|
+
type: string;
|
|
7
|
+
properties: {
|
|
8
|
+
name: {
|
|
9
|
+
type: string;
|
|
10
|
+
};
|
|
11
|
+
display_name: {
|
|
12
|
+
type: string;
|
|
13
|
+
};
|
|
14
|
+
branding: {
|
|
15
|
+
type: string;
|
|
16
|
+
};
|
|
17
|
+
metadata: {
|
|
18
|
+
type: string;
|
|
19
|
+
};
|
|
20
|
+
connections: {
|
|
21
|
+
type: string;
|
|
22
|
+
items: {
|
|
23
|
+
type: string;
|
|
24
|
+
properties: {
|
|
25
|
+
connection_id: {
|
|
26
|
+
type: string;
|
|
27
|
+
};
|
|
28
|
+
assign_membership_on_login: {
|
|
29
|
+
type: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
required: string[];
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export default class OrganizationsHandler extends DefaultHandler {
|
|
39
|
+
existing: Asset[];
|
|
40
|
+
constructor(config: DefaultHandler);
|
|
41
|
+
deleteOrganization(org: any): Promise<void>;
|
|
42
|
+
deleteOrganizations(data: any): Promise<void>;
|
|
43
|
+
createOrganization(org: any): Promise<Asset>;
|
|
44
|
+
createOrganizations(creates: CalculatedChanges['create']): Promise<void>;
|
|
45
|
+
updateOrganization(org: any, organizations: any): Promise<{
|
|
46
|
+
id: any;
|
|
47
|
+
}>;
|
|
48
|
+
updateOrganizations(updates: CalculatedChanges['update'], orgs: Asset[]): Promise<void>;
|
|
49
|
+
getType(): Promise<Asset[]>;
|
|
50
|
+
processChanges(assets: Assets): Promise<void>;
|
|
51
|
+
}
|