auth0-deploy-cli 7.7.1 → 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/CHANGELOG.md +14 -1
- package/lib/args.d.ts +29 -0
- package/lib/commands/export.d.ts +2 -0
- package/lib/commands/import.d.ts +2 -0
- package/lib/commands/index.d.ts +9 -0
- package/lib/configFactory.d.ts +7 -0
- package/lib/context/defaults.d.ts +1 -0
- package/lib/context/directory/handlers/actions.d.ts +6 -0
- package/lib/context/directory/handlers/attackProtection.d.ts +10 -0
- package/lib/context/directory/handlers/branding.d.ts +6 -0
- package/lib/context/directory/handlers/clientGrants.d.ts +6 -0
- package/lib/context/directory/handlers/clients.d.ts +6 -0
- package/lib/context/directory/handlers/connections.d.ts +6 -0
- package/lib/context/directory/handlers/databases.d.ts +6 -0
- package/lib/context/directory/handlers/emailProvider.d.ts +6 -0
- package/lib/context/directory/handlers/emailTemplates.d.ts +6 -0
- package/lib/context/directory/handlers/guardianFactorProviders.d.ts +6 -0
- package/lib/context/directory/handlers/guardianFactorTemplates.d.ts +6 -0
- package/lib/context/directory/handlers/guardianFactors.d.ts +6 -0
- package/lib/context/directory/handlers/guardianPhoneFactorMessageTypes.d.ts +6 -0
- package/lib/context/directory/handlers/guardianPhoneFactorSelectedProvider.d.ts +6 -0
- package/lib/context/directory/handlers/guardianPolicies.d.ts +6 -0
- package/lib/context/directory/handlers/hooks.d.ts +6 -0
- package/lib/context/directory/handlers/index.d.ts +12 -0
- 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/pages.d.ts +6 -0
- package/lib/context/directory/handlers/resourceServers.d.ts +6 -0
- package/lib/context/directory/handlers/roles.d.ts +6 -0
- package/lib/context/directory/handlers/rules.d.ts +6 -0
- package/lib/context/directory/handlers/rulesConfigs.d.ts +6 -0
- package/lib/context/directory/handlers/tenant.d.ts +10 -0
- package/lib/context/directory/handlers/triggers.d.ts +6 -0
- package/lib/context/directory/index.d.ts +17 -0
- package/lib/context/index.d.ts +4 -0
- package/lib/context/yaml/handlers/actions.d.ts +6 -0
- package/lib/context/yaml/handlers/attackProtection.d.ts +6 -0
- package/lib/context/yaml/handlers/branding.d.ts +6 -0
- package/lib/context/yaml/handlers/clientGrants.d.ts +6 -0
- package/lib/context/yaml/handlers/clients.d.ts +6 -0
- package/lib/context/yaml/handlers/connections.d.ts +6 -0
- package/lib/context/yaml/handlers/databases.d.ts +6 -0
- package/lib/context/yaml/handlers/emailProvider.d.ts +6 -0
- package/lib/context/yaml/handlers/emailTemplates.d.ts +6 -0
- package/lib/context/yaml/handlers/guardianFactorProviders.d.ts +6 -0
- package/lib/context/yaml/handlers/guardianFactorTemplates.d.ts +6 -0
- package/lib/context/yaml/handlers/guardianFactors.d.ts +6 -0
- package/lib/context/yaml/handlers/guardianPhoneFactorMessageTypes.d.ts +6 -0
- package/lib/context/yaml/handlers/guardianPhoneFactorSelectedProvider.d.ts +6 -0
- package/lib/context/yaml/handlers/guardianPolicies.d.ts +6 -0
- package/lib/context/yaml/handlers/hooks.d.ts +6 -0
- package/lib/context/yaml/handlers/index.d.ts +12 -0
- 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/pages.d.ts +6 -0
- package/lib/context/yaml/handlers/resourceServers.d.ts +6 -0
- package/lib/context/yaml/handlers/roles.d.ts +6 -0
- package/lib/context/yaml/handlers/rules.d.ts +6 -0
- package/lib/context/yaml/handlers/rulesConfigs.d.ts +6 -0
- package/lib/context/yaml/handlers/tenant.d.ts +6 -0
- package/lib/context/yaml/handlers/triggers.d.ts +6 -0
- package/lib/context/yaml/index.d.ts +13 -0
- package/lib/index.d.ts +88 -0
- package/lib/index.js +5 -2
- package/lib/logger.d.ts +2 -0
- package/lib/logger.js +7 -17
- package/lib/readonly.d.ts +2 -0
- package/lib/sessionDurationsToMinutes.d.ts +7 -0
- package/lib/tools/auth0/client.d.ts +2 -0
- package/lib/tools/auth0/handlers/actions.d.ts +95 -0
- package/lib/tools/auth0/handlers/actions.js +1 -1
- package/lib/tools/auth0/handlers/attackProtection.d.ts +28 -0
- package/lib/tools/auth0/handlers/branding.d.ts +27 -0
- package/lib/tools/auth0/handlers/clientGrants.d.ts +32 -0
- package/lib/tools/auth0/handlers/clients.d.ts +23 -0
- package/lib/tools/auth0/handlers/connections.d.ts +54 -0
- package/lib/tools/auth0/handlers/databases.d.ts +36 -0
- package/lib/tools/auth0/handlers/default.d.ts +54 -0
- package/lib/tools/auth0/handlers/default.js +22 -8
- 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/guardianFactorProviders.d.ts +25 -0
- package/lib/tools/auth0/handlers/guardianFactorTemplates.d.ts +21 -0
- package/lib/tools/auth0/handlers/guardianFactors.d.ts +21 -0
- package/lib/tools/auth0/handlers/guardianPhoneFactorMessageTypes.d.ts +21 -0
- package/lib/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.d.ts +18 -0
- package/lib/tools/auth0/handlers/guardianPolicies.d.ts +23 -0
- package/lib/tools/auth0/handlers/hooks.d.ts +58 -0
- package/lib/tools/auth0/handlers/index.d.ts +129 -0
- package/lib/tools/auth0/handlers/migrations.d.ts +15 -0
- package/lib/tools/auth0/handlers/migrations.js +1 -1
- package/lib/tools/auth0/handlers/organizations.d.ts +51 -0
- package/lib/tools/auth0/handlers/organizations.js +1 -1
- package/lib/tools/auth0/handlers/pages.d.ts +42 -0
- package/lib/tools/auth0/handlers/prompts.d.ts +11 -0
- package/lib/tools/auth0/handlers/resourceServers.d.ts +51 -0
- package/lib/tools/auth0/handlers/roles.d.ts +48 -0
- package/lib/tools/auth0/handlers/roles.js +1 -1
- package/lib/tools/auth0/handlers/rules.d.ts +55 -0
- package/lib/tools/auth0/handlers/rules.js +1 -1
- package/lib/tools/auth0/handlers/rulesConfigs.d.ts +25 -0
- package/lib/tools/auth0/handlers/tenant.d.ts +11 -0
- package/lib/tools/auth0/handlers/triggers.d.ts +35 -0
- package/lib/tools/auth0/handlers/triggers.js +1 -1
- package/lib/tools/auth0/index.d.ts +15 -0
- package/lib/tools/auth0/schema.d.ts +15 -0
- package/lib/tools/calculateChanges.d.ts +26 -0
- package/lib/tools/calculateChanges.js +1 -1
- package/lib/tools/constants.d.ts +71 -0
- package/lib/tools/constants.js +3 -1
- package/lib/tools/deploy.d.ts +3 -0
- package/lib/tools/deploy.js +2 -2
- package/lib/tools/index.d.ts +82 -0
- package/lib/tools/utils.d.ts +18 -0
- package/lib/tools/utils.js +35 -2
- package/lib/tools/validationError.d.ts +5 -0
- package/lib/types.d.ts +255 -0
- package/lib/utils.d.ts +66 -0
- package/package.json +7 -7
- package/tsconfig.json +2 -1
- package/lib/tools/logger.js +0 -21
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import importCMD from './commands/import';
|
|
3
|
+
import exportCMD from './commands/export';
|
|
4
|
+
declare const _default: {
|
|
5
|
+
deploy: typeof importCMD;
|
|
6
|
+
dump: typeof exportCMD;
|
|
7
|
+
import: typeof importCMD;
|
|
8
|
+
export: typeof exportCMD;
|
|
9
|
+
tools: {
|
|
10
|
+
constants: {
|
|
11
|
+
CONCURRENT_CALLS: number;
|
|
12
|
+
RULES_DIRECTORY: string;
|
|
13
|
+
RULES_STAGES: string[];
|
|
14
|
+
DEFAULT_RULE_STAGE: string;
|
|
15
|
+
HOOKS_HIDDEN_SECRET_VALUE: string;
|
|
16
|
+
OBFUSCATED_SECRET_VALUE: string;
|
|
17
|
+
HOOKS_DIRECTORY: string;
|
|
18
|
+
ACTIONS_DIRECTORY: string;
|
|
19
|
+
TRIGGERS_DIRECTORY: string;
|
|
20
|
+
RULES_CONFIGS_DIRECTORY: string;
|
|
21
|
+
PAGES_DIRECTORY: string;
|
|
22
|
+
PAGE_LOGIN: string;
|
|
23
|
+
PAGE_GUARDIAN_MULTIFACTOR: string;
|
|
24
|
+
PAGE_PASSWORD_RESET: string;
|
|
25
|
+
PAGE_ERROR: string;
|
|
26
|
+
DATABASE_CONNECTIONS_DIRECTORY: string;
|
|
27
|
+
DATABASE_SCRIPTS_CHANGE_EMAIL: string;
|
|
28
|
+
DATABASE_SCRIPTS_GET_USER: string;
|
|
29
|
+
EMAIL_TEMPLATES_TYPES: string[];
|
|
30
|
+
ACTIONS_TRIGGERS: string[];
|
|
31
|
+
EMAIL_TEMPLATES_DIRECTORY: string;
|
|
32
|
+
EMAIL_VERIFY: string;
|
|
33
|
+
EMAIL_VERIFY_BY_CODE: string;
|
|
34
|
+
EMAIL_RESET: string;
|
|
35
|
+
EMAIL_WELCOME: string;
|
|
36
|
+
EMAIL_BLOCKED: string;
|
|
37
|
+
EMAIL_STOLEN_CREDENTIALS: string;
|
|
38
|
+
EMAIL_ENROLLMENT: string;
|
|
39
|
+
EMAIL_CHANGE_PASSWORD: string;
|
|
40
|
+
EMAIL_PASSWORD_RESET: string;
|
|
41
|
+
EMAIL_MFA_OOB_CODE: string;
|
|
42
|
+
EMAIL_USER_INVITATION: string;
|
|
43
|
+
GUARDIAN_DIRECTORY: string;
|
|
44
|
+
GUARDIAN_FACTORS_DIRECTORY: string;
|
|
45
|
+
GUARDIAN_PROVIDERS_DIRECTORY: string;
|
|
46
|
+
GUARDIAN_TEMPLATES_DIRECTORY: string;
|
|
47
|
+
UNIVERSAL_LOGIN_TEMPLATE: string;
|
|
48
|
+
RESOURCE_SERVERS_DIRECTORY: string;
|
|
49
|
+
RESOURCE_SERVERS_CLIENT_NAME: string;
|
|
50
|
+
RESOURCE_SERVERS_MANAGEMENT_API_NAME: string;
|
|
51
|
+
RESOURCE_SERVERS_ID_NAME: string;
|
|
52
|
+
CLIENTS_DIRECTORY: string;
|
|
53
|
+
CLIENTS_GRANTS_DIRECTORY: string;
|
|
54
|
+
BRANDING_DIRECTORY: string;
|
|
55
|
+
BRANDING_TEMPLATES_DIRECTORY: string;
|
|
56
|
+
BRANDING_TEMPLATES_YAML_DIRECTORY: string;
|
|
57
|
+
CLIENTS_CLIENT_NAME: string;
|
|
58
|
+
CLIENTS_CLIENT_ID_NAME: string;
|
|
59
|
+
CONNECTIONS_DIRECTORY: string;
|
|
60
|
+
CONNECTIONS_CLIENT_NAME: string;
|
|
61
|
+
CONNECTIONS_ID_NAME: string;
|
|
62
|
+
ROLES_DIRECTORY: string;
|
|
63
|
+
ATTACK_PROTECTION_DIRECTORY: string;
|
|
64
|
+
GUARDIAN_FACTORS: string[];
|
|
65
|
+
GUARDIAN_POLICIES: string[];
|
|
66
|
+
GUARDIAN_PHONE_PROVIDERS: string[];
|
|
67
|
+
GUARDIAN_PHONE_MESSAGE_TYPES: string[];
|
|
68
|
+
GUARDIAN_FACTOR_TEMPLATES: string[];
|
|
69
|
+
GUARDIAN_FACTOR_PROVIDERS: {
|
|
70
|
+
sms: string[];
|
|
71
|
+
'push-notification': string[];
|
|
72
|
+
};
|
|
73
|
+
PAGE_NAMES: string[];
|
|
74
|
+
DATABASE_SCRIPTS: string[];
|
|
75
|
+
DATABASE_SCRIPTS_NO_IMPORT: string[];
|
|
76
|
+
DATABASE_SCRIPTS_IMPORT: string[];
|
|
77
|
+
EMAIL_TEMPLATES_NAMES: string[];
|
|
78
|
+
SUPPORTED_BRANDING_TEMPLATES: string[];
|
|
79
|
+
};
|
|
80
|
+
deploy: typeof import("./tools").deploy;
|
|
81
|
+
keywordReplace: typeof import("./tools").keywordReplace;
|
|
82
|
+
loadFileAndReplaceKeywords: typeof import("./tools").loadFileAndReplaceKeywords;
|
|
83
|
+
Auth0: typeof import("./tools").Auth0;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
export default _default;
|
|
87
|
+
export declare const dump: typeof exportCMD;
|
|
88
|
+
export declare const deploy: typeof importCMD;
|
package/lib/index.js
CHANGED
|
@@ -13,6 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
14
|
};
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.deploy = exports.dump = void 0;
|
|
16
17
|
const global_agent_1 = require("global-agent");
|
|
17
18
|
const args_1 = require("./args");
|
|
18
19
|
const logger_1 = __importDefault(require("./logger"));
|
|
@@ -49,7 +50,7 @@ if (require.main === module) {
|
|
|
49
50
|
const params = (0, args_1.getParams)();
|
|
50
51
|
logger_1.default.debug('Starting Auth0 Deploy CLI Tool');
|
|
51
52
|
if (params.debug) {
|
|
52
|
-
logger_1.default.
|
|
53
|
+
logger_1.default.level = 'debug';
|
|
53
54
|
// Set for tools
|
|
54
55
|
process.env.AUTH0_DEBUG = 'true';
|
|
55
56
|
process.env.AUTH0_LOG = 'debug';
|
|
@@ -76,10 +77,12 @@ if (require.main === module) {
|
|
|
76
77
|
});
|
|
77
78
|
}
|
|
78
79
|
// Export commands to be used programmatically
|
|
79
|
-
|
|
80
|
+
exports.default = {
|
|
80
81
|
deploy: import_1.default,
|
|
81
82
|
dump: export_1.default,
|
|
82
83
|
import: import_1.default,
|
|
83
84
|
export: export_1.default,
|
|
84
85
|
tools: tools_1.default,
|
|
85
86
|
};
|
|
87
|
+
exports.dump = export_1.default;
|
|
88
|
+
exports.deploy = import_1.default;
|
package/lib/logger.d.ts
ADDED
package/lib/logger.js
CHANGED
|
@@ -1,21 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const winston_1 =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
timestamp: true,
|
|
13
|
-
level: process.env.AUTH0_LOG || 'info',
|
|
14
|
-
handleExceptions: true,
|
|
15
|
-
json: false,
|
|
16
|
-
colorize: true,
|
|
17
|
-
}),
|
|
18
|
-
],
|
|
3
|
+
const winston_1 = require("winston");
|
|
4
|
+
const { combine, timestamp, colorize } = winston_1.format;
|
|
5
|
+
const logger = (0, winston_1.createLogger)({
|
|
6
|
+
level: process.env.AUTH0_LOG || 'info',
|
|
7
|
+
format: combine(colorize(), timestamp(), winston_1.format.printf((info) => `${info.timestamp} - ${info.level}: ${info.message}`)),
|
|
8
|
+
transports: [new winston_1.transports.Console()],
|
|
19
9
|
exitOnError: false,
|
|
20
10
|
});
|
|
21
|
-
exports.default =
|
|
11
|
+
exports.default = logger;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const sessionDurationsToMinutes: ({ session_lifetime, idle_session_lifetime, }: {
|
|
2
|
+
session_lifetime?: number | undefined;
|
|
3
|
+
idle_session_lifetime?: number | undefined;
|
|
4
|
+
}) => {
|
|
5
|
+
session_lifetime_in_minutes?: number;
|
|
6
|
+
idle_session_lifetime_in_minutes?: number;
|
|
7
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import DefaultAPIHandler from './default';
|
|
2
|
+
import { Asset } from '../../../types';
|
|
3
|
+
export declare const schema: {
|
|
4
|
+
type: string;
|
|
5
|
+
items: {
|
|
6
|
+
type: string;
|
|
7
|
+
required: string[];
|
|
8
|
+
additionalProperties: boolean;
|
|
9
|
+
properties: {
|
|
10
|
+
code: {
|
|
11
|
+
type: string;
|
|
12
|
+
default: string;
|
|
13
|
+
};
|
|
14
|
+
runtime: {
|
|
15
|
+
type: string;
|
|
16
|
+
};
|
|
17
|
+
dependencies: {
|
|
18
|
+
type: string;
|
|
19
|
+
items: {
|
|
20
|
+
type: string;
|
|
21
|
+
additionalProperties: boolean;
|
|
22
|
+
properties: {
|
|
23
|
+
name: {
|
|
24
|
+
type: string;
|
|
25
|
+
};
|
|
26
|
+
version: {
|
|
27
|
+
type: string;
|
|
28
|
+
};
|
|
29
|
+
registry_url: {
|
|
30
|
+
type: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
secrets: {
|
|
36
|
+
type: string;
|
|
37
|
+
items: {
|
|
38
|
+
type: string;
|
|
39
|
+
properties: {
|
|
40
|
+
name: {
|
|
41
|
+
type: string;
|
|
42
|
+
};
|
|
43
|
+
value: {
|
|
44
|
+
type: string;
|
|
45
|
+
};
|
|
46
|
+
updated_at: {
|
|
47
|
+
type: string;
|
|
48
|
+
format: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
name: {
|
|
54
|
+
type: string;
|
|
55
|
+
default: string;
|
|
56
|
+
};
|
|
57
|
+
supported_triggers: {
|
|
58
|
+
type: string;
|
|
59
|
+
items: {
|
|
60
|
+
type: string;
|
|
61
|
+
properties: {
|
|
62
|
+
id: {
|
|
63
|
+
type: string;
|
|
64
|
+
default: string;
|
|
65
|
+
};
|
|
66
|
+
version: {
|
|
67
|
+
type: string;
|
|
68
|
+
};
|
|
69
|
+
url: {
|
|
70
|
+
type: string;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
deployed: {
|
|
76
|
+
type: string;
|
|
77
|
+
};
|
|
78
|
+
status: {
|
|
79
|
+
type: string;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
export default class ActionHandler extends DefaultAPIHandler {
|
|
85
|
+
existing: Asset[] | null;
|
|
86
|
+
constructor(options: any);
|
|
87
|
+
createAction(action: any): Promise<Asset>;
|
|
88
|
+
deleteAction(action: any): Promise<void | never[]>;
|
|
89
|
+
objString(action: any): string;
|
|
90
|
+
deployActions(actions: any): Promise<void>;
|
|
91
|
+
deployAction(action: any): Promise<void>;
|
|
92
|
+
actionChanges(action: any, found: any): Promise<Asset>;
|
|
93
|
+
getType(): Promise<Asset[] | null>;
|
|
94
|
+
processChanges(assets: any): Promise<void>;
|
|
95
|
+
}
|
|
@@ -44,7 +44,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
44
44
|
exports.schema = void 0;
|
|
45
45
|
const lodash_1 = __importDefault(require("lodash"));
|
|
46
46
|
const default_1 = __importStar(require("./default"));
|
|
47
|
-
const logger_1 = __importDefault(require("
|
|
47
|
+
const logger_1 = __importDefault(require("../../../logger"));
|
|
48
48
|
const utils_1 = require("../../utils");
|
|
49
49
|
const MAX_ACTION_DEPLOY_RETRY = 60;
|
|
50
50
|
// With this schema, we can only validate property types but not valid properties on per type basis
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import DefaultAPIHandler from './default';
|
|
2
|
+
import { Asset, Assets } from '../../../types';
|
|
3
|
+
export declare const schema: {
|
|
4
|
+
type: string;
|
|
5
|
+
properties: {
|
|
6
|
+
breachedPasswordDetection: {
|
|
7
|
+
type: string;
|
|
8
|
+
};
|
|
9
|
+
bruteForceProtection: {
|
|
10
|
+
type: string;
|
|
11
|
+
};
|
|
12
|
+
suspiciousIpThrottling: {
|
|
13
|
+
type: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
additionalProperties: boolean;
|
|
17
|
+
};
|
|
18
|
+
export default class AttackProtectionHandler extends DefaultAPIHandler {
|
|
19
|
+
existing: {
|
|
20
|
+
breachedPasswordDetection: any;
|
|
21
|
+
bruteForceProtection: any;
|
|
22
|
+
suspiciousIpThrottling: any;
|
|
23
|
+
} | null;
|
|
24
|
+
constructor(config: DefaultAPIHandler);
|
|
25
|
+
objString(item: Asset): string;
|
|
26
|
+
getType(): Promise<Asset>;
|
|
27
|
+
processChanges(assets: Assets): Promise<void>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import DefaultHandler from './default';
|
|
2
|
+
import { Asset } from '../../../types';
|
|
3
|
+
export declare const schema: {
|
|
4
|
+
type: string;
|
|
5
|
+
properties: {
|
|
6
|
+
templates: {
|
|
7
|
+
type: string;
|
|
8
|
+
items: {
|
|
9
|
+
type: string;
|
|
10
|
+
properties: {
|
|
11
|
+
template: {
|
|
12
|
+
type: string;
|
|
13
|
+
};
|
|
14
|
+
body: {
|
|
15
|
+
type: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export default class BrandingHandler extends DefaultHandler {
|
|
23
|
+
existing: Asset;
|
|
24
|
+
constructor(options: DefaultHandler);
|
|
25
|
+
getType(): Promise<Asset>;
|
|
26
|
+
processChanges(assets: any): Promise<void>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import DefaultHandler from './default';
|
|
2
|
+
import { Asset, Assets } from '../../../types';
|
|
3
|
+
import DefaultAPIHandler from './default';
|
|
4
|
+
export declare const schema: {
|
|
5
|
+
type: string;
|
|
6
|
+
items: {
|
|
7
|
+
type: string;
|
|
8
|
+
properties: {
|
|
9
|
+
client_id: {
|
|
10
|
+
type: string;
|
|
11
|
+
};
|
|
12
|
+
audience: {
|
|
13
|
+
type: string;
|
|
14
|
+
};
|
|
15
|
+
scope: {
|
|
16
|
+
type: string;
|
|
17
|
+
items: {
|
|
18
|
+
type: string;
|
|
19
|
+
};
|
|
20
|
+
uniqueItems: boolean;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
required: string[];
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export default class ClientGrantsHandler extends DefaultHandler {
|
|
27
|
+
existing: Asset[] | null;
|
|
28
|
+
constructor(config: DefaultAPIHandler);
|
|
29
|
+
objString(item: any): string;
|
|
30
|
+
getType(): Promise<Asset>;
|
|
31
|
+
processChanges(assets: Assets): Promise<void>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Asset, Assets } from '../../../types';
|
|
2
|
+
import DefaultAPIHandler from './default';
|
|
3
|
+
export declare const schema: {
|
|
4
|
+
type: string;
|
|
5
|
+
items: {
|
|
6
|
+
type: string;
|
|
7
|
+
properties: {
|
|
8
|
+
name: {
|
|
9
|
+
type: string;
|
|
10
|
+
minLength: number;
|
|
11
|
+
pattern: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
required: string[];
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export default class ClientHandler extends DefaultAPIHandler {
|
|
18
|
+
existing: Asset[] | null;
|
|
19
|
+
constructor(config: DefaultAPIHandler);
|
|
20
|
+
objString(item: any): string;
|
|
21
|
+
processChanges(assets: Assets): Promise<void>;
|
|
22
|
+
getType(): Promise<Asset[]>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import DefaultAPIHandler from './default';
|
|
2
|
+
import { CalculatedChanges, Asset, Assets } from '../../../types';
|
|
3
|
+
import { ConfigFunction } from '../../../configFactory';
|
|
4
|
+
export declare const schema: {
|
|
5
|
+
type: string;
|
|
6
|
+
items: {
|
|
7
|
+
type: string;
|
|
8
|
+
properties: {
|
|
9
|
+
name: {
|
|
10
|
+
type: string;
|
|
11
|
+
};
|
|
12
|
+
strategy: {
|
|
13
|
+
type: string;
|
|
14
|
+
};
|
|
15
|
+
options: {
|
|
16
|
+
type: string;
|
|
17
|
+
};
|
|
18
|
+
enabled_clients: {
|
|
19
|
+
type: string;
|
|
20
|
+
items: {
|
|
21
|
+
type: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
realms: {
|
|
25
|
+
type: string;
|
|
26
|
+
items: {
|
|
27
|
+
type: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
metadata: {
|
|
31
|
+
type: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
required: string[];
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export declare const addExcludedConnectionPropertiesToChanges: ({ proposedChanges, existingConnections, config, }: {
|
|
38
|
+
proposedChanges: CalculatedChanges;
|
|
39
|
+
existingConnections: Asset[];
|
|
40
|
+
config: ConfigFunction;
|
|
41
|
+
}) => CalculatedChanges;
|
|
42
|
+
export default class ConnectionsHandler extends DefaultAPIHandler {
|
|
43
|
+
existing: Asset[] | null;
|
|
44
|
+
constructor(config: DefaultAPIHandler);
|
|
45
|
+
objString(connection: any): string;
|
|
46
|
+
getFormattedOptions(connection: any, clients: any): {
|
|
47
|
+
options: any;
|
|
48
|
+
} | {
|
|
49
|
+
options?: undefined;
|
|
50
|
+
};
|
|
51
|
+
getType(): Promise<Asset[] | null>;
|
|
52
|
+
calcChanges(assets: Assets): Promise<CalculatedChanges>;
|
|
53
|
+
processChanges(assets: Assets): Promise<void>;
|
|
54
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import DefaultAPIHandler from './default';
|
|
2
|
+
import { CalculatedChanges, Assets } from '../../../types';
|
|
3
|
+
export declare const schema: {
|
|
4
|
+
type: string;
|
|
5
|
+
items: {
|
|
6
|
+
type: string;
|
|
7
|
+
properties: {
|
|
8
|
+
strategy: {
|
|
9
|
+
type: string;
|
|
10
|
+
enum: string[];
|
|
11
|
+
default: string;
|
|
12
|
+
};
|
|
13
|
+
name: {
|
|
14
|
+
type: string;
|
|
15
|
+
};
|
|
16
|
+
options: {
|
|
17
|
+
type: string;
|
|
18
|
+
properties: {
|
|
19
|
+
customScripts: {
|
|
20
|
+
type: string;
|
|
21
|
+
properties: {};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
required: string[];
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export default class DatabaseHandler extends DefaultAPIHandler {
|
|
30
|
+
constructor(config: DefaultAPIHandler);
|
|
31
|
+
objString(db: any): string;
|
|
32
|
+
getClientFN(fn: 'create' | 'delete' | 'getAll' | 'update'): Function;
|
|
33
|
+
getType(): Promise<import("../../../types").Asset>;
|
|
34
|
+
calcChanges(assets: Assets): Promise<CalculatedChanges>;
|
|
35
|
+
processChanges(assets: Assets): Promise<void>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Asset, Assets, Auth0APIClient, CalculatedChanges } from '../../../types';
|
|
2
|
+
import { ConfigFunction } from '../../../configFactory';
|
|
3
|
+
export declare function order(value: any): (t: any, n: any, descriptor: any) => any;
|
|
4
|
+
export default class APIHandler {
|
|
5
|
+
config: ConfigFunction;
|
|
6
|
+
id: string;
|
|
7
|
+
type: string;
|
|
8
|
+
updated: number;
|
|
9
|
+
created: number;
|
|
10
|
+
deleted: number;
|
|
11
|
+
existing: null | Asset | Asset[];
|
|
12
|
+
client: Auth0APIClient;
|
|
13
|
+
identifiers: string[];
|
|
14
|
+
objectFields: string[];
|
|
15
|
+
sensitiveFieldsToObfuscate: string[];
|
|
16
|
+
stripUpdateFields: string[];
|
|
17
|
+
stripCreateFields: string[];
|
|
18
|
+
name?: string;
|
|
19
|
+
functions: {
|
|
20
|
+
getAll: string;
|
|
21
|
+
update: string;
|
|
22
|
+
create: string;
|
|
23
|
+
delete: string;
|
|
24
|
+
};
|
|
25
|
+
constructor(options: {
|
|
26
|
+
id?: APIHandler['id'];
|
|
27
|
+
config: ConfigFunction;
|
|
28
|
+
type: APIHandler['type'];
|
|
29
|
+
client: Auth0APIClient;
|
|
30
|
+
objectFields?: APIHandler['objectFields'];
|
|
31
|
+
identifiers?: APIHandler['identifiers'];
|
|
32
|
+
stripUpdateFields?: APIHandler['stripUpdateFields'];
|
|
33
|
+
sensitiveFieldsToObfuscate?: APIHandler['sensitiveFieldsToObfuscate'];
|
|
34
|
+
stripCreateFields?: APIHandler['stripCreateFields'];
|
|
35
|
+
functions: {
|
|
36
|
+
getAll?: string;
|
|
37
|
+
update?: string;
|
|
38
|
+
create?: string;
|
|
39
|
+
delete?: string;
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
getClientFN(fn: string | Function): Function;
|
|
43
|
+
didDelete(item: Asset): void;
|
|
44
|
+
didCreate(item: Asset): void;
|
|
45
|
+
didUpdate(item: Asset): void;
|
|
46
|
+
objString(item: Asset): string;
|
|
47
|
+
getType(): Promise<Asset | Asset[] | null>;
|
|
48
|
+
load(): Promise<{
|
|
49
|
+
[key: string]: Asset | Asset[] | null;
|
|
50
|
+
}>;
|
|
51
|
+
calcChanges(assets: Assets): Promise<CalculatedChanges>;
|
|
52
|
+
validate(assets: Assets): Promise<void>;
|
|
53
|
+
processChanges(assets: Assets, changes: CalculatedChanges): Promise<void>;
|
|
54
|
+
}
|
|
@@ -14,8 +14,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.order = void 0;
|
|
16
16
|
const validationError_1 = __importDefault(require("../../validationError"));
|
|
17
|
-
const logger_1 = __importDefault(require("../../logger"));
|
|
18
17
|
const utils_1 = require("../../utils");
|
|
18
|
+
const logger_1 = __importDefault(require("../../../logger"));
|
|
19
19
|
const calculateChanges_1 = require("../../calculateChanges");
|
|
20
20
|
function order(value) {
|
|
21
21
|
return function decorator(t, n, descriptor) {
|
|
@@ -34,6 +34,8 @@ class APIHandler {
|
|
|
34
34
|
this.identifiers = options.identifiers || ['id', 'name'];
|
|
35
35
|
this.objectFields = options.objectFields || [];
|
|
36
36
|
this.stripUpdateFields = [...(options.stripUpdateFields || []), this.id];
|
|
37
|
+
this.sensitiveFieldsToObfuscate = options.sensitiveFieldsToObfuscate || [];
|
|
38
|
+
this.stripCreateFields = options.stripCreateFields || [];
|
|
37
39
|
this.functions = Object.assign({ getAll: 'getAll', create: 'create', delete: 'delete', update: 'update' }, (options.functions || {}));
|
|
38
40
|
this.updated = 0;
|
|
39
41
|
this.created = 0;
|
|
@@ -68,7 +70,8 @@ class APIHandler {
|
|
|
68
70
|
return __awaiter(this, void 0, void 0, function* () {
|
|
69
71
|
// Load Asset from Tenant
|
|
70
72
|
logger_1.default.info(`Retrieving ${this.type} data from Auth0`);
|
|
71
|
-
|
|
73
|
+
const data = yield this.getType();
|
|
74
|
+
this.existing = (0, utils_1.obfuscateSensitiveValues)(data, this.sensitiveFieldsToObfuscate);
|
|
72
75
|
return { [this.type]: this.existing };
|
|
73
76
|
});
|
|
74
77
|
}
|
|
@@ -76,13 +79,14 @@ class APIHandler {
|
|
|
76
79
|
return __awaiter(this, void 0, void 0, function* () {
|
|
77
80
|
const typeAssets = assets[this.type];
|
|
78
81
|
// Do nothing if not set
|
|
79
|
-
if (!typeAssets)
|
|
82
|
+
if (!typeAssets) {
|
|
80
83
|
return {
|
|
81
84
|
del: [],
|
|
82
85
|
create: [],
|
|
83
86
|
conflicts: [],
|
|
84
87
|
update: [],
|
|
85
88
|
};
|
|
89
|
+
}
|
|
86
90
|
const existing = yield this.getType();
|
|
87
91
|
// Figure out what needs to be updated vs created
|
|
88
92
|
return (0, calculateChanges_1.calculateChanges)({
|
|
@@ -166,8 +170,11 @@ class APIHandler {
|
|
|
166
170
|
generator: (updateItem) => {
|
|
167
171
|
const updateFN = this.getClientFN(this.functions.update);
|
|
168
172
|
const params = { [this.id]: updateItem[this.id] };
|
|
169
|
-
const
|
|
170
|
-
|
|
173
|
+
const updatePayload = (() => {
|
|
174
|
+
let data = (0, utils_1.stripFields)(Object.assign({}, updateItem), this.stripUpdateFields);
|
|
175
|
+
return (0, utils_1.stripObfuscatedFieldsFromPayload)(data, this.sensitiveFieldsToObfuscate);
|
|
176
|
+
})();
|
|
177
|
+
return updateFN(params, updatePayload)
|
|
171
178
|
.then((data) => this.didUpdate(data))
|
|
172
179
|
.catch((err) => {
|
|
173
180
|
throw new Error(`Problem updating ${this.type} ${this.objString(updateItem)}\n${err}`);
|
|
@@ -181,7 +188,11 @@ class APIHandler {
|
|
|
181
188
|
data: create || [],
|
|
182
189
|
generator: (createItem) => {
|
|
183
190
|
const createFunction = this.getClientFN(this.functions.create);
|
|
184
|
-
|
|
191
|
+
const createPayload = (() => {
|
|
192
|
+
const strippedPayload = (0, utils_1.stripFields)(createItem, this.stripCreateFields);
|
|
193
|
+
return (0, utils_1.stripObfuscatedFieldsFromPayload)(strippedPayload, this.sensitiveFieldsToObfuscate);
|
|
194
|
+
})();
|
|
195
|
+
return createFunction(createPayload)
|
|
185
196
|
.then((data) => {
|
|
186
197
|
this.didCreate(data);
|
|
187
198
|
this.created += 1;
|
|
@@ -199,8 +210,11 @@ class APIHandler {
|
|
|
199
210
|
generator: (updateItem) => {
|
|
200
211
|
const updateFN = this.getClientFN(this.functions.update);
|
|
201
212
|
const params = { [this.id]: updateItem[this.id] };
|
|
202
|
-
const
|
|
203
|
-
|
|
213
|
+
const updatePayload = (() => {
|
|
214
|
+
let data = (0, utils_1.stripFields)(Object.assign({}, updateItem), this.stripUpdateFields);
|
|
215
|
+
return (0, utils_1.stripObfuscatedFieldsFromPayload)(data, this.sensitiveFieldsToObfuscate);
|
|
216
|
+
})();
|
|
217
|
+
return updateFN(params, updatePayload)
|
|
204
218
|
.then((data) => {
|
|
205
219
|
this.didUpdate(data);
|
|
206
220
|
this.updated += 1;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import DefaultHandler from './default';
|
|
2
|
+
import { Asset, Assets } from '../../../types';
|
|
3
|
+
export declare const schema: {
|
|
4
|
+
type: string;
|
|
5
|
+
};
|
|
6
|
+
export default class EmailProviderHandler extends DefaultHandler {
|
|
7
|
+
constructor(options: DefaultHandler);
|
|
8
|
+
getType(): Promise<Asset>;
|
|
9
|
+
objString(provider: any): string;
|
|
10
|
+
processChanges(assets: Assets): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import DefaultHandler from './default';
|
|
2
|
+
import { Assets, Asset } from '../../../types';
|
|
3
|
+
export declare const supportedTemplates: string[];
|
|
4
|
+
export declare const schema: {
|
|
5
|
+
type: string;
|
|
6
|
+
items: {
|
|
7
|
+
type: string;
|
|
8
|
+
properties: {
|
|
9
|
+
template: {
|
|
10
|
+
type: string;
|
|
11
|
+
enum: string[];
|
|
12
|
+
};
|
|
13
|
+
body: {
|
|
14
|
+
type: string;
|
|
15
|
+
default: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
required: string[];
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export default class EmailTemplateHandler extends DefaultHandler {
|
|
22
|
+
constructor(options: DefaultHandler);
|
|
23
|
+
getType(): Promise<Asset>;
|
|
24
|
+
updateOrCreate(emailTemplate: any): Promise<void>;
|
|
25
|
+
processChanges(assets: Assets): Promise<void>;
|
|
26
|
+
}
|