auth0-deploy-cli 7.11.0 → 7.12.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 +3 -3
- package/CHANGELOG.md +29 -1
- package/lib/context/directory/handlers/branding.js +9 -3
- package/lib/context/directory/handlers/customDomains.d.ts +5 -0
- package/lib/context/directory/handlers/customDomains.js +46 -0
- package/lib/context/directory/handlers/index.js +4 -0
- package/lib/context/directory/handlers/prompts.d.ts +6 -0
- package/lib/context/directory/handlers/prompts.js +81 -0
- package/lib/context/yaml/handlers/customDomains.d.ts +5 -0
- package/lib/context/yaml/handlers/customDomains.js +26 -0
- package/lib/context/yaml/handlers/index.js +4 -0
- package/lib/context/yaml/handlers/prompts.d.ts +6 -0
- package/lib/context/yaml/handlers/prompts.js +26 -0
- package/lib/index.d.ts +2 -0
- package/lib/tools/auth0/handlers/actions.js +20 -4
- package/lib/tools/auth0/handlers/customDomains.d.ts +43 -0
- package/lib/tools/auth0/handlers/customDomains.js +85 -0
- package/lib/tools/auth0/handlers/index.d.ts +34 -24
- package/lib/tools/auth0/handlers/index.js +2 -0
- package/lib/tools/auth0/handlers/prompts.d.ts +41 -3
- package/lib/tools/auth0/handlers/prompts.js +139 -19
- package/lib/tools/auth0/handlers/rules.js +2 -2
- package/lib/tools/constants.d.ts +2 -0
- package/lib/tools/constants.js +2 -0
- package/lib/tools/index.d.ts +2 -0
- package/lib/types.d.ts +23 -8
- package/lib/types.js +46 -0
- package/lib/utils.d.ts +48 -0
- package/package.json +1 -1
package/.circleci/config.yml
CHANGED
|
@@ -47,13 +47,13 @@ jobs:
|
|
|
47
47
|
- run:
|
|
48
48
|
name: Publish package
|
|
49
49
|
command: npm publish
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
ts_migration_progress:
|
|
52
52
|
machine:
|
|
53
53
|
image: ubuntu-2004:202111-02
|
|
54
54
|
steps:
|
|
55
55
|
- checkout
|
|
56
|
-
- run :
|
|
56
|
+
- run :
|
|
57
57
|
name: Typescript Migration Progress
|
|
58
58
|
command: sh typescript-migration-progress.sh
|
|
59
59
|
|
|
@@ -66,7 +66,7 @@ workflows:
|
|
|
66
66
|
v: "lts"
|
|
67
67
|
- test:
|
|
68
68
|
name: test_current
|
|
69
|
-
v: "
|
|
69
|
+
v: "18.0.0"
|
|
70
70
|
test_and_deploy:
|
|
71
71
|
jobs:
|
|
72
72
|
- test:
|
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [7.12.1] - 2022-05-11
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Unable to deploy without branding settings feature [#532]
|
|
15
|
+
|
|
16
|
+
## [7.12.0] - 2022-05-10
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- Prompts support (both prompts settings and custom text for prompts) [#530]
|
|
21
|
+
- Custom domains support [#527]
|
|
22
|
+
|
|
23
|
+
## [7.11.1] - 2022-05-04
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
|
|
27
|
+
- Deployment of newly-created actions always failing due to "A draft must be in the 'built' state" error [#524]
|
|
28
|
+
- Undefined `updateRule` Auth0 SDK alias replaced with operational `rules.update` [#526]
|
|
29
|
+
|
|
10
30
|
## [7.11.0] - 2022-04-28
|
|
11
31
|
|
|
12
32
|
### Added
|
|
@@ -714,7 +734,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
714
734
|
[#509]: https://github.com/auth0/auth0-deploy-cli/issues/509
|
|
715
735
|
[#512]: https://github.com/auth0/auth0-deploy-cli/issues/512
|
|
716
736
|
[#517]: https://github.com/auth0/auth0-deploy-cli/issues/517
|
|
717
|
-
[
|
|
737
|
+
[#524]: https://github.com/auth0/auth0-deploy-cli/issues/524
|
|
738
|
+
[#526]: https://github.com/auth0/auth0-deploy-cli/issues/526
|
|
739
|
+
[#527]: https://github.com/auth0/auth0-deploy-cli/issues/527
|
|
740
|
+
[#530]: https://github.com/auth0/auth0-deploy-cli/issues/530
|
|
741
|
+
[#532]: https://github.com/auth0/auth0-deploy-cli/issues/532
|
|
742
|
+
[unreleased]: https://github.com/auth0/auth0-deploy-cli/compare/v7.12.1...HEAD
|
|
743
|
+
[7.12.1]: https://github.com/auth0/auth0-deploy-cli/compare/v7.12.0...v7.12.1
|
|
744
|
+
[7.12.0]: https://github.com/auth0/auth0-deploy-cli/compare/v7.11.1...v7.12.0
|
|
745
|
+
[7.11.1]: https://github.com/auth0/auth0-deploy-cli/compare/v7.11.0...v7.11.1
|
|
718
746
|
[7.11.0]: https://github.com/auth0/auth0-deploy-cli/compare/v7.10.0...v7.11.0
|
|
719
747
|
[7.10.0]: https://github.com/auth0/auth0-deploy-cli/compare/v7.9.0...v7.10.0
|
|
720
748
|
[7.9.0]: https://github.com/auth0/auth0-deploy-cli/compare/v7.8.0...v7.9.0
|
|
@@ -18,12 +18,18 @@ const tools_1 = require("../../../tools");
|
|
|
18
18
|
const utils_1 = require("../../../utils");
|
|
19
19
|
function parse(context) {
|
|
20
20
|
const brandingDirectory = path_1.default.join(context.filePath, tools_1.constants.BRANDING_DIRECTORY);
|
|
21
|
+
const brandingFile = path_1.default.join(brandingDirectory, 'branding.json');
|
|
21
22
|
if (!(0, utils_1.existsMustBeDir)(brandingDirectory))
|
|
22
23
|
return { branding: null };
|
|
23
|
-
const
|
|
24
|
+
const brandingSettings = (() => {
|
|
25
|
+
if ((0, utils_1.isFile)(brandingFile)) {
|
|
26
|
+
return (0, utils_1.loadJSON)(brandingFile, context.mappings);
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
})();
|
|
24
30
|
const brandingTemplatesFolder = path_1.default.join(brandingDirectory, tools_1.constants.BRANDING_TEMPLATES_DIRECTORY);
|
|
25
31
|
if (!(0, utils_1.existsMustBeDir)(brandingTemplatesFolder))
|
|
26
|
-
return { branding:
|
|
32
|
+
return { branding: brandingSettings };
|
|
27
33
|
const templatesDefinitionFiles = (0, utils_1.getFiles)(brandingTemplatesFolder, ['.json']);
|
|
28
34
|
const templates = templatesDefinitionFiles.map((templateDefinitionFile) => {
|
|
29
35
|
const definition = (0, utils_1.loadJSON)(templateDefinitionFile, context.mappings);
|
|
@@ -31,7 +37,7 @@ function parse(context) {
|
|
|
31
37
|
return definition;
|
|
32
38
|
}, {});
|
|
33
39
|
return {
|
|
34
|
-
branding: Object.assign(Object.assign({},
|
|
40
|
+
branding: Object.assign(Object.assign({}, brandingSettings), { templates }),
|
|
35
41
|
};
|
|
36
42
|
}
|
|
37
43
|
function dump(context) {
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DirectoryHandler } from '.';
|
|
2
|
+
import { Asset, ParsedAsset } from '../../../types';
|
|
3
|
+
declare type ParsedCustomDomains = ParsedAsset<'customDomains', Asset[]>;
|
|
4
|
+
declare const customDomainsHandler: DirectoryHandler<ParsedCustomDomains>;
|
|
5
|
+
export default customDomainsHandler;
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
const getCustomDomainsDirectory = (filePath) => path_1.default.join(filePath, tools_1.constants.CUSTOM_DOMAINS_DIRECTORY);
|
|
20
|
+
const getCustomDomainsFile = (filePath) => path_1.default.join(getCustomDomainsDirectory(filePath), 'custom-domains.json');
|
|
21
|
+
function parse(context) {
|
|
22
|
+
const customDomainsDirectory = getCustomDomainsDirectory(context.filePath);
|
|
23
|
+
if (!(0, utils_1.existsMustBeDir)(customDomainsDirectory))
|
|
24
|
+
return { customDomains: null }; // Skip
|
|
25
|
+
const customDomainsFile = getCustomDomainsFile(context.filePath);
|
|
26
|
+
return {
|
|
27
|
+
customDomains: (0, utils_1.loadJSON)(customDomainsFile, context.mappings),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function dump(context) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const { customDomains } = context.assets;
|
|
33
|
+
if (!customDomains)
|
|
34
|
+
return; // Skip, nothing to dump
|
|
35
|
+
// Create Rules folder
|
|
36
|
+
const customDomainsDirectory = getCustomDomainsDirectory(context.filePath);
|
|
37
|
+
fs_extra_1.default.ensureDirSync(customDomainsDirectory);
|
|
38
|
+
const customDomainsFile = getCustomDomainsFile(context.filePath);
|
|
39
|
+
(0, utils_1.dumpJSON)(customDomainsFile, customDomains);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
const customDomainsHandler = {
|
|
43
|
+
parse,
|
|
44
|
+
dump,
|
|
45
|
+
};
|
|
46
|
+
exports.default = customDomainsHandler;
|
|
@@ -29,6 +29,8 @@ const triggers_1 = __importDefault(require("./triggers"));
|
|
|
29
29
|
const attackProtection_1 = __importDefault(require("./attackProtection"));
|
|
30
30
|
const branding_1 = __importDefault(require("./branding"));
|
|
31
31
|
const logStreams_1 = __importDefault(require("./logStreams"));
|
|
32
|
+
const prompts_1 = __importDefault(require("./prompts"));
|
|
33
|
+
const customDomains_1 = __importDefault(require("./customDomains"));
|
|
32
34
|
const directoryHandlers = {
|
|
33
35
|
rules: rules_1.default,
|
|
34
36
|
rulesConfigs: rulesConfigs_1.default,
|
|
@@ -56,5 +58,7 @@ const directoryHandlers = {
|
|
|
56
58
|
attackProtection: attackProtection_1.default,
|
|
57
59
|
branding: branding_1.default,
|
|
58
60
|
logStreams: logStreams_1.default,
|
|
61
|
+
prompts: prompts_1.default,
|
|
62
|
+
customDomains: customDomains_1.default,
|
|
59
63
|
};
|
|
60
64
|
exports.default = directoryHandlers;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DirectoryHandler } from '.';
|
|
2
|
+
import { ParsedAsset } from '../../../types';
|
|
3
|
+
import { Prompts } from '../../../tools/auth0/handlers/prompts';
|
|
4
|
+
declare type ParsedPrompts = ParsedAsset<'prompts', Prompts>;
|
|
5
|
+
declare const promptsHandler: DirectoryHandler<ParsedPrompts>;
|
|
6
|
+
export default promptsHandler;
|
|
@@ -0,0 +1,81 @@
|
|
|
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 __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
|
+
};
|
|
22
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const path_1 = __importDefault(require("path"));
|
|
27
|
+
const fs_extra_1 = require("fs-extra");
|
|
28
|
+
const tools_1 = require("../../../tools");
|
|
29
|
+
const utils_1 = require("../../../utils");
|
|
30
|
+
const getPromptsDirectory = (filePath) => {
|
|
31
|
+
return path_1.default.join(filePath, tools_1.constants.PROMPTS_DIRECTORY);
|
|
32
|
+
};
|
|
33
|
+
const getPromptsSettingsFile = (promptsDirectory) => {
|
|
34
|
+
return path_1.default.join(promptsDirectory, 'prompts.json');
|
|
35
|
+
};
|
|
36
|
+
const getCustomTextFile = (promptsDirectory) => {
|
|
37
|
+
return path_1.default.join(promptsDirectory, 'custom-text.json');
|
|
38
|
+
};
|
|
39
|
+
function parse(context) {
|
|
40
|
+
const promptsDirectory = getPromptsDirectory(context.filePath);
|
|
41
|
+
if (!(0, utils_1.existsMustBeDir)(promptsDirectory))
|
|
42
|
+
return { prompts: null }; // Skip
|
|
43
|
+
const promptsSettings = (() => {
|
|
44
|
+
const promptsSettingsFile = getPromptsSettingsFile(promptsDirectory);
|
|
45
|
+
if (!(0, utils_1.isFile)(promptsSettingsFile))
|
|
46
|
+
return {};
|
|
47
|
+
return (0, utils_1.loadJSON)(promptsSettingsFile, context.mappings);
|
|
48
|
+
})();
|
|
49
|
+
const customText = (() => {
|
|
50
|
+
const customTextFile = getCustomTextFile(promptsDirectory);
|
|
51
|
+
if (!(0, utils_1.isFile)(customTextFile))
|
|
52
|
+
return {};
|
|
53
|
+
return (0, utils_1.loadJSON)(customTextFile, context.mappings);
|
|
54
|
+
})();
|
|
55
|
+
return {
|
|
56
|
+
prompts: Object.assign(Object.assign({}, promptsSettings), { customText }),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function dump(context) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
const { prompts } = context.assets;
|
|
62
|
+
if (!prompts)
|
|
63
|
+
return;
|
|
64
|
+
const { customText } = prompts, promptsSettings = __rest(prompts, ["customText"]);
|
|
65
|
+
const promptsDirectory = getPromptsDirectory(context.filePath);
|
|
66
|
+
(0, fs_extra_1.ensureDirSync)(promptsDirectory);
|
|
67
|
+
if (!promptsSettings)
|
|
68
|
+
return;
|
|
69
|
+
const promptsSettingsFile = getPromptsSettingsFile(promptsDirectory);
|
|
70
|
+
(0, utils_1.dumpJSON)(promptsSettingsFile, promptsSettings);
|
|
71
|
+
if (!customText)
|
|
72
|
+
return;
|
|
73
|
+
const customTextFile = getCustomTextFile(promptsDirectory);
|
|
74
|
+
(0, utils_1.dumpJSON)(customTextFile, customText);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
const promptsHandler = {
|
|
78
|
+
parse,
|
|
79
|
+
dump,
|
|
80
|
+
};
|
|
81
|
+
exports.default = promptsHandler;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { YAMLHandler } from '.';
|
|
2
|
+
import { Asset, ParsedAsset } from '../../../types';
|
|
3
|
+
declare type ParsedCustomDomains = ParsedAsset<'customDomains', Asset[]>;
|
|
4
|
+
declare const customDomainsHandler: YAMLHandler<ParsedCustomDomains>;
|
|
5
|
+
export default customDomainsHandler;
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
function parseAndDump(context) {
|
|
13
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
const { customDomains } = context.assets;
|
|
15
|
+
if (!customDomains)
|
|
16
|
+
return { customDomains: null };
|
|
17
|
+
return {
|
|
18
|
+
customDomains,
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
const customDomainsHandler = {
|
|
23
|
+
parse: parseAndDump,
|
|
24
|
+
dump: parseAndDump,
|
|
25
|
+
};
|
|
26
|
+
exports.default = customDomainsHandler;
|
|
@@ -29,6 +29,8 @@ const triggers_1 = __importDefault(require("./triggers"));
|
|
|
29
29
|
const attackProtection_1 = __importDefault(require("./attackProtection"));
|
|
30
30
|
const branding_1 = __importDefault(require("./branding"));
|
|
31
31
|
const logStreams_1 = __importDefault(require("./logStreams"));
|
|
32
|
+
const prompts_1 = __importDefault(require("./prompts"));
|
|
33
|
+
const customDomains_1 = __importDefault(require("./customDomains"));
|
|
32
34
|
const yamlHandlers = {
|
|
33
35
|
rules: rules_1.default,
|
|
34
36
|
hooks: hooks_1.default,
|
|
@@ -56,5 +58,7 @@ const yamlHandlers = {
|
|
|
56
58
|
attackProtection: attackProtection_1.default,
|
|
57
59
|
branding: branding_1.default,
|
|
58
60
|
logStreams: logStreams_1.default,
|
|
61
|
+
prompts: prompts_1.default,
|
|
62
|
+
customDomains: customDomains_1.default,
|
|
59
63
|
};
|
|
60
64
|
exports.default = yamlHandlers;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { YAMLHandler } from '.';
|
|
2
|
+
import { ParsedAsset } from '../../../types';
|
|
3
|
+
import { Prompts } from '../../../tools/auth0/handlers/prompts';
|
|
4
|
+
declare type ParsedPrompts = ParsedAsset<'prompts', Prompts>;
|
|
5
|
+
declare const promptsHandler: YAMLHandler<ParsedPrompts>;
|
|
6
|
+
export default promptsHandler;
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
function parseAndDump(context) {
|
|
13
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
const { prompts } = context.assets;
|
|
15
|
+
if (!prompts)
|
|
16
|
+
return { prompts: null };
|
|
17
|
+
return {
|
|
18
|
+
prompts,
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
const promptsHandler = {
|
|
23
|
+
parse: parseAndDump,
|
|
24
|
+
dump: parseAndDump,
|
|
25
|
+
};
|
|
26
|
+
exports.default = promptsHandler;
|
package/lib/index.d.ts
CHANGED
|
@@ -77,6 +77,8 @@ declare const _default: {
|
|
|
77
77
|
EMAIL_TEMPLATES_NAMES: string[];
|
|
78
78
|
SUPPORTED_BRANDING_TEMPLATES: string[];
|
|
79
79
|
LOG_STREAMS_DIRECTORY: string;
|
|
80
|
+
PROMPTS_DIRECTORY: string;
|
|
81
|
+
CUSTOM_DOMAINS_DIRECTORY: string;
|
|
80
82
|
};
|
|
81
83
|
deploy: typeof import("./tools").deploy;
|
|
82
84
|
keywordReplace: typeof import("./tools").keywordReplace;
|
|
@@ -46,7 +46,7 @@ const lodash_1 = __importDefault(require("lodash"));
|
|
|
46
46
|
const default_1 = __importStar(require("./default"));
|
|
47
47
|
const logger_1 = __importDefault(require("../../../logger"));
|
|
48
48
|
const utils_1 = require("../../utils");
|
|
49
|
-
const
|
|
49
|
+
const MAX_ACTION_DEPLOY_RETRY_ATTEMPTS = 60; // 60 * 2s => 2 min timeout
|
|
50
50
|
// With this schema, we can only validate property types but not valid properties on per type basis
|
|
51
51
|
exports.schema = {
|
|
52
52
|
type: 'array',
|
|
@@ -162,10 +162,10 @@ class ActionHandler extends default_1.default {
|
|
|
162
162
|
logger_1.default.info(`[${this.type}]: Waiting for build to complete ${this.objString(action)}`);
|
|
163
163
|
action.retry_count = 1;
|
|
164
164
|
}
|
|
165
|
-
if (action.retry_count >
|
|
165
|
+
if (action.retry_count > MAX_ACTION_DEPLOY_RETRY_ATTEMPTS) {
|
|
166
166
|
throw err;
|
|
167
167
|
}
|
|
168
|
-
yield sleep(
|
|
168
|
+
yield sleep(2000);
|
|
169
169
|
action.retry_count += 1;
|
|
170
170
|
yield this.deployAction(action);
|
|
171
171
|
}
|
|
@@ -233,9 +233,25 @@ class ActionHandler extends default_1.default {
|
|
|
233
233
|
return;
|
|
234
234
|
const changes = yield this.calcChanges(assets);
|
|
235
235
|
yield _super.processChanges.call(this, assets, changes);
|
|
236
|
+
const postProcessedActions = yield (() => __awaiter(this, void 0, void 0, function* () {
|
|
237
|
+
this.existing = null; //Clear the cache
|
|
238
|
+
const actions = yield this.getType();
|
|
239
|
+
return actions;
|
|
240
|
+
}))();
|
|
236
241
|
// Deploy actions
|
|
237
242
|
const deployActions = [
|
|
238
|
-
...changes.create
|
|
243
|
+
...changes.create
|
|
244
|
+
.filter((action) => action.deployed)
|
|
245
|
+
.map((actionWithoutId) => {
|
|
246
|
+
var _a;
|
|
247
|
+
// Add IDs to just-created actions
|
|
248
|
+
const actionId = (_a = postProcessedActions === null || postProcessedActions === void 0 ? void 0 : postProcessedActions.find((postProcessedAction) => {
|
|
249
|
+
return postProcessedAction.name === actionWithoutId.name;
|
|
250
|
+
})) === null || _a === void 0 ? void 0 : _a.id;
|
|
251
|
+
const actionWithId = Object.assign(Object.assign({}, actionWithoutId), { id: actionId });
|
|
252
|
+
return actionWithId;
|
|
253
|
+
})
|
|
254
|
+
.filter((action) => !!action.id),
|
|
239
255
|
...changes.update.filter((action) => action.deployed),
|
|
240
256
|
];
|
|
241
257
|
yield this.deployActions(deployActions);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import DefaultAPIHandler from './default';
|
|
2
|
+
import { Asset, Assets } from '../../../types';
|
|
3
|
+
export declare const schema: {
|
|
4
|
+
type: string;
|
|
5
|
+
items: {
|
|
6
|
+
type: string;
|
|
7
|
+
properties: {
|
|
8
|
+
custom_domain_id: {
|
|
9
|
+
type: string;
|
|
10
|
+
};
|
|
11
|
+
custom_client_ip_header: {
|
|
12
|
+
type: string;
|
|
13
|
+
nullable: boolean;
|
|
14
|
+
enum: (string | null)[];
|
|
15
|
+
};
|
|
16
|
+
domain: {
|
|
17
|
+
type: string;
|
|
18
|
+
};
|
|
19
|
+
primary: {
|
|
20
|
+
type: string;
|
|
21
|
+
};
|
|
22
|
+
status: {
|
|
23
|
+
type: string;
|
|
24
|
+
enum: string[];
|
|
25
|
+
};
|
|
26
|
+
type: {
|
|
27
|
+
type: string;
|
|
28
|
+
enum: string[];
|
|
29
|
+
};
|
|
30
|
+
verification: {
|
|
31
|
+
type: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
required: string[];
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export default class CustomDomainsHadnler extends DefaultAPIHandler {
|
|
38
|
+
existing: Asset[] | null;
|
|
39
|
+
constructor(config: DefaultAPIHandler);
|
|
40
|
+
objString(item: Asset): string;
|
|
41
|
+
getType(): Promise<Asset>;
|
|
42
|
+
processChanges(assets: Assets): Promise<void>;
|
|
43
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
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
|
+
exports.schema = void 0;
|
|
16
|
+
const default_1 = __importDefault(require("./default"));
|
|
17
|
+
exports.schema = {
|
|
18
|
+
type: 'array',
|
|
19
|
+
items: {
|
|
20
|
+
type: 'object',
|
|
21
|
+
properties: {
|
|
22
|
+
custom_domain_id: { type: 'string' },
|
|
23
|
+
custom_client_ip_header: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
nullable: true,
|
|
26
|
+
enum: ['true-client-ip', 'cf-connecting-ip', 'x-forwarded-for', null],
|
|
27
|
+
},
|
|
28
|
+
domain: { type: 'string' },
|
|
29
|
+
primary: { type: 'boolean' },
|
|
30
|
+
status: { type: 'string', enum: ['pending_verification', 'ready', 'disabled', 'pending'] },
|
|
31
|
+
type: { type: 'string', enum: ['auth0_managed_certs', 'self_managed_certs'] },
|
|
32
|
+
verification: { type: 'object' },
|
|
33
|
+
},
|
|
34
|
+
required: ['domain', 'type'],
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
class CustomDomainsHadnler extends default_1.default {
|
|
38
|
+
constructor(config) {
|
|
39
|
+
super(Object.assign(Object.assign({}, config), { type: 'customDomains', id: 'custom_domain_id', identifiers: ['domain'], stripCreateFields: ['status', 'primary', 'verification'], functions: {
|
|
40
|
+
//@ts-ignore
|
|
41
|
+
delete: (args) => {
|
|
42
|
+
return this.client.customDomains.delete({ id: args.custom_domain_id });
|
|
43
|
+
},
|
|
44
|
+
} }));
|
|
45
|
+
}
|
|
46
|
+
objString(item) {
|
|
47
|
+
return super.objString(item.domain);
|
|
48
|
+
}
|
|
49
|
+
getType() {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
if (this.existing) {
|
|
52
|
+
return this.existing;
|
|
53
|
+
}
|
|
54
|
+
const customDomains = yield this.client.customDomains.getAll({ paginate: false });
|
|
55
|
+
this.existing = customDomains;
|
|
56
|
+
return customDomains;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
processChanges(assets) {
|
|
60
|
+
const _super = Object.create(null, {
|
|
61
|
+
processChanges: { get: () => super.processChanges }
|
|
62
|
+
});
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
const { customDomains } = assets;
|
|
65
|
+
if (!customDomains)
|
|
66
|
+
return;
|
|
67
|
+
const changes = yield this.calcChanges(assets).then((changes) => {
|
|
68
|
+
const changesWithoutUpdates = Object.assign(Object.assign({}, changes), { create: changes.create.map((customDomainToCreate) => {
|
|
69
|
+
const newCustomDomain = Object.assign({}, customDomainToCreate);
|
|
70
|
+
if (customDomainToCreate.custom_client_ip_header === null) {
|
|
71
|
+
delete newCustomDomain.custom_client_ip_header;
|
|
72
|
+
}
|
|
73
|
+
return newCustomDomain;
|
|
74
|
+
}), delete: changes.del.map((deleteToMake) => {
|
|
75
|
+
const deleteWithSDKCompatibleID = Object.assign(Object.assign({}, deleteToMake), { id: deleteToMake.custom_domain_id });
|
|
76
|
+
delete deleteWithSDKCompatibleID['custom_domain_id'];
|
|
77
|
+
return deleteWithSDKCompatibleID;
|
|
78
|
+
}), update: [] });
|
|
79
|
+
return changesWithoutUpdates;
|
|
80
|
+
});
|
|
81
|
+
yield _super.processChanges.call(this, assets, changes);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
exports.default = CustomDomainsHadnler;
|
|
@@ -5,37 +5,37 @@ declare const _default: {
|
|
|
5
5
|
excludeSchema?: any;
|
|
6
6
|
schema: any;
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
hooks: {
|
|
9
9
|
default: typeof APIHandler;
|
|
10
10
|
excludeSchema?: any;
|
|
11
11
|
schema: any;
|
|
12
12
|
};
|
|
13
|
-
|
|
13
|
+
actions: {
|
|
14
14
|
default: typeof APIHandler;
|
|
15
15
|
excludeSchema?: any;
|
|
16
16
|
schema: any;
|
|
17
17
|
};
|
|
18
|
-
|
|
18
|
+
triggers: {
|
|
19
19
|
default: typeof APIHandler;
|
|
20
20
|
excludeSchema?: any;
|
|
21
21
|
schema: any;
|
|
22
22
|
};
|
|
23
|
-
|
|
23
|
+
pages: {
|
|
24
24
|
default: typeof APIHandler;
|
|
25
25
|
excludeSchema?: any;
|
|
26
26
|
schema: any;
|
|
27
27
|
};
|
|
28
|
-
|
|
28
|
+
resourceServers: {
|
|
29
29
|
default: typeof APIHandler;
|
|
30
30
|
excludeSchema?: any;
|
|
31
31
|
schema: any;
|
|
32
32
|
};
|
|
33
|
-
|
|
33
|
+
clients: {
|
|
34
34
|
default: typeof APIHandler;
|
|
35
35
|
excludeSchema?: any;
|
|
36
36
|
schema: any;
|
|
37
37
|
};
|
|
38
|
-
|
|
38
|
+
branding: {
|
|
39
39
|
default: typeof APIHandler;
|
|
40
40
|
excludeSchema?: any;
|
|
41
41
|
schema: any;
|
|
@@ -45,87 +45,97 @@ declare const _default: {
|
|
|
45
45
|
excludeSchema?: any;
|
|
46
46
|
schema: any;
|
|
47
47
|
};
|
|
48
|
-
|
|
48
|
+
roles: {
|
|
49
49
|
default: typeof APIHandler;
|
|
50
50
|
excludeSchema?: any;
|
|
51
51
|
schema: any;
|
|
52
52
|
};
|
|
53
|
-
|
|
53
|
+
prompts: {
|
|
54
54
|
default: typeof APIHandler;
|
|
55
55
|
excludeSchema?: any;
|
|
56
56
|
schema: any;
|
|
57
57
|
};
|
|
58
|
-
|
|
58
|
+
attackProtection: {
|
|
59
59
|
default: typeof APIHandler;
|
|
60
60
|
excludeSchema?: any;
|
|
61
61
|
schema: any;
|
|
62
62
|
};
|
|
63
|
-
|
|
63
|
+
clientGrants: {
|
|
64
64
|
default: typeof APIHandler;
|
|
65
65
|
excludeSchema?: any;
|
|
66
66
|
schema: any;
|
|
67
67
|
};
|
|
68
|
-
|
|
68
|
+
customDomains: {
|
|
69
69
|
default: typeof APIHandler;
|
|
70
70
|
excludeSchema?: any;
|
|
71
71
|
schema: any;
|
|
72
72
|
};
|
|
73
|
-
|
|
73
|
+
databases: {
|
|
74
74
|
default: typeof APIHandler;
|
|
75
75
|
excludeSchema?: any;
|
|
76
76
|
schema: any;
|
|
77
77
|
};
|
|
78
|
-
|
|
78
|
+
emailProvider: {
|
|
79
79
|
default: typeof APIHandler;
|
|
80
80
|
excludeSchema?: any;
|
|
81
81
|
schema: any;
|
|
82
82
|
};
|
|
83
|
-
|
|
83
|
+
emailTemplates: {
|
|
84
84
|
default: typeof APIHandler;
|
|
85
85
|
excludeSchema?: any;
|
|
86
86
|
schema: any;
|
|
87
87
|
};
|
|
88
|
-
|
|
88
|
+
guardianFactorProviders: {
|
|
89
89
|
default: typeof APIHandler;
|
|
90
90
|
excludeSchema?: any;
|
|
91
91
|
schema: any;
|
|
92
92
|
};
|
|
93
|
-
|
|
93
|
+
guardianFactors: {
|
|
94
94
|
default: typeof APIHandler;
|
|
95
95
|
excludeSchema?: any;
|
|
96
96
|
schema: any;
|
|
97
97
|
};
|
|
98
|
-
|
|
98
|
+
guardianFactorTemplates: {
|
|
99
99
|
default: typeof APIHandler;
|
|
100
100
|
excludeSchema?: any;
|
|
101
101
|
schema: any;
|
|
102
102
|
};
|
|
103
|
-
|
|
103
|
+
guardianPhoneFactorMessageTypes: {
|
|
104
104
|
default: typeof APIHandler;
|
|
105
105
|
excludeSchema?: any;
|
|
106
106
|
schema: any;
|
|
107
107
|
};
|
|
108
|
-
|
|
108
|
+
guardianPhoneFactorSelectedProvider: {
|
|
109
109
|
default: typeof APIHandler;
|
|
110
110
|
excludeSchema?: any;
|
|
111
111
|
schema: any;
|
|
112
112
|
};
|
|
113
|
-
|
|
113
|
+
guardianPolicies: {
|
|
114
114
|
default: typeof APIHandler;
|
|
115
115
|
excludeSchema?: any;
|
|
116
116
|
schema: any;
|
|
117
117
|
};
|
|
118
|
-
|
|
118
|
+
logStreams: {
|
|
119
119
|
default: typeof APIHandler;
|
|
120
120
|
excludeSchema?: any;
|
|
121
121
|
schema: any;
|
|
122
122
|
};
|
|
123
|
-
|
|
123
|
+
migrations: {
|
|
124
124
|
default: typeof APIHandler;
|
|
125
125
|
excludeSchema?: any;
|
|
126
126
|
schema: any;
|
|
127
127
|
};
|
|
128
|
-
|
|
128
|
+
organizations: {
|
|
129
|
+
default: typeof APIHandler;
|
|
130
|
+
excludeSchema?: any;
|
|
131
|
+
schema: any;
|
|
132
|
+
};
|
|
133
|
+
rulesConfigs: {
|
|
134
|
+
default: typeof APIHandler;
|
|
135
|
+
excludeSchema?: any;
|
|
136
|
+
schema: any;
|
|
137
|
+
};
|
|
138
|
+
tenant: {
|
|
129
139
|
default: typeof APIHandler;
|
|
130
140
|
excludeSchema?: any;
|
|
131
141
|
schema: any;
|
|
@@ -51,6 +51,7 @@ const triggers = __importStar(require("./triggers"));
|
|
|
51
51
|
const organizations = __importStar(require("./organizations"));
|
|
52
52
|
const attackProtection = __importStar(require("./attackProtection"));
|
|
53
53
|
const logStreams = __importStar(require("./logStreams"));
|
|
54
|
+
const customDomains = __importStar(require("./customDomains"));
|
|
54
55
|
const auth0ApiHandlers = {
|
|
55
56
|
rules,
|
|
56
57
|
rulesConfigs,
|
|
@@ -80,5 +81,6 @@ const auth0ApiHandlers = {
|
|
|
80
81
|
organizations,
|
|
81
82
|
attackProtection,
|
|
82
83
|
logStreams,
|
|
84
|
+
customDomains,
|
|
83
85
|
};
|
|
84
86
|
exports.default = auth0ApiHandlers; // TODO: apply stronger types to schema properties
|
|
@@ -1,11 +1,49 @@
|
|
|
1
1
|
import DefaultHandler from './default';
|
|
2
|
-
import {
|
|
2
|
+
import { Assets, Language } from '../../../types';
|
|
3
|
+
declare const promptScreenTypes: readonly ["login", "login-id", "login-password", "login-email-verification", "signup", "signup-id", "signup-password", "reset-password", "consent", "mfa-push", "mfa-otp", "mfa-voice", "mfa-phone", "mfa-webauthn", "mfa-sms", "mfa-email", "mfa-recovery-code", "mfa", "status", "device-flow", "email-verification", "email-otp-challenge", "organizations", "invitation", "common"];
|
|
3
4
|
export declare const schema: {
|
|
4
5
|
type: string;
|
|
6
|
+
properties: {
|
|
7
|
+
universal_login_experience: {
|
|
8
|
+
type: string;
|
|
9
|
+
enum: string[];
|
|
10
|
+
};
|
|
11
|
+
webauthn_platform_first_factor: {
|
|
12
|
+
type: string;
|
|
13
|
+
};
|
|
14
|
+
identifier_first: {
|
|
15
|
+
type: string;
|
|
16
|
+
};
|
|
17
|
+
customText: {
|
|
18
|
+
type: string;
|
|
19
|
+
properties: {};
|
|
20
|
+
};
|
|
21
|
+
};
|
|
5
22
|
};
|
|
23
|
+
export declare type PromptScreenTypes = typeof promptScreenTypes[number];
|
|
24
|
+
export declare type PromptSettings = {
|
|
25
|
+
universal_login_experience?: 'new' | 'classic';
|
|
26
|
+
webauthn_platform_first_factor?: boolean;
|
|
27
|
+
identifier_first?: boolean;
|
|
28
|
+
};
|
|
29
|
+
export declare type PromptsCustomText = {
|
|
30
|
+
[key in PromptScreenTypes]: {
|
|
31
|
+
[key: string]: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export declare type Prompts = Partial<PromptSettings & {
|
|
35
|
+
customText: AllPromptsByLanguage;
|
|
36
|
+
}>;
|
|
37
|
+
export declare type AllPromptsByLanguage = Partial<{
|
|
38
|
+
[key in Language]: Partial<PromptsCustomText>;
|
|
39
|
+
}>;
|
|
6
40
|
export default class PromptsHandler extends DefaultHandler {
|
|
7
|
-
existing:
|
|
41
|
+
existing: Prompts;
|
|
8
42
|
constructor(options: DefaultHandler);
|
|
9
|
-
|
|
43
|
+
objString({ customText }: Prompts): string;
|
|
44
|
+
getType(): Promise<Prompts | null>;
|
|
45
|
+
getCustomTextSettings(): Promise<AllPromptsByLanguage>;
|
|
10
46
|
processChanges(assets: Assets): Promise<void>;
|
|
47
|
+
updateCustomTextSettings(customText: Prompts['customText']): Promise<void>;
|
|
11
48
|
}
|
|
49
|
+
export {};
|
|
@@ -8,46 +8,166 @@ 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
|
};
|
|
14
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
26
|
exports.schema = void 0;
|
|
16
|
-
//@ts-nocheck because prompts haven't been fully implemented in this codebase yet
|
|
17
27
|
const default_1 = __importDefault(require("./default"));
|
|
18
|
-
|
|
28
|
+
const types_1 = require("../../../types");
|
|
29
|
+
const lodash_1 = require("lodash");
|
|
30
|
+
const promptScreenTypes = [
|
|
31
|
+
'login',
|
|
32
|
+
'login-id',
|
|
33
|
+
'login-password',
|
|
34
|
+
'login-email-verification',
|
|
35
|
+
'signup',
|
|
36
|
+
'signup-id',
|
|
37
|
+
'signup-password',
|
|
38
|
+
'reset-password',
|
|
39
|
+
'consent',
|
|
40
|
+
'mfa-push',
|
|
41
|
+
'mfa-otp',
|
|
42
|
+
'mfa-voice',
|
|
43
|
+
'mfa-phone',
|
|
44
|
+
'mfa-webauthn',
|
|
45
|
+
'mfa-sms',
|
|
46
|
+
'mfa-email',
|
|
47
|
+
'mfa-recovery-code',
|
|
48
|
+
'mfa',
|
|
49
|
+
'status',
|
|
50
|
+
'device-flow',
|
|
51
|
+
'email-verification',
|
|
52
|
+
'email-otp-challenge',
|
|
53
|
+
'organizations',
|
|
54
|
+
'invitation',
|
|
55
|
+
'common',
|
|
56
|
+
];
|
|
57
|
+
exports.schema = {
|
|
58
|
+
type: 'object',
|
|
59
|
+
properties: {
|
|
60
|
+
universal_login_experience: {
|
|
61
|
+
type: 'string',
|
|
62
|
+
enum: ['new', 'classic'],
|
|
63
|
+
},
|
|
64
|
+
webauthn_platform_first_factor: {
|
|
65
|
+
type: 'boolean',
|
|
66
|
+
},
|
|
67
|
+
identifier_first: {
|
|
68
|
+
type: 'boolean',
|
|
69
|
+
},
|
|
70
|
+
customText: {
|
|
71
|
+
type: 'object',
|
|
72
|
+
properties: types_1.languages.reduce((acc, language) => {
|
|
73
|
+
return Object.assign(Object.assign({}, acc), { [language]: {
|
|
74
|
+
type: 'object',
|
|
75
|
+
properties: promptScreenTypes.reduce((acc, screenType) => {
|
|
76
|
+
return Object.assign(Object.assign({}, acc), { [screenType]: {
|
|
77
|
+
type: 'object',
|
|
78
|
+
} });
|
|
79
|
+
}, {}),
|
|
80
|
+
} });
|
|
81
|
+
}, {}),
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
};
|
|
19
85
|
class PromptsHandler extends default_1.default {
|
|
20
86
|
constructor(options) {
|
|
21
87
|
super(Object.assign(Object.assign({}, options), { type: 'prompts' }));
|
|
22
88
|
}
|
|
89
|
+
objString({ customText }) {
|
|
90
|
+
return `Prompts settings${!!customText ? ' and prompts custom text' : ''}`;
|
|
91
|
+
}
|
|
23
92
|
getType() {
|
|
24
93
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
94
|
+
const promptsSettings = yield this.client.prompts.getSettings();
|
|
95
|
+
const customText = yield this.getCustomTextSettings();
|
|
96
|
+
return Object.assign(Object.assign({}, promptsSettings), { customText });
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
getCustomTextSettings() {
|
|
100
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
+
const supportedLanguages = yield this.client.tenant
|
|
102
|
+
.getSettings()
|
|
103
|
+
.then(({ enabled_locales }) => enabled_locales);
|
|
104
|
+
const data = yield Promise.all(supportedLanguages.flatMap((language) => {
|
|
105
|
+
return promptScreenTypes.map((screenType) => {
|
|
106
|
+
return this.client.prompts
|
|
107
|
+
.getCustomTextByLanguage({
|
|
108
|
+
prompt: screenType,
|
|
109
|
+
language,
|
|
110
|
+
})
|
|
111
|
+
.then((customTextData) => {
|
|
112
|
+
if ((0, lodash_1.isEmpty)(customTextData))
|
|
113
|
+
return null;
|
|
114
|
+
return Object.assign({ language }, customTextData);
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
})).then((customTextData) => {
|
|
118
|
+
return customTextData
|
|
119
|
+
.filter((customTextData) => {
|
|
120
|
+
return customTextData !== null;
|
|
121
|
+
})
|
|
122
|
+
.reduce((acc, customTextItem) => {
|
|
123
|
+
if ((customTextItem === null || customTextItem === void 0 ? void 0 : customTextItem.language) === undefined)
|
|
124
|
+
return acc;
|
|
125
|
+
const { language } = customTextItem, customTextSettings = __rest(customTextItem, ["language"]);
|
|
126
|
+
return Object.assign(Object.assign({}, acc), { [language]: !!acc[language]
|
|
127
|
+
? Object.assign(Object.assign({}, acc[language]), customTextSettings) : Object.assign({}, customTextSettings) });
|
|
128
|
+
}, {});
|
|
129
|
+
});
|
|
130
|
+
return data;
|
|
39
131
|
});
|
|
40
132
|
}
|
|
41
133
|
processChanges(assets) {
|
|
42
134
|
return __awaiter(this, void 0, void 0, function* () {
|
|
43
135
|
const { prompts } = assets;
|
|
44
|
-
|
|
45
|
-
if (!prompts || !Object.keys(prompts).length)
|
|
136
|
+
if (!prompts)
|
|
46
137
|
return;
|
|
47
|
-
|
|
138
|
+
const { customText } = prompts, promptSettings = __rest(prompts, ["customText"]);
|
|
139
|
+
if (!(0, lodash_1.isEmpty)(promptSettings)) {
|
|
140
|
+
yield this.client.prompts.updateSettings({}, promptSettings);
|
|
141
|
+
}
|
|
142
|
+
yield this.updateCustomTextSettings(customText);
|
|
48
143
|
this.updated += 1;
|
|
49
144
|
this.didUpdate(prompts);
|
|
50
145
|
});
|
|
51
146
|
}
|
|
147
|
+
updateCustomTextSettings(customText) {
|
|
148
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
149
|
+
/*
|
|
150
|
+
Note: deletes are not currently supported
|
|
151
|
+
*/
|
|
152
|
+
if (!customText)
|
|
153
|
+
return;
|
|
154
|
+
yield Promise.all(Object.keys(customText).flatMap((language) => {
|
|
155
|
+
const languageScreenTypes = customText[language];
|
|
156
|
+
if (!languageScreenTypes)
|
|
157
|
+
return [];
|
|
158
|
+
return Object.keys(languageScreenTypes).map((prompt) => {
|
|
159
|
+
const body = languageScreenTypes[prompt];
|
|
160
|
+
return this.client.prompts.updateCustomTextByLanguage({
|
|
161
|
+
prompt,
|
|
162
|
+
language,
|
|
163
|
+
//@ts-ignore
|
|
164
|
+
body: {
|
|
165
|
+
[prompt]: languageScreenTypes[prompt],
|
|
166
|
+
} || {},
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
}));
|
|
170
|
+
});
|
|
171
|
+
}
|
|
52
172
|
}
|
|
53
173
|
exports.default = PromptsHandler;
|
|
@@ -175,8 +175,8 @@ class RulesHandler extends default_1.default {
|
|
|
175
175
|
yield this.client.pool
|
|
176
176
|
.addEachTask({
|
|
177
177
|
data: changes.reOrder,
|
|
178
|
-
generator: (rule) => this.client
|
|
179
|
-
.
|
|
178
|
+
generator: (rule) => this.client.rules
|
|
179
|
+
.update({ id: rule.id }, (0, utils_1.stripFields)(rule, this.stripUpdateFields))
|
|
180
180
|
.then(() => {
|
|
181
181
|
const updated = {
|
|
182
182
|
name: rule.name,
|
package/lib/tools/constants.d.ts
CHANGED
package/lib/tools/constants.js
CHANGED
package/lib/tools/index.d.ts
CHANGED
|
@@ -73,6 +73,8 @@ declare const _default: {
|
|
|
73
73
|
EMAIL_TEMPLATES_NAMES: string[];
|
|
74
74
|
SUPPORTED_BRANDING_TEMPLATES: string[];
|
|
75
75
|
LOG_STREAMS_DIRECTORY: string;
|
|
76
|
+
PROMPTS_DIRECTORY: string;
|
|
77
|
+
CUSTOM_DOMAINS_DIRECTORY: string;
|
|
76
78
|
};
|
|
77
79
|
deploy: typeof deploy;
|
|
78
80
|
keywordReplace: typeof keywordReplace;
|
package/lib/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PromptScreenTypes, Prompts, PromptsCustomText, PromptSettings } from './tools/auth0/handlers/prompts';
|
|
1
2
|
declare type SharedPaginationParams = {
|
|
2
3
|
checkpoint?: boolean;
|
|
3
4
|
paginate?: boolean;
|
|
@@ -126,9 +127,20 @@ export declare type BaseAuth0APIClient = {
|
|
|
126
127
|
get: (arg0: Asset) => Promise<Asset>;
|
|
127
128
|
};
|
|
128
129
|
};
|
|
129
|
-
prompts:
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
prompts: {
|
|
131
|
+
updateCustomTextByLanguage: (arg0: {
|
|
132
|
+
prompt: PromptScreenTypes;
|
|
133
|
+
language: Language;
|
|
134
|
+
body: {
|
|
135
|
+
[key: string]: string;
|
|
136
|
+
};
|
|
137
|
+
}) => Promise<void>;
|
|
138
|
+
getCustomTextByLanguage: (arg0: {
|
|
139
|
+
prompt: PromptScreenTypes;
|
|
140
|
+
language: Language;
|
|
141
|
+
}) => Promise<Partial<PromptsCustomText>>;
|
|
142
|
+
getSettings: () => Promise<PromptSettings>;
|
|
143
|
+
updateSettings: (arg0: {}, arg1: Partial<PromptSettings>) => Promise<void>;
|
|
132
144
|
};
|
|
133
145
|
resourceServers: APIClientBaseFunctions;
|
|
134
146
|
roles: APIClientBaseFunctions & {
|
|
@@ -150,15 +162,14 @@ export declare type BaseAuth0APIClient = {
|
|
|
150
162
|
getAll: () => Promise<Asset[]>;
|
|
151
163
|
};
|
|
152
164
|
tenant: APIClientBaseFunctions & {
|
|
153
|
-
getSettings: () => Promise<Asset
|
|
165
|
+
getSettings: () => Promise<Asset & {
|
|
166
|
+
enabled_locales: Language[];
|
|
167
|
+
}>;
|
|
154
168
|
updateSettings: (arg0: Asset) => Promise<void>;
|
|
155
169
|
};
|
|
156
170
|
triggers: APIClientBaseFunctions & {
|
|
157
171
|
getTriggerBindings: () => Promise<Asset>;
|
|
158
172
|
};
|
|
159
|
-
updateRule: (arg0: {
|
|
160
|
-
id: string;
|
|
161
|
-
}, arg1: Asset) => Promise<Asset>;
|
|
162
173
|
};
|
|
163
174
|
export declare type Auth0APIClient = BaseAuth0APIClient & {
|
|
164
175
|
pool: {
|
|
@@ -220,6 +231,7 @@ export declare type Assets = Partial<{
|
|
|
220
231
|
clients: Asset[] | null;
|
|
221
232
|
clientGrants: Asset[] | null;
|
|
222
233
|
connections: Asset[] | null;
|
|
234
|
+
customDomains: Asset[] | null;
|
|
223
235
|
databases: Asset[] | null;
|
|
224
236
|
emailProvider: Asset | null;
|
|
225
237
|
emailTemplates: Asset[] | null;
|
|
@@ -238,6 +250,7 @@ export declare type Assets = Partial<{
|
|
|
238
250
|
migrations: Asset[] | null;
|
|
239
251
|
organizations: Asset[] | null;
|
|
240
252
|
pages: Asset[] | null;
|
|
253
|
+
prompts: Prompts | null;
|
|
241
254
|
resourceServers: Asset[] | null;
|
|
242
255
|
roles: Asset[] | null;
|
|
243
256
|
rules: Asset[] | null;
|
|
@@ -255,11 +268,13 @@ export declare type CalculatedChanges = {
|
|
|
255
268
|
conflicts: Asset[];
|
|
256
269
|
create: Asset[];
|
|
257
270
|
};
|
|
258
|
-
export declare type AssetTypes = 'rules' | 'rulesConfigs' | 'hooks' | 'pages' | 'databases' | 'clientGrants' | 'resourceServers' | 'clients' | 'connections' | 'tenant' | 'emailProvider' | 'emailTemplates' | 'guardianFactors' | 'guardianFactorProviders' | 'guardianFactorTemplates' | 'migrations' | 'guardianPhoneFactorMessageTypes' | 'guardianPhoneFactorSelectedProvider' | 'guardianPolicies' | 'roles' | 'actions' | 'organizations' | 'triggers' | 'attackProtection' | 'branding' | 'logStreams';
|
|
271
|
+
export declare type AssetTypes = 'rules' | 'rulesConfigs' | 'hooks' | 'pages' | 'databases' | 'clientGrants' | 'resourceServers' | 'clients' | 'connections' | 'tenant' | 'emailProvider' | 'emailTemplates' | 'guardianFactors' | 'guardianFactorProviders' | 'guardianFactorTemplates' | 'migrations' | 'guardianPhoneFactorMessageTypes' | 'guardianPhoneFactorSelectedProvider' | 'guardianPolicies' | 'roles' | 'actions' | 'organizations' | 'triggers' | 'attackProtection' | 'branding' | 'logStreams' | 'prompts' | 'customDomains';
|
|
259
272
|
export declare type KeywordMappings = {
|
|
260
273
|
[key: string]: (string | number)[] | string | number;
|
|
261
274
|
};
|
|
262
275
|
export declare type ParsedAsset<Key extends AssetTypes, T> = {
|
|
263
276
|
[key in Key]: T | null;
|
|
264
277
|
};
|
|
278
|
+
export declare const languages: readonly ["ar", "bg", "bs", "cs", "da", "de", "el", "en", "es", "et", "fi", "fr", "fr-CA", "fr-FR", "he", "hi", "hr", "hu", "id", "is", "it", "ja", "ko", "lt", "lv", "nb", "nl", "pl", "pt", "pt-BR", "pt-PT", "ro", "ru", "sk", "sl", "sr", "sv", "th", "tr", "uk", "vi", "zh-CN", "zh-TW"];
|
|
279
|
+
export declare type Language = typeof languages[number];
|
|
265
280
|
export {};
|
package/lib/types.js
CHANGED
|
@@ -1,2 +1,48 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.languages = void 0;
|
|
4
|
+
exports.languages = [
|
|
5
|
+
'ar',
|
|
6
|
+
'bg',
|
|
7
|
+
'bs',
|
|
8
|
+
'cs',
|
|
9
|
+
'da',
|
|
10
|
+
'de',
|
|
11
|
+
'el',
|
|
12
|
+
'en',
|
|
13
|
+
'es',
|
|
14
|
+
'et',
|
|
15
|
+
'fi',
|
|
16
|
+
'fr',
|
|
17
|
+
'fr-CA',
|
|
18
|
+
'fr-FR',
|
|
19
|
+
'he',
|
|
20
|
+
'hi',
|
|
21
|
+
'hr',
|
|
22
|
+
'hu',
|
|
23
|
+
'id',
|
|
24
|
+
'is',
|
|
25
|
+
'it',
|
|
26
|
+
'ja',
|
|
27
|
+
'ko',
|
|
28
|
+
'lt',
|
|
29
|
+
'lv',
|
|
30
|
+
'nb',
|
|
31
|
+
'nl',
|
|
32
|
+
'pl',
|
|
33
|
+
'pt',
|
|
34
|
+
'pt-BR',
|
|
35
|
+
'pt-PT',
|
|
36
|
+
'ro',
|
|
37
|
+
'ru',
|
|
38
|
+
'sk',
|
|
39
|
+
'sl',
|
|
40
|
+
'sr',
|
|
41
|
+
'sv',
|
|
42
|
+
'th',
|
|
43
|
+
'tr',
|
|
44
|
+
'uk',
|
|
45
|
+
'vi',
|
|
46
|
+
'zh-CN',
|
|
47
|
+
'zh-TW',
|
|
48
|
+
];
|
package/lib/utils.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export declare function stripIdentifiers(auth0: Auth0, assets: Assets): {
|
|
|
21
21
|
clients?: Asset[] | null | undefined;
|
|
22
22
|
clientGrants?: Asset[] | null | undefined;
|
|
23
23
|
connections?: Asset[] | null | undefined;
|
|
24
|
+
customDomains?: Asset[] | null | undefined;
|
|
24
25
|
databases?: Asset[] | null | undefined;
|
|
25
26
|
emailProvider?: Asset | null | undefined;
|
|
26
27
|
emailTemplates?: Asset[] | null | undefined;
|
|
@@ -39,6 +40,53 @@ export declare function stripIdentifiers(auth0: Auth0, assets: Assets): {
|
|
|
39
40
|
migrations?: Asset[] | null | undefined;
|
|
40
41
|
organizations?: Asset[] | null | undefined;
|
|
41
42
|
pages?: Asset[] | null | undefined;
|
|
43
|
+
prompts?: Partial<import("./tools/auth0/handlers/prompts").PromptSettings & {
|
|
44
|
+
customText: Partial<{
|
|
45
|
+
id: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
46
|
+
ar: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
47
|
+
bg: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
48
|
+
bs: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
49
|
+
cs: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
50
|
+
da: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
51
|
+
de: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
52
|
+
el: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
53
|
+
en: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
54
|
+
es: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
55
|
+
et: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
56
|
+
fi: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
57
|
+
fr: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
58
|
+
"fr-CA": Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
59
|
+
"fr-FR": Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
60
|
+
he: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
61
|
+
hi: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
62
|
+
hr: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
63
|
+
hu: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
64
|
+
is: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
65
|
+
it: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
66
|
+
ja: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
67
|
+
ko: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
68
|
+
lt: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
69
|
+
lv: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
70
|
+
nb: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
71
|
+
nl: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
72
|
+
pl: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
73
|
+
pt: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
74
|
+
"pt-BR": Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
75
|
+
"pt-PT": Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
76
|
+
ro: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
77
|
+
ru: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
78
|
+
sk: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
79
|
+
sl: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
80
|
+
sr: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
81
|
+
sv: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
82
|
+
th: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
83
|
+
tr: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
84
|
+
uk: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
85
|
+
vi: Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
86
|
+
"zh-CN": Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
87
|
+
"zh-TW": Partial<import("./tools/auth0/handlers/prompts").PromptsCustomText>;
|
|
88
|
+
}>;
|
|
89
|
+
}> | null | undefined;
|
|
42
90
|
resourceServers?: Asset[] | null | undefined;
|
|
43
91
|
roles?: Asset[] | null | undefined;
|
|
44
92
|
rules?: Asset[] | null | undefined;
|