auth0-deploy-cli 7.7.1 → 7.10.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 +40 -1
- package/README.md +2 -2
- 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/branding.js +55 -21
- 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/index.js +2 -0
- package/lib/context/directory/handlers/logStreams.d.ts +7 -0
- package/lib/context/directory/handlers/logStreams.js +49 -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 +13 -0
- package/lib/context/yaml/handlers/branding.js +23 -6
- 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/index.js +2 -0
- package/lib/context/yaml/handlers/logStreams.d.ts +7 -0
- package/lib/context/yaml/handlers/logStreams.js +23 -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 +89 -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 +23 -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 +134 -0
- package/lib/tools/auth0/handlers/index.js +2 -0
- package/lib/tools/auth0/handlers/logStreams.d.ts +40 -0
- package/lib/tools/auth0/handlers/logStreams.js +77 -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 +2 -2
- 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/resourceServers.js +1 -1
- package/lib/tools/auth0/handlers/roles.d.ts +48 -0
- package/lib/tools/auth0/handlers/roles.js +2 -2
- package/lib/tools/auth0/handlers/rules.d.ts +55 -0
- package/lib/tools/auth0/handlers/rules.js +2 -2
- 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 +3 -3
- package/lib/tools/constants.d.ts +72 -0
- package/lib/tools/constants.js +4 -1
- package/lib/tools/deploy.d.ts +3 -0
- package/lib/tools/deploy.js +2 -2
- package/lib/tools/index.d.ts +83 -0
- package/lib/tools/utils.d.ts +18 -0
- package/lib/tools/utils.js +36 -3
- package/lib/tools/validationError.d.ts +5 -0
- package/lib/types.d.ts +257 -0
- package/lib/utils.d.ts +67 -0
- package/package.json +10 -10
- package/tsconfig.json +2 -1
- package/lib/tools/logger.js +0 -21
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,36 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [7.10.0] - 2022-04-26
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Branding support for directory format [#505]
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- More comprehensive support for deletions through `AUTH0_ALLOW_DELETE` [#509]
|
|
19
|
+
|
|
20
|
+
## [7.9.0] - 2022-04-19
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
- Log streams support [#495]
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
- `##` String keyword replacements now work when nested inside `@@` array replacements [#504]
|
|
29
|
+
|
|
30
|
+
## [7.8.0] - 2022-04-14
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
|
|
34
|
+
- Type declarations for more seamless integration into Typescript projects when used as a module [#485]
|
|
35
|
+
|
|
36
|
+
### Security
|
|
37
|
+
|
|
38
|
+
- Updated Winston from 2.3.x to 3.3.0 which applies fix for theoretical prototype pollution vulnerability [#497]
|
|
39
|
+
|
|
10
40
|
## [7.7.1] - 2022-04-07
|
|
11
41
|
|
|
12
42
|
### Added
|
|
@@ -666,7 +696,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
666
696
|
[#478]: https://github.com/auth0/auth0-deploy-cli/issues/478
|
|
667
697
|
[#481]: https://github.com/auth0/auth0-deploy-cli/issues/481
|
|
668
698
|
[#482]: https://github.com/auth0/auth0-deploy-cli/issues/482
|
|
669
|
-
[
|
|
699
|
+
[#485]: https://github.com/auth0/auth0-deploy-cli/issues/485
|
|
700
|
+
[#495]: https://github.com/auth0/auth0-deploy-cli/issues/495
|
|
701
|
+
[#497]: https://github.com/auth0/auth0-deploy-cli/issues/497
|
|
702
|
+
[#504]: https://github.com/auth0/auth0-deploy-cli/issues/504
|
|
703
|
+
[#505]: https://github.com/auth0/auth0-deploy-cli/issues/505
|
|
704
|
+
[#509]: https://github.com/auth0/auth0-deploy-cli/issues/509
|
|
705
|
+
[unreleased]: https://github.com/auth0/auth0-deploy-cli/compare/v7.10.0...HEAD
|
|
706
|
+
[7.10.0]: https://github.com/auth0/auth0-deploy-cli/compare/v7.9.0...v7.10.0
|
|
707
|
+
[7.9.0]: https://github.com/auth0/auth0-deploy-cli/compare/v7.8.0...v7.9.0
|
|
708
|
+
[7.8.0]: https://github.com/auth0/auth0-deploy-cli/compare/v7.7.1...v7.8.0
|
|
670
709
|
[7.7.1]: https://github.com/auth0/auth0-deploy-cli/compare/v7.7.0...v7.7.1
|
|
671
710
|
[7.7.0]: https://github.com/auth0/auth0-deploy-cli/compare/v7.6.0...v7.7.0
|
|
672
711
|
[7.6.0]: https://github.com/auth0/auth0-deploy-cli/compare/v7.5.2...v7.6.0
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ The `auth0-deploy-cli` tool supports the importing and exporting of Auth0 Tenant
|
|
|
7
7
|
Supported Auth0 Management API resources
|
|
8
8
|
|
|
9
9
|
- [x] [Actions](https://auth0.com/docs/api/management/v2/#!/Actions/get_actions)
|
|
10
|
-
- [
|
|
10
|
+
- [x] [Branding](https://auth0.com/docs/api/management/v2/#!/Branding/get_branding)
|
|
11
11
|
- [x] [Clients (Applications)](https://auth0.com/docs/api/management/v2#!/Clients/get_clients)
|
|
12
12
|
- [x] [Client Grants](https://auth0.com/docs/api/management/v2#!/Client_Grants/get_client_grants)
|
|
13
13
|
- [x] [Connections](https://auth0.com/docs/api/management/v2#!/Connections/get_connections)
|
|
@@ -16,7 +16,7 @@ Supported Auth0 Management API resources
|
|
|
16
16
|
- [x] [Grants](https://auth0.com/docs/api/management/v2#!/Grants/get_grants)
|
|
17
17
|
- [x] [Hooks](https://auth0.com/docs/api/management/v2#!/Hooks/get_hooks)
|
|
18
18
|
- [x] [Hook Secrets](https://auth0.com/docs/api/management/v2/#!/Hooks/get_secrets)
|
|
19
|
-
- [
|
|
19
|
+
- [x] [Log Streams](https://auth0.com/docs/api/management/v2#!/Log_Streams/get_log_streams)
|
|
20
20
|
- [ ] [Logs](https://auth0.com/docs/api/management/v2#!/Logs/get_logs)
|
|
21
21
|
- [x] [Organizations](https://auth0.com/docs/api/management/v2#!/Organizations/get_organizations)
|
|
22
22
|
- [ ] [Prompts](https://auth0.com/docs/api/management/v2#!/Prompts/get_prompts)
|
package/lib/args.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Config } from './types';
|
|
2
|
+
declare type SharedParams = {
|
|
3
|
+
proxy_url?: string;
|
|
4
|
+
debug?: boolean;
|
|
5
|
+
config_file?: string;
|
|
6
|
+
env?: boolean;
|
|
7
|
+
secret?: string;
|
|
8
|
+
base_path?: string;
|
|
9
|
+
config?: Partial<Config>;
|
|
10
|
+
};
|
|
11
|
+
declare type ImportSpecificParams = {
|
|
12
|
+
input_file: string;
|
|
13
|
+
};
|
|
14
|
+
declare type ExportSpecificParams = {
|
|
15
|
+
format: 'yaml' | 'directory';
|
|
16
|
+
output_folder: string;
|
|
17
|
+
export_ids?: boolean;
|
|
18
|
+
};
|
|
19
|
+
export declare type ExportParams = ExportSpecificParams & SharedParams;
|
|
20
|
+
export declare type ImportParams = ImportSpecificParams & SharedParams;
|
|
21
|
+
export declare type CliParams = (ExportParams | ImportParams) & {
|
|
22
|
+
_: ['export' | 'import' | 'deploy' | 'dump'];
|
|
23
|
+
};
|
|
24
|
+
declare function getParams(): CliParams;
|
|
25
|
+
declare const _default: {
|
|
26
|
+
getParams: typeof getParams;
|
|
27
|
+
};
|
|
28
|
+
export default _default;
|
|
29
|
+
export { getParams };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Config } from './types';
|
|
2
|
+
export declare type ConfigFunction = (arg0: keyof Config) => any;
|
|
3
|
+
export declare const configFactory: () => {
|
|
4
|
+
(key: keyof Config): any;
|
|
5
|
+
setProvider(providerFunction: ConfigFunction): void;
|
|
6
|
+
setValue(key: keyof Config, value: any): void;
|
|
7
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function emailProviderDefaults(emailProvider: any): any;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DirectoryHandler } from '.';
|
|
2
|
+
declare type ParsedAttackProtection = {
|
|
3
|
+
attackProtection: {
|
|
4
|
+
breachedPasswordDetection: unknown;
|
|
5
|
+
bruteForceProtection: unknown;
|
|
6
|
+
suspiciousIpThrottling: unknown;
|
|
7
|
+
} | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const attackProtectionHandler: DirectoryHandler<ParsedAttackProtection>;
|
|
10
|
+
export default attackProtectionHandler;
|
|
@@ -8,6 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
11
22
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
23
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
24
|
};
|
|
@@ -17,7 +28,11 @@ const path_1 = __importDefault(require("path"));
|
|
|
17
28
|
const tools_1 = require("../../../tools");
|
|
18
29
|
const utils_1 = require("../../../utils");
|
|
19
30
|
function parse(context) {
|
|
20
|
-
const
|
|
31
|
+
const brandingDirectory = path_1.default.join(context.filePath, tools_1.constants.BRANDING_DIRECTORY);
|
|
32
|
+
if (!(0, utils_1.existsMustBeDir)(brandingDirectory))
|
|
33
|
+
return { branding: undefined };
|
|
34
|
+
const branding = (0, utils_1.loadJSON)(path_1.default.join(brandingDirectory, 'branding.json'), context.mappings);
|
|
35
|
+
const brandingTemplatesFolder = path_1.default.join(brandingDirectory, tools_1.constants.BRANDING_TEMPLATES_DIRECTORY);
|
|
21
36
|
if (!(0, utils_1.existsMustBeDir)(brandingTemplatesFolder))
|
|
22
37
|
return { branding: context.assets.branding };
|
|
23
38
|
const templatesDefinitionFiles = (0, utils_1.getFiles)(brandingTemplatesFolder, ['.json']);
|
|
@@ -27,32 +42,51 @@ function parse(context) {
|
|
|
27
42
|
return definition;
|
|
28
43
|
}, {});
|
|
29
44
|
return {
|
|
30
|
-
branding: {
|
|
31
|
-
templates,
|
|
32
|
-
},
|
|
45
|
+
branding: Object.assign(Object.assign({}, branding), { templates }),
|
|
33
46
|
};
|
|
34
47
|
}
|
|
35
48
|
function dump(context) {
|
|
36
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
const
|
|
38
|
-
if (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
branding.templates.forEach((templateDefinition) => {
|
|
43
|
-
const markup = templateDefinition.body;
|
|
44
|
-
try {
|
|
45
|
-
fs_extra_1.default.writeFileSync(path_1.default.join(brandingTemplatesFolder, `${templateDefinition.template}.html`), markup);
|
|
46
|
-
}
|
|
47
|
-
catch (e) {
|
|
48
|
-
throw new Error(`Error writing template file: ${templateDefinition.template}, because: ${e.message}`);
|
|
49
|
-
}
|
|
50
|
-
// save the location as relative file.
|
|
51
|
-
templateDefinition.body = `.${path_1.default.sep}${templateDefinition.template}.html`;
|
|
52
|
-
(0, utils_1.dumpJSON)(path_1.default.join(brandingTemplatesFolder, `${templateDefinition.template}.json`), templateDefinition);
|
|
53
|
-
});
|
|
50
|
+
const _a = context.assets.branding, { templates = [] } = _a, branding = __rest(_a, ["templates"]);
|
|
51
|
+
if (!!branding)
|
|
52
|
+
dumpBranding(context);
|
|
53
|
+
if (!!templates)
|
|
54
|
+
dumpBrandingTemplates(context);
|
|
54
55
|
});
|
|
55
56
|
}
|
|
57
|
+
const dumpBrandingTemplates = ({ filePath, assets }) => {
|
|
58
|
+
if (!assets || !assets.branding)
|
|
59
|
+
return;
|
|
60
|
+
const { branding: { templates = [] }, } = assets;
|
|
61
|
+
const brandingTemplatesFolder = path_1.default.join(filePath, tools_1.constants.BRANDING_DIRECTORY, tools_1.constants.BRANDING_TEMPLATES_DIRECTORY);
|
|
62
|
+
fs_extra_1.default.ensureDirSync(brandingTemplatesFolder);
|
|
63
|
+
templates.forEach((templateDefinition) => {
|
|
64
|
+
const markup = templateDefinition.body;
|
|
65
|
+
try {
|
|
66
|
+
fs_extra_1.default.writeFileSync(path_1.default.join(brandingTemplatesFolder, `${templateDefinition.template}.html`), markup);
|
|
67
|
+
}
|
|
68
|
+
catch (e) {
|
|
69
|
+
throw new Error(`Error writing template file: ${templateDefinition.template}, because: ${e.message}`);
|
|
70
|
+
}
|
|
71
|
+
// save the location as relative file.
|
|
72
|
+
templateDefinition.body = `.${path_1.default.sep}${templateDefinition.template}.html`;
|
|
73
|
+
(0, utils_1.dumpJSON)(path_1.default.join(brandingTemplatesFolder, `${templateDefinition.template}.json`), templateDefinition);
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
const dumpBranding = ({ filePath, assets }) => {
|
|
77
|
+
if (!assets || !assets.branding)
|
|
78
|
+
return;
|
|
79
|
+
const { branding } = assets;
|
|
80
|
+
const brandingWithoutTemplates = (() => {
|
|
81
|
+
const newBranding = Object.assign({}, branding);
|
|
82
|
+
delete newBranding.templates;
|
|
83
|
+
return newBranding;
|
|
84
|
+
})();
|
|
85
|
+
const brandingDirectory = path_1.default.join(filePath, tools_1.constants.BRANDING_DIRECTORY);
|
|
86
|
+
fs_extra_1.default.ensureDirSync(brandingDirectory);
|
|
87
|
+
const brandingFilePath = path_1.default.join(brandingDirectory, 'branding.json');
|
|
88
|
+
(0, utils_1.dumpJSON)(brandingFilePath, brandingWithoutTemplates);
|
|
89
|
+
};
|
|
56
90
|
const brandingHandler = {
|
|
57
91
|
parse,
|
|
58
92
|
dump,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DirectoryHandler } from '.';
|
|
2
|
+
declare type ParsedGuardianFactorProviders = {
|
|
3
|
+
guardianFactorProviders: unknown[] | undefined;
|
|
4
|
+
};
|
|
5
|
+
declare const guardianFactorProvidersHandler: DirectoryHandler<ParsedGuardianFactorProviders>;
|
|
6
|
+
export default guardianFactorProvidersHandler;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DirectoryHandler } from '.';
|
|
2
|
+
declare type ParsedGuardianFactorTemplates = {
|
|
3
|
+
guardianFactorTemplates: unknown[] | undefined;
|
|
4
|
+
};
|
|
5
|
+
declare const guardianFactorTemplatesHandler: DirectoryHandler<ParsedGuardianFactorTemplates>;
|
|
6
|
+
export default guardianFactorTemplatesHandler;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DirectoryHandler } from '.';
|
|
2
|
+
declare type ParsedGuardianFactorMessageTypes = {
|
|
3
|
+
guardianPhoneFactorMessageTypes: unknown;
|
|
4
|
+
} | {};
|
|
5
|
+
declare const guardianFactorMessageTypesHandler: DirectoryHandler<ParsedGuardianFactorMessageTypes>;
|
|
6
|
+
export default guardianFactorMessageTypesHandler;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DirectoryHandler } from '.';
|
|
2
|
+
declare type ParsedGuardianFactorSelectedProvider = {
|
|
3
|
+
guardianPhoneFactorSelectedProvider: unknown;
|
|
4
|
+
} | {};
|
|
5
|
+
declare const guardianFactorSelectedProviderHandler: DirectoryHandler<ParsedGuardianFactorSelectedProvider>;
|
|
6
|
+
export default guardianFactorSelectedProviderHandler;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import DirectoryContext from '..';
|
|
2
|
+
import { AssetTypes } from '../../../types';
|
|
3
|
+
export declare type DirectoryHandler<T> = {
|
|
4
|
+
dump: (context: DirectoryContext) => void;
|
|
5
|
+
parse: (context: DirectoryContext) => T;
|
|
6
|
+
};
|
|
7
|
+
declare const directoryHandlers: {
|
|
8
|
+
[key in AssetTypes]: DirectoryHandler<{
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
}>;
|
|
11
|
+
};
|
|
12
|
+
export default directoryHandlers;
|
|
@@ -28,6 +28,7 @@ const organizations_1 = __importDefault(require("./organizations"));
|
|
|
28
28
|
const triggers_1 = __importDefault(require("./triggers"));
|
|
29
29
|
const attackProtection_1 = __importDefault(require("./attackProtection"));
|
|
30
30
|
const branding_1 = __importDefault(require("./branding"));
|
|
31
|
+
const logStreams_1 = __importDefault(require("./logStreams"));
|
|
31
32
|
const directoryHandlers = {
|
|
32
33
|
rules: rules_1.default,
|
|
33
34
|
rulesConfigs: rulesConfigs_1.default,
|
|
@@ -54,5 +55,6 @@ const directoryHandlers = {
|
|
|
54
55
|
triggers: triggers_1.default,
|
|
55
56
|
attackProtection: attackProtection_1.default,
|
|
56
57
|
branding: branding_1.default,
|
|
58
|
+
logStreams: logStreams_1.default,
|
|
57
59
|
};
|
|
58
60
|
exports.default = directoryHandlers;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
16
|
+
const path_1 = __importDefault(require("path"));
|
|
17
|
+
const tools_1 = require("../../../tools");
|
|
18
|
+
const utils_1 = require("../../../utils");
|
|
19
|
+
function parse(context) {
|
|
20
|
+
const logStreamsDirectory = path_1.default.join(context.filePath, tools_1.constants.LOG_STREAMS_DIRECTORY);
|
|
21
|
+
if (!(0, utils_1.existsMustBeDir)(logStreamsDirectory))
|
|
22
|
+
return { logStreams: undefined }; // Skip
|
|
23
|
+
const foundFiles = (0, utils_1.getFiles)(logStreamsDirectory, ['.json']);
|
|
24
|
+
const logStreams = foundFiles
|
|
25
|
+
.map((f) => (0, utils_1.loadJSON)(f, context.mappings))
|
|
26
|
+
.filter((p) => Object.keys(p).length > 0); // Filter out empty rulesConfigs
|
|
27
|
+
return {
|
|
28
|
+
logStreams,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function dump(context) {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const logStreams = context.assets.logStreams || [];
|
|
34
|
+
if (!logStreams)
|
|
35
|
+
return; // Skip, nothing to dump
|
|
36
|
+
// Create Rules folder
|
|
37
|
+
const logStreamsDirectory = path_1.default.join(context.filePath, tools_1.constants.LOG_STREAMS_DIRECTORY);
|
|
38
|
+
fs_extra_1.default.ensureDirSync(logStreamsDirectory);
|
|
39
|
+
logStreams.forEach((logStream) => {
|
|
40
|
+
const ruleFile = path_1.default.join(logStreamsDirectory, `${(0, utils_1.sanitize)(logStream.name)}.json`);
|
|
41
|
+
(0, utils_1.dumpJSON)(ruleFile, logStream);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
const logStreamsHandler = {
|
|
46
|
+
parse,
|
|
47
|
+
dump,
|
|
48
|
+
};
|
|
49
|
+
exports.default = logStreamsHandler;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DirectoryHandler } from '.';
|
|
2
|
+
declare type ParsedTenant = {
|
|
3
|
+
tenant: {
|
|
4
|
+
session_lifetime: number;
|
|
5
|
+
idle_session_lifetime: number;
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
};
|
|
8
|
+
} | {};
|
|
9
|
+
declare const tenantHandler: DirectoryHandler<ParsedTenant>;
|
|
10
|
+
export default tenantHandler;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Assets, Auth0APIClient, Config } from '../../types';
|
|
2
|
+
declare type KeywordMappings = {
|
|
3
|
+
[key: string]: (string | number)[] | string | number;
|
|
4
|
+
};
|
|
5
|
+
export default class DirectoryContext {
|
|
6
|
+
basePath: string;
|
|
7
|
+
filePath: string;
|
|
8
|
+
config: Config;
|
|
9
|
+
mappings: KeywordMappings;
|
|
10
|
+
mgmtClient: Auth0APIClient;
|
|
11
|
+
assets: Assets;
|
|
12
|
+
constructor(config: Config, mgmtClient: Auth0APIClient);
|
|
13
|
+
loadFile(f: string, folder: string): string;
|
|
14
|
+
load(): Promise<void>;
|
|
15
|
+
dump(): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { YAMLHandler } from '.';
|
|
2
|
+
declare type BrandingTemplate = {
|
|
3
|
+
template: string;
|
|
4
|
+
body: string;
|
|
5
|
+
};
|
|
6
|
+
declare type ParsedBranding = {
|
|
7
|
+
branding: {
|
|
8
|
+
templates?: BrandingTemplate[];
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
declare const brandingHandler: YAMLHandler<ParsedBranding>;
|
|
13
|
+
export default brandingHandler;
|